Skip to content

Commit 292fe42

Browse files
Asmaa Mnebhisre
authored andcommitted
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. Signed-off-by: Asmaa Mnebhi <[email protected]> Reviewed-by: David Thompson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 50f74b7 commit 292fe42

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/power/reset/pwr-mlxbf.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
struct pwr_mlxbf {
2020
struct work_struct reboot_work;
21-
struct work_struct shutdown_work;
2221
const char *hid;
2322
};
2423

@@ -27,22 +26,17 @@ static void pwr_mlxbf_reboot_work(struct work_struct *work)
2726
acpi_bus_generate_netlink_event("button/reboot.*", "Reboot Button", 0x80, 1);
2827
}
2928

30-
static void pwr_mlxbf_shutdown_work(struct work_struct *work)
31-
{
32-
acpi_bus_generate_netlink_event("button/power.*", "Power Button", 0x80, 1);
33-
}
34-
3529
static irqreturn_t pwr_mlxbf_irq(int irq, void *ptr)
3630
{
3731
const char *rst_pwr_hid = "MLNXBF24";
38-
const char *low_pwr_hid = "MLNXBF29";
32+
const char *shutdown_hid = "MLNXBF29";
3933
struct pwr_mlxbf *priv = ptr;
4034

4135
if (!strncmp(priv->hid, rst_pwr_hid, 8))
4236
schedule_work(&priv->reboot_work);
4337

44-
if (!strncmp(priv->hid, low_pwr_hid, 8))
45-
schedule_work(&priv->shutdown_work);
38+
if (!strncmp(priv->hid, shutdown_hid, 8))
39+
orderly_poweroff(true);
4640

4741
return IRQ_HANDLED;
4842
}
@@ -70,10 +64,6 @@ static int pwr_mlxbf_probe(struct platform_device *pdev)
7064
if (irq < 0)
7165
return dev_err_probe(dev, irq, "Error getting %s irq.\n", priv->hid);
7266

73-
err = devm_work_autocancel(dev, &priv->shutdown_work, pwr_mlxbf_shutdown_work);
74-
if (err)
75-
return err;
76-
7767
err = devm_work_autocancel(dev, &priv->reboot_work, pwr_mlxbf_reboot_work);
7868
if (err)
7969
return err;

0 commit comments

Comments
 (0)