Skip to contentSkip to conversation

Input: gpio-keys - Add shutdown callback

PATCH In review Florian Fainelli 2 participants 3 messages Feb 1, 2019 – Feb 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: gpio-keys - Add shutdown callback

On some platforms (e.g.: ARCH_BRCMSTB) it is possible to enter "poweroff" while leaving some wake-up sources enabled such as key presses in order to allow for the system to wake-up.

Wire up a .shutdown() callback which calls into the existing gpio_keys_suspend() since the logic is essentially the same.

---
 drivers/input/keyboard/gpio_keys.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/input/keyboard/gpio_keys.c +10 -0
index 492a971b95b5..6cd199e8a370 100644
@@ -1015,8 +1015,18 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
 
+static void gpio_keys_shutdown(struct platform_device *pdev)
+{
+	int ret;
+
+	ret = gpio_keys_suspend(&pdev->dev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to shutdown\n");
+}
+
 static struct platform_driver gpio_keys_device_driver = {
 	.probe		= gpio_keys_probe,
+	.shutdown	= gpio_keys_shutdown,
 	.driver		= {
 		.name	= "gpio-keys",
 		.pm	= &gpio_keys_pm_ops,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 11 lines · Florian Fainelli

On some platforms (e.g.: ARCH_BRCMSTB) it is possible to enter "poweroff" while leaving some wake-up sources enabled such as key presses in order to allow for the system to wake-up.

Wire up a .shutdown() callback which calls into the existing gpio_keys_suspend() since the logic is essentially the same.

---
 drivers/input/keyboard/gpio_keys.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Any feedback on this?

Quoted 25 lines
drivers/input/keyboard/gpio_keys.c +10 -0
index 492a971b95b5..6cd199e8a370 100644
@@ -1015,8 +1015,18 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
 
+static void gpio_keys_shutdown(struct platform_device *pdev)
+{
+	int ret;
+
+	ret = gpio_keys_suspend(&pdev->dev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to shutdown\n");
+}
+
 static struct platform_driver gpio_keys_device_driver = {
 	.probe		= gpio_keys_probe,
+	.shutdown	= gpio_keys_shutdown,
 	.driver		= {
 		.name	= "gpio-keys",
 		.pm	= &gpio_keys_pm_ops,
Signature · 1 line
Florian
maintainer
#2 lore raw
Quoted 8 lines · Florian Fainelli
Quoted 7 lines · Florian Fainelli

On some platforms (e.g.: ARCH_BRCMSTB) it is possible to enter "poweroff" while leaving some wake-up sources enabled such as key presses in order to allow for the system to wake-up.

Wire up a .shutdown() callback which calls into the existing gpio_keys_suspend() since the logic is essentially the same.

Quoted 6 lines
Quoted 4 lines
---
 drivers/input/keyboard/gpio_keys.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Any feedback on this?

OK, I'll take it. Hopefully it won't affect existing systems as the change is unconditional.

Thanks.

Signature · 1 line
Dmitry