diff mbox series

[SRU,J:linux-bluefield,v1,1/1] UBUNTU: SAUCE: pwr-mlxbf: support Bobcat graceful shutdown via gpio6

Message ID 20240320163416.5348-2-asmaa@nvidia.com
State New
Headers show
Series UBUNTU: SAUCE: pwr-mlxbf: support Bobcat graceful shutdown via gpio6 | expand

Commit Message

Asmaa Mnebhi March 20, 2024, 4:34 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2058498

OCP3.0 project was discontinued and canceled so all stale code related to
that was removed.
The HID MLNXBF29 is used now for triggering a graceful shutdown for the Bobcat
board. On the bobcat board, the main board cpld issues the shutdown request to
the dpu cpld. the dpu cpld issues that request to ARM via GPIO6 and ARM should
trigger a graceful shutdown and set the ARM boot progress to 6.

Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Reviewed-by: David Thompson <davthompson@nvidia.com>
---
 drivers/power/reset/pwr-mlxbf.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/drivers/power/reset/pwr-mlxbf.c b/drivers/power/reset/pwr-mlxbf.c
index 181c421ffa48..ef2912ee2f46 100644
--- a/drivers/power/reset/pwr-mlxbf.c
+++ b/drivers/power/reset/pwr-mlxbf.c
@@ -19,11 +19,10 @@ 
 
 #include <linux/devm-helpers.h>
 
-#define DRV_VERSION "1.2"
+#define DRV_VERSION "1.3"
 
 struct pwr_mlxbf {
 	struct work_struct reboot_work;
-	struct work_struct shutdown_work;
 	const char *hid;
 };
 
@@ -32,22 +31,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;
 }
@@ -75,10 +69,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;