mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] PM / wakeup: Add callback for wake-up change notification
Date: Wed, 20 Jun 2018 10:02:41 +0200	[thread overview]
Message-ID: <2523505.Jaak4fIuPm@aspire.rjw.lan> (raw)
In-Reply-To: <CAMuHMdWgdsSS7qcfPmHnvL-XmXzyoS=bMGgc6q0urcvO5upWvQ@mail.gmail.com>

On Tuesday, June 19, 2018 5:22:06 PM CEST Geert Uytterhoeven wrote:
> Hi Rafael,
> 
> On Tue, Jun 19, 2018 at 4:48 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Tue, Jun 19, 2018 at 3:55 PM, Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> > > Add a callback to inform a device that its wake-up setting has been
> > > changed.  This allows a device to synchronize device configuration with
> > > an external user action.
> > >
> > > E.g. on systems using a Rohm BD9571MWV PMIC and a toggle accessory power
> > > switch, the system suspend/resume procedure is:
> > >   1. Configure PMIC for DDR backup mode (by software), which changes the
> > >      role of the accessory power switch from a power to a wake-up
> > >      switch,
> > >   2. Switch accessory power switch off (manually), to prepare for system
> > >      suspend,
> > >   3. Suspend system (by software),
> > >   4. Switch accessory power switch on (manually), to wake up the system.
> > >
> > > As step 2 involves a manual operation, step 1 cannot be combined
> > > with step 3 and performed in the PMIC's suspend callback (unlike on
> > > systems with a momentary power switch).
> > >
> > > Adding the new callback allows to move step 1 to the new callback, to be
> > > performed in response to the user writing "enabled" to the PMIC's
> > > "wakeup" virtual file in sysfs.
> >
> > I still don't quite understand this TBH.
> >
> > In particular, why do you want a write to "wakeup" trigger this
> > instead of having a special sysfs attr for that exposed by your PMIC
> > driver?
> 
> In v1 (https://patchwork.kernel.org/patch/9996567/), I had a
> driver-specific "backup_mode" sysfs file.
> In v2 and later of the driver series (https://lkml.org/lkml/2018/4/18/345),
> I changed that to use the standard "wakeup" file in sysfs, in response to
> a comment from Mark Brown.

Well, I'm not convinced that this is the right approach, though.

> > Writing "enabled" to "wakeup" for the PMIC should enable the PMIC
> > itself to wake up the system, which isn't quite the case, or is it?
> 
> Actually the PMIC cannot wake up the system if backup mode is not enabled.

That doesn't really matter.  "enabled" in "wakeup" only means that user space
allows the device to wake up the system from sleep, but it still may not be
able to do that for certain reasons (like in this case).  By adding this
callback you're changing the meaning of the attribute.

> When suspending the system (PSCI suspend) without enabling backup mode
> first, the system will just crash (which cannot be distinguished from being
> suspended, as PSCI doesn't support any other wake-up sources anyway[*] ;-)
> So in that sense writing "enabled" to the "wakeup" file does enable the
> PMIC to wake up the system.
> 
> Do you still prefer a driver-specific sysfs file?

Yes, I do.

Thanks,
Rafael


  reply	other threads:[~2018-06-20  8:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 13:55 [PATCH v2 0/2] regulator: bd9571mwv: Add support for toggle power switches Geert Uytterhoeven
2018-06-19 13:55 ` [PATCH v2 1/2] PM / wakeup: Add callback for wake-up change notification Geert Uytterhoeven
2018-06-19 14:47   ` Rafael J. Wysocki
2018-06-19 15:22     ` Geert Uytterhoeven
2018-06-20  8:02       ` Rafael J. Wysocki [this message]
2018-06-20 10:35         ` Mark Brown
2018-06-20 12:15           ` Rafael J. Wysocki
2018-06-20 13:25             ` Mark Brown
2018-06-26 10:06               ` Geert Uytterhoeven
2018-06-26 10:16                 ` Rafael J. Wysocki
2018-06-26 10:29                   ` Geert Uytterhoeven
2018-06-26 13:55                     ` Rafael J. Wysocki
2018-06-19 13:55 ` [PATCH v2 2/2] regulator: bd9571mwv: Add support for toggle power switches Geert Uytterhoeven

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=2523505.Jaak4fIuPm@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=broonie@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=len.brown@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®