Disable Power Button IRQ from TPS65217 on BBBW?

65 views
Skip to first unread message

Joe Glandorf

unread,
Oct 28, 2020, 7:46:13 AM10/28/20
to BeagleBoard
If I just tap the power button on the BBBW, 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:  
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`  
The image is from https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Buster_LXQt_Snapshot , as it works with the LCD out-of-the-box.  

  - start with RCN's DT repo:  
  - `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 {
    ```  
    
 - 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
    ```   

Joe Glandorf

unread,
Oct 28, 2020, 1:26:52 PM10/28/20
to BeagleBoard
Added another test, below (without success), and also posted this to https://forum.digikey.com/t/disable-power-button-irq-from-tps65217-on-bbbw/9803  
    
  - 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
    ```   


Robert Nelson

unread,
Oct 28, 2020, 1:44:11 PM10/28/20
to Beagle Board
You can disable teh cape universal redirect with disabling this line
in /boot/uEnv.txt

enable_uboot_overlays=1

You can also just not build with the tps65218-pwrbutton driver:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/input/misc/tps65218-pwrbutton.c

Regards,

--
Robert Nelson
https://rcn-ee.com/

Joe Glandorf

unread,
Oct 29, 2020, 6:37:32 PM10/29/20
to BeagleBoard
Thanks, Robert.  Unfortunately, commenting out either line in uEnv.txt, 
`#enable_uboot_overlays=1` or 
`#enable_uboot_cape_universal=1`
the TPS65217 IRQ still exists:  
$ cat /proc/interrupts | grep 65217
 60:          0      INTC   7 Level     tps65217-irq
 62:          0  tps65217   0 Edge      vbus
 63:          0  tps65217   2 Edge      tps65217_pwr_but
And, PWM no longer works using the Python scripts, even after restoring the original dtb files.

Is this the appropriate information source for building the kernel?  
We're currently using this lxqt image for the BBBW:  

Joe

Robert Nelson

unread,
Oct 29, 2020, 6:43:46 PM10/29/20
to Beagle Board
On Thu, Oct 29, 2020 at 5:37 PM Joe Glandorf <jgla...@gmail.com> wrote:
>
> Thanks, Robert. Unfortunately, commenting out either line in uEnv.txt,
> `#enable_uboot_overlays=1` or
> `#enable_uboot_cape_universal=1`
> the TPS65217 IRQ still exists:
> $ cat /proc/interrupts | grep 65217
> 60: 0 INTC 7 Level tps65217-irq
> 62: 0 tps65217 0 Edge vbus
> 63: 0 tps65217 2 Edge tps65217_pwr_but
> And, PWM no longer works using the Python scripts, even after restoring the original dtb files.

Correct, you'd have to enable pwm..

User cross posted here:

https://forum.digikey.com/t/disable-power-button-irq-from-tps65217-on-bbbw/9803/2

With the dtb hack to make tps65217_pwr_but disappear..

>
> Is this the appropriate information source for building the kernel?
> - https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-LinuxKernel
> We're currently using this lxqt image for the BBBW:
> - https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Buster_LXQt_Snapshot

Correct
Reply all
Reply to author
Forward
0 new messages