Re: [PATCH] iio: st-sensors: add support for lis3lv02d accelerometer
From: Jonathan Cameron <hidden>
Date: 2014-09-11 16:39:01
Also in:
linux-iio
On September 11, 2014 10:13:24 AM GMT+01:00, Linus Walleij [off-list ref] wrote:
On Mon, Aug 25, 2014 at 6:19 PM, Jonathan Cameron [off-list ref] wrote:quoted
On 23/08/14 18:31, Linus Walleij wrote:quoted
This adds support for the LIS3LV02 accelerometer found in the ST Microelectronics Nomadik board series. Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Denis CIOCCA <redacted> Cc: Lee Jones <redacted> Signed-off-by: Linus Walleij <redacted>If anyone wants to look at what the misc driver supports that westillquoted
don't have in the IIO driver then that would be great!I had a quick look at it: - The misc driver has a bridge that optionally registers the accelerometer as a joystick in the input subsystem, so it can be used as a polled joystick. That looks like something we would want to be able to do for any accelerometer in a generic glue file in IIO I think?
That is what we had iio-input for but it has languished unloved for quite a while. Always too many other things to do! Nasty bit in there is how to do bindings for it. No one really likes the existing ones for iio client drivers. Note it is more general than just accelerometers as all sorts of other devices are useful for human input. At some point we need to figure out how to represent analog sensors connected to a generic ADC.
- Ability to generate a "free-fall event" on a misc device if the device containing the sensor is dropped. A special interrupt can be enabled on the device for this. I can't quite see how userspace is supposed to react to it, because this miscdevice userspace ABI is sort of complex.
Long ago we had a discussion about how to handle this. I think the conclusion was we just needed a standard abi that any driver could use to notify user space if any sensor told the machine it was in free fall. /Dev/freefall perhaps with simple poll /select support? Can do this with iio events but perhaps a separate system would be lighter weight? Interesting trick would be to do a software filter for this for devices without hardware support.
- Some driver-specific sysfs power management stuff - Context save/restore registers for power-off handling. - Trigger selftest from sysfs : I suspect this could be ported over to all the ST Micro devices, as they are similar in that way, same kind of test registers. - Possible to enable high-pass filter from the DT config. (Should that not be dynamic?)
Probably.
Apart from that it has a custom sysfs interface to read the accelerometer, similar to the IIO interface. It seems to *only* support raw values AFAICT though, not sensitivity adjustment, so my patch gives the ability to have better sensor handling in the kernel from an IIO point of view.
I likewise looked at this long ago (came out roughly concurrently with the similar lis3l02dq driver) came to roughly the same conclusion.
Yours, Linus Walleij
-- Sent from my Android phone with K-9 Mail. Please excuse my brevity.