Commit Graph

77 Commits

Author SHA1 Message Date
Greg Kroah-Hartman d84a2b0d6f Merge 3.17-rc6 into staging-next.
We want the fixes in there, and it resolves a merge issue with
drivers/iio/accel/bma180.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-22 07:30:03 -07:00
Irina Tirdea 48edc37481 iio: magn: ak8975: fix unnecessary casting between char* and const char*
Use const char* instead of casting const char* to char*.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-09-14 18:31:11 +01:00
Denis CIOCCA a31d092899 iio:magnetometer: bugfix magnetometers gain values
This patch fix gains values. The first driver was designed using
engineering samples, in mass production the values are changed.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-09-14 18:21:23 +01:00
Sanjeev Sharma 81816affea iio: remove .owner field for driver using module_platform_driver
This patch removes the .owner field for drivers which use the
platform_driver_register api because this is overriden in
_platform_driver_register.

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-08-26 21:08:38 +01:00
Reyad Attiyat 03d795589d iio: hid-sensor-magn-3d: Fix build warning
Fix build warning, sizeof() called on dynamically
sized pointer, by removing the call and the dependent
function parameter. It is not needed or used in this
driver, when pushing values to an iio buffer.

Changes from v1
- Fix mistake in varible name

Signed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-27 14:16:29 +01:00
Greg Kroah-Hartman 040bf7d63d Fourth round of IIO new drivers, functionality and cleanups for the 3.17 cycle
New functionality
 * A new modifier to indicate that a rotation is relative to either
   true or magnetic north.  This is to be used by some magnetometers
   that provide data in this way.
 * hid magnetometer now supports output rotations from various variants on
   North
 * HMC5843 driver converted to regmap and reworked to allow easy support
   of other similar devices.  Support for HMC5983 added via both i2c and SPI.
 * Rework of Exynos driver to simplify extension to support more devices.
 * Addition of support for the Exynos3250 ADC (which requires an additional
   clock)  Support for quite a few more devices on its way.
 
 Cleanups
 * ad7997 - a number of cleanups and tweaks to how the events are controlled
   to make it more intuitive.
 * kxcjk - cleanups and minor fixes for this new driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJT0VkRAAoJEFSFNJnE9BaIVmwP/i9/kzwHaXr09GbOMoUNlnuP
 4wU+qJTucPOlj0rNvE6VewOshkF5G1soMAc97MAlEL12mU0qXt+q9m9xu7aVnQwF
 FU87BECdmbWVSIfGnCwkm2PzN+zLmGKr/TTPdCa+kuX1WIq7tUfVwYJVqU7vxDde
 n1G5Rx3sbujwAd/kP5X0Bk35X2Wng4Af0f3tkuoRC8nFWCxXN1qW9VZHlJCp5UIh
 c4J1COUeANf26CnMbgz3qqumGtYX1gbGHi3zzD4vYxD+inqKtvg/pqTqge3J7E9D
 HBhyNn0Rd3m2DDoz/5fRQ5z/5CAKLkpsqJa9ZsYLzzmo3AHUDYoVA6tGIoExhW9q
 7P8FJgJx0Gc58V/A0Y48vcHAcqinoL+2vphc5BHZXA2wdeVHZxWO3e7HX7KUmr55
 AXlHowFf0VKoJjJtcfFkFjalF5flIfyA7Kiu+10kptj8wsoX+AjUHXPYDfeRxw+S
 7nkr/7janHvsBhoP83PqPdRSrlnNPiLJSl8ZIgegVpKOBtsRKJLGW4zlwTp1lchr
 M1ydD9eh3uUT3luKRCJzoXo60Ia15x3KBrZxIkQiORIW2otlfUm7dduICc4p9Ij7
 RjU8S1NbOVZiD8fNcbmnFp0Xj3cGf4K/Jf1Jvs/QrGB2GAuYoF48BIyeaHj0tCr8
 n4wJtDu+aly6vzM7Kf8d
 =iOto
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Fourth round of IIO new drivers, functionality and cleanups for the 3.17 cycle

New functionality
* A new modifier to indicate that a rotation is relative to either
  true or magnetic north.  This is to be used by some magnetometers
  that provide data in this way.
* hid magnetometer now supports output rotations from various variants on
  North
* HMC5843 driver converted to regmap and reworked to allow easy support
  of other similar devices.  Support for HMC5983 added via both i2c and SPI.
* Rework of Exynos driver to simplify extension to support more devices.
* Addition of support for the Exynos3250 ADC (which requires an additional
  clock)  Support for quite a few more devices on its way.

Cleanups
* ad7997 - a number of cleanups and tweaks to how the events are controlled
  to make it more intuitive.
* kxcjk - cleanups and minor fixes for this new driver.
2014-07-24 14:57:19 -07:00
Reyad Attiyat abea9c62c3 iio: hid-sensor-magn-3d: Add support for rotation from north
Add the HID usage attribute ID's and IIO channel info for rotation
from north support.

Signed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-20 13:39:35 +01:00
Reyad Attiyat 2a96540a5c iio: hid-sensor-magn-3d: Scan for usage attributes before setting up iio channels
Scan for and count the HID usage attributes supported by the driver.
This allows for the driver to only setup the IIO channels for the
sensor usages present in the HID USB reports.

Changes from v5
-Fixed kernel panic from invalid pointer dereference
-Fixed variable assignment style

Signed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-20 13:37:52 +01:00
Greg Kroah-Hartman 589e1d10ff Merge 3.16-rc5 into staging-next
We want the fixes in -rc5 in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-13 15:35:56 -07:00
Linus Walleij 2d7768a872 iio: st_sensors: add devicetree probing support
The I2C devices that make up the STMicroelectronics MEMS sensors
may be sneakily enabled by cleverly giving the device node the same
name as a string match from the platform device ID table. However
the right method is to use the compatible string.

On detection, the ST sensors use the ID string to probe and
instatiate the right sensor driver, so pass the kernel-internal ID
string in the .data field of the OF match table, and set the I2C
client name to this name when a compatible match is used.

This avoids having misc Linux-specific strings floating around in
the device tree.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-11 21:09:49 +01:00
Jonathan Cameron 2d239c9e92 iio:st sensors: remove custom sampling frequence attribute in favour of core support.
This allows in kernel client drivers to access this

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
2014-07-07 09:39:57 +01:00
Sachin Kamat 5f25b41f7e iio: hid-sensor-magn-3d: Fix return values
IIO_CHAN_INFO_SAMP_FREQ and IIO_CHAN_INFO_HYSTERESIS cases ignored
the actual return values (which could be -EINVAL) and instead
returned IIO_VAL_INT_PLUS_MICRO always. Return the actual value
obtained from the functions. Both functions return IIO_VAL_INT_PLUS_MICRO
upon success.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-05 11:07:12 +01:00
Greg Kroah-Hartman 3dc50c1af3 Second round of new drivers and cleanups for IIO in the 3.17 cycle.
New drivers
 * mcp4902, mcp4912 and mcp4922 SPI DAC driver.
 * max1027, max1029 and max1031 SPI ADC driver.
 
 Cleanups
 * cm32181 - use devm APIs to simplify error paths.
 * ak8975 - use devm APIs to simplify error paths.
 * ad9850 - drop some unused defines and an unnecessary goto.
 * hmc5843 - add missing devices to the device id table and the documentation.
 * ad9832 - small formatting cleanups.
 * sca3000 - hide direct use of the stufftoread element by adding a
     data_available function.  This is a precursor for the addition of buffer
     watermarks to the subsystem but stands as a good cleanup on its own.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJTsCi1AAoJEFSFNJnE9BaIncoP/i6vgt+l+jM7qCvD8xCa4Kto
 hwwXrtYEmAekAYcdcKesR/xBMw6Y1njjtPvnuOOXkxNcqLLhDUvvCGPvC2hsqNs1
 sZfq/KdzmgLNiy6FlprnVYAtoWL8yWiSdPa/aG7FAD/swOnrjQ+Dch/Kw0ha82dF
 CaoTLzLwwBr4V0m8XY4c6Uvgb+ywjYGsVspu69WKlMxnP9gGsb/e9QnqZteGwwxa
 D3ooy3dXdKzl3lc5y9HXqVDwFaennBxSiWtEHJZWUWt9QTeomeoSQuEa/6sJU9Fd
 MjOHiFuiiHF+fSCzvOKKudi3PFW//ztJjQQHlFbf7AojUH6uAnKuHzQ6mCM7dkH2
 h3pCidScC+nnPvJ4rF9uKHtj7kbch2vS0eT38BK04pCUiEOhv/55xIzFxLO58xFf
 d1a7Jlfyx498x0AVffPe+R/4a4/2cJWThB1lpPPKjq0Mm9Q5hdvHLTwloGCWfmVT
 k6y43xw0fC1DoNrXRe5aH8j7ih8CF1RaZowyWeEplIWDTrLixFqiZsVB6LwFjNxN
 ggTLK2rHfGlKEumqq7RlZGPSpkBs5a86KsuREEd169QCZYt2KCu5sZhW7+XKYPqa
 yIuGBfYXYAaaz71kK621jxKUhB3V61blUOX2/R1Cu4Mg02i441FibR04LquVReFy
 YNIGv95sgAsqXnfXHqfV
 =3Fhy
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second round of new drivers and cleanups for IIO in the 3.17 cycle.

New drivers
* mcp4902, mcp4912 and mcp4922 SPI DAC driver.
* max1027, max1029 and max1031 SPI ADC driver.

Cleanups
* cm32181 - use devm APIs to simplify error paths.
* ak8975 - use devm APIs to simplify error paths.
* ad9850 - drop some unused defines and an unnecessary goto.
* hmc5843 - add missing devices to the device id table and the documentation.
* ad9832 - small formatting cleanups.
* sca3000 - hide direct use of the stufftoread element by adding a
    data_available function.  This is a precursor for the addition of buffer
    watermarks to the subsystem but stands as a good cleanup on its own.
2014-06-29 09:49:28 -07:00
Beomho Seo a845a3aab8 iio: magnetometer: ak8975: Use devm_* APIs
This patch use devm_* APIs make driver simpler.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-06-29 12:03:45 +01:00
Greg Kroah-Hartman ef7994fa2a Merge 3.16-rc2 into staging-next
We want the staging fixes here as well.
2014-06-22 12:33:51 -04:00
Greg Kroah-Hartman e28642c04a First set of IIO fixes for the 3.16 cycle.
A mixed bag of fixes, many of which feel just to late for 3.15.
 
 * hid sensors - some devices need a feature report request in order to
   change power state.  This isn't part of the spec, but has been observed
   on several devices and does no harm to others.
 * mpl3115 has had two errors in the buffer description fixed. The presure is
   signed, not unsigned and the temperature has 12 bits rather than 16.
   These could lead to incorrect interpretation of the data in userspace.
 * tsl2x7x - the high byte of the proximity thresholds should be written along
   with the low byte (which was). This could lead to interesting results
   with large thresholds.
 * twl4030 - a flag to specify processed values were required was not set
   when initializing a reading.  As such values returned were in an unknown
   state. Fixed by simply initializing it appropriately.
 * IIO_SIMPLE_DUMMY_BUFFER did not select IIO_BUFFER leading to randconfig
   build errors.
 * ak8975 was applying an unwanted le16_to_cpu conversion as the i2c framework
   already performs one.  As such for big endian systems, the bytes would be
   in the wrong order in the magnetic field measurements reported.
 * mxs-lradc - the controllable voltage dividers were not enabled / disabled for
   later channels than the first one during conversion.
 * at91_adc error handling returned -ENOMEM in a u8. Return value of
   at91_adc_get_trigger_value_by_name changed to int thus allowing -ENOMEM and
   also original values to be returned.
 * mcb - mcb_request_mem returns and ERR_PTR but the caller was checking for
   NULL to detect an error.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJTnLYyAAoJEFSFNJnE9BaI6r4QAK22hjl1J3xoWwOPUJhfJ5Hh
 VTjwO1OxwQ1XtUN5WneeJM73eu6moXD/avG2NbX4orAkNjSXKL6+/3WAds/rYMj2
 0vPiJsKsGBBlhu2w2RU80xVOPT2/XXIH3bYWDiUlr/i6DLEh8mU3kKX/yZzF+cIn
 hheYnOHZzLqGH8JircScEJv+B06svZtlfoDeLYaKY03HupTvEH95mvCSZk71PxZb
 A+7Qb3nDlZrpLBFKj4L5x15MIoEgopID2pX0kHLNY2DE1sopr2Z+FgSa3u/wtSEx
 k/ViyHPRk1mjTrQ92RMmTF5lMts6JFCmMgpPCNmcSyRKt6Fe6KcCMiWIlSs9I69i
 6KAIes5XpP7Qti5Yd4gi70uiq7fL1hR18Yhzv6IdmNdS8iJhk53YiWDYiYBgXwWS
 rcOva4NsaoeLYUdNJZRtap3RLsQRKAxg7HNhL+G88rr3wCsA0P7rb6BMdFK+3MiS
 BDcYe8mHIzX9tJZa4EU8kOdr+aphQeDt1nH4aZDWT3J7fo6RWrWcPMWFAcx+1jp3
 VVDL6Jn8WIuxYIDFznSQ6T6tvsvuqPgCqOA0ygfzvruo3m/oWvTT/+i2YFotGH3Y
 7Mlw7TACAmcuZStBLg6R0R1fD39zpfp4/+GNRxFaaB8otMPyrbizb0HBcaksQCp0
 0MTbFSjuAlXZ3NhVIm2O
 =RuB2
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-3.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First set of IIO fixes for the 3.16 cycle.

A mixed bag of fixes, many of which feel just to late for 3.15.

* hid sensors - some devices need a feature report request in order to
  change power state.  This isn't part of the spec, but has been observed
  on several devices and does no harm to others.
* mpl3115 has had two errors in the buffer description fixed. The presure is
  signed, not unsigned and the temperature has 12 bits rather than 16.
  These could lead to incorrect interpretation of the data in userspace.
* tsl2x7x - the high byte of the proximity thresholds should be written along
  with the low byte (which was). This could lead to interesting results
  with large thresholds.
* twl4030 - a flag to specify processed values were required was not set
  when initializing a reading.  As such values returned were in an unknown
  state. Fixed by simply initializing it appropriately.
* IIO_SIMPLE_DUMMY_BUFFER did not select IIO_BUFFER leading to randconfig
  build errors.
* ak8975 was applying an unwanted le16_to_cpu conversion as the i2c framework
  already performs one.  As such for big endian systems, the bytes would be
  in the wrong order in the magnetic field measurements reported.
* mxs-lradc - the controllable voltage dividers were not enabled / disabled for
  later channels than the first one during conversion.
* at91_adc error handling returned -ENOMEM in a u8. Return value of
  at91_adc_get_trigger_value_by_name changed to int thus allowing -ENOMEM and
  also original values to be returned.
* mcb - mcb_request_mem returns and ERR_PTR but the caller was checking for
  NULL to detect an error.
2014-06-18 10:41:08 -07:00
Srinivas Pandruvada d14c0f10e7 iio: AK09911 : 3 axis compass support
Added IIO magnetometer driver for AK09911. In functionality is resembles
AK8975 or AK8963. But there are several differences, so instead of
modifying existing AK8975 driver and keep it clean, implemented as
a separate driver.
The key differences are:
- Register map is different and have different indexes
- AK09911 is a very compact interface with no DRDY pin. So no support
 of interrupt or GPIO poll
- Even for polled mode no mention on ST2 register, which is required in
ak8975 driver
- mode values are different for fuse access

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-06-16 20:55:24 +01:00
Peter Meerwald 8ba42fb7b1 iio: Fix endianness issue in ak8975_read_axis()
i2c_smbus_read_word_data() does host endian conversion already,
no need for le16_to_cpu()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Stable@vger.kernel.org
2014-06-07 11:50:34 +01:00
Srinivas Pandruvada 8009c594a5 iio: hid-sensors: Compass 3D: Raw read support
Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05 10:59:52 +01:00
Srinivas Pandruvada 56ff6be608 iio: hid-sensors: Add API to power on/off
Added an API to allow client drivers to turn ON and OFF sensors for
quick read. Added data_read as counting varaible instead of boolean,
so that sensor is powered off only when last user released it.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05 10:59:49 +01:00
Srinivas Pandruvada 92463fdab5 iio: hid-sensors: Compass 3D: adjust scale and offset
Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05 10:59:47 +01:00
Srinivas Pandruvada 88cece46ac iio: ak8975: Fix issue with the name
Fixing issue caused by clash of two patches, one adding a name with
the acpi enumeration patch.

54ab3e24 Beomho Seo          2014-04-02 @572  	indio_dev->name = id->name;
d913971e Srinivas Pandruvada 2014-03-19  574  	indio_dev->name = name;

The name added by commit 54ab3e24 is not required as this is already
added by taking care of case where id is NULL.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-03 12:01:13 +01:00
Peter Meerwald 0828eddc56 iio:magnetometer:mag3110: Enable user offset calibration
add IIO_CHAN_INFO_CALIBBIAS

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-03 11:27:52 +01:00
Peter Meerwald 6584891bd0 iio:magnetometer:mag3110: Fix initialization of ctrl_reg1
DR bits need to be shifted; since MAG3110_CTRL_DR_DEFAULT is
zero, the change has no effect

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-03 11:19:42 +01:00
Linus Walleij ea7e586bdd iio: st_sensors: move regulator retrieveal to core
Currently the pressure sensor has code to retrieve and enable two
regulators for Vdd and Vdd IO, but actually these voltage inputs
are found on all of these ST sensors, so move the regulator
handling to the core and make sure all the ST sensors call these
functions on probe() and remove() to enable/disable power.

Here also mover over to obtaining the regulator from the *parent*
device of the IIO device, as the IIO device is created on-the-fly
in this very subsystem it very unlikely evert have any regulators
attached to it whatsoever. It is much more likely that the parent
is a platform device, possibly instantiated from a device tree,
which in turn have Vdd and Vdd IO supplied assigned to it.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26 11:52:42 +01:00
Linus Walleij 4f544ced19 iio: st_sensors: announce registered sensors
It is pretty helpful to know already from dmesg that a certain
device is successfully registered, instead of having to browse
sysfs to see if it's actually there.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26 11:50:59 +01:00
Srinivas Pandruvada d913971eca iio: ak8975: Added ACPI enumeration
Added capability so that this device can be enumerated via ACPI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-03-29 10:40:39 +00:00
Srinivas Pandruvada 6027c077f6 iio: ak8975 : Add AK8963 compatibility mode support
AK8963 and AK8975 use same register definitions, except the range
of X,Y,Z values. Added support of 8963 based on i2c_device_id.
Unfortunately there is no way to detect the type via registers,
both device registers return 0x48 as id of chipset.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-03-22 12:41:37 +00:00
Peter Meerwald b2addb4a11 iio:magnetometer:mag3110: Fix unreachable code
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw()
        info: ignoring unreachable code.

drivers/iio/magnetometer/mag3110.c
   185          case IIO_CHAN_INFO_SCALE:
   186                  switch (chan->type) {
   187                  case IIO_MAGN:
   188                          *val = 0;
   189                          *val2 = 1000;
   190                          return IIO_VAL_INT_PLUS_MICRO;
   191                  case IIO_TEMP:
   192                          *val = 1000;
   193                          return IIO_VAL_INT;
   194                  default:
   195                          return -EINVAL;
   196                  }
   197                  return IIO_VAL_INT_PLUS_MICRO;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

introduced by f9279d3a, mag3110: Scale factor missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-25 20:45:58 +00:00
Peter Meerwald f9279d3a8c iio:magnetometer:mag3110: Scale factor missing for temperature
temperature is reported in milli-Celsius

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15 09:54:46 +00:00
Greg Kroah-Hartman e5b9c05772 First set of new drivers and cleanups for IIO in the 3.15 cycle.
New drivers:
 * si7005 relative humidity and temperature sensor
 * Lite-on ltr501 ambient light and proximity sensor
 
 Cleanups
 * Clean up some dead comments in max1363
 * Drop some obsolete variables in adjd_s311 and tcs3472 left over from
   the introduction of iio_push_to_buffers_with_timestamp.
 * Drop some unneeded linux/init.h includes
 * Squish a sparse warning in mpl3115 by correctly specifying a be32 variable.
 * A number of cleanups and fixes for sca3000
 * Drop an unneed checks in mxs-lradc, ad7303 and adis16400.
 * Drop a platform_set_drvdata in viperboard after the only use of it was
   removed during a devm conversion.
 * Add a missing device name for ak8975 to comply with the ABI.
 * Put mpu6050 into the IMU menu as it slipped out into the main menu.
 * Fix a typo and some comment formatting in mpu6050.
 * Document at91 ADC clock properties.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJS+R3TAAoJEFSFNJnE9BaILtoP/RiZaeAQe5hKVtS7DBNmtbvH
 NVrk4SDl8F5WH6O6MKvRn54aBWyPj3axyMb0WLv9oGQycxlflT/420Q1UaayG4oX
 W1IOS/X2JNrWpt/xlNPi8crqpcRZbLVjKoRGhw0BMR9OTD+x6U+NTNGpr9WJUNAB
 CjmYpa6MhouQMd59+HMroSf1PIvBfvG2fkAMg2AoRSQ6TU19q5Yi0zzqwS17iZf3
 VTazh63dVKYyt3MJimjnGcA4A2kv5YOrfK59qYfHPIVR4AfKNVKlwVQlu8TlBaXE
 eYr2G1Jbd/GRkUe5FRGL9Nlnl8exnUU8JGCTpeXSJSmDWAe2xVkjTNbDDyrT5Gem
 6c02ms0xYeIxqzYpZVZs8OueuZhs2DztcT0e+p7ByvjBZ+XvMEp9t00DnsV3rSEa
 Y9X1vpeZei5bRW+woKCniEhV/89seUe1ASyj/g8yiPYc5b1mKhcUQKFs1vCToWjV
 v0MEp15569jeqX+6igOAloArxykrdmS4hAeMfyKoijApd97n5hkK2jwjFxRv9rZs
 2Q+2qTDA/3E9+wRjLrx4v+Bu6EKH44K5Z5H5rPmnsgRe8/0UQx4xvhI6Bv2Krx0v
 CKdwNAo6Z5iePAtmaMU46l9h1AygOAzub9V2L36Irxd4BFLLYUj1zSW2hN1zgfCX
 4YTgPtTGZ/lBfNsvBy9b
 =nSiE
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new drivers and cleanups for IIO in the 3.15 cycle.

New drivers:
* si7005 relative humidity and temperature sensor
* Lite-on ltr501 ambient light and proximity sensor

Cleanups
* Clean up some dead comments in max1363
* Drop some obsolete variables in adjd_s311 and tcs3472 left over from
  the introduction of iio_push_to_buffers_with_timestamp.
* Drop some unneeded linux/init.h includes
* Squish a sparse warning in mpl3115 by correctly specifying a be32 variable.
* A number of cleanups and fixes for sca3000
* Drop an unneed checks in mxs-lradc, ad7303 and adis16400.
* Drop a platform_set_drvdata in viperboard after the only use of it was
  removed during a devm conversion.
* Add a missing device name for ak8975 to comply with the ABI.
* Put mpu6050 into the IMU menu as it slipped out into the main menu.
* Fix a typo and some comment formatting in mpu6050.
* Document at91 ADC clock properties.
2014-02-11 14:12:12 -08:00
Beomho Seo 54ab3e244d iio: ak8975: Add device name
This patch add device name.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:31:29 +00:00
Beomho Seo bef44abccb iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit
This effects the reported scale of the raw values, and thus userspace
applications that use this value.

One micro tesla equal 0.01 gauss. So I have fixed calculation formula And add RAW_TO_GAUSS macro.
ASA is in the range of 0 to 255. If multiply 0.003, calculation result(in_magn_[*]_scale) is
always 0. So multiply 3000 and return and IIO_VAL_INT_PLUS_MICRO.
As a result, read_raw call back function return accurate scale value.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:28:05 +00:00
Peter Meerwald 71bd89454d iio:magnetometer:mag3110: Fix output of decimal digits in show_int_plus_micros()
need to print leading zeros, hence "%d.%06d"

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:06:27 +00:00
Peter Meerwald f25330f63e iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled
individual reads are not permitted concurrently with buffered reads

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:06:22 +00:00
Jonathan Cameron e5687979eb iio🔍mag3110 replaces IIO_ST macro with explicit entries to struct scan_type
The IIO_ST macro no longer covers all the elements of struct scan_type
and has this has lead to some bugs being introduced.

The drivers are easier to follow with this structure being directly
filled so that is now preferred.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:55:50 +00:00
Greg Kroah-Hartman 06749f192b Merge v3.13-rc2 into staging-next
we want these fixes in here.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-02 16:39:07 -08:00
Srinivas Pandruvada 2461fc9f3f iio: hid-sensors: magnetometer : Add sensitivity
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
magnetometer fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 13:51:23 +00:00
Peter Meerwald 50619cb173 iio: Fix mag3110 Kconfig dependencies
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:15:34 +00:00
Peter Meerwald 911bdc68ec iio: Fix mag3110 scan_type
last argument of IIO_ST is shift, not endianness

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:12:33 +00:00
Srinivas Pandruvada ec7f68e07b iio: hid_Sensors: fix crash during trigger unregister
We can't store the trigger instance created by iio_trigger_alloc, in
trig field of iio_device structure. This needs to be stored in the
driver private data. Othewise it can result in crash during module
unload. Hence created a trig_ptr in the common data structure
for each HID sensor IIO driver and storing here.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-02 19:07:06 +00:00
Peter Meerwald 39631b5f95 iio: Add Freescale mag3110 magnetometer driver
three-axis digital magnetometer with I2C interface

datasheet is available from
http://cache.freescale.com/files/sensors/doc/data_sheet/MAG3110.pdf

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:43:11 +01:00
Peter Meerwald eb03610a9c iio: Correct description how to convert microtesla to gauss
this just fixes the comment; however, I'm not sure if the driver reports
measurements correctly; the raw values are 0.3 uT / LSB; IIO is supposed
to report magnetic fields in Gauss, so the scale should be around 1/300
(ignoring ASA) -- but value and scale are returned as VAL_INT

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-20 22:36:13 +01:00
Lars-Peter Clausen bbc1751d24 iio:st_magn: Remove redundant call to iio_sw_buffer_preenable().
The equivalent of iio_sw_buffer_preenable() is now done in the IIO buffer core,
so there is no need to do this from the driver anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-16 19:13:50 +01:00
Greg Kroah-Hartman 02ab343f3b Merge 3.12-rc4 into staging-next
We want the staging fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 17:22:43 -07:00
Denis CIOCCA 512690daa6 iio:magnetometer: Bugfix magnetometer default output registers
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-30 21:46:11 +01:00
Denis CIOCCA f60b12b02e iio:magn: Register buffer also without specific trigger
This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:08 +01:00
Lee Jones 267a29b957 iio: magn-core: st: Clean up error handling in probe()
Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:07 +01:00
Lars-Peter Clausen 8c60c7e75d iio: Remove unnecessary casts for iio_push_to_buffers()
Now that iio_push_to_buffers() takes a void pointer for the data parameter we
can remove those casts to u8*.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-15 19:05:07 +01:00
Peter Meerwald 0c0427acd5 iio: Remove unnecessary _write_raw_get_fmt() in several hid-sensor drivers
IIO_VAL_INT_PLUS_MICRO is the default, no need to return it explicitly

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-19 20:01:25 +01:00