-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Support gpio-poweroff driver to allow switching off power #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks okay. Will add in next update. |
Fantastic! Thank you so much :) I'll be happy to test and report back when something is ready. |
kernel: Add rpi-ft5406 overlay Add rpi-ft5406 driver as module kernel: config: Enable 8250 serial port See: raspberrypi/linux#1008 kernel: config: Enable POWER_RESET_GPIO See: raspberrypi/linux#1031 firmware: arm_display: Fix fb_base alias returned from mailbox property interface See: raspberrypi/linux#1026 firmware: mem_unlock - prevent decrementing lock count below 0 firmware: camera: Support multi-channel raw image capture firmware: camera: write_raw copies input frame if HDR is enabled firmware: camera: Write correct camera mode from write_raw_md_stage firmware: AGC tuner: Correction to setting default digital gain to x1.0
kernel: Add rpi-ft5406 overlay Add rpi-ft5406 driver as module kernel: config: Enable 8250 serial port See: raspberrypi/linux#1008 kernel: config: Enable POWER_RESET_GPIO See: raspberrypi/linux#1031 firmware: arm_display: Fix fb_base alias returned from mailbox property interface See: raspberrypi/linux#1026 firmware: mem_unlock - prevent decrementing lock count below 0 firmware: camera: Support multi-channel raw image capture firmware: camera: write_raw copies input frame if HDR is enabled firmware: camera: Write correct camera mode from write_raw_md_stage firmware: AGC tuner: Correction to setting default digital gain to x1.0
Can you try rpi-update. The options should be in. |
@popcornmix Unfortunately no success yet, here is what I did.
Please see my thread in raspberrypi.org forum for details (link in original post above). I put an oscilloscope on GPIO 26 which I'm using as the power-off control signal. The pin goes high during boot when dt-blob.bin is loaded, but when I execute "shutdown -h now" or "poweroff" the pin remains high after the 'halt' state. (At the end of shutdown the Raspberry Pi green "disk activity" LED blinks a few times then stays off, while the red "power" LED stays on.) The overlay seems to be loaded as I have directory /proc/device-tree/soc/gpio/power_ctrl/ and files within, but I wonder if the fragment@0 is correct. How can I help to get it working? Thank you! |
The options you requested appear to be present:
@pelwell may have some ideas. |
Thanks. I have the same output on my system. Interesting that there is a config for LTC2952 which has some extra features compared to LTC2951 I am using. Seems like this should work. |
Good guess. I've commented on the thread. |
If I read this correctly, gpio-poweroff won't work because pm_power_off is already set in the platform file. arch/arm/mach-bcm2708/bcm2708.c void __init bcm2708_init(void)
{
...
pm_power_off = bcm2708_power_off; drivers/power/reset/gpio-poweroff.c static int gpio_poweroff_probe(struct platform_device *pdev)
{
bool input = false;
/* If a pm_power_off function has already been added, leave it alone */
if (pm_power_off != NULL) {
dev_err(&pdev->dev,
"%s: pm_power_off function already registered",
__func__);
return -EBUSY;
} |
@notro : @pelwell noted that it should replace the standard pm_power_off handler - please see here But as I've commented over in the thread, it's still not working... |
What does this return:
|
I've got it working (with caveats) - I'm writing a response for the Forum. |
And you were correct (of course) about the existing pm_power_off handler. |
Thread updated. Gist here: https://gist.github.com/pelwell/e4c5662c331fcae1e707 |
You could do: if (!force && pm_power_off != NULL) { |
Or just remove the whole if clause, since pm_power_off will always be set in our repo. |
I've pushed the patch to the rpi-4.0.y branch. It will be in the next firmware release. |
That's really excellent news. I will post a message here when I test it. Thank you! |
kernel: bcm2708-spi: Don't use static pin configuration with DT kernel: bcm2708-i2s: Don't use static pin configuration with DT kernel: gpio-poweroff: Allow it to work on Raspberry Pi See: raspberrypi/linux#1031 kernel: BCM270X_DT: Create a core clock, use it for SPI and sdhost kernel: BCM270X_DT: Add overlay to enable uart1 See: raspberrypi/linux#1008 kernel: config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING See: Hexxeh/rpi-firmware#85 firmware: arm_loader: Support initialising vchiq through mailbox property interface See: raspberrypi/linux#1026 firmware: drivers/usb: Reduce busy-wait to sensible timeout See: raspberrypi/linux#1026 firmware: video_encode: Initialise headers for video_bitrate See: #163 firmware: arm_loader: Use the new core_freq DT parameter if present firmware: arm_loader: Set the uart1_clkrate DT property from core_freq firmware: arm_cursor: Better handling of a second app requesting a cursor firmware: arm: Tidy up setting of arm_control and arm_bash
kernel: bcm2708-spi: Don't use static pin configuration with DT kernel: bcm2708-i2s: Don't use static pin configuration with DT kernel: gpio-poweroff: Allow it to work on Raspberry Pi See: raspberrypi/linux#1031 kernel: BCM270X_DT: Create a core clock, use it for SPI and sdhost kernel: BCM270X_DT: Add overlay to enable uart1 See: raspberrypi/linux#1008 kernel: config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING See: #85 firmware: arm_loader: Support initialising vchiq through mailbox property interface See: raspberrypi/linux#1026 firmware: drivers/usb: Reduce busy-wait to sensible timeout See: raspberrypi/linux#1026 firmware: video_encode: Initialise headers for video_bitrate See: raspberrypi/firmware#163 firmware: arm_loader: Use the new core_freq DT parameter if present firmware: arm_loader: Set the uart1_clkrate DT property from core_freq firmware: arm_cursor: Better handling of a second app requesting a cursor firmware: arm: Tidy up setting of arm_control and arm_bash
rpi-update firmware should contain @pelwell's patch |
It works perfectly! Thank you @popcornmix @pelwell @notro for all your help in adding this feature. No doubt a lot of people can make use of it. You guys are awesome! I think this issue can be marked closed. |
kernel: Add rpi-ft5406 overlay Add rpi-ft5406 driver as module kernel: config: Enable 8250 serial port See: raspberrypi/linux#1008 kernel: config: Enable POWER_RESET_GPIO See: raspberrypi/linux#1031 firmware: arm_display: Fix fb_base alias returned from mailbox property interface See: raspberrypi/linux#1026 firmware: mem_unlock - prevent decrementing lock count below 0 firmware: camera: Support multi-channel raw image capture firmware: camera: write_raw copies input frame if HDR is enabled firmware: camera: Write correct camera mode from write_raw_md_stage firmware: AGC tuner: Correction to setting default digital gain to x1.0
kernel: bcm2708-spi: Don't use static pin configuration with DT kernel: bcm2708-i2s: Don't use static pin configuration with DT kernel: gpio-poweroff: Allow it to work on Raspberry Pi See: raspberrypi/linux#1031 kernel: BCM270X_DT: Create a core clock, use it for SPI and sdhost kernel: BCM270X_DT: Add overlay to enable uart1 See: raspberrypi/linux#1008 kernel: config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING See: Hexxeh/rpi-firmware#85 firmware: arm_loader: Support initialising vchiq through mailbox property interface See: raspberrypi/linux#1026 firmware: drivers/usb: Reduce busy-wait to sensible timeout See: raspberrypi/linux#1026 firmware: video_encode: Initialise headers for video_bitrate See: raspberrypi#163 firmware: arm_loader: Use the new core_freq DT parameter if present firmware: arm_loader: Set the uart1_clkrate DT property from core_freq firmware: arm_cursor: Better handling of a second app requesting a cursor firmware: arm: Tidy up setting of arm_control and arm_bash
I tried to use the device tree GPIO binding gpio-poweroff to switch off power to the Raspberry Pi (via an on/off push-button controller) once the system reaches 'halt' state. Please see these links for info:
https://github.com/raspberrypi/linux/blob/rpi-4.0.y/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
and
https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=113789.
It did not work because the standard Raspberry Pi configurations do not include the gpio-poweroff driver which must be enabled using the POWER_RESET and POWER_RESET_GPIO flags. I would like to request these additions.
I believe this would be an excellent feature to have support for as it will allow the RPi to actually switch off the power to a system it is controlling once it reaches a shutdown state. Currently the RPi enters a low-power shutdown state, but circuitry controlling the power (and anything connected to it) remains on.
As the gpio-poweroff driver would only be enabled by a device tree overlay it will not cause any conflict/incompatibility with existing systems.
Thank you!
The text was updated successfully, but these errors were encountered: