Brian Masney [Tue, 17 Jan 2017 09:25:02 +0000 (04:25 -0500)]
staging: iio: isl29028: add runtime power management support
This patch adds runtime power management support to the isl29028 driver.
It defaults to powering off the device after two seconds of inactivity.
isl29028_chip_init_and_power_on() currently only zeros the CONFIGURE
register on the chip, which will cause the chip to turn off. This patch
also renames that function to isl29028_clear_configure_reg() since it is
now used in several places.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:25:01 +0000 (04:25 -0500)]
staging: iio: isl29028: only set ALS scale when ALS/IR sensing is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_als_scale() and
this is not needed until the user actually needs to take a reading from
the ALS/IR sensor. This patch moves the isl29028_set_als_scale() call
from isl29028_chip_init_and_power_on() to isl29028_set_als_ir_mode().
This sets the stage for faster resume times from runtime power
management if the user is only querying the proximity sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:25:00 +0000 (04:25 -0500)]
staging: iio: isl29028: only set proximity sampling rate when proximity is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_proxim_sampling()
and this is not needed until the user actually needs to take a proximity
reading. This patch moves the isl29028_set_proxim_sampling() call from
isl29028_chip_init_and_power_on() to isl29028_enable_proximity().
This sets the stage for faster resume times from the runtime power
management if the user is only querying the ALS/IR sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:59 +0000 (04:24 -0500)]
staging: iio: isl29028: remove enable flag from isl29028_enable_proximity()
isl29028_enable_proximity() has a boolean argument named enable. This
function is only called once and the enable flag is set to true in that
call. This patch removes the enable parameter from that function.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_write_raw() contains unnecessary parenthesis when checking to
see if the passed in lux scale is valid. This patch removes the
unnecessary parenthesis.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:57 +0000 (04:24 -0500)]
staging: iio: isl29028: remove out of memory log message
If the call to devm_iio_device_alloc() fails, then isl29028_probe()
logs a message saying that memory cannot be allocated. The user's system
most likely has larger issues at this point. This patch removes that
error message since the error code is passed on and the message is not
necessary.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:56 +0000 (04:24 -0500)]
staging: iio: isl29028: remove unnecessary error logging in isl29028_chip_init_and_power_on()
If the call to isl29028_chip_init_and_power_on() in isl29028_probe()
fails, then isl29028_probe() will log an error message. All of the
error paths in that call path already have error logging in place. This
patch removes the unnecessary logging.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:54 +0000 (04:24 -0500)]
staging: iio: isl29028: move failure logging into isl29028_set_als_scale()
When isl29028_set_als_scale() fails, it was up to both callers to log
the failure message. This patch moves the logging into
isl29028_set_als_scale() to reduce the overall amount of code in the
driver.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:53 +0000 (04:24 -0500)]
staging: iio: isl29028: move failure logging into isl29028_set_proxim_sampling()
When isl29028_set_proxim_sampling() fails, it was up to both callers to
log the failure message. This patch moves the logging into
isl29028_set_proxim_sampling() to reduce the overall amount of code in
the driver.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:48 +0000 (04:24 -0500)]
staging: iio: isl29028: made alignment of variables in struct isl29028_chip consistent
The alignment of the variables in the struct isl29028_chip is not
consistent. This changes all of the variables to use consistent
alignment to improve the code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:50 +0000 (04:24 -0500)]
staging: iio: isl29028: combine isl29028_proxim_get() and isl29028_read_proxim()
isl29028_proxim_get() checks to see if the promixity needs to be
enabled on the chip and then calls isl29028_read_proxim(). There
are no other callers of isl29028_read_proxim(). The naming between
these two functions can be confusing so this patch combines the
two to avoid the confusion.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:49 +0000 (04:24 -0500)]
staging: iio: isl29028: fix alignment of function arguments
Two separate calls to regmap_update_bits() in isl29028_set_als_scale()
and isl29028_set_als_ir_mode() did not have their function arguments
on the next line aligned correctly to the open parenthesis. This patch
corrects the alignment.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: max1363: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: potentiometer: mcp4531: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: opt3001: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: health: max30100: use msleep() for long uncritical delays
ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 35ms delays here to use msleep() and
reduce the load on the hrtimer subsystem.
Fixes: commit 4d33615df58b ("iio: light: add MAX30100 oximeter driver support") Link: http://lkml.org/lkml/2017/1/11/377 Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Phil Reid [Mon, 16 Jan 2017 08:38:24 +0000 (16:38 +0800)]
iio: adc: tlc4541: add support for TI tlc4541 adc
This adds TI's tlc4541 16-bit ADC driver. Which is a single channel
ADC. Supports raw and trigger buffer access.
Also supports the tlc3541 14-bit device, which has not been tested.
Implementation of the tlc3541 is fairly straight forward thou.
Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Mon, 16 Jan 2017 05:01:10 +0000 (21:01 -0800)]
iio: bmi160: use variable names for sizeof() operator
Replace the types with the actual variable names when using the
sizeof() operator. This is kernel preferred style as it's
more obvious that it is correct.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Arnd Bergmann [Fri, 20 Jan 2017 16:25:15 +0000 (17:25 +0100)]
iio: light: cm3605: mark PM functions as __maybe_unused
When CONFIG_PM_SLEEP is disabled, we get a harmless warning
drivers/iio/light/cm3605.c:292:12: error: 'cm3605_pm_resume' defined but not used [-Werror=unused-function]
drivers/iio/light/cm3605.c:281:12: error: 'cm3605_pm_suspend' defined but not used [-Werror=unused-function]
Marking the functions as possibly unused avoids the warning without
needing to add an #ifdef.
Fixes: 8afa505c1230 ("iio: light: add driver for Capella CM3605") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Fri, 20 Jan 2017 20:22:58 +0000 (12:22 -0800)]
iio: pressure: ms5611: claim direct mode during oversampling changes
Driver was checking for direct mode before changing oversampling
ratios, but was not locking it. Use the claim/release helper
functions to guarantee the device stays in direct mode while the
oversampling ratios are being updated. Continue to use the drivers
private state lock to protect against conflicting direct mode access
of the state data.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Fri, 20 Jan 2017 22:11:30 +0000 (14:11 -0800)]
iio: proximity: sx9500: claim direct mode during raw proximity reads
Driver was checking for direct mode but not locking it. Use the
claim/release helper functions to guarantee the device stays in
direct mode during raw reads of proximity data.
Alison Schofield [Fri, 20 Jan 2017 20:39:32 +0000 (12:39 -0800)]
iio: magnetometer: mag3110: claim direct mode during raw writes
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during raw writes.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
David Lechner [Wed, 11 Jan 2017 17:52:51 +0000 (11:52 -0600)]
iio: adc: ti-ads7950: Change regulator matching string to "vref"
This changes the reference voltage regulator matching string from "refin"
to "vref". This is to be consistent with other A/DC chips that also use
"vref-supply" in their device tree bindings.
Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
David Lechner [Wed, 11 Jan 2017 17:52:50 +0000 (11:52 -0600)]
iio: adc: ti-ads7950: Drop "ti-" prefix from module name
This drops the "ti-" prefix from the module name. It makes the module name
consistent with other iio ti-ads* drivers and it makes the driver work
with device tree (the spi subsystem drops the "ti," prefix when matching
compatible strings from device tree).
Tested working on LEGO MINDSTORMS EV3 with the following device tree node:
Colin Ian King [Wed, 11 Jan 2017 17:49:33 +0000 (17:49 +0000)]
iio: magnetometer: ak8974: remove redundant zero timeout check
At the end of the delay loop timeout will always be zero
and hence the check for !timeout will always be true. Remove
the redundant check and the redundant return 0 at the end of
the function.
Fixes CoverityScan CID#1357168 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Wed, 11 Jan 2017 10:48:39 +0000 (11:48 +0100)]
iio: inkern: pass through raw values if no scaling
When a consumer calls iio_read_channel_processed() the IIO core
tries to apply scaling to the value, but if the channel only
supports reading raw values, we should return that raw value
to the cosumer instead of an error.
This is what userspace is expected to do with sensors only
providing raw values so the kernel should do the same, so as to
avoid adding scaling boilerplate to drivers for hardware that
actually return processed values from raw reads.
A sensor not providing a scale, but providing a _raw attribute
could be valid if for example the scale is the default of 1,
but an offset needs to be applied to convert to the _processed
form.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support for TI TMP007 - 16 bit IR thermopile sensor with integrated Math engine.
Sensor takes care of calculating the object temperature with the help of calibrated constants stored in non-volatile memory,
thereby reducing the calculation overhead.
Signed-off-by: Manivannan Sadhasivam <manivannanece23@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:adc:qcom-spmi-vadc: use div64_s64 instead of direct 64 bit division.
Another one of these that we missed previously which prevents test builds
of this driver on 32 bit platforms as it gives an undefined __divdi3 warning.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Fri, 30 Dec 2016 18:25:49 +0000 (18:25 +0000)]
iio:adc:qcom-spmi-vadc : fix undefined __divdi3
A simple do_div call works here as all the signed 64 bit is
actually small and unsigned at this point, and the numerator is
u32.
Introduce a temporary u64 variable to avoid type comparison warnings
on some architectures.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Wed, 14 Dec 2016 13:55:25 +0000 (14:55 +0100)]
iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications
For some reason the axp288_adc driver was modifying the
AXP288_ADC_TS_PIN_CTRL register, changing bits 0-1 depending on
whether the GP_ADC channel or another channel was written.
These bits control when a bias current is send to the TS_PIN, the
GP_ADC has its own pin and a separate bit in another register to
control the bias current.
Not only does changing when to enable the TS_PIN bias current
(always or only when sampling) when reading the GP_ADC make no sense
at all, the code is modifying these bits is writing the entire register,
assuming that all the other bits have their default value.
So if the firmware has configured a different bias-current for either
pin, then that change gets clobbered by the write, likewise if the
firmware has set bit 2 to indicate that the battery has no thermal sensor,
this will get clobbered by the write.
This commit fixes all this, by simply removing all writes to the
AXP288_ADC_TS_PIN_CTRL register, they are not needed to read the
GP_ADC pin, and can actually be harmful.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.
Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/iio/adc/fsl-imx25-gcq.ko | grep alias
$
After this patch:
$ modinfo drivers/iio/adc/fsl-imx25-gcq.ko | grep alias
alias: of:N*T*Cfsl,imx25-gcqC*
alias: of:N*T*Cfsl,imx25-gcq
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio:buffer.h - split into buffer.h and buffer_impl.h
buffer.h supplies everything needed for devices using buffers.
buffer_impl.h supplies access to the internals as needed to write
a buffer implementation.
This was really motivated by the mess that turned up in the
kernel-doc documentation pulled in by the new sphinx docs.
It made it clear that our logical separations in headers were
generally terrible. The buffer case was easy to sort out without
greatly effecting drivers so here it is.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
It's bad practice and only done in this fake driver + it breaks my
attempt to take struct buffer opaque. Not worth an access function
as it shouldn't be done anyway.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
iio:buffer: Push implementation of iio_device_attach_buffer into .c file
This is a precursor to the splitting of buffer.h into parts relevant
to buffer implementation vs those for devices using buffers.
struct buffer is about to become opaque as far as the header is
concerned.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
iio:buffer.h include pushdown into buffer implementations
These were only getting access to the internals of struct iio_dev via
the include of iio.h within buffer.h. This should always have been
explicitly included by the buffer implementations themselves.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Linus Walleij [Thu, 5 Jan 2017 13:32:33 +0000 (14:32 +0100)]
iio: accel: st_accel: handle deprecated bindings
The earlier deployed LIS3LV02DL driver had already defined a few
DT bindings that need to be supported by the new more generic
driver and listed as compatible but deprecated bindings in the
documentation.
After this we can start to activate the new driver with the old
systems where applicable.
As part of this enablement: make us depend on the old drivers
not being in use so we don't get a kernel with two competing
drivers.
Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging: iio: ad7606: replace range/range_available with corresponding scale
Eliminate the non-standard attributes in_voltage_range and
in_voltage_range_available. Implement in_voltage_scale_available in place
of these attributes and update the SCALE accordingly. The array
scale_avail is introduced to hold the available scale values.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Thu, 5 Jan 2017 10:24:04 +0000 (18:24 +0800)]
iio: Add gravity sensor support
Gravity sensor is a soft sensor, which derives value from
standard accelerometer device by filtering out the acceleration
which is not caused by gravity.
Gravity sensor provides a three dimensional vector indicating
the direction and magnitude of gravity. Typically, this sensor
is used to determine the device's relative orientation in space.
The units and the coordinate system is the same as the one used by
the acceleration sensor.
When a device is at rest, the output of the gravity sensor should
be identical to that of the accelerometer.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Gravity sensor and accelerometer have similar channels and
share channel usage ids. So the most of the code for accel_3d
can be reused.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Thu, 5 Jan 2017 10:24:03 +0000 (18:24 +0800)]
iio: Add channel for Gravity
Add new channel types support for gravity sensor.
Gravity sensor provides an application-level or physical collection that
identifies a device that measures exclusively the force of Earth's
gravity along any number of axes.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Sun, 18 Dec 2016 21:56:05 +0000 (22:56 +0100)]
iio: light: add driver for Capella CM3605
This adds a driver for the Capella Microsystems CM3605 Ambient
Light Sensor and proximity sensor. This is a pretty simple entirely
analog device that is interfaced with the target system using
the POUT (proximity out) and AOUT (ambient light out) signals.
The POUT signal is a simple high/low signal that indicates whether
an object is in proximity, most typically used to detect a face
in front of a mobile device. The signal requires that an infrared
LED is mounted next to the device, making IR light reflect off
the object in proximity and triggering the POUT signal. We grab
a GPIO pin to handle the POUT signal as an interrupt line and
register this as an event channel for the sensor.
Since the proximity sensor requires an IR LED, we add a LED trigger
named "cm3605" so that the infrared LED can just associate with
this trigger to be sure it is always on when the proximity sensor
needs it.
The AOUT is an analog voltage between 0 and 1550 mV that indicate
the LUX value in the ambient light: this is orthogonal to the
proximity sensor functionality. Since this analog voltage needs
to be converted into a digital value, the driver grabs an IIO
channel named "aout" associated with the device.
This patch created a combined ALS and proximity sensor driver.
The former supports raw reads of the LUX value and the latter
will generate proximity events.
To integrate this properly with Linux we also add a supply
regulator for the VDD pin (driving both functions) and add device
tree bindings to define the RSET resistor that in turn configures
the luminosity range of the ALS sensor.
Since the sensor needs to be on more or less constantly, we
restrict the power management to system suspend/resume: we
disable the IR LED and disable the regulator for VDD on suspend
and take them back up on resume.
Tests:
cd /sys/bus/iio/devices/iio:device1
cat in_illuminance_raw
304
(hold hand over sensor)
cat in_illuminance_raw
17
iio_event_monitor cm3605
Found IIO device with name cm3605 with device number 1
(hold hand over sensor)
Event: time: 2444842301447, type: proximity, channel: 0,
evtype: thresh, direction: falling
(remove hand over sensor)
Event: time: 2445583440706, type: proximity, channel: 0,
evtype: thresh, direction: rising
Cc: Capella Microsystems <capellamicro@gmail.com> Cc: Kevin Tsai <ktsai@capellamicro.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
There is one light sensor type defined in the sensor hub specification,
which has one Illuminance field. It doesn't distinguish between ambient
light sensor or color sensor. Currently it is presented as IIO_INTENSITY
channel. There are some user spaces specifically looking for IIO_LIGHT
channel.
To satisfy such user spaces this change also add a duplicate IIO_LIGHT
channel. The units of measurement of Illuminance field is Lux, so it is
still compatible to IIO ABI.
Marcin Niestroj [Mon, 12 Dec 2016 16:58:43 +0000 (17:58 +0100)]
iio: st_pressure: Export sampling frequency for lps25h and lps331ap
Both devices are using the same iio_chan_spec to define which settings
are exported with sysfs. Both are properly configured to set/get
sampling frequency for pressure and temperature. They also properly
export available sampling frequencies. The only missing thing is
sampling_frequency sysfs file, which allows to set/get this property
from userspace.
Add sampling frequency to iio channel info mask, so sampling_frequency
file is properly exported using sysfs.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marcin Niestroj [Mon, 12 Dec 2016 16:58:42 +0000 (17:58 +0100)]
iio: st_pressure: Fix data sign
Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
the pressure and temperature data is a 2's complement.
I'm sending this the slow way, as negative pressures on these are pretty
unusual and the nature of the fixing of multiple device introduction patches
will make it hard to apply to older kernels - Jonathan.
Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver") Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor") Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor") Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support") Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marcin Niestroj [Thu, 8 Dec 2016 14:22:56 +0000 (15:22 +0100)]
Documentation: DT: Add bmi160 imu binding
This adds documentation for Bosch BMI160 Inertial Measurement Unit
device-tree bindings.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: spmi-vadc: Changes to support different scaling
Several ADC channels are supported in PMIC which can be used to
measure voltage, temperature, current etc. Different scaling can be
applied on the obtained voltage to report in physical units. Scaling
functionality can be different per channel. Add scaling support per
channel. Every channel present in adc has an unique conversion formula
for obtained voltage. Add support to report in Raw as well as in
processed format. Scaling is applied when processed read is requested
and is not applied when a Raw read is requested.
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: spmi-vadc: Update function for generic voltage conversion
Several channels are supported in ADC of PMIC which can be used to
measure voltage, temperature, current etc., Hardware provides
readings for all channels in adc code. That adc code needs to be
converted to voltage. Logic for conversion of adc code to voltage
is common for all ADC channels(voltage, temperature, current
.,etc). Implement separate function for generic conversion logic.
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 4 Dec 2016 02:19:29 +0000 (21:19 -0500)]
staging: iio: isl29028: made alignment of #defines consistent
The alignment of the #defines at the top of the file is not consistent.
This changes all of the defines to use consistent alignment to improve
the code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 4 Dec 2016 02:19:27 +0000 (21:19 -0500)]
staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init()
isl29028_chip_init() contains the device driver defaults and
two I2C calls that detect the presence of the chip. This patch
moves these into isl29028_probe() so that this function can
be used by the power management runtinme in a followup patch. This
patch also renames isl29028_chip_init() to
isl29028_chip_init_and_power_on().
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 4 Dec 2016 02:19:25 +0000 (21:19 -0500)]
staging: iio: isl29028: remove nested if statements
There are two callers to the function isl29028_set_als_ir_mode() and
both instances use a nested if statement to only change the chip state
if it is not in the proper mode. This patch moves this check into the
isl29028_set_als_ir_mode() function to remove the nested if
statements.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Pan Bian [Sat, 3 Dec 2016 13:44:30 +0000 (21:44 +0800)]
staging: iio: cdc: fix improper return value
At the end of function ad7150_write_event_config(), directly returns 0.
As a result, the errors will be ignored by the callers. It may be better
to return variable "ret".
Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Pan Bian [Sat, 3 Dec 2016 09:24:17 +0000 (17:24 +0800)]
iio: light: fix improper return value
In function cm3232_reg_init(), it returns 0 even if the last call to
i2c_smbus_write_byte_data() returns a negative value (indicates error).
As a result, the return value may be inconsistent with the execution
status, and the caller of cm3232_reg_init() will not be able to detect
the error. This patch fixes the bug.
This patch fixes the following checkpatch.pl warning in ad7150.c
WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred
Occured during build.
Signed-off-by: Amit Kushwaha <kushwaha.a@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Added timestamp channel. With this change, each sample has a timestamp.
This timestamp can be from the sensor hub when present or local kernel
timestamp. HID sensors can send timestamp with input data using usage id
HID_USAGE_SENSOR_TIME_TIMESTAMP. This timestamp value is converted to
nano seconds before pushing this sample to the iio core.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Aniroop Mathur [Sat, 26 Nov 2016 03:47:26 +0000 (09:17 +0530)]
IIO: Change msleep to usleep_range for small msecs
msleep(1~20) may not do what the caller intends, and will often sleep longer.
(~20 ms actual sleep for any value given in the 1~20ms range)
This is not the desired behaviour for many cases like device resume time,
device suspend time, device enable time, data reading time, etc.
Thus, change msleep to usleep_range for precise wakeups.
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reto Schneider [Sun, 20 Nov 2016 21:11:24 +0000 (22:11 +0100)]
iio: adis1620x: Fix mixed up device descriptions
The module descriptions for the ADIS 16201, 16203 and 16209 drivers do not
match the actual function of the devices. Update them accordingly to fix
this.
Signed-off-by: Reto Schneider <code@reto-schneider.ch> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Shrirang Bagul [Thu, 24 Nov 2016 05:33:45 +0000 (13:33 +0800)]
iio: st_pressure: Support i2c probe using acpi
Compatible strings are not available on ACPI based systems. This patch adds
support to use DSDT information read from platform BIOS instead for probing
st pressure sensors.
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The visorchipset.c functionality was moved into the visorbus driver
previously. This patch updates the s-Par firmware postcode values to
reflect this status.