[PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-03-14 Thread Geert Uytterhoeven
Hi all,

The ROHM BD9571MWV PMIC on the Renesas Salvator-X(S) and ULCB
development boards supports DDR Backup Power, which means that the DDR
power rails can be kept powered while the main SoC is powered down.

This patch series extends the support for DDR backup mode[1] to systems
with toggle instead of momentary power switches.

With a toggle power switch (or level signal), the following steps must
be followed exactly:
   1. Configure PMIC for backup mode, which changes the role of the
  power switch to a wake-up switch, 
   2. Switch accessory power switch off, to prepare for system suspend,
  which is a manual step not controlled by software,
   3. Suspend system,
   4. Switch accessory power switch on, to resume.

Unlike on systems with a momentary toggle switch, an additional step 2
must be performed in between step 1 and step 3.  Hence step 1 can no
longer be handled in the PMIC's suspend callback.

This patch series proposes a new callback for wake-up change
notification, which allows performing step 1 when the user writes
"enabled" to the PMIC's "wakeup" virtual file in sysfs, e.g.

echo enabled > 
/sys/devices/platform/soc/e60b.i2c/i2c-7/7-0030/bd9571mwv-regulator.2.auto/power/wakeup

Conversely, writing "disabled" reverts the role of the accessory switch
to a power switch.
Note that unlike with momentary switches, backup mode is not enabled by
default, as enabling it prevents the board from being powered off using
the power switch, which may confuse the user.

This has been tested on M3ULCB (thanks Jacopo!), and on Salvator-X(S).

For testing, driver and DTS patches are available in the
topic/bd9571-ddr-backup-mode-driver-v2 and
topic/bd9571-ddr-backup-mode-dt-v2 branches of my renesas-drivers git
repository at
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.

Thanks for your comments!

[1] https://lkml.org/lkml/2018/3/14/302

Geert Uytterhoeven (2):
  PM / wakeup: Add callback for wake-up change notification
  regulator: bd9571mwv: Add support for toggle power switches

 drivers/base/power/wakeup.c |  4 
 drivers/regulator/bd9571mwv-regulator.c | 24 
 include/linux/pm.h  |  1 +
 3 files changed, 29 insertions(+)

-- 
2.7.4

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-04-18 Thread Geert Uytterhoeven
Hi all,

On Wed, Mar 14, 2018 at 12:26 PM, Geert Uytterhoeven
 wrote:
> The ROHM BD9571MWV PMIC on the Renesas Salvator-X(S) and ULCB
> development boards supports DDR Backup Power, which means that the DDR
> power rails can be kept powered while the main SoC is powered down.
>
> This patch series extends the support for DDR backup mode[1] to systems
> with toggle instead of momentary power switches.
>
> With a toggle power switch (or level signal), the following steps must
> be followed exactly:
>1. Configure PMIC for backup mode, which changes the role of the
>   power switch to a wake-up switch,
>2. Switch accessory power switch off, to prepare for system suspend,
>   which is a manual step not controlled by software,
>3. Suspend system,
>4. Switch accessory power switch on, to resume.
>
> Unlike on systems with a momentary toggle switch, an additional step 2
> must be performed in between step 1 and step 3.  Hence step 1 can no
> longer be handled in the PMIC's suspend callback.
>
> This patch series proposes a new callback for wake-up change
> notification, which allows performing step 1 when the user writes
> "enabled" to the PMIC's "wakeup" virtual file in sysfs, e.g.
>
> echo enabled > 
> /sys/devices/platform/soc/e60b.i2c/i2c-7/7-0030/bd9571mwv-regulator.2.auto/power/wakeup
>
> Conversely, writing "disabled" reverts the role of the accessory switch
> to a power switch.
> Note that unlike with momentary switches, backup mode is not enabled by
> default, as enabling it prevents the board from being powered off using
> the power switch, which may confuse the user.
>
> This has been tested on M3ULCB (thanks Jacopo!), and on Salvator-X(S).
>
> For testing, driver and DTS patches are available in the
> topic/bd9571-ddr-backup-mode-driver-v2 and
> topic/bd9571-ddr-backup-mode-dt-v2 branches of my renesas-drivers git
> repository at
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.
>
> Thanks for your comments!
>
> [1] https://lkml.org/lkml/2018/3/14/302
>
> Geert Uytterhoeven (2):
>   PM / wakeup: Add callback for wake-up change notification
>   regulator: bd9571mwv: Add support for toggle power switches
>
>  drivers/base/power/wakeup.c |  4 
>  drivers/regulator/bd9571mwv-regulator.c | 24 
>  include/linux/pm.h  |  1 +
>  3 files changed, 29 insertions(+)

Any comments/suggestions?

In case you lost the patches from the thread:
https://www.spinics.net/lists/linux-renesas-soc/msg24955.html

Thanks!

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-04-18 Thread Mark Brown
On Wed, Apr 18, 2018 at 03:29:36PM +0200, Geert Uytterhoeven wrote:

> Any comments/suggestions?

> In case you lost the patches from the thread:
> https://www.spinics.net/lists/linux-renesas-soc/msg24955.html

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.

Sending content free pings adds to the mail volume (if they are seen at
all) which is often the problem and since they can't be reviewed
directly if something has gone wrong you'll have to resend the patches
anyway, though there are some other maintainers who like them - if in
doubt look at how patches for the subsystem are normally handled.


signature.asc
Description: PGP signature


Re: [PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-04-19 Thread Pavel Machek
On Wed 2018-04-18 15:00:41, Mark Brown wrote:
> On Wed, Apr 18, 2018 at 03:29:36PM +0200, Geert Uytterhoeven wrote:
> 
> > Any comments/suggestions?
> 
> > In case you lost the patches from the thread:
> > https://www.spinics.net/lists/linux-renesas-soc/msg24955.html
> 
> Please don't send content free pings and please allow a reasonable time
> for review.  People get busy, go on holiday, attend conferences and so 
> on so unless there is some reason for urgency (like critical bug fixes)
> please allow at least a couple of weeks for review.  If there have been
> review comments then people may be waiting for those to be

If I follow the logs right, there was one month before ping. That
seems pretty reasonable time.

> Sending content free pings adds to the mail volume (if they are seen at
> all) which is often the problem and since they can't be reviewed

Yep, and sending content free complains about pings also adds to the
main volume :-(.

Anyway, last time I sent you a patch... you _had_ time to complain
that I'm pinging too often, but you apparently did not have time to
look at the patch. That patch would have been in time for v4.16-rc1
IIRC.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-05-12 Thread Mark Brown
On Thu, Apr 19, 2018 at 10:13:56PM +0200, Pavel Machek wrote:
> On Wed 2018-04-18 15:00:41, Mark Brown wrote:

> > Please don't send content free pings and please allow a reasonable time
> > for review.  People get busy, go on holiday, attend conferences and so 

> If I follow the logs right, there was one month before ping. That
> seems pretty reasonable time.

Right, but the content free bit still applies (as does the bit about
resending which is the main actionable bit for people).  The two go hand
in hand so often that I just wrote the one thing for both.

> > Sending content free pings adds to the mail volume (if they are seen at
> > all) which is often the problem and since they can't be reviewed

> Yep, and sending content free complains about pings also adds to the
> main volume :-(.

They're not content free.  They're telling people that if it looks like
their patch has fallen through the cracks then they need to resend their
patch and why, without that people (especially newer contributors) might
not be clear about what to do.

> Anyway, last time I sent you a patch... you _had_ time to complain
> that I'm pinging too often, but you apparently did not have time to
> look at the patch. That patch would have been in time for v4.16-rc1
> IIRC.

If that's the tlv320dac33 patch you sent a followup in the middle of the
thread with what you said was a current version or something but never
actually sent that version as a regular patch submission.  You'd also
managed to not have the ASoC on the front of the patch which pushes it
to the bottom of the review queue, it won't turn up when I look in in my
inbox for ASoC patches.

Now, I for whatever reason didn't explicitly tell you I was expecting a
resend so you didn't explicitly know that this was what was going on
which is a good example of why letting people know what's going on is a
good idea.


signature.asc
Description: PGP signature