All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Luca Weiss <luca@z3ntu.xyz>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: pm8941-pwrkey - respect reboot_mode for warm reset
Date: Wed, 14 Jul 2021 17:40:46 +0800	[thread overview]
Message-ID: <20210714094045.GD11342@dragon> (raw)
In-Reply-To: <1824770.6rn2EVs8mz@g550jk>

Hi Luca,

On Sun, Jul 11, 2021 at 11:57:25AM +0200, Luca Weiss wrote:
> Hi Shawn,
> 
> On Dienstag, 29. Juni 2021 05:05:09 CEST Shawn Guo wrote:
> > 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)
> 
> This doesn't compile with CONFIG_INPUT_PM8941_PWRKEY=m
> 
>  ERROR: modpost: "reboot_mode" [drivers/input/misc/pm8941-pwrkey.ko] undefined!

Thanks for the report!  I will add a patch to export the symbol.

> 
> Also just to clarify, this is supposed to trigger when rebooting with 
> LINUX_REBOOT_CMD_RESTART2 and adding an argument that way, right?

With either of the following two methods, 'reboot_mode' will be turned
into REBOOT_WARM.

- Boot kernel with 'reboot=warm' on cmdline

- Set warm mode via sysfs entry
  $ echo warm > /sys/kernel/reboot/mode

Shawn

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  3:05 [PATCH] Input: pm8941-pwrkey - respect reboot_mode for warm reset Shawn Guo
2021-07-11  9:57 ` Luca Weiss
2021-07-14  9:40   ` Shawn Guo [this message]
2022-02-26 10:04     ` Luca Weiss

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=20210714094045.GD11342@dragon \
    --to=shawn.guo@linaro.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=luca@z3ntu.xyz \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.