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

Ilya Yanok yanok at emcraft.com
Thu May 5 19:41:29 EDT 2011


Hello Kurt,

On 25.04.2011 09:25, Kurt Van Dijck wrote:
>> So, to add both input and hwmon drivers we need to serialize the
>> register accesses.
> 
> 1 physical device may contain several 'class_device's, even if they're of
> different types.  So in a single platform_device probe function, you can do
> both 'input_register_device' and 'hwmon_register_device'.
> This way of working actually puts 2 drivers in 1 file, and let those
> share 1 lock (mutex or so). A peripheral with 2 functions mixed together
> should IMHO be addressed this way. Your driver is the coupling
> between hardware (mixed functions) and Linux device model (clean seperation).

Yes, I know this is possible. Still, I think it's not desired. I should
ask my customer...
My concern is pushing these changes upstream. Is such two-in-one driver
going to be easily accepted?

Anyway, thanks for the idea.

>> I was thinking about adding some middle-layer to
>> perform the actual conversion. The question is what is the preferred way
>> to add such a middle layer?
> 
> IMHO a middle layer for this type of problem is a bit overkill.

Still I can see that at least S3C does this.

>> Should we use a multi-function device driver
>> for this or just some platform-specific code (as S3C does)? Or maybe
>> there is another way?
> 
> AFAIK MFD is a solution when multiple devices have sequential register maps.
> MFD does no locking.

Well, yes. MFD was just another idea where to put custom API piece...

Thanks!

Regards, Ilya.



More information about the linux-arm-kernel mailing list