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>
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>
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>
It is meant to be long and is only added to an s64.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Rama Krishna Phani A <rphani@codeaurora.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
This is the IIO driver for AVIA HX711 ADC which is mostly used in weighting
cells.
The protocol is quite simple and using GPIOs:
One GPIO is used as clock (SCK) while another GPIO is read (DOUT)
The raw value read from the chip is delivered.
To get a weight one needs to subtract the zero offset and scale it.
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
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>
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>
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>
As a precursor to splitting buffer.h, lets make sure all drivers
include the relevant headers rather than relying on picking them
up from kfifo_buf.h.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Ancient legacy of me doing it wrong which it is nice to clear
up whilst we are here.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
This is a necessary step in taking the buffer implementation
opaque.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Nothing outside of indiustrialio-buffer.c should be using this.
Requires a large amount of juggling of functions to avoid a
forward definition.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
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>
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>
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>
* 104-quad-8
- Fix selecting wrong register when the index control register is desired.
- Fix an off by one error when addressing the input/output control register.
- Fix inverted logic on the active high / low control
* bmi160
- Sleep for worst case rather than best case amount of time after cmd
execution begins.
* max44000
- typo fix in illuminance_integration_time_available listing.
* st-sensors
- Fix channel data passing. This one took a while to get tested on 24bit
parts. Definitely one for stable asap as the bug broke quite a few parts.
- lis3lv02 needs a data alignment bit set and the scaling was wrong.
* ti_am335x
- depend on HAS_DMA
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlhnxPERHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0Fojkwg//TD9jlh6x/Xt7qi0EgC1c8Ie0Dr6iUsQr
gYgvVMtIsjSlThXGtLWxjDLzLeW1DUpxwjy9Kqnwt5onBgBnQj5PAL/lptH7/e6z
hxj6lXvz5j1pcjjyXzhMa4JPIZJUU75Jj4airhGoHdvTFQDzqKr9GpLKUnrf4lwt
HWFtCcT90ckhg/PTTaxfIhI4gEHBHoVx9h1/3Tn4VImhE693rLPSs1nS7+hEQIn2
LZbCMAtxMh3qcCIK9fYrri3e+28KJ7veiWE8mYynxBd6Wa6OGq/D316Ml616mRgZ
3SpyDWy05YtM4nVNi1kFwKTHb3v6Ljeyno0lmP0joJlIGLwHJS1qDGL0Wps6RI87
utrfcZKOI2hcoFm49OMYdV3MJ18umGo0asOFMlH6u0RaLXXAz7hN1l9nyB5VzejT
8culF/8XgNYuzFhkD65Ecksoz0azfMwXphwyPm3WEt1EE5meMeXt6bVsfI+8vyhp
e/TfhloVfLUobau5yF2C+ih7xrHkVta+f860jqCkiHqngUgzksLoah53mA2Wh36f
2+D6RbEFEo6Fx4DoELm55CZKpVFv9Ia1ICkg2kuJCFBXL8aTAAYmyphyPDccXGSs
G2DZCAUjJ1sP7xPVMGuLD7A/IvggUDbs8m0i2sVq4JRZVLRfBW9khjGaCmjOAWBY
ijWzzZtUywo=
=aYfF
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-4.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First round of IIO fixes for the 4.10 cycle.
* 104-quad-8
- Fix selecting wrong register when the index control register is desired.
- Fix an off by one error when addressing the input/output control register.
- Fix inverted logic on the active high / low control
* bmi160
- Sleep for worst case rather than best case amount of time after cmd
execution begins.
* max44000
- typo fix in illuminance_integration_time_available listing.
* st-sensors
- Fix channel data passing. This one took a while to get tested on 24bit
parts. Definitely one for stable asap as the bug broke quite a few parts.
- lis3lv02 needs a data alignment bit set and the scaling was wrong.
* ti_am335x
- depend on HAS_DMA
The LIS3LV02 has a special bit that need to be set to get the
read values left aligned. Before this patch we get gibberish
like this:
iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.010042 -0.642688 19155832931907
0.000000 -0.010042 -0.642688 19155858751073
Which is because we read a raw value for 1g as 64 which is
the nominal 1024 for 1g shifted 4 bits to the left by being
right-aligned rather than left aligned.
Since all other sensors are left aligned, add some code to
set the special DAS (data alignment setting) bit to 1 so that
the right value is now read like this:
iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.147095 -10.120135 24761614364956
-0.029419 -0.176514 -10.120135 24761631624540
The scaling was weird as well: we have a gain of 1000 for 1g
and 3000 for 6g. I don't even remember how I came up with the
old values but they are wrong.
Fixes: 3acddf74f8 ("iio: st-sensors: add support for lis3lv02d accelerometer")
Cc: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Using realbits as i2c/spi read len, when that value is not byte aligned
(e.g 12 bits), lead to skip msb part of out data registers.
Fix this taking into account scan_type.shift in addition to
scan_type.realbits as read length:
read_len = DIV_ROUND_UP(realbits + shift, 8)
This fix has been tested on 8, 12, 16, 24 bit sensors
Fixes: e7385de529 ("iio:st_sensors: align on storagebits boundaries")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
According to the datasheet, the shortest available integration time for
ALS ADC conversion is 1.5625ms but illuminance_integration_time_available
sysfs file shows wrong value.
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Fixes: d5d8f49b6 ("max44000: Expose ambient sensor scaling")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds the ACPI/PNP ID. The AD5592/3 driver core is already
designed around the unified device property API.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds the ACPI/PNP ID. The AD5592/3 driver core is already
designed around the unified device property API.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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.
Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
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: 217494e5b7 ("iio:pressure: Add STMicroelectronics pressures driver")
Fixes: 2f5effcbd0 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
Fixes: 7885a8ce68 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
Fixes: e039e2f5b4 ("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>
Datasheet specifies typical and maximum execution times for which CMD
register is occupied after previous command execution. We took these
values as minimum and maximum time for usleep_range() call before making
a new command execution.
To be sure, that the CMD register is no longer occupied we need to wait
*at least* the maximum time specified by datasheet.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
From now on we can add bmi160 device to device-tree by specifying
compatible string.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
From now on we can add bmi160 device to device-tree by specifying
compatible string.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
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>
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>
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.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188641
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The set_to_preset_on_index sysfs attribute provides a boolean
configuration option to enable a preset operation on the respective
channel's counter when Index occurs. However, the corresponding
configuration bit on the Input/Output Control register must be set low
to enable the preset operation.
This patch inverts the internal driver boolean logic exposed via the
set_to_preset_on_index attribute in order to correctly configure the
device which expects an active low bit.
Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
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>
The Input/Output Control register (IOR) is offset by 1 from the
respective channel data register. This patch fixes off-by-one errors
when attempting to write to a channel IOR where the base address was not
properly offset.
Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The LS7266R1 requires bits 5 & 6 to be high in order to select the Index
Control Register. This patch fixes a typo that incorrectly selects the
Input/Output Control Register where the Index Control Register was
desired.
Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds a new driver for the TI ADS7950 family of ADC chips. These
communicate using SPI and come in 8/10/12-bit and 4/8/12/16 channel
varieties.
Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
smatch warned:
sval_binop_signed: invalid divide LLONG_MIN/-1
and this fixes it. It's actually good to have, in order to avoid accidental
checking for negative return values here.
Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Support driver probe by reading unique HID on systems based on ACPI instead
of DT compatible strings.
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
Add support to probe st_accel sensors on i2c bus using ACPI. Compatible
strings are not avaialable on ACPI based systems.
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support to match st sensors using information passed from ACPI DST
tables.
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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.
Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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: ac4f6eee8f ("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>
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.
This is usually good if the #defines give a meaning to the
opaque magic numbers.
However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.
Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.
This patch is purely syntactic should have no semantic effect.
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support for STMicroelectronics STM32 MCU's analog to
digital converter.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add core driver for STMicroelectronics STM32 ADC (Analog to Digital
Converter). STM32 ADC can be composed of up to 3 ADCs with shared
resources like clock prescaler, common interrupt line and analog
reference voltage.
This core driver basically manages shared resources.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Includes Peter Rosin's interesting drivers for a comparator. First complex
use we have had with an analog front end made from discrete components.
Brian Masney's work on moving the tsl2583 driver out of staging also
feature extensively!
New Drivers
* DAC based on a digital potentiometer
- New driver for the use of a dpot as a DAC. Includes bindings and Axentia
entry in vendor prefixes.
* Envelope detector baed on DAC and a comparator including device tree
bindings.
Staging Graduation
* tsl2583.
Core new features
- Core provision for _available attributes. This one had been stalled for
a long time until Peter picked it up and ran with it!
- In kernel interface helpers to retrieve available info from channels.
Driver new features
* mcp4531
- Add range of available raw values (used for the dpot dac driver).
Driver cleanups and fixes for issues introduced
* ad7766
- Testing the wrong variable following devm_regulator_bulk_get introduced
with the driver earlier in this cycle.
* ad9832
- Fix a wrong ordering in the probe introduced in the previous set of
patches. A use before allocation bug.
* cros_ec_sensors
- Testing for an error in a u8 will never work.
* mpu3050
- Remove duplicate initializer for the module owner.
- Add missing i2c dependency.
- Inform the i2c mux core how it is used - step one in implifying device
tree bindings.
* st-sensors
- Get rid of large number of uninformative defines in favour of putting the
constants where they are relevant. It is clear what they are from where
they are used.
* tsl2583
- Fix unused function warning when CONFIG_PM disabled and remove the
ifdefs in favour of __maybe_unused.
- Refactor taos_chip_on to only read relevant registers.
- Make sure calibscale and integration time are being set.
- Verify chip is in ready to be used before calibration.
- Remove some repeated checks for chip status (it's protected by a mutex
so can't change until it's released)
- Change current state storage from a tristate enum to a boolean seeing as
only two values are actually used now.
- Drop a redundant write to the control regiser in taos_probe (it's a noop)
- Drop the FSF mailing address.
- Clean up logging to not use hard coded function names (use __func__
instead).
- Cleanup up variable and function name prefixes.
- Alignment of #define fixes.
- Fix comparison between signed and unsigned integer warnings.
- Add some newlines in favour of readability.
- Combine the two sysfs ABI docs that somehow ended up in different places.
- Fix multiline comment syntax.
- Move a code block to inside an else statement as it makes more sense there.
- Change tsl2583_als_calibrate to return 0 rather than a value nothing
reads.
- Drop some pointless brackets
- Don't assume 32bit unsigned int.
- Change to a per device instance lux table.
- Add missing tsl2583 to the list of supported devices in the intro comments.
- Improve commment on clearing of interrupts.
- Drop some uninformative comments.
- Drop a memset call that doesn't do anything useful any more.
- Don't initialize some return variables that are always set.
- Add Brian Masney as a module author after all these changes.
-----BEGIN PGP SIGNATURE-----
iQIuBAABCAAYBQJYKMYhERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIiNMP
/00ZTTfPR/I5VtriTchGTgXN6lDTnypFk9Z4niynK3EIdF6Mw5XphQjtUzg7sJl4
U7yH89lzt0PxAJHylW5x0YOwrr6fyau+rNA2Kj26psaQpf5Yva0UDRexsomTZaad
P005cf0yc4fuG/7KvjeONeLeaRXf9Qfs20r8htECLFhIGSE0qsGtfzUMn6tdbyn/
r/hxHR7oE2YThuFytX2sNJEJVmCDz+tTOz7kJv5L0e6Cg6cvMFizYUsoFYcZYGOQ
DNicdRfW5FOidBMCqXzYLDBn+oY+a35g90hFV3CvYsfEm+X6BzTgr3FI3PHmtXHT
RRAmRdgxg2z/rqp475f5EamRtZxEg0uktbqcs9bH8Bx7IDe8KtoNKLdPdxIT3T1D
ZYb0RkpPmfnBq3bDGh7DJVWl+Ht9Fj0jaKRNyWgiyopA9c6zN4MKRA+HNSxKRvD7
Qizw0QIPbtEGkw6WbQrrOSSwzNY/dq51vrT0eBmMaGpjmdDpRKrK53/k7uwk3/Wv
hjGWD5kdLRCAHL+EQKFssN/RgLS5PRhXsJQFeIYbH8VJFlEZ28j09gXJnjcpDucK
CXv37q8CX6wJ2NB+i+skOvKpxArgv+Mr4oE9LNYZie65EUyN28/Ii1n9vYmTPTlG
KXGKPynaR0sfrl+ir6+FCtuFXJnYC5WUqJH/yMRjA2z8
=mPkb
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.10c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Third set of IIO new device support, features and cleanup for the 4.10 cycle.
Includes Peter Rosin's interesting drivers for a comparator. First complex
use we have had with an analog front end made from discrete components.
Brian Masney's work on moving the tsl2583 driver out of staging also
feature extensively!
New Drivers
* DAC based on a digital potentiometer
- New driver for the use of a dpot as a DAC. Includes bindings and Axentia
entry in vendor prefixes.
* Envelope detector baed on DAC and a comparator including device tree
bindings.
Staging Graduation
* tsl2583.
Core new features
- Core provision for _available attributes. This one had been stalled for
a long time until Peter picked it up and ran with it!
- In kernel interface helpers to retrieve available info from channels.
Driver new features
* mcp4531
- Add range of available raw values (used for the dpot dac driver).
Driver cleanups and fixes for issues introduced
* ad7766
- Testing the wrong variable following devm_regulator_bulk_get introduced
with the driver earlier in this cycle.
* ad9832
- Fix a wrong ordering in the probe introduced in the previous set of
patches. A use before allocation bug.
* cros_ec_sensors
- Testing for an error in a u8 will never work.
* mpu3050
- Remove duplicate initializer for the module owner.
- Add missing i2c dependency.
- Inform the i2c mux core how it is used - step one in implifying device
tree bindings.
* st-sensors
- Get rid of large number of uninformative defines in favour of putting the
constants where they are relevant. It is clear what they are from where
they are used.
* tsl2583
- Fix unused function warning when CONFIG_PM disabled and remove the
ifdefs in favour of __maybe_unused.
- Refactor taos_chip_on to only read relevant registers.
- Make sure calibscale and integration time are being set.
- Verify chip is in ready to be used before calibration.
- Remove some repeated checks for chip status (it's protected by a mutex
so can't change until it's released)
- Change current state storage from a tristate enum to a boolean seeing as
only two values are actually used now.
- Drop a redundant write to the control regiser in taos_probe (it's a noop)
- Drop the FSF mailing address.
- Clean up logging to not use hard coded function names (use __func__
instead).
- Cleanup up variable and function name prefixes.
- Alignment of #define fixes.
- Fix comparison between signed and unsigned integer warnings.
- Add some newlines in favour of readability.
- Combine the two sysfs ABI docs that somehow ended up in different places.
- Fix multiline comment syntax.
- Move a code block to inside an else statement as it makes more sense there.
- Change tsl2583_als_calibrate to return 0 rather than a value nothing
reads.
- Drop some pointless brackets
- Don't assume 32bit unsigned int.
- Change to a per device instance lux table.
- Add missing tsl2583 to the list of supported devices in the intro comments.
- Improve commment on clearing of interrupts.
- Drop some uninformative comments.
- Drop a memset call that doesn't do anything useful any more.
- Don't initialize some return variables that are always set.
- Add Brian Masney as a module author after all these changes.
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The DAC is used to find the peak level of an alternating voltage input
signal by a binary search using the output of a comparator wired to
an interrupt pin. Like so:
_
| \
input +------>-------|+ \
| \
.-------. | }---.
| | | / |
| dac|-->--|- / |
| | |_/ |
| | |
| | |
| irq|------<-------'
| |
'-------'
Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
It is assumed that the dpot is used as a voltage divider between the
current dpot wiper setting and the maximum resistance of the dpot. The
divided voltage is provided by a vref regulator.
.------.
.-----------. | |
| vref |--' .---.
| regulator |--. | |
'-----------' | | d |
| | p |
| | o | wiper
| | t |<---------+
| | |
| '---' dac output voltage
| |
'------+------------+
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Example:
$ cat '/sys/bus/iio/devices/iio:device0/out_resistance_raw_available'
[0 1 256]
Meaning: min 0, step 1 and max 256.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Specifically a helper for reading the available maximum raw value of a
channel and a helper for forwarding read_avail requests for raw values
from one iio driver to an iio channel that is consumed.
These rather specific helpers are in turn built with generic helpers
making it easy to build more helpers for available values as needed.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
A large number of attributes can only take a limited range of values.
Currently in IIO this is handled by directly registering additional
*_available attributes thus providing this information to userspace.
It is desirable to provide this information via the core for much the same
reason this was done for the actual channel information attributes in the
first place. If it isn't there, then it can only really be accessed from
userspace. Other in kernel IIO consumers have no access to what valid
parameters are.
Two forms are currently supported:
* list of values in one particular IIO_VAL_* format.
e.g. 1.300000 1.500000 1.730000
* range specification with a step size:
e.g. [1.000000 0.500000 2.500000]
equivalent to 1.000000 1.5000000 2.000000 2.500000
An addition set of masks are used to allow different sharing rules for the
*_available attributes generated.
This allows for example:
in_accel_x_offset
in_accel_y_offset
in_accel_offset_available.
We could have gone with having a specification for each and every
info_mask element but that would have meant changing the existing userspace
ABI. This approach does not.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[forward ported, added some docs and fixed buffer overflows /peda]
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:
drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.
Fixes: 231147ee77 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
(cherry picked from commit 32cb7d27e6)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.
This is usually good if the #defines give a meaning to the
opaque magic numbers.
However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.
Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.
This patch is purely syntactic should have no semantic effect.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.
This is usually good if the #defines give a meaning to the
opaque magic numbers.
However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.
Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.
This patch is purely syntactic should have no semantic effect.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.
This is usually good if the #defines give a meaning to the
opaque magic numbers.
However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.
Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.
This patch is purely syntactic should have no semantic effect.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The i2c mux core can then take appropriate action depending on if it is
used for an actual i2c mux, or for an arbitrator or gate. In this case
it is used as a gate.
This will make devicetree bindings simpler when they are eventually
added.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
status is a u8 hence the check if status is less than zero has no effect.
Fix this by replacing status with int ret so the less than zero compare
will correctly detect errors.
Issue found with static analysis with CoverityScan, CID 1375919
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fixes: 974e6f02e2 ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub")
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
We should be testing "ret" here.
Fixes: aa16c6bd0e ("iio:adc: Add support for AD7766/AD7767")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The new mpu3050 driver fails to build if I2C is disabled:
drivers/iio/built-in.o: In function `mpu3050_i2c_driver_exit':
mpu3050-i2c.c:(.exit.text+0x17f): undefined reference to `i2c_del_driver'
drivers/iio/built-in.o: In function `mpu3050_i2c_driver_init':
mpu3050-i2c.c:(.init.text+0x215): undefined reference to `i2c_register_driver'
This adds a Kconfig dependency to ensure we only build it when I2C
is available.
Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The newly added mpu3050 driver has two initializations for the
module owner, which causes a warning for 'make W=1':
include/linux/export.h:37:21: error: initialized field overwritten [-Werror=override-init]
drivers/iio/gyro/mpu3050-core.c:749:19: note: in expansion of macro 'THIS_MODULE'
This removes one of the two.
Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This includes two branch merges for elements that may also go via MFD.
New device support
* cros_ec
- new driver to support these Chrome OS contiguous sensors which are behind
the Chrome OS embedded controller. Requires a few minor MFD and chrome
platform changes. One follow up fix deals with some dependency issues in
Kconfig.
* mpu-3050
- new driver and device tree bindings for this venerable device.
* st_accel
- support for the lng2dm an
Driver features
* ad7192
- Add DVdd regulator handling
* ad9832
- Add DVDD regulator handling
* at91
- Suspend and resume support
* si7020
- Device tree bindings
* ti-am335x
- DMA support - uses dma to accelerate short bursts of read back rather
than full blown DMA buffer support. Greatly improved performance.
Includes an MFD addition to give access to the address needed for DMA.
* tsl2583
- Device tree bindings
Cleanups and minor fixes
* ad7192
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
- Rename reg variable to reflect which regulator it is
* ad5933
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* ad7746
- Fix a missing return value (fallout from previous patch set)
* ad7780
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* ad9832
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
- Rename reg regulator to reflect which one it is
* ad9834
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* hts221
- Remove a duplicated include
* maxim thermocouple
- Handle a wrong storage side in read function. Prevent any problems that
might be introduced by additions to this driver in future.
* tsl2583 - big set from Brian Masney to drive this towards a staging
graduation.
- Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
- Improved error handling in various functions
- Drop redundant power_state custom sysfs attribute.
- Use IIO_*_ATTR* macros for remaining attributes.
- Return an error code to userspace on invalid parameters being writen to
sysfs files.
- Add locking to various attribute accesses to remove possible races.
- Add defines for various magic numbers.
- Use smbus_read_byte_data instead of a write_byte followed by read_byte.
- Query only relevant registers in probe.
- Tidy up ordering of code comments.
- Remove a pointless power off sequence in taos_chip_on.
- Don't bother shutting down the chip when updating the lux table.
The table is held entirely in the driver and doesn't effect the chip at all.
- Drop a redundant i2c call in taos_als_calibrate where the same register
is read twice in a row.
-----BEGIN PGP SIGNATURE-----
iQIuBAABCAAYBQJYH22HERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIUg4P
/1GRFGpTbqyzDOX6KZKAdBRsRMn3XPL0XslvbKpupY4T9WFEJbZi01z4P/x+uRIk
6TtRlhdWBLdzVQ6sLpVAZVXR2/FxGj+nsc2ONgHJXm02/fDBmjI89Ed9WVS1HR73
D2yLAFhflvE6mDMExvAnUVBh9ClR2SXoGL0N1k+VQM08Rs+F6IzBAg2albiPkct/
7UQB9apn4VCCaRY02gllvWrUiJV3w8jsSikwDACZsprQGIxKjLiH4evtRfSOI8bg
Z7UoJYaYNMiQtn6+rFaNUjFQtzlnWcjB92RUy/MqnpXmkuAvw3+CbXYteYnailO1
eTsIjKpwssKaQh5HHALrxIwP/a/9a+Wyrd8iheygUQvzSNx3gcxXrtNrUk8eI/9W
N8pBRBbu+2pzSzVLQb+7SR5wJG1zQ5NEXI1gpZuyed94g30Be0vQpeiZRNCUL+J0
ta28Xa25cREzHrXGXrhfyxNJuriav/8A5PTtnGJSZZ8RhuHZq24TcC8h6KVOWR+3
BBiehupFcIErbrGcMKuhq01q8A9+Vj/1z6hQaZzfIpXFjEEUvkBo3OMiNtgpkQYM
XYdaF2bH25t8wx020z4FrmN48nxg2HDTLtKissP/6bInh4kYyGneKhf6QQVnG2IX
41XLE/fw4QoAnLuTBXD3boydC08uJmVkXeOH2sfaCYwG
=ptGw
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.10b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing
Jonathan writes:
Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle
This includes two branch merges for elements that may also go via MFD.
New device support
* cros_ec
- new driver to support these Chrome OS contiguous sensors which are behind
the Chrome OS embedded controller. Requires a few minor MFD and chrome
platform changes. One follow up fix deals with some dependency issues in
Kconfig.
* mpu-3050
- new driver and device tree bindings for this venerable device.
* st_accel
- support for the lng2dm an
Driver features
* ad7192
- Add DVdd regulator handling
* ad9832
- Add DVDD regulator handling
* at91
- Suspend and resume support
* si7020
- Device tree bindings
* ti-am335x
- DMA support - uses dma to accelerate short bursts of read back rather
than full blown DMA buffer support. Greatly improved performance.
Includes an MFD addition to give access to the address needed for DMA.
* tsl2583
- Device tree bindings
Cleanups and minor fixes
* ad7192
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
- Rename reg variable to reflect which regulator it is
* ad5933
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* ad7746
- Fix a missing return value (fallout from previous patch set)
* ad7780
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* ad9832
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
- Rename reg regulator to reflect which one it is
* ad9834
- Fix regulator naming to match datasheet
- Handle regulator errors correctly (so as to not break deferred probing)
* hts221
- Remove a duplicated include
* maxim thermocouple
- Handle a wrong storage side in read function. Prevent any problems that
might be introduced by additions to this driver in future.
* tsl2583 - big set from Brian Masney to drive this towards a staging
graduation.
- Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
- Improved error handling in various functions
- Drop redundant power_state custom sysfs attribute.
- Use IIO_*_ATTR* macros for remaining attributes.
- Return an error code to userspace on invalid parameters being writen to
sysfs files.
- Add locking to various attribute accesses to remove possible races.
- Add defines for various magic numbers.
- Use smbus_read_byte_data instead of a write_byte followed by read_byte.
- Query only relevant registers in probe.
- Tidy up ordering of code comments.
- Remove a pointless power off sequence in taos_chip_on.
- Don't bother shutting down the chip when updating the lux table.
The table is held entirely in the driver and doesn't effect the chip at all.
- Drop a redundant i2c call in taos_als_calibrate where the same register
is read twice in a row.
While testing, it was observed that on some platforms the scale value
from iio sysfs for gyroscope is always 0 (E.g. Yoga 260). This results
in the final angular velocity component values to be zeros.
This is caused by insufficient precision of scale value displayed in sysfs.
If the precision is changed to nano from current micro, then this is
sufficient to display the scale value on this platform.
Since this can be a problem for all other HID sensors, increase scale
precision of all HID sensors to nano from current micro.
Results on Yoga 260:
name scale before scale now
--------------------------------------------
gyro_3d 0.000000 0.000000174
als 0.001000 0.001000000
magn_3d 0.000001 0.000001000
accel_3d 0.000009 0.000009806
Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This fix makes newer ISH hubs work. Previous ones worked by lucky
coincidence.
Rotation sensor function does not work due to miss PM function.
Add common hid sensor iio pm function for rotation sensor.
Further clarification from Srinivas:
If CONFIG_PM is not defined, then this prevents this sensor to
function. So above commit caused this.
This sensor was supposed to be always on to trigger wake up in prior
external hubs. But with the new ISH hub this is not the case.
Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Fixes: 2b89635e9a ("iio: hid_sensor_hub: Common PM functions")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds the required pieces to ti_am335x_adc driver for
DMA support
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add suspend/resume callback, support the pinctrl sleep state when
the system suspend as well.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Neither sample frequency value nor hysteresis value can be set to be a
negative number, check and return "Invalid argument" if they are negative.
If not do this change, sample_frequency will be set into some unknown
value, read hysteresis value after write negative number will return
"Invalid argument".
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>
add support to STMicroelectronics LNG2DM accelerometer to
st_accel framework
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds devicetree support for the si7020 iio driver. Since it works
well without requiring any additional property, its compatible string is
added to the trivial i2c devices bindings list.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Would have merged this into the original patch as a fixup but I've already
pushed that out as an immutable branch for others to use so it'll have
to be a separate patch. The original select had a typo as well.
Trying to do this via a select was opening a can of worms due to
a tree of other elements that would also have needed selecting.
A simple depends seems much mroe straight forward and appropriate in this
case.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
fix scale configuration/parsing for h3lis331dl accel driver
when sensitivity is higher than 1(m/s^2)/digit
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Fixes: 1e52fefc9b ("iio: accel: Add support for the h3lis331dl accelerometer")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This resolves a merge issue with
drivers/staging/iio/accel/sca3000_core.c and we want the fixes all in
here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Check whether the ChromeOS Embedded Controller is a sensor hub and in
such case issue a command to get the number of sensors and register them
all.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Handle 3d contiguous sensors like Accelerometers, Gyroscope and
Magnetometer that are presented by the ChromeOS EC Sensor hub.
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add the core functions to be able to support the sensors attached behind
the ChromeOS Embedded Controller and used by other IIO cros-ec sensor
drivers.
The cros_ec_sensor_core driver matches with current driver in ChromeOS
4.4 tree, so it includes all the fixes at the moment. The support for
this driver was made by Gwendal Grignou. The original patch and all the
fixes has been squashed and rebased on top of mainline.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
[eballetbo: split, squash and rebase on top of mainline the patches
found in ChromeOS tree]
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:
drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.
Fixes: 231147ee77 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds a new driver for the Invensense MPU-3050 gyroscope.
This driver is based on information from the rough input driver
in drivers/input/misc/mpu3050.c and the scratch misc driver
posted by Nathan Royer in 2011. Some years have passed but this
is finally a fully-fledged driver for this gyroscope. It was
developed and tested on the Qualcomm APQ8060 Dragonboard.
The driver supports both raw and buffered input. It also
supports the internal trigger mechanism by registering a trigger
that can fire in response to the internal sample engine of the
component. In addition to reading out the gyroscope sensor
values, the driver also supports reading the temperature from
the sensor.
The driver currently only supports I2C but the MPU-3050 can
also be used from SPI, so the I2C portions are split in their
own file and we just use regmap to access all registers, so
it will be trivial to plug in SPI support if/when someone has
a system requiring this.
To conserve power, the driver utilizes the runtime PM
framework and will put the sensor in off mode and disable the
regulators when unused, after a timeout of 10 seconds.
The fullscale can be set for the sensor to 250, 500, 1000 or
2000 deg/s. This corresponds to scale values of rougly 0.000122,
0.000275, 0.000512 or 0.001068. By writing such values (or close
to these) into "in_anglevel_scale", the corresponding fullscale
can be chosen. It will default to 2000 deg/s (~35 rad/s).
The gyro component can have DC offsets on all axes. These can be
compensated using the standard sysfs ABI property
"in_anglevel_[xyz]_calibbias". This is in positive/negative
values of the raw values, so a suitable calibration bias can be
determined by userspace by reading the "in_anglevel_[xyz]_raw"
for a few iterations while holding the sensor still, create an
average integer, and writing the negative inverse of that into
"in_anglevel_[xyz]_calibbias". After this the hardware will
automatically subtract the bias, also when using buffered
readings.
Since the MPU-3050 has an outgoing I2C port it needs to act as
an I2C mux. This means that the device is switching I2C traffic
to devices beyond it. On my system this is the only way to reach
the accelerometer. The "sensor fusion" ability of the MPU-3050
to directly talk to the device on the outgoing I2C port is
currently not used by the driver, but it has code to allow I2C
traffic to pass through so that the Linux kernel can reach the
device on the other side with a kernel driver.
Example usage with the native trigger:
$ generic_buffer -a -c10 -n mpu3050
iio device number being used is 0
iio trigger number being used is 0
No channels are enabled, enabling all channels
Enabling: in_anglvel_z_en
Enabling: in_timestamp_en
Enabling: in_anglvel_y_en
Enabling: in_temp_en
Enabling: in_anglvel_x_en
/sys/bus/iio/devices/iio:device0 mpu3050-dev0
29607.142578 -0.117493 0.074768 0.012817 180788797150
29639.285156 -0.117493 0.076904 0.013885 180888982335
29696.427734 -0.116425 0.076904 0.012817 180989178039
29742.857422 -0.117493 0.076904 0.012817 181089377742
29764.285156 -0.116425 0.077972 0.012817 181189574187
29860.714844 -0.115356 0.076904 0.012817 181289772705
29864.285156 -0.117493 0.076904 0.012817 181389971520
29910.714844 -0.115356 0.076904 0.013885 181490170483
29917.857422 -0.116425 0.076904 0.011749 181590369742
29975.000000 -0.116425 0.076904 0.012817 181690567075
Disabling: in_anglvel_z_en
Disabling: in_timestamp_en
Disabling: in_anglvel_y_en
Disabling: in_temp_en
Disabling: in_anglvel_x_en
The first column is the temperature in millidegrees, then the x,y,z
axes in succession followed by the timestamp. Also tested successfully
using the HRTimer trigger.
Cc: Nick Vaccaro <nvaccaro@google.com>
Cc: Ge Gao <ggao@invensense.com>
Cc: Anna Si <asi@invensense.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Cc: Gregor Boirie <gregor.boirie@parrot.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fair number of outreachy related patches in here. Some of these may well
have already been picked up by Greg but git will sort that out for us.
Also some good staging cleanup work from other sources. Thanks Brian and Lars
in particular for this.
New device support
* ACCES 104-quad-8
- New driver for this 8 channel encoder input board. Lots of new ABI with
this one.
* AD7766
- New driver supporting AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1 and
AD7767-2 24 bit ADCs.
* dmard 10
- New driver for this 3 axis accelerometer.
* Honeywell ABP pressure sensors.
- New driver covering 56 parts in this series (too many to list here!)
* HTS221
- New driver to support this relative humidiy and temperature device.
* LMP91000
- New driver for this potentiostat (form of chemical sensor). Nice example
of use of the buffered consumer interfaces and the use of a consumer
provided trigger.
* MiraMEMS DA311
- New driver for this 3 axis accelerometer.
* MiraMEMS DA280
- New driver for this 3 axis accelerometer. Follow up caught up with
vendor prefixes for these.
Staging graduations
* isl29018 light sensor
- Fixes and cleanups listed below (thanks for your hard work on this Brian!)
* sca3000
- Fixes and cleanups listed below. This was one of the small set of drivers
that went into staging when IIO was first added. Turns out it had a few
bugs and needed to be brought into the modern era! Not clear if I am
the only person who actually has one of these still wired to a board.
New features (Core)
- Add an iio_trigger_validate_own_device helper which relies on the device
and trigger having the same parent. Convenient to have this for some
of the more complex trigger / device interactions. Was hand rolled in
a few drivers already so good to bring it into the core.
- Add an iio_read_channel_offset in kernel access helper (similar to
the existing one for scale).
- IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros. These
lead some rather contrived function naming, but there is no denying they
do reduced boilerplate. I'm going to resist their introduction in
drivers 'unless' they form part of a larger set of cleanups.
- Counter channel type and index type.
New features (Drivers)
* hdc100x
- Triggered buffer support.
* mcp4725
- Device tree bindings and support.
- Voltage reference selection.
* ti-adc0832
- Triggered buffer support.
* ti-adc161s626
- Add regulator support allowing _scale and _offset values to be established
and exported.
New features (Tools)
* iio_generic_buffer
- -A option to force enable all channels rather than faulting if some are
already enabled (like -a does). Followup patches tidied this support up.
Cleanups (Core)
- Use kmalloc_array in iio_scan_mask_set.
- Take event_attrs field of iio_info structure constant
- Staging todo list updates. Most of it was long done.
- MAINTAINERS had a wrong directory listing.
Cleanups (Drivers)
* Missing i2c trivial devices entries.
* ad5592r
- Fix an endian type related sparse warnings.
* ad7150
- Constify the event attribute_group structures.
* ad7152
- Add some blank lines to improve readability.
- Sampling frequency control via chan-info element rather than hand rolled
attributes.
- add a new lock to avoid use of mlock for non state change related locking.
* ad7280
- Constify atrribute_group structure (second patch covers the event ones)
* ad7606 (Lars is driving most of the cleanup on this with some additions from
Eva)
- Fix improper setting of oversampling pins. This has been broken a very
long time in this staging driver, so not going to push this back to stable.
- Implement oversampling configuration via the chan_info mask element.
- Remove an unused int_vref_mv field.
- Remove a reundant name field from ad7606_chip_info.
- Remove default device configuration from platform_data in favour of
whatever the power on defaults are.
- Remove out of band error reporting in the kernel log as not providing
much information.
- Fix oversampling ratio by having 1 be the value for no oversampling.
- Avoid allocating buffer for each data capture.
- Factor out common code between periodic and one-shot capture.
- Move set_drvdat into common code.
- Let the common probe function return int rather than jumping through
an ERR_PTR.
- Pass struct device * into common remove to simplify code.
- Always run trigger handler only once per event (no one can remember why
it was being possibly done twice).
- Move over to the GPIO descriptor API to shorten and clarify code.
- Move the buffer code into the main file as it's not optional and is
now rather short in this driver.
- Fix the naming of the supply regulator.
- Rework regulator handling to handle errors including deferred probing.
- Tidy up a ptr_err or 0 return.
* ad7746
- Sampling frequency control via info_mask element rather than hand rolled
* ad7758
- Sampling frequency control via info_mask element rather than hand rolled
attributes.
* ad7816
- Constify the event attribute_group structure.
* adt7316
- Constify the event attribute group structures.
* ak8974
- Cleanup some sparse warnings about endian types.
* ak8975
- Cleanup some sparse warnings about endian types.
* bmi160
- Spare endian warning cleanups.
* isl29018 (towards staging graduation)
- Remove unusedvariables and defines.
- Improve consistency of error handling.
- Signed / unsigned comparison fixes.
- Use the IIO_DEVICE_ATTR_{RO, RW} macros
- Fix a race in in_illuminance_scale_available_show.
- Cleanup exit points of _read_raw
- Sanity check if in suspended state during a write_raw call as was already
done for read_raw.
- Document device tree bidnings.
- Document infrared supression controls.
- Add some newlines to improve readability and drop one that shouldn't be
there.
- Fix a poorly named functions name.
- Fix multiline coment syntax.
- Tidy up a pair or return statements by unifying them.
- Rename description in Kconfig for consistency with similar drivers.
* lidar
- cleanup power management by dropping unnecessary call.
* ltr501
- Use the claim_direct_mode helpers. Fix a race condition along the way.
* max1027
- Fix a dubious x | !y sparse warning.
- Use the new iio_trigger_validate_own_device helper.
* max440000
- Clean up some sparse warnings about endian types.
* mcp4725
- Use the regulator framework to establish the reference voltage rather than
getting it from platform data.
- Tidy up a comment typo.
- Fix a wrong PTR_ERR query (wrong regulator).
* mma7660
- Take a mma7660_nscale static.
* mma8452
- Use the new iio_trigger_validate_own_device helper.
- Use claim_direct_mode helpers - fix a race condition along the way.
* mpl3115
- Use claim_direct_mode helpers - fix a race condition along the way.
* ms65611
- Tidy up regulator error handling and clean out a static warning in the mix.
* sca3000
- Avoid a potential unitialized variable if a hardware read returns a value
that isn't actually supported (mostly warning supression).
- Fix a use before setting of the indio_dev->buffer pointer. Broken for
a very long time so not going to rush this into stable.
- Merge buffer file with core file. We used to always split these.
Sometimes it's just not worth the hassle. In this case the device's main
feature is it's hardware fifos so unlikely anyone would want to run it
without.
- Drop the sca3000_register_ring_funcs function as it's a pointless wrapper
once we have only one file.
- Fix cleaning of flag + setting of size of scan. Without this you can't
start the buffer twice and expect sensible (or any) results. Again,
broken for a long time so not heading for stable.
- Drop the custom watershed setting ABI - for now we'll just support one
value.
- Move to a hybrid hard / soft buffer design (how we've been doing it
for similar devices for a while now!)
- Cleanup some unusued variables.
- Use a fake channel to support core handling of freefall event registration.
- Cleanup the register defines.
- Fix an off by one error in axis due to IIO_NO_MOD taking up the 0 value.
Been broken since first admission of IIO to the staging tree.
- Add readback of the 3db low pass filter frequency and later writing
allowing droppign of custom measurement mode attributes as they can
be represented by the filter choices that is their main characteristic.
- Drop non standard revision attr and replace with dev_info on probe.
- Avoid a race in probe.
- Various formatting fixes.
- Kernel-docify docs that were very nearly in the write format.
* tsl2583
- Constify attribute_group structure.
* zpa2326
- Drop a redundant DEBUG ifdef.
Cleanups (Tools)
* iio_generic_buffer
- Fix the ? arguement. Previously it sort of worked as you got the help
message as a result of it not recognising the arguement.
-----BEGIN PGP SIGNATURE-----
iQIuBAABCAAYBQJYDSX+ERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIQSEP
/2HRMqDXeIh2N0oVLBFK5pEaAZ52tjsEmf1XgfCJ3D1PczS0vzqkFKuG/078BU3v
e9MTj39sF1EOyGJv4mdfnHygLPvjaTU/A6HoIaP1t9cUgSQ1jzPN0tO8/Hj/ESlU
U3mNgUNUIa9cnVIfWk2cPJqgKJ/w52vRk00yRnOKZjHZkxbYQq9rPJ7ks12jQSGT
IBEipiYMnRovc2w4NWbAry5pAXBmttVFKyi5FZ7uIM5EH34+SAY6laXSoZQl8E74
LKgIwdPUn9yeujyX6ohBFRFloOf/4VYedV6NIUz8k5BzuTeAJcp4DSMLXSWIwZVd
sdza6el3Tt0MkjIgioTg7N07FvatbQVIsnWnLjLb/zpMjGQPigfTnIi7kYcH3wHx
NwpTy1MZg5U571LOYXsEhNvIFiQICoV6+8d/PzrO1J+rphuQYreOm0WzjvIqW4q/
dU2uCAMOHd82gjm9QrKjvrc+4M3oGc3ENE/i5P2YNQhdkdNKp9PMWgL6RO9QXgeQ
9TrjbDr9OSFLatZg5IswWFa5CHL9AZ6OuvaRyx/8n5cBdY3n8+wMIowRQJlMUdGY
Aa5ByntMsvhwCu+M1+fDihZyx4suTNvW7+Emqd/8lCb+BRjHoamBb6uGBGx6Txvy
6TPluNWE+cK5Tjkrn+jDbTzhwdaaSRtO4ECRwxXYAqfn
=ZRUt
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of IIO new device support, features and cleanups for the 4.10 cycle.
Fair number of outreachy related patches in here. Some of these may well
have already been picked up by Greg but git will sort that out for us.
Also some good staging cleanup work from other sources. Thanks Brian and Lars
in particular for this.
New device support
* ACCES 104-quad-8
- New driver for this 8 channel encoder input board. Lots of new ABI with
this one.
* AD7766
- New driver supporting AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1 and
AD7767-2 24 bit ADCs.
* dmard 10
- New driver for this 3 axis accelerometer.
* Honeywell ABP pressure sensors.
- New driver covering 56 parts in this series (too many to list here!)
* HTS221
- New driver to support this relative humidiy and temperature device.
* LMP91000
- New driver for this potentiostat (form of chemical sensor). Nice example
of use of the buffered consumer interfaces and the use of a consumer
provided trigger.
* MiraMEMS DA311
- New driver for this 3 axis accelerometer.
* MiraMEMS DA280
- New driver for this 3 axis accelerometer. Follow up caught up with
vendor prefixes for these.
Staging graduations
* isl29018 light sensor
- Fixes and cleanups listed below (thanks for your hard work on this Brian!)
* sca3000
- Fixes and cleanups listed below. This was one of the small set of drivers
that went into staging when IIO was first added. Turns out it had a few
bugs and needed to be brought into the modern era! Not clear if I am
the only person who actually has one of these still wired to a board.
New features (Core)
- Add an iio_trigger_validate_own_device helper which relies on the device
and trigger having the same parent. Convenient to have this for some
of the more complex trigger / device interactions. Was hand rolled in
a few drivers already so good to bring it into the core.
- Add an iio_read_channel_offset in kernel access helper (similar to
the existing one for scale).
- IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros. These
lead some rather contrived function naming, but there is no denying they
do reduced boilerplate. I'm going to resist their introduction in
drivers 'unless' they form part of a larger set of cleanups.
- Counter channel type and index type.
New features (Drivers)
* hdc100x
- Triggered buffer support.
* mcp4725
- Device tree bindings and support.
- Voltage reference selection.
* ti-adc0832
- Triggered buffer support.
* ti-adc161s626
- Add regulator support allowing _scale and _offset values to be established
and exported.
New features (Tools)
* iio_generic_buffer
- -A option to force enable all channels rather than faulting if some are
already enabled (like -a does). Followup patches tidied this support up.
Cleanups (Core)
- Use kmalloc_array in iio_scan_mask_set.
- Take event_attrs field of iio_info structure constant
- Staging todo list updates. Most of it was long done.
- MAINTAINERS had a wrong directory listing.
Cleanups (Drivers)
* Missing i2c trivial devices entries.
* ad5592r
- Fix an endian type related sparse warnings.
* ad7150
- Constify the event attribute_group structures.
* ad7152
- Add some blank lines to improve readability.
- Sampling frequency control via chan-info element rather than hand rolled
attributes.
- add a new lock to avoid use of mlock for non state change related locking.
* ad7280
- Constify atrribute_group structure (second patch covers the event ones)
* ad7606 (Lars is driving most of the cleanup on this with some additions from
Eva)
- Fix improper setting of oversampling pins. This has been broken a very
long time in this staging driver, so not going to push this back to stable.
- Implement oversampling configuration via the chan_info mask element.
- Remove an unused int_vref_mv field.
- Remove a reundant name field from ad7606_chip_info.
- Remove default device configuration from platform_data in favour of
whatever the power on defaults are.
- Remove out of band error reporting in the kernel log as not providing
much information.
- Fix oversampling ratio by having 1 be the value for no oversampling.
- Avoid allocating buffer for each data capture.
- Factor out common code between periodic and one-shot capture.
- Move set_drvdat into common code.
- Let the common probe function return int rather than jumping through
an ERR_PTR.
- Pass struct device * into common remove to simplify code.
- Always run trigger handler only once per event (no one can remember why
it was being possibly done twice).
- Move over to the GPIO descriptor API to shorten and clarify code.
- Move the buffer code into the main file as it's not optional and is
now rather short in this driver.
- Fix the naming of the supply regulator.
- Rework regulator handling to handle errors including deferred probing.
- Tidy up a ptr_err or 0 return.
* ad7746
- Sampling frequency control via info_mask element rather than hand rolled
* ad7758
- Sampling frequency control via info_mask element rather than hand rolled
attributes.
* ad7816
- Constify the event attribute_group structure.
* adt7316
- Constify the event attribute group structures.
* ak8974
- Cleanup some sparse warnings about endian types.
* ak8975
- Cleanup some sparse warnings about endian types.
* bmi160
- Spare endian warning cleanups.
* isl29018 (towards staging graduation)
- Remove unusedvariables and defines.
- Improve consistency of error handling.
- Signed / unsigned comparison fixes.
- Use the IIO_DEVICE_ATTR_{RO, RW} macros
- Fix a race in in_illuminance_scale_available_show.
- Cleanup exit points of _read_raw
- Sanity check if in suspended state during a write_raw call as was already
done for read_raw.
- Document device tree bidnings.
- Document infrared supression controls.
- Add some newlines to improve readability and drop one that shouldn't be
there.
- Fix a poorly named functions name.
- Fix multiline coment syntax.
- Tidy up a pair or return statements by unifying them.
- Rename description in Kconfig for consistency with similar drivers.
* lidar
- cleanup power management by dropping unnecessary call.
* ltr501
- Use the claim_direct_mode helpers. Fix a race condition along the way.
* max1027
- Fix a dubious x | !y sparse warning.
- Use the new iio_trigger_validate_own_device helper.
* max440000
- Clean up some sparse warnings about endian types.
* mcp4725
- Use the regulator framework to establish the reference voltage rather than
getting it from platform data.
- Tidy up a comment typo.
- Fix a wrong PTR_ERR query (wrong regulator).
* mma7660
- Take a mma7660_nscale static.
* mma8452
- Use the new iio_trigger_validate_own_device helper.
- Use claim_direct_mode helpers - fix a race condition along the way.
* mpl3115
- Use claim_direct_mode helpers - fix a race condition along the way.
* ms65611
- Tidy up regulator error handling and clean out a static warning in the mix.
* sca3000
- Avoid a potential unitialized variable if a hardware read returns a value
that isn't actually supported (mostly warning supression).
- Fix a use before setting of the indio_dev->buffer pointer. Broken for
a very long time so not going to rush this into stable.
- Merge buffer file with core file. We used to always split these.
Sometimes it's just not worth the hassle. In this case the device's main
feature is it's hardware fifos so unlikely anyone would want to run it
without.
- Drop the sca3000_register_ring_funcs function as it's a pointless wrapper
once we have only one file.
- Fix cleaning of flag + setting of size of scan. Without this you can't
start the buffer twice and expect sensible (or any) results. Again,
broken for a long time so not heading for stable.
- Drop the custom watershed setting ABI - for now we'll just support one
value.
- Move to a hybrid hard / soft buffer design (how we've been doing it
for similar devices for a while now!)
- Cleanup some unusued variables.
- Use a fake channel to support core handling of freefall event registration.
- Cleanup the register defines.
- Fix an off by one error in axis due to IIO_NO_MOD taking up the 0 value.
Been broken since first admission of IIO to the staging tree.
- Add readback of the 3db low pass filter frequency and later writing
allowing droppign of custom measurement mode attributes as they can
be represented by the filter choices that is their main characteristic.
- Drop non standard revision attr and replace with dev_info on probe.
- Avoid a race in probe.
- Various formatting fixes.
- Kernel-docify docs that were very nearly in the write format.
* tsl2583
- Constify attribute_group structure.
* zpa2326
- Drop a redundant DEBUG ifdef.
Cleanups (Tools)
* iio_generic_buffer
- Fix the ? arguement. Previously it sort of worked as you got the help
message as a result of it not recognising the arguement.
* atlas chemical
- Fix alignment of big endian values in a larger storage (by using the right
size storage)
* maxim thermocouple
- Fix alignment of big endian values in larger (by using the correct
sized storage).
* sca3000
- Handle unexpected mode values.
* ti-adc081
- Select IIO_TRIGGERED_BUFFER to avoid build errors
-----BEGIN PGP SIGNATURE-----
iQIuBAABCAAYBQJYDSpNERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIv80P
/0QCSY52U6sQt01ybdxyPhwZ6EfIxzzv64ukSHIFJBgQee1Z143tvAPVM80ZcIPW
oSOD9Cy3HABPFhLEnmTkAtUD69kguYGQmvnRxFhslVl0Skxo19gUhz/sWI9sR/5l
KG4/8Z/vXL9CYyurF/FCuWnYOu6tKK9Ody4AkMc7UTDNrON6agGQZh32W9PwRsrH
7aElCfyhom19vkZ37Odzgovl5FQ6eBcFjV6RarhihN/r7aV0wSn4fsuFPTrdKB+N
509FOr3/Vy+rBBtwwKyxNIMWhgO1tHEGKNR+ZKLENnMJUU3eixsWST1+wM6W7QoW
rVymu/nRPeWbWdqBH/wMlt7zuwZXqiRPNOP1Eyjg6PXRambdiu6UI+whOYxK6/7+
+xExQ1xDG4SkzXUtRXSUOgbiJfjcu5PlHiqnPVjs8qgFMuYChVnw0DYnX7uuQKxT
vIo0jA26BW32Rv5iJ07AIHAq0gJ+lo7NBDNMN5D33JLioiiVKxa+qsyWHpoUYMIR
o3IcMTuMMPAoFzGkvVdR85rO4D8nL87CDYj0QrA2T6arcKFtMybSPr19+yL8lOF4
KzI17dZqpW+5yYQxS8jEqbykuylp0jyDVgY8ecHsQ5SX7QtgmerN54FJc/UJvnhZ
1aN/BV6VNcbEpDtefhLMhgOIOUEPnQHpd8wK377W8us/
=jpcn
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First set of IIO fixes for the 4.9 cycle.
* atlas chemical
- Fix alignment of big endian values in a larger storage (by using the right
size storage)
* maxim thermocouple
- Fix alignment of big endian values in larger (by using the correct
sized storage).
* sca3000
- Handle unexpected mode values.
* ti-adc081
- Select IIO_TRIGGERED_BUFFER to avoid build errors
This will result in a random value being reported on big endian architectures.
(thanks to Lars-Peter Clausen for pointing out the effects of this bug)
Only effects a value printed to the log, but as this reports the settings of
the probe in question it may be of direct interest to users.
Also, fixes the following sparse endianness warnings:
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Fixes: e8dd92bfbf ("iio: chemical: atlas-ph-sensor: add EC feature")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
PTR_ERR should access the value just tested by IS_ERR
Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
CC: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Remove pm_runtime_mark_last_busy() call that wasn't need in the probe
since the device should be put to sleep.
Clarification from Matt:
Basically it going to be suspended once pm_runtime_idle() is called,
and setting the last busy is useless and not needed.
Clearly this doesn't affect the device running but just makes the code
more consistent with other uses.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds triggered buffer support for the ti-adc0832 driver. Tested with
ADC0831 and ADC0832 by using SYSFS trigger.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>