summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lis3lv02d.h
AgeCommit message (Collapse)AuthorFilesLines
2009-12-15lis3: selftest supportSamu Onkalo1-2/+12
Implement selftest feature as specified by chip manufacturer. Control: read selftest sysfs entry Response: "OK x y z" or "FAIL x y z" where x, y, and z are difference between selftest mode and normal mode. Test is passed when values are within acceptance limit values. Acceptance limits are provided via platform data. See chip spesifications for acceptance limits. If limits are not properly set, OK / FAIL decision is meaningless. However, userspace application can still make decision based on the numeric x, y, z values. Selftest is meant for HW diagnostic purposes. It is not meant to be called during normal use of the chip. It may cause false interrupt events. Selftest mode delays polling of the normal results but it doesn't cause wrong values. Chip must be in static state during selftest. Any acceration during the test causes most probably failure. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Éric Piel <Eric.Piel@tremplin-utc.net> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15lis3lv02d: proper power on sequenceSamu Onkalo1-0/+1
Lis3 accelerometer sensors have quite long power on delay (up to 125 ms). This patch adds necessary delay to power on sequence for currently supported lis3 chips. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Tested-by: Éric Piel <eric.piel@tremplin-utc.net> Acked-by: Éric Piel <eric.piel@tremplin-utc.net> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15lis3: fix show rate for 8 bits chipsÉric Piel1-0/+1
Originally the driver was only targeted to 12bits sensors. When support for 8bits sensors was added, some slight difference in the registers were overlooked. This should fix it, both for initialization, and for displaying the rate. Reported-by: Kalhan Trisal <kalhan.trisal@intel.com> Reported-by: Christoph Plattner <christoph.plattner@gmx.at> Tested-by: Christoph Plattner <christoph.plattner@gmx.at> Tested-by: Samu Onkalo <samu.p.onkalo@nokia.com> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15lis3: update documentation and commentsÉric Piel1-12/+16
Most of the documentation and comments were written when the driver was only supporting one type of chip, only via ACPI/HP. Update the info to the much clearer understanding that we have now. Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-22lis3: add free-fall/wakeup function via platform_dataDaniel Mack1-6/+18
This offers a way for platforms to define flags and thresholds for the free-fall/wakeup functions of the lis302d chips. More registers needed to be seperated as they are specific to the Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-17lis3: add click functionDaniel Mack1-1/+18
The LIS302DL accelerometer chip has a 'click' feature which can be used to detect sudden motion on any of the three axis. Configuration data is passed via spi platform_data and no action is taken if that's not specified, so it won't harm any existing platform. To make the configuration effective, the IRQ lines need to be set up appropriately. This patch also adds a way to do that from board support code. The DD_* definitions were factored out to an own enum because they are specific to LIS3LV02D devices. Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-17lis3: use input_polled_deviceEric Piel1-2/+3
Now that there is no need to hookup on the open/close of the joystick, it's possible to use the simplified interface input_polled_device, instead of creating our own kthread. [randy.dunlap@oracle.com: fix Kconfig] [randy.dunlap@oracle.com: fix Kconfig some more] Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-17lis3: remove automatic shutdown of the deviceEric Piel1-4/+1
After measurement on my laptop, it seems that turning off the device does not bring any energy saving (within 0.1W precision). So let's keep the device always on. It simplifies the code, and it avoids the problem of reading a wrong value sometimes just after turning the device on. Moreover, since commit ef2cfc790bf5f0ff189b01eabc0f4feb5e8524df had been too zealous, the device was actually never turned off anyway. This patch also restores the damages done by this commit concerning the initialisation/poweroff. Also do more clean up with the usage of the lis3_dev global variable. Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-01lis3: solve dependency between core and ACPIDaniel Mack1-10/+10
This solves the dependency between lis3lv02d.[ch] and ACPI specific methods. It introduces a ->bus_priv pointer to the device struct which is casted to 'struct acpi_device' in the ACIP layer. Changed hp_accel.c accordingly. Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-01hp_accel: adev is poor name of exported symbolPavel Machek1-1/+1
As Andrew noted, adev is pretty poor name for symbol being exported. Rename it to lis3. Signed-off-by: Pavel Machek <pavel@ucw.cz> Cc: Eric Piel <eric.piel@tremplin-utc.net> Cc: Vladimir Botka <vbotka@suse.cz> Cc: <Quoc.Pham@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-19lis3lv02d: support both one- and two-byte sensorsGiuseppe Bilotta1-3/+13
Sensors responding with 0x3B to WHO_AM_I only have one data register per direction, thus returning a signed byte from the position which is occupied by the MSB in sensors responding with 0x3A. Since multiple sensors share the reply to WHO_AM_I, we rename the defines to better indicate what they identify (family of single and double precision sensors). We support both kind of sensors by checking for the sensor type on init and defining appropriate data-access routines and sensor limits (for the joystick) depending on what we find. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Eric Piel <Eric.Piel@tremplin-utc.net> Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-19hp accelerometer: add freefall detectionPavel Machek1-0/+5
This adds freefall handling to hp_accel driver. According to HP, it should just work, without us having to set the chip up by hand. hpfall.c is example .c program that parks the disk when accelerometer detects free fall. It should work; for now, it uses fixed 20seconds protection period. Signed-off-by: Pavel Machek <pavel@suse.cz> Cc: Thomas Renninger <trenn@suse.de> Cc: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-10LIS3LV02D: separate the core from HP ACPI APIEric Piel1-1/+34
The sensor can be accessed via various buses. In particular, SPI, I²C and, on HP laptops, via a specific ACPI API (the only one currently supported). Separate this latest platform from the core of the sensor driver to allow support for the other bus type. The second, and more direct goal is actually to be able to merge this part with the hp-disk-leds driver, which has the same ACPI PNP number. Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-13LIS3LV02Dx Accelerometer driverPavel Machek1-0/+149
This adds a driver to the accelerometer sensor found in several HP laptops (under the commercial names of "HP Mobile Data Protection System 3D" and "HP 3D driveguard"). It tries to have more or less the same interfaces as the hdaps and other accelerometer drivers: in sysfs and as a joystick. This driver was first written by Yan Burman. Eric Piel has updated it and slimed it up (including the removal of an interface to access to the free-fall feature of the sensor because it is not reliable enough for now). Pavel Machek removed few more features and switched locking from semaphore to mutex. Several people have contributed to the database of the axes. [eric.piel@tremplin-utc.net: LIS3LV02D: Conform to the new ACPI API] Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Yan Burman <burman.yan@gmail.com> Signed-off-by: Pavel Machek <pavel@suse.cz> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>