These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.12.y With the following command: git format-patch -N v6.12.27..HEAD (HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e) Exceptions: - (def)configs patches - github workflows patches - applied & reverted patches - readme patches - wireless patches Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
From fcfa5a981cc4b0e89210484abc7a2027873f937f Mon Sep 17 00:00:00 2001
|
|
From: Nick Bulleid <nedbulleid@fastmail.com>
|
|
Date: Thu, 10 May 2018 21:57:02 +0100
|
|
Subject: [PATCH] Add ability to export gpio used by gpio-poweroff
|
|
|
|
Signed-off-by: Nick Bulleid <nedbulleid@fastmail.com>
|
|
|
|
Added export feature to gpio-poweroff documentation
|
|
|
|
Signed-off-by: Nick Bulleid <nedbulleid@fastmail.com>
|
|
---
|
|
.../bindings/power/reset/gpio-poweroff.yaml | 4 ++++
|
|
drivers/power/reset/gpio-poweroff.c | 11 ++++++++++-
|
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
|
--- a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.yaml
|
|
+++ b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.yaml
|
|
@@ -50,6 +50,10 @@ properties:
|
|
default: 3000
|
|
description: Time to wait before assuming the power off sequence failed.
|
|
|
|
+ export:
|
|
+ type: boolean
|
|
+ description: Export the GPIO line to the sysfs system
|
|
+
|
|
required:
|
|
- compatible
|
|
- gpios
|
|
--- a/drivers/power/reset/gpio-poweroff.c
|
|
+++ b/drivers/power/reset/gpio-poweroff.c
|
|
@@ -55,6 +55,7 @@ static int gpio_poweroff_probe(struct pl
|
|
bool input = false;
|
|
enum gpiod_flags flags;
|
|
int priority = SYS_OFF_PRIO_DEFAULT;
|
|
+ bool export = false;
|
|
int ret;
|
|
|
|
gpio_poweroff = devm_kzalloc(&pdev->dev, sizeof(*gpio_poweroff), GFP_KERNEL);
|
|
@@ -86,10 +87,18 @@ static int gpio_poweroff_probe(struct pl
|
|
if (IS_ERR(gpio_poweroff->reset_gpio))
|
|
return PTR_ERR(gpio_poweroff->reset_gpio);
|
|
|
|
+ export = device_property_read_bool(&pdev->dev, "export");
|
|
+ if (export) {
|
|
+ gpiod_export(gpio_poweroff->reset_gpio, true);
|
|
+ gpiod_export_link(&pdev->dev, "poweroff-gpio", gpio_poweroff->reset_gpio);
|
|
+ }
|
|
+
|
|
ret = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF,
|
|
priority, gpio_poweroff_do_poweroff, gpio_poweroff);
|
|
- if (ret)
|
|
+ if (ret) {
|
|
+ gpiod_unexport(gpio_poweroff->reset_gpio);
|
|
return dev_err_probe(&pdev->dev, ret, "Cannot register poweroff handler\n");
|
|
+ }
|
|
|
|
return 0;
|
|
}
|