Jakob Hauser
0ca09faade
iio: magnetometer: yas530: Change data type of calibration coefficients
...
This is a preparation for adding YAS537 variant.
YAS537 uses other data types on the calibration coefficients [1] than YAS530 [2]
and YAS532 [3].
On YAS537, at least for a4 and a7 this could matter because 8-bit unsigned data
from the register gets stored into a signed data type, therefore this should be
8-bit as well.
For YAS530/532, on the other hand, it doesn't seem to matter. The size of a2-a9
and k is smaller than 8-bit at extraction, also the applied math is low. And
Cx/Cy1/Cy2, now being defined as signed 16-bit, are extracted as unsigned 8-bit
and undergo only minor math.
[1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas537.c#L76-L78
[2] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas_mag_driver-yas530.c#L526-L527
[3] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L76-L77
Signed-off-by: Jakob Hauser <jahau@rocketmail.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/f1e53bd6672aebe59f9b236b41374482edf888f8.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Jakob Hauser
8239f904f9
iio: magnetometer: yas530: Correct temperature handling
...
The raw temperature value is a number of counts from a certain starting
point. The resolution of the temperature counts is different for the YAS
variants.
Temperature compensation for YAS532 version AC seems to be handled differently.
It uses the deviation from 20 degree Celsius [1] whereas YAS530 and older
versions of YAS532 apply solely the t value as a multiplier [2][3].
In funtion yas5xx_read_raw(), add case IIO_CHAN_INFO_PROCESSED. Remove scale
of temperature as this isn't applied.
Additionally correct sign of temperature channel in iio_chan_spec. It's already
defined that way in the yas5xx_get_measure() function.
[1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L442
[2] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas_mag_driver-yas530.c#L881-L883
[3] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-18.1/drivers/sensors/geomagnetic/yas_mag_driver-yas53x.c#L856-L858
Signed-off-by: Jakob Hauser <jahau@rocketmail.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/eb45f328c7a81eb622c6a8cfc5c468ea58bbdace.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Jakob Hauser
413cf69163
iio: magnetometer: yas530: Correct scaling of magnetic axes
...
Looks like YAS530 raw values return picotesla and YAS532 nanotesla. Adapt
comments and scaling.
Signed-off-by: Jakob Hauser <jahau@rocketmail.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/053ab05cb9a0f6b0536ab5e0de57009f513c6f81.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Jakob Hauser
4efdfbc16c
iio: magnetometer: yas530: Change range of data in volatile register
...
In function yas5xx_volatile_reg(), register "YAS5XX_MEASURE_DATA + 8" shouldn't
be volatile as we count from 0 to 7 here.
Instead of lowering the number from 8 to 7, the operator "<=" is replaced by
"<". The size of the measure data array is 8, therefore it's more natural to
use 8 as a constant.
This change is of low importance as the "+ 8" register isn't called.
Signed-off-by: Jakob Hauser <jahau@rocketmail.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/dabba10feb80171350525ac874f944076c46e084.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Jakob Hauser
e137fafc89
iio: magnetometer: yas530: Change data type of hard_offsets to signed
...
The "hard_offsets" are currently unsigned u8 but they should be signed as they
can get negative. They are signed in function yas5xx_meaure_offsets() and in the
Yamaha drivers [1][2].
[1] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas.h#L156
[2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L91
Fixes: de8860b1ed ("iio: magnetometer: Add driver for Yamaha YAS530")
Signed-off-by: Jakob Hauser <jahau@rocketmail.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/40f052bf6491457d0c5c0ed4c3534dc6fa251c3c.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Crt Mori
ef6d997667
dt-bindings: iio: mlx90632 Add supply regulator documentation
...
Document the newly added vdd supply option.
Signed-off-by: Crt Mori <cmo@melexis.com >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20220808144936.1559158-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Crt Mori
21a60fce89
iio: temperature: mlx90632 Add supply regulator to sensor
...
Provide possibility to toggle power supply to the sensor so that user
can optimize their setup and not have the sensor constantly powered.
Signed-off-by: Crt Mori <cmo@melexis.com >
Link: https://lore.kernel.org/r/20220808144908.1559069-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Uwe Kleine-König
33dae107b6
iio: imu: adis16475: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:03 +01:00
Uwe Kleine-König
129a90cf81
iio: frequency: adrf6780: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
3ea5b370af
iio: frequency: adf4371: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
72336966ee
iio: adc: xilinx-xadc: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
40c0c1312c
iio: adc: xilinx-ams: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
dcb9bd105c
iio: adc: ti-ads131e08: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
4004912e0c
iio: adc: lpc18xx: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
51f2f910a5
iio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify
...
Make use of devm_clk_get_prepared() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
cdd07b3ab9
iio: adc: ad9467: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
25f7e79515
iio: adc: ad7768-1: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Uwe Kleine-König
8bbce0954f
iio: adc: ad7124: Benefit from devm_clk_get_enabled() to simplify
...
Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20220808204740.307667-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:02 +01:00
Jonathan Cameron
71041f73dc
iio: magn: hmc5843: Move struct dev_pm_ops out of header
...
Having this structure defined static in the header lead to
unnecessary duplication and required additional symbol exports.
Use the EXPORT_NS_SIMPLE_DEV_PM_OPS() to clean this up in the same
fashion as many other drivers do this.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807184534.1037363-3-jic23@kernel.org
2022-08-15 22:30:02 +01:00
Jonathan Cameron
c3b4afb182
iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver
...
This formatting is odd, so fix it to be more standard.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807184534.1037363-2-jic23@kernel.org
2022-08-15 22:30:02 +01:00
Jonathan Cameron
1c4986f7e1
iio: adc: mt6360: Drop an incorrect __maybe_unused marking.
...
Given the struct platform_driver has one of it's elements assigned to
point to the of_device_id table, it is never going to be unused.
Drop the marking.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Cc: Gene Chen <gene_chen@richtek.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807162121.862894-1-jic23@kernel.org
2022-08-15 22:30:02 +01:00
Jonathan Cameron
4c0babbd97
staging: iio: resolver: ad2s1210: Fix alignment for DMA safety
...
____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1. Switch to the updated
IIO_DMA_MINALIGN definition. As the tx[] an rx[] buffers are only used
in the same SPI exchanges, we should be safe with them on the same cacheline.
Hence only mark the first one __aligned(IIO_DMA_MINALIGN).
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807151218.656881-5-jic23@kernel.org
2022-08-15 22:30:02 +01:00
Jonathan Cameron
48a1319164
staging: iio: meter: ade7854: Fix alignment for DMA safety
...
____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1. Switch to the updated
IIO_DMA_MINALIGN definition.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com >
Link: https://lore.kernel.org/r/20220807151218.656881-4-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
e48668a38b
staging: iio: frequency: ad9834: Fix alignment for DMA safety
...
____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1. Switch to the updated
IIO_DMA_MINALIGN definition.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807151218.656881-3-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
282d16b628
iio: light: cm32181: Mark the dev_pm_ops static.
...
Only accessed from the local file.
Warning:
drivers/iio/light/cm32181.c:508:1: warning: symbol 'cm32181_pm_ops' was not declared. Should it be static?
Fixes: 68c1b3dd5c ("iio: light: cm32181: Add PM support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807145457.646062-3-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
89aba57598
iio: test: Mark file local structure arrays static.
...
Warning cleanup:
drivers/iio/test/iio-test-rescale.c:32:30: warning: symbol 'scale_cases' was not declared. Should it be static?
drivers/iio/test/iio-test-rescale.c:480:30: warning: symbol 'offset_cases' was not declared. Should it be static?
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Cc: Liam Beguin <liambeguin@gmail.com >
Reviewed-by: Liam Beguin <liambeguin@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220807145457.646062-2-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Francesco Dolcini
becbe550a3
dt-bindings: iio: adc: stmpe: Remove node name requirement
...
STMPE driver does not require a specific node name anymore, only the
compatible is checked, update binding according to this.
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20220712163345.445811-5-francesco.dolcini@toradex.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:01 +01:00
Jonathan Cameron
40b5c4d5b5
iio: cdc: ad7746: Move driver out of staging.
...
All known major issues with this driver resolved so time to move
it out of staging. This also allows us to remove the now empty
staging/iio/cdc directory and build files.
Note this cleanup work was done using the roadtest framework.
https://lore.kernel.org/all/20220311162445.346685-1-vincent.whitchurch@axis.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
2022-08-15 22:30:01 +01:00
Jonathan Cameron
cc21231ef0
iio: cdc: ad7746: Add device specific ABI documentation.
...
The datasheet description of offset calibration is complex, so for that
on just refer the reader to the device datasheet.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-16-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
6d6c760954
staging: iio: ad7746: White space cleanup
...
Tidy up some trivial whitespace issues.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-15-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
4b717201a0
staging: iio: cdc: ad7746: Use read_avail() rather than opencoding.
...
Switch over to the IIO core handling for _available attributes
making them available for in kernel users and enforcing correct
naming etc automatically.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-14-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
2d72ead25a
staging: iio: cdc: ad7746: Switch from _offset to _zeropoint for differential channels.
...
As this offset is applied equally to both lines of the differential
pair, _ofset should not be used. Use the new ABI _zeropoint instead
to avoid userspace software applying this value when calculating
real value = (_raw + _offset) * _scale
Also add a comment to explain why an offset of 0x800000 is applied
within the driver rather than exposed to userspace.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-13-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
5c64990b99
iio: core: Introduce _zeropoint for differential channels
...
Address an ABI gap for device where the offset of both lines in a
differential pair may be controlled so as to allow a wider range of
inputs, but without having any direct effect of the differential
measurement.
_offset cannot be used as to remain in line with existing usage,
userspace would be expected to apply it as (_raw + _offset) * _scale
whereas _zeropoint is not. i.e. If we were computing the differential
in software it would be.
((postive_raw + _zeropoint) - (negative_raw + zeropoint) + _offset) * _scale
= ((postive_raw - negative_raw) + _offset) * _scale
= (differential_raw + _offset) * _scale
Similarly calibbias is expected to tweak the measurement seen, not
the adjust the two lines of the differential pair.
Needed for in_capacitanceX-capacitanceY_zeropoint for the
AD7746 CDC driver.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-12-jic23@kernel.org
2022-08-15 22:30:01 +01:00
Jonathan Cameron
431e9147b4
staging: iio: cdc: ad7746: Use _raw and _scale for temperature channels.
...
Performing the maths to rescale a 24 bit raw reading within the driver
was resulting in precision losses. So make that userspace's problem
by exporting the scale and letting the maths be done in userspace with
appropriate precision. Issue identified using roadtester testing
framework.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-11-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
90e7853ce0
staging: iio: cdc: ad7746: Drop unused i2c_set_clientdata()
...
As the comment states, this was only used in remove() and now
there is no explicit remove() function to make use of it.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-10-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
9eee2fc4a6
staging: iio: cdc: ad7746: Break up use of chan->address and use FIELD_PREP etc
...
Instead of encoding several different fields into chan->address use
an indirection to a separate per channel structure where the various
fields can be expressed in a more readable form. This also allows
the register values to be constructed at runtime using FIELD_PREP().
Drop the now redundant _SHIFT macros.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-9-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
b1f567bde7
staging: iio: cdc: ad7764: Push locking down into case statements in read/write_raw
...
Not all paths require any locking at all. So to simplify the
removal of such locking push the locks down into the individual
case statements.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-8-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
5d54564e47
staging: iio: cdc: ad7746: Factor out ad7746_read_channel()
...
Reduce deep indenting and simplify the locking cleanup that follows.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-7-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
77fdc4cead
staging: iio: cdc: ad7746: Use local buffer for multi byte reads.
...
I2C does not require DMA safe buffers so there is no need to ensure
the buffers are in their own cacheline. Hence simplify things by
using a local variable instead of embedding the buffer in the chip
info structure.
Includes a trivial whitespace cleanup to drop a line between function
and error handling.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-6-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
104827ec92
staging: iio: cdc: ad7746: Push handling of supply voltage scale to userspace.
...
The supply voltage is attenuated by 6 before being fed to the ADC.
Handle this explicitly rather than pre-multiplying the _raw value by 6.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-5-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
ebf30bed14
staging: iio: cdc: ad7746: Use explicit be24 handling.
...
Chance from fiddly local implementation of be24 to cpu endian conversion
by reading into a 3 byte buffer and using get_unaligned_be24()
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-4-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Jonathan Cameron
1efc41035f
iio: ABI: Fix wrong format of differential capacitance channel ABI.
...
in_ only occurs once in these attributes.
Fixes: 0baf29d658 ("staging:iio:documentation Add abi docs for capacitance adcs.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220626122938.582107-3-jic23@kernel.org
2022-08-15 22:30:00 +01:00
Nuno Sá
110f11589c
iio: inkern: fix coding style warnings
...
Just cosmetics. No functional change intended...
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-16-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:00 +01:00
Nuno Sá
b22bc4d607
iio: inkern: remove OF dependencies
...
Since all users of the OF dependendent API are now converted to use the
firmware agnostic alternative, we can drop OF dependencies from the IIO
in kernel interface.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-15-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:00 +01:00
Nuno Sá
d7705f3544
iio: adc: stm32-adc: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com >
Tested-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com >
Link: https://lore.kernel.org/r/20220715122903.332535-14-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:00 +01:00
Nuno Sá
4f47a236a2
iio: adc: qcom-spmi-adc5: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-13-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:00 +01:00
Nuno Sá
e7c672d06b
iio: adc: qcom-spmi-vadc: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-12-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:30:00 +01:00
Nuno Sá
9e90c1772f
iio: adc: qcom-pm8xxx-xoadc: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-11-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:29:59 +01:00
Nuno Sá
34b6eb8935
iio: adc: at91-sama5d2_adc: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com >
Link: https://lore.kernel.org/r/20220715122903.332535-10-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:29:59 +01:00
Nuno Sá
dec7e2c83e
iio: adc: ab8500-gpadc: convert to device properties
...
Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20220715122903.332535-9-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2022-08-15 22:29:59 +01:00