LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Luca Weiss <luca@z3ntu.xyz>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Matteo Croce <mcroce@microsoft.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Petr Mladek <pmladek@suse.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, Shawn Guo <shawn.guo@linaro.org>
Subject: [PATCH v2 2/2] Input: pm8941-pwrkey - Respect reboot_mode for warm reset
Date: Wed, 14 Jul 2021 17:58:49 +0800	[thread overview]
Message-ID: <20210714095850.27185-3-shawn.guo@linaro.org> (raw)
In-Reply-To: <20210714095850.27185-1-shawn.guo@linaro.org>

On some devices, e.g. Sony Xperia M4 Aqua, warm reset is used to reboot
device into bootloader and recovery mode.  Instead of always doing hard
reset, add a check on reboot_mode for possible warm reset.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/input/misc/pm8941-pwrkey.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index cf8104454e74..9b14d6eb1918 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -27,6 +27,7 @@
 #define PON_PS_HOLD_RST_CTL2		0x5b
 #define  PON_PS_HOLD_ENABLE		BIT(7)
 #define  PON_PS_HOLD_TYPE_MASK		0x0f
+#define  PON_PS_HOLD_TYPE_WARM_RESET	1
 #define  PON_PS_HOLD_TYPE_SHUTDOWN	4
 #define  PON_PS_HOLD_TYPE_HARD_RESET	7
 
@@ -93,7 +94,10 @@ static int pm8941_reboot_notify(struct notifier_block *nb,
 		break;
 	case SYS_RESTART:
 	default:
-		reset_type = PON_PS_HOLD_TYPE_HARD_RESET;
+		if (reboot_mode == REBOOT_WARM)
+			reset_type = PON_PS_HOLD_TYPE_WARM_RESET;
+		else
+			reset_type = PON_PS_HOLD_TYPE_HARD_RESET;
 		break;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2021-07-14  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  9:58 [PATCH v2 0/2] Warm reset support for pm8941-pwrkey Shawn Guo
2021-07-14  9:58 ` [PATCH v2 1/2] reboot: Export symbol 'reboot_mode' Shawn Guo
2021-10-17  4:28   ` Dmitry Torokhov
2021-07-14  9:58 ` Shawn Guo [this message]
2021-07-25 19:34   ` [PATCH v2 2/2] Input: pm8941-pwrkey - Respect reboot_mode for warm reset Luca Weiss
2021-10-17  4:28   ` Dmitry Torokhov
2021-08-24  3:00 ` [PATCH v2 0/2] Warm reset support for pm8941-pwrkey Shawn Guo
2021-10-17  4:29   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210714095850.27185-3-shawn.guo@linaro.org \
    --to=shawn.guo@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca@z3ntu.xyz \
    --cc=mcroce@microsoft.com \
    --cc=pmladek@suse.com \
    --cc=rafael.j.wysocki@intel.com \
    --subject='Re: [PATCH v2 2/2] Input: pm8941-pwrkey - Respect reboot_mode for warm reset' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).