All of lore.kernel.org
 help / color / mirror / Atom feed
* How to test regulator driver?
@ 2009-03-09 15:02 Anuj Aggarwal
  2009-03-09 15:32 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Anuj Aggarwal @ 2009-03-09 15:02 UTC (permalink / raw)
  To: Linux OMAP List

Hi,

I want to test my regulator driver by writing a small kernel module.
But I am a little confused as what should be passed as the first
argument of regulator_get(). How would the kernel module know about
the device pointer that needs to be passed to the _get function?

Thanks,
Anuj Aggarwal

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

* Re: How to test regulator driver?
  2009-03-09 15:02 How to test regulator driver? Anuj Aggarwal
@ 2009-03-09 15:32 ` Mark Brown
  2009-03-24 11:44   ` Aggarwal, Anuj
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-03-09 15:32 UTC (permalink / raw)
  To: Anuj Aggarwal; +Cc: Linux OMAP List

On Mon, Mar 09, 2009 at 08:32:55PM +0530, Anuj Aggarwal wrote:

> I want to test my regulator driver by writing a small kernel module.
> But I am a little confused as what should be passed as the first
> argument of regulator_get(). How would the kernel module know about
> the device pointer that needs to be passed to the _get function?

regulator_get() takes the struct device for the consumer as an argument
so it depends on what your consumer is.  For test purposes there's an
existing virtual consumer driver in the tree which should hopefully save
you having to write your own - it allows you to poke the settings from
sysfs.  drivers/regulator/virtual.c

Questions like this that aren't OMAP-specific should really be asked on
the relevant general list (in this case linux-kernel).

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

* RE: How to test regulator driver?
  2009-03-09 15:32 ` Mark Brown
@ 2009-03-24 11:44   ` Aggarwal, Anuj
  2009-03-24 15:35     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Aggarwal, Anuj @ 2009-03-24 11:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux OMAP List, Pillai, Manikandan

I am seriously confused on how to fetch the struct device * in my consumer driver, for an already registered regulator. I am planning to use this consumer driver as a part of my CPU freq/CPU idle framework but I don't know what to pass in regulator_get.

Should I register my regulator device as a platform_device as against an i2c_client device what I am having now? Other regulator drivers (drivers/regulator/twl4030-regulator.c, wm8400.c etc) are doing the same thing in their code. Using the current approach, I am facing difficulty in getting the struct device * for invoking the regulator_get()?

Otherwise, can I expose one function in my regulator driver which will return the appropriate struct device * when user calls it with a supply name string? This device pointer then will be used in my consumer driver while calling the regulator_get API?

Thanks and Regards,
Anuj Aggarwal
 
Platform Support Products
Texas Instruments Inc
Ph: +91-80-2509-9542
TI IP Ph: 509-9542
PSP Products RSS Feed PSP Product Announcements
 
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Mark Brown
> Sent: Monday, March 09, 2009 9:03 PM
> To: Anuj Aggarwal
> Cc: Linux OMAP List
> Subject: Re: How to test regulator driver?
> 
> On Mon, Mar 09, 2009 at 08:32:55PM +0530, Anuj Aggarwal wrote:
> 
> > I want to test my regulator driver by writing a small kernel module.
> > But I am a little confused as what should be passed as the first
> > argument of regulator_get(). How would the kernel module know about
> > the device pointer that needs to be passed to the _get function?
> 
> regulator_get() takes the struct device for the consumer as an argument
> so it depends on what your consumer is.  For test purposes there's an
> existing virtual consumer driver in the tree which should hopefully save
> you having to write your own - it allows you to poke the settings from
> sysfs.  drivers/regulator/virtual.c
> 
> Questions like this that aren't OMAP-specific should really be asked on
> the relevant general list (in this case linux-kernel).
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: How to test regulator driver?
  2009-03-24 11:44   ` Aggarwal, Anuj
@ 2009-03-24 15:35     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-03-24 15:35 UTC (permalink / raw)
  To: Aggarwal, Anuj; +Cc: Linux OMAP List, Pillai, Manikandan

On Tue, Mar 24, 2009 at 05:14:58PM +0530, Aggarwal, Anuj wrote:

> I am seriously confused on how to fetch the struct device * in my
> consumer driver, for an already registered regulator. I am planning to
> use this consumer driver as a part of my CPU freq/CPU idle framework
> but I don't know what to pass in regulator_get.

Your consumer driver should not be using the struct device for the
regulator when calling regulator_get().  They should never need to know
anything about the struct device of the regulator that is providing a
supply to them.  The consumer should use a fixed device name and the
struct device for itself, these will then be resolved to an actual
regulator by the core based on the machine constraints.

In the specific case of cpufreq where there is no struct device for the
consumer use NULL when calling regulator_get().

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

end of thread, other threads:[~2009-03-24 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-09 15:02 How to test regulator driver? Anuj Aggarwal
2009-03-09 15:32 ` Mark Brown
2009-03-24 11:44   ` Aggarwal, Anuj
2009-03-24 15:35     ` 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.