Brian Masney [Fri, 4 May 2018 02:53:16 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: add device ids for code readability
This patch adds the device IDs to the device_channel_config array to
improve code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:14 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: correct integration time and lux equation
The integration_time sysfs attribute did not report the correct
time. Changing the integration time would cause the reported lux to
change wildly. Once the integration time was corrected, all of the
equations, and lux tables needed to be corrected to match what the
data sheets expected. This patch corrects all of this, and adds some
more comments about how some of the constants were derived. Here are
the results from testing a TSL2772 hooked up to a Raspberry Pi 2:
# cat in_intensity0_integration_time
0.002730
# watch -n .1 cat in_illuminance0_input
; Lux hovers around 55
# echo 0.65 > in_intensity0_integration_time
# cat in_intensity0_integration_time
0.649740
# watch -n .1 cat in_illuminance0_input
; Lux hovers around 55 with noticeable lag to lux changes in watch
; process.
; Now test the ALS calibration routine.
# cat in_intensity0_calibbias
1000
# cat in_illuminance0_target_input
150
# echo 1 > in_illuminance0_calibrate
# cat in_intensity0_calibbias
2777
# watch -n .1 cat in_illuminance0_input
; Lux now hovers around 150-155
The returned lux values were tested on a TSL2772 in various lighting
conditions and the results are within the lux ranges described at
https://en.wikipedia.org/wiki/Lux.
The driver was primarily tested using a TSL2772, however some quick tests
were also ran against the devices TSL2771, TSL2572, and TMD2772.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:13 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: use IIO_CONST_ATTR for calibscale_available
The in_intensity0_calibscale_available sysfs attribute has code that
checks the device type to determine which calibration scales are
available. This check is not necessary since all of the supported
ALS device types use the scales 1 8 16 120. This patch converts the
sysfs attribute to use IIO_CONST_ATTR. The following device datasheets
were checked: tsl2571, tsl2771, tmd2771, tsl2572, tsl2772, tmd2772.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:12 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: move calibscale_available attribute to IIO_INTENSITY channel
The calibscale_available attribute is currently associated with the
IIO_LIGHT channel but should be associated with the IIO_INTENSITY
channel. This patch corrects that association and it also corrects
lines that were unnecessarily split for the
in_intensity0_integration_time sysfs attribute.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:11 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: don't setup event handlers if interrupts are not configured
The driver would expose to userspace the events directory even if the
interrupts were not configured. This patch changes the driver so that
the events directory is not exposed to user space if interrupts are
not configured. This patch also corrects the indentation of the
chan_table_elements and info structure members.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:10 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: add range checking to three sysfs attributes
The sysfs attributes in_illuminance0_target_input,
in_illuminance0_calibrate, and in_proximity0_calibrate did not have
proper range checking in place so this patch adds the correct range
checks.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Fri, 4 May 2018 02:53:09 +0000 (22:53 -0400)]
staging: iio: tsl2x7x: use GPL-2.0+ SPDX license identifier
The summary text for the GPL is not needed since the SPDX identifier
is a legally binding shorthand that can be used instead.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Sean Nyekjaer [Tue, 1 May 2018 08:15:54 +0000 (10:15 +0200)]
iio: ti-
dac5571: Add DT binding documentation
Adding binding documentation for Texas Instruments
DAC5571 Family
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Sean Nyekjaer [Tue, 1 May 2018 08:15:53 +0000 (10:15 +0200)]
iio: dac: add TI
DAC5571 family support
This patch adds support for the Texas Intruments
DAC5571 Family.
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Martin Kelly [Tue, 1 May 2018 17:56:41 +0000 (10:56 -0700)]
iio: imu: inv_mpu6050: minor wording fixes
Just some minor grammar/spelling fixes of things I noticed while reading
the code.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 30 Apr 2018 10:14:11 +0000 (12:14 +0200)]
iio: imu: inv_mpu6050: fix user_ctrl register overwritten
When in spi mode, we are setting i2c disable bit in user_ctrl
register. But the register is overwritten after when turning fifo
on. So save user_ctrl init value and always use it when updating
the register.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 30 Apr 2018 10:14:10 +0000 (12:14 +0200)]
iio: imu: inv_mpu6050: skip first sample when gyro is on
Implement generic skip first samples mechanism and use it to
filter out first sample when gyro is on.
The problem for these chips is that the first sample of the gyro
is out of specs, because gyro is not completely stabilized. To
ensure all data are within sensor specs, we just skip the first
sample when turning gyro on.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 30 Apr 2018 10:14:09 +0000 (12:14 +0200)]
iio: imu: inv_mpu6050: fix possible deadlock between mutex and iio
Detected by kernel circular locking dependency checker.
We are locking iio mutex (iio_device_claim_direct_mode) after
locking our internal mutex. But when the buffer starts, iio first
locks its mutex and then we lock our internal one.
To avoid possible deadlock, we need to use the same order
everwhere. So we change the ordering by locking first iio mutex,
then our internal mutex.
Fixes: 68cd6e5b206b ("iio: imu: inv_mpu6050: fix lock issues by using our own mutex")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 30 Apr 2018 10:14:08 +0000 (12:14 +0200)]
iio: imu: inv_mpu6050: use i2c mux only for chip with i2c aux bus
icm20608 does not have i2c aux bus, so it does not make sense to
allocate an i2c mux for this chip.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Sun, 22 Apr 2018 22:04:10 +0000 (00:04 +0200)]
staging: iio: Documentation: Add missing sysfs docs for angle channel
The iio resolver drivers in staging use angle channels. This patch
add missing documentation for this type of channel.
As was discussed in [1], radians is chosen as the unit, to match the
unit of angular velocity.
[1] https://marc.info/?l=linux-driver-devel&m=
152190078308330&w=2
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Sun, 22 Apr 2018 22:03:03 +0000 (00:03 +0200)]
staging: iio: ad2s1200: Improve readability with be16_to_cpup
The manual states that the data is contained in the upper 12 bits
of the 16 bits read by spi. The code that extracts these 12 bits
is correct for both be and le machines, but this is not clear
from a first glance.
To improve readability the relevant expressions are replaced
with equivalent expressions that use be16_to_cpup.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Mon, 23 Apr 2018 21:08:09 +0000 (23:08 +0200)]
iio: afe: rescale: new driver
If an ADC channel measures the midpoint of a voltage divider, the
interesting voltage is often the voltage over the full resistance.
E.g. if the full voltage is too big for the ADC to handle.
Likewise, if an ADC channel measures the voltage across a shunt
resistor, with or without amplification, the interesting value is
often the current through the resistor.
This driver solves these problems by allowing to linearly scale a channel
and/or by allowing changes to the type of the channel.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Mon, 23 Apr 2018 21:08:08 +0000 (23:08 +0200)]
dt-bindings: iio: afe: add binding for current-sense-amplifier
Similar to current sense shunts, but an amplifier enables the use
of a smaller sense resistance.
Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Mon, 23 Apr 2018 21:08:07 +0000 (23:08 +0200)]
dt-bindings: iio: afe: add binding for voltage-divider
An ADC is often used to measure other quantities indirectly. This
binding describe one cases, a "big" voltage measured with the help
of a voltage divider.
Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Mon, 23 Apr 2018 21:08:06 +0000 (23:08 +0200)]
dt-bindings: iio: afe: add binding for current-sense-shunt
An ADC is often used to measure other quantities indirectly. This
binding describe one cases, a current through a shunt resistor
measured by the voltage over it.
Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Charles Keepax [Tue, 24 Apr 2018 15:05:51 +0000 (16:05 +0100)]
iio: accel: bcm150: Remove handling for regmap raw_read_max
The regmap core now handles splitting up transactions according to
max_raw_read, so this code is no longer required in client drivers.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 23 Apr 2018 10:33:33 +0000 (12:33 +0200)]
iio: imu: inv_mpu6050: clean read channel data error path
Delete the useless ored result and give a second chance to turn
the chip back off at the end.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 23 Apr 2018 10:33:32 +0000 (12:33 +0200)]
iio: imu: inv_mpu6050: clean read raw by factorizing out raw data
Factorize reading channel data in its own function.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 23 Apr 2018 10:33:31 +0000 (12:33 +0200)]
iio: imu: inv_mpu6050: use devm_* at init and delete remove
Use devm_* for iio_triggered_buffer_setup, iio_device_register,
iio_trigger_register. Delete unneeded inv_mpu6050_remove_trigger,
inv_mpu_core_remove, and inv_mpu_remove for spi driver.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 23 Apr 2018 10:33:30 +0000 (12:33 +0200)]
iio: imu: inv_mpu6050: fix error path not turning chip back off
Some functions are turning the chip on and not back off in error
path. With set_power function using a reference counter that
would keep the chip on forever.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabrice Gasnier [Fri, 23 Feb 2018 12:51:01 +0000 (13:51 +0100)]
iio: adc: stm32-dfsdm: add check on spi-max-frequency
spi-max-frequency is requested for SPI master mode (only), to tune output
clock. It may happen requested frequency isn't reachable.
Add explicit check, so probe fails with error in this case. Otherwise,
output clock may simply be silently turned off (conversions fail).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabrice Gasnier [Fri, 23 Feb 2018 12:51:00 +0000 (13:51 +0100)]
iio: adc: stm32-dfsdm: add check on max filter id
reg property should be checked against number of available filters.
BTW, dfsdm->num_fls wasn't used. But it can be used for this purpose.
This prevents using data out of allocated dfsdm->fl_list array.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabrice Gasnier [Fri, 23 Feb 2018 12:50:59 +0000 (13:50 +0100)]
iio: adc: stm32-dfsdm: misc style improvements and fixes
Misc fixes & style improvements:
- checkpatch warns about line over 80 characters.
- remove extra spaces and a blank line (e.g. checkpatch --strict)
- remove bad error message always printed in probe routine.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Fri, 20 Apr 2018 19:29:52 +0000 (21:29 +0200)]
staging: iio: ad2s1200: Add blank lines
Add blank lines to improve readability.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Fri, 20 Apr 2018 19:29:08 +0000 (21:29 +0200)]
staging: iio: ad2s1200: Reverse Christmas tree ordering
Reorders the variable declarations to prefer a reverse Christmas tree
order to improve readability.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Fri, 20 Apr 2018 19:28:52 +0000 (21:28 +0200)]
staging: iio: ad2s1200: Sort includes alphabetically
This patches sorts all the includes in alphabetic order.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Veenstra [Fri, 20 Apr 2018 19:28:32 +0000 (21:28 +0200)]
staging: iio: ad2s1200: Remove unneeded include
This patches removes unneeded slab.h header.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:53 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: rename prox_config to als_prox_config
The configuration register on the device is represented with the
prox_config member on the tsl2x7x_settings structure. According to the
TSL2772 data sheet, this register can hold: 1) the proximity drive
level, 2) ALS/Proximity long wait, and 3) the ALS gain level. This
patch renames prox_config to als_prox_config since ALS settings can
be stored here as well.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:52 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: various comment cleanups
This patch removes several unnecessary comments, changes some comments
so that the use as much of the allowable 80 characters as possible, adds
the proper whitespace, removes some structure members from the kernel
docs that are no longer present, and improves the existing kernel doc
information for some existing structure members.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:51 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: use device defaults for als_time, prox_time and wait_time
This patch changes the defaults of the als_time, prox_time and
wait_time to match the defaults according to the TSL2772 datasheet.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:50 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: rename prx to prox for consistency
The driver mostly uses the 'prox' naming convention for most of the
proximity settings, however prx_time and tsl2x7x_prx_gain was present.
This patch renames these to prox_time and tsl2x7x_prox_gain for
consistency with everything else in the driver.
The kernel documentation for prx_gain is corrected to prox_gain so that
it matches what is actually in the structure.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:49 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: move power and diode settings into header file
The power and diode defines are needed for the platform data so this
patch moves the defines out of the .c file and into the header file. A
comment for the diode is also cleaned up while this code is touched.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:47 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: simplify device id verification
This patch renames tsl2x7x_device_id() to tsl2x7x_device_id_verif(),
removes the unnecessary pointer on the id parameter, and only calls
the verification function once.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:46 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: simplify tsl2x7x_write_interrupt_config return
tsl2x7x_write_interrupt_config() has an unnecessary return value check
at the end of the function. This patch changes the function to just
return the value from the call to tsl2x7x_invoke_change().
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:45 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: remove unnecessary chip status checks in suspend/resume
tsl2x7x_suspend() and tsl2x7x_resume() both check to see what the
current chip status is. These checks are not necessary so this patch
removes those checks.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:44 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: simplify tsl2x7x_clear_interrupts function
tsl2x7x_clear_interrupts() takes a reg argument but there are only
two callers to this function and both callers pass the same value.
Since this function was introduced, interrupts are now working
properly for this driver, and several unnecessary calls to
tsl2x7x_clear_interrupts() were removed. This patch removes the
tsl2x7x_clear_interrupts() function and replaces the two callers
with the i2c_smbus_write_byte() call instead.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:43 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: don't return error in IRQ handler
tsl2x7x_event_handler() could return an error and this could cause the
interrupt to remain masked. We shouldn't return an error in the
interrupt handler so this patch always returns IRQ_HANDLED. An error
will be logged if one occurs.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 21 Apr 2018 00:41:41 +0000 (20:41 -0400)]
staging: iio: tsl2x7x: move integration_time* attributes to IIO_INTENSITY channel
The integration_time* attributes are currently associated with the
IIO_LIGHT channel but should be associated with the IIO_INTENSITY
channel. Directory listing of the sysfs attributes for a TSL2772
with this patch applied:
dev
events
in_illuminance0_calibrate
in_illuminance0_calibscale_available
in_illuminance0_input
in_illuminance0_lux_table
in_illuminance0_target_input
in_intensity0_calibbias
in_intensity0_calibscale
in_intensity0_integration_time
in_intensity0_integration_time_available
in_intensity0_raw
in_intensity1_raw
in_proximity0_calibrate
in_proximity0_calibscale
in_proximity0_calibscale_available
in_proximity0_raw
name
of_node
power
subsystem
uevent
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Wolfram Sang [Thu, 19 Apr 2018 14:06:18 +0000 (16:06 +0200)]
staging: iio: adc: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Wolfram Sang [Thu, 19 Apr 2018 14:05:49 +0000 (16:05 +0200)]
iio: common: hid-sensors: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Wolfram Sang [Thu, 19 Apr 2018 14:05:48 +0000 (16:05 +0200)]
iio: common: cros_ec_sensors: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hans de Goede [Wed, 18 Apr 2018 12:33:18 +0000 (14:33 +0200)]
iio: accel: st_accel: Add support for the SMO8840 ACPI id
The Lenovo Ideapad Miix 320 uses an st accelerometer with an ACPI id
of SMO8840, add support for this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Martin Kelly [Fri, 20 Apr 2018 16:54:01 +0000 (09:54 -0700)]
dt-bindings: iio:imu:mpu6050: support more interrupt types
Document that the hardware supports falling edge, rising edge, level
low, and level high interrupt types, rather than just rising edge.
The language used is the same as that in st_lsm6dsx.txt.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Martin Kelly [Fri, 20 Apr 2018 16:54:00 +0000 (09:54 -0700)]
iio:imu: inv_mpu6050: support more interrupt types
Currently, we support only rising edge interrupts, and in fact we assume
that the interrupt we're given is rising edge (and things won't work if
it's not). However, the device supports rising edge, falling edge, level
low, and level high interrupts.
Empirically, on my system, switching to level interrupts has fixed a
problem I had with significant (~40%) interrupt loss with edge
interrupts. This issue is likely related to the SoC I'm using (Allwinner
H3), but being able to switch the interrupt type is still a very useful
workaround.
I tested this with each interrupt type and verified correct behavior in
a logic analyzer.
Add support for these interrupt types while also eliminating the error
case of the device tree and driver using different interrupt types.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Tue, 17 Apr 2018 07:19:40 +0000 (09:19 +0200)]
iio: imu: inv_mpu6050: use set_power_itg function in i2c mux
Set power function is rewritten manually inside i2c mux select.
Better use the already identical existing function.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Tue, 17 Apr 2018 07:19:39 +0000 (09:19 +0200)]
iio: imu: inv_mpu6050: clean set_power_itg and fix usage
Rewrite set_power_itg. Failing when turning power off is
no more decreasing the counter now and sleeping only happens
when effectively turning the chip on. Fix also usage in init
function (setting power on one time is sufficient to ensure
chip is effectively on).
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabian Mewes [Mon, 16 Apr 2018 15:34:06 +0000 (17:34 +0200)]
dt-bindings: iio: adc: mcp320x: Use vendor prefix compatible strings
Update the example to use the compatible string including the
vendor prefix instead of the ones deprecated in
3a872138e4b.
Signed-off-by: Fabian Mewes <architekt@coding4coffee.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:40 +0000 (13:36 -0300)]
staging: iio: ad7746: Fix bound checkings
Also remove unnecessary parenthesis
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Christophe JAILLET [Sun, 8 Apr 2018 19:44:15 +0000 (21:44 +0200)]
iio: sca3000: Handle errors returned by 'sca3000_configure_ring()' in 'sca3000_probe()'
'sca3000_configure_ring()' can fail, so test its return value and
propagate it if needed.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Christophe JAILLET [Sun, 8 Apr 2018 19:44:01 +0000 (21:44 +0200)]
iio: sca3000: Fix an error handling path in 'sca3000_probe()'
Use 'devm_iio_kfifo_allocate()' instead of 'iio_kfifo_allocate()' in order
to simplify code and avoid a memory leak in an error path in
'sca3000_probe()'. A call to 'sca3000_unconfigure_ring()' was missing.
Sent via the next merge window as unimportant bug and there are
other patches dependent on it.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:53:39 +0000 (14:53 +0300)]
iio:dac:ad5686: Add AD5671R/75R/94/94R/95R/96/96R support
The AD5694/AD5694R/AD5695R/AD5696/AD5696R are a family of 4 channel DACs
with 12-bit, 14-bit and 16-bit precision respectively. The devices have
either no built-in reference, or built-in 2.5V reference.
The AD5671R/AD5675R are similar, except that they have 8 instead of 4
channels.
These devices are similar to AD5672R/AD5676/AD5676R and
AD5684/AD5684R/AD5684/AD5685R/AD5686/AD5686R, except that they use i2c
instead of spi.
Datasheets:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5671R_5675R.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5696R_5695R_5694R.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:53:17 +0000 (14:53 +0300)]
iio:dac:ad5686: Refactor the driver
In this patch restructures the existing ad5686 driver by adding a module
for SPI and a header file, while the baseline module deals with the
chip-logic.
This is a necessary step, as this driver should support in the future
similar devices which differ only in the type of interface used (I2C
instead of SPI).
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:53:01 +0000 (14:53 +0300)]
iio:dac:ad5686: Add AD5672R/76/76R/84R/86R support
The AD5684R/AD5686R are a family of 4 channel DACs with 12-bit, 14-bit and
16-bit precision respectively. The devices come either with a built-in
reference or no built-in reference.
The AD5672R/AD5676/AD5676R are similar, except that they have 8 channels
instead of 4.
Datasheets:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5672R_5676R.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5686R_5685R_5684R.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:52:48 +0000 (14:52 +0300)]
iio:dac:ad5686: Add support for AD5685R
This driver acctually supports the AD5685R device and NOT the AD5685, which
does not exist. Maintain old id entry in case we have devicetrees
out there which are using the wrong name.
More information can be found in the datasheet:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5686_5684.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:52:31 +0000 (14:52 +0300)]
iio:dac:ad5686: Add support for various number of channels
This patch adds a new num_channels attribute as part of the
ad5686_chip_info struct which replaces the AD5686_DAC_CHANNELS define. This
is a necessary step, since this driver should support similar devices which
differ only in the number of channels.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:52:12 +0000 (14:52 +0300)]
iio:dac:ad5686: Change license description
Add GPLv2+ SPDX identifier and remove license notice to keep the whole
purpose of using an SPDx id.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stefan Popa [Wed, 11 Apr 2018 11:51:51 +0000 (14:51 +0300)]
iio:dac:ad5686: Style fixes no functional changes
This patch fixes some indentation issues and does not modify the
functionality of the driver.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Douglas Fischer [Mon, 2 Apr 2018 22:42:00 +0000 (18:42 -0400)]
iio: imu: Add mpu9255 support to mpu6050 driver
Added support for the mpu9255 IMU to the mpu6050 driver. The
register map is the same as the other chips; the only driver
difference is the compatible string and the WHOAMI register
value.
Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Matt Ranostay [Tue, 10 Apr 2018 06:18:22 +0000 (23:18 -0700)]
iio: chemical: atlas-ph-sensor: use msleep() for long uncritical delays
usleep_range() uses hrtimers and provides no advantage over msleep()
for larger delays.
Cc: Nicholas Mc Guire <hofrat@osadl.org>
Link: http://lkml.org/lkml/2017/1/11/377
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Wed, 11 Apr 2018 12:49:15 +0000 (14:49 +0200)]
iio: potentiometer: mcp4531: switch to using .probe_new
Use the new probe style for i2c drivers.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Rosin [Wed, 11 Apr 2018 12:49:14 +0000 (14:49 +0200)]
iio: potentiometer: mcp4018: switch to using .probe_new
Use the new probe style for i2c drivers.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Fri, 13 Apr 2018 08:25:06 +0000 (10:25 +0200)]
iio: imu: inv_mpu6050: do not flush fifo when iio buffer is full
There is no need to flush fifo and loose all data when the iio
buffer is full. Just drop the data by ignoring the error as
commonly done in other drivers.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Reviewed-by: Martin Kelly <martin@martingkelly.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:43 +0000 (13:36 -0300)]
staging: iio: ad7746: Reorder variable declarations
Reorder some variable declarations in an inverse-pyramid scheme.
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:42 +0000 (13:36 -0300)]
staging: iio: ad7746: Reorder includes alphabetically
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:41 +0000 (13:36 -0300)]
staging: iio: ad7746: Fix multiple line dereference
Clear checkpatch.pl WARNING about multiple line derefence but creates a
new one of line over 80 characters. In my opinion, it improves
readability.
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:39 +0000 (13:36 -0300)]
staging: iio: ad7746: Adjust arguments to match open parenthesis
Clear a couple more checkpatch.pl CHECKS.
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hernán Gonzalez [Fri, 13 Apr 2018 16:36:38 +0000 (13:36 -0300)]
staging: iio: ad7746: Automatically swap values in readings/writings
Data to read or write was being handled with the swab16() macro instead
of using i2c_smbus_{read,write}_swapped.
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Fri, 30 Mar 2018 20:33:51 +0000 (22:33 +0200)]
Documentation: dt: iio: imu: st_lsm6dsx: add ism330dlc sensor device binding
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Fri, 30 Mar 2018 20:33:50 +0000 (22:33 +0200)]
iio: imu: st_lsm6dsx: add support to ism330dlc
Add support to STM ISM330DLC 6-axis (acc + gyro) Mems sensor
http://www.st.com/resource/en/datasheet/ism330dlc.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Fri, 30 Mar 2018 18:43:22 +0000 (20:43 +0200)]
iio: imu: st_lsm6dsx: fix FIFO threshold mask for LSM6DSM/LSM6DSL
According to the latest datasheet, LSM6DSM and LSM6DSL imu sensors
export GENMASK(10, 0) for FIFO threshold mask definition. Despite
that is not an actual issue since write on fifo_th register is protected
by max_fifo_size value, fix fifo_th and fifo_diff register definitions
Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:22:51 +0000 (14:52 +0530)]
Staging: iio: adis16209: Move adis16209 driver out of staging
Move the adis16209 driver out of staging directory and merge to the
mainline IIO subsystem.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:21:19 +0000 (14:51 +0530)]
Staging: iio: adis16209: Use GENMASK
Use GENMASK to improve readability and remove the local
variables used to store intermediate data.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:19:22 +0000 (14:49 +0530)]
Staging: iio: adis16209: Remove unused headers
Remove few unused header files since the adis core handles
the sysfs and buffer support.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:14:42 +0000 (14:44 +0530)]
Staging: iio: adis16209: Add a blank line after return statements
Add a blank line after return statements to improve the code
readability.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:13:23 +0000 (14:43 +0530)]
Staging: iio: adis16209: Prefer reverse christmas tree ordering
Prefer reverse christmas tree ordering of declarations to
improve readability.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Shreeya Patel [Thu, 29 Mar 2018 09:12:02 +0000 (14:42 +0530)]
Staging: iio: adis16209: Indent the field definitions
Have indentation in field definitions to make them
clearly different from the register addresses.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jean-Baptiste Maneyrol [Mon, 26 Mar 2018 14:01:20 +0000 (14:01 +0000)]
iio: imu: inv_mpu6050: clean double declaration of set_power_itg
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Xingyu Chen [Mon, 26 Mar 2018 08:46:29 +0000 (16:46 +0800)]
iio: adc: meson-saradc: add support for Meson AXG
Add the SAR ADC driver for the Amlogic Meson-AXG SoC.
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Xingyu Chen [Mon, 26 Mar 2018 08:46:28 +0000 (16:46 +0800)]
dt-bindings: iio: adc: document the Meson AXG support
Update the documentation to expicitly support the Meson-AXG SoC.
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Yixun Lan [Mon, 26 Mar 2018 08:46:27 +0000 (16:46 +0800)]
iio: adc: meson-saradc: squash and share the common adc platform data
Extract and promote common adc platform data into a new structure,
to make it better share the info between several SoCs,
this will avoid duplicating the code all over the place,
Save a few memory and make the code more maintainable.
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 24 Mar 2018 20:05:54 +0000 (16:05 -0400)]
staging: iio: tsl2x7x: use either direction for IIO_EV_INFO_{ENABLE,PERIOD}
The events IIO_EV_INFO_VALUE and IIO_EV_INFO_ENABLE currently have a
falling and rising direction configured. There does not need to be a
separate distinction so this patch changes these to use the
either direction. Directory listing of event sysfs attributes for a
TSL2772 with this patch applied:
in_intensity0_thresh_either_en
in_intensity0_thresh_either_period
in_intensity0_thresh_falling_value
in_intensity0_thresh_rising_value
in_proximity0_thresh_either_en
in_proximity0_thresh_either_period
in_proximity0_thresh_falling_value
in_proximity0_thresh_rising_value
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Sat, 24 Mar 2018 20:05:52 +0000 (16:05 -0400)]
staging: iio: tsl2x7x: use auto increment I2C protocol
The hardware supports 16-bit ALS and proximity readings, however the
datasheet recommends using the I2C auto increment protocol so that the
correct high and low bytes are read even if the integration cycle ends
between reading the lower and upper registers.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Himanshu Jha [Thu, 22 Mar 2018 19:12:45 +0000 (00:42 +0530)]
Staging: iio: accel: adis16201: Move adis16201 driver out of staging
Move adis16201 driver out of staging and merge into mainline
IIO subsystem.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Himanshu Jha [Thu, 22 Mar 2018 19:12:44 +0000 (00:42 +0530)]
Staging: iio: accel: adis16201: Fix 80 character line limit
Split the line over 80 characters limit to fix checkpatch
warning.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Himanshu Jha [Thu, 22 Mar 2018 19:12:43 +0000 (00:42 +0530)]
Staging: iio: accel: adis16201: Use GENMASK
Use GENMASK to improve readability and remove the local variables used to
store intermediate data.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Himanshu Jha [Thu, 22 Mar 2018 19:12:42 +0000 (00:42 +0530)]
Staging: iio: accel: adis16201: Remove unused headers
Remove few unused headers files since the adis core handles the buffer and
sysfs support.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:12 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: add copyright
Add Brian Masney's copyright and to the list of module authors for all
of the staging cleanups. This patch also update's Jon Brenner's current
work email address since AMS now owns TAOS.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:11 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: put local variables in reverse Christmas tree order
This patch ensures that all of the local variable declarations are in
reverse Christmas tree order where possible to increase code
readability.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:10 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: remove ch0 and ch1 variables from tsl2x7x_get_lux()
Remove the ch0 and ch1 variables from tsl2x7x_get_lux() and
write those values directly into the chip->als_cur_info.als_ch0
and chip->als_cur_info.als_ch01 variables.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:09 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: remove unused variables from tsl2x7x_get_lux()
tsl2x7x_get_lux() has a ch0lux and ch1lux variables that are not used
so this patch removes them.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:08 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: split out als and prox persistence settings
The struct tsl2x7x_settings contained a persistence member that
contained both the ALS and proximity persistence fields. This patch
splits this out into two separate fields so that the bitmasks in
several parts of the code are no longer necessary.
The default persistence settings are also changed by this patch from:
- Proximity: 0 (Every proximity cycle generates an interrupt)
- ALS: 255 (60 consecutive values out of range)
to something a little more reasonable based on my testing:
- Proximity: 1 (1 proximity value out of range)
- ALS: 1 (1 value outside of threshold range)
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:07 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: make logging consistent and correct newlines
This patch updates all of the logging commands so that they are
consistent with the other messages, includes __func__ in the message,
and all of the messages include newlines. This patch also removes some
debug log messages.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:06 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: split out als and prox interrupt settings
The struct tsl2x7x_settings contained an interrupts_en member that was
a bitmask for which interrupts are enabled. This required having
bitmasks in several parts of the code. This patch splits this field
out into two booleans to remove most of the bitmasks in the code.
This patch also fixes a bug where if an interrupt pin was configured,
but proximity interrupts were disabled, then the proximity value could
not be polled.
This patch also removes an unnecessary second call to writing the
control register in tsl2x7x_chip_on().
Driver tested using a TSL2772 hooked up to a Raspberry Pi 2.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:05 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: simplify tsl2x7x_prox_cal()
tsl2x7x_prox_cal() would set the interrupt flag, and reset the device to
start doing the calibration routine. However, this did not actually
affect the readings since they are polled. This patch drops the interrupt
code.
This patch also drops the function tsl2x7x_prox_calculate() and removes
support for the standard deviation and min sample since those values
were not used.
Driver was tested using a TSL2772 hooked up to a Raspberry Pi 2. I
performed the following testing at various distances:
- Put hand in front of sensor and keep the sensor and hand stationary.
- Perform calibration routine.
- Run iio_event_monitor.
- Verify that a proximity event is triggered when my hand comes
anywhere between the sensor and where I performed the calibration
routine.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Brian Masney [Wed, 21 Mar 2018 10:29:04 +0000 (06:29 -0400)]
staging: iio: tsl2x7x: no need to clear interrupt flag when getting lux
tsl2x7x_get_lux() does not need to clear the interrupt flag when
querying the ALS. The interrupt flag is cleared in
tsl2x7x_event_handler(). This patches removes the unnecessary code.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>