Commit graph

1337 commits

Author SHA1 Message Date
Hartmut Knaack 423ad0c405 iio:light:stk3310: make endianness independent of host
Data is stored in the device in be16 format. Make use of be16_to_cpu and
cpu_to_be16 to have correct endianness on any host architecture.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 14:54:45 +01:00
Hartmut Knaack 037e966f2d iio:light:stk3310: move device register to end of probe
iio_device_register should be the last operation during probe. Therefor
move up interrupt setup code and while at it, change the check for invalid
values of client->irq to be smaller than zero.
Fixes: 3dd477acbd ("iio: light: Add threshold interrupt support for STK3310")

As the device_register makes the userspace interfaces of the device available
it is possible for requests to come in before the probe sequence has finished.
This can lead to unhandled interrupts and similar.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 14:53:16 +01:00
Martin Kepplinger c5d0db0690 iio: mma8452: use iio event type IIO_EV_TYPE_MAG
IIO_EV_TYPE_THRESH in rising direction describes an event where the
threshold is crossed in rising direction, positive or negative values
being possible. This is not the case here.

Since the threshold is no signed value and only the magnitude is compared,
IIO_EV_TYPE_MAG is what describes the behaviour of these devices, see the
sysfs-bus-iio ABI Documentation.

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 14:32:18 +01:00
Manfred Schlaegl 41be6a0d5a iio: mcp320x: Fix NULL pointer dereference
On reading in_voltage_scale of we got an NULL pointer dereference Oops.

The reason for this is, that mcp320x_read_raw tries to access
chip_info->resolution from struct mcp320x, but chip_info is never set.

chip_info was never set since the driver was added, but there was no
acute problem, because it was not referenced.
The acute problem exists since
b12206e917
iio: adc: mcp320x. Add support for more ADCs

This patch fixes the issue by setting chip_info in mcp320x_probe.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Reviewed-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 13:58:51 +01:00
Fugang Duan bf604a4c44 iio: adc: vf610: fix the adc register read fail issue
Read the register only when the adc register address is 4 byte aligned.
(rather than the other way around).

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Cc: <Stable.vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 13:35:26 +01:00
Crt Mori c68a67b7ad iio: mlx96014: Replace offset sign
Changed the offset to negative as usual equation is: (raw +
offset)*scale and in this
case offset should be negative (as we deduct 273.15 Kelvin to get temperature
in Celsius).

Signed-off-by: Crt Mori <cmo@melexis.com>
Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 12:23:39 +01:00
Viorel Suman 354c879dbd iio: magnetometer: mmc35240: fix SET/RESET sequence
The RESET operation invoked in the last instance will align
in the natural way all 3 axis and the chip top view.

Without this, north and south are swapped.

Signed-off-by: Viorel Suman <viorel.suman@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:54:29 +01:00
Daniel Baluta 3ceaa2c207 iio: magnetometer: mmc35240: Fix SET/RESET mask
This fixes setting the SET/RESET bit in the REG_CTRL0
register.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:36 +01:00
Daniel Baluta 8b14821a5c iio: magnetometer: mmc35240: Fix crash in pm suspend
We must set i2c client private data at probe in order to
correctly retrieve it in pm suspend/resume, preventing
the following crash:

[ 321.790582] PM: Syncing filesystems ... done.
[ 322.364440] PM: Preparing system for mem sleep
[ 322.400047] PM: Entering mem sleep
[ 322.462178] BUG: unable to handle kernel NULL pointer dereference at 0000036c
[ 322.469119] IP: [<80e0b3d2>] mmc35240_suspend+0x12/0x30
[ 322.474291] *pdpt = 000000002fd6f001 *pde = 0000000000000000
[ 322.479967] Oops: 0000 1 PREEMPT SMP
[ 322.496516] task: a86d0df0 ti: a8766000 task.ti: a8766000
[ 322.570744] Call Trace:
[ 322.573217] [<80c0d2d1>] pm_generic_suspend+0x21/0x30
[ 322.578284] [<80d042ab>] i2c_device_pm_suspend+0x1b/0x30

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:35 +01:00
Hartmut Knaack 6a14925ef2 iio:magnetometer:bmc150_magn: output intended variable
According to the debug/error string, the content of chip_id is supposed to
be output, rather than the return value of the previous operation.

Fixes: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:35 +01:00
Hartmut Knaack 2e187a0284 iio:magnetometer:bmc150_magn: add regmap dependency
bmc150_magn makes use of REGMAP_I2C, so select it to build always without
errors.

Fixes: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:31 +01:00
Peter Meerwald f451957daf iio: tmp006: Check channel info on write
only SAMP_FREQ is writable

Will lead to SAMP_FREQ being written by any attempt to write
to the other exported attributes and hence a rather unexpected
result!

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:18 +01:00
Geert Uytterhoeven 06b00f99ca iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able()
drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_preenable’:
drivers/iio/proximity/sx9500.c:682: warning: ‘ret’ may be used uninitialized in this function
drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_predisable’:
drivers/iio/proximity/sx9500.c:706: warning: ‘ret’ may be used uninitialized in this function

If active_scan_mask is empty, it will loop once more over all channels,
doing nothing.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:17 +01:00
Hartmut Knaack c42b9e13f9 iio:light:ltr501: fix regmap dependency
The use of regmap in commit 2f2c96338a requires REGMAP_I2C to be selected, in
order to meet all dependencies.

Fixes: 2f2c96338a ("iio: ltr501: Add regmap support.")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:17 +01:00
Hartmut Knaack fe5adb9174 iio:light:ltr501: fix variable in ltr501_init
When filling data->als_contr, the register content read into status needs
to be used, instead of the return status value of regmap_read.

Fixes: 8592a7eefa ("iio: ltr501: Add support for ltr559 chip")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:16 +01:00
Vlad Dogaru 0d1462de0b iio: sx9500: fix bug in compensation code
The initial compensation was mistakingly toggling an extra bit in the
control register.  Fix this and make sure it's less likely to happen by
introducing an additional macro.

Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:15 +01:00
Vlad Dogaru 498adaeb89 iio: sx9500: rework error handling of raw readings
Fix error handling so that we can power the chip down even if a raw read
fails.

Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:15 +01:00
Teodora Baluta c99389ad3d iio: magnetometer: mmc35240: fix available sampling frequencies
Fix the sampling frequencies according to the datasheet (page 8). The
datasheet specifies the following available frequencies for continuous
mode: 1.5 Hz, 13 Hz, 25 Hz, and 50 Hz.

Also fix comments about the ODR to comply with datasheet.

Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:14 +01:00
Hartmut Knaack 53c8eccb71 iio:light:stk3310: Fix REGMAP_I2C dependency
The stk3310 driver makes use of regmap_i2c, so this dependency needs to be
reflected in Kconfig.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:13 +01:00
Tiberiu Breana 0f16fc8bb3 iio: light: STK3310: un-invert proximity values
In accordance with the recent proximity ABI changes,
STK3310's proximity readings should be un-inversed
in order to return low values for far-away objects
and high values for close ones.

As consequences of this change, iio event directions
have been switched and maximum proximity sensor
reference values have also been adjusted in accordance
with the real readings.

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:12 +01:00
Hartmut Knaack 5646e856db iio:adc:cc10001_adc: fix Kconfig dependency
The Cosmic Circuits 10001 ADC driver depends on HAS_IOMEM, HAVE_CLK and
REGULATOR together, not just any of these.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:12 +01:00
Peter Meerwald 40f34b0c75 iio: light: tcs3414: Fix bug preventing to set integration time
the millisecond values in tcs3414_times should be checked against
val2, not val, which is always zero.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Stephan Kleisinger <stephan.kleisinger@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:10 +01:00
Hartmut Knaack c13c9da6d8 iio:accel:bmc150-accel: fix counting direction
In bmc150_accel_unregister_triggers() triggers should be unregistered in
reverse order of registration. Trigger registration starts with number 0,
counting up. In consequence, trigger number needs to be count down here.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:09 +01:00
Hartmut Knaack bd7bd0cc3a iio:light:cm3323: clear bitmask before set
When setting the bits for integration time, the appropriate bitmask needs
to be cleared first.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:08 +01:00
Jan Leupold 815983e9af iio: adc: at91_adc: allow to use full range of startup time
The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
some higher values can't be reached.

Change the type in function parameter and private structure field from u8 to
u32.

Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
[nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:06 +01:00
JM Friedt 09f4dcc944 iio: DAC: ad5624r_spi: fix bit shift of output data value
The value sent on the SPI bus is shifted by an erroneous number of bits.
The shift value was already computed in the iio_chan_spec structure and
hence subtracting this argument to 16 yields an erroneous data position
in the SPI stream.

Signed-off-by: JM Friedt <jmfriedt@femto-st.fr>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:05 +01:00
Daniel Baluta 86d24f04f9 iio: proximity: sx9500: Fix proximity value
Because of the ABI confusion proximity value exposed by SX9500
was inverted.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:04 +01:00
Adriana Reus 2acbe15f8a iio: inv-mpu: Specify the expected format/precision for write channels
The gyroscope needs IIO_VAL_INT_PLUS_NANO for the scale channel and
unless specified write returns MICRO by default.
This needs to be properly specified so that write operations into scale
have the expected behaviour.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:01 +01:00
Fabio Estevam b220da654d iio: twl4030-madc: Pass the IRQF_ONESHOT flag
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.

So pass the IRQF_ONESHOT flag in this case.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/irqf_oneshot.cocci.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:00 +01:00
Heiko Stuebner c11e28f959 iio: adc: rockchip_saradc: add missing MODULE_* data
The module-data is currently missing. This includes the license-information
which makes the driver taint the kernel and miss symbols when compiled as
module.

Fixes: 44d6f2ef94 ("iio: adc: add driver for Rockchip saradc")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:47:58 +01:00
Srinivas Pandruvada 88cc7b4eee hid-sensor: Fix suspend/resume delay
By default all the sensors are runtime suspended state (lowest power
state). During Linux suspend process, all the run time suspended
devices are resumed and then suspended. This caused all sensors to
power up and introduced delay in suspend time, when we introduced
runtime PM for HID sensors. The opposite process happens during resume
process.

To fix this, we do powerup process of the sensors only when the request
is issued from user (raw or tiggerred). In this way when runtime,
resume calls for powerup it will simply return as this will not match
user requested state.

Note this is a regression fix as the increase in suspend / resume
times can be substantial (report of 8 seconds on Len's laptop!)

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Len Brown <len.brown@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:47:57 +01:00
Greg Kroah-Hartman 78a66b00d9 Third round of new IIO drivers, cleanups and functionality for the 4.2 cycle.
Given Linus announced a 4.8rc coming up, hopefully time for one more
 lot of IIO patches this cycle.  Some of these are actually
 improvements / fixes for patches earlier in the cycle.
 
 New device support
 * st_accel driver - support devices with 8 bit channels.
 
 Cleanup
 * A general cleanup of the iio tools under /tools/ from Hartmut.
   I'm more than a little embarassed by how bad some of these were! Are well,
   much more refined and less bug prone now.
   These cover lots of stuff like unhandled error returns, memory leaks as
   well as general refactoring to tidy the code up.
 * iio_simple_dummy - fix memory leaks in the init functions, drop some
   pointless error returns from functions that never generate errors and
   make the module parameter explicitly unsigned.
 * More buffer handling reworks from Lars-Peter, this time targetting hardware
   buffers (a little used corner that looks likely to get more use in the near
   future). Specifically:
   - Always compute the masklength as inkernel buffer users may need it.
   - Add a means of labeling which buffer modes a given buffer implementation
     supports.
   - In the case of hardware buffers, require strict scan matching rather than
     matching to a superset.  Currently the demux is bypassed by these drivers
     (this may well not change for efficiency reasons) so allowing a superset
     of channels to be selected would otherwise lead to more data than requested
     confusing userspace.
 
 Driver funcationality improvments
 * mmc35240 - adds a compensation to the raw values as borrowed form Memsic's
   own input driver.
 * mma8452
   - event support
   - event debouncing
   - high  pass filter configuration
   - triggers
 * vf610 - allow conversion mode to be adjusted
 
 Fixlets
 * mmc35240
   - Off by one error that by coincidence had no real effect.
   - i2c_device_name should be lowercase.
   - Lack of null terminator at end of attributes array.
   - Avoid computing the fractional part of the magnetic field by moving
     the scaling into userspace where floating point is available to simplify
     the maths.
   - Use a smaller sleep before assuming the measurement is done.  This is
     safe and improves the possible polling rate.
   - Fix sensitivity on z-axis - datasheet disagrees with Memsic's releasedd
     code and the value used in the code seems to be correct.
 * stk3310 - make a local variable signed to ensure error handling works.
 * twl4030
   - fix calculation of the temperature sense current - bug unlikely
     to have ever been noticed as the difference is small.
   - Fix errors in descriptions.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVdgz8AAoJEFSFNJnE9BaIMSoP/RYq9yzkRtQ+T7ZnxdW0uaVK
 W8zhcg9W62dKbu0ccMVI+ESv9bg+3Ti/ZHE2251olYzXER5qrUUqB7llpgJeoni+
 ft1RyOZYYTWqv/2fx9Jdn+h4792tv4nykdgY3YhxR3anPD5Tb3PcRryCJ739d6xL
 c8HZedMP9znbC7BiEzRcLBPiyiv+NFKHF0T6LCkwlTGoe6q+8yaW1blmxTRmtpnD
 Wpf08/vafBmbjUmxfcvtgyOr73D6/kNOk9xYtvbQguD5nG5oHRe96nlaTtW7//hi
 ybP0q+UPV7Hss1pgufEZufPfWglsqOpIWJ7diUyXzvf9x7FAUd2nuiAHKybUg4bT
 yC2dSCVgRAa1zLEwcTub5MNtjkcfM0l9wsnCCIssD5p9s4EEenge1UjHsV7zm/KA
 JzBKBRz98Mo6m+F2gWZkkpuIb9UbI99oLBVDzhFBYf77b1L8curJ+pBH2lcICMun
 K5+WC3itkl7QImbyrCXdHmu9/oWS2+MSVHsmmL4omMFb071/C1iAUCIJahJrbgcy
 jIjaNJp3WgOplQp4tlP6WtsbzHh0DzjjLj+RKFv2mqYMlHhhAFdoH68qXPxG3kYo
 IxyGh7sH7ic5BQyt4B8/GhxakDuf55O/kyS7t01B3c5JbJp/IAbobfWkpCtuICYV
 GIIZTKI5kJb1Q8P7AbUD
 =sNVc
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-v4.2c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third round of new IIO drivers, cleanups and functionality for the 4.2 cycle.

Given Linus announced a 4.8rc coming up, hopefully time for one more
lot of IIO patches this cycle.  Some of these are actually
improvements / fixes for patches earlier in the cycle.

New device support
* st_accel driver - support devices with 8 bit channels.

Cleanup
* A general cleanup of the iio tools under /tools/ from Hartmut.
  I'm more than a little embarassed by how bad some of these were! Are well,
  much more refined and less bug prone now.
  These cover lots of stuff like unhandled error returns, memory leaks as
  well as general refactoring to tidy the code up.
* iio_simple_dummy - fix memory leaks in the init functions, drop some
  pointless error returns from functions that never generate errors and
  make the module parameter explicitly unsigned.
* More buffer handling reworks from Lars-Peter, this time targetting hardware
  buffers (a little used corner that looks likely to get more use in the near
  future). Specifically:
  - Always compute the masklength as inkernel buffer users may need it.
  - Add a means of labeling which buffer modes a given buffer implementation
    supports.
  - In the case of hardware buffers, require strict scan matching rather than
    matching to a superset.  Currently the demux is bypassed by these drivers
    (this may well not change for efficiency reasons) so allowing a superset
    of channels to be selected would otherwise lead to more data than requested
    confusing userspace.

Driver funcationality improvments
* mmc35240 - adds a compensation to the raw values as borrowed form Memsic's
  own input driver.
* mma8452
  - event support
  - event debouncing
  - high  pass filter configuration
  - triggers
* vf610 - allow conversion mode to be adjusted

Fixlets
* mmc35240
  - Off by one error that by coincidence had no real effect.
  - i2c_device_name should be lowercase.
  - Lack of null terminator at end of attributes array.
  - Avoid computing the fractional part of the magnetic field by moving
    the scaling into userspace where floating point is available to simplify
    the maths.
  - Use a smaller sleep before assuming the measurement is done.  This is
    safe and improves the possible polling rate.
  - Fix sensitivity on z-axis - datasheet disagrees with Memsic's releasedd
    code and the value used in the code seems to be correct.
* stk3310 - make a local variable signed to ensure error handling works.
* twl4030
  - fix calculation of the temperature sense current - bug unlikely
    to have ever been noticed as the difference is small.
  - Fix errors in descriptions.
2015-06-10 20:48:34 -07:00
Linus Walleij bbf5f037fa iio: st_accel: support the LIS331DL sensor
This adds support for the LIS331DL sensor version. This is
a simple 8bit-only accelerometer.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-08 22:21:18 +01:00
Greg Kroah-Hartman 6394d6d01b Merge 4.1-rc7 into staging-testing
We want the staging tree fixes in here too to help with testing and
merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 10:34:44 -07:00
Linus Walleij 4861a007bf iio: st_accel: support 8bit channel data
Some sensors like the LIS331DL only support 8bit data by a single
register per axis. These utilize the MSB byte. Make it possible
to register these apropriately.

A oneliner change is needed in the ST sensors core to handle 8bit
reads as this is the first supported 8bit sensor.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:58:28 +01:00
Stefan Agner bf04c1a367 iio: adc: vf610: implement configurable conversion modes
Support configurable conversion mode through sysfs. So far, the
mode used was low-power, which is enabled by default now. Beside
that, the modes normal and high-speed are selectable as well.

Use the new device tree property which specifies the maximum ADC
conversion clock frequencies. Depending on the mode used, the
available resulting conversion frequency are calculated
dynamically.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:53:25 +01:00
H. Nikolaus Schaller 994bda83dc iio: adc: twl4030_madc: Fix description of twl4030_madc_set_current_generator()
The @chan parameter can be 0 or 1 and not a bit mask. Fix wrong description.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Marek Belisko <marek@goldelico.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:25:55 +01:00
H. Nikolaus Schaller 0cbb39f143 iio: adc: twl4030_madc: Fix calculation of the temperature sense current
The bit mask to read the setting of the constant current source
for measuring the NTC voltage was the wrong one. Since default
value is initialized to the lowest level (000 = 10uA) the difference
was probably never noticed in practice.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Marek Belisko <marek@goldelico.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:24:44 +01:00
Martin Fuzzey ae6d9ce056 iio: mma8452: Add support for interrupt driven triggers.
Implement interrupt driven trigger for data ready.
This allows more efficient access to the sample data.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:20:36 +01:00
Martin Fuzzey 1e79841a00 iio: mma8452: Add highpass filter configuration.
Allow the cutoff frequency of the high pass filter to be configured.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:20:33 +01:00
Martin Fuzzey 5dbbd19f11 iio: mma8452: Add support for transient event debouncing
Allow the debouce counter for transient events to be configured
using the sysfs attribute events/in_accel_thresh_rising_period

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:19:36 +01:00
Martin Fuzzey 28e3427824 iio: mma8452: Basic support for transient events.
The event is triggered when the highpass filtered absolute acceleration
exceeds the threshold.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:16:36 +01:00
Daniel Baluta 4892688d70 iio: magnetometer: mmc35240: Add compensation for raw values
This patch adds compensation formula to raw readings, borrowed
from Memsic's input driver.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:25 +01:00
Daniel Baluta 6b90da4b58 iio: magnetometer: mmc35240: Fix sensitivity on z-axis
Datasheet says (Page 2) that typical value for sensitivity
for 16 bits mode on Z-axis is 770. Anyhow, looking at the
input driver provided by Memsic the value for MMC35240 is
1024.

Also, testing shows that using 1024 for Z-axis senzitivity
offers better results.

Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:22 +01:00
Daniel Baluta 787f55c4d1 iio: magnetometer: mmc35240: Use a smaller sleep value
According to datasheet, Page 8, minimum wait time to complete
measurement is 10ms. Adjusting this value will increase the
userspace polling rate.

Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:20 +01:00
Daniel Baluta c2890547a0 iio: magnetometer: mmc35240: Fix broken processed value
The current computation for fractional part of the magnetic
field is broken. This patch fixes it by taking a different
approach. We expose the raw reading in milli Gauss (to avoid
rounding errors) with a scale of 0.001.

Thus the final computation is done in userspace where floating
point operation are more relaxed.

Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:18 +01:00
Daniel Baluta bd35a214f5 iio: magnetometer: mmc35240: NULL terminate attribute array
This avoid nasty crashes when registering the IIO device.

Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:12 +01:00
Daniel Baluta a52ffebcf1 iio: magnetometer: mmc35240: i2c device name should be lower case
This is the standard convention for i2c device name and
also this is the name used in some Intel platforms DT
files.

Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 16:33:09 +01:00
Dan Carpenter ed6e75c7dc iio: light: signedness bug in stk3310_write_raw()
"index" needs to be signed for the error handling to work.

Fixes: be9e6229d6 ('iio: light: Add support for Sensortek STK3310')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-01 16:57:23 +01:00
Dan Carpenter 5517547bf4 iio: magnetometer: correct a harmless off by one check
The line before limits i to 0-3 so the existing code works fine but the
check is still off by one and >= is intended instead of >.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-01 16:55:19 +01:00