[RFC] What is the preferred way to share ADC unit between hwmon and input(ts) drivers?

Jonathan Cameron jic23 at cam.ac.uk
Fri May 6 11:15:25 EDT 2011


On 05/06/11 15:23, Mark Brown wrote:
> On Fri, May 06, 2011 at 04:13:26PM +0200, Ithamar R. Adema wrote:
> 
>> Would it be worth considering generalizing the model that s3c uses[1]
>> for adc? I've reused that for at least two other platforms already,
>> though not mainlined (yet).
> 
>> It could make for a good /drivers/adc/ base IMHO. Any opinions?
> 
> I'd have expected that this stuff should be able to fit into IIO and
> that it would be able to be used by in-kernel users.
To my mind this is just like any other bit of hardware used by drivers
in different subsystems. Fits in MFD as far as I am concerned (and there
are several parts doing this ls drivers/mfd/*adc*).
Take the jz4740-adc.c file.  That provides adc reading to a touchscreen
a battery monitor and hwmon driver.  Any thing else is just reinventing
the wheel...

We can add in kernel hooks to IIO (would be easy enough -
for low rate stuff). I'd be happy to accept patches for this (it's not
a priority for any current active developers as far as I know).
However, that's silly if all you want is to pass it directly to input and hwmon.
Just write a driver that registers both interfaces directly.
If one of the adc channels needs stuff from IIO, add that as well.

IIO does have a (prototype) bridge to input, but that's done via userspace
is there to handle people doing unusual things with sensors typically used
for very different purposes (using 500 dolar IMU as a joystick for example).
We could do this in kernel, but that involves adding some logic at the
back end of the high data rate paths and hence would rather not...

Jonathan



More information about the linux-arm-kernel mailing list