power: reset: pwr-mlxbf: support graceful shutdown
Subsystems (2)
PATCH v2 1/1 power: reset: pwr-mlxbf: support graceful shutdown
The OCP board used a BlueField's GPIO pin for entering low power mode. That board was not commercialized and has been dropped from production so all its code is unused. The new hardware requirement is to trigger a graceful shutdown when that GPIO pin is toggled. So replace the unused low power mode with a graceful shutdown.
--- drivers/power/reset/pwr-mlxbf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/power/reset/pwr-mlxbf.c +3 -13
@@ -18,7 +18,6 @@struct pwr_mlxbf {struct work_struct reboot_work; -struct work_struct shutdown_work;const char *hid; };
@@ -27,22 +26,17 @@ static void pwr_mlxbf_reboot_work(struct work_struct *work)acpi_bus_generate_netlink_event ("button/reboot.*" ,"Reboot Button" ,0x80 ,1 ); } -static void pwr_mlxbf_shutdown_work (struct work_struct *work) -{ -acpi_bus_generate_netlink_event ("button/power.*" ,"Power Button" ,0x80 ,1 ); -} -static irqreturn_t pwr_mlxbf_irq (int irq,void *ptr) {const char *rst_pwr_hid ="MLNXBF24" ; -const char *low_pwr_hid ="MLNXBF29" ; +const char *shutdown_hid ="MLNXBF29" ;struct pwr_mlxbf *priv = ptr;if (!strncmp (priv->hid, rst_pwr_hid,8 ))schedule_work (&priv->reboot_work); -if (!strncmp (priv->hid, low_pwr_hid,8 )) -schedule_work (&priv->shutdown_work); +if (!strncmp (priv->hid, shutdown_hid,8 )) +orderly_poweroff (true);return IRQ_HANDLED ; }
@@ -70,10 +64,6 @@ static int pwr_mlxbf_probe(struct platform_device *pdev)if (irq <0 )return dev_err_probe (dev, irq,"Error getting %s irq.\n" , priv->hid); - err =devm_work_autocancel (dev, &priv->shutdown_work, pwr_mlxbf_shutdown_work); -if (err) -return err; - err =devm_work_autocancel (dev, &priv->reboot_work, pwr_mlxbf_reboot_work);if (err)return err;
Signature · 1 line
2.30.1
Hi Sebastian,
Did you get a chance to review this second patch?
Thank you!
Asmaa
Quoted 77 lines
-----Original Message-----
From: Asmaa Mnebhi <[email protected]>
Sent: Tuesday, June 11, 2024 9:43 AM
To: [email protected]; [email protected]; linux- [email protected]
Cc: Asmaa Mnebhi <[email protected]>; David Thompson <[email protected]>
Subject: [PATCH v2 1/1] power: reset: pwr-mlxbf: support graceful shutdownThe OCP board used a BlueField's GPIO pin for entering low power mode. That board was not commercialized and has been dropped from production so all its code is unused.
The new hardware requirement is to trigger a graceful shutdown when that GPIO pin is toggled. So replace the unused low power mode with a graceful shutdown.Signed-off-by Asmaa Mnebhi <[email protected]>Reviewed-by David Thompson <[email protected]>--- drivers/power/reset/pwr-mlxbf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)drivers/power/reset/pwr- renamed from drivers/power/reset/pwr-mlxbf.c +0
-0
mlxbf.cindex1775b318d0ef..4f1cd1c0018c100644drivers/power/reset/pwr-mlxbf.c +3
-12@@ -18,7 +18,6 @@struct pwr_mlxbf {struct work_struct reboot_work; -struct work_struct shutdown_work;const char *hid; };@@ -27,22 +26,17 @@ static void pwr_mlxbf_reboot_work(struct work_struct *work) acpi_bus_generate_netlink_event("button/reboot.*", "Reboot Button", 0x80, 1); } -static void pwr_mlxbf_shutdown_work(struct work_struct *work) -{ -acpi_bus_generate_netlink_event ("button/power.*" ,"Power Button", 0x80, 1); -} - static irqreturn_t pwr_mlxbf_irq(int irq, void *ptr) {const char *rst_pwr_hid ="MLNXBF24" ; -const char *low_pwr_hid ="MLNXBF29" ; +const char *shutdown_hid ="MLNXBF29" ;struct pwr_mlxbf *priv = ptr;if (!strncmp (priv->hid, rst_pwr_hid,8 ))schedule_work (&priv->reboot_work); -if (!strncmp (priv->hid, low_pwr_hid,8 )) -schedule_work (&priv->shutdown_work); +if (!strncmp (priv->hid, shutdown_hid,8 )) +orderly_poweroff (true);return IRQ_HANDLED ; }@@ -70,10 +64,6 @@ static int pwr_mlxbf_probe(struct platform_device *pdev)if (irq <0 )return dev_err_probe (dev, irq,"Error getting %s irq.\n" , priv- >hid); - err =devm_work_autocancel (dev, &priv->shutdown_work, pwr_mlxbf_shutdown_work); -if (err) -return err; -err = devm_work_autocancel(dev,
&priv->reboot_work,pwr_mlxbf_reboot_work);drivers/power/reset/pwr-mlxbf.c +0
-1if (err)return err; --2.30.1
Hello,
Kind reminder.
Thank you.
Asmaa
Quoted 97 lines
-----Original Message-----
From: Asmaa Mnebhi <[email protected]>
Sent: Friday, August 9, 2024 4:21 PM
To: [email protected]; [email protected]; linux- [email protected]
Cc: David Thompson <[email protected]>
Subject: RE: [PATCH v2 1/1] power: reset: pwr-mlxbf: support graceful shutdownHi Sebastian,
Did you get a chance to review this second patch?
Thank you!
AsmaaQuoted 10 lines
-----Original Message-----
From: Asmaa Mnebhi <[email protected]>
Sent: Tuesday, June 11, 2024 9:43 AM
To: [email protected]; [email protected]; linux- [email protected]
Cc: Asmaa Mnebhi <[email protected]>; David Thompson <[email protected]>
Subject: [PATCH v2 1/1] power: reset: pwr-mlxbf: support graceful shutdownQuoted 2 lines
The OCP board used a BlueField's GPIO pin for entering low power mode. That board was not commercialized and has been dropped from
production
Quoted 25 lines
so all its code is unused.
The new hardware requirement is to trigger a graceful shutdown when that GPIO pin is toggled. So replace the unused low power mode with a graceful shutdown.Signed-off-by Asmaa Mnebhi <[email protected]>Reviewed-by David Thompson <[email protected]>--- drivers/power/reset/pwr-mlxbf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)(quoted diff) +0
-0b/drivers/power/reset/pwr-
mlxbf.cindex1775b318d0ef..4f1cd1c0018c100644drivers/power/reset/pwr-mlxbf.c +0
-1@@ -18,7 +18,6 @@struct pwr_mlxbf {struct work_struct reboot_work; -struct work_struct shutdown_work;const char *hid; };drivers/power/reset/pwr-mlxbf.c static void pwr_mlxbf_reboot_work(struct · line 27
Quoted 2 lines
drivers/power/reset/pwr-mlxbf.c +0
-0@@ -27,22 +26,17 @@ static void pwr_mlxbf_reboot_work(struct work_struct *work) acpi_bus_generate_netlink_event("button/reboot.*", "RebootButton",
Quoted 40 lines
drivers/power/reset/pwr-mlxbf.c +3
-110x80, 1); } -static void pwr_mlxbf_shutdown_work(struct work_struct *work) -{ -acpi_bus_generate_netlink_event ("button/power.*" ,"Power Button", 0x80, 1); -} - static irqreturn_t pwr_mlxbf_irq(int irq, void *ptr) {const char *rst_pwr_hid ="MLNXBF24" ; -const char *low_pwr_hid ="MLNXBF29" ; +const char *shutdown_hid ="MLNXBF29" ;struct pwr_mlxbf *priv = ptr;if (!strncmp (priv->hid, rst_pwr_hid,8 ))schedule_work (&priv->reboot_work); -if (!strncmp (priv->hid, low_pwr_hid,8 )) -schedule_work (&priv->shutdown_work); +if (!strncmp (priv->hid, shutdown_hid,8 )) +orderly_poweroff (true);return IRQ_HANDLED ; }@@ -70,10 +64,6 @@ static int pwr_mlxbf_probe(struct platform_device *pdev)if (irq <0 )return dev_err_probe (dev, irq,"Error getting %s irq.\n" , priv- >hid); - err =devm_work_autocancel (dev, &priv->shutdown_work, pwr_mlxbf_shutdown_work); -if (err) -return err; -err = devm_work_autocancel(dev,
&priv->reboot_work,pwr_mlxbf_reboot_work);drivers/power/reset/pwr-mlxbf.c +0
-1if (err)return err; --2.30.1
Sebastian Reichel
AppliedQuoted 8 lines · Asmaa Mnebhi
The OCP board used a BlueField's GPIO pin for entering low power mode. That board was not commercialized and has been dropped from production so all its code is unused. The new hardware requirement is to trigger a graceful shutdown when that GPIO pin is toggled. So replace the unused low power mode with a graceful shutdown.
[...]
Applied, thanks!
[1/1] power: reset: pwr-mlxbf: support graceful shutdown
commit: 292fe42c34a9e9eea07f58a691813e077e9ca86f
Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>