[ Upstream commit f88ecccac4 ]
One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes). This is not guaranteed in
this driver which uses a 40 byte array of smaller elements on the stack.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here. We close both issues by
moving to a suitable structure in the iio_priv() data with alignment
explicitly requested. This data is allocated with kzalloc so no
data can leak appart from previous readings.
Fixes: 87aec56e27 ("iio: health: Add driver for the TI AFE4404 heart monitor")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
commit 3f9c6d3879 upstream.
One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes). This is not guaranteed in
this driver which uses a 32 byte array of smaller elements on the stack.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here. We close both issues by
moving to a suitable structure in the iio_priv() data with alignment
explicitly requested. This data is allocated with kzalloc so no
data can leak appart from previous readings.
Fixes: eec96d1e2d ("iio: health: Add driver for the TI AFE4403 heart monitor")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 655 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Based on 3 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 1105 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case, I placed the "fall through"
annotation at the bottom of the case, which is what GCC is expecting
to find.
Addresses-Coverity-ID: 1458342 ("Missing break in switch")
Addresses-Coverity-ID: 1458345 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add GPLv2+ SPDX identifier and update email for author's drivers.
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This resolves the merge issue pointed out by Stephen in
drivers/iio/adc/meson_saradc.c.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As per ABI temperature should be in milli Celsius after scaling,
not Celsius
Note on stable cc. This driver is breaking the standard IIO
ABI. (JC)
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Maxim MAX30105 part adds a third LED (green) and uses a multi-LED
measuring mode producing three measurements
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Current code assumes always 2 measurements (6 bytes) have to be copied,
prepare for more flexibility
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Move the programming of the mode setting from init() to
buffer_postenable()
Split out a separate function to
only update the power/shutdown bit
This changes permits to more easily implement different
modes of measurements in further patches
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Chip must not be in shutdown for reading temperature, so briefly leave
shutdown if buffer is not already running
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stalder <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Table 4 of the datasheet specifies the mode control, these are not
individual bits; add multi LED mode
Add multi-LED mode and fix MODE_MASK (3 bits wide, not 2)
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The equivalent of both of these are now done via macro magic when
the relevant register calls are made. The actual structure
elements will shortly go away.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Quite a bit of outreachy activity here with a driver from a current intern
and a number of cleanup patches as part of the next round.
Getting a pull request in early this cycle as it's looking like another large
cycle for IIO.
New device support
* adxl345
- initial device support. Note, once complete support is done the intent
is to superceded the driver in input/misc.
- bindings.
- conversion from i2c direct calls to regmap and driver split.
- spi support.
* chromeos light and proximity.
- new driver.
* devantech srf04 ultrasonic ranger
- new driver with device tree bindings.
* hid temperature
- new driver for environemntal temperature support from hid devices.
* max30102 oximeter
- new driver with device tree bindings.
* st lsm6dsx
- refactor and addition of device support for lsm6dsl and lsm6ds3h.
Staging graduation
* isl29028 including copyright notice update to reflect Brian's work.
* lpc32xx_adc.
* spear adc. It's not perfect and there are some datasheet disagreements, but
it works and is good enough to graduate.
New features
* documentation
- abi docs for in_proximity_sampling_frequency_available.
- generalise counting direction ABI docs as a second driver is going to
use them.
* hid-sensor-prox
- Add support for HID_USAGE_SENSOR_HUMAN_PRESENCE if used on a particular
device.
* isl29028
- runtime pm.
* meson-saradc
- switch from polling to interrupt mode and improved read_raw_sample function
to avoid unnecessary loop.
* tmp007
- interrupt and threshold event support.
Cleanups and minor fixes
* ad2s1210
- permissions to octal.
* ad7192
- permissions to octal.
- use BIT macro.
* ad9832
- merge header definitions into source file.
* ad9834
- merge header definitions into source file.
* ade7753
- merge header definitions into source file.
- cleanup include ordering.
* ade7854
- simplify return logic.
* adis16201
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16203
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16209
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16240
- permissions to octal.
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adt7136
- permissions to octal.
* cio-dac
- set missing parent device.
* documentation
- update version numbers on sysfs ABI for counter bits that didn't quite.
make 4.9.
* isl29028
- mdelay to msleep.
- incorrrect sleep time when taking first proximity reading.
* lmp91000
- set missing parent device.
* lpc32xx
- Consistent prefixes for defines.
- rename local state structure to _state.
* max30100
- set missing parent device.
* max30102
- set missing parent device.
* maxim-thermocouple
- set missing parent device.
* meter driver header
- permissions to octal.
* pulsedlight-lidar-lite-v2
- set missing parent device.
* quad-8
- set missing parent device.
* st104
- set missing parent device.
Other
* Mailmap
- update Matt Ranostay's email address to the Konsolko one.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAli8K40RHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FogLWBAAoclyQ3AwUecfujFcGx/ZJuba63M+qPIk
SvmUCocnCjfgLI5WnB4J6rMldoD7CMAhrOpFeFuJlr/g6f4WMToJVT6PdHEtMqvB
Rci/ODa9QNDPBpA1sLGCFu704yzBxQTmq53V1d9kZBJ/FxTqwOZamStjKAC2EskX
yuslGGGSdveIYfmBfHIY1VlT2xwuf9xmyhi0STAIn86ViATH/Hhz2xWNBjaHxTrs
gJ6sLGmwh9RYO1KlXSUmbXHd9mWoME2iIsEVGsPzILPkHuHsjvVtjPmQkHB6cT8v
W1OvYJqHz7CbOmcqOVCUbtho/sdw9uhdGkc+Vm9ilxukfVFu9I3cnTTV6um7rj76
/bKf4qB0B/BlXgyfGdGY/gmotSI53sPeG7Vp0nd/5ZmYXKhP4NS+rRB1ipy71nGV
YY/fmgrAobm3wrmWdMUOhBCH/hfN8aSR3S6exJarEejfIpOzu3GeVP8706krKvwO
1HOHBVyJ5gt+WI18kvYC78Mhs5HVeKCSuHf8eJ1bZHOUoVtIHtN4HnF5wCa0on/t
Qu0am0SW596J95EUVMsodNYXUTP6JwcQeKt65VvXSq2jcnqylPT95SuroVqZ3NNH
Lpq7kfjfV4p/n6G9EUE/7+RBXZL0BboI7v8GbIvodfXmFk099mkEbHnpMRffc6XQ
o1TUYqzAQPI=
=rlqq
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.12a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First set of IIO new device support, features and cleanup for the 4.12 cycle.
Quite a bit of outreachy activity here with a driver from a current intern
and a number of cleanup patches as part of the next round.
Getting a pull request in early this cycle as it's looking like another large
cycle for IIO.
New device support
* adxl345
- initial device support. Note, once complete support is done the intent
is to superceded the driver in input/misc.
- bindings.
- conversion from i2c direct calls to regmap and driver split.
- spi support.
* chromeos light and proximity.
- new driver.
* devantech srf04 ultrasonic ranger
- new driver with device tree bindings.
* hid temperature
- new driver for environemntal temperature support from hid devices.
* max30102 oximeter
- new driver with device tree bindings.
* st lsm6dsx
- refactor and addition of device support for lsm6dsl and lsm6ds3h.
Staging graduation
* isl29028 including copyright notice update to reflect Brian's work.
* lpc32xx_adc.
* spear adc. It's not perfect and there are some datasheet disagreements, but
it works and is good enough to graduate.
New features
* documentation
- abi docs for in_proximity_sampling_frequency_available.
- generalise counting direction ABI docs as a second driver is going to
use them.
* hid-sensor-prox
- Add support for HID_USAGE_SENSOR_HUMAN_PRESENCE if used on a particular
device.
* isl29028
- runtime pm.
* meson-saradc
- switch from polling to interrupt mode and improved read_raw_sample function
to avoid unnecessary loop.
* tmp007
- interrupt and threshold event support.
Cleanups and minor fixes
* ad2s1210
- permissions to octal.
* ad7192
- permissions to octal.
- use BIT macro.
* ad9832
- merge header definitions into source file.
* ad9834
- merge header definitions into source file.
* ade7753
- merge header definitions into source file.
- cleanup include ordering.
* ade7854
- simplify return logic.
* adis16201
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16203
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16209
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adis16240
- permissions to octal.
- merge header definitions into source file.
- rename _core.c to .c as there is nothing else.
* adt7136
- permissions to octal.
* cio-dac
- set missing parent device.
* documentation
- update version numbers on sysfs ABI for counter bits that didn't quite.
make 4.9.
* isl29028
- mdelay to msleep.
- incorrrect sleep time when taking first proximity reading.
* lmp91000
- set missing parent device.
* lpc32xx
- Consistent prefixes for defines.
- rename local state structure to _state.
* max30100
- set missing parent device.
* max30102
- set missing parent device.
* maxim-thermocouple
- set missing parent device.
* meter driver header
- permissions to octal.
* pulsedlight-lidar-lite-v2
- set missing parent device.
* quad-8
- set missing parent device.
* st104
- set missing parent device.
Other
* Mailmap
- update Matt Ranostay's email address to the Konsolko one.
Initialize the parent of the IIO device to the device that registered it.
This makes sure that the IIO device appears the right level in the device
hierarchy.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Initialize the parent of the IIO device to the device that registered it.
This makes sure that the IIO device appears the right level in the device
hierarchy.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This resolves the merge errors that were reported in linux-next and it
picks up the staging and IIO fixes that we need/want in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
MAX30102 is an heart rate and pulse oximeter sensor that works using
two LEDS of different wavelengths, and detecting the light reflected
back.
This patchset adds support for both IR and RED LED channels which can
be processed in userspace to determine heart rate and blood oxygen
levels. The MAX30102 part isn't completely register and functional
compatible with the existing MAX30100 driver.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 35ms delays here to use msleep() and
reduce the load on the hrtimer subsystem.
Fixes: commit 4d33615df5 ("iio: light: add MAX30100 oximeter driver support")
Link: http://lkml.org/lkml/2017/1/11/377
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
FIFO was being read every sample after the "almost full" state was
reached. This was due to an incorrect placement of the parenthesis
in the while condition check.
Note - the fixes tag is not actually correct, but the fix in this patch
would also be needed for it to function correctly so we'll go with that
one. Backports should pick up both.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Fixes: b74fccad7 ("iio: health: max30100: correct FIFO check condition")
Cc: Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's. Replace it with i2c
functions to get the correct iio_dev.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's. Replace it with spi
functions to get the correct iio_dev.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
New device support
* ads1015
- add ads1115 support
* bma220 accelerometer
- new driver
- triggered buffer support.
* bmc150
- add bmm150 support.
* bmp280
- bme280 support with addition of humidity channel.
* max5487 potentiometer
- new driver
* MMA7660FC accelerometer.
- New driver
* st-pressure
- support for the lps22hb
* loop trigger.
- This one is *nasty* but we have real applications (parrot drones) where
it is useful. The trigger basically spins as hard as it can firing off
a new trigger each time all triggered devices come back to say they are
done. It doesn't hang a machine even when doing it on a dummy driver.
A lot nicer than having this implemented within lots of device drivers
anyway.
Core stuff
* Add support to create IIO devices via configfs (similar to we did for
triggers a while back) + docs.
* New channel types
- IIO_ELECTRICAL_CONDUCTIVITY
* Couple of MAINTAINERS patches to list the device tree bindings.
* Make trigger ops structure non optional (comment fix). It hasn't been for
an awful long time, but that's not what the description said.
New features
* ak8975
- support adapters that are limited to byte data only by allowing the
emulated block read i2c function that was recently introduced.
* atlas-ph
- support atlas-ec (electrical conductivity sensor)
* bmi160
- add available frequency and scale attributes to make the driver
more user friendly (and avoid having to read the datasheet to know
what will work).
* dummy
- move creation to configfs interface. It's not real hardware so we
are not that worried about the ABI breakage ;)
* mma8452
- oversampling ration support
* nau7802
- expose available gains to make life easier for userspace.
* st-sensors
- allow use of emulation for SMBus block reads as all the st parts support
it.
* ti-ads1015
- list datasheet names to allow their use by inkernel consumers.
* Various module alias additions to help auto probing. Drop one redundant one
as well.
Cleanups
* ad7266, ad7476, ad7887, ad7923, ad799x
- use direct mode claim function rather than open coding it during sensor
read (prevents switching on buffers mid read).
* ad7793, ad7791
- use direct mode claim to prevent frequency changes when buffers running.
* afe440x - These are ABI breaking but the driver requires custom userspace
code to do anything useful anyway and that is still being written and under
control of TI. Ultimately we may have other libraries to do pulse
oximetry with these devices but we aren't aware of any yet.
- kernel-doc format fixes
- drop ifdef fun around of_match_ptr - it's not worth the mess to save
a tiny amount of space.
- drop some unnecessary register initializations.
- drop the weird locked gain modes as they gain us nothing (can just set
all gains separately).
- remove handling of offset attributes seeing as no channels actually have
them (oops)
- Drop the LED3 input channel as it's an alias for ALED2.
- *big one* remove channel names - an experiment that turned out to not
make sense - see patch for details.
- use regmap fields to clean up code.
- tie the tia gain stages to appropriate channels in the ABI as that is
what they really effect. Same with the LED currents.
- cleanout some unused defines and fix a missnamed one.
* atlas-ph
- reorganise to allow support of other similar parts.
* bmc150
- document supported chips in kconfig help.
* jsa1212
- drop an unneeded i2c functionality check for functionality the driver
doesn't use.
* mxs-lradc
- simply touch screen registration code.
- remove the touch screen unregister as all devm based now.
- disable only those channels that are masked in hardware stop (others
are already dealt with elsewhere)
* st-sensors
- unexport st_sensors_get_buffer_element as nothing outside the st-sensors
core driver uses it.
- fix handling of failure to start up regulators.
* tpl0102
- drop an i2c functionality test for features that aren't needed.
* ti-am335x
- use variable name rather than type in sizeof for clarity.
- use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.
Tools
* Add install / uninstall to makefile. Someone cares, so presumably
some people will find it useful!
* generic_buffer
- rename to iio_generic_buffer to line up with other tools.
- handle cleanup when receiving signals
- Add a --device-num option and a --trigger-num option rather than
relying on naming which doesn't work if you have two of the same part.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJXWFXGAAoJEFSFNJnE9BaIQ4kP/jcoVTR8w6EMdcr1BErrvFgm
IMbMMK8wJtc1dhKcp77h/DQjCunPAaDMgdtg1uJcreRDl1dY1jiFh/PMLrt/eods
tsJZcN1h40aLlPEdMQFl3oiaWjpUm23gdDtfiCHA+sM/FhQ+A+83EdonU7hbAGT2
E2NAb5xkC+74WEUit5qEouz++4JRnsJEpBx3A7mwkiUH9RnFA9OflsTdIFSIEbzb
V4yMWeYBAlhwKPy/7z6/hAMK/+Psabw8FppCAw2HcADVpT517rkl4MpvErSZeFGz
cr46+ZWhXZ4PaG2jG2xVLpqSbqLSfWp8uqfj0WavW2gFn/1jCB+FST904q7IPVW2
QPxALqxMAMSzOHxTYmDLfJ4IJ5vvLKroom4ixKgbl7jKXF3+PTooR6U4hGQmLK7K
VKWjb/kIdHpuRT3/pG2kysMtJkk1av5BBZkl9sWUEFgCd4vYP1eB1Ah3aE/P26OH
BCueMDaJqKAzmVa6Dx5MCLlJpxHpQl/OBz5wdXiMRbYeky/QHgzaTmi/HZ0wwXvn
zFHAglWzLq7q0HY+q7wwI20R16cRYIve3HOaLFvQdXd1xpBP1BF+aAxT/vSb+otS
1OWCEHAxq4XEM7VcRKv9XL59gXuSB8ZaSl6k82+IjjfgOqLHh8BSygVle7iu14TE
glokfXQRC7xhgfC1zQf9
=Hq1a
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.8a' 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.8 cycle.
New device support
* ads1015
- add ads1115 support
* bma220 accelerometer
- new driver
- triggered buffer support.
* bmc150
- add bmm150 support.
* bmp280
- bme280 support with addition of humidity channel.
* max5487 potentiometer
- new driver
* MMA7660FC accelerometer.
- New driver
* st-pressure
- support for the lps22hb
* loop trigger.
- This one is *nasty* but we have real applications (parrot drones) where
it is useful. The trigger basically spins as hard as it can firing off
a new trigger each time all triggered devices come back to say they are
done. It doesn't hang a machine even when doing it on a dummy driver.
A lot nicer than having this implemented within lots of device drivers
anyway.
Core stuff
* Add support to create IIO devices via configfs (similar to we did for
triggers a while back) + docs.
* New channel types
- IIO_ELECTRICAL_CONDUCTIVITY
* Couple of MAINTAINERS patches to list the device tree bindings.
* Make trigger ops structure non optional (comment fix). It hasn't been for
an awful long time, but that's not what the description said.
New features
* ak8975
- support adapters that are limited to byte data only by allowing the
emulated block read i2c function that was recently introduced.
* atlas-ph
- support atlas-ec (electrical conductivity sensor)
* bmi160
- add available frequency and scale attributes to make the driver
more user friendly (and avoid having to read the datasheet to know
what will work).
* dummy
- move creation to configfs interface. It's not real hardware so we
are not that worried about the ABI breakage ;)
* mma8452
- oversampling ration support
* nau7802
- expose available gains to make life easier for userspace.
* st-sensors
- allow use of emulation for SMBus block reads as all the st parts support
it.
* ti-ads1015
- list datasheet names to allow their use by inkernel consumers.
* Various module alias additions to help auto probing. Drop one redundant one
as well.
Cleanups
* ad7266, ad7476, ad7887, ad7923, ad799x
- use direct mode claim function rather than open coding it during sensor
read (prevents switching on buffers mid read).
* ad7793, ad7791
- use direct mode claim to prevent frequency changes when buffers running.
* afe440x - These are ABI breaking but the driver requires custom userspace
code to do anything useful anyway and that is still being written and under
control of TI. Ultimately we may have other libraries to do pulse
oximetry with these devices but we aren't aware of any yet.
- kernel-doc format fixes
- drop ifdef fun around of_match_ptr - it's not worth the mess to save
a tiny amount of space.
- drop some unnecessary register initializations.
- drop the weird locked gain modes as they gain us nothing (can just set
all gains separately).
- remove handling of offset attributes seeing as no channels actually have
them (oops)
- Drop the LED3 input channel as it's an alias for ALED2.
- *big one* remove channel names - an experiment that turned out to not
make sense - see patch for details.
- use regmap fields to clean up code.
- tie the tia gain stages to appropriate channels in the ABI as that is
what they really effect. Same with the LED currents.
- cleanout some unused defines and fix a missnamed one.
* atlas-ph
- reorganise to allow support of other similar parts.
* bmc150
- document supported chips in kconfig help.
* jsa1212
- drop an unneeded i2c functionality check for functionality the driver
doesn't use.
* mxs-lradc
- simply touch screen registration code.
- remove the touch screen unregister as all devm based now.
- disable only those channels that are masked in hardware stop (others
are already dealt with elsewhere)
* st-sensors
- unexport st_sensors_get_buffer_element as nothing outside the st-sensors
core driver uses it.
- fix handling of failure to start up regulators.
* tpl0102
- drop an i2c functionality test for features that aren't needed.
* ti-am335x
- use variable name rather than type in sizeof for clarity.
- use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.
Tools
* Add install / uninstall to makefile. Someone cares, so presumably
some people will find it useful!
* generic_buffer
- rename to iio_generic_buffer to line up with other tools.
- handle cleanup when receiving signals
- Add a --device-num option and a --trigger-num option rather than
relying on naming which doesn't work if you have two of the same part.
These definitions are not currently used and if the functionality
they represent is needed the values should be added back to a table
for easy userspace use.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The current channel number for the LEDs should match the stage
number that they are active during, fix this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Currently the TIA gain settings are exported to userspace as sysfs
entries that do not clearly represent their internal relation to the
sampling stages. The gain settings are enabled on a per-stage basis,
this can be seen in figure 24 of the current AFE4404 datasheet.
These gain settings should therefore be tied to the channels that are
read during these stages. Make this change here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
These drivers can use regmap fields to access fields in registers, this
allows us to remove some macros/defines and simplify code, do this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
These AFEs have 4 ADC mesuring stages (called LED2, ALED2, LED1, and
ALED1 in the datasheet), we map these as channels, these stages can serve
different purposes depending on the application. For instance the AFE4404
has an additional LED (LED3), this LED can be timed to be active during
stage 2 (or anystage, but the datasheet describes this case and the name
of the stage reflects this use). This ability is used further in upcoming
parts that tie the front-end gain and the LED timings together. For these
reasons we remove explicit naming the channels.
Without channel names it is best that the index numbers are in order to
match the stage number, reorder the channel numbers.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Input channel LED3 is only an alias for stage ALED2, this virtual channel
does nothing for us, remove this channel.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
No channel in the afe4403 driver has IIO_CHAN_INFO_OFFSET set so
remove the handlers for this.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The LED channels are not scannable and so scan_index should
be negative, fix this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Locking the two gain stages to the same setting adds no value for us,
so initialize them as unlocked and remove the sysfs for unlocking them.
This also allows us to greatly simplify showing and setting the gain
registers.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The drivers set some register values during initialization that can be
set at runtime, these defaults were used in testing but are not
necessary, remove these.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The drivers DT tables are not built-in when OF is not enabled, this does
not save us enough to justify ugly ifdefs. Clean this up.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fix kernel-doc formatting for structs, and while we are making little
fixes, clarify the module description and update the copywrite.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Correct issue that the last entry in FIFO was being read twice due
to an incorrect decrement of entry count variable before condition
check.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The newly added afe4404 driver implements suspend/resume using the
SIMPLE_DEV_PM_OPS() macro, which leaves out references to the actual
functions when CONFIG_PM is disabled, causing a harmless warning:
health/afe4404.c:509:12: error: 'afe4404_suspend' defined but not used
health/afe4404.c:530:12: error: 'afe4404_resume' defined but not used
This marks the functions as __maybe_unused so we don't get those
warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 87aec56e27 ("iio: health: Add driver for the TI AFE4404 heart monitor")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The newly added afe4403 driver implements suspend/resume using the
SIMPLE_DEV_PM_OPS() macro, which leaves out references to the actual
functions when CONFIG_PM is disabled, causing a harmless warning:
health/afe4403.c:509:12: error: 'afe4403_suspend' defined but not used
health/afe4403.c:530:12: error: 'afe4403_resume' defined but not used
This marks the functions as __maybe_unused so we don't get those
warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: eec96d1e2d ("iio: health: Add driver for the TI AFE4403 heart monitor")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The newly added afe4403 driver uses the regmap facility to abstract
the I2C and SPI access. However, it fails to ensure that regmap_spi
is actually present:
drivers/iio/built-in.o: In function `afe4403_probe':
:(.text+0x9bf8): undefined reference to `__devm_regmap_init_spi'
This adds a Kconfig select statement like the afe4404 I2C driver
has.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: eec96d1e2d ("iio: health: Add driver for the TI AFE4403 heart monitor")
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add driver for the TI AFE4403 heart rate monitor and pulse oximeter.
This device detects reflected LED light fluctuations and presents an ADC
value to the user space for further signal processing.
Data sheet located here:
http://www.ti.com/product/AFE4403/datasheet
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add driver for the TI AFE4404 heart rate monitor and pulse oximeter.
This device detects reflected LED light fluctuations and presents an ADC
value to the user space for further signal processing.
Datasheet: http://www.ti.com/product/AFE4404/datasheet
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>