RE: How to test regulator driver?

2009-03-24 Thread Aggarwal, Anuj
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-ow...@vger.kernel.org [mailto:linux-omap-
 ow...@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 majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How to test regulator driver?

2009-03-24 Thread Mark Brown
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().
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


How to test regulator driver?

2009-03-09 Thread Anuj Aggarwal
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
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How to test regulator driver?

2009-03-09 Thread Mark Brown
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html