linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* "coupled" regulator support
@ 2016-07-15 12:01 Jisheng Zhang
  2016-07-15 12:50 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Jisheng Zhang @ 2016-07-15 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I dunno how to name this kind of regulator, my situation is:

multiple devices connects to one voltage regulator_dev, e.g devA and devB connects
to regR, regR only support two voltage v1 and v2, let's say v1 < v2

regR can only be set to v1 if devA and devB all call for set voltage to v1
regR can set to v2 if devA or devB call for set voltage to v2

To support this situation, I'd like to add flag to regulator structure and
patch regulator_check_consumers() to check whether we are safe to set the vol

Is this patch acceptable or we already have elegant solution?

Thanks in advance,
Jisheng

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

* "coupled" regulator support
  2016-07-15 12:01 "coupled" regulator support Jisheng Zhang
@ 2016-07-15 12:50 ` Mark Brown
  2016-07-18  6:44   ` Jisheng Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2016-07-15 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 15, 2016 at 08:01:13PM +0800, Jisheng Zhang wrote:

> regR can only be set to v1 if devA and devB all call for set voltage to v1
> regR can set to v2 if devA or devB call for set voltage to v2

> To support this situation, I'd like to add flag to regulator structure and
> patch regulator_check_consumers() to check whether we are safe to set the vol

Surely this is just what normal set voltage calls do?  If devA says
set_voltage(v1, v2) but devB still has set_voltage(v2, v2) then we will
leave the voltage at v2, we'll only allow it to be set to v1 if both
consumers agree that this is a valid voltage.  It feels like there's
something else going on here that I'm missing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160715/43fa8c09/attachment.sig>

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

* "coupled" regulator support
  2016-07-15 12:50 ` Mark Brown
@ 2016-07-18  6:44   ` Jisheng Zhang
  2016-07-18 18:05     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Jisheng Zhang @ 2016-07-18  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Mark,

On Fri, 15 Jul 2016 13:50:39 +0100 Mark Brown wrote:

> On Fri, Jul 15, 2016 at 08:01:13PM +0800, Jisheng Zhang wrote:
> 
> > regR can only be set to v1 if devA and devB all call for set voltage to v1
> > regR can set to v2 if devA or devB call for set voltage to v2  
> 
> > To support this situation, I'd like to add flag to regulator structure and
> > patch regulator_check_consumers() to check whether we are safe to set the vol  
> 
> Surely this is just what normal set voltage calls do?  If devA says
> set_voltage(v1, v2) but devB still has set_voltage(v2, v2) then we will
> leave the voltage at v2, we'll only allow it to be set to v1 if both
> consumers agree that this is a valid voltage.  It feels like there's
> something else going on here that I'm missing?

oops, sorry for not describing the situation clearly. Here are more details.

I'm implementing DVFS for devA and devB, devA and devB shares the same
voltage regulator. devA and devB are different devices, and they are
independent in DVFS.

v1 and v2 and both valid voltages, but here we have an explicit limitation:
we must take the "regulator shared" fact into consideration. Let's assume
the voltage is at v2, devA is not busy now, it wants to scale down freq, then
scale down voltage to v1, but if devB hasn't call for setting voltage to
v1, we can't scale down voltage now, we need to wait for devB sending out
the voltage scaling down request when it is not busy in future some time.
Obviously, the last user will succeed to scale down the voltage.

My solution is
to extend regulator_check_consumers() to check whether all consumers agree
to scaling down voltage or not.

Thanks,
Jisheng

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

* "coupled" regulator support
  2016-07-18  6:44   ` Jisheng Zhang
@ 2016-07-18 18:05     ` Mark Brown
  2016-07-21 10:45       ` Jisheng Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2016-07-18 18:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 18, 2016 at 02:44:22PM +0800, Jisheng Zhang wrote:

> v1 and v2 and both valid voltages, but here we have an explicit limitation:
> we must take the "regulator shared" fact into consideration. Let's assume
> the voltage is at v2, devA is not busy now, it wants to scale down freq, then
> scale down voltage to v1, but if devB hasn't call for setting voltage to
> v1, we can't scale down voltage now, we need to wait for devB sending out
> the voltage scaling down request when it is not busy in future some time.
> Obviously, the last user will succeed to scale down the voltage.

> My solution is
> to extend regulator_check_consumers() to check whether all consumers agree
> to scaling down voltage or not.

I'm not sure I 100% follow your explanation above - it still sounds like
a normal shared regulator situation.  In general I'm really unsure how
this sort of scheme is expected to work.  It seems like in a lot of
cases there will be some other constraints in play (like needing to do
frequency updates as part of the sequence) which can't be handled purely
in the regulator API and/or that the DVFS driver ought to be able to use
notifiers to discover when actual changes have happened and handle
things in their own code.  But like I say I don't 100% follow what's new
in your example so I may be missing something.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160718/1fb3dae4/attachment-0001.sig>

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

* "coupled" regulator support
  2016-07-18 18:05     ` Mark Brown
@ 2016-07-21 10:45       ` Jisheng Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Jisheng Zhang @ 2016-07-21 10:45 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Mark,

On Mon, 18 Jul 2016 19:05:08 +0100 Mark Brown wrote:

> On Mon, Jul 18, 2016 at 02:44:22PM +0800, Jisheng Zhang wrote:
> 
> > v1 and v2 and both valid voltages, but here we have an explicit limitation:
> > we must take the "regulator shared" fact into consideration. Let's assume
> > the voltage is at v2, devA is not busy now, it wants to scale down freq, then
> > scale down voltage to v1, but if devB hasn't call for setting voltage to
> > v1, we can't scale down voltage now, we need to wait for devB sending out
> > the voltage scaling down request when it is not busy in future some time.
> > Obviously, the last user will succeed to scale down the voltage.  
> 
> > My solution is
> > to extend regulator_check_consumers() to check whether all consumers agree
> > to scaling down voltage or not.  
> 
> I'm not sure I 100% follow your explanation above - it still sounds like
> a normal shared regulator situation.  In general I'm really unsure how

You are right!
After carefully checking the code, I found the existing regulator core could
meet my what I want.

Thanks so much,
Jisheng

> this sort of scheme is expected to work.  It seems like in a lot of
> cases there will be some other constraints in play (like needing to do
> frequency updates as part of the sequence) which can't be handled purely
> in the regulator API and/or that the DVFS driver ought to be able to use
> notifiers to discover when actual changes have happened and handle
> things in their own code.  But like I say I don't 100% follow what's new
> in your example so I may be missing something.

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

end of thread, other threads:[~2016-07-21 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 12:01 "coupled" regulator support Jisheng Zhang
2016-07-15 12:50 ` Mark Brown
2016-07-18  6:44   ` Jisheng Zhang
2016-07-18 18:05     ` Mark Brown
2016-07-21 10:45       ` Jisheng Zhang

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).