summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
AgeCommit message (Collapse)Author
2023-05-28staging: iio: Switch i2c drivers back to use .probe()Uwe Kleine-König
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230524151646.486847-2-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-04-27Merge tag 'char-misc-6.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc drivers updates from Greg KH: "Here is the "big" set of char/misc and other driver subsystems for 6.4-rc1. It's pretty big, but due to the removal of pcmcia drivers, almost breaks even for number of lines added vs. removed, a nice change. Included in here are: - removal of unused PCMCIA drivers (finally!) - Interconnect driver updates and additions - Lots of IIO driver updates and additions - MHI driver updates - Coresight driver updates - NVMEM driver updates, which required some OF updates - W1 driver updates and a new maintainer to manage the subsystem - FPGA driver updates - New driver subsystem, CDX, for AMD systems - lots of other small driver updates and additions All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (196 commits) mcb-lpc: Reallocate memory region to avoid memory overlapping mcb-pci: Reallocate memory region to avoid memory overlapping mcb: Return actual parsed size when reading chameleon table kernel/configs: Drop Android config fragments virt: acrn: Replace obsolete memalign() with posix_memalign() spmi: Add a check for remove callback when removing a SPMI driver spmi: fix W=1 kernel-doc warnings spmi: mtk-pmif: Drop of_match_ptr for ID table spmi: pmic-arb: Convert to platform remove callback returning void spmi: mtk-pmif: Convert to platform remove callback returning void spmi: hisi-spmi-controller: Convert to platform remove callback returning void w1: gpio: remove unnecessary ENOMEM messages w1: omap-hdq: remove unnecessary ENOMEM messages w1: omap-hdq: add SPDX tag w1: omap-hdq: allow compile testing w1: matrox: remove unnecessary ENOMEM messages w1: matrox: use inline over __inline__ w1: matrox: switch from asm to linux header w1: ds2482: do not use assignment in if condition w1: ds2482: drop unnecessary header ...
2023-04-27Merge tag 'staging-6.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging driver updates from Greg KH: "Here is the large set of staging driver updates for 6.4-rc1. Once again, we removed more code than was added, a nice trend. It was a calm cycle, mostly all just small coding style cleanups, included in here are: - removal of the greybus loopback testing tools, userspace code that didn't belong in a driver subdirectory and was causing problems for some build systems - platform remove callback cleanups - rtl8192e huge cleanups - other small staging driver cleanups. All of these have been in linux-next for a while with no reported problems" * tag 'staging-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (185 commits) staging: rtl8192e: Fix W_DISABLE# does not work after stop/start staging: rtl8192e: Remove unchanged variables bfsync_processing and more staging: rtl8192e: Remove unchanged variable frame_sync_monitor staging: rtl8192e: Remove unchanged variable chan_forced staging: rtl8192e: Remove set to true while true of bfirst_after_down staging: rtl8192e: Remove second initialization of bActuallySet staging: rtl8192e: Remove unused macro RT_SET_PS_LEVEL staging: rtl8192e: Remove unused function rtl92e_disable_nic staging: rtl8192e: Remove unchanged variable RegRfPsLevel staging: rtl8172: Add blank lines after declarations staging: rtl8192e: Remove unused variable RF_Type staging: rtl8192e: Remove one of two checks for hardware RTL8192SE staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE staging: greybus: drop loopback test files staging: rtl8192e: Add blank lines after declarations staging: rtl8192e: avoid CamelCase <dot11RSNAStatsCCMPDecryptErrors> staging: rtl8192e: avoid CamelCase <dot11RSNAStatsCCMPReplays> staging: rtl8192e: avoid CamelCase <dot11RSNAStatsCCMPFormatErrors> staging: rtl8192e: fix alignment to match open parenthesis ...
2023-04-10staging: iio: resolver: ads1210: fix config modeNuno Sá
As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode. [1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf Fixes: b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230327145414.1505537-1-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-04-06staging: iio: resolver: ad2s1210: Add explicit include for of.hRob Herring
With linux/acpi.h no longer implicitly including of.h, add an explicit include of of.h to fix the following error: drivers/staging/iio/resolver/ad2s1210.c:706:21: error: implicit declaration of function 'of_match_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-03-28staging: iio: resolver: ads1210: fix config modeNuno Sá
As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode. [1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf Fixes: b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup") Cc: stable <stable@kernel.org> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230327145414.1505537-1-nuno.sa@analog.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-11staging: iio: meter: Drop ade7854 driverJonathan Cameron
This driver is so far from making correct use of the IIO infrastructure and ABI that if someone wanted to make the driver suitable for moving out of staging, they would more or less be starting from scratch. As such there is little point in keeping the existing code in staging. Note this was only user of the meter.h header so that is dropped. There are no other drivers in the staging/iio/meter directory so drop the build system files as well. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230129160805.747745-1-jic23@kernel.org
2022-11-23staging: iio: accel: adis16240: Call '__adis_initial_startup()'Ramona Bolboaca
Call '__adis_initial_startup()' instead of its locked variant in 'adis16240_probe()'. The locks are not needed at this point. Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221122082757.449452-9-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: accel: adis16203: Call '__adis_initial_startup()'Ramona Bolboaca
Call '__adis_initial_startup()' instead of its locked variant in 'adis16203_probe()'. The locks are not needed at this point. Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221122082757.449452-8-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: ade7854: Convert to i2c's .probe_new()Uwe Kleine-König
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20221118224540.619276-569-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: ad5933: Convert to i2c's .probe_new()Uwe Kleine-König
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20221118224540.619276-568-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: adt7316: Convert to i2c's .probe_new()Uwe Kleine-König
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20221118224540.619276-567-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: meter: replace ternary operator by if conditionDeepak R Varma
Replace ternary operator by simple if based evaluation of the return value. Issue identified using coccicheck. Signed-off-by: Deepak R Varma <drv@mailo.com> Link: https://lore.kernel.org/r/Y3CAdCa17WdWDYUa@qemulion Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23staging: iio: frequency: ad9834: merge unnecessary split linesDeepak R Varma
Improve code readability by merging unnecessary split lines that are well within the code-style guidelines post merge. Signed-off-by: Deepak R Varma <drv@mailo.com> Acked-by: Julia Lawall <julia.lawall@inria.fr> Link: https://lore.kernel.org/r/Y0z2/qFe3kW96MTs@debian-BULLSEYE-live-builder-AMD64 Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-08-20staging: iio: frequency: ad9832: Fix alignment for DMA safetyJonathan Cameron
____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. Whilst here, move the marking to cover the whole union. That has no functional affect, but makes it slightly easier to see what is going on. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220813160600.1157169-1-jic23@kernel.org
2022-08-15staging: iio: resolver: ad2s1210: Fix alignment for DMA safetyJonathan Cameron
____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-15staging: iio: meter: ade7854: Fix alignment for DMA safetyJonathan Cameron
____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-15staging: iio: frequency: ad9834: Fix alignment for DMA safetyJonathan Cameron
____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-15iio: cdc: ad7746: Move driver out of staging.Jonathan Cameron
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-15staging: iio: ad7746: White space cleanupJonathan Cameron
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-15staging: iio: cdc: ad7746: Use read_avail() rather than opencoding.Jonathan Cameron
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-15staging: iio: cdc: ad7746: Switch from _offset to _zeropoint for ↵Jonathan Cameron
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-15staging: iio: cdc: ad7746: Use _raw and _scale for temperature channels.Jonathan Cameron
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-15staging: iio: cdc: ad7746: Drop unused i2c_set_clientdata()Jonathan Cameron
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-15staging: iio: cdc: ad7746: Break up use of chan->address and use FIELD_PREP etcJonathan Cameron
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-15staging: iio: cdc: ad7764: Push locking down into case statements in ↵Jonathan Cameron
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-15staging: iio: cdc: ad7746: Factor out ad7746_read_channel()Jonathan Cameron
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-15staging: iio: cdc: ad7746: Use local buffer for multi byte reads.Jonathan Cameron
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-15staging: iio: cdc: ad7746: Push handling of supply voltage scale to userspace.Jonathan Cameron
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-15staging: iio: cdc: ad7746: Use explicit be24 handling.Jonathan Cameron
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-04-28staging: iio: ad2s1210: remove redundant assignment to variable negativeColin Ian King
Variable negative is being assigned a value that is never read, it is being re-assigned later. The assignment is redundant and can be removed. Cleans up clang scan build warning: drivers/staging/iio/resolver/ad2s1210.c:502:3: warning: Value stored to 'negative' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220418134603.81336-1-colin.i.king@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-28iio: Replace strtobool() with kstrtobool()Lars-Peter Clausen
strtobool() is deprecated and just a wrapper around kstrtobool().Replace it with kstrtobool() so the deprecated function can be removed eventually. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220409105812.2113895-1-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-10iio: core: Simplify the registration of kfifo buffersMiquel Raynal
Among all the users of the kfifo buffers, no one uses the INDIO_BUFFER_HARDWARE mode. So let's take this as a general rule and simplify a little bit the internals - overall the documentation - by eliminating unused specific cases. Use the INDIO_BUFFER_SOFTWARE mode by default with kfifo buffers, which will basically mimic what all the "non direct" modes do. Cc: Benson Leung <bleung@chromium.org> Cc: Guenter Roeck <groeck@chromium.org> Cc: Jyoti Bhayana <jbhayana@google.com> Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-13-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-02-21iio:adc:ad7280a: Move out of stagingJonathan Cameron
This is a rather unusual device (in IIO anyway). However, it has a near to standard userspace ABI. Note the work to move this out of staging was done against a minimal QEMU model, which doesn't model all the features of the device. I have no intention to upstream the QEMU model as it was developed just to enable this driver cleanup. https://github.com/jic23/qemu/tree/ad7280a-hacks Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-21-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Use more conservative delays to allow 105C operation.Jonathan Cameron
The datasheet provides timings for operating this device at up to 105 degrees centigrade. Adopt these more conservative timings. Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-20-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Remove shift from cb_mask state cache.Jonathan Cameron
Making the local storage of the Cell Balance mask a simple bitmap and then shifting it only at time of register write simplifies several code paths. Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-19-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Drop buggy support for early termination of AUX alert.Jonathan Cameron
This functionality is intended to allow for a few temperature sensors to be missing (and hence not worth reading) on the final device in a chain. The ones removed are 3 and 5 (unlike for the ADC channels where it is 4 and 5). The datasheet includes a foot note 3 to Table 12 that makes this complex to support. "(3) To remove AUX5 or AUX5 and AUX3 from the alert detection, conversions on three auxiliary ADC input channels only must be selected in the control register." This mode has never been supported by the driver. As this support would be complex to add and the rework is being done against a QEMU model developed for the purposes of verifying nothing is broken, it is better to drop this support for now. Reported-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-16-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Use device properties to replace platform data.Jonathan Cameron
Convert all the device specific info that was previously in platform data over to generic firmware query interfaces. dt-bindings to follow shortly. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-15-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Use a local dev pointer to avoid &spi->devJonathan Cameron
We use this a few times already and it is about to get worse, so introduce a local variable to simplify things. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-14-jic23@kernel.org
2022-02-21staging:iio:ad7280a: Reflect optionality of irq in ABIJonathan Cameron
Given the irq is optional, let us remove the interfaces related to events when it is not present. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-13-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Cleanup includesJonathan Cameron
Drop used includes, add a few missing ones and reorder. The include-what-you-use tool output was considered in making this change. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-12-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Make oversampling_ratio a runtime controlJonathan Cameron
Oversampling has nothing directly to do with analog circuits or similar so belongs in the control of userspace as a policy decision. The only complexity in here was that the acquisition time needs updating if this setting is changed at runtime (as oversampling is time consuming). Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-11-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Trivial comment formatting cleanupJonathan Cameron
IIO uses the /* * stuff * more stuff */ multi-line style, so use that here as well. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-10-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Drop unused timestamp channel.Jonathan Cameron
The driver doesn't support buffered mode, so a timestamp channel that is entirely hidden from userspace without buffer mode is rather pointless. Drop it. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-9-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Standardize extended ABI namingJonathan Cameron
The *_balance_switch_en and *_balance_switch_timer attributes had non standard prefixes. Use the ext_info framework to automatically create then with in_voltageX-voltageY_ prefix. Documentation for these two unusual attributes to follow. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-8-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Switch to standard event controlJonathan Cameron
This driver had a slightly non standard events ABI but there seems to be no reason for not doing it with the core support for rising and falling events on the two types of channels. In theory the events on different daisy chained chips could be at different levels, but the driver has never supported this and it doesn't seem likely to be used so let us ignore that option. Includes reordering so that we only set the software cached value of the thresholds if the hardware write succeeds. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-7-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Use bitfield ops to managed fields in transfers.Jonathan Cameron
The write and two types of read transfer are sufficiently complex that they benefit from the clarity of using FIELD_PREP() and FIELD_GET(). This also applies to the handling in ad7280_event_handler() so use a similar approach there as well. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-6-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Split buff[2] into tx and rx partsJonathan Cameron
As the __cacheline_aligned will ensure that the first of these two buffers is appropriate aligned, there is no need to keep them as a single array which is confusing given the first element is always tx and the second rx. Hence let us just have two parts and name them separately. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-5-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: rename _read() to _read_reg()Jonathan Cameron
This avoids possible confusion with read back of the channel conversions. These two types of reads are of difference sizes with resulting differences in the data layout of the response from the hardware. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-4-jic23@kernel.org
2022-02-21staging:iio:adc:ad7280a: Register define cleanup.Jonathan Cameron
1. Postfix register addresses with _REG to distinguish them from fields within the registers 2. Switch to using FIELD_PREP and masks to aid readability. 3. Shorten a few defines to make the lines remain a sensible length. 4. Fix an issue whether where an CTRL_LB field is set in CTRL_HB. 5. Fix wrong AUX1_3_4 which should be AUX_1_3_5 according to table 14 in the datasheet. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-3-jic23@kernel.org