Cai Huoqing [Tue, 28 Sep 2021 01:44:02 +0000 (09:44 +0800)]
iio: health: afe4404: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928014403.1563-2-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:44:01 +0000 (09:44 +0800)]
iio: health: afe4403: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928014403.1563-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:40:54 +0000 (09:40 +0800)]
iio: st_lsm9ds0: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928014055.1431-2-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:40:53 +0000 (09:40 +0800)]
iio: st_sensors: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928014055.1431-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:39:01 +0000 (09:39 +0800)]
iio: dac: ti-dac7311: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-8-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:39:00 +0000 (09:39 +0800)]
iio: dac: stm32-dac: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-7-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:59 +0000 (09:38 +0800)]
iio: dac: mcp4922: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-6-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:58 +0000 (09:38 +0800)]
iio: dac: max5821: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-5-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:57 +0000 (09:38 +0800)]
iio: dac: ds4424: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-4-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:56 +0000 (09:38 +0800)]
iio: dac: ltc1660: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://lore.kernel.org/r/20210928013902.1341-3-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:55 +0000 (09:38 +0800)]
iio: dac: lpc18xx_dac: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-2-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Tue, 28 Sep 2021 01:38:54 +0000 (09:38 +0800)]
iio: dac: ad8801: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928013902.1341-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Florian Boor [Thu, 30 Sep 2021 10:42:49 +0000 (12:42 +0200)]
dt-bindings: iio: ad779x: Add binding document
New binding documentation for AD799x series of I²C ADC ICs.
Signed-off-by: Florian Boor <florian.boor@kernelconcepts.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210930104249.2924336-2-florian.boor@kernelconcepts.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Florian Boor [Thu, 30 Sep 2021 10:42:48 +0000 (12:42 +0200)]
iio: adc: ad799x: Implement selecting external reference voltage input on AD7991, AD7995 and AD7999.
Make use of the AD7991_REF_SEL bit and support using the external
reference voltage if 'vref-supply' is present. Use VCC voltage supply
as reference if no extra reference is supplied.
Signed-off-by: Florian Boor <florian.boor@kernelconcepts.de>
Link: https://lore.kernel.org/r/20210930104249.2924336-1-florian.boor@kernelconcepts.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Dan Carpenter [Mon, 4 Oct 2021 13:44:54 +0000 (16:44 +0300)]
iio: adc: max1027: fix error code in max1027_wait_eoc()
Return -ETIMEDOUT on timeout instead of success.
Fixes:
1f7b4048b31b ("iio: adc: max1027: Use the EOC IRQ when populated for single reads")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Sun, 13 Jun 2021 15:10:39 +0000 (16:10 +0100)]
iio: imu: adis16400: Fix buffer alignment requirements.
iio_push_to_buffers_with_timestamp() requires that the buffer
is 8 byte alignment to ensure an inserted timestamp is naturally aligned.
This requirement was not met here when burst mode is in use beause
of a leading u16. Use the new iio_push_to_buffers_with_ts_unaligned()
function that has more relaxed requirements.
It is somewhat complex to access that actual data length, but a
safe bound can be found by using scan_bytes - sizeof(timestamp) so that
is used in this path.
More efficient approaches exist, but this ensure correctness at the
cost of using a bounce buffer.
Fixes:
5075e0720d93 ("iio: imu: adis: generalize burst mode support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613151039.569883-5-jic23@kernel.org
Jonathan Cameron [Sun, 13 Jun 2021 15:10:38 +0000 (16:10 +0100)]
iio: gyro: mpu3050: Fix alignment and size issues with buffers.
Fix a set of closely related issues.
1. When using fifo_values() there was not enough space for the timestamp to
be inserted by iio_push_to_buffers_with_timestamp()
2. fifo_values() did not meet the alignment requirement of
iio_push_to_buffers_with_timestamp()
3. hw_values did not meet the alignment requirement either.
1 and 2 fixed by using new iio_push_to_buffers_with_ts_unaligned() which has
no alignment or space padding requirements.
3 fixed by introducing a structure that makes the space and alignment
requirements explicit.
Fixes:
3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210613151039.569883-4-jic23@kernel.org
Jonathan Cameron [Sun, 13 Jun 2021 15:10:37 +0000 (16:10 +0100)]
iio: adc: ti-adc108s102: Fix alignment of buffer pushed to iio buffers.
Use the newly introduce iio_push_to_buffers_with_ts_unaligned() function
to ensure a bounce buffer is used to provide the required alignment and
space padding needed by the IIO core which requires the timestamp
is naturally aligned. There will be a performance cost to this change
but it will ensure the driver works on platforms that do not support
unaligned 8 byte assignments, and with consumer drivers that may
assume natural alignment of the timestamp.
Issue found as part of an audit of all calls to
iio_push_to_buffers_with_timestamp()
Fixes:
7e87d11c9bda ("iio: adc: Add support for TI ADC108S102 and ADC128S102")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Link: https://lore.kernel.org/r/20210613151039.569883-3-jic23@kernel.org
Jonathan Cameron [Sun, 13 Jun 2021 15:10:36 +0000 (16:10 +0100)]
iio: core: Introduce iio_push_to_buffers_with_ts_unaligned()
Whilst it is almost always possible to arrange for scan data to be
read directly into a buffer that is suitable for passing to
iio_push_to_buffers_with_timestamp(), there are a few places where
leading data needs to be skipped over.
For these cases introduce a function that will allocate an appropriate
sized and aligned bounce buffer (if not already allocated) and copy
the unaligned data into that before calling
iio_push_to_buffers_with_timestamp() on the bounce buffer.
We tie the lifespace of this buffer to that of the iio_dev.dev
which should ensure no memory leaks occur.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613151039.569883-2-jic23@kernel.org
Randy Dunlap [Sat, 2 Oct 2021 23:28:03 +0000 (16:28 -0700)]
iio: chemical: SENSEAIR_SUNRISE_CO2 depends on I2C
Fix kconfig symbol dependency warning:
WARNING: unmet direct dependencies detected for REGMAP_I2C
Depends on [n]: I2C [=n]
Selected by [y]:
- SENSEAIR_SUNRISE_CO2 [=y] && IIO [=y]
Fixes:
c397894e24f1 ("iio: chemical: Add Senseair Sunrise 006-0-007 drive")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: linux-iio@vger.kernel.org
Link: https://lore.kernel.org/r/20211002232803.5108-1-rdunlap@infradead.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Colin Ian King [Fri, 1 Oct 2021 12:00:18 +0000 (13:00 +0100)]
iio: adc: aspeed: Fix spelling mistake "battey" -> "battery"
There is a spelling mistake in a dev_warn message. Fix it.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20211001120018.17570-1-colin.king@canonical.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 19:43:15 +0000 (22:43 +0300)]
iio: adc: ad7291: convert probe to device-managed only
This is a simple conversion for to device-managed with using
devm_request_threaded_irq(), disabling the regulator via a
devm_add_action_or_reset() hook and finally using
devm_iio_device_register().
The i2c_set_clientdata() call is removed as it becomes redundant after this
change.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210926194315.7742-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 19:26:42 +0000 (22:26 +0300)]
iio: adc: Kconfig: add COMPILE_TEST dep for berlin2-adc
Otherwise most build checks will omit this driver from a compile-test due
to it's dependency only on the BERLIN_ARCH symbol.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210926192642.4051329-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 19:26:41 +0000 (22:26 +0300)]
iio: adc: berlin2-adc: convert probe to device-managed only
This driver requires only a devm_add_action_or_reset() hook for the
power-down of the device, and then devm_iio_device_register() can be used
directly.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210926192642.4051329-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 16:28:59 +0000 (19:28 +0300)]
iio: adc: rn5t618-adc: use devm_iio_map_array_register() function
This driver already hooks a similar unwind callback via
devm_add_action_or_reset().
They pretty much do the same thing, so this change converts it to the
devm_iio_map_array_register().
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/20210926162859.3567685-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 16:21:10 +0000 (19:21 +0300)]
iio: adc: max1363: convert probe to full device-managed
For this conversion, the 2 regulators (being enabled) require each a
devm_add_action_or_reset() hook registration.
For the other functions, there are device-managed variants.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210926162110.3536436-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Sun, 26 Sep 2021 15:49:32 +0000 (18:49 +0300)]
iio: adc: nau7802: convert probe to full device-managed
This is a trivial conversion to device-managed functions.
The mutex_destroy() calls are redundant, as the data will be free'd anyway.
And the IRQ and IIO register functions both have device-managed
equivalents.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210926154932.3287590-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nuno Sá [Fri, 3 Sep 2021 14:14:22 +0000 (16:14 +0200)]
iio: adis16460: make use of the new unmasked_drdy flag
The library can now handle enabling/disabling IRQs for devices that
cannot unmask the data ready pin. Hence there's no need to provide an
'enable_irq' callback anymore.
The library will also automatically request the IRQ with 'IRQF_NO_AUTOEN'
so that we can also remove that from the driver.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-5-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nuno Sá [Fri, 3 Sep 2021 14:14:21 +0000 (16:14 +0200)]
iio: adis16475: make use of the new unmasked_drdy flag
The library can now handle enabling/disabling IRQs for devices that
cannot unmask the data ready pin. Hence there's no need to provide an
'enable_irq' callback anymore.
The library will also automatically request the IRQ with 'IRQF_NO_AUTOEN'
so that we can also remove that from the driver.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-4-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nuno Sá [Fri, 3 Sep 2021 14:14:20 +0000 (16:14 +0200)]
iio: adis: handle devices that cannot unmask the drdy pin
Some devices can't mask/unmask the data ready pin and in those cases
each driver was just calling '{dis}enable_irq()' to control the trigger
state. This change, moves that handling into the library by introducing
a new boolean in the data structure that tells the library that the
device cannot unmask the pin.
On top of controlling the trigger state, we can also use this flag to
automatically request the IRQ with 'IRQF_NO_AUTOEN' in case it is set.
So far, all users of the library want to start operation with IRQs/DRDY
pin disabled so it should be fairly safe to do this inside the library.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nuno Sá [Fri, 3 Sep 2021 14:14:19 +0000 (16:14 +0200)]
iio: adis: do not disabe IRQs in 'adis_init()'
With commit
ecb010d441088 ("iio: imu: adis: Refactor adis_initial_startup")
we are doing a HW or SW reset to the device which means that we'll get
the default state of the data ready pin (which is enabled). Hence there's
no point in disabling the IRQ in the init function. Moreover, this
function is intended to initialize internal data structures and not
really do anything on the device.
As a result of this, some devices were left with the data ready pin enabled
after probe which was not the desired behavior. Thus, we move the call to
'adis_enable_irq()' to the initial startup function where it makes more
sense for it to be.
Note that for devices that cannot mask/unmask the pin, it makes no sense
to call the function at this point since the IRQ should not have been
yet requested. This will be improved in a follow up change.
Fixes:
ecb010d441088 ("iio: imu: adis: Refactor adis_initial_startup")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:29:17 +0000 (10:29 +0300)]
iio: adc: da9150-gpadc: convert probe to full-device managed
This change converts the probe of this driver to use device-managed
functions only, which means that the remove hook can be removed.
The remove hook has only 2 calls to iio_device_unregister() and
iio_map_array_unregister(). Both these can now be done via devm register
functions, now that there's also a devm_iio_map_array_register() function.
The platform_set_drvdata() can also be removed now.
This change also removes the error print for when the iio_device_register()
call fails. This isn't required now.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210903072917.45769-6-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:29:16 +0000 (10:29 +0300)]
iio: adc: lp8788_adc: convert probe to full-device managed
This change converts the probe of this driver to use device-managed
functions only, which means that the remove hook can be removed.
The remove hook has only 2 calls to iio_device_unregister() and
iio_map_array_unregister(). Both these can now be done via devm register
functions, now that there's also a devm_iio_map_array_register() function.
The platform_set_drvdata() can also be removed now.
This change also removes the error print for when the iio_device_register()
call fails. This isn't required now.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210903072917.45769-5-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:29:15 +0000 (10:29 +0300)]
iio: adc: axp288_adc: convert probe to full device-managed
This change converts the probe of this driver to use device-managed
functions only, which means that the remove hook can be removed.
The remove hook has only 2 calls to iio_device_unregister() and
iio_map_array_unregister(). Both these can now be done via devm register
functions, now that there's also a devm_iio_map_array_register() function.
The platform_set_drvdata() can also be removed now.
This change also removes the error print for when the iio_device_register()
call fails. This isn't required now.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210903072917.45769-4-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:29:14 +0000 (10:29 +0300)]
iio: adc: intel_mrfld_adc: convert probe to full device-managed
The only call in the remove hook is the iio_map_array_unregister() call.
Since we have a devm_iio_map_array_register() function now, we can use that
and remove the remove hook entirely.
The IIO device was registered with the devm_iio_device_register() prior to
this change.
Also, the platform_set_drvdata() can be removed now, since it was used only
in the remove hook.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210903072917.45769-3-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:29:13 +0000 (10:29 +0300)]
iio: inkern: introduce devm_iio_map_array_register() short-hand function
This change introduces a device-managed variant to the
iio_map_array_register() function. It's a simple implementation of calling
iio_map_array_register() and registering a callback to
iio_map_array_unregister() with the devm_add_action_or_reset().
The function uses an explicit 'dev' parameter to bind the unwinding to. It
could have been implemented to implicitly use the parent of the IIO device,
however it shouldn't be too expensive to callers to just specify to which
device object to bind this unwind call.
It would make the API a bit more flexible.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210903072917.45769-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 25 Jun 2021 07:43:25 +0000 (10:43 +0300)]
iio: adc: fsl-imx25-gcq: initialize regulators as needed
The driver tries to initialize all possible regulators from the DT, then
match the external regulators with each channel and then release all unused
regulators.
We can change the logic a bit to initialize regulators only when at least
one channel needs them.
This change creates a mx25_gcq_ext_regulator_setup() function that is
called only for the external regulators. If there's already a reference to
an external regulator, the function will just exit early with no error.
This way, the driver doesn't need to keep any track of these regulators
during init.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210625074325.9237-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 26 Sep 2021 14:02:30 +0000 (16:02 +0200)]
iio: imu: st_lsm6dsx: move max_fifo_size in st_lsm6dsx_fifo_ops
Move max_fifo_size in st_lsm6dsx_fifo_ops in order to have all
FIFO configuration parameters in st_lsm6dsx_fifo_ops structure.
This patch does not introduce any logic change, just small code
rearrangement.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/3262ad9d9d1497e19ea1bab208c495c2b9a98994.1632664866.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:08 +0000 (13:54 +0200)]
iio: adc: max1027: Don't reject external triggers when there is no IRQ
External triggers do not necessarily need the EOC interrupt to be
populated to work properly. The end of conversion status may either come
from an interrupt or from a sufficient enough extra delay. IRQs are not
mandatory so move the triggered buffer setup out of the IRQ condition
and add the logic to wait enough time for all the requested conversions
to be in the device's FIFO.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-17-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:07 +0000 (13:54 +0200)]
iio: adc: max1027: Allow all kind of triggers to be used
There is no reason to limit this driver to its internal trigger. The
only difference being, when using an external trigger, the sample
conversion must be manually started.
Drop the ->validate_trigger() hook in order to allow other triggers to
be bound.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-16-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:06 +0000 (13:54 +0200)]
iio: adc: max1027: Use the EOC IRQ when populated for single reads
So far the End-Of-Conversion interrupt was only used in conjunction with
the internal trigger to process the data. Let's extend the use of this
interrupt handler to support regular single-shot conversions as well.
Doing so requires writing our own hard IRQ handler. This handler has to
check if buffers are enabled or not:
*** Buffers disabled condition ***
This means the user requested a single conversion and the sample is
ready to be retrieved.
-> This implies adding the relevant completion boilerplate.
*** Buffers enabled condition ***
Triggers are used. So far there is only support for the internal
trigger but this trigger might soon be attached to another device as
well so it is the core duty to decide which handler to call in order
to process the data. The core will decide to either:
* Call the internal trigger handler which will extract the data that
is already present in the ADC FIFOs
or
* Call the trigger handler of another driver when using this trigger
with another device, even though this call will be slightly delayed
by the fact that the max1027 IRQ is a data-ready interrupt rather
than a real trigger:
-> The new handler will manually inform the core about the trigger
having transitioned by directly calling iio_trigger_poll() (which
iio_trigger_generic_data_rdy_poll() initially did).
In order for the handler to be "source" agnostic, we also need to change
the private pointer and provide the IIO device instead of the trigger
object.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-15-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:05 +0000 (13:54 +0200)]
iio: adc: max1027: Stop requesting a threaded IRQ
The threaded handler is not populated, this means there is nothing
running in process context so let's switch to the regular
devm_request_irq() call instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-14-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:04 +0000 (13:54 +0200)]
iio: adc: max1027: Introduce an end of conversion helper
For now this helper only waits for the maximum duration of a single
conversion.
In practice, a "temperature measurement" will take twice this
time because it will also carry another analog conversion but as here we
will only care about the temperature conversion which happens first, we
can still only wait for a single sample and get the right data.
This helper will soon be improved to properly handle the end of
conversion interrupt as well as a higher number of samples.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-13-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:03 +0000 (13:54 +0200)]
iio: adc: max1027: Separate the IRQ handler from the read logic
Create a max1027_read_scan() helper which will make clearer the future IRQ
handler updates (no functional change).
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-12-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:02 +0000 (13:54 +0200)]
iio: adc: max1027: Prevent single channel accesses during buffer reads
When hardware buffers are enabled (the cnvst pin being the trigger), one
should not mess with the device state by requesting a single channel
read.
There is already a iio_buffer_enabled() check in *_read_single_value()
to merely prevent this situation but the check is inconsistent since
buffers can be enabled after the if clause anyway. Instead, use the core
mutex by calling iio_device_claim/release_direct_mode().
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-11-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:01 +0000 (13:54 +0200)]
iio: adc: max1027: Create a helper to configure the channels to scan
These bits are meant to be reused for triggered buffers setup.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-10-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:54:00 +0000 (13:54 +0200)]
iio: adc: max1027: Ensure a default cnvst trigger configuration
We don't expect the (hardware) cnvst trigger to be enabled at boot time,
this is a user choice made in sysfs and there is a dedicated callback to
enable/disable this trigger. Hence, we can just ensure it is disabled in
the probe at initialization time and then assume that whenever a
->read_raw() call happens, the trigger has been disabled and conversions
will start on register write.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-9-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:59 +0000 (13:53 +0200)]
iio: adc: max1027: Simplify the _set_trigger_state() helper
The call to max1027_enable_trigger() is the same in both cases thanks to
the 'state' variable, so factorize a little bit to simplify the code and
explain why we call this helper.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-8-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:58 +0000 (13:53 +0200)]
iio: adc: max1027: Create a helper to enable/disable the cnvst trigger
There are two ways to physically trigger a conversion:
- A falling edge on the cnvst pin
- A write operation on the conversion register
Let's create a helper for this.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210921115408.66711-7-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:57 +0000 (13:53 +0200)]
iio: adc: max1027: Rename a helper
Make it clear that the *_set_trigger_state() hook is responsible for
cnvst based conversions by renaming the helper. This may avoid
confusions with software trigger support that is going to be
introduced.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210921115408.66711-6-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:56 +0000 (13:53 +0200)]
iio: adc: max1027: Minimize the number of converted channels
Provide a list of ->available_scan_masks which match the device's
capabilities. Basically, these devices are able to scan from 0 to N, N
being the highest voltage channel requested by the user. The temperature
can be included or not, but cannot be retrieved alone.
The consequence is, instead of reading and pushing to the IIO buffers
all channels each time, the "minimum" number of channels will be scanned
and pushed based on the ->active_scan_mask.
For example, if the user wants channels 1, 4 and 5, all channels from
0 to 5 will be scanned and pushed to the IIO buffers. The core will then
filter out the unneeded samples based on the ->active_scan_mask that has
been selected and only channels 1, 4 and 5 will be available to the user
in the shared buffer.
Provide a comment in the code explaining this logic.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-5-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:55 +0000 (13:53 +0200)]
iio: adc: max1027: Drop useless debug messages
These two debug messages bring absolutely no value, let's drop them.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-4-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:54 +0000 (13:53 +0200)]
iio: adc: max1027: Drop extra warning message
Memory allocation errors automatically trigger the right logs, no need
to have our own.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210921115408.66711-3-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Tue, 21 Sep 2021 11:53:53 +0000 (13:53 +0200)]
iio: adc: max1027: Fix style
Follow checkpatch.pl's main advices before hacking into the driver, mainly:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int *' to bare use of 'unsigned *'
CHECK: Comparison to NULL could be written "!foo"
CHECK: Alignment should match open parenthesis
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-2-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Sat, 25 Sep 2021 02:05:47 +0000 (10:05 +0800)]
MAINTAINERS: Add the driver info of the NXP IMX8QXP
The NXP i.MX 8QuadXPlus SOC has a new ADC IP. After adding
the driver support for it, I add the driver info of the
NXP IMX8QXP ADC to MAINTAINERS file.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210925020555.129-4-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Sat, 25 Sep 2021 02:05:46 +0000 (10:05 +0800)]
dt-bindings: iio: adc: Add binding documentation for NXP IMX8QXP ADC
The NXP i.MX 8QuadXPlus SOC a new ADC IP, so add
binding documentation for NXP IMX8QXP ADC.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210925020555.129-3-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Sat, 25 Sep 2021 02:05:45 +0000 (10:05 +0800)]
iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC
The NXP i.MX 8QuadXPlus SOC has a new ADC IP, so add
driver support for this ADC.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210925020555.129-2-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Sean Nyekjaer [Mon, 20 Sep 2021 11:42:21 +0000 (13:42 +0200)]
iio: accel: fxls8962af: add wake on event
This adds ways for the SoC to wake from accelerometer wake events.
In the suspend function we skip disabling the sensor if wakeup-source
and events are activated.
If buffered reads are enabled they will be deactivated before suspend.
As the onboard buffer is only holding up to 32 12-bit X/Y/Z data
triplets.
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210920114221.1595543-2-sean@geanix.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Sean Nyekjaer [Mon, 20 Sep 2021 11:42:20 +0000 (13:42 +0200)]
iio: accel: fxls8962af: add threshold event handling
Add event channels that control the creation of motion events.
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20210920114221.1595543-1-sean@geanix.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:20 +0000 (16:15 +0800)]
iio: adc: aspeed: Get and set trimming data.
The ADC controller has a trimming register for fine-tune the reference
voltage. The trimming value comes from the OTP register which will be
written during chip production. This patch will read this OTP value and
configure it to the ADC register when the ADC controller probes and using
dts property "aspeed,trim-data-valid" to determine whether to execute this
flow.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-12-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:19 +0000 (16:15 +0800)]
iio: adc: aspeed: Support battery sensing.
In ast2600, ADC integrate dividing circuit at last input channel for
battery sensing. This patch use the dts property "battery-sensing" to
enable this feature makes the last channel of each adc can tolerance
higher voltage than reference voltage. The offset interface of ch7 will
be separated when enabling the battery sensing mode.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-11-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:18 +0000 (16:15 +0800)]
iio: adc: aspeed: Add compensation phase.
This patch adds a compensation phase to improve the accuracy of ADC
measurement. This is the built-in function through input half of the
reference voltage to get the ADC offset.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-10-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:17 +0000 (16:15 +0800)]
iio: adc: aspeed: Add func to set sampling rate.
Add the function to set the sampling rate and keep the sampling period
for a driver used to wait the fresh value.
In addition, since the ADC clock is required when initializing the ADC
device, move clk_prepare_enable ahead of the initialization phase.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-9-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:16 +0000 (16:15 +0800)]
iio: adc: aspeed: Fix the calculate error of clock.
The ADC clock formula is
ast2400/2500:
ADC clock period = PCLK * 2 * (ADC0C[31:17] + 1) * (ADC0C[9:0] + 1)
ast2600:
ADC clock period = PCLK * 2 * (ADC0C[15:0] + 1)
They all have one fixed divided 2 and the legacy driver didn't handle it.
This patch register the fixed factory clock device as the parent of ADC
clock scaler to fix this issue.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-8-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:15 +0000 (16:15 +0800)]
iio: adc: aspeed: Support ast2600 adc.
Make driver to support ast2600 adc device.
- Use shared reset controller
- Complete the vref configure function
- Add the model data for ast2600 adc
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-7-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:14 +0000 (16:15 +0800)]
iio: adc: aspeed: Use devm_add_action_or_reset.
This patch use devm_add_action_or_reset to handle the error in probe
phase.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-6-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:13 +0000 (16:15 +0800)]
iio: adc: aspeed: Use model_data to set clk scaler.
This patch uses need_prescaler and scaler_bit_width to set the ADC clock
scaler.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-5-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:12 +0000 (16:15 +0800)]
iio: adc: aspeed: Add vref config function
Add the function to check the vref_fixed_mv and set the value to driver
data.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-4-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:11 +0000 (16:15 +0800)]
iio: adc: aspeed: Restructure the model data
This patch refactors the model data structure to distinguish the
function form different versions of aspeed ADC.
- Rename the vref_voltage to vref_fixed_mv and add vref_mv driver data
When driver probe will check vref_fixed_mv value and store it to vref_mv
which isn't const value.
- Add num_channels
Make num_channles of iio device can be changed by different model_data
- Add need_prescaler flag and scaler_bit_width
The need_prescaler flag is used to tell the driver the clock divider needs
another Prescaler and the scaler_bit_width to set the clock divider
bitfield width.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-3-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Wed, 22 Sep 2021 08:15:10 +0000 (16:15 +0800)]
iio: adc: aspeed: Keep model data to driver data.
Keep the model data pointer to driver data for reducing the usage of
of_device_get_match_data().
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210922081520.30580-2-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jacopo Mondi [Mon, 20 Sep 2021 13:54:13 +0000 (15:54 +0200)]
iio: ABI: Document in_concentration_co2_scale
Document the 'in_concentration_co2_scale' standard IIO attribute.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Link: https://lore.kernel.org/r/20210920135413.140310-5-jacopo+renesas@jmondi.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jacopo Mondi [Mon, 20 Sep 2021 13:54:12 +0000 (15:54 +0200)]
iio: chemical: Add Senseair Sunrise 006-0-007 driver
Add support for the Senseair Sunrise 006-0-0007 driver through the
IIO subsystem.
Datasheet: https://rmtplusstoragesenseair.blob.core.windows.net/docs/Dev/publicerat/TDE5531.pdf
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Link: https://lore.kernel.org/r/20210920135413.140310-4-jacopo+renesas@jmondi.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jacopo Mondi [Mon, 20 Sep 2021 13:54:11 +0000 (15:54 +0200)]
iio: ABI: docs: Document Senseair Sunrise ABI
Add documentation for the sysfs attributes of the sunrise_co2 driver.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Link: https://lore.kernel.org/r/20210920135413.140310-3-jacopo+renesas@jmondi.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jacopo Mondi [Mon, 20 Sep 2021 13:54:10 +0000 (15:54 +0200)]
dt-bindings: iio: chemical: Document senseair,sunrise CO2 sensor
Add documentation for the Senseair Sunrise 006-0-0007 CO2 NDIR sensor.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210920135413.140310-2-jacopo+renesas@jmondi.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Heidelberg [Mon, 13 Sep 2021 18:19:49 +0000 (20:19 +0200)]
dt-bindings: iio: magnetometer: asahi-kasei,ak8975 add vid reg
Driver and device-tree also use vid-supply regulator.
Fixes:
7e000fbff7a0 ("dt-bindings: iio: magnetometer: ak8975: convert format to yaml, add maintainer")
Signed-off-by: David Heidelberg <david@ixit.cz>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210913181949.83179-1-david@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Heidelberg [Sun, 19 Sep 2021 20:36:56 +0000 (22:36 +0200)]
dt-bindings: iio: kionix,kxcjk1013: driver support interrupts
Device has interrupts support, which description was missing in the bindings.
Signed-off-by: David Heidelberg <david@ixit.cz>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210919203656.119742-1-david@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Krzysztof Kozlowski [Fri, 24 Sep 2021 13:35:15 +0000 (15:35 +0200)]
iio: adc: exynos: describe drivers in KConfig
Describe better which driver applies to which SoC, to make configuring
kernel for Samsung SoC easier.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210924133515.112357-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Wed, 8 Sep 2021 10:56:30 +0000 (18:56 +0800)]
iio: adc: rockchip_saradc: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210908105631.1474-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Wed, 8 Sep 2021 10:56:38 +0000 (18:56 +0800)]
iio: dac: stm32-dac: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210908105638.1525-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Daniel Palmer [Sun, 19 Sep 2021 07:26:16 +0000 (16:26 +0900)]
iio: accel: mma7660: Mark acpi match table as maybe unused
When building kernels without ACPI support the table is declared
but is not used because ACPI_PTR() turns it into a NULL.
Add the __maybe_unused attribute to stop the compiler whining.
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Link: https://lore.kernel.org/r/20210919072616.3849723-1-daniel@0x0f.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 13 Sep 2021 12:00:02 +0000 (15:00 +0300)]
iio: light: max44000: use device-managed functions in probe
This is a simple conversion. Both iio_device_register() and
iio_triggered_buffer_setup() functions have device-managed variants.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913120002.306280-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 13 Sep 2021 11:53:08 +0000 (14:53 +0300)]
iio: gyro: adis16080: use devm_iio_device_register() in probe
There is nothing else that needs to be done for this driver. The remove
hook calls only the iio_device_unregister() hook.
So this driver can use devm_iio_device_register() directly.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913115308.301877-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 13 Sep 2021 11:52:37 +0000 (14:52 +0300)]
iio: dac: ad5064: convert probe to full device-managed
This change converts the probe of the AD5064 driver to use only
device-managed functions.
The regulator_bulk_disable() is passed on a devm_add_action_or_reset() hook
and the devm_iio_device_register() can be used to register the IIO device.
The driver has both I2C and SPI hooks inside, so all these can be removed.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913115237.301310-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 13 Sep 2021 11:52:09 +0000 (14:52 +0300)]
staging: iio: ad9832: convert probe to device-managed
This change does a conversion of the driver to use device-managed init
functions. The 2 regulators and the clock inits are converted to use
devm_add_action_or_reset() callbacks for de-initializing them when the
driver unloads.
And finally the devm_iio_device_register() function can be use to register
the device.
The remove hook can finally be removed and the spi_set_drvdata() call can
also be removed as the private data is no longer used.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913115209.300665-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 13 Sep 2021 11:51:21 +0000 (14:51 +0300)]
iio: dac: ad7303: convert probe to full device-managed
For this conversion, the regulators need to have some cleanup hooks
registered with devm_add_action_or_reset() and then the
devm_io_device_register() call can be used.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913115121.300082-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Daniel Palmer [Mon, 13 Sep 2021 11:29:13 +0000 (20:29 +0900)]
iio: imu: inv_mpu6050: Mark acpi match table as maybe unused
When building kernels without ACPI support the table is declared
but is not used because ACPI_PTR() turns it into a NULL.
Add the __maybe_unused attribute to stop the compiler whining.
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Link: https://lore.kernel.org/r/20210913112913.2148026-1-daniel@0x0f.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cai Huoqing [Wed, 8 Sep 2021 10:56:45 +0000 (18:56 +0800)]
iio: ep93xx: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210908105646.1576-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Puranjay Mohan [Fri, 3 Sep 2021 18:43:12 +0000 (00:13 +0530)]
iio: accel: adxl355: Add triggered buffer support
Provide a way for continuous data capture by setting up buffer support. The
data ready signal exposed at the DRDY pin of the ADXL355 is exploited as
a hardware interrupt which triggers to fill the buffer.
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Link: https://lore.kernel.org/r/20210903184312.21009-3-puranjay12@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Puranjay Mohan [Fri, 3 Sep 2021 18:43:11 +0000 (00:13 +0530)]
iio: accel: adxl355: use if(ret) in place of ret < 0
Replace if(ret < 0) with if(ret) for consistency.
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Link: https://lore.kernel.org/r/20210903184312.21009-2-puranjay12@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lucas Stankus [Wed, 1 Sep 2021 19:14:54 +0000 (16:14 -0300)]
iio: accel: Add driver support for ADXL313
ADXL313 is a small, thin, low power, 3-axis accelerometer with high
resolution measurement up to +/-4g. It includes an integrated 32-level
FIFO and has activity and inactivity sensing capabilities.
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL313.pdf
Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/d16e2d1967e46bb2b1024b6d23bc4889da77dc6b.1630523106.git.lucas.p.stankus@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lucas Stankus [Wed, 1 Sep 2021 19:14:28 +0000 (16:14 -0300)]
dt-bindings: iio: accel: Add binding documentation for ADXL313
Add device tree binding documentation for ADXL313 3-axis accelerometer.
Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/2eff22d1d22f7e72efdabdc681d02e922682c434.1630523106.git.lucas.p.stankus@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Tue, 31 Aug 2021 07:14:46 +0000 (15:14 +0800)]
iio: adc: aspeed: completes the bitfield declare.
This patch completes the declare of ADC register bitfields and uses the
same prefix ASPEED_ADC_* for these bitfields. In addition, tidy up space
alignment of the codes.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210831071458.2334-4-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Billy Tsai [Tue, 31 Aug 2021 07:14:45 +0000 (15:14 +0800)]
dt-bindings: iio: adc: Add ast2600-adc bindings
Add device tree bindings document for the aspeed ast2600 adc device
driver.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210831071458.2334-3-billy_tsai@aspeedtech.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 3 Sep 2021 07:37:07 +0000 (10:37 +0300)]
iio: adc: ti-ads8344: convert probe to device-managed
This change converts the driver to register via devm_iio_device_register().
The regulator disable is moved on a devm_add_action_or_reset() hook.
And the spi_set_drvdata() isn't required anymore.
And finally, the ads8344_remove() can be removed as well.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210903073707.46892-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:11 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: update copyright and authors information
Update copyright and authors information (corrected e-mail address), and
add myself as one of the authors.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-9-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:10 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: add support for sama7g5 device
Add support to sama7g5 ADC which is similar with sama5d2/sam9x60 device.
Differences are highlighted by compatible.
Main differences include 16 channels instead of 12 and missing
resistive touchscreen.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-8-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:09 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: add helper for COR register
Add helper for the COR register. This helper allows to modify the COR
register, removes duplicate code and improves readability.
The COR offset is now part of the register layout. This will allow
different platform with a different offset to use the same helper.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-7-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:08 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: add support for separate end of conversion registers
Some platforms have separated the end-of-conversion information from the
usual ISR/IMR/IER/IDR registers, into EOC_ISR/EOC_IMR/EOC_IER/EOC_IDR.
To cope with both variants, helpers are being added, that will make
code more clear and more easy to read.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-6-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:07 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: convert to platform specific data structures
Convert the driver to platform specific structures. This means:
- create a register layout struct that will hold offsets for registers
- create a platform struct that will hold platform information (number of
channels, indexes for different channels and pointer to layout struct)
- convert specific macros that are platform dependent into platform variables
This step is in fact a no-op, but allows the driver to be more flexible
and for future enhancement including adding new platforms that are partly
compatible with the current driver and differ slightly in register layout
or capabilities for example.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-5-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Eugen Hristev [Wed, 1 Sep 2021 12:30:06 +0000 (15:30 +0300)]
iio: adc: at91-sama5d2_adc: remove unused definition
Remove unused register definition
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-4-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>