Power Button not working with Yocto

I’m just starting out with the Yocto Project for the BBB,

I’ve build core image base, minimal and full-cmdline without any customisation for the BBB.

The system boots up OK but I’ve noticed that the power button doesn’t respond. If the board is powered down via the “halt” or “shutdown” commands the power button still stays on as well.

Has anyone got any ideas or can point me in the right direction to get the power button to respond and the system to shutdown correctly.

I’m guessing I need to add drivers for the power IC, but not quite sure where to start.

Thanks

David

I am using yocto daisy 1.6.1, and tested the power button using the following tutorial:

http://www.clarenceho.net:8123/blog/articles/2013/09/14/using-the-power-button-on-beaglebone-black-for-shutdown

You have to apply a few patches to get this to work. I started with this:
https://github.com/beagleboard/meta-beagleboard/tree/master/common-bsp/recipes-kernel/linux/linux-mainline-3.8/pmic

And adapted it to the 3.14 kernel used by Yocto:
https://github.com/mzakharo/meta-yocto-bone/tree/master/recipes-kernel/linux/files/pmic

Hope this helps!

Thanks for you help.

The script got the button working, I get a system shutdown message on the console after pressing it. The power led still stays on and the SYS_RESTs pin is still high though.

I’m guessing the kernel patch didn’t work or more likely I didn’t apply it right.

I added the line ~/poky/meta-yocto-bone \ under BBLAYERS?= in the bblayers,conf file and rebuild the system with bitbake core-image-minimal. Is there anything else I need to do to patch the kernel?

Thanks for you help.

The script got the button working, I get a system shutdown message on the console after pressing it. The power led still stays on and the SYS_RESTs pin is still high though.

I’m guessing the kernel patch didn’t work or more likely I didn’t apply it right.

I added the line ~/poky/meta-yocto-bone \ under BBLAYERS?= in the bblayers,conf file and rebuild the system with bitbake core-image-minimal. Is there anything else I need to do to patch the kernel?

The problem has something to do with the register settings in the PMIC. Here is what I think is happening:

It looks like the BB Linux Kernel is configured to enter sleep mode when the command shutdown or halt is used. After a little investigation, here is the sequence after shutdown or halt:

kernel_power_off()
machine_power_off()
pm_power_off()
rtc_power_off() //Toggles PWR_EN pin

When the PMIC is in sleep mode, some of the regulators remain on which I believe is the issue some of the user are experiencing. Making the default state to OFF mode (same as pulling the power plug) and not SLEEP mode will probably be more suitable for most users. The solution is pretty simple:

The solution I have Robert was to add pmic-shutdown-controller as shown in
/Documentation/devicetree/bindings/regulator/tps65217.txt.

However, Robert added this into his kernel but this doesn’t seem to have fixed the issue. Here are some other references that might be helpful.

In /drivers/mfd/tps65217.c search for PWR_EN, the
comments “Set the PMIC to shutdown on PWR_EN toggle”

Reading “Power Down Sequence” on page 18 (TPS65217C TRM), this will initiate the power down sequence and leave the PMIC in OFF mode.

Ultimately, we probably need to look at the PMIC register setting just before toggling PWR_EN as this might explain why this is not working correctly.

Regards,
John