Commit Graph

155 Commits

Author SHA1 Message Date
Greg Kroah-Hartman d47e538235 Fourth set of IIO new device support, features and cleanups for the 4.12 cycle
New device support
 * max1117, 1118 and 1119
   - new ADC driver
 * max9611
   - new ADC driver
 * pm8xxx hk/xoadc
   - new driver with some shared features broken out from the SPMI vadc.
 * sun4i-gpadc
   - A33 thermal sensor support (with associated rework)
 * stm32-dac
   - new driver and bindings
 * stm32 trigger
   - enable support of quadrature encoder device and counter modes
 
 Features
 * apds9960
   - use the runtime pm for normal suspend
 * stm32-adc
   - add opition to sest resolution via devicetree
 * xoadc
   - augment DT bindings to deal with some weird mux cases
 
 Cleanups
 * ad5933
   - protect direct mode using claim and release helpers
 * ade7759
   - S_IRUGO and friends to octal in two goes
 * adis16203
   - drop unnecessary brackets
 * hid-sensor
   - fix unbalanced pm_runtieme_enable error when probing after remove
 * lsm6dsx
   - use actual part numbers for device name when known
   - simplify data read pin parsing
 * mpu3050
   - avoid double reporting errors
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAljxPf4RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojZfA//UUaFcaEiMJjoUwBQlOM49nueGcAlOOOz
 blMYe6JIIm3DYjEJnNhlA1Wn83JVitGQopQ4Tt9yrsxc3urt6GiAiRCK1Lwuyauw
 l1IrdsV9tzbPrauL8UxZYygIYHZx6ltKnpbSHCrXaA2BOTIYzgIBDGmRv+MPutwW
 iaW+dKJVW5G/5VV0aIaJc2w5wXujFcWkZoiTJgZBHhGJJ5AY6zyA3tBEOIY7K3KO
 z4EIY6V9pvVaSgvuWGVWQjtYwjqSSqp5J5Ih7ATpp4hPwi+XIudWqaiq1y2rHQKM
 Y/wqjz+W/NyAJGSFEnub7gE4wGauQtxMiOLTenrfDWkFxF0YRkunylY8Kwcgvmhh
 +TdHhazlfIHca5z/MJ0dg/4UPj75o2CtB+N1NyNMjx/K7Juu2MmcKNShLa/l68jT
 rYEuNQUyhTvNuhlYPTcYmGbL7VbyXJzgbVbk9/Dd1hcS+p/oqn18ulGsWxcj5kEI
 ME+vHOakq02GTAQEG2FLvE604fTt/dHyXdYFsDY0RCm9ZSURvRqFLYpkxyrQFe+P
 yhC9b6ouW+dPGez0RmwPZTWnH0E6eN5b13yR3ILewj/NUVA6cjlm0inhnck1IwFe
 NWVQiMz1a2DsXfk5VjBQVlsipHxW9rs8SArdWnndDpbSErQJT/KrCxantmkNciYw
 oXf1eFCo/MQ=
 =zHqs
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Fourth set of IIO new device support, features and cleanups for the 4.12 cycle

New device support
* max1117, 1118 and 1119
  - new ADC driver
* max9611
  - new ADC driver
* pm8xxx hk/xoadc
  - new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
  - A33 thermal sensor support (with associated rework)
* stm32-dac
  - new driver and bindings
* stm32 trigger
  - enable support of quadrature encoder device and counter modes

Features
* apds9960
  - use the runtime pm for normal suspend
* stm32-adc
  - add opition to sest resolution via devicetree
* xoadc
  - augment DT bindings to deal with some weird mux cases

Cleanups
* ad5933
  - protect direct mode using claim and release helpers
* ade7759
  - S_IRUGO and friends to octal in two goes
* adis16203
  - drop unnecessary brackets
* hid-sensor
  - fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
  - use actual part numbers for device name when known
  - simplify data read pin parsing
* mpu3050
  - avoid double reporting errors
2017-04-18 17:13:31 +02:00
Greg Kroah-Hartman f78a8236c6 Merge 4.11-rc6 into staging-next
We want the staging and iio fixes in here to handle merging easier.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-10 15:21:55 +02:00
Peter Rosin 6a95d825f6 iio: gyro: mpu3050: stop double error reporting
i2c_mux_add_adapter already logs a message on failure.

Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-03 20:40:51 +01:00
Quentin Schulz 4bdc902968 iio: bmg160: reset chip when probing
The gyroscope chip might need to be reset to be used.

Without the chip being reset, the driver stopped at the first
regmap_read (to get the CHIP_ID) and failed to probe.

The datasheet of the gyroscope says that a minimum wait of 30ms after
the reset has to be done.

This patch has been checked on a BMX055 and the datasheet of the BMG160
and the BMI055 give the same reset register and bits.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 16:36:25 +00:00
Javier Martinez Canillas 91b4b16617 iio: gyro: itg3200: Add OF device ID table
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 10:58:31 +00:00
Wei Yongjun 752d01d990 iio: common: ssp_sensors: gyro: use devm_iio_device_register()
Use devm_iio_device_register() for IIO subsystem device
registration and delete the remove function since there
is no need after this change.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28 12:16:17 +00:00
Jonathan Cameron 8abd5ba539 iio:kfifo_buf header include push down.
As a precursor to splitting buffer.h, lets make sure all drivers
include the relevant headers rather than relying on picking them
up from kfifo_buf.h.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-01-10 19:54:53 +00:00
Linus Walleij d8594fa22a iio: gyro: st_gyro: inline per-sensor data
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 15:38:09 +00:00
Arnd Bergmann b548674ea7 iio: gyro: mpu3050: add I2C dependency
The new mpu3050 driver fails to build if I2C is disabled:

drivers/iio/built-in.o: In function `mpu3050_i2c_driver_exit':
mpu3050-i2c.c:(.exit.text+0x17f): undefined reference to `i2c_del_driver'
drivers/iio/built-in.o: In function `mpu3050_i2c_driver_init':
mpu3050-i2c.c:(.init.text+0x215): undefined reference to `i2c_register_driver'

This adds a Kconfig dependency to ensure we only build it when I2C
is available.

Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:29:33 +00:00
Arnd Bergmann 630e7ab470 iio: gyro: mpu3050: remove duplicate initializer
The newly added mpu3050 driver has two initializations for the
module owner, which causes a warning for 'make W=1':

include/linux/export.h:37:21: error: initialized field overwritten [-Werror=override-init]
drivers/iio/gyro/mpu3050-core.c:749:19: note: in expansion of macro 'THIS_MODULE'

This removes one of the two.

Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:28:25 +00:00
Linus Walleij 3904b28efb iio: gyro: Add driver for the MPU-3050 gyroscope
This adds a new driver for the Invensense MPU-3050 gyroscope.
This driver is based on information from the rough input driver
in drivers/input/misc/mpu3050.c and the scratch misc driver
posted by Nathan Royer in 2011. Some years have passed but this
is finally a fully-fledged driver for this gyroscope. It was
developed and tested on the Qualcomm APQ8060 Dragonboard.

The driver supports both raw and buffered input. It also
supports the internal trigger mechanism by registering a trigger
that can fire in response to the internal sample engine of the
component. In addition to reading out the gyroscope sensor
values, the driver also supports reading the temperature from
the sensor.

The driver currently only supports I2C but the MPU-3050 can
also be used from SPI, so the I2C portions are split in their
own file and we just use regmap to access all registers, so
it will be trivial to plug in SPI support if/when someone has
a system requiring this.

To conserve power, the driver utilizes the runtime PM
framework and will put the sensor in off mode and disable the
regulators when unused, after a timeout of 10 seconds.

The fullscale can be set for the sensor to 250, 500, 1000 or
2000 deg/s. This corresponds to scale values of rougly 0.000122,
0.000275, 0.000512 or 0.001068. By writing such values (or close
to these) into "in_anglevel_scale", the corresponding fullscale
can be chosen. It will default to 2000 deg/s (~35 rad/s).

The gyro component can have DC offsets on all axes. These can be
compensated using the standard sysfs ABI property
"in_anglevel_[xyz]_calibbias". This is in positive/negative
values of the raw values, so a suitable calibration bias can be
determined by userspace by reading the "in_anglevel_[xyz]_raw"
for a few iterations while holding the sensor still, create an
average integer, and writing the negative inverse of that into
"in_anglevel_[xyz]_calibbias". After this the hardware will
automatically subtract the bias, also when using buffered
readings.

Since the MPU-3050 has an outgoing I2C port it needs to act as
an I2C mux. This means that the device is switching I2C traffic
to devices beyond it. On my system this is the only way to reach
the accelerometer. The "sensor fusion" ability of the MPU-3050
to directly talk to the device on the outgoing I2C port is
currently not used by the driver, but it has code to allow I2C
traffic to pass through so that the Linux kernel can reach the
device on the other side with a kernel driver.

Example usage with the native trigger:

$ generic_buffer -a -c10 -n mpu3050
iio device number being used is 0
iio trigger number being used is 0
No channels are enabled, enabling all channels
Enabling: in_anglvel_z_en
Enabling: in_timestamp_en
Enabling: in_anglvel_y_en
Enabling: in_temp_en
Enabling: in_anglvel_x_en
/sys/bus/iio/devices/iio:device0 mpu3050-dev0
29607.142578 -0.117493 0.074768 0.012817 180788797150
29639.285156 -0.117493 0.076904 0.013885 180888982335
29696.427734 -0.116425 0.076904 0.012817 180989178039
29742.857422 -0.117493 0.076904 0.012817 181089377742
29764.285156 -0.116425 0.077972 0.012817 181189574187
29860.714844 -0.115356 0.076904 0.012817 181289772705
29864.285156 -0.117493 0.076904 0.012817 181389971520
29910.714844 -0.115356 0.076904 0.013885 181490170483
29917.857422 -0.116425 0.076904 0.011749 181590369742
29975.000000 -0.116425 0.076904 0.012817 181690567075
Disabling: in_anglvel_z_en
Disabling: in_timestamp_en
Disabling: in_anglvel_y_en
Disabling: in_temp_en
Disabling: in_anglvel_x_en

The first column is the temperature in millidegrees, then the x,y,z
axes in succession followed by the timestamp. Also tested successfully
using the HRTimer trigger.

Cc: Nick Vaccaro <nvaccaro@google.com>
Cc: Ge Gao <ggao@invensense.com>
Cc: Anna Si <asi@invensense.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Cc: Gregor Boirie <gregor.boirie@parrot.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25 17:24:05 +01:00
Julia Lawall becf05e748 iio: common: ssp_sensors: gyro: constify iio_info structures
Check for iio_info structures that are only stored in the info field of a
iio_dev structure.  This field is declared const, so iio_info structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct iio_info i@p = { ... };

@ok@
identifier r.i;
struct iio_dev e;
position p;
@@
e.info = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct iio_info e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct iio_info i = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1245        344       0    1589         635
   drivers/iio/gyro/ssp_gyro_sensor.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1397       192          0       1589     635
   drivers/iio/gyro/ssp_gyro_sensor.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18 11:59:51 +01:00
Steffen Trumtrar bf61f5d226 iio: bmg160: add callbacks for the filter frequency
The filter frequency and sample rate have a fixed relationship.
Only the filter frequency is unique, however.
Currently the driver ignores the filter settings for 32 Hz and
64 Hz.

This patch adds the necessary callbacks to be able to configure
and read the filter setting from sysfs.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-03 12:39:55 +01:00
Gregor Boirie bc2b7dab62 iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30 19:41:38 +01:00
Greg Kroah-Hartman af52739b92 Merge 4.7-rc4 into staging-next
We want the fixes in here, and we can resolve a merge issue in
drivers/iio/industrialio-trigger.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-20 08:25:44 -07:00
Greg Kroah-Hartman aabb406008 First round of IIO new device support, features and cleanups for the 4.8 cycle.
New device support
 * ads1015
   - add ads1115 support
 * bma220 accelerometer
   - new driver
   - triggered buffer support.
 * bmc150
   - add bmm150 support.
 * bmp280
   - bme280 support with addition of humidity channel.
 * max5487 potentiometer
   - new driver
 * MMA7660FC accelerometer.
   - New driver
 * st-pressure
   - support for the lps22hb
 * loop trigger.
   - This one is *nasty* but we have real applications (parrot drones) where
   it is useful.  The trigger basically spins as hard as it can firing off
   a new trigger each time all triggered devices come back to say they are
   done.  It doesn't hang a machine even when doing it on a dummy driver.
   A lot nicer than having this implemented within lots of device drivers
   anyway.
 
 Core stuff
 * Add support to create IIO devices via configfs (similar to we did for
 triggers a while back) + docs.
 * New channel types
   - IIO_ELECTRICAL_CONDUCTIVITY
 * Couple of MAINTAINERS patches to list the device tree bindings.
 * Make trigger ops structure non optional (comment fix). It hasn't been for
 an awful long time, but that's not what the description said.
 
 New features
 * ak8975
   - support adapters that are limited to byte data only by allowing the
   emulated block read i2c function that was recently introduced.
 * atlas-ph
   - support atlas-ec (electrical conductivity sensor)
 * bmi160
   - add available frequency and scale attributes to make the driver
   more user friendly (and avoid having to read the datasheet to know
   what will work).
 * dummy
   - move creation to configfs interface.  It's not real hardware so we
   are not that worried about the ABI breakage ;)
 * mma8452
   - oversampling ration support
 * nau7802
   - expose available gains to make life easier for userspace.
 * st-sensors
   - allow use of emulation for SMBus block reads as all the st parts support
   it.
 * ti-ads1015
   - list datasheet names to allow their use by inkernel consumers.
 * Various module alias additions to help auto probing.  Drop one redundant one
 as well.
 
 Cleanups
 * ad7266, ad7476, ad7887, ad7923, ad799x
   - use direct mode claim function rather than open coding it during sensor
   read (prevents switching on buffers mid read).
 * ad7793, ad7791
   - use direct mode claim to prevent frequency changes when buffers running.
 * afe440x - These are ABI breaking but the driver requires custom userspace
   code to do anything useful anyway and that is still being written and under
   control of TI.  Ultimately we may have other libraries to do pulse
   oximetry with these devices but we aren't aware of any yet.
   - kernel-doc format fixes
   - drop ifdef fun around of_match_ptr - it's not worth the mess to save
   a tiny amount of space.
   - drop some unnecessary register initializations.
   - drop the weird locked gain modes as they gain us nothing (can just set
   all gains separately).
   - remove handling of offset attributes seeing as no channels actually have
   them (oops)
   - Drop the LED3 input channel as it's an alias for ALED2.
   - *big one* remove channel names - an experiment that turned out to not
   make sense - see patch for details.
   - use regmap fields to clean up code.
   - tie the tia gain stages to appropriate channels in the ABI as that is
   what they really effect. Same with the LED currents.
   - cleanout some unused defines and fix a missnamed one.
 * atlas-ph
   - reorganise to allow support of other similar parts.
 * bmc150
   - document supported chips in kconfig help.
 * jsa1212
   - drop an unneeded i2c functionality check for functionality the driver
   doesn't use.
 * mxs-lradc
   - simply touch screen registration code.
   - remove the touch screen unregister as all devm based now.
   - disable only those channels that are masked in hardware stop (others
   are already dealt with elsewhere)
 * st-sensors
   - unexport st_sensors_get_buffer_element as nothing outside the st-sensors
   core driver uses it.
   - fix handling of failure to start up regulators.
 * tpl0102
   - drop an i2c functionality test for features that aren't needed.
 * ti-am335x
   - use variable name rather than type in sizeof for clarity.
   - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.
 
 Tools
 * Add install / uninstall to makefile.  Someone cares, so presumably
 some people will find it useful!
 *  generic_buffer
    - rename to iio_generic_buffer to line up with other tools.
    - handle cleanup when receiving signals
    - Add a --device-num option and a --trigger-num option rather than
    relying on naming which doesn't work if you have two of the same part.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXWFXGAAoJEFSFNJnE9BaIQ4kP/jcoVTR8w6EMdcr1BErrvFgm
 IMbMMK8wJtc1dhKcp77h/DQjCunPAaDMgdtg1uJcreRDl1dY1jiFh/PMLrt/eods
 tsJZcN1h40aLlPEdMQFl3oiaWjpUm23gdDtfiCHA+sM/FhQ+A+83EdonU7hbAGT2
 E2NAb5xkC+74WEUit5qEouz++4JRnsJEpBx3A7mwkiUH9RnFA9OflsTdIFSIEbzb
 V4yMWeYBAlhwKPy/7z6/hAMK/+Psabw8FppCAw2HcADVpT517rkl4MpvErSZeFGz
 cr46+ZWhXZ4PaG2jG2xVLpqSbqLSfWp8uqfj0WavW2gFn/1jCB+FST904q7IPVW2
 QPxALqxMAMSzOHxTYmDLfJ4IJ5vvLKroom4ixKgbl7jKXF3+PTooR6U4hGQmLK7K
 VKWjb/kIdHpuRT3/pG2kysMtJkk1av5BBZkl9sWUEFgCd4vYP1eB1Ah3aE/P26OH
 BCueMDaJqKAzmVa6Dx5MCLlJpxHpQl/OBz5wdXiMRbYeky/QHgzaTmi/HZ0wwXvn
 zFHAglWzLq7q0HY+q7wwI20R16cRYIve3HOaLFvQdXd1xpBP1BF+aAxT/vSb+otS
 1OWCEHAxq4XEM7VcRKv9XL59gXuSB8ZaSl6k82+IjjfgOqLHh8BSygVle7iu14TE
 glokfXQRC7xhgfC1zQf9
 =Hq1a
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of IIO new device support, features and cleanups for the 4.8 cycle.

New device support
* ads1015
  - add ads1115 support
* bma220 accelerometer
  - new driver
  - triggered buffer support.
* bmc150
  - add bmm150 support.
* bmp280
  - bme280 support with addition of humidity channel.
* max5487 potentiometer
  - new driver
* MMA7660FC accelerometer.
  - New driver
* st-pressure
  - support for the lps22hb
* loop trigger.
  - This one is *nasty* but we have real applications (parrot drones) where
  it is useful.  The trigger basically spins as hard as it can firing off
  a new trigger each time all triggered devices come back to say they are
  done.  It doesn't hang a machine even when doing it on a dummy driver.
  A lot nicer than having this implemented within lots of device drivers
  anyway.

Core stuff
* Add support to create IIO devices via configfs (similar to we did for
triggers a while back) + docs.
* New channel types
  - IIO_ELECTRICAL_CONDUCTIVITY
* Couple of MAINTAINERS patches to list the device tree bindings.
* Make trigger ops structure non optional (comment fix). It hasn't been for
an awful long time, but that's not what the description said.

New features
* ak8975
  - support adapters that are limited to byte data only by allowing the
  emulated block read i2c function that was recently introduced.
* atlas-ph
  - support atlas-ec (electrical conductivity sensor)
* bmi160
  - add available frequency and scale attributes to make the driver
  more user friendly (and avoid having to read the datasheet to know
  what will work).
* dummy
  - move creation to configfs interface.  It's not real hardware so we
  are not that worried about the ABI breakage ;)
* mma8452
  - oversampling ration support
* nau7802
  - expose available gains to make life easier for userspace.
* st-sensors
  - allow use of emulation for SMBus block reads as all the st parts support
  it.
* ti-ads1015
  - list datasheet names to allow their use by inkernel consumers.
* Various module alias additions to help auto probing.  Drop one redundant one
as well.

Cleanups
* ad7266, ad7476, ad7887, ad7923, ad799x
  - use direct mode claim function rather than open coding it during sensor
  read (prevents switching on buffers mid read).
* ad7793, ad7791
  - use direct mode claim to prevent frequency changes when buffers running.
* afe440x - These are ABI breaking but the driver requires custom userspace
  code to do anything useful anyway and that is still being written and under
  control of TI.  Ultimately we may have other libraries to do pulse
  oximetry with these devices but we aren't aware of any yet.
  - kernel-doc format fixes
  - drop ifdef fun around of_match_ptr - it's not worth the mess to save
  a tiny amount of space.
  - drop some unnecessary register initializations.
  - drop the weird locked gain modes as they gain us nothing (can just set
  all gains separately).
  - remove handling of offset attributes seeing as no channels actually have
  them (oops)
  - Drop the LED3 input channel as it's an alias for ALED2.
  - *big one* remove channel names - an experiment that turned out to not
  make sense - see patch for details.
  - use regmap fields to clean up code.
  - tie the tia gain stages to appropriate channels in the ABI as that is
  what they really effect. Same with the LED currents.
  - cleanout some unused defines and fix a missnamed one.
* atlas-ph
  - reorganise to allow support of other similar parts.
* bmc150
  - document supported chips in kconfig help.
* jsa1212
  - drop an unneeded i2c functionality check for functionality the driver
  doesn't use.
* mxs-lradc
  - simply touch screen registration code.
  - remove the touch screen unregister as all devm based now.
  - disable only those channels that are masked in hardware stop (others
  are already dealt with elsewhere)
* st-sensors
  - unexport st_sensors_get_buffer_element as nothing outside the st-sensors
  core driver uses it.
  - fix handling of failure to start up regulators.
* tpl0102
  - drop an i2c functionality test for features that aren't needed.
* ti-am335x
  - use variable name rather than type in sizeof for clarity.
  - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.

Tools
* Add install / uninstall to makefile.  Someone cares, so presumably
some people will find it useful!
*  generic_buffer
   - rename to iio_generic_buffer to line up with other tools.
   - handle cleanup when receiving signals
   - Add a --device-num option and a --trigger-num option rather than
   relying on naming which doesn't work if you have two of the same part.
2016-06-09 09:15:58 -07:00
Linus Walleij 65925b65ed iio: st_sensors: switch to a threaded interrupt
commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded
("iio: st_sensors: verify interrupt event to status") caused
a regression when reading ST sensors from a HRTimer trigger
rather than the intrinsic interrupts: the HRTimer may
trigger faster than the sensor provides new values, and
as the check against new values available as a cause of
the interrupt trigger was done in the poll function,
this would bail out of the HRTimer interrupt with
IRQ_NONE.

So clearly we need to only check the new values available
from the proper interrupt handler and not from the poll
function, which should rather just read the raw values
from the registers, put them into the buffer and be happy.

To achieve this: switch the ST Sensors over to using a true
threaded interrupt handler.

In the interrupt thread, check if new values are available,
else yield to the (potential) next device on the same
interrupt line to check the registers. If the interrupt
was ours, proceed to poll the values.

Instead of relying on iio_trigger_generic_data_rdy_poll() as
a top half to wake up the thread that polls the sensor for
new data, have the thread call iio_trigger_poll_chained()
after determining that is is the proper source of the
interrupt. This is modelled on drivers/iio/accel/mma8452.c
which is already using a properly threaded interrupt handler.

In order to get the same precision in timestamps as
previously, where samples would be timestamped in the
poll function pf->timestamp when calling
iio_trigger_generic_data_rdy_poll() we introduce a
local timestamp in the sensor data, set it in the top half
(fastpath) of the interrupt handler and provide that to the
core when calling iio_push_to_buffers_with_timestamp().

Additionally: if the active scanmask is not set for the
sensor no IRQs should be enabled and we need to bail out
with IRQ_NONE. This can happen if spurious IRQs fire when
installing the threaded interrupt handler.

Tested with hard interrupt triggers on LIS331DL, then also
tested with hrtimers on the same sensor by creating a 75Hz
HRTimer and using it to poll the sensor.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Reported-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Jonathan Cameron <jic23@kernel.org>
Fixes: 97865fe413 ("iio: st_sensors: verify interrupt event to status")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29 20:21:41 +01:00
Gregor Boirie 14f295c846 iio:st_sensors: fix power regulator usage
Ensure failure to enable power regulators is properly handled.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29 16:08:10 +01:00
Greg Kroah-Hartman 5a45e01d41 2nd set of new device support, features and cleanup for IIO in the 4.7 cycle.
Bit of a bumper set for new drivers but plenty of other stuff here as well!
 
 New device support
 * ad5592R ADC/DAC
   - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips.
 * Aosong am2315 relative humidity
   - new driver with triggered buffer support in follow up patch.
 * bmi160 imu
   - new driver
 * bmp280
   - bmp180 support - note there is support in the misc/bmp085 driver. Intent
     is to remove that driver long term.
 * invensense mpu6050
   - cleanup leading to explicit support of mpu9150 with a good few cleanups
     along the way.
 * Hope RF hp03 pressure and temperature sensor.
   - new driver
 * maxim DS1803 potentiometer
   - new driver
 * maxim max44000 light and proximity sensor
   - new driver built in a series of steps to support pretty much everything.
 * ROHM BH1780 light sensor
   - new driver. There is an existing driver in misc that this is pretty much
     intended to replace.  The discussion on whether to support the non standard
     interface of that driver is some way is continuing.
 * st-gyro
   - lsm9ds0-gyro.  The accel/magn side of this will take a while longer as
     extensions to the st library are needed for cases where two types of sensor
     share a single i2c address.
 * ti-adc081c
   - support the adc101c and adc121c
 * Vishay VEML6070 UV sensor
   - new driver.
 
 New features
 * core
   - devm_ APIs for channel_get and channel_get_all.  The first user of these
     is the generic ADC based thermal driver.  As it is going through the
     thermal tree these will be picked up as a patch to that next cycle as that
     is how the author preferred to do it.
   - mounting matrix support.  This new core support allows devices to provide
     to userspace (typically from the device tree) allowing compensation for how
     the sensor is mounted on the device.  First examples are on UAVs but it
     has a more mundane use on typical phone where the chip may be on the front
     or the back of the circuit board and soldered at any angle. Includes
     support for this ABI in ak8975 (which has an older interface, now
     deprecated) and mpu6050.
 * tools
   - add a -a option to enable all available channels in generic_buffer sample.
     Makes it somewhat easier to use.
 * adis library and drivers
   - support manual self test flag clearing.  This has technically been broken
     for a very long time - result is an offset on readings as the applied field
     is on all the time.
 * ak8975
   - triggered buffer support
 * bmc150
   - spi support (including splitting the driver into core and i2c parts)
 * bmp280
   - oversampling support.
 * dht11
   - improved logging - useful to debug timing issues on this quirky device.
 * st-sensors
   - read each channel invidivually as not all support the optimization of
   reading in bulk.  This is technically a fix, but will need to be backported
   if desired.
   - support open drain and shared interrupts.
 * ti-adc081c
   - triggered buffer support.
 
 Cleanups
 * inkern
   - white space fix.
 * ad7606
   - use the iio_device_claim_direct_mode call rather than open coding equiv.
 * ad799x
   - white space fix.
 * ad9523
   - unsigned -> unsigned int
 * apds9660
   - brace location tidying up.
   - silence an uninitialized variable warning.
 * ak8975
   - else and brace on same line fix.
 * at91_adc
   - white space fixes.
 * bmc150
   - use regmap stored copy of the device pointer rather than having an
     additional copy.
 * bmg160
   - use regmap stored copy of the device pointer rather than having an
     additional copy.
 * hid-sensors
   - white space fixes.
 * mcp3422
   - white space fix.
 * mma7455
   - use regmap to retrieve the device struct rather than carrying another copy
     in the private data.
 * ms_sensors
   - white space fix.
 * mxs-lradc
   - move current bindings out of staging - some will be shortly deprecated but
     the reality is that we have device trees out there using them so they will
     need to be supported for some time.  They accidentally got left behind
     when the driver graduated from staging.
   - white space cleanup.
   - set INPUT_PROP_DIRECT.
   - move ts config into a better function.
   - move the STMP reset out of the ADC init.
 * vf610_adc
   - case label indenting fix.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXHnw8AAoJEFSFNJnE9BaIDsIP/jbvOSDgOyvh4iNqV3ppAfvL
 yw/CWfKB5oMiqq/ENBNyMcD7kpGoh6ad/2JV1eXRnZsKArTwX6iN0Nu3yPxa+ySn
 xYc/BoGFwnNei+FqnFEqvK9RFZ3okQEkTW+OJg6eDMGDdL9HojZnALX4BE66QF3E
 W699vd3nA9SXqQ1UkQ+ozWdybBh2ksOfXknyN/S0sioIeG4MopCIyLMZzBGcDOCN
 EjdBudZla8VGTWcrp1ofOap6gJ7wKpbtlTPXuAEXtAypnDvuRdH7loTxtzSovNYd
 u6r9bujc1KUE4ilkYqODd5de4HvKm7aCR2ojlXeKlj+BNaF/uxQoYV/Al5e9CwR8
 nnz7c0rVAWIGc2tCiejJOMXB0t4TjVdzXZG9G/maKk1PNFOdUPb9Ul9BsjM28q5s
 yUneBuKlGFj2K/+E1AmTDRMhStMCMgrXZgyh0GSI07UZsVRnJR7ikUw7tly+J4ki
 21qKvTgXMKU+Fzh1HeqVcocq2AHsjlnKWuaB4/YiQzG5V0oGM4rvt78ewSMkmVkR
 IcIF9yI5XUfDAFdQUtvRlLP6p+qHylMH72aYq8pkMZ43Dq6hukyfx4vkc0Ztw7yS
 A655/frXiGeU2MFVSM2PYVloLQ5sftL5jDSBiDunzXHAl2WoXppu5Rjc7QvLnzLr
 vxvvN7MyGvi1GnKxcnYw
 =zzV9
 -----END PGP SIGNATURE-----

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

Jonathan writes:

2nd set of new device support, features and cleanup for IIO in the 4.7 cycle.

Bit of a bumper set for new drivers but plenty of other stuff here as well!

New device support
* ad5592R ADC/DAC
  - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips.
* Aosong am2315 relative humidity
  - new driver with triggered buffer support in follow up patch.
* bmi160 imu
  - new driver
* bmp280
  - bmp180 support - note there is support in the misc/bmp085 driver. Intent
    is to remove that driver long term.
* invensense mpu6050
  - cleanup leading to explicit support of mpu9150 with a good few cleanups
    along the way.
* Hope RF hp03 pressure and temperature sensor.
  - new driver
* maxim DS1803 potentiometer
  - new driver
* maxim max44000 light and proximity sensor
  - new driver built in a series of steps to support pretty much everything.
* ROHM BH1780 light sensor
  - new driver. There is an existing driver in misc that this is pretty much
    intended to replace.  The discussion on whether to support the non standard
    interface of that driver is some way is continuing.
* st-gyro
  - lsm9ds0-gyro.  The accel/magn side of this will take a while longer as
    extensions to the st library are needed for cases where two types of sensor
    share a single i2c address.
* ti-adc081c
  - support the adc101c and adc121c
* Vishay VEML6070 UV sensor
  - new driver.

New features
* core
  - devm_ APIs for channel_get and channel_get_all.  The first user of these
    is the generic ADC based thermal driver.  As it is going through the
    thermal tree these will be picked up as a patch to that next cycle as that
    is how the author preferred to do it.
  - mounting matrix support.  This new core support allows devices to provide
    to userspace (typically from the device tree) allowing compensation for how
    the sensor is mounted on the device.  First examples are on UAVs but it
    has a more mundane use on typical phone where the chip may be on the front
    or the back of the circuit board and soldered at any angle. Includes
    support for this ABI in ak8975 (which has an older interface, now
    deprecated) and mpu6050.
* tools
  - add a -a option to enable all available channels in generic_buffer sample.
    Makes it somewhat easier to use.
* adis library and drivers
  - support manual self test flag clearing.  This has technically been broken
    for a very long time - result is an offset on readings as the applied field
    is on all the time.
* ak8975
  - triggered buffer support
* bmc150
  - spi support (including splitting the driver into core and i2c parts)
* bmp280
  - oversampling support.
* dht11
  - improved logging - useful to debug timing issues on this quirky device.
* st-sensors
  - read each channel invidivually as not all support the optimization of
  reading in bulk.  This is technically a fix, but will need to be backported
  if desired.
  - support open drain and shared interrupts.
* ti-adc081c
  - triggered buffer support.

Cleanups
* inkern
  - white space fix.
* ad7606
  - use the iio_device_claim_direct_mode call rather than open coding equiv.
* ad799x
  - white space fix.
* ad9523
  - unsigned -> unsigned int
* apds9660
  - brace location tidying up.
  - silence an uninitialized variable warning.
* ak8975
  - else and brace on same line fix.
* at91_adc
  - white space fixes.
* bmc150
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* bmg160
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* hid-sensors
  - white space fixes.
* mcp3422
  - white space fix.
* mma7455
  - use regmap to retrieve the device struct rather than carrying another copy
    in the private data.
* ms_sensors
  - white space fix.
* mxs-lradc
  - move current bindings out of staging - some will be shortly deprecated but
    the reality is that we have device trees out there using them so they will
    need to be supported for some time.  They accidentally got left behind
    when the driver graduated from staging.
  - white space cleanup.
  - set INPUT_PROP_DIRECT.
  - move ts config into a better function.
  - move the STMP reset out of the ADC init.
* vf610_adc
  - case label indenting fix.
2016-04-26 15:07:23 -07:00
Crestez Dan Leonard 41c128cb25 iio: st_gyro: Add lsm9ds0-gyro support
This device has an identical interface to other supported sensors and the patch
only adds IDs.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-23 22:47:18 +01:00
Alison Schofield dc2c57153e iio: gyro: bmg160: use regmap to retrieve struct device
Driver includes struct regmap and struct device in its global data.
Remove the struct device and use regmap API to retrieve device info.

Patch created using Coccinelle plus manual edits.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19 19:58:18 +01:00
Linus Walleij 97865fe413 iio: st_sensors: verify interrupt event to status
This makes all ST sensor drivers check that they actually have
new data available for the requested channel(s) before claiming
an IRQ, by reading the status register (which is conveniently
the same for all ST sensors) and check that the channel has new
data before proceeding to read it and fill the buffer.

This way sensors can share an interrupt line: it can be flaged
as shared and then the sensor that did not fire will return
NO_IRQ, and the sensor that fired will handle the IRQ and
return IRQ_HANDLED.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19 19:58:12 +01:00
Greg Kroah-Hartman 5f47992491 Merge 4.6-rc3 into staging-next
This resolves a lot of merge issues with PAGE_CACHE_* changes, and an
iio driver merge issue.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-11 09:30:50 -07:00
Irina Tirdea b475c59b11 iio: gyro: bmg160: fix buffer read values
When reading gyroscope axes using iio buffers, the values
returned are always 0. In the interrupt handler, the return
value of the read operation is returned to the user instead
of the value read. Return the value read to the user.

This is also fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 11:21:33 +01:00
Irina Tirdea 95e7ff0341 iio: gyro: bmg160: fix endianness when reading axes
For big endian platforms, reading the axes will return
invalid values.

The device stores each axis value in a 16 bit little
endian register. The driver uses regmap_read_bulk to get
the axis value, resulting in a 16 bit little endian value.
This needs to be converted to cpu endianness to work
on big endian platforms.

Fix endianness for big endian platforms by converting
the values for the axes read from little endian to
cpu.

This is also partially fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 11:16:48 +01:00
Irina Tirdea fb12b6c725 iio: remove gpio interrupt probing from drivers that use a single interrupt
Commit 845c877009 ("i2c / ACPI: Assign IRQ for devices that have
GpioInt automatically") automatically assigns the first ACPI GPIO
interrupt in client->irq, so we can remove the probing code from
drivers that use only one interrupt.

Commit 0f0796509c ("iio: remove gpio interrupt probing from drivers
that use a single interrupt") removes gpio interrupt probing from most
drivers. This patch cleans the remaining ones.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:48 +01:00
Irina Tirdea 7e3d1eb123 iio: accel: bmg160: optimize transfers in trigger handler
Some i2c busses (e.g.: Synopsys DesignWare I2C adapter) need to
enable/disable the bus at each i2c transfer and must wait for
the enable/disable to happen before sending the data.

When reading data in the trigger handler, the bmg160 gyro driver does
one bus transfer for each axis. This has an impact on the frequency
of the accelerometer at high sample rates due to additional delays
introduced by the bus at each transfer.

Reading all axis values in one bus transfer reduces the delays
introduced by the bus.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:45 +01:00
Irina Tirdea ee8c5419e0 iio: gyro: bmg160: use available_scan_masks
Use available_scan_masks to allow the iio core to select
the data to send to userspace depending on which axes are
enabled, instead of doing this in the driver's interrupt
handler.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:44 +01:00
Linus Walleij a9fd053b56 iio: st_sensors: support active-low interrupts
Most ST MEMS Sensors that support interrupts can also handle sending
an active low interrupt, i.e. going from high to low on data ready
(or other interrupt) and thus triggering on a falling edge to the
interrupt controller.

Set up logic to inspect the interrupt line we get for a sensor: if
it is triggering on rising edge, leave everything alone, but if it
triggers on falling edges, set up active low, and if unsupported
configurations appear: warn with errors and reconfigure the interrupt
to a rising edge, which all interrupt generating sensors support.

Create a local header for st_sensors_core.h to share functions
between the sensor core and the trigger setup code.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-10 12:35:32 +00:00
Greg Kroah-Hartman f3cf3fb7ec First set of new device support, features and cleanups for IIO in the 4.5 cycle
Usual mixed bag, but the big item perhaps in this series is the DMA buffer
 support added by Lars-Peter Clausen. It's been in the works for a long time
 and it will be interesting to see what hardware support shows up now that
 this is available.
 
 New core features + associate cleanup.
 * Add generic DMA buffer infrastructure
 * Add a DMAengine framework based buffer
  Also associated minor changes.
    - Set the device buffer watermark based on the minimum watermark for all
      attached buffers rather than just the 'primary' one.
    - iio_buffer_init - only set the watermark default if one hasn't already
      been provided.  This allows simple support for devices with a fixed
      watermark.
    - read only attribute for watermark on fixed watermark devices.
    - add explicit buffer enable/disable callbacks to allow the buffer to
      do more than trivial actions when it is being turned on and off.
 * IIO_VAL_INT support in write_raw_get_fmt function.
 
 New device support
 * Freescale MMA7455/7456L accelerometers
 * Memsic MXC6255XC accelerometer
 * ST lis2dh12 accelerometer
 * TI ADS8688 ADC
 * TI Palamas (twl6035/7) gpadc
 
 New driver features
 * mma8452
   - support either of the available interrupt pins to cope with the case
     where board layout has lead to a particular one being connected.
 
 Staging graduation
 * Dummy driver
   - this driver acts as both an example and a test device for those with
     out hardware to develop userspace code against.
 
 Cleanups and minor bits and bobs.
 * treewide
   - Sort out the ordering of iio_device_register/unregister vs runtime
     pm function calls so that it's all nice and consistent and not race
     prone.
   - Check sscanf return values.  None of the cases will actually happen as
     the strings are supplied internally, but best to be consistent on this.
 * ad7780
   - switch over to the gpio descriptor interface and remove the now unused
     platform data which gets rid of a header entirely.
 * ad7793
   - drop a pointless else statement.
 * at91_adc
   - Swap kmalloc_array in for a kmalloc doing the same job.
 * dummy
   - get rid of some commented out lines that snuck in during the move of
     the driver.
 * lm3533-als
   - Print an error message on provision of an invalid resistance.
 * mcp320x
   - Add compatible strings with vendor prefix and deprecate those with
     no vendor prefix.
 * mxs-lradc
   - Use BIT macro in various places rather than shifted ones.
 * pa12203001
   - Power off the chip if the registration fails.
 * pulsedlight-lidar-lite
   - add runtime PM support.
 * xilinx XADC
   - constify an iio_buffer_setup_ops structure.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWUcmhAAoJEFSFNJnE9BaIyjYP/0A+CZMUqIGbYG9qFxnq7yYZ
 977Wt/gGI8+Jq5RwNw6gTfhp2GrCN+5gzDbE2mBEn94c6SKBrj2Q9trW1FQ+Nhfx
 9bZoyq3ZPRCV+efEDGfeK/JWRwv+V6IWwAF2J/iCPWpRMTEsIW5kM1JSO3ISlnma
 diyil1hefGTJY8aCqGApthfX4fyZK98oCV6zojxpCZfFPdsa+vf5n1RQ143odnOk
 6NSfXHYLI+2e+mJ1lw4GdpZdF+rF+7jWsUYC5EDNmvlIJYiKmm13whSQeWO0NHo8
 oD0pYboSIWnmdXx4s3RbWF2+Y28O1+oJDKZfXabB8DjVwtvlGnmWBRhgKji2e6E6
 Hhct83YbDWtEpbNkXcWpnc5v5ynmAMTYTxADhinTGUtVQh3Q4wWduuoHK6IyeI4s
 dbfpO2Wh6N/5k3a4UoA69IcI2DzPzb2sIFWpdS8wuNv5xDhV2OmmY2PjTfq2w+Qz
 hEoMCNDUG6rQAYf4auXK5JjhI4CaG/mz/qjIibTUqGODYECzQQyvq+c2Gdq0S8O/
 CUHOgui6aHbyuhWmXlEzhhkjuvBQZYaTxCA+LGMzy8w7UY9m4n5L/fX9M9IfFsMH
 NFCPrUfmxKPQj/mHlhu7KHaTMUlQ0pTqV5flSwqsjstZ2QddvI5EAKiLwIEhg7/2
 RpnOZoiFIxykduEYLxeh
 =CfCl
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 4.5 cycle

Usual mixed bag, but the big item perhaps in this series is the DMA buffer
support added by Lars-Peter Clausen. It's been in the works for a long time
and it will be interesting to see what hardware support shows up now that
this is available.

New core features + associate cleanup.
* Add generic DMA buffer infrastructure
* Add a DMAengine framework based buffer
 Also associated minor changes.
   - Set the device buffer watermark based on the minimum watermark for all
     attached buffers rather than just the 'primary' one.
   - iio_buffer_init - only set the watermark default if one hasn't already
     been provided.  This allows simple support for devices with a fixed
     watermark.
   - read only attribute for watermark on fixed watermark devices.
   - add explicit buffer enable/disable callbacks to allow the buffer to
     do more than trivial actions when it is being turned on and off.
* IIO_VAL_INT support in write_raw_get_fmt function.

New device support
* Freescale MMA7455/7456L accelerometers
* Memsic MXC6255XC accelerometer
* ST lis2dh12 accelerometer
* TI ADS8688 ADC
* TI Palamas (twl6035/7) gpadc

New driver features
* mma8452
  - support either of the available interrupt pins to cope with the case
    where board layout has lead to a particular one being connected.

Staging graduation
* Dummy driver
  - this driver acts as both an example and a test device for those with
    out hardware to develop userspace code against.

Cleanups and minor bits and bobs.
* treewide
  - Sort out the ordering of iio_device_register/unregister vs runtime
    pm function calls so that it's all nice and consistent and not race
    prone.
  - Check sscanf return values.  None of the cases will actually happen as
    the strings are supplied internally, but best to be consistent on this.
* ad7780
  - switch over to the gpio descriptor interface and remove the now unused
    platform data which gets rid of a header entirely.
* ad7793
  - drop a pointless else statement.
* at91_adc
  - Swap kmalloc_array in for a kmalloc doing the same job.
* dummy
  - get rid of some commented out lines that snuck in during the move of
    the driver.
* lm3533-als
  - Print an error message on provision of an invalid resistance.
* mcp320x
  - Add compatible strings with vendor prefix and deprecate those with
    no vendor prefix.
* mxs-lradc
  - Use BIT macro in various places rather than shifted ones.
* pa12203001
  - Power off the chip if the registration fails.
* pulsedlight-lidar-lite
  - add runtime PM support.
* xilinx XADC
  - constify an iio_buffer_setup_ops structure.
2015-12-01 09:13:29 -08:00
Ioana Ciornei a106b47489 iio: gyro: check sscanf return value
This patch fixes the checkpatch warnings:
WARNING: unchecked sscanf return value

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:43:16 +00:00
Adriana Reus 7d0ead5c3f iio: Reconcile operation order between iio_register/unregister and pm functions
At probe, runtime pm should be setup before registering the sysfs interface so
that all the power attributes are accurate and functional when registering.
Also, when removing the device we should unregister first to make sure
that the interfaces that may result in wakeups are no longer available.

Fix this behaviour for the following drivers: bmc150, bmg160, kmx61,
kxcj-1013, mma9551, mma9553, rpr0521.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:36:53 +00:00
Linus Torvalds 75f5db39ff spi: Updates for v4.4
Quite a lot of activity in SPI this cycle, almost all of it in drivers
 with a few minor improvements and tweaks in the core.
 
  - Updates to pxa2xx to support Intel Broxton and multiple chip selects.
  - Support for big endian in the bcm63xx driver.
  - Multiple slave support for the mt8173
  - New driver for the auxiliary SPI controller in bcm2835 SoCs.
  - Support for Layerscale SoCs in the Freescale DSPI driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWOehzAAoJECTWi3JdVIfQTPYH+wYMDG8gAIw2s0AJ4DvVe4qZ
 sOAm1UgUJZxssrEA6BNqbfM0dfRo+oQJKmRd0Dc5n7LEMsYHdI/5yKHk8PCS6ZzD
 iQyQCzbd0thDAqwuPaMP62cyPDHwyJX22VGTsgVnj6AZqAQ+9+g4SPKhFnm1Mlm4
 hmDi6fdSrsqo8k8gkpVN8RFOfVsjAV1dLtAauQRWDHrqMxXURSrKG76eqAqUa5bn
 BLPXBoj5PA0DMLPO2j+ADZwWN723LrI2mSSlc+ThjEX/OIt2OhAoiOTV5RPqaafy
 TIsCkh68q/gYAsL5HtvvmgZByl41FLYiO0Z+rXmWUyMMbnvhZTLws9S2BNpBLuk=
 =DgXG
 -----END PGP SIGNATURE-----

Merge tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "Quite a lot of activity in SPI this cycle, almost all of it in drivers
  with a few minor improvements and tweaks in the core.

   - Updates to pxa2xx to support Intel Broxton and multiple chip selects.
   - Support for big endian in the bcm63xx driver.
   - Multiple slave support for the mt8173
   - New driver for the auxiliary SPI controller in bcm2835 SoCs.
   - Support for Layerscale SoCs in the Freescale DSPI driver"

* tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits)
  spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
  spi: pxa2xx: Add support for Intel Broxton
  spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
  spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
  spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
  spi: Add DSPI support for layerscape family
  spi: ti-qspi: improve ->remove() callback
  spi/spi-xilinx: Fix race condition on last word read
  spi: Drop owner assignment from spi_drivers
  spi: Add THIS_MODULE to spi_driver in SPI core
  spi: Setup the master controller driver before setting the chipselect
  spi: dw: replace magic constant by DW_SPI_DR
  spi: mediatek: mt8173 spi multiple devices support
  spi: mediatek: handle controller_data in mtk_spi_setup
  spi: mediatek: remove mtk_spi_config
  spi: mediatek: Update document devicetree bindings to support multiple devices
  spi: fix kernel-doc warnings about missing return desc in spi.c
  spi: fix kernel-doc warnings about missing return desc in spi.h
  spi: pxa2xx: Align a few defines
  spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select
  ...
2015-11-05 13:15:12 -08:00
Andrew F. Davis 3821a065f5 spi: Drop owner assignment from spi_drivers
An spi_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28 10:30:17 +09:00
Markus Pargmann b1d125cc62 iio: bmg160: Add SPI driver
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-31 17:06:11 +01:00
Markus Pargmann 13426454b6 iio: bmg160: Separate i2c and core driver
This patch separates the core driver using regmap and the i2c driver
which creates the i2c regmap. Also in the Kconfig file BMG160 and
BMG160_I2C are separate now.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-31 17:04:23 +01:00
Linus Walleij a0175b9c76 iio: st_sensors: add debugfs register read hook
This adds a debugfs hook to read/write registers in the ST
sensors using debugfs. Proved to be awesome help when trying
to debug why IRQs do not arrive.

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-08-16 10:51:25 +01:00
Markus Pargmann 5d889abbe5 iio: bmg160: Remove remaining uses of i2c_client
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16 10:51:23 +01:00
Markus Pargmann ebc6eb5907 iio: bmg160: Use generic dev_drvdata
i2c_get_clientdata() is specifically for i2c. Replace it with the
generic dev_get/set_drvdata() to support different protocols.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16 10:51:22 +01:00
Markus Pargmann 74e04345dc iio: bmg160: Remove i2c_client from data struct
i2c_client variable is not really used anymore in the core driver. It is
only used to get the device to make proper outputs.

This patch replaces all i2c_client usage through direct usage of the
device pointer.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16 10:51:22 +01:00
Markus Pargmann c6c9e995bc iio: bmg160: Use i2c regmap instead of direct i2c access
This patch introduces regmap usage into the driver. This is done to
later easily support the SPI interface of this chip.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16 10:51:21 +01:00
Markus Pargmann 06d2f6ca5a iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required
This patch adds selects for IIO_BUFFER and IIO_TRIGGERED_BUFFER. Without
IIO_BUFFER, the driver does not compile.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 19:24:13 +01:00
Lars-Peter Clausen 5450c360d4 iio: adis16136: Add ADIS16137 support
The ADIS16137 is register map compatible to the ADIS16136, but has a
different scale factor for the gyroscope output.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08 15:09:21 +01:00
Lars-Peter Clausen f1afda124b iio: adis16260: Add ADIS16266 support
The ADIS16266 is mostly register compatible to the ADIS16260. The
difference is a different gyroscope scale factor as well not having the
relative angular displacement channel.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08 12:58:15 +01:00
Giuseppe Barba bc27381edb iio: st-sensors: add configuration for WhoAmI address
This patch permits to configure the WhoAmI register address
because some device could have not a standard address for
this register.

Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com>
Reviewed-by: Denis Ciocca <denis.ciocca@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-23 20:43:04 +01:00
Krzysztof Kozlowski 2155971a66 iio: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11 18:50:07 +01:00
Greg Kroah-Hartman 61e331202f Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle.
Core functionality
 * i and q modifiers from quadrature channels.
 * IIO_CHAN_INFO_OVERSAMPLING_RATIO added.
 * High pass filter attributes added to mirror the existing low pass filter
   ones.
 
 Core cleanups
 * Make IIO tools building more cross compiler friendly.
 * Substantial rework of the function __iio_update_buffers to greatly simplify
   a hideously evolved function.
 
 New drivers and support
 * ACPI0008 ambient light sensor driver. This one has been around a long time to
   will be good to finally get it into mainline.
 * Berlin SOC ADC support.
 * BMC150 magnetometer.  The accelerometer in the same package has been supported
   for quite some time, so good to have this half as well.
 * m62332 DAC driver
 * MEMSIC MMC35420 magnetometer.
 * ROHM BH1710 and similar ambient light sensors.
 * Sensortek STK3310 light sensor.
 * Sensortek STK8312 accelerometer.
 * Sensortek STK8BA50 accelerometer.
 * ti-adc128s052 gains support form the adc122s021 2 channel ADC.
 
 Driver cleanups and functionality.
 * Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled.
 * bmc150 - decouple trigger from buffer to allow other triggers to be used.
 * bmg160 - decouple trigger from buffer to allow other triggers to be used.
   Fix a trivial unused field.
 * Constify a load of platform_device_id structures.
 * inv_mpu6050 - device tree bindings.
 * hid-sensors - fix a memory leak during probe if certain errors occur.
 * ltr501 - illuminance channel derived (in an non obvious fashion) from the
   intensity channels.
 * ltr501 - fix a boundary check on the proximity threshold.
 * mlx90614 - drop a pointless return.
 * mma8452 - Debugfs register access and fix a bug that had no effect (by
   coincidence)
 * ti_am335x_adc - add device tree bindings for sample-delay, open-delay and
   averaging.  The ideal settings for these tend to be board design specific.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVYfYpAAoJEFSFNJnE9BaI1ScQAIJ2jsFZdf8fcVnWeq0bYx9I
 VUPfz/bJ/kLQRGm/LDgpMPc5o1mOE+rupwFpp/iQf15vVUN86+CRLt0qd5I/cAEg
 I3qbaieS1H9Qyd2dLTgAcZAh6tH7ZvFJm/hB6T5xQAYFGY2IMq/n3qA4//W37tUb
 2bKTRb67LWbGivOvwbxdSpEkBLtVcUw3UNn9nfqjB8BEAHIesh88gJkVKAAuRYqk
 Tm8AzQ7EGsosz2R7mIvukSBwXBcvRyxyOxCdLBPIWSESeLwMiiat0zCfv3MxrYiD
 FVpdlywoReIjDG6z9ALOm4VMtRF2m2VrjPHclQ3kYgYSgyf0fRmoiyGowv7hkeya
 Z+p9ltOZ8qdis+yH1ci9Ch695HURa1m0seirX4exqiv0Crx8UF+iNIvs9Ai84Rv8
 NNVlscoeEyijUaqoBb1YvG/Fryh2IEiGXTkF4Eld+EhW8AKkFFNIqR+Gwvs1YegT
 02A8kHxD0GyMYJo1uEwd+TnKwCBglwsie8omkxOXqsY860DRtBr7jOxyb/RzkSVi
 jGtq1Y4nxVv7q3nkn+vQDRNgAQTbH1EJfrDilpIxIWK+9onNmKMnhKnSTVNAdld/
 Hhn9g/MHptQtmA+DwMcJ3Aqn0xMUdgoE9GIkMGoKSZku9H0DhWHLdxTa2lxdJFUo
 OiWVvP0eJuvu0E0h4eA2
 =uX2k
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle.

Core functionality
* i and q modifiers from quadrature channels.
* IIO_CHAN_INFO_OVERSAMPLING_RATIO added.
* High pass filter attributes added to mirror the existing low pass filter
  ones.

Core cleanups
* Make IIO tools building more cross compiler friendly.
* Substantial rework of the function __iio_update_buffers to greatly simplify
  a hideously evolved function.

New drivers and support
* ACPI0008 ambient light sensor driver. This one has been around a long time to
  will be good to finally get it into mainline.
* Berlin SOC ADC support.
* BMC150 magnetometer.  The accelerometer in the same package has been supported
  for quite some time, so good to have this half as well.
* m62332 DAC driver
* MEMSIC MMC35420 magnetometer.
* ROHM BH1710 and similar ambient light sensors.
* Sensortek STK3310 light sensor.
* Sensortek STK8312 accelerometer.
* Sensortek STK8BA50 accelerometer.
* ti-adc128s052 gains support form the adc122s021 2 channel ADC.

Driver cleanups and functionality.
* Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled.
* bmc150 - decouple trigger from buffer to allow other triggers to be used.
* bmg160 - decouple trigger from buffer to allow other triggers to be used.
  Fix a trivial unused field.
* Constify a load of platform_device_id structures.
* inv_mpu6050 - device tree bindings.
* hid-sensors - fix a memory leak during probe if certain errors occur.
* ltr501 - illuminance channel derived (in an non obvious fashion) from the
  intensity channels.
* ltr501 - fix a boundary check on the proximity threshold.
* mlx90614 - drop a pointless return.
* mma8452 - Debugfs register access and fix a bug that had no effect (by
  coincidence)
* ti_am335x_adc - add device tree bindings for sample-delay, open-delay and
  averaging.  The ideal settings for these tend to be board design specific.
2015-05-24 11:45:21 -07:00
Vlad Dogaru 00e0c8e8e8 iio: gyro: bmg160: decouple buffer and triggers
Make it possible to use buffering with an external trigger, such as one
based on sysfs or hrtimer.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:26:54 +01:00
Vlad Dogaru eb2191017e iio: gyro: bmg160: remove redundant field
Replace the 'timestamp' field in struct bmg160_data with the identically
named field in iio_poll_func and with calls to iio_get_time_ns().

The reported timestamps may be slightly different, but the advantage is
that we no longer assume that the buffer of bmg160 is triggered by its
own trigger.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:24:36 +01:00
Fabio Estevam d8c9d23e29 iio: gyro: hid-sensor-gyro-3d: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:09:49 +01:00