All of lore.kernel.org
 help / color / mirror / Atom feed
* Regulator framework usage in suspend/resume contex.
@ 2009-12-17 16:54 ` Lukasz Majewski
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2009-12-17 16:54 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: 'Kyungmin Park', Tomasz Fujak, 'Marek Szyprowski',
	Lukasz Majewski, linux-samsung-soc

Hello all,

I'm trying to use the regulator framework in conjunction with suspend/resume
(code based on a s3c Samsung SoC platform).
My goal is to change values of regulators output before going to sleep and
restore their values after resume.

I use echo mem > /sys/power/state to suspend to RAM.
I've implemented platform_suspend_ops' .begin method and from it I'm calling
the regulator_suspend_prepare(state) function from regulator framework
(declared at include/linux/regulator/machine.h, defined at core.c).
After this step I'm going to sleep. And it seems that voltage values are
changed/disabled as they should (according to .constraints->.state_mem
struct fields).

The problem is when I disable normally enabled source or change its voltage
value to new_value when entering the suspend to RAM state.

.state_mem      = {
	.enabled= 0,
},

Or

.state_mem      = {
	.uV= new_value,
	.enabled= 1,
},

I don't know how to enable this source again after resume or restore source
microvolts setting as before suspend?

As I suppose, the preferred place for performing this would be a .finish
method from platform_suspend_ops' structure (declared in
include/linux/suspend.h).

It looks like some relevant method is missing in the framework, or I haven't
look deep enough to spot one :-).

One possible workaround would be to reinitialize all regulators with
regulator_init_complete(void) function, but I'm not sure if then old
microvolt settings would be restored. Probably not...
Does anybody have any idea how to solve this problem?

I was grepping a little and it looks, that regulator_suspend_prepare()
method is not used by any suspend/resume driver in the kernel linux tree (at
least up to kernel version 2.6.32-rc8), so there is no reference code.



Thanks in advance,
Lukasz Majewski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Regulator framework usage in suspend/resume contex.
@ 2009-12-17 16:54 ` Lukasz Majewski
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2009-12-17 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hello all,

I'm trying to use the regulator framework in conjunction with suspend/resume
(code based on a s3c Samsung SoC platform).
My goal is to change values of regulators output before going to sleep and
restore their values after resume.

I use echo mem > /sys/power/state to suspend to RAM.
I've implemented platform_suspend_ops' .begin method and from it I'm calling
the regulator_suspend_prepare(state) function from regulator framework
(declared at include/linux/regulator/machine.h, defined at core.c).
After this step I'm going to sleep. And it seems that voltage values are
changed/disabled as they should (according to .constraints->.state_mem
struct fields).

The problem is when I disable normally enabled source or change its voltage
value to new_value when entering the suspend to RAM state.

.state_mem      = {
	.enabled= 0,
},

Or

.state_mem      = {
	.uV= new_value,
	.enabled= 1,
},

I don't know how to enable this source again after resume or restore source
microvolts setting as before suspend?

As I suppose, the preferred place for performing this would be a .finish
method from platform_suspend_ops' structure (declared in
include/linux/suspend.h).

It looks like some relevant method is missing in the framework, or I haven't
look deep enough to spot one :-).

One possible workaround would be to reinitialize all regulators with
regulator_init_complete(void) function, but I'm not sure if then old
microvolt settings would be restored. Probably not...
Does anybody have any idea how to solve this problem?

I was grepping a little and it looks, that regulator_suspend_prepare()
method is not used by any suspend/resume driver in the kernel linux tree (at
least up to kernel version 2.6.32-rc8), so there is no reference code.



Thanks in advance,
Lukasz Majewski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Regulator framework usage in suspend/resume contex.
  2009-12-17 16:54 ` Lukasz Majewski
@ 2009-12-18 11:13   ` Mark Brown
  -1 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-12-18 11:13 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: linux-arm-kernel, linux-samsung-soc, 'Kyungmin Park',
	'Marek Szyprowski',
	Tomasz Fujak

On Thu, Dec 17, 2009 at 05:54:21PM +0100, Lukasz Majewski wrote:

In general if you want advice on a kernel subsystem it's best to CC the
maintainers of the relevant subsystem - messages posted only to mailing
lists (particularly high volume ones such as this) can easily get lost
in the flow.

> I'm trying to use the regulator framework in conjunction with suspend/resume
> (code based on a s3c Samsung SoC platform).
> My goal is to change values of regulators output before going to sleep and
> restore their values after resume.

Which PMIC are you using for this?

> The problem is when I disable normally enabled source or change its voltage
> value to new_value when entering the suspend to RAM state.

It'd be useful to see the driver here...

> I don't know how to enable this source again after resume or restore source
> microvolts setting as before suspend?

The expecation of the API is that your suspend state configuration will
not impact the state used for the running system so no work should be
required by software to restore the state.  Hardware tends to want this
since the suspend mode will normally involve powering down the CPU and
therefore needs some hardware handshake between the CPU and the PMIC.
If the regulator driver is doing something too different to this then it
probably shouldn't be implementing the suspend mode APIs at all.

There's also a general idea that consumer drivers should be turning off
their supplies when they suspend, if only to allow them to better take
advantage of runtime PM schemes as they come along (though currently
they all use different callbacks).

There's currently no support for restoring the state of regulators that
don't have the hardware handshaking for entering and exiting suspend,
mostly due to lack of demand.  That may be best handled by the
individual regulators from their suspend and resume methods, probably
using a core helper, but I've not fully thought that through.

> It looks like some relevant method is missing in the framework, or I haven't
> look deep enough to spot one :-).

It's a bit academic anyway for ARM platforms since suspend to disk isn't
supported by the architecture at present so most systems will never do
anything except suspend to RAM so there's no real need to select which
mode to use at runtime.

> I was grepping a little and it looks, that regulator_suspend_prepare()
> method is not used by any suspend/resume driver in the kernel linux tree (at
> least up to kernel version 2.6.32-rc8), so there is no reference code.

That's correct, it should probably be hooked in for the 1133-EV1 i.MX
support but IIRC that was merged prior to the platform supporting
suspend and like I say the suspend mode configuration for ARM is a bit
academic.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Regulator framework usage in suspend/resume contex.
@ 2009-12-18 11:13   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-12-18 11:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 17, 2009 at 05:54:21PM +0100, Lukasz Majewski wrote:

In general if you want advice on a kernel subsystem it's best to CC the
maintainers of the relevant subsystem - messages posted only to mailing
lists (particularly high volume ones such as this) can easily get lost
in the flow.

> I'm trying to use the regulator framework in conjunction with suspend/resume
> (code based on a s3c Samsung SoC platform).
> My goal is to change values of regulators output before going to sleep and
> restore their values after resume.

Which PMIC are you using for this?

> The problem is when I disable normally enabled source or change its voltage
> value to new_value when entering the suspend to RAM state.

It'd be useful to see the driver here...

> I don't know how to enable this source again after resume or restore source
> microvolts setting as before suspend?

The expecation of the API is that your suspend state configuration will
not impact the state used for the running system so no work should be
required by software to restore the state.  Hardware tends to want this
since the suspend mode will normally involve powering down the CPU and
therefore needs some hardware handshake between the CPU and the PMIC.
If the regulator driver is doing something too different to this then it
probably shouldn't be implementing the suspend mode APIs at all.

There's also a general idea that consumer drivers should be turning off
their supplies when they suspend, if only to allow them to better take
advantage of runtime PM schemes as they come along (though currently
they all use different callbacks).

There's currently no support for restoring the state of regulators that
don't have the hardware handshaking for entering and exiting suspend,
mostly due to lack of demand.  That may be best handled by the
individual regulators from their suspend and resume methods, probably
using a core helper, but I've not fully thought that through.

> It looks like some relevant method is missing in the framework, or I haven't
> look deep enough to spot one :-).

It's a bit academic anyway for ARM platforms since suspend to disk isn't
supported by the architecture at present so most systems will never do
anything except suspend to RAM so there's no real need to select which
mode to use at runtime.

> I was grepping a little and it looks, that regulator_suspend_prepare()
> method is not used by any suspend/resume driver in the kernel linux tree (at
> least up to kernel version 2.6.32-rc8), so there is no reference code.

That's correct, it should probably be hooked in for the 1133-EV1 i.MX
support but IIRC that was merged prior to the platform supporting
suspend and like I say the suspend mode configuration for ARM is a bit
academic.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-18 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-17 16:54 Regulator framework usage in suspend/resume contex Lukasz Majewski
2009-12-17 16:54 ` Lukasz Majewski
2009-12-18 11:13 ` Mark Brown
2009-12-18 11:13   ` Mark Brown

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.