[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230724223057.1208122-3-quic_eberman@quicinc.com>
Date: Mon, 24 Jul 2023 15:30:52 -0700
From: Elliot Berman <quic_eberman@...cinc.com>
To: Mark Rutland <mark.rutland@....com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Sebastian Reichel <sre@...nel.org>
CC: Elliot Berman <quic_eberman@...cinc.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
"Rob Herring" <robh+dt@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-pm@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-msm@...r.kernel.org>, <kernel@...cinc.com>,
Satya Durga Srinivasu Prabhala <quic_satyap@...cinc.com>,
Melody Olvera <quic_molvera@...cinc.com>,
"Prasad Sodagudi" <quic_psodagud@...cinc.com>
Subject: [RFC PATCH 2/4] power: reset: reboot-mode: Wire reboot_mode enum to magic
Allow the reboot mode type to be wired to magic.
Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
---
drivers/power/reset/reboot-mode.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index a646aefa041b..4ea97ccbaf51 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -22,12 +22,8 @@ struct mode_info {
static bool get_reboot_mode_magic(struct reboot_mode_driver *reboot,
const char *cmd, unsigned int *magic)
{
- const char *normal = "normal";
struct mode_info *info;
- if (!cmd)
- cmd = normal;
-
list_for_each_entry(info, &reboot->head, list) {
if (!strcmp(info->mode, cmd)) {
*magic = info->magic;
@@ -45,6 +41,32 @@ static int reboot_mode_notify(struct notifier_block *this,
unsigned int magic;
reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
+
+ if (!cmd) {
+ switch (mode) {
+ case REBOOT_COLD:
+ cmd = "cold";
+ break;
+ case REBOOT_WARM:
+ cmd = "warm";
+ break;
+ case REBOOT_HARD:
+ cmd = "hard";
+ break;
+ case REBOOT_SOFT:
+ cmd = "soft";
+ break;
+ case REBOOT_GPIO:
+ cmd = "gpio";
+ break;
+ }
+ if (get_reboot_mode_magic(reboot, cmd, &magic)) {
+ reboot->write(reboot, magic);
+ return NOTIFY_DONE;
+ }
+ cmd = "normal";
+ }
+
if (get_reboot_mode_magic(reboot, cmd, &magic))
reboot->write(reboot, magic);
--
2.41.0
Powered by blists - more mailing lists