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>
Erik Arfvidson [Mon, 21 Nov 2016 17:15:41 +0000 (12:15 -0500)]
staging: unisys: include: fix pound defines
The purpose of this patch is to add style consistency and
beautify the entire file. This patch removes unused pound defines
and cleans up spacing and tabbing of pound defines.
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The purpose of this patch is to add style consistency and beautify the
entire file.
Grammar:
Uppercased beginning of new sentences/paragraphs
Missing ' and .
Fixed several comments using prefix phrase "as is in" to "as in"
Standard Grammar
Comments:
Fixed comments to follow the multiline styling
All comments are now either same line or above variable/definitions
Removed nested slash-star comments
Removed a random comment left by accident
Aligned star comments
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jason Cooper <jason@lakedaemon.net Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>