platform/kernel/linux-rpi.git
8 years agoiio: chemical: atlas-ph-sensor: add ORP feature
Matt Ranostay [Fri, 19 Aug 2016 20:36:11 +0000 (13:36 -0700)]
iio: chemical: atlas-ph-sensor: add ORP feature

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: chemical: atlas-ph-sensor: switch to REGCACHE_NONE regmap tree
Matt Ranostay [Fri, 19 Aug 2016 20:36:10 +0000 (13:36 -0700)]
iio: chemical: atlas-ph-sensor: switch to REGCACHE_NONE regmap tree

Since there are overlapping volatile regions between parts, and only
register that isn't volatile is the temperature compensation provided
from userspace.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers
Matt Ranostay [Fri, 19 Aug 2016 20:36:09 +0000 (13:36 -0700)]
iio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ti-adc161s626: add support for TI 1-channel differential ADCs
Matt Ranostay [Sat, 20 Aug 2016 03:17:03 +0000 (20:17 -0700)]
iio: adc: ti-adc161s626: add support for TI 1-channel differential ADCs

Add support for Texas Instruments ADC141S626, and ADC161S626 chips.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: buffer-callback: allow getting underlying iio_dev
Matt Ranostay [Sat, 20 Aug 2016 03:17:02 +0000 (20:17 -0700)]
iio: buffer-callback: allow getting underlying iio_dev

Add iio_channel_cb_get_iio_dev function to allow getting the
underlying iio_dev. This is useful for setting the trigger of the
consumer ADC device.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: add support for the Domintech DMARD09 3-axis accelerometer
Jelle van der Waa [Tue, 26 Jul 2016 21:23:48 +0000 (23:23 +0200)]
iio: accel: add support for the Domintech DMARD09 3-axis accelerometer

Minimal implementation of an IIO driver for the Domintech DMARD09 3-axis
accelerometer. Only supports reading the x,y,z axes at the moment.

Implementation based on the Android driver from the Acer Liquid E2
kernel sources.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: Add support for Domintech DMARD06 accelerometer
Aleksei Mamlin [Mon, 25 Jul 2016 15:21:18 +0000 (18:21 +0300)]
iio: accel: Add support for Domintech DMARD06 accelerometer

This patch add support for Domintech DMARD05, DMARD06 and DMARD07
accelerometers.

Signed-off-by: Aleksei Mamlin <mamlinav@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agodevicetree: bindings: Add vendor prefix for Domintech Co., Ltd.
Aleksei Mamlin [Mon, 25 Jul 2016 15:21:17 +0000 (18:21 +0300)]
devicetree: bindings: Add vendor prefix for Domintech Co., Ltd.

Add vendor-prefix for Domintech Co., Ltd.

Signed-off-by: Aleksei Mamlin <mamlinav@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agotools: iio: lsiio: enumerate processed channels
Matt Ranostay [Tue, 2 Aug 2016 02:39:51 +0000 (19:39 -0700)]
tools: iio: lsiio: enumerate processed channels

Enumerate the processed channels (e.g. *_input) as well the raw channels.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: sx9500: Use complete() instead of complete_all()
Daniel Wagner [Thu, 4 Aug 2016 13:07:10 +0000 (15:07 +0200)]
iio: sx9500: Use complete() instead of complete_all()

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

sx9500_read_proximity()
  sx9500_inc_chan_users()
  sx9500_inc_data_rdy_users()
  wait_for_completion_interruptible()

                                        s9500_irq_thread_handler()
                                          complete()

  reinit_completion()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: Use complete() instead of complete_all()
Daniel Wagner [Thu, 4 Aug 2016 13:07:09 +0000 (15:07 +0200)]
iio: adc: Use complete() instead of complete_all()

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

nau7802_read_irq()
  reinit_completion()
  nau7802_read_conversion()
  wait_for_completion_interruptible_timeout()

                                        nau7802_eoc_trigger()
                                          complete()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: bma180: use iio helper function to guarantee direct mode
Alison Schofield [Mon, 25 Jul 2016 19:11:20 +0000 (12:11 -0700)]
iio: accel: bma180: use iio helper function to guarantee direct mode

Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: humidity: hdc100x: add HDC1000 and HDC1008 to Kconfig
Alison Schofield [Mon, 25 Jul 2016 18:50:12 +0000 (11:50 -0700)]
iio: humidity: hdc100x: add HDC1000 and HDC1008 to Kconfig

hdc100x supports Texas Instruments HDC1000 and HDC1008 relative
humidity and temperature sensors. Add these product names to
Kconfig.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: us5182d: Add missing error code assignment before test
Christophe JAILLET [Wed, 10 Aug 2016 05:18:16 +0000 (07:18 +0200)]
iio: light: us5182d: Add missing error code assignment before test

It is likely that checking the result of 'pm_runtime_set_active' is
expected here.

Fixes: f0e5f57d3ac2 ("iio: light: us8152d: Add power management support")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: add a driver for AK8974
Linus Walleij [Mon, 25 Jul 2016 13:54:55 +0000 (15:54 +0200)]
iio: magn: add a driver for AK8974

This adds a driver for the Asahi Kasei AK8974 and its sibling
AMI305 magnetometers. It was deployed on scale in 2009 on a
multitude of devices. It is distincly different from AK8973
and AK8975 and needs its own driver.

This patch is based on the long lost work of Samu Onkalo at Nokia,
who made a misc character device driver for the Maemo/MeeGo Nokia
devices, before the time of the IIO subsystem. It was mounted in e.g.
the Nokia N950, N8, N86, N97 etc. It is also mounted on the
ST-Ericsson HREF reference designs.

It works nicely in sysfs:

$ cat in_magn_x_raw && cat in_magn_y_raw && cat in_magn_z_raw
-55
-101
161

And with buffered reads using a simple HRTimer trigger:
$ generic_buffer -c10 -a -n ak8974 -t foo
iio device number being used is 3
iio trigger number being used is 2
No channels are enabled, enabling all channels
Enabling: in_magn_x_en
Enabling: in_magn_y_en
Enabling: in_magn_z_en
Enabling: in_timestamp_en
/sys/bus/iio/devices/iio:device3 foo
-58.000000 -102.000000 157.000000 946684970985321044
-60.000000 -98.000000 159.000000 946684971012237548
-60.000000 -106.000000 163.000000 946684971032257080
-62.000000 -94.000000 169.000000 946684971052185058
-58.000000 -98.000000 163.000000 946684971072204589
-54.000000 -100.000000 163.000000 946684971092224121
-53.000000 -103.000000 164.000000 946684971112731933
-50.000000 -102.000000 165.000000 946684971132232666
-61.000000 -101.000000 164.000000 946684971152191162
-57.000000 -99.000000 168.000000 946684971172210693
Disabling: in_magn_x_en
Disabling: in_magn_y_en
Disabling: in_magn_z_en
Disabling: in_timestamp_en

I cannot currently scale these raw values to gauss. This is
because of lack of documentation. I have sent a request for
a datasheet to Asahi Kasei.

The driver can optionally use a DRDY line IRQ to capture data,
else it will sleep and poll.

Cc: Samu Onkalo <samu.onkalo@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: DT bindings for AK8974
Linus Walleij [Mon, 25 Jul 2016 13:54:54 +0000 (15:54 +0200)]
iio: magn: DT bindings for AK8974

This adds device tree bindings for the AK8974 magnetometer, similar
to those for the AK8975.

Cc: devicetree@vger.kernel.org
Cc: Samu Onkalo <samu.onkalo@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Add IIO support for the Measurement Computing CIO-DAC family
William Breathitt Gray [Tue, 12 Jul 2016 13:33:14 +0000 (09:33 -0400)]
iio: Add IIO support for the Measurement Computing CIO-DAC family

The Measurement Computing CIO-DAC is a family of 16-bit and 12-bit
analog output devices. The analog outputs are from AD660BN/AD7237
converters with each output buffered by an OP-27. Voltage ranges are
configured via physical jumpers on the device.

This driver does not support the devices' simulataneous update mode; the
XFER jumper option should be deselected for all analog output channels.

This driver provides IIO support for the Measurement Computing CIO-DAC
family: CIO-DAC16, CIO-DAC08, and PC104-DAC06. The base port addresses
for the devices may be configured via the base array module parameter.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ad7298: use iio helper function to guarantee direct mode
Alison Schofield [Mon, 18 Jul 2016 19:34:17 +0000 (12:34 -0700)]
iio: adc: ad7298: use iio helper function to guarantee direct mode

Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ad7793: use iio helper function to guarantee direct mode
Alison Schofield [Mon, 18 Jul 2016 19:35:24 +0000 (12:35 -0700)]
iio: adc: ad7793: use iio helper function to guarantee direct mode

Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: kxcjk-1013: add the "KIOX000A" ACPI id
Christophe Chapuis [Sun, 17 Jul 2016 08:15:15 +0000 (10:15 +0200)]
iio: accel: kxcjk-1013: add the "KIOX000A" ACPI id

On the Cube i9 tablet, the ACPI id for the Kionix kxcj9 accelerometer is
"KIOX000A" (as can be seen in the DSDT of the Cube i9 tablet).
It is the same accelerometer, so only adding the ACPI id is needed.

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: light: isl29018/28: remove I2C_CLASS_HWMON .class setting
Alison Schofield [Sat, 16 Jul 2016 02:28:47 +0000 (19:28 -0700)]
staging: iio: light: isl29018/28: remove I2C_CLASS_HWMON .class setting

I2C_CLASS_HWMON is for a hardware monitoring chip wanting
auto-detection.  IIO drivers don't typically use .class.
Remove it.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29028: Prefix functions
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:44 +0000 (13:55 +0200)]
staging: iio: isl29028: Prefix functions

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29028: Expose scale and sample frequency available without comma
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:43 +0000 (13:55 +0200)]
staging: iio: isl29028: Expose scale and sample frequency available without comma

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29028: Prefix stuff
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:42 +0000 (13:55 +0200)]
staging: iio: isl29028: Prefix stuff

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29028: Prefix #defines
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:41 +0000 (13:55 +0200)]
staging: iio: isl29028: Prefix #defines

and drop unused PROX_DRIVE

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29018: Prefix remaining functions
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:40 +0000 (13:55 +0200)]
staging: iio: isl29018: Prefix remaining functions

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29018: Cleanup of comments
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:39 +0000 (13:55 +0200)]
staging: iio: isl29018: Cleanup of comments

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29018: Drop newlines
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:38 +0000 (13:55 +0200)]
staging: iio: isl29018: Drop newlines

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29018: Remove excessive output messages
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:37 +0000 (13:55 +0200)]
staging: iio: isl29018: Remove excessive output messages

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: isl29018: Prefix #defines
Peter Meerwald-Stadler [Tue, 5 Jul 2016 11:55:36 +0000 (13:55 +0200)]
staging: iio: isl29018: Prefix #defines

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: vcnl4000: Add missing locking
Peter Meerwald-Stadler [Tue, 5 Jul 2016 10:23:21 +0000 (12:23 +0200)]
iio: light: vcnl4000: Add missing locking

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: vcnl4000: Cleanup read_raw() returns
Peter Meerwald-Stadler [Tue, 5 Jul 2016 10:23:20 +0000 (12:23 +0200)]
iio: light: vcnl4000: Cleanup read_raw() returns

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: vcnl4000: Use BIT() macro
Peter Meerwald-Stadler [Tue, 5 Jul 2016 10:23:19 +0000 (12:23 +0200)]
iio: light: vcnl4000: Use BIT() macro

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: vcnl4000: Mention and check support for VCNL4010 and VCNL4020
Peter Meerwald-Stadler [Tue, 5 Jul 2016 10:23:18 +0000 (12:23 +0200)]
iio: light: vcnl4000: Mention and check support for VCNL4010 and VCNL4020

VCNL4000, VCNL4010 and VCNL4020 chips are fairly compatible from a software
point of view, added features are not yet supported by the driver

patch adds a check for the product ID and demotes the corresponding
dev_info() to dev_dbg()

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: temperature: add support for Maxim thermocouple chips
Matt Ranostay [Tue, 5 Jul 2016 01:54:04 +0000 (18:54 -0700)]
iio: temperature: add support for Maxim thermocouple chips

Add initial driver support for MAX6675, and MAX31855 thermocouple chips.

Cc: Marek Vasut <marex@denx.de>
Cc: Matt Porter <mporter@konsulko.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agodrivers:iio:accel:mma8452: removed unwanted return statements
Bijosh Thykkoottathil [Mon, 4 Jul 2016 11:15:08 +0000 (11:15 +0000)]
drivers:iio:accel:mma8452: removed unwanted return statements

Removed unwanted return statements from the function
mma8452_set_freefall_mode.

Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agodrivers:iio:accel:mma8452: added cleanup provision in case of failure.
Bijosh Thykkoottathil [Mon, 4 Jul 2016 10:08:53 +0000 (10:08 +0000)]
drivers:iio:accel:mma8452: added cleanup provision in case of failure.

mma8452_set_freefall_mode can return -ve value in case if
i2c_smbus_read_byte_data fails. This function is called from mma8452_probe,
and returning -ve value from probe indicates probe failure. Need to call
iio_triggered_buffer_cleanup & iio_trigger_cleanup in this case.

Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Add iio.git tree to MAINTAINERS
Jonathan Cameron [Sun, 3 Jul 2016 09:18:03 +0000 (10:18 +0100)]
iio: Add iio.git tree to MAINTAINERS

The tree has been in the same location for a long time.  Putting it in
MAINTAINERS makes it easy for those new to, or less familiar with IIO
to find the correct tree to base patches on.

Mostly basing on staging-next is fine as well unless working on a very
active driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure: clean useless static channel initializers
Gregor Boirie [Mon, 27 Jun 2016 10:38:58 +0000 (12:38 +0200)]
iio:st_pressure: clean useless static channel initializers

Some static channels are explicitly initialized with default values.
Remove them to enhance readability.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure:lps22hb: temperature support
Gregor Boirie [Mon, 27 Jun 2016 10:38:57 +0000 (12:38 +0200)]
iio:st_pressure:lps22hb: temperature support

Implement lps22hb temperature sampling channel.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure:lps22hb: open drain support
Gregor Boirie [Mon, 27 Jun 2016 10:38:56 +0000 (12:38 +0200)]
iio:st_pressure:lps22hb: open drain support

Add support for open drain interrupt line.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure: temperature triggered buffering
Gregor Boirie [Mon, 27 Jun 2016 10:38:55 +0000 (12:38 +0200)]
iio:st_pressure: temperature triggered buffering

Enable support for triggered buffering of temperature samples.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure: document sampling gains
Gregor Boirie [Mon, 27 Jun 2016 10:38:54 +0000 (12:38 +0200)]
iio:st_pressure: document sampling gains

Details scaling factors and offsets applied to raw temperature and pressure
samples.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_pressure: align storagebits on power of 2
Gregor Boirie [Mon, 27 Jun 2016 10:38:53 +0000 (12:38 +0200)]
iio:st_pressure: align storagebits on power of 2

Sampled pressure data are 24 bits long and should be stored in a 32 bits
word.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:st_sensors: align on storagebits boundaries
Gregor Boirie [Mon, 27 Jun 2016 10:38:52 +0000 (12:38 +0200)]
iio:st_sensors: align on storagebits boundaries

Ensure triggered buffering memory accesses are properly aligned on per
channel storagebits boundaries.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging:iio:lis3l02dq drop separate driver
Jonathan Cameron [Sun, 3 Jul 2016 13:55:50 +0000 (14:55 +0100)]
staging:iio:lis3l02dq drop separate driver

Retire this venerable driver as the basic support is now in the
generic st-sensors accelerometer driver.

There are a few missing features in the new driver:
* Threshold events.
* Access to the calibration adjustment registers (patch shortly)

In exchange it brings a cleaner and more maintainable code base that actually
gets tested more than once every few years.  I'll actually be suprised
if anyone other than me has a board with one of these on that is running
an up to date kernel.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: st_accel: Add lis3l02dq support
Jonathan Cameron [Sun, 22 May 2016 19:39:29 +0000 (20:39 +0100)]
iio: accel: st_accel: Add lis3l02dq support

Time to finally kill off the venerable (it was one of my first drivers)
lis3l02dq driver in favour of adding support in the st sensors framework.

This does loose us the event support that driver always had, but I think
that will reappear at some point and in the meantime the maintenance
advantages of dropping the 'special' driver for this one part outweigh
the issues.

It's worth noting this part is ancient and I may well be the only person
who still has any on hardware running recent kernels.

It has a few 'quirks'.
 - No WAI register so that just became optional.
 - A BDU option that really does block updates.  Completely.
   Whatever you do, you don't get any more data with it set.
   It is documented the same as more modern parts but I presume they
   are actually clearing for updates after a read of both bytes!
 - Fixed scale.
 - It's too quick.  Even at slowest rate (280Hz) I can't read out fast
   enough on my board (stargate 2) to beat new data coming in. Linus'
   repeat read patch doesn't help in this case. It just means I get 10
   readings before dying... So in reality this will get used with
   software triggers only unless someone has this long out of production
   device on a quick board.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: add missing of_node references to iio_dev
Matt Ranostay [Sun, 3 Jul 2016 00:26:33 +0000 (17:26 -0700)]
iio: adc: add missing of_node references to iio_dev

Adding missing indio_dev->dev.of_node references to allow iio consumers
to access the device channels.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ti-ads1015: add indio_dev->dev.of_node reference
Matt Ranostay [Fri, 1 Jul 2016 02:33:50 +0000 (19:33 -0700)]
iio: adc: ti-ads1015: add indio_dev->dev.of_node reference

Add the pointer to the device tree node of the ADC so that iio
consumers can reference the respective channels.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: potentiometer: Fix typo in Kconfig
Florian Vaussard [Thu, 30 Jun 2016 07:34:51 +0000 (09:34 +0200)]
iio: potentiometer: Fix typo in Kconfig

Fix s/potentiomenter/potentiometer/.

Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: potentiometer: mcp4531: Add device tree binding
Florian Vaussard [Thu, 30 Jun 2016 07:34:50 +0000 (09:34 +0200)]
iio: potentiometer: mcp4531: Add device tree binding

This patch adds the necessary device tree binding to allow DT probing of
currently supported parts.

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: potentiometer: mcp4531: Add device tree binding documentation
Florian Vaussard [Thu, 30 Jun 2016 07:34:49 +0000 (09:34 +0200)]
iio: potentiometer: mcp4531: Add device tree binding documentation

Add the device tree documentation for all the supported parts. Apart the
compatible string and standard I2C binding, no other binding is currently
needed.

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: potentiometer: mcp4531: Add support for MCP454x, MCP456x, MCP464x and MCP466x
Florian Vaussard [Thu, 30 Jun 2016 07:34:48 +0000 (09:34 +0200)]
iio: potentiometer: mcp4531: Add support for MCP454x, MCP456x, MCP464x and MCP466x

This patch adds support for MCP454x, MCP456x, MCP464x and MCP466x parts.
The main difference with currently supported parts (MCP453x and alike) is
the addition of a non-volatile memory in order to recall the wiper setting
at power-on. This feature is currently not supported and only the
volatile memory is used to set the wiper.

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:imu:mpu6050: icm20608 initial support
Gregor Boirie [Thu, 30 Jun 2016 17:06:34 +0000 (19:06 +0200)]
iio:imu:mpu6050: icm20608 initial support

Introduce support for Invense ICM20608 IMU, a 6-axis motion tracking device
that combines a 3-axis gyroscope and a 3-axis accelerometer:
http://www.invensense.com/products/motion-tracking/6-axis/icm-20608-2

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: max1363: Add device tree binding
Florian Vaussard [Thu, 30 Jun 2016 07:43:06 +0000 (09:43 +0200)]
iio: adc: max1363: Add device tree binding

This patch adds the necessary device tree binding to allow DT probing of
currently supported parts.

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: max1363: Add device tree binding documentation
Florian Vaussard [Thu, 30 Jun 2016 07:43:05 +0000 (09:43 +0200)]
iio: adc: max1363: Add device tree binding documentation

Add the device tree documentation for all the supported parts. Mandatory
binding is the compatible string and the slave I2C address.

Optional properties can be used to specify the Vcc / Vref regulators, as
well as the IRQ line if available.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: bmg160: add callbacks for the filter frequency
Steffen Trumtrar [Thu, 21 Apr 2016 10:49:00 +0000 (12:49 +0200)]
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>
8 years agoiio: Add driver for Broadcom iproc-static-adc
Raveendra Padasalagi [Tue, 28 Jun 2016 07:40:35 +0000 (13:10 +0530)]
iio: Add driver for Broadcom iproc-static-adc

This patch adds basic driver implementation for Broadcom's
static adc controller used in iProc SoC's family.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoDocumentation: DT: Add iproc-static-adc binding
Raveendra Padasalagi [Tue, 28 Jun 2016 07:40:34 +0000 (13:10 +0530)]
Documentation: DT: Add iproc-static-adc binding

The patch adds devicetree binding document for broadcom's
iproc-static-adc controller driver.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: read calibration data once
Linus Walleij [Thu, 30 Jun 2016 01:48:54 +0000 (03:48 +0200)]
iio: pressure: bmp280: read calibration data once

The calibration data is described as coming from an E2PROM and that
means it does not change. Just read it once at probe time and store
it in the device state container. Also toss the calibration data
into the entropy pool since it is device unique.

Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add power management
Linus Walleij [Thu, 30 Jun 2016 01:48:53 +0000 (03:48 +0200)]
iio: pressure: bmp280: add power management

The PM280 has an internal standby-mode, but to really save power
we should shut the sensor down and disconnect the power. With
the proper .pm hooks we can enable both runtime and system power
management of the sensor. We use the *force callbacks from the
system PM hooks. When the sensor comes back we always reconfigure
it to make sure it is ready to roll as expected.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add support for BMP085 EOC interrupt
Linus Walleij [Thu, 30 Jun 2016 01:48:52 +0000 (03:48 +0200)]
iio: pressure: bmp280: add support for BMP085 EOC interrupt

The first version of this sensor, BMP085, supports sending an
End-of-Conversion (EOC) interrupt. Add code to support this using
a completion, in a similar vein as drivers/misc/bmp085.c does.

Make sure to check that we are given a rising edge, because the
EOC line goes from low-to-high when the conversion is ready.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add SPI interface driver
Linus Walleij [Thu, 30 Jun 2016 01:48:51 +0000 (03:48 +0200)]
iio: pressure: bmp280: add SPI interface driver

This patch mimics the SPI functionality found in the misc driver in
drivers/misc/bh085-spi.c to make it possible to reuse the existing
BMP280/BMP180/BMP085 driver with all clients of the other driver.
The adoption is straight-forward since like the other driver, it is
a simple matter of using regmap.

This driver is also so obviously inspired/copied from the old misc
driver in drivers/misc/bmp085.c that I just took the liberty to
add in the authors of the other drivers + self in the core driver
file.

The MISC driver also supports a variant named "BMP181" so include
that here to be complete in comparison to the old driver.

The bus mapping code for SPI was written by Akinobu Mita.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Tested-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: split off an I2C Kconfig entry
Linus Walleij [Thu, 30 Jun 2016 01:48:50 +0000 (03:48 +0200)]
iio: pressure: bmp280: split off an I2C Kconfig entry

This creates a separate BMP280_I2C Kconfig entry that gets selected
by BMP280 for I2C transport. As we currently only support I2C
transport there is not much practical change other than getting
a separate object file (or module) for the I2C driver part. The
old Kconfig symbol BMP280 will still select the stuff we need so
that oldconfig and old defconfigs works fine.

Tested-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: split driver in logical parts
Linus Walleij [Thu, 30 Jun 2016 01:48:49 +0000 (03:48 +0200)]
iio: pressure: bmp280: split driver in logical parts

This splits the BMP280 driver in three logical parts: the core driver
bmp280-core that only operated on a struct device * and a struct regmap *,
the regmap driver bmp280-regmap that can be shared between I2C and other
transports and the I2C module driver bmp280-i2c.

Cleverly bake all functionality into a single object bmp280.o so that
we still get the same module binary built for the device in the end,
without any fuzz exporting symbols to the left and right.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: support supply regulators
Linus Walleij [Thu, 30 Jun 2016 01:48:48 +0000 (03:48 +0200)]
iio: pressure: bmp280: support supply regulators

The BMP085/BMP180/BMP280 is supplied with two power sources:
VDDA (analog power) and VDDD (digital power). As these may come
from regulators (as on the APQ8060 Dragonboard) we need the driver
to attempt to fetch and enable these regulators.

We FAIL if we cannot: boards should either define:
- Proper regulators if present
- Define fixed regulators if power is hardwired to the component
- Rely on dummy regulators (will be present on all DT systems and
  any boardfile system that calls regulator_has_full_constraints().

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agodrivers:iio:light:isl29125: added macros for sensing range
Bijosh Thykkoottathil [Mon, 27 Jun 2016 15:37:41 +0000 (15:37 +0000)]
drivers:iio:light:isl29125: added macros for sensing range

Added macros for sensing range as the corresponding magic numbers
were used at multiple places.
   - ISL29125_SENSING_RANGE_0 for 375 lux full range
   - ISL29125_SENSING_RANGE_1 for 10k lux full range

Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_sensors: harden interrupt handling
Linus Walleij [Wed, 29 Jun 2016 13:14:42 +0000 (15:14 +0200)]
iio: st_sensors: harden interrupt handling

Leonard Crestez observed the following phenomenon: when using
hard interrupt triggers (the DRDY line coming out of an ST
sensor) sometimes a new value would arrive while reading the
previous value, due to latencies in the system.

We discovered that the ST hardware as far as can be observed
is designed for level interrupts: the DRDY line will be held
asserted as long as there are new values coming. The interrupt
handler should be re-entered until we're out of values to
handle from the sensor.

If interrupts were handled as occurring on the edges (usually
low-to-high) new values could appear and the line be held
asserted after that, and these values would be missed, the
interrupt handler would also lock up as new data was
available, but as no new edges occurs on the DRDY signal,
nothing happens: the edge detector only detects edges.

To counter this, do the following:

- Accept interrupt lines to be flagged as level interrupts
  using IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW. If the line
  is marked like this (in the device tree node or ACPI
  table or similar) it will be utilized as a level IRQ.
  We mark the line with IRQF_ONESHOT and mask the IRQ
  while processing a sample, then the top half will be
  entered again if new values are available.

- If we are flagged as using edge interrupts with
  IRQF_TRIGGER_RISING or IRQF_TRIGGER_FALLING: remove
  IRQF_ONESHOT so that the interrupt line is not
  masked while running the thread part of the interrupt.
  This way we will never miss an interrupt, then introduce
  a loop that polls the data ready registers repeatedly
  until no new samples are available, then exit the
  interrupt handler. This way we know no new values are
  available when the interrupt handler exits and
  new (edge) interrupts will be triggered when data arrives.
  Take some extra care to update the timestamp in the poll
  loop if this happens. The timestamp will not be 100%
  perfect, but it will at least be closer to the actual
  events. Usually the extra poll loop will handle the new
  samples, but once in a blue moon, we get a new IRQ
  while exiting the loop, before returning from the
  thread IRQ bottom half with IRQ_HANDLED. On these rare
  occasions, the removal of IRQF_ONESHOT means the
  interrupt will immediately fire again.

- If no interrupt type is indicated from the DT/ACPI,
  choose IRQF_TRIGGER_RISING as default, as this is necessary
  for legacy boards.

Tested successfully on the LIS331DL and L3G4200D by setting
sampling frequency to 400Hz/800Hz and stressing the system:
extra reads in the threaded interrupt handler occurs.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Tested-by: Crestez Dan Leonard <cdleonard@gmail.com>
Reported-by: Crestez Dan Leonard <cdleonard@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: deploy runtime and system PM
Linus Walleij [Wed, 29 Jun 2016 12:08:38 +0000 (14:08 +0200)]
iio: magn: ak8975: deploy runtime and system PM

This adds runtime PM support to the AK8975 driver. It solves two
problems:

- After reading the first value the chip was left in MODE_ONCE,
  meaning (presumably) it may be consuming more power. Now the
  runtime PM hooks kick in and set it to POWER_DOWN.

- Regulators were simply enabled and left on, making it
  impossible to turn the power consuming regulators off because
  of the increased refcount. We now disable the regulators at
  autosuspend.

- We also handle system suspend: by using pm_runtime_force_suspend()
  and pm_runtime_force_resume() from the system PM sleep hooks,
  the runtime PM code is managing the power also for this case.
  It is currently not completely optimal: when the system resumes
  the AK8975 goes into active mode even if noone is going to use
  it: currently the force calls need to be paired, but the runtime
  PM people are working on making it possible to leave devices
  runtime suspended when coming back from sleep.

Inspired by my work on the BH1780 light sensor driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: make sure to power down at remove()
Linus Walleij [Wed, 29 Jun 2016 12:08:37 +0000 (14:08 +0200)]
iio: magn: ak8975: make sure to power down at remove()

The code was not powering the magnetometer down properly at
remove(): just cutting the regulators without first setting the
device in power off mode. Fix this.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: allow a delay after enabling regulators
Linus Walleij [Wed, 29 Jun 2016 12:08:36 +0000 (14:08 +0200)]
iio: magn: ak8975: allow a delay after enabling regulators

The datasheet actually specifies that we need to wait atleast
500us after powering on the device before trying to set mode.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: refactor regulator handlers
Linus Walleij [Wed, 29 Jun 2016 12:08:35 +0000 (14:08 +0200)]
iio: magn: ak8975: refactor regulator handlers

Move the regulator_get() calls directly into the probe() function,
keep only the power_on()/power_off() functions to flick the
regulators on/off.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: add Vid regulator
Linus Walleij [Wed, 29 Jun 2016 12:08:34 +0000 (14:08 +0200)]
iio: magn: ak8975: add Vid regulator

The AK8975 has two power sources: Vdd (analog voltage supply)
and Vid (digital voltage supply). Optionally also obtain the Vid
supply regulator and enable it.

If an error occurs when enabling one of the regulators: bail out.

Cc: Gregor Boirie <gregor.boirie@parrot.com>
Cc: Richard Leitner <dev@g0hl1n.net>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: ak8975: fix regulator usage
Linus Walleij [Wed, 29 Jun 2016 12:08:33 +0000 (14:08 +0200)]
iio: magn: ak8975: fix regulator usage

IS_ERR_OR_NULL() should never be used with regulators because
a NULL pointer may be a perfectly valid dummy regulator

We should always succeed to fetch and enable a regulator, but
it may be a dummy. That is fine, so bail out for any real
errors or probe deferrals

Include the error code in the warning print so we know what
kind of problem we're dealing with (for example it is nice to
see if it is a probe deferral).

As we will bail out of probe if the regulator is erroneous,
just issue regulator_disable() on the poweroff path: it will
succeed.

Cc: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add reset GPIO line handling
Linus Walleij [Thu, 30 Jun 2016 01:48:47 +0000 (03:48 +0200)]
iio: pressure: bmp280: add reset GPIO line handling

On the APQ8060 Dragonboard the reset line to the BMP085 pressure
sensor is not deasserted on boot, so the driver needs to handle
this. For a simple GPIO line supplied as a descriptor (from a board
file, device tree or ACPI) this does the trick.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: support device tree initialization
Linus Walleij [Thu, 30 Jun 2016 01:48:46 +0000 (03:48 +0200)]
iio: pressure: bmp280: support device tree initialization

This adds device tree support to the BMP085, BMP180 and BMP280
pressure sensors. Tested on the Qualcomm APQ8060 Dragonboard:

iio:device1$ cat in_temp_input
26700
iio:device1$ cat in_pressure_input
99.185000000

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: augment DT bindings
Linus Walleij [Thu, 30 Jun 2016 01:48:45 +0000 (03:48 +0200)]
iio: pressure: bmp280: augment DT bindings

This adds standard device tree bindings for a reset GPIO line, and
the VDDD and VDDA power regulators.

Cc: devicetree@vger.kernel.org
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:core: timestamping clock selection support
Gregor Boirie [Wed, 9 Mar 2016 18:05:49 +0000 (19:05 +0100)]
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>
8 years agotimekeeping: export get_monotonic_coarse64 symbol
Gregor Boirie [Wed, 9 Mar 2016 18:05:48 +0000 (19:05 +0100)]
timekeeping: export get_monotonic_coarse64 symbol

EXPORT_SYMBOL() get_monotonic_coarse64 for new IIO timestamping clock
selection usage. This provides user apps the ability to request a
particular IIO device to timestamp samples using a monotonic coarse clock
granularity.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoMerge tag 'iio-for-4.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Wed, 29 Jun 2016 22:35:01 +0000 (15:35 -0700)]
Merge tag 'iio-for-4.8b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second round of new iio device support, features and cleanups in the 4.8 cycle

Firstly some contact detail updates:
* NXP took over freescale. Update the mma8452 header to reflect this.
* Martin Kepplinger email address change in mma8452 header.
* Adriana Reus has changed email address. Update .mailmap.
* Matt Ranostay has changed email address. Update .mailmap.

New Device Support
* max1363
  - add the missing i2c_device_ids for a couple of parts so they can actually
    be used.
* ms5867
  - add device ids for ms5805 and ms5837 parts.

New Features
* ad5755
  - DT support.  This one was a bit controversial and under review for a long
    time.  Still no one could come up with a better solution.
* stx104
  - add gpio support
* ti-adc081c
  - Add ACPI device ID matching.

Core changes
* Refuse to register triggers with duplicate names.  There is no way to
  distinguish between them so this makes no sense.  A few drivers do not
  generate unique names for each instance of the device present.  We can't
  fix this without changing ABI so leave them and wait for someone to
  actually take the rare step of two identical accelerometers on the same
  board.
* buffer-dma
  - use ARRAY_SIZE in a few appropriate locations.

Tools
* Fix the fact that the --trigger-num option in generic_buffer didn't allow
  0 which is perfectly valid in the ABI.

Cleanups
* as3935
  - improve error reporting.
  - remove redundant zeroing of a field in iio_priv.
* gp2ap020a00f
  - use the iio_device_claim_*_mode helpers rather than open coding locking
  around mode changes.
* isl29125
  - use the iio_device_claim_*_mode helpers rather than open coding locking.
* lidar
  - use the iio_device_claim_*_mode helpers rather than open coding locking.
* mma8452
  - more detail in devices supported description in comments (addresses and
  similar)
* sca3000
  - add a missing error check.
* tcs3414
  - use the iio_device_claim_*_mode helpers rather than open coding locking.
* tcs3472
  - use the iio_device_claim_*_mode helpers rather than open coding locking.

8 years agoiio: ad5755: Add DT binding documentation
Sean Nyekjaer [Mon, 27 Jun 2016 08:27:18 +0000 (10:27 +0200)]
iio: ad5755: Add DT binding documentation

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: ad5755: add support for dt bindings
Sean Nyekjaer [Mon, 27 Jun 2016 08:27:17 +0000 (10:27 +0200)]
iio: ad5755: add support for dt bindings

Devicetree can provide platform data

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: buffer-dma: Use ARRAY_SIZE in for loop range
Phil Reid [Mon, 27 Jun 2016 03:17:56 +0000 (11:17 +0800)]
iio: buffer-dma: Use ARRAY_SIZE in for loop range

Use the ARRAY_SIZE macro in the for loops that access queue->fileio.blocks.
Macro is already used in a couple of places where this access occurs,
but range was hardcoded in these locations.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: max1363: Fix missing i2c_device_id for MAX1164x parts
Florian Vaussard [Tue, 21 Jun 2016 07:09:27 +0000 (09:09 +0200)]
iio: adc: max1363: Fix missing i2c_device_id for MAX1164x parts

The driver supports MAX11644, MAX11645, MAX11646 and MAX11647 parts. But
the corresponding i2c_device_id are missing. Add them!

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: proximity: as3935: remove redundant zeroing of tune_cap
Matt Ranostay [Thu, 16 Jun 2016 01:47:02 +0000 (18:47 -0700)]
iio: proximity: as3935: remove redundant zeroing of tune_cap

This is redundant as the containing stucture is allocated as part of
iio_device_alloc using kzalloc and hence is already 0.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: stx104: Add GPIO support for the Apex Embedded Systems STX104
William Breathitt Gray [Mon, 13 Jun 2016 13:06:48 +0000 (09:06 -0400)]
iio: stx104: Add GPIO support for the Apex Embedded Systems STX104

The Apex Embedded Systems STX104 device features eight lines of digital
I/O (four digital inputs and four digital outputs). This patch adds GPIO
support for these eight lines of digital I/O via GPIOLIB.

Cc: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: as3935: improve error reporting in as3935_event_work
Arnd Bergmann [Mon, 30 May 2016 14:52:04 +0000 (16:52 +0200)]
iio: as3935: improve error reporting in as3935_event_work

gcc warns about a potentially uninitialized variable use
in as3935_event_work:

drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’:
drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This case specifically happens when spi_w8r8() fails with a
negative return code. We check all other users of this function
except this one.

As the error is rather unlikely to happen after the device
has already been initialized, this just adds a dev_warn().
Another warning already exists in the same function, but is
missing a trailing '\n' character, so I'm fixing that too.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: accel: add error check
Luis de Bethencourt [Wed, 22 Jun 2016 19:43:31 +0000 (20:43 +0100)]
staging: iio: accel: add error check

Go to error_ret if sca3000_read_ctrl_reg() failed.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ti-adc081c: add ACPI device ID matching
Dan O'Donovan [Fri, 27 May 2016 17:37:30 +0000 (18:37 +0100)]
iio: adc: ti-adc081c: add ACPI device ID matching

Add ACPI device ID matching for TI ADC081C/ADC101C/ADC121C ADCs.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Refuse to register triggers with duplicate names
Crestez Dan Leonard [Mon, 23 May 2016 18:40:01 +0000 (21:40 +0300)]
iio: Refuse to register triggers with duplicate names

The trigger name is documented as unique but drivers are currently
allowed to register triggers with duplicate names. This should be
considered a bug since it makes the 'current_trigger' interface
unusable.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: fsl-mc: convert mc command build/parse to use C structs
Ioana Radulescu [Wed, 22 Jun 2016 21:40:52 +0000 (16:40 -0500)]
staging: fsl-mc: convert mc command build/parse to use C structs

The layer abstracting the building of commands and extracting
responses is currently based on macros that shift and mask the command
fields and requires exposing offset/size values as macro parameters
and makes the code harder to read.

For clarity and maintainability, instead use an implementation based on
mapping the MC command definitions to C structures. These structures
contain the hardware command fields (which are naturally-aligned)
and individual fields are little-endian ordering (the byte ordering
of the hardware).

As such, there is no need to perform the conversion between core and
hardware (LE) endianness in mc_send_command(), but instead each
individual field in a command will be converted separately if needed
by the function building the command or extracting the response.

This patch does not introduce functional changes, both the hardware
ABIs and the APIs exposed for the DPAA2 objects remain the same.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: properly set hwirq in msi set_desc
Stuart Yoder [Wed, 22 Jun 2016 21:40:51 +0000 (16:40 -0500)]
staging: fsl-mc: properly set hwirq in msi set_desc

For an MSI domain the hwirq is an arbitrary but unique
id to identify an interrupt.  Previously the hwirq was set to
the MSI index of the interrupt, but that only works if there is
one DPRC.  Additional DPRCs require an expanded namespace.  Use
both the ICID (which is unique per DPRC) and the MSI index to
compose a hwirq value.

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: dprc: fix ordering problem freeing resources in remove of dprc
Stuart Yoder [Wed, 22 Jun 2016 21:40:50 +0000 (16:40 -0500)]
staging: fsl-mc: dprc: fix ordering problem freeing resources in remove of dprc

When unbinding a dprc from the dprc driver the cleanup of
the resource pools must happen after irq pool cleanup
is done.

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: dprc: add missing irq free
Stuart Yoder [Wed, 22 Jun 2016 21:40:49 +0000 (16:40 -0500)]
staging: fsl-mc: dprc: add missing irq free

add missing free of the Linux irq when tearing down interrupts

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: fix asymmetry in destroy of mc_io
Bharat Bhushan [Wed, 22 Jun 2016 21:40:48 +0000 (16:40 -0500)]
staging: fsl-mc: fix asymmetry in destroy of mc_io

An mc_io represents a mapped MC portal.  Previously, an mc_io was
created for the root dprc in fsl_mc_bus_probe() and for child dprcs
in dprc_probe().  But the free of that data structure happened in the
general bus remove callback.  This asymmetry resulted in some bugs due
to unwanted destroys of mc_io object in some scenarios (e.g. vfio).

Fix this bug by making things symmetric-- mc_io created in
fsl_mc_bus_probe() is freed in fsl_mc_bus_remove().  The mc_io created
in dprc_probe() is freed in dprc_remove().

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
[Stuart: added check for root dprc and reworded commit message]
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: make fsl_mc_is_root_dprc() global
Stuart Yoder [Wed, 22 Jun 2016 21:40:47 +0000 (16:40 -0500)]
staging: fsl-mc: make fsl_mc_is_root_dprc() global

make fsl_mc_is_root_dprc() global so that the dprc driver
can use it

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: export mc_get_version
Stuart Yoder [Wed, 22 Jun 2016 21:40:46 +0000 (16:40 -0500)]
staging: fsl-mc: export mc_get_version

some drivers (built as modules) rely on mc_get_version()

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: add support for device table matching
Stuart Yoder [Wed, 22 Jun 2016 21:40:45 +0000 (16:40 -0500)]
staging: fsl-mc: add support for device table matching

Move the definition of fsl_mc_device_id to its proper location in
mod_devicetable.h, and add fsl-mc bus support to devicetable-offsets.c
and file2alias.c to enable device table matching.  With this patch udev
based module loading of fsl-mc drivers is supported.

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: clean up the device id struct
Stuart Yoder [Wed, 22 Jun 2016 21:40:44 +0000 (16:40 -0500)]
staging: fsl-mc: clean up the device id struct

-rename the struct used for fsl-mc device ids to be more
 consistent with other busses
-remove the now obsolete and unused version fields

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: implement uevent callback and set the modalias
Stuart Yoder [Wed, 22 Jun 2016 21:40:43 +0000 (16:40 -0500)]
staging: fsl-mc: implement uevent callback and set the modalias

Replace placeholder code in the uevent callback to properly
set the MODALIAS env variable.

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>