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.
The dgnc driver has no business creating "custom" sysfs files just for a
single tty driver. Combined with the odd way they are created, it's
just a mess, so remove them entirely as I am tired of tripping over them
when doing driver core changes.
James Simmons [Wed, 30 Nov 2016 01:33:33 +0000 (20:33 -0500)]
staging: lustre: libcfs: repair improper unlikely test
The scripts to replace NULL test got confused with the
macro parenthesis so the unlikely test in libcfs_private.h
ended up incorrect. This fixes this error.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fan Yong [Wed, 23 Nov 2016 23:01:20 +0000 (18:01 -0500)]
staging: lustre: obd: reserve connection flag OBD_CONNECT_FLAGS2
This is a feature for the client and server to use
obd_connect_flags2 to communicate future feature flags. The
client should set this flag whenever any flags in that field
are requested, and the server should mask unsupported features
from this field (assuming it understands OBD_CONNECT_FLAGS2).
When checking if an OBD_CONNECT2_xxxx feature is supported,
the client/server needs to firstly check if OBD_CONNECT_FLAGS2
is supported, since this field is also beyond the end of the
old obd_connect_data.
Land the connection flags to upstream client earlier for reserving
the slot to avoid potential conflict with others.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7543
Reviewed-on: http://review.whamcloud.com/17647 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fan Yong [Wed, 23 Nov 2016 23:01:17 +0000 (18:01 -0500)]
staging: lustre: obd: reserve connection flag OBD_CONNECT_SUBTREE
The connection flag OBD_CONNECT_SUBTREE will be used for the
following the patch: LU-28 mounting of filesystem from MDS
http://review.whamcloud.com/5007
Land the connection flags to master earlier for reserving the
slot to avoid potential conflict with others.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7543
Reviewed-on: http://review.whamcloud.com/17644 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Thu, 24 Nov 2016 11:10:39 +0000 (14:10 +0300)]
staging: lustre: lnet: memory corruption in selftest
We want sizeof(struct lstcon_node) but instead we're getting the sizeof
a pointer.
Fixes: 8d78f0f2ba76 ("staging: lustre: lnet: cleanup some of the > 80 line issues") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-for-4.10d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Fourth set of IIO new device support, features and cleaups for the 4.10 cycle.
Probably the final set before the merge window unless things get significantly
delayed.
New device support
* STM32 ADC core
- new driver. Interesting device with up to 3 ADCs with complex triggering
options that will follow later. Note split into an 'mfd like' core that
handles the interrupt sharing etc between the various instances present and
a per ADC section that is instantiated as many times as needed.
- device tree bindings.
Cleanups and minor fixes
* st_accel
- inline per sensor data as the defines don't add any meaning and make it
much harder to check if a given sensor has the right values.
* hid-magnetometer
- sort out the associations of the associated attributes with the two types.
Ooi, Joyce [Wed, 16 Nov 2016 09:43:09 +0000 (17:43 +0800)]
iio: magnetometer: separate the values of attributes based on their usage type for HID compass sensor
There are 2 usage types (Magnetic Flux and Heading data field) for HID
compass sensor, thus the values of offset, scale, and sensitivity should
be separated according to their respective usage type. The changes made
are as below:
1. Hysteresis: A struct hid_sensor_common rot_attributes is created in
struct magn_3d_state to contain the sensitivity for IIO_ROT.
2. Scale: scale_pre_decml and scale_post_decml are separated for IIO_MAGN
and IIO_ROT.
3. Offset: Same as scale, value_offset is separated for IIO_MAGN and
IIO_ROT.
For sensitivity, HID_USAGE_SENSOR_ORIENT_MAGN_FLUX and
HID_USAGE_SENSOR_ORIENT_MAGN_HEADING are used for sensivitity fields based
on the HID Sensor Usages specifications. Hence, these changes are added on
the sensitivity field.
Dan Carpenter [Thu, 24 Nov 2016 13:38:07 +0000 (16:38 +0300)]
iio: tsl2583: make array large enough
This array is supposed to have 10 elements. Smatch complains that with
the current code we can have n == max_ints and read beyond the end of
the array.
Fixes: ac4f6eee8fe8 ("staging: iio: TAOS tsl258x: Device driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
David Kershner [Mon, 21 Nov 2016 17:15:52 +0000 (12:15 -0500)]
staging: unisys: visorbus: return EAGAIN when empty
It really isn't an error when you call visorchannel_signalremove and
there isn't anything in the queue. Just means that the IOSP didn't
process anything since the last time you checked. Just inform the
caller that it is empty by returning -EAGAIN.
Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>