Re: [PATCH] power_supply: change the way how wm97xx-bat driver is registered

Anton Vorontsov
2008-11-03T17:21:58Z

On Mon, Nov 03, 2008 at 04:54:57PM +0000, Jonathan Cameron wrote:
[...]
> It is needlessly complex for this sort of thing, but that's not it's
> purpose. (though that's not to say it won't be able to do this sort
> of thing). It's gotten a smigeon delayed due to a change of my own
> requirements for what it does. As a reminder, the purpose of that
> subsystem was at least partly to provide reasonably high performance
> data capture facilities (ring buffers, triggered sampling etc alongside
> suitably powerful userspace interfaces.) Possibly my apps are somewhat
> unusual, but the complexity is absolutely necessary for what I'm doing
> (annoyingly!)

Yeah, I understand that. But when you need simple driver for very
simple ADC device, the subsystem is a bit scary. Maybe we could just
implement "simple API" on top of it, that would hide the complexity.

Something like

value = adc_sample_pin(adc_device, "voltage");

And

struct adc_pin pins[2];
pins[0].name = "x-axis";
pins[0].num_samples = 5;
pins[1].name = "y-axis";
pins[2].num_samples = 5;

adc_sample_pins(adc_device, pins);
for (i = 0; i < ARRAY_SIZE(pins); i++) {
for (j = 0; j < pins[i].num_samples; i++)
process(pins[i].values[j].value);
}

That would work for most in-kernel ADC users (batteries, touchscreens).

> Anyhow, definitely not given up on it.

Great, looking forward to your patches.

--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2