Disable Power Button IRQ from TPS65217 on BBBW?

(Also made this post here on the BB Google group.)
If I just tap the power button on the BeagleBone Black Wireless, it immediately begins the shutdown sequence. We need to avoid that behavior; it seems the way to do so is to disable the PB-state change IRQ (from the TPS65217 datasheet):
8.6.4 Interrupt Register (INT) (Address = 0x02) [reset = 0x80]
Bit 6: PBM R/W 0b = Interrupt is issued when PB status changes.
Bit 6: PBM R/W 1b = No interrupt is issued when PB status changes.
The bit is cleared:
i2cget -f -y 0 0x24 0x2
0x20
A similar post from 2017 didn’t really seem to have a resolution:
“Disabling PowerOff and Reset button” https://groups.google.com/g/beagleboard/c/4qv0osguaDI/m/0ITntryPAQAJ
I’ve followed a similar path, outlined in more detail below, without being able to disable the PB IRQ, either.
Thanks for any assistance.

The hardware is a BBBW with a 4D Systems gen4 cape and LCD.
$ uname -a
Linux beaglebone 4.19.94-ti-r43 #1buster SMP PREEMPT Wed Apr 22 06:11:16 UTC 2020 armv7l GNU/Linux

  • start with RCN’s DT repo:

  • git clone https://github.com/beagleboard/BeagleBoard-DeviceTrees

  • pushd ~/BeagleBoard-DeviceTrees

  • fgrep -rni . -e 'tps65217-pwrbutton'
    ./src/arm/tps65217.dtsi:27: compatible = "ti,tps65217-pwrbutton";

  • nano ./src/arm/tps65217.dtsi
    comment out the pwrbutton node

    /*
            pwrbutton {
                    compatible = "ti,tps65217-pwrbutton";
                    interrupts = <2>;
                    status = "disabled";
            };
    
    */
    
  • Note that it doesn’t matter if the above file is modified, or the one below, or both. In no case is the PB IRQ disabled.

  • edit the common BB file, am335x-bone-common.dtsi, to disable the pwrbutton

  • pushd ~/BeagleBoard-DeviceTrees

  • nano -l ./src/arm/am335x-bone-common.dtsi

  • the line to edit is ~365

  • change status from okay to disabled:

      pwrbutton {
              status = "disabled";
      };  
  • build the dtb files: make

  • back up the current dtb file, then copy the new dtb file

    debian@beaglebone:~/BeagleBoard-DeviceTrees$ sudo mv /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-wireless.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-wireless.bak.dtb
    debian@beaglebone:~/BeagleBoard-DeviceTrees$ sudo cp ./src/arm/am335x-boneblack-wireless.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-wireless.dtb   
    
  • Compare the resulting dtb file with the original:

  • the entire pwrbutton section commented out in tps65217.dtsi

  • pwrbutton set to disabled in am335x-bone-common.dtsi

```  
$ dtdiff /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-wireless.bak.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-wireless.dtb
--- /dev/fd/63  2020-10-28 02:56:38.720410323 +0000
+++ /dev/fd/62  2020-10-28 02:56:38.720410323 +0000
@@ -280,7 +280,7 @@

        chosen {
                base_dtb = "am335x-boneblack-wireless.dts";
-               base_dtb_timestamp = "Wed Apr 22 06:09:34 2020";
+               base_dtb_timestamp = "Tue Oct 27 19:48:20 2020";
                stdout-path = "/ocp/serial@44e09000";
        };

@@ -851,9 +851,7 @@
                                };

                                pwrbutton {
-                                       compatible = "ti,tps65217-pwrbutton";
-                                       interrupts = < 0x02 >;
-                                       status = "okay";
+                                       status = "disabled";
                                };

                                regulators {
```  
  • based on boot-up messages from serial port

     ...
    debug: [enable_uboot_cape_universal=1] ...
    debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] ...
    uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] ...
    uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb ...
    loading /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.dtb ...
     ...
    

    I copied am335x-boneblack-uboot-univ.dtb instead of am335x-boneblack-wireless.dtb (already built, above)

  • pushd ~/BeagleBoard-DeviceTrees

  • sudo mv /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.bak.dtb

  • sudo cp ./src/arm/am335x-boneblack-uboot-univ.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ

  • dtdiff /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.bak.dtb /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.dtb

  • verify no occurrences of pwr in the decompiled tree:
    - dtc -I dtb -O dts -o ./src.txt ./src/arm/am335x-boneblack-uboot-univ.dtb
    - nano src.txt

  • the tps65217_pwr_but IRQ is still present

  • check irq’s:
    $ cat /proc/interrupts | grep 65217

    142:          0      INTC   7 Level     tps65217-irq
    144:          0  tps65217   0 Edge      vbus
    145:          0  tps65217   2 Edge      tps65217_pwr_but
    

Hi @jglandorftecat, I got this to work:

debian@beaglebone:/opt/source/dtb-4.19-ti$ git diff
diff --git a/src/arm/am335x-bone-common.dtsi b/src/arm/am335x-bone-common.dtsi
index 8952fe1..28ff7bf 100644
--- a/src/arm/am335x-bone-common.dtsi
+++ b/src/arm/am335x-bone-common.dtsi
@@ -362,7 +362,7 @@
        };
 
        pwrbutton {
-               status = "okay";
+               status = "disabled";
        };
 
        regulators {
diff --git a/src/arm/tps65217.dtsi b/src/arm/tps65217.dtsi
index 399baaa..552d6b7 100644
--- a/src/arm/tps65217.dtsi
+++ b/src/arm/tps65217.dtsi
@@ -24,7 +24,7 @@
        };
 
        pwrbutton {
-               compatible = "ti,tps65217-pwrbutton";
+               compatible = "ti,tps65217-pwrbutton-disabled";
                interrupts = <2>;
                status = "disabled";
        };

Turns out the “status” of variable isn’t even read in the tps pwr button driver… So just play with the compatible string to disable it…

debian@beaglebone:/opt/source/dtb-4.19-ti$ cat /proc/interrupts | grep 65217
145:          2      INTC   7 Level     tps65217-irq
147:          2  tps65217   0 Edge      vbus
debian@beaglebone:/opt/source/dtb-4.19-ti$ dmesg | grep input
[    1.207975] eqep 48300180.eqep: swap_inputs:0
[    1.208446] eqep 48302180.eqep: swap_inputs:0
[    1.208847] eqep 48304180.eqep: swap_inputs:0

Regards,

Thanks, Robert! Will have to try it in the morning. Been getting up to speed on building the kernel, under Debian on WSL–it just got done a few minutes ago.

Thanks. That does indeed work.
–Joe