iio:accel: Removed unnecessary parameter on common_probe function

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:gyro: Removed unnecessary parameter on common_probe function

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:magnetometer: Removed unnecessary parameter on common_probe function

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:pressure: Removed unnecessary parameter on common_probe function

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:pressure: Changed pressure data variable name to press_data

This patch fix pressure data variable name. Usually pdata name
it is used for platform data.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:common: Set the device pointer into ST common sensors library

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: vf610: Return the error code directly

There is no need to pass the error clock code to the variable 'ret'.

Just return the error directly.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: vf610: Disable the regulator on error

If clk_prepare_enable() fails we should disable the regulator that was
previously enabled.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: vf610: SIMPLE_DEV_PM_OPS can fit on a single line

No need to call the SIMPLE_DEV_PM_OPS() macro in several lines.

It can fit into the 80-column range.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
IIO: add si7020 driver

This patch adds support to the Industrial IO subsystem
for the Silicon Labs Si7013/20/21 Relative Humidity and
Temperature Sensors.

Website: http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx

These are i2c devices which measure relative humidity
and temperature and all use the same protocol. The
Si7013 has an additional input with programmable
linearization which is not supported because that's
complicated and I didn't need it.

Signed-off-by: David Barksdale <dbarksdale@uplogix.com>

--
Changes since v1:
* Renamed to si7020 and replaced Si701x/2x with Si7013/20/21.
* Removed unneeded mutex.
* Pre-computed floating-point constant expressions.
* Removed address_list and I2C_CLASS_HWMON.

Changes since v2:
* Return correct raw sensor values.
* Rename dev variable to indio_dev.
* Issue a software reset command during probe.
* Un-broke string literal.

Changes since v3:
* enum changed to #define
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: mcp320x. Add support for more ADCs

Signed-off-by: Soeren Andersen <san at rosetechnology.dk>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: vf610: Propagate the real error when platform_get_irq() fails

There is no need to pass a 'fake' return value when platform_get_irq() fails.

Propagate the real error instead.

While at it, only consider negative numbers returned by platform_get_irq()
as error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: add ABI documentation for scaled pressure

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: add bmp280 pressure and temperature driver

Minimal implementation, can read temperature and data using direct mode.

Datasheet available at
<http://ae-bst.resource.bosch.com/media/products/dokumente/bmp280/BST-BMP280-DS001-09.pdf>

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
bmp280: use correct routine for division

The proper way to divide two signed 64-bit values is to use div64_s64.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Add ABI documentation for offset and scaled humidity

This patch adds ABI documentation entries for in_humidityrelative_offset
and in_humidityrelative_scale, since there is at least one user for these,
Si7005 humidity and temperature sensor driver.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Add ABI documentation for RGBC intensity hardware gain factor

This patch adds documentation for RGBC in_intensity_*_hardwaregain.
There is at least one user for these, ADJD-S311-CR999 digital color sensor
driver.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging: iio: iio_event_monitor: Add support for missing IIO modifiers

This patch adds the missing IIO modifiers in event_is_known function
and iio_modifier_names vector.

Additionally, it removes duplicate name entries of IIO_MOD_LIGHT_BOTH
and IIO_MOD_LIGHT_IR in iio_modifier_names.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: inkern: Add of_xlate function to struct iio_info

When #iio-cells is greater than '0', the driver could provide
a custom of_xlate function that reads the *args* and returns
the appropriate index in registered IIO channels array.

Add simple translation function, suitable for the most 1:1
mapped channels in IIO chips, and use it when driver did not
provide custom implementation.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:humidity:si7020: cleanup read_raw and probe

When reading temperature or humidity values, a shift of two bits to the right
needs to be applied, and only for the humidity channel a mask of the lower
12 bits needs to be applied. This reduces code repetition.
During probe, i2c_set_clientdata() was used, although its counterpart was not,
so drop it.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>