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:  
"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`  
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:  
  - `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 {
    ```  
    
 - 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
    ```   

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/8593581f-3981-4e3d-ad88-d7c4a6cbc39bn%40googlegroups.com.

Reply via email to