This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously. So this driver
inserts a wait time before reading the conversion register if the
configuration is changed from a previous request.
Currently, the wait time is only the period required for a single
conversion that is calculated as the reciprocal of the sampling frequency.
However we also need to wait for the the previous conversion to complete.
Otherwise we probably get the conversion result for the previous
configuration when the sampling frequency is lower.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
pm_runtime_get_sync() and pm_runtime_put_autosuspend() return 0 on
success, 1 if the device's runtime PM status was already requested status
or error code on failure. So a positive return value doesn't indicate an
error condition.
However, any non-zero return values from buffer preenable and postdisable
callbacks are recognized as an error and this driver reuses the return
value from pm_runtime_get_sync() and pm_runtime_put_autosuspend() in
these callbacks. This change fixes the false error detections.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously. So this driver
doesn't insert a wait time before reading the conversion register if the
configuration is not changed from a previous request.
This assumption is broken if the device is runtime suspended and entered
a power-down state. The forthcoming request causes reading a stale result
from the conversion register as the device is runtime resumed just before.
Fix it by adding a flag to detect that condition and insert a necessary
wait time.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ADS1015 device have two operating modes, continuous conversion mode
and single-shot mode. This driver assumes that the continuous conversion
mode is selected by runtime resume callback when the ADC result is
requested.
If CONFIG_PM is disabled, the device is always in the default single-shot
mode and no one begins a single conversion. So the conversion register
doesn't contain valid ADC result. Fix it by changing the continuous mode
in probe function.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ti-ads1015 driver supports ADS1015 and ADS1115 devices. The same
scale information is used for both devices in this driver, however they
have actually different values and the ADS1115's one is not correct.
These devices have the same full-scale input voltage range for each PGA
selection. So instead of adding another hardcoded scale information,
compute a correct scale on demand from each device's resolution.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ti-ads1015 driver has eight iio voltage channels and each iio channel
can hold own sampling frequency information.
The ADS1015 device only have a single config register which contains an
input multiplexer selection, PGA and data rate settings. So the driver
should load the correct settings when the input multiplexer selection is
changed.
However, regardless of which channlel is currently selected, changing any
iio channel's sampling frequency information immediately overwrites the
current data rate setting in the config register.
It breaks the current data rate setting if the different channel's sampling
frequency information is changed because the data rate setting is not
reloaded when the input multiplexer is switched.
This removes the unexpected config register update and correctly load the
data rate setting before getting adc result.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
ACPI enabled platforms do not have a mean of regulators. Instead we use
hard coded voltage value for reference pin. When value is 0 (default) we
fall back to request a regulator.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Without the triggered buffer code, we get a link error:
drivers/iio/adc/at91-sama5d2_adc.o: In function `at91_adc_probe':
at91-sama5d2_adc.c:(.text+0x938): undefined reference to `devm_iio_triggered_buffer_setup'
This adds a Kconfig 'select' statement like other ADC
drivers have it already.
Fixes: 5e1a1da0f8 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch fix following checkpatch warnings in xadc driver
1. prefer 'unsigned int' to bare use of 'unsigned'.
2. else is not generally useful after a break or return.
3. fill all function definition arguments with identifier name
Signed-off-by: Sai Krishna Potthuri <lakshmis@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
SPI device registered via OF will always match a legacy SPI device ID and
that the MODALIAS reported will always be of the form spi:<device>.
There is an ACPI method to enumerate such devices via specific ACPI ID
and use of compatible strings. It will not work for the drivers which
have no OF match ID table present.
Besides this could change in the future so the correct approach is to
have an OF device ID table if the devices are registered via OF.
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
STM32 ADC allows each channel to be sampled with a different sampling time,
by setting SMPR registers. Basically, value depends on local electrical
properties. Selecting correct value for sampling time highly depends on
analog source impedance. There is a manual that may help in this process:
'How to get the best ADC accuracy in STM32...'
This patch allows to configure minimum sampling time via device tree,
either for:
- all channels at once:
st,min-sample-time-nsecs = <10000>;
- independently for each channel (must match "st,adc-channels" list):
st,adc-channels = <0 1>;
st,min-sample-time-nsecs = <5000 10000>;
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 completely new drivers in this set and plenty of other stuff.
One ABI change due to a silly mistake a long time back. Hopefully no
one will notice. It effects the numerical order of consumer device
channels which was the reverse of the obvious. It's going the slow
way to allow us some margin to spot if we have broken userspace or
not (seems unlikely)
New Device Support
* ccs811
- new driver for the Volatile Organic Compounds (VOC) sensor.
* dln2 adc
- new driver for the ADC on this flexible usb board.
* EP93xx
- new driver for this Cirrus logic SoC ADC.
* ltc2471
- new ADC driver support the ltc2471 and ltc2473
* st_accel
- add trivial table entries to support H3LIS331DL, LIS331DL, LIS3LV02DL.
* st_gyro
- add L3GD20H support (again) having fixed the various things that were
broken in the first try. Includes devicetree binding.
* stm32 dac
- add support for the DACs in the STM32F4 series
Features
* Documentation
- add missing power attribute documentation to the ABI docs.
* at91-sama5d2
- add hardware trigger and buffered capture support with bindings.
- suspend and resume functionality.
* bmc150
- support for the BOSC0200 ACPI device id seen on some tablets.
* hdc100x
- devicetree bindings
- document supported devices
- match table and device ids.
* hts221
- support active low interrupts (with bindings)
- open drain mode with bindings.
* htu21
- OF match table and bindings.
* lsm6dsx
- open drain mode with bindings
* ltc2497
- add support for board file based consumer mapping.
* ms5367
- OF match table and bindings.
* mt7622
- binding document and OF match table.
- suspend and resume support.
* rpr0521
- triggered buffer support.
* tsys01
- OF match table and bindings.
Cleanups and minor fixes
* core
- fix ordering of IIO channels to entry numbers when using
iio_map_array_register rather than reversing them.
- use the new %pOF format specifier rather than full name for the
device tree nodes.
* ad7280a
- fix potential issue with macro argument reuse.
* ad7766
- drop a pointless NULL value check as it's done in the gpiod code.
* adis16400
- unsigned -> unsigned int.
* at91 adc
- make some init data static to reduce code size.
* at91-sama5d2 ADC
- make some init data static to reduce code size.
* da311
- make some init data static to reduce code size.
* hid-sensor-rotation
- drop an unnecessary static.
* hts221
- refactor the write_with_mask code.
- move the BDU configuration to probe time as there is no reason for it
to change.
- avoid overwriting reserved data during power-down. This is a fix, but
the infrastructure need was too invasive to send it to mainline except
in a merge window. It's not a regression as it was always wrong.
- avoid reconfigure the sampling frequency multiple times by just
doing it in the write_raw function directly.
- refactor the power_on/off calls into a set_enable.
- move the dry-enable logic into trig_set_state as that is the only
place it was used.
* ina219
- fix polling of ina226 conversion ready flag.
* imx7d
- add vendor name in kconfig for consistency with similar parts.
* mcp3422
- Change initial channel to 0 as it feels more logical.
- Check for some errors in probe.
* meson-saradc
- add a check of of_match_device return value.
* mpu3050
- allow open drain for any interrupt type.
* rockchip adc
- add check on of_match_device return value.
* sca3000
- drop a trailing whitespace.
* stm32 adc
- make array stm32h7_adc_ckmodes_spec static.
* stm32 dac
- fix an error message.
* stm32 timers
- fix clock name in docs to match reality after changes.
* st_accel
- explicit OF table (spi).
- add missing entries to OF table (i2c).
- rename of_device_id table to drop the part name.
- adding missing lis3l02dq entry to bindings.
- rename H3LIS331DL_DRIVER_NAME to line up with similar entries in driver.
* st_gyro
- explicit OF table (spi).
* st_magn
- explicit OF table (spi).
- enable multiread for lis3mdl.
* st_pressure
- explicit OF table (spi).
* st_sensors common.
- move st_sensors_of_i2c_probe and rename to make it available for spi
drivers.
* tsc3472
- don't write an extra byte when writing the ATIME register.
- add a link to the datasheet.
* tsl2x7x - continued staging cleanups
- add of_match_table.
- drop redundant power_state sysfs attribute.
- drop wrapper tsl2x7x_i2c_read.
- clean up i2c calls made in tsl2x7x_als_calibrate.
- refactor the read and write _event_value callbacks to handle additional
elements.
- use usleep_range instead of mdelay.
- check return value from tsl2x7x_invoke_change.
* zpa2326
- add some newline to the end of logging macros.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAll3oWIRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FoimeBAAs2WBPr8kQZeDfdjNS5isk+GoBJ4btHDL
+BpBODylDku/WIJb7hpBymH2Xs/7qUuYLYwz0P1XVrSo/1kK+krJQR0DUwcracfy
gqMS4KEmgWbhmBV2ksPfCGcoT5rimxLUqpka5+WWAszNtwi7YOt5FadTb9yK4WdG
Di5AzaVLKAUBpQrrHdFPXewxenVs1P/X0ES7fSNU1SIL2bRAaPDj9duu3URivt9l
XRh7qqNpuNMIQ3MmeEeLDJkyeeeWHYdnps/XDfW0i5VElxwZImTPD+AFAoc2E51J
pujvXlu1a6FgMH+hp7hbOxNuf3eKlIq9mrfGre4K6DkTB0gro3oU2bCa5BEq/be1
PrKQZsfkK0KmrLCh0UqwTTcWdorOfussWpZ6Ib4/l4JQEeII/odwyZJ3vHNlm0Gy
0n/TVfNVQEY2zLswWdUOaQ2bvLGaXoeIBH0sMtCPOKks/4u692qZg3LAC1g5mEKF
4ykKG8oJ/UvWcqb00Z1H1qkT+B0ZmOEZzf6M7rFlPKr48DHrbu1YZcoaPYoBxeWP
nL9S0zdygs06HI3/5Rl4Vv7HMTCbKabOp7eamW3IDqRpcW6dLzsXrG/e3YFbvMxq
sGfd3g8jXaf1rlA9qP5FOHdQM2ySoi/WliwShH46LTY17sHSwQd46FYDKn4ZMT4q
6oMBnYOeadg=
=imPz
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.14a' 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.14 cycle.
4 completely new drivers in this set and plenty of other stuff.
One ABI change due to a silly mistake a long time back. Hopefully no
one will notice. It effects the numerical order of consumer device
channels which was the reverse of the obvious. It's going the slow
way to allow us some margin to spot if we have broken userspace or
not (seems unlikely)
New Device Support
* ccs811
- new driver for the Volatile Organic Compounds (VOC) sensor.
* dln2 adc
- new driver for the ADC on this flexible usb board.
* EP93xx
- new driver for this Cirrus logic SoC ADC.
* ltc2471
- new ADC driver support the ltc2471 and ltc2473
* st_accel
- add trivial table entries to support H3LIS331DL, LIS331DL, LIS3LV02DL.
* st_gyro
- add L3GD20H support (again) having fixed the various things that were
broken in the first try. Includes devicetree binding.
* stm32 dac
- add support for the DACs in the STM32F4 series
Features
* Documentation
- add missing power attribute documentation to the ABI docs.
* at91-sama5d2
- add hardware trigger and buffered capture support with bindings.
- suspend and resume functionality.
* bmc150
- support for the BOSC0200 ACPI device id seen on some tablets.
* hdc100x
- devicetree bindings
- document supported devices
- match table and device ids.
* hts221
- support active low interrupts (with bindings)
- open drain mode with bindings.
* htu21
- OF match table and bindings.
* lsm6dsx
- open drain mode with bindings
* ltc2497
- add support for board file based consumer mapping.
* ms5367
- OF match table and bindings.
* mt7622
- binding document and OF match table.
- suspend and resume support.
* rpr0521
- triggered buffer support.
* tsys01
- OF match table and bindings.
Cleanups and minor fixes
* core
- fix ordering of IIO channels to entry numbers when using
iio_map_array_register rather than reversing them.
- use the new %pOF format specifier rather than full name for the
device tree nodes.
* ad7280a
- fix potential issue with macro argument reuse.
* ad7766
- drop a pointless NULL value check as it's done in the gpiod code.
* adis16400
- unsigned -> unsigned int.
* at91 adc
- make some init data static to reduce code size.
* at91-sama5d2 ADC
- make some init data static to reduce code size.
* da311
- make some init data static to reduce code size.
* hid-sensor-rotation
- drop an unnecessary static.
* hts221
- refactor the write_with_mask code.
- move the BDU configuration to probe time as there is no reason for it
to change.
- avoid overwriting reserved data during power-down. This is a fix, but
the infrastructure need was too invasive to send it to mainline except
in a merge window. It's not a regression as it was always wrong.
- avoid reconfigure the sampling frequency multiple times by just
doing it in the write_raw function directly.
- refactor the power_on/off calls into a set_enable.
- move the dry-enable logic into trig_set_state as that is the only
place it was used.
* ina219
- fix polling of ina226 conversion ready flag.
* imx7d
- add vendor name in kconfig for consistency with similar parts.
* mcp3422
- Change initial channel to 0 as it feels more logical.
- Check for some errors in probe.
* meson-saradc
- add a check of of_match_device return value.
* mpu3050
- allow open drain for any interrupt type.
* rockchip adc
- add check on of_match_device return value.
* sca3000
- drop a trailing whitespace.
* stm32 adc
- make array stm32h7_adc_ckmodes_spec static.
* stm32 dac
- fix an error message.
* stm32 timers
- fix clock name in docs to match reality after changes.
* st_accel
- explicit OF table (spi).
- add missing entries to OF table (i2c).
- rename of_device_id table to drop the part name.
- adding missing lis3l02dq entry to bindings.
- rename H3LIS331DL_DRIVER_NAME to line up with similar entries in driver.
* st_gyro
- explicit OF table (spi).
* st_magn
- explicit OF table (spi).
- enable multiread for lis3mdl.
* st_pressure
- explicit OF table (spi).
* st_sensors common.
- move st_sensors_of_i2c_probe and rename to make it available for spi
drivers.
* tsc3472
- don't write an extra byte when writing the ATIME register.
- add a link to the datasheet.
* tsl2x7x - continued staging cleanups
- add of_match_table.
- drop redundant power_state sysfs attribute.
- drop wrapper tsl2x7x_i2c_read.
- clean up i2c calls made in tsl2x7x_als_calibrate.
- refactor the read and write _event_value callbacks to handle additional
elements.
- use usleep_range instead of mdelay.
- check return value from tsl2x7x_invoke_change.
* zpa2326
- add some newline to the end of logging macros.
New driver adding support for ADC found on Cirrus Logic EP93xx series of SoCs.
Board specific code must take care to create plaform device with all necessary
resources.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.
Signed-off-by: Rob Herring <robh@kernel.org>
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>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: linux-iio@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The gpiod API checks for NULL descriptors, so there is no need to
duplicate the check in the driver.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Don't populate array startup_lookup on the stack but instead make
it static. Makes the object code smaller.
Before:
text data bss dec hex filename
21754 5440 128 27322 6aba drivers/iio/adc/at91_adc.o
After:
text data bss dec hex filename
21613 5496 128 27237 6a65 drivers/iio/adc/at91_adc.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Making the const array startup_lookup static rather having it on the
stack saves 69 bytes. Add in missing int specifier to clean up a
checkpatch warning.
Before:
text data bss dec hex filename
10297 2800 128 13225 33a9 drivers/iio/adc/at91-sama5d2_adc.o
After:
text data bss dec hex filename
10140 2888 128 13156 3364 drivers/iio/adc/at91-sama5d2_adc.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.
In case of NULL print error message and return -ENODEV
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.
In case of NULL print error message and return -ENODEV
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for Diolan DLN2 ADC via IIO's ADC interface.
ADC is the fourth and final component of the DLN2 for the kernel.
Signed-off-by: Jack Andersen <jackoalan@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The LTC2741 and LTC2473 are single voltage ADC chips. The LTC2473
is similar to the LTC2471 but outputs a signed differential value.
Datasheet:
http://cds.linear.com/docs/en/datasheet/24713fb.pdf
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
- Add PMBus client driver for IR35221
- Add support for NCT6795D to nct6775 driver
- Functional improvements to adt7475, aspeed-pwm-tacho, and ibmpowernv drivers
- Minor fixes and cleanups in various drivers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJZWYZwAAoJEMsfJm/On5mBCSYP/3GmiLKCS1aTupt31QUlHBw0
yJfoL8RgwbQFR83y2fI679G1dgM1a0fyIBmFCNER5jPuxhbg5ZMb+BqT5SUDYXD8
+isABxmOkWfszze5p6UlQHl5wBg+D+rV9IluxLniT74nKRtlKcIU3ePjii6vpAfK
5rPxqTzwzVNHfDygiCK8DwflS5s8njOUJy1zLXroe4kUvu+NJnZb0nDdkD26zN75
JHYNiqso2UQd2kD3kJgNzJ4t9OGcNWwPse4Y/z0P6YAMEbs8zNuS0MbVURsk17/9
12w8eNOzsmj9m3MGKg9d6c75tG75ZRdsZzUxLEngO1LafKZ7o1YV9DBjIyhVTRxi
nKofp0m/7xw/5R6XhyezL5EYohDFxjTNCT+h+GQoqvG4mZl4piG6ew4t6iG0AmJy
91rXmUdYagXKU+DxNbBNM4MMwXkNHG6+jhufF9g1MTr9K7kLu9URU2gWA7Tm5/1u
/0/Qt+XBr112T+luj8BHVYTiC7iaEhtBWFIFPNeay2+2Jt2nyYLcngiIuJLmwuCe
vyK9i9j5P7jhxS23omzn5Ca8hdUmtOABR5cKOwpPur0yfGLjLAQG+vBW5mYu6yJt
El8QftmRN/PWnEglG+nIJG35RL3XzCl6/CyI//C6tVHJViItUPQl/ZXpZUFXHsFY
TeXRyHZGGcCQtBbsFUoZ
=J5ye
-----END PGP SIGNATURE-----
Merge tag 'hwmon-for-linus-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
- Add PMBus client driver for IR35221
- Add support for NCT6795D to nct6775 driver
- Functional improvements to adt7475, aspeed-pwm-tacho, and ibmpowernv
drivers
- Minor fixes and cleanups in various drivers
* tag 'hwmon-for-linus-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (22 commits)
hwmon: (aspeed-pwm-tacho) Poll with short sleeps.
hwmon: (aspeed-pwm-tacho) reduce fan_tach period
hwmon: (ibmpowernv) Add current(A) sensor
hwmon: (ibmpowernv) introduce a legacy_compatibles array
hwmon: (pwm-fan) Switch to new atomic PWM API
hwmon: (scpi) Fix the scale of SCP sensor readings
hwmon: (aspeed-pwm-tacho) Enable both edge measurement.
hwmon: (ibmpowernv) Add highest/lowest attributes to sensors
hwmon: (pmbus) move header file out of I2C realm
hwmon: (max6639) move header file out of I2C realm
hwmon: (ltc4245) move header file out of I2C realm
hwmon: (ds620) move header file out of I2C realm
hwmon: (ads1015) move header file out of I2C realm
hwmon: (adt7475) temperature smoothing
hwmon: (adt7475) add high frequency support
hwmon: (adt7475) fan stall prevention
hwmon: (adt7475) replace find_nearest() with find_closest()
hwmon: (pmbus) Add client driver for IR35221
hwmon: (nct6775) Add support for NCT6795D
hwmon: (nct6775) Improve fan detection
...
Add missing hooks in the LTC2497 IIO driver to allow hwmon mapping.
Signed-off-by: Gaurav Gupta <gauragup@cisco.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The array stm32h7_adc_ckmodes_spec does not need to be in global scope, so
make it static.
Cleans up sparse warning:
"symbol 'stm32h7_adc_ckmodes_spec' was not declared. Should it be static?"
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Some part of the configuration are not touched after the probe
and if something goes wrong on writing the initial one,
the chip will misbehave.
Adding an error checking ensures that the inital configuration will
be written correctly. Moreover ensures that a sensible configuration
will be saved in driver data and used subsequently as intended.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Reported-by: Maarten Brock <m.brock@vanmierlo.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Initial channel should be the first available channel on
all configurations, so changing to channel 0 available on
all supported chips.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Reported-by: Maarten Brock <m.brock@vanmierlo.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch supports auxadc suspend/resume flow.
Disable auxadc clk and power in suspend function.
Enable axuadc clk and power in resume function.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Added support for suspend/resume functionality for the ADC IP
in sama5d2 SoC.
In order to enter Suspend to ram mode (backup + self refresh mode for
memory), in which the ADC IP is no longer powered, we need to reset the
pins to default state, for the scenario when they are also used for I2C
bus to communicate with the PMIC.
On resume, we need to reconfigure the ADC IP registers and reconfigure the
trigger registers in the case when the suspend procedure is done while
sysfs has the buffer and trigger enabled.
In the case the suspend happens exactly during a software triggered
conversion, the request will time out, because we reset and power down
the ADC.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
While the INA226 has a conversion ready flag (CVRF) in the R/W Mask/Enable
register with read-to-clear semantics, the corresponding bit of the INA219
(CNVR) is part of the bus voltage register. The flag is cleared by reading
the power register.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Added support for the external hardware trigger on pin ADTRG,
integrated the three possible edges into the driver
and created buffer management for data retrieval
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
To keep IMX7D_ADC text consistent with other iio/adc entries, add
the vendor name to the driver menu text.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
A few reverts here. One was a general failure to notice a device was already
supported by another driver. The second is due to a review comment pointing
out that the original patch was a bad idea and would break existing systems.
Reverts
* bma180
- Revert addition of support for the BMA250E it is already supported by
the bmc150-accel and better supported at that. Oops.
* hi8435
- The fix for cleanup of the reset gpio stuff isn't a good way to go. It
breaks systems where an inverting level convertor is used. The right fix
is to make the original devicetree correct - even if it involves patching
the devicetree in kernel.
New Device Support
* stm32-adc
- STM32H7 support and bindings.
Features
* core
- add a hardware triggered operating mode for systems in which the actual
trigger is never seen by the kernel. This is typically only used when
a device 'can' use other triggers, but if a particular magic one is
enabled the interrupt is effectively handled in hardware and we never see
it.
* st-lsm6dsx
- support active low interrupts.
* stm32-adc
- Make the core adc clock optional as not all hardware supported requires it.
- Make the bus clock optional in the per instance driver as it may be shared
by all instances of the ADC and is handled by the core.
- Rework to have a data structure representing the device type specific
elements.
* stm32-trigger (and counter)
- Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
- Add an attribute to configure device modes for quadrature counting etc.
Clean ups and minor fixes
* IIO core.
- use __sysfs_match_string() helper rather than open coding the same.
* ad7791
- use sysfs_match_string() helper rather than open coding the same.
* aspeed-adc
- handle return value of clk_prepare_enable
* cpcap
- Fix default register values and ensure the battery thermistor is enabled
correctly.
- Fix the reported die temperature where we can - docs are lacking.
- Remove the hung interrupt quirk as no longer happens due to fix in the
mfd driver.
* hi8435
- Remove &s from hi8435_info definition as unneeded and inconsistent.
* hid-sensor-trgger
- Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
* ina2xx
- Make the use of iio_info_mask* elements consistent for all channels.
This doesn't have any visible effect, but acts as clear documentation of
which channels various resulting attributes apply to.
* lpc32xx
- handle the return value of clk_prepare_enable.
* meson-saradc
- NULL instead of 0 for pointer.
* mma9551
- use NULL for GPIO connection ID to aid implementation fo ACPI support.
Here the connection ID doesn't actually tell us anything and it is much
easier to deal with the driver if it's not there.
* mpu6050
- Fix lock issues through use of a local mux.
- Replace sprintf with scnprintf as appropriate.
- Check whoami against all known values. This allows for a small number of
boards where we are really fishing for the part not being present at all.
It is unfortunately common to have undescribed changes to use newer chips.
We paper over this but just emitting a warning for those cases as long as
we know about.
* mxs-lradc
- Fix some non static warnings.
* rcar-adc
- Part of making the naming for this part consistent across the kernel.
* st_accel
- drop some spi_device_id entries for variants with no SPI support
* st_magn
- drop some spi_device_id entries for variants with no SPI support.
* sx9500
- Use devm_gpiod_get instead of indexed value with an index of 0 on all
occasions.
* twl4030
- Drop unused twl4030_get_madc_conversion as callers removed now throughout
kernel.
- Unexport twl4030_madc_conversion() as no used only within this driver.
- Drop twl4030_madc_user_params as not used now.
- Drop twl4030_madc_request.func_cb as not used now.
- Fold the twl4030-madc.h header into the driver as no longer used anywhere
else in the kernel.
* xilinx
- Handle the return value of clk_prepare_enable
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAllJSCURHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FogTTQ//bbAzHKB0qTwusFN5jrz1JqjGj3+bMXH/
KumP4nj7NzwKBe4tDe40FsdkZ4c+Um8pK2Aj7iJZojwTcCi02VVjbM++Gj0akMTZ
MIlrEkTvqVsmVFG085hloSiFU2xXfTnfQmp19M9QtyDnHkgBMo9sOFnBK3EG+Se4
NIliUvq8PJzCjTRVafSeSFNoDMwXXQTIKhfq8TDSeOG9o5mCTgAdy8yGiZ2ag/Ok
peFfwauGs9Gg6tRour7UxccawuLnuzPNzwzUUSG3gkdIUTQVD6YHAzXzwblnB5P6
0ZcErJpGSLAYcHQH310ZRTizhhW+vi+ftWUkps81xqpmFp3+EydVnJS0MZXYgM2o
Cv6wbohp9w22I5/B9TMEfL7vnj1i4iZoJfi00Su1HBDHBiNpXISRc/fnkRMWavhr
gvypyxngQmXm1JN/R8UMbJQsSpH3TN07AYF1qx0Tktfyx4S18rdW4hwt+kBNe9ni
5G9xQU8IhmN8yvHMsTvZHbAmbuOR6iaghx3arf65qdHPvKSQ/nTSlran9U1JPvyJ
tWVKtPaY5zEGgkQBmWee+qWkWOBGYDC4nmTwijB0u61Deq+5hGg55cZPd0fSXLMg
6ecNg2v7zrdYldulOpfdNUEOrXa/NYBEAuYUNvccp8DArOqdazkCyO3DlDFDUXRw
RKNE7Btx/rU=
=2fJI
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.13b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of IIO new device support, features and cleanups for the 4.13 cycle.
A few reverts here. One was a general failure to notice a device was already
supported by another driver. The second is due to a review comment pointing
out that the original patch was a bad idea and would break existing systems.
Reverts
* bma180
- Revert addition of support for the BMA250E it is already supported by
the bmc150-accel and better supported at that. Oops.
* hi8435
- The fix for cleanup of the reset gpio stuff isn't a good way to go. It
breaks systems where an inverting level convertor is used. The right fix
is to make the original devicetree correct - even if it involves patching
the devicetree in kernel.
New Device Support
* stm32-adc
- STM32H7 support and bindings.
Features
* core
- add a hardware triggered operating mode for systems in which the actual
trigger is never seen by the kernel. This is typically only used when
a device 'can' use other triggers, but if a particular magic one is
enabled the interrupt is effectively handled in hardware and we never see
it.
* st-lsm6dsx
- support active low interrupts.
* stm32-adc
- Make the core adc clock optional as not all hardware supported requires it.
- Make the bus clock optional in the per instance driver as it may be shared
by all instances of the ADC and is handled by the core.
- Rework to have a data structure representing the device type specific
elements.
* stm32-trigger (and counter)
- Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
- Add an attribute to configure device modes for quadrature counting etc.
Clean ups and minor fixes
* IIO core.
- use __sysfs_match_string() helper rather than open coding the same.
* ad7791
- use sysfs_match_string() helper rather than open coding the same.
* aspeed-adc
- handle return value of clk_prepare_enable
* cpcap
- Fix default register values and ensure the battery thermistor is enabled
correctly.
- Fix the reported die temperature where we can - docs are lacking.
- Remove the hung interrupt quirk as no longer happens due to fix in the
mfd driver.
* hi8435
- Remove &s from hi8435_info definition as unneeded and inconsistent.
* hid-sensor-trgger
- Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
* ina2xx
- Make the use of iio_info_mask* elements consistent for all channels.
This doesn't have any visible effect, but acts as clear documentation of
which channels various resulting attributes apply to.
* lpc32xx
- handle the return value of clk_prepare_enable.
* meson-saradc
- NULL instead of 0 for pointer.
* mma9551
- use NULL for GPIO connection ID to aid implementation fo ACPI support.
Here the connection ID doesn't actually tell us anything and it is much
easier to deal with the driver if it's not there.
* mpu6050
- Fix lock issues through use of a local mux.
- Replace sprintf with scnprintf as appropriate.
- Check whoami against all known values. This allows for a small number of
boards where we are really fishing for the part not being present at all.
It is unfortunately common to have undescribed changes to use newer chips.
We paper over this but just emitting a warning for those cases as long as
we know about.
* mxs-lradc
- Fix some non static warnings.
* rcar-adc
- Part of making the naming for this part consistent across the kernel.
* st_accel
- drop some spi_device_id entries for variants with no SPI support
* st_magn
- drop some spi_device_id entries for variants with no SPI support.
* sx9500
- Use devm_gpiod_get instead of indexed value with an index of 0 on all
occasions.
* twl4030
- Drop unused twl4030_get_madc_conversion as callers removed now throughout
kernel.
- Unexport twl4030_madc_conversion() as no used only within this driver.
- Drop twl4030_madc_user_params as not used now.
- Drop twl4030_madc_request.func_cb as not used now.
- Fold the twl4030-madc.h header into the driver as no longer used anywhere
else in the kernel.
* xilinx
- Handle the return value of clk_prepare_enable
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Rick Altherr <raltherr@google.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use sysfs_match_string() helper instead of open coded variant.
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
twl4030-madc.h is no longer used by anything outside of
the iio driver, so it can be merged into the driver.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This functionality is not used by the IIO subsystem. Due
to removal of legacy API it can also be removed.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
All madc users have been converted to IIO API, so drop the
legacy API. The function is still used inside of the driver.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Drop legacy twl4030_get_madc_conversion() method. It has been
used by drivers to get madc data before it conversion to IIO
API. There are no users in the mainline kernel anymore.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for STM32H7 Analog to Digital Converter. It has up
to 20 external channels, resolution ranges from 8 to 16bits.
Either bus or asynchronous adc clock may be used.
Add registers & bitfields definition. Also add new configuration
options to enter/exit powerdown and perform self-calibration.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
STM32F4 requires one clock per ADC instance for register access. But,
newer version of ADC hardware block have common bus clock for all
instances (per instance driver isn't responsible for getting it).
So, make it optional by default. Still, enforce it's required on STM32F4.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Prepare support for stm32h7 adc variant by introducing compatible
configuration data.
Move STM32F4 specific stuff to compatible data structure:
- registers & bit fields
- input channels data
- start/stop procedures
- trigger definitions
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Analog clock input is mandatory on stm32f4. But newer version of
ADC hardware block allow to select either bus clock or asynchronous
clock, for analog circuitry.
So, make it optional by default, but enforce clk presence on stm32f4.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
meson_sar_adc_clear_fifo passes a 0 as value-pointer to regmap_read().
In case of the meson-saradc driver this ends up in regmap_mmio_read(),
where the value-pointer is de-referenced unconditionally to assign the
value which was read.
Fix this by passing an actual pointer, even though all we want to do is
to discard the value.
As a side-effect this fixes a sparse warning ("Using plain integer as
NULL pointer") as reported by Paolo Cretaro.
Fixes: 3adbf34273 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
Reported-by: Paolo Cretaro <paolocretaro@gmail.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test. Also add NULL test for iores.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
INA226/230/231 has integration times per voltage channel and common
averaging setting for both channels, while the INA219/220 only has a
combined integration time/averaging setting per channel.
Only expose the averaging attribute for the INA226, and expose the correct
integration times for the INA219.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fix sparse warning: Using plain integer as NULL pointer
Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>