Commit graph

404 commits

Author SHA1 Message Date
Greg Kroah-Hartman
8210a2004d First set of IIO fixes for the 5.16 cycle
As these are very late in the 5.15 cycle and non are particularly urgent,
 they can wait for the merge window.
 
 Key element in this set is Yang Yingliang has identified a number of
 issues in error paths introduced recently when we added multiple
 buffer support.
 
 Other fixes:
 * adi,ad5662
   - Fix handling of i2c_master_send() return value.
 * adi,ad5766
   - Fix a wrong dt-property name that indicated wrong units and
     did not mach the bindings.
   - Associated 'fix' of the bindings example to have a possible scale.
 * st,pressure-spi
   - Add some missing entries to the spi_device_id table to ensure
     auto-loading works.
 * ti,tsc2046
   - Fix a backwards comparison leading to a false dev_warn
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmFxs7kRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojEXhAAn8OoUwEaViRbrVuPJmWCLuhZR8/ke1HE
 9WFXYjVvr6+FIyxgOxTVhoVd0LmcqzgeMg0si8CvnXvmx0mYqRyGxSgZ0oSWOfNR
 /RhfbL3RKyWmbp5ey3JuJxGS9Py1LXSFycsC7igjrgySqGo05kLrMpGkMr2g3d6a
 OKBOaoiBQPEvYmkNlFLOhtWGHNA4mICmi7UWwcfeN667SWKT3VFpBllSQwRpRXtz
 h/h0XhJg72x7JdJJsiBAWX9IsbBm9bXjaeXWZldDNnrZRS3VKTXzAkMTI0Wu0Rrq
 voEXvh74ys280aXoh5eHzN4OLdGBTJLVRjNaEAUaSMry4oWPpnkkda9pYY8dCcaR
 b8kPxn68PnrjbBG5et3PBo+/XAh7C0Ny2ETEqI8qlNk9adqUEl0wixuUUEljEqVE
 2rB35SEJYJzl0V0Up2uZMzYhPsfw+kbZoLUPyLfL9uNW3r1l9xgQURTM74UZcSdI
 cV2kcGWZdIX6IKVrChhPpeXcsS9ZWljWzUGu4IFBw1h9X6jwhbWJvACj889Rf4EI
 +ndjCylpE4aJfoZI7JSg5i41KvEGbwE3SkrKZTMNWe6aPajhcylzeG9+jxsAYaPn
 +hnKbPTE99oaopu1Od/s2EUtmIontZQy74aDfbQM3HU8fHmauk8/+L9kDNlkV2b3
 ZWbSw6Z2g4g=
 =jYCH
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-5.16a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

First set of IIO fixes for the 5.16 cycle

As these are very late in the 5.15 cycle and non are particularly urgent,
they can wait for the merge window.

Key element in this set is Yang Yingliang has identified a number of
issues in error paths introduced recently when we added multiple
buffer support.

Other fixes:
* adi,ad5662
  - Fix handling of i2c_master_send() return value.
* adi,ad5766
  - Fix a wrong dt-property name that indicated wrong units and
    did not mach the bindings.
  - Associated 'fix' of the bindings example to have a possible scale.
* st,pressure-spi
  - Add some missing entries to the spi_device_id table to ensure
    auto-loading works.
* ti,tsc2046
  - Fix a backwards comparison leading to a false dev_warn

* tag 'iio-fixes-for-5.16a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: buffer: Fix memory leak in iio_buffers_alloc_sysfs_and_mask()
  iio: adc: tsc2046: fix scan interval warning
  iio: core: fix double free in iio_device_unregister_sysfs()
  iio: core: check return value when calling dev_set_name()
  iio: buffer: Fix memory leak in iio_buffer_register_legacy_sysfs_groups()
  iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask()
  iio: buffer: Fix memory leak in __iio_buffer_alloc_sysfs_and_mask()
  iio: buffer: check return value of kstrdup_const()
  iio: dac: ad5446: Fix ad5622_write() return value
  Documentation:devicetree:bindings:iio:dac: Fix val
  drivers: iio: dac: ad5766: Fix dt property name
  iio: st_pressure_spi: Add missing entries SPI to device ID table
2021-10-24 13:08:36 +02:00
Greg Kroah-Hartman
6bce28cb49 First set of IIO new device and feature support for the 5.16 cycle
Counter subsystem changes now sent separately.
 
 This has been a busy cycle, so lots here and a few more stragglers to
 come next week.
 
 Big new feature in this cycle is probably output buffer support.
 This has been in the works for a very long time so it's great to see
 Mihail pick up the challenge and build upon his predecessors work to finally
 bring this feature to mainline.
 
 New device support
 ------------------
 
 * adi,adxl313
   - New driver and dt bindings for this low power accelerometer.
 * adi,adxl355
   - New driver and dt bindings for this accelerometer.
   - Later series adds buffer support.
 * asahi-kasei,ak8975
   - Minor additions to driver to support ak09916
 * aspeed,aspeed-adc
   - Substantial rework plus feature additions to add support for the
     ast2600 including a new dt bindings doc.
 * atmel,at91_sama5d2
   - Rework and support introduced for the sama7g5 parts.
 * maxim,max31865
   - New driver and bindings for this RTD temperature sensor chip.
 * nxp,imx8qxp
   - New driver and bindings for the ADC found on the i.MX 8QuadXPlus Soc.
 * senseair,sunrise
   - New driver and bindings for this family of carbon dioxide gas sensors.
 * sensiron,scd4x
   - New driver and bindings for this carbon dioxide gas sensor.
 
 New features
 ------------
 
 * Output buffer support.  Works in a similar fashion to input buffers, but
   in this case userspace pushes data into the kfifo which is then drained
   to the device when a trigger occurs.  Support added to the ad5766 DAC
   driver.
 * Core, devm_iio_map_array_register() to avoid need for
   devm_add_action_or_reset() based cleanup in fully managed allocation
   drivers.
 * Core iio_push_to_buffers_with_ts_unaligned() function to safely handle a
   few drivers where it really hard to ensure the correct data alignment in
   an iio_push_to_buffers_with_timestamp() call. Note this uses a bounce
   buffer so should be avoided whenever possible.  Used in the ti,adc108s102,
   invense,mpu3050 and adi,adis16400.  This closes the last   known set
   of drivers with alignment issues at this interface.
 * maxim,max1027
   - Substantial rework to this driver main target of which was supporting
     use of other triggers than it's own EOC interrupt.
   - Transfer optimization.
 * nxp,fxls8962af
   - Threshold even support including using it as a wakeup source.
 
 Cleanups, minor fixes etc
 -------------------------
 
 Chances of a common type to multiple drivers:
 
 * devm_ conversion and drop of .remove() callbacks in:
   - adi,ad5064
   - adi,ad7291
   - adi,ad7303
   - adi,ad7746
   - adi,ad9832
   - adi,adis16080
   - dialog,da9150-gpadc
   - intel,mrfld_adc
   - marvell,berlin2
   - maxim,max1363
   - maxim,max44000
   - nuvoton,nau7802
   - st_sensors (includes a lot of rework!)
   - ti,ads8344
   - ti,lp8788
 
 * devm_platform_ioremap_resource() used to reduce boilerplate
   - cirrus,ep93xx
   - rockchip,saradc
   - stm,stm32-dac
 
 * Use dev_err_probe() in more places to both not print on deferred probe and
   ensure a reason for the deferral is available for debug purposes.
   - adi,ad8801
   - capella,cm36651
   - linear,ltc1660
   - maxim,ds4424
   - maxim,max5821
   - microchip,mcp4922
   - nxp,lpc18xx
   - onnn,noa1305
   - st,lsm9ds0
   - st,st_sensors
   - st,stm32-dac
   - ti,afe4403
   - ti,afe4404
   - ti,dac7311
 
 * Drop error returns in SPI and I2C remove() functions as they are ignored and
   long term plan is to change these all over to returning void. In some cases
   these patches just make it 'obvious' they always return 0 where it was the
   case before but not easy to tell.
   - adi,ad5380
   - adi,ad5446
   - adi,ad5686
   - adi,ad5592r
   - bosch,bma400
   - bosch,bmc150
   - fsl,mma7455
   - honeywell,hmc5843
   - kionix,kxsd9
   - maxim,max5487
   - meas,ms5611
   - ti,afe4403
 
 Driver specific changes
 
 * adi,ad5770r
   - Bring driver inline with documented bindings.
 * adi,ad7746
   - Trivial style fix
 * adi,ad7949
   - Express some magic values as the underlying parts via new #defines.
   - Make it work with SPI controllers that don't support 14 or 16 bit messages
   - Support selection of voltage reference from dt including expanding the
     dt-bindings to cover this new functionality.
 * adi,ad799x
   - Implement selection of external reference voltage on AD7991, AD7995 and
     AD7999.
   - Add missing dt-bindings doc for devices supported by this driver.
 * adi,adislib
   - Move interrupt startup to better location in startup flow.
   - Handle devices that cannot mask/unmask the drdy pin and must instead mask
     at the interrupt controller.  Applies to the adis16460 and adis16475 from
     which we then drop equivalent code.
 * adi,ltc2983
   - Add support for optional reset pin.
   - Fail to probe if no channels specified in dt binding.
 * asahi-kasei,ak8975
   - dt-binding additions of missing vid-supply regulator.
 * aspeed,aspeed-adc
   - Typo fix.
 * fsl,mma7660
   - Mark acpi_device_id table __maybe_unused to avoid build warning.
 * fsl,imx25-gcq
   - Avoid initializing regulators that aren't used.
 * invensense,mpu3050
   - Drop a dead protection against a clash with the old input driver.
 * invensense,mpu6050
   - Rework code to not use strcpy() and hence avoid possibility of wrong sized
     buffers. Note this wasn't a bug, but the new code is a lot more readable.
   - Mark acpi_device_id table __maybe_unused to avoid build warning.
 * kionix,kxcjk1013
   - dt-binding addition to note it supports interrupts.
 * marvell,berlin2-adc
   - Enable COMPILE_TEST building.
 * maxim,max1027
   - Avoid returning success in an error path.
 * nxp,imx8qxp
   - Fix warning when runtime pm not enabled via __maybe_unused.
 * ricoh,rn5t618
   - Use the new devm_iio_map_array_register() instead of open coding the same.
 * samsung,exynos_adc
   - Improve kconfig help text.
 * st,lsm6dsx
   - Move max_fifo_size into the fifo_ops structure where the other configuration
     parameters are found.
 * st,st_sensors:
   - Reorder to ensure we turn the power off after removing userspace interfaces.
 * senseair,sunrise
   - Add missing I2C dependency.
 * ti,twl6030
   - Small code tidy up.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmFudVERHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Foiepg//R5DRm1gMFGP/dl2P8u6KD2oXNmbqc3J0
 +EPRTkyTyawQzc21wdxUh3oObgxmDS6P7Cr17z9viGse2PsUjza4Sptic3Zqi3Kv
 FzeXZaP0GY9nC+hAyz+dSkMKNw19mkCYYEIWhDwYFpXMiOV8QlT+6pFgOiffofeR
 GYMUoV2XeuxR6OH0zMOuYKTzjOCYC+VJTP4BfeUetpRZQyllgFOA+5KX4ZWTiJMV
 eGCaq3Hhn6IQa7ATgYUBYJyMkAXQDrKDaMxiaCIuh/k3bgjAkfhkV48mu2cHTsX9
 v0q21JkgmBenwNP/OQ6mxmWR9SFY4eB22Ptkd1foTPjAsqoST7qmqEBhhLrRb/fB
 HkL0I7M4tWDqSTJKgdn+UHYrKFW9oBHIt5SK1tCS+zTYIn1wEmkY/w/9MuZllBFO
 VKu5q2ypf/yGgCqPIZilK69mrZd7/72rE6tr3oefUF2iUVLdh9fI1TjGGyoT6GZ5
 ZlEIfGHRpcRGHFiA4e+6tTx9VLr8m1B5YVvBWWPlruYe8ep7MmD3KjUcwINiRyNs
 5rdBl2RI8VAUBbQ+60VWn03e/0kuRESpFC3Gf/ng+6hRSUbRFe4lZw60GbyFDXwV
 m1odTlkXA7l6oRG9f5COhE/oNO7dsfMO74W6+yzhWICnxjgJFosaaZTLw8F9QJdS
 m3z9tSU84js=
 =htmG
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-5.16a-split-take4' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

First set of IIO new device and feature support for the 5.16 cycle

Counter subsystem changes now sent separately.

This has been a busy cycle, so lots here and a few more stragglers to
come next week.

Big new feature in this cycle is probably output buffer support.
This has been in the works for a very long time so it's great to see
Mihail pick up the challenge and build upon his predecessors work to finally
bring this feature to mainline.

New device support
------------------

* adi,adxl313
  - New driver and dt bindings for this low power accelerometer.
* adi,adxl355
  - New driver and dt bindings for this accelerometer.
  - Later series adds buffer support.
* asahi-kasei,ak8975
  - Minor additions to driver to support ak09916
* aspeed,aspeed-adc
  - Substantial rework plus feature additions to add support for the
    ast2600 including a new dt bindings doc.
* atmel,at91_sama5d2
  - Rework and support introduced for the sama7g5 parts.
* maxim,max31865
  - New driver and bindings for this RTD temperature sensor chip.
* nxp,imx8qxp
  - New driver and bindings for the ADC found on the i.MX 8QuadXPlus Soc.
* senseair,sunrise
  - New driver and bindings for this family of carbon dioxide gas sensors.
* sensiron,scd4x
  - New driver and bindings for this carbon dioxide gas sensor.

New features
------------

* Output buffer support.  Works in a similar fashion to input buffers, but
  in this case userspace pushes data into the kfifo which is then drained
  to the device when a trigger occurs.  Support added to the ad5766 DAC
  driver.
* Core, devm_iio_map_array_register() to avoid need for
  devm_add_action_or_reset() based cleanup in fully managed allocation
  drivers.
* Core iio_push_to_buffers_with_ts_unaligned() function to safely handle a
  few drivers where it really hard to ensure the correct data alignment in
  an iio_push_to_buffers_with_timestamp() call. Note this uses a bounce
  buffer so should be avoided whenever possible.  Used in the ti,adc108s102,
  invense,mpu3050 and adi,adis16400.  This closes the last   known set
  of drivers with alignment issues at this interface.
* maxim,max1027
  - Substantial rework to this driver main target of which was supporting
    use of other triggers than it's own EOC interrupt.
  - Transfer optimization.
* nxp,fxls8962af
  - Threshold even support including using it as a wakeup source.

Cleanups, minor fixes etc
-------------------------

Chances of a common type to multiple drivers:

* devm_ conversion and drop of .remove() callbacks in:
  - adi,ad5064
  - adi,ad7291
  - adi,ad7303
  - adi,ad7746
  - adi,ad9832
  - adi,adis16080
  - dialog,da9150-gpadc
  - intel,mrfld_adc
  - marvell,berlin2
  - maxim,max1363
  - maxim,max44000
  - nuvoton,nau7802
  - st_sensors (includes a lot of rework!)
  - ti,ads8344
  - ti,lp8788

* devm_platform_ioremap_resource() used to reduce boilerplate
  - cirrus,ep93xx
  - rockchip,saradc
  - stm,stm32-dac

* Use dev_err_probe() in more places to both not print on deferred probe and
  ensure a reason for the deferral is available for debug purposes.
  - adi,ad8801
  - capella,cm36651
  - linear,ltc1660
  - maxim,ds4424
  - maxim,max5821
  - microchip,mcp4922
  - nxp,lpc18xx
  - onnn,noa1305
  - st,lsm9ds0
  - st,st_sensors
  - st,stm32-dac
  - ti,afe4403
  - ti,afe4404
  - ti,dac7311

* Drop error returns in SPI and I2C remove() functions as they are ignored and
  long term plan is to change these all over to returning void. In some cases
  these patches just make it 'obvious' they always return 0 where it was the
  case before but not easy to tell.
  - adi,ad5380
  - adi,ad5446
  - adi,ad5686
  - adi,ad5592r
  - bosch,bma400
  - bosch,bmc150
  - fsl,mma7455
  - honeywell,hmc5843
  - kionix,kxsd9
  - maxim,max5487
  - meas,ms5611
  - ti,afe4403

Driver specific changes

* adi,ad5770r
  - Bring driver inline with documented bindings.
* adi,ad7746
  - Trivial style fix
* adi,ad7949
  - Express some magic values as the underlying parts via new #defines.
  - Make it work with SPI controllers that don't support 14 or 16 bit messages
  - Support selection of voltage reference from dt including expanding the
    dt-bindings to cover this new functionality.
* adi,ad799x
  - Implement selection of external reference voltage on AD7991, AD7995 and
    AD7999.
  - Add missing dt-bindings doc for devices supported by this driver.
* adi,adislib
  - Move interrupt startup to better location in startup flow.
  - Handle devices that cannot mask/unmask the drdy pin and must instead mask
    at the interrupt controller.  Applies to the adis16460 and adis16475 from
    which we then drop equivalent code.
* adi,ltc2983
  - Add support for optional reset pin.
  - Fail to probe if no channels specified in dt binding.
* asahi-kasei,ak8975
  - dt-binding additions of missing vid-supply regulator.
* aspeed,aspeed-adc
  - Typo fix.
* fsl,mma7660
  - Mark acpi_device_id table __maybe_unused to avoid build warning.
* fsl,imx25-gcq
  - Avoid initializing regulators that aren't used.
* invensense,mpu3050
  - Drop a dead protection against a clash with the old input driver.
* invensense,mpu6050
  - Rework code to not use strcpy() and hence avoid possibility of wrong sized
    buffers. Note this wasn't a bug, but the new code is a lot more readable.
  - Mark acpi_device_id table __maybe_unused to avoid build warning.
* kionix,kxcjk1013
  - dt-binding addition to note it supports interrupts.
* marvell,berlin2-adc
  - Enable COMPILE_TEST building.
* maxim,max1027
  - Avoid returning success in an error path.
* nxp,imx8qxp
  - Fix warning when runtime pm not enabled via __maybe_unused.
* ricoh,rn5t618
  - Use the new devm_iio_map_array_register() instead of open coding the same.
* samsung,exynos_adc
  - Improve kconfig help text.
* st,lsm6dsx
  - Move max_fifo_size into the fifo_ops structure where the other configuration
    parameters are found.
* st,st_sensors:
  - Reorder to ensure we turn the power off after removing userspace interfaces.
* senseair,sunrise
  - Add missing I2C dependency.
* ti,twl6030
  - Small code tidy up.

* tag 'iio-for-5.16a-split-take4' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (148 commits)
  iio: imx8qxp-adc: mark PM functions as __maybe_unused
  iio: pressure: ms5611: Make ms5611_remove() return void
  iio: potentiometer: max5487: Don't return an error in .remove()
  iio: magn: hmc5843: Make hmc5843_common_remove() return void
  iio: health: afe4403: Don't return an error in .remove()
  iio: dac: ad5686: Make ad5686_remove() return void
  iio: dac: ad5592r: Make ad5592r_remove() return void
  iio: dac: ad5446: Make ad5446_remove() return void
  iio: dac: ad5380: Make ad5380_remove() return void
  iio: accel: mma7455: Make mma7455_core_remove() return void
  iio: accel: kxsd9: Make kxsd9_common_remove() return void
  iio: accel: bmi088: Make bmi088_accel_core_remove() return void
  iio: accel: bmc150: Make bmc150_accel_core_remove() return void
  iio: accel: bma400: Make bma400_remove() return void
  drivers:iio:dac:ad5766.c: Add trigger buffer
  iio: triggered-buffer: extend support to configure output buffers
  iio: kfifo-buffer: Add output buffer support
  iio: Add output buffer support
  iio: documentation: Document scd4x calibration use
  drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensor
  ...
2021-10-19 11:44:28 +02:00
Uwe Kleine-König
3ceed0211a iio: dac: ad5686: Make ad5686_remove() return void
Up to now ad5686_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211013203223.2694577-11-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19 08:30:45 +01:00
Uwe Kleine-König
72ba450562 iio: dac: ad5592r: Make ad5592r_remove() return void
Up to now ad5592r_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211013203223.2694577-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19 08:30:45 +01:00
Uwe Kleine-König
1f10848f18 iio: dac: ad5446: Make ad5446_remove() return void
Up to now ad5446_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211013203223.2694577-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19 08:30:45 +01:00
Uwe Kleine-König
d6220554e4 iio: dac: ad5380: Make ad5380_remove() return void
Up to now ad5380_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211013203223.2694577-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19 08:30:45 +01:00
Mihail Chindris
885b9790c2 drivers:iio:dac:ad5766.c: Add trigger buffer
This chip is able to generate waveform and using an
with the output trigger buffer will be easy to generate one.

Signed-off-by: Mihail Chindris <mihail.chindris@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211007080035.2531-7-mihail.chindris@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19 08:30:45 +01:00
Cai Huoqing
d1249ba70d 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>
2021-10-19 08:30:44 +01:00
Cai Huoqing
7051c1215c 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>
2021-10-19 08:30:44 +01:00
Cai Huoqing
c0e9ef04a9 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>
2021-10-19 08:30:43 +01:00
Cai Huoqing
d5c1118f6f 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>
2021-10-19 08:30:43 +01:00
Cai Huoqing
2b87c267d8 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>
2021-10-19 08:30:43 +01:00
Cai Huoqing
7bb9df2d58 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>
2021-10-19 08:30:43 +01:00
Cai Huoqing
7cf5307c00 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>
2021-10-19 08:30:43 +01:00
Cai Huoqing
f80d6061da 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>
2021-10-19 08:30:43 +01:00
Pekka Korpinen
558df982d4 iio: dac: ad5446: Fix ad5622_write() return value
On success i2c_master_send() returns the number of bytes written. The
call from iio_write_channel_info(), however, expects the return value to
be zero on success.

This bug causes incorrect consumption of the sysfs buffer in
iio_write_channel_info(). When writing more than two characters to
out_voltage0_raw, the ad5446 write handler is called multiple times
causing unexpected behavior.

Fixes: 3ec36a2cf0 ("iio:ad5446: Add support for I2C based DACs")
Signed-off-by: Pekka Korpinen <pekka.korpinen@iki.fi>
Link: https://lore.kernel.org/r/20210929185755.2384-1-pekka.korpinen@iki.fi
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-17 11:42:04 +01:00
Cai Huoqing
7685f50798 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>
2021-10-17 11:05:54 +01:00
Alexandru Ardelean
14a6ee6ec5 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>
2021-10-17 11:05:54 +01:00
Alexandru Ardelean
8a16c76e23 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>
2021-10-17 11:05:53 +01:00
Mihail Chindris
d9de0fbdeb drivers: iio: dac: ad5766: Fix dt property name
In the documentation the name for the property is
output-range-microvolts which is a standard name, therefore this name
must be used.

Fixes: fd9373e41b ("iio: dac: ad5766: add driver support for AD5766")
Signed-off-by: Mihail Chindris <mihail.chindris@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211007080035.2531-5-mihail.chindris@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-07 16:50:08 +01:00
Dan Carpenter
f7a28df7db iio: dac: ti-dac5571: fix an error code in probe()
If we have an unexpected number of channels then return -EINVAL instead
of returning success.

Fixes: df38a4a72a ("iio: dac: add TI DAC5571 family support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210816183954.GB2068@kili
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:08 +01:00
Nuno Sá
26df977a90 iio: ad5770r: make devicetree property reading consistent
The bindings file for this driver is defining the property as 'reg' but
the driver was reading it with the 'num' name. The bindings actually had
the 'num' property when added in
commit ea52c21268 ("dt-bindings: iio: dac: Add docs for AD5770R DAC")
and then changed it to 'reg' in
commit 2cf3818f18 ("dt-bindings: iio: dac: AD5570R fix bindings errors").
However, both these commits landed in v5.7 so the assumption is
that either 'num' is not being used or if it is, the validations were not
done.

Anyways, if someone comes back yelling about this, we might just support
both of the properties in the future. Not ideal, but that's life...

Fixes: 2cf3818f18 ("dt-bindings: iio: dac: AD5570R fix bindings errors")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210818080525.62790-1-nuno.sa@analog.com
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:00:32 +01:00
Théo Borém Fabris
6a25893cb0 iio: dac: max5821: convert device register to device managed function
Add a device managed hook, via devm_add_action_or_reset() and
max5821_regulator_disable(), to disable voltage regulator on device
detach.
Replace iio_device_register() by devm_iio_device_register() and remove
the max5821_remove() function used to unregister the device and disable the
voltage regulator.
Remove i2c_set_clientdata() from the probe function, since
i2c_get_clientdata() is not used anymore.
Remove regulator_disable() calls from the probe function.

Signed-off-by: Théo Borém Fabris <theobf@usp.br>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210724220159.11998-1-theobf@usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31 18:17:22 +01:00
Jonathan Cameron
97683c851f iio: dac: ad5624r: Fix incorrect handling of an optional regulator.
The naming of the regulator is problematic.  VCC is usually a supply
voltage whereas these devices have a separate VREF pin.

Secondly, the regulator core might have provided a stub regulator if
a real regulator wasn't provided. That would in turn have failed to
provide a voltage when queried. So reality was that there was no way
to use the internal reference.

In order to avoid breaking any dts out in the wild, make sure to fallback
to the original vcc naming if vref is not available.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210627163244.1090296-9-jic23@kernel.org
2021-07-19 09:51:58 +01:00
Greg Kroah-Hartman
6771fb0b94 1st set of new IIO/counter device support, features and cleanup for 5.14
There are a couple of large cleanup sets in here alongside a number of new
 drivers.
 
 Note an immutable branch merged to add a stub for i2c_verify_client()
 as needed to avoid a build issue in the fxls8962af driver as a result of a
 workaround for a device errata that only applies when i2c interface is used.
 
 Counters
 ========
 
 New device support
 * intel,quadrature encoder peripheral found on Elkhart Lake platforms.
   - New driver.
 
 IIO
 ===
 
 New device support
 * amstaos,tsl2591 ambient light sensor.
   - New driver + bindings
   - Follow up fix to ensure some local variables are suitable for error
     handling.
 * fsl,fxls8962af + fsl,fxls8964af accelerometers
   - New driver + bindings
   - Includes an errata work around that cause a build bot failure fixed
     by adding a stub to i2c.
 * kionix,kxcjk-1013
   - Add support for KX023-1025 device.  Mostly a different register map
     that needed to be supported.
 * murata,sca3300 accelerometer
   - New driver + bindings
 * st,lsm9ds0 IMU
   - Rework of st,sensors driver to cleanly support this new glue driver
     that enables the two parts of the LSM9DS0.
 * ti,tsc2046 touchscreen controller ADC.
   - New driver. Intent here is to use this with existing IIO consumer
     drivers such as resistive-adc-touch.
   - Follow up fix to avoid an issue with unsigned subtraction in error
     check.
 * ti,tmp117 digital temperature sensor
   - New driver + bindings
 
 Features
 * adi,ad5755
   - Add missing dt-binding doc
 * adi,ad7298
   - Add ACPI ID used on Intel Galileo Gen 1 boards.
   - Add missing dt-binding doc
 * adi,ad7476
   - Add missing dt-binding doc
 * adi,ad7746
   - Add missing dt-binding doc for this driver that will hopefully move out
     of staging shortly. Update staging driver to use the binding instead of
     platform data.
 * adi,adis16201 + adis16209
   - Add missing dt-binding doc
 * adi,adis16480
   - Support burst mode for adis16495 and adis16497 parts.
 * bosch,bma220
   - Add missing dt-binding doc
 * fsl,mma7455
   - Add missing dt-binding doc
 * iio-rescale
   - Support handling of processed channels from provider.  Some ADCs
     require (typically non linear) calibration functions to be applied,
     and so provide only IIO_CHAN_INFO_PROCESSED read back. They can be
     used as providers to the iio-rescale driver which needs to handle them
     somewhat differently from IIO_CHAN_INFO_RAW
 * sensiron,sps30
   - Support the serial interface.  Note this required significant
     refactoring of existing driver.
 * st,st-sensors
   - Add mount matrix support for normal dt-binding whilst continuing to
     support the odd ACPI approach for accelerometers.
 * ti,dac082s085 + similar
   - Add missing dt-binding doc
 * trivial-devices - add entries for
   - memsic,mx4005, memsic,mx6255 and memsic,mxc6655
   - sensortek,stk8312 and sensortek,stk8ba50
 
 Cleanup / minor fixes
 * core
   - Use devm_add_action_or_reset() to replace boilerplate in several
     driver and core IIO devm_* functions.
   - Fix an error path issue introduced by above, that could return an
     error pointer rather than the expected null from dev_iio_device_alloc()
   - Move more IIO internals related fields from struct iio_dev to
     struct iio_dev_opaque.
   - Drop unused final update of in_loc in demux setup.
 * Docs
   - Move some docs from driver specific to core dos to avoid replication
     of names which the documentation builder does not allow.
     Note this means adding a few device specific notes to the general docs
     to cover the more unusual uses of the ABI.
   - ABI: Move old buffer/* and scan_elements/* docs to obsolete as now we
     have the bufferX/* variant.  Not we are not getting rid of these
     interfaces, just encouraging new code to use the new interface.
 * IIO wide:
   - Tidy up new cases of dev.parent etc being set in drivers as the core
     now does it.
   - Fix more cases of possible miss-aligned buffers when passed to
     iio_push_to_buffers_with_timestamp().  Note we only have one known
     instance of anyone seeing this bug actually happening, so this has been
     a low priority cleanup effort for several cycles.
   - sysfs_emit() used in more drivers.
   - Runtime pm tidy up and use of pm_runtime_resume_and_get()
   - Buffer alignment fixes as iio_push_to_buffers_with_timestamp requires
     that the timestamp when inserted by naturally aligned + consumers can
     assume that all fields are naturally aligned. Part of a long running
     effort, with at least 2 more series to come tackling additional
     variants.
   - Stop specifying "mount-matrix" property name in every lookup of the
     mount matrix from firmware by hard coding it in the core.
 * adi,ad7476
   - Handle the variety of different regulators used by the parts supported
     by this driver (came up in dt-binding review)
 * adi,ad7746
   - Trivial drop of if (ret) return ret; return 0; pattern
   - Tidy up comments
   - Pull capdac setup out to own function.
 * adi,ad7766
   - Trivial drop of if (ret) return ret; return 0; pattern
 * adi,adis
   - Avoid returning error codes in interrupt handlers.
   - Handle a failure in spi_write in the trigger handler.
   - Rework to add updating of device page after changing it.
   - Don't push data to IIO buffers when read failed.
   - Add configuration of burst max speed to core avoid handling this in
     each driver.
   - Use the adis_dev_lock() helper in adis16260 and adis16136 drivers.
   - Excessive includes cleanup via include-what-you-use static checker
     after zero day highlighted that these needed updating.
 * afe
   - Amend binding to add #io-channel-cells, thus allowing this IIO
     consumer to also be an IIO provider.
 * aosong,am2315
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * bosch,bma180
   - Adding missing bandwidth settings (500, 1000 Hz)
 * bosch,bme680
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * ep93xx_adc,
   - Drop a redundant error print.
 * maxim,max118
   - Convert remainder of probe() to devm_ managed functions.
   - Avoid some repeated jumping back and forth between iio_dev and
     spi structures.
 * maxim,max11100
   - Use get_unaligned_be16() instead of open coding.
   - Convert remainder of probe() to devm_ managed functions.
 * samsung,exynos_adc
   - Unused error value dropped.
 * sensiron,sgp30
   - Drop use of %hx in favor of %x and letting the normal type conversion
     work.
 * sensortek,stk8312
   - Add lowercase device id and note uppercase version deprecated.
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * sprx,sc72xx_adc
   - add MODULE_DEVICE_TABLE
 * st,lsm6dsx
   - Fix docs of valid ODRs
 * st,sensors
   - dt-binding rework.  Two efforts on this crossed in a previous cycle
     so this update cherry picks the best of the two yaml conversions.
   - Don't copy the channel spec array as now ext_info is no longer modified.
 * st,stm32-adc
   - tidy up some docs that were marked as kernel-doc but aren't.
 * ti,adc081c, ti,adc0832, ti,adc108s102 and ti,adc161s626
   - Convert remainder of probe() functions to devm_ managed functions
     to simplify error handing and remove paths.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmC/mCoRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoidAQ//SqpbBeEy8HATSHccooHwHI3eK+hnj0n9
 9zr6/7o52EQ0lFN6V7OLp0XNL3DNIV8oYAyvzYZ4Qh2NXLYQHDnqiiUyLxCfctqu
 Ii+9NmVmuk/PlPRRubQRZE+Czdtwgsp7dRQOYJiuxUeKVD/EUVjl1FmpsiPtGeaa
 iU6JaYtdF3ie0b1zQCwQTYYsM8lZ2/ovKW8F29K5ALnrDd9h6Ad0p5QDvyDxyajp
 VyLRJa7nwAfK5rP6efuNsDfzbMycTPtHkcC+Pgec/2RrXL5mDz4EXHI1nOUZAGdb
 UaN/uDpytAxJZk6Fs2f+RdgevlQgpBxAXGDHE2YHkcZi7X0ppWOjeIZFSDbDiaHO
 XlSQgOelUqKtHhRZ3MYHxbSOgO3Vif6ecCDMNCN78E0YE3kQHHSwY0JMGgUeHIGG
 hQPKGaD1AKzh7AsbPbazYW6VX4dDDWcr8pQ8D9wWLUKikcZLKqRH5uAwvjZ+NjuC
 Bfnjx/QhmIhbs0gFaw4Q5mvYQ3Zmfh7nzcW98jwcbR6pOqKvIeqzw9OARRHaimrd
 /GRCiccxKtU8J7f5l+MSzYQt4hT0Ef1vuq9Ak5SDCr3Fwnix5ipFVLkipWvgJ7JD
 OqubcwwW5EfgZPY/X7nsK/U6v8SlqF4XrvCVky4MUt0x1YXxc/tjYak8oLEqpMVC
 gQP3KUZIYeA=
 =Zved
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-5.14a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

1st set of new IIO/counter device support, features and cleanup for 5.14

There are a couple of large cleanup sets in here alongside a number of new
drivers.

Note an immutable branch merged to add a stub for i2c_verify_client()
as needed to avoid a build issue in the fxls8962af driver as a result of a
workaround for a device errata that only applies when i2c interface is used.

Counters
========

New device support
* intel,quadrature encoder peripheral found on Elkhart Lake platforms.
  - New driver.

IIO
===

New device support
* amstaos,tsl2591 ambient light sensor.
  - New driver + bindings
  - Follow up fix to ensure some local variables are suitable for error
    handling.
* fsl,fxls8962af + fsl,fxls8964af accelerometers
  - New driver + bindings
  - Includes an errata work around that cause a build bot failure fixed
    by adding a stub to i2c.
* kionix,kxcjk-1013
  - Add support for KX023-1025 device.  Mostly a different register map
    that needed to be supported.
* murata,sca3300 accelerometer
  - New driver + bindings
* st,lsm9ds0 IMU
  - Rework of st,sensors driver to cleanly support this new glue driver
    that enables the two parts of the LSM9DS0.
* ti,tsc2046 touchscreen controller ADC.
  - New driver. Intent here is to use this with existing IIO consumer
    drivers such as resistive-adc-touch.
  - Follow up fix to avoid an issue with unsigned subtraction in error
    check.
* ti,tmp117 digital temperature sensor
  - New driver + bindings

Features
* adi,ad5755
  - Add missing dt-binding doc
* adi,ad7298
  - Add ACPI ID used on Intel Galileo Gen 1 boards.
  - Add missing dt-binding doc
* adi,ad7476
  - Add missing dt-binding doc
* adi,ad7746
  - Add missing dt-binding doc for this driver that will hopefully move out
    of staging shortly. Update staging driver to use the binding instead of
    platform data.
* adi,adis16201 + adis16209
  - Add missing dt-binding doc
* adi,adis16480
  - Support burst mode for adis16495 and adis16497 parts.
* bosch,bma220
  - Add missing dt-binding doc
* fsl,mma7455
  - Add missing dt-binding doc
* iio-rescale
  - Support handling of processed channels from provider.  Some ADCs
    require (typically non linear) calibration functions to be applied,
    and so provide only IIO_CHAN_INFO_PROCESSED read back. They can be
    used as providers to the iio-rescale driver which needs to handle them
    somewhat differently from IIO_CHAN_INFO_RAW
* sensiron,sps30
  - Support the serial interface.  Note this required significant
    refactoring of existing driver.
* st,st-sensors
  - Add mount matrix support for normal dt-binding whilst continuing to
    support the odd ACPI approach for accelerometers.
* ti,dac082s085 + similar
  - Add missing dt-binding doc
* trivial-devices - add entries for
  - memsic,mx4005, memsic,mx6255 and memsic,mxc6655
  - sensortek,stk8312 and sensortek,stk8ba50

Cleanup / minor fixes
* core
  - Use devm_add_action_or_reset() to replace boilerplate in several
    driver and core IIO devm_* functions.
  - Fix an error path issue introduced by above, that could return an
    error pointer rather than the expected null from dev_iio_device_alloc()
  - Move more IIO internals related fields from struct iio_dev to
    struct iio_dev_opaque.
  - Drop unused final update of in_loc in demux setup.
* Docs
  - Move some docs from driver specific to core dos to avoid replication
    of names which the documentation builder does not allow.
    Note this means adding a few device specific notes to the general docs
    to cover the more unusual uses of the ABI.
  - ABI: Move old buffer/* and scan_elements/* docs to obsolete as now we
    have the bufferX/* variant.  Not we are not getting rid of these
    interfaces, just encouraging new code to use the new interface.
* IIO wide:
  - Tidy up new cases of dev.parent etc being set in drivers as the core
    now does it.
  - Fix more cases of possible miss-aligned buffers when passed to
    iio_push_to_buffers_with_timestamp().  Note we only have one known
    instance of anyone seeing this bug actually happening, so this has been
    a low priority cleanup effort for several cycles.
  - sysfs_emit() used in more drivers.
  - Runtime pm tidy up and use of pm_runtime_resume_and_get()
  - Buffer alignment fixes as iio_push_to_buffers_with_timestamp requires
    that the timestamp when inserted by naturally aligned + consumers can
    assume that all fields are naturally aligned. Part of a long running
    effort, with at least 2 more series to come tackling additional
    variants.
  - Stop specifying "mount-matrix" property name in every lookup of the
    mount matrix from firmware by hard coding it in the core.
* adi,ad7476
  - Handle the variety of different regulators used by the parts supported
    by this driver (came up in dt-binding review)
* adi,ad7746
  - Trivial drop of if (ret) return ret; return 0; pattern
  - Tidy up comments
  - Pull capdac setup out to own function.
* adi,ad7766
  - Trivial drop of if (ret) return ret; return 0; pattern
* adi,adis
  - Avoid returning error codes in interrupt handlers.
  - Handle a failure in spi_write in the trigger handler.
  - Rework to add updating of device page after changing it.
  - Don't push data to IIO buffers when read failed.
  - Add configuration of burst max speed to core avoid handling this in
    each driver.
  - Use the adis_dev_lock() helper in adis16260 and adis16136 drivers.
  - Excessive includes cleanup via include-what-you-use static checker
    after zero day highlighted that these needed updating.
* afe
  - Amend binding to add #io-channel-cells, thus allowing this IIO
    consumer to also be an IIO provider.
* aosong,am2315
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* bosch,bma180
  - Adding missing bandwidth settings (500, 1000 Hz)
* bosch,bme680
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* ep93xx_adc,
  - Drop a redundant error print.
* maxim,max118
  - Convert remainder of probe() to devm_ managed functions.
  - Avoid some repeated jumping back and forth between iio_dev and
    spi structures.
* maxim,max11100
  - Use get_unaligned_be16() instead of open coding.
  - Convert remainder of probe() to devm_ managed functions.
* samsung,exynos_adc
  - Unused error value dropped.
* sensiron,sgp30
  - Drop use of %hx in favor of %x and letting the normal type conversion
    work.
* sensortek,stk8312
  - Add lowercase device id and note uppercase version deprecated.
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* sprx,sc72xx_adc
  - add MODULE_DEVICE_TABLE
* st,lsm6dsx
  - Fix docs of valid ODRs
* st,sensors
  - dt-binding rework.  Two efforts on this crossed in a previous cycle
    so this update cherry picks the best of the two yaml conversions.
  - Don't copy the channel spec array as now ext_info is no longer modified.
* st,stm32-adc
  - tidy up some docs that were marked as kernel-doc but aren't.
* ti,adc081c, ti,adc0832, ti,adc108s102 and ti,adc161s626
  - Convert remainder of probe() functions to devm_ managed functions
    to simplify error handing and remove paths.

* tag 'iio-for-5.14a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (171 commits)
  i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C
  iio: adis: Cleanout unused headers
  iio: accel: bma180: Add missing 500 Hz / 1000 Hz bandwidth
  counter: Add support for Intel Quadrature Encoder Peripheral
  staging: iio: cdc: ad7746: extract capac setup to own function
  staging: iio: cdc: ad7746: clean up probe return
  staging: iio: cdc: ad7746: remove ordinary comments
  iio: adc: ti-adc161s626: Use devm managed functions for all of probe.
  iio: adc: ti-adc108s102: Use devm managed functions for all of probe()
  iio: adc: ti-adc0832: Use devm managed functions for all of probe()
  iio: adc: ti-adc081c: Use devm managed functions for all of probe()
  iio: adc: max1118: Avoid jumping back and forth between spi and iio structures
  iio: adc: max1118: Use devm_ managed functions for all of probe
  iio: adc: max11100: Use devm_ functions for rest of probe()
  iio: adc: max11100: Use get_unaligned_be16() rather than opencoding.
  iio: chemical: sgp30: Drop use of %hx in format string.
  iio: gyro: st_gyro: Support mount matrix
  iio: magnetometer: st_magn: Support mount matrix
  iio: accel: st_sensors: Stop copying channels
  iio: accel: st_sensors: Support generic mounting matrix
  ...
2021-06-09 12:11:49 +02:00
Andy Shevchenko
98b7b0ca08 iio: dac: ad5770r: Put fwnode in error case during ->probe()
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: cbbb819837 ("iio: dac: ad5770r: Add AD5770R support")
Cc: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210510095649.3302835-1-andy.shevchenko@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-22 08:32:36 +01:00
Jonathan Cameron
54e81f6818 iio: dac: stm32-dac: Use pm_runtime_resume_and_get() to replace open coding.
Found using coccicheck script under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

This is a prequel to taking a closer look at the runtime pm in IIO drivers
in general

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-17-jic23@kernel.org
2021-05-17 13:54:26 +01:00
Jonathan Cameron
e42523c11f iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent and of_node
This is set to the same value in devm_iio_device_alloc() so no need to do
it again.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Cristian Pop <cristian.pop@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426170251.351957-3-jic23@kernel.org
2021-05-17 13:49:12 +01:00
Bhaskar Chowdhury
abfdfd1443 iio: dac: Rudimentary typo fix
s/concurent/concurrent/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20210323012215.451075-1-unixbhaskar@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-29 11:28:24 +01:00
Lars-Peter Clausen
f46ac00978 iio: dac: Convert powerdown read callbacks to sysfs_emit()
Update DAC drivers powerdown attribute show callback to use the new
sysfs_emit() function.

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210320071405.9347-5-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-29 11:12:30 +01:00
Mugilraj Dhavachelvan
2662e81745 iio:dac:max517.c: Use devm_iio_device_register()
Use devm_iio_device_register() to avoid remove function and
drop explicit call to iio_device_unregister().

Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314175709.34301-1-dmugil2000@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25 19:13:52 +00:00
Jonathan Cameron
92e212e597 iio: dac: ad5504: fix wrong part number in kernel-doc structure name.
Probably a bit of cut and paste where someone forgot to change the
part number.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210314164655.408461-5-jic23@kernel.org
2021-03-25 19:13:51 +00:00
Jonathan Cameron
e0549f3432 iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name
Nothing useful to add beyond this causing a warning with W=1

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210314164655.408461-4-jic23@kernel.org
2021-03-25 19:13:51 +00:00
Mircea Caprioru
477bd010c2 iio: dac: ad5686: Add support for AD5673R/AD5677R
The AD5673R/AD5677R are low power, 16-channel, 12-/16-bit buffered voltage
output digital-to-analog converters (DACs). They include a 2.5 V internal
reference (enabled by default).

These devices are very similar to AD5674R/AD5679R, except that they
have an i2c interface.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210217074102.23148-1-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11 20:47:10 +00:00
zuoqilin
0071aa3002 iio:adc:dac:ad5791 typo fix of regster
change 'regster' to 'register'

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Link: https://lore.kernel.org/r/20210128021905.963-1-zuoqilin1@163.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11 20:46:57 +00:00
Greg Kroah-Hartman
ec52736c35 Merge 5.11-rc5 into staging-next
We need the IIO/Staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-25 10:37:59 +01:00
Cristian Pop
fd9373e41b iio: dac: ad5766: add driver support for AD5766
The AD5766/AD5767 are 16-channel, 16-bit/12-bit, voltage output dense DACs
Digital-to-Analog converters.

This change adds support for these DACs.

Signed-off-by: Cristian Pop <cristian.pop@analog.com>
Link: https://lore.kernel.org/r/20210115112105.58652-3-cristian.pop@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-22 08:52:05 +00:00
Lars-Peter Clausen
efd597b283 iio: ad5504: Fix setting power-down state
The power-down mask of the ad5504 is actually a power-up mask. Meaning if
a bit is set the corresponding channel is powered up and if it is not set
the channel is powered down.

The driver currently has this the wrong way around, resulting in the
channel being powered up when requested to be powered down and vice versa.

Fixes: 3bbbf150ff ("staging:iio:dac:ad5504: Use strtobool for boolean values")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201209104649.5794-1-lars@metafoo.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-14 20:56:56 +00:00
Alexandru Ardelean
223f4d9517 iio: dac: ad7303: remove platform data header
The information in the ad7303 platform_data header is unused, so it's dead
code.
This change removes it and it's inclusion from the driver.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201001141004.53846-1-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-10-10 18:03:28 +01:00
Michael Auchter
bf7cfa685d iio: dac: ad5686: add of_match_table
Add of_match_table to this driver, so devices can be probed based on
device tree contents.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Link: https://lore.kernel.org/r/20200924195215.49443-2-michael.auchter@ni.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-10-10 16:41:33 +01:00
Michael Auchter
7dc8faeab3 iio: dac: ad5686: add support for AD5338R
The AD5338R is a 10-bit DAC with 2 outputs and an internal 2.5V
reference (enabled by default). The register configuration is nearly
identical to the AD5696R DAC that's already supported by this driver,
with the channel selection bits being the only thing different.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Link: https://lore.kernel.org/r/20200924195215.49443-1-michael.auchter@ni.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-10-10 16:41:09 +01:00
Greg Kroah-Hartman
b290f902b8 Second set of features and cleanups for IIO in 5.10
We have a couple of changes that apply to large sets of drivers, so
 I have grouped those to keep this short.
 
 There are a few late breaking fixes in here that can wait for the
 merge window.
 
 dt yaml conversions
 -------------------
 
 * adi,ad7768-1
 * adi,ad7949
 * aspeed,ast2400
 * cosmic,10001-adc
 * dlg,da9150-gpadc
 * fsl,imx25-gcq
 * fsl,imx7d-adc
 * fsl,vf610
 * holt,hi8435
 * marvell,berlin2-adc
 * motorola,cpcap-adc
 * nuvoton,nau7802
 * nuvoton,npcm750-adc
 * nxp,lpc1850-adc
 * nxp,lpc3220
 * sprd,sc2720-adc
 * st,stmpe-adc
 * ti,adc12138
 * ti,ads1015
 * ti,ads7950
 * ti,twl4030-madc
 
 Features
 --------
 
 * adxrs290
   - Add triggered buffer support and expose data ready signal as a possible
     trigger. Includes updating bindings.
   - Add debugfs hooks for register access.
 * mlx90632
   - Add a clear user interface to override the measured ambient temperature.
 * vl53l0x
   - Add IRQ support including dt bindings.
 
 Cleanups and minor fixes
 ------------------------
 (groups)
 Replace mlock with local lock:
   * adf4350
   * exynos-adc
   * fls-imx25-gcq
   * stm32-dac
 
 devm use to simplify probe error handling and remove functions.
   * adis16201
   * adis16203
   * adis16209
   * adis16240
   * adis16136
   * adis16260
   * adis16400
   * adis16460
   * adis16480
   * adis library - drop unused adis_setup_buffer_and_trigger()
 
 of_match_ptr removal and incorrect ACPI binding removal
   of_match_ptr() rarely makes sense in an IIO driver as space saving
   is trivial and it breaks ACPI PRP0001 based instantiation.
   Mostly this series is about removing examples that get copied into new
   drivers.
   * ad2s1200
   * ad5272
   * ad5446
   * ad5592r
   * ad5593r
   * ad5703
   * ak8974
   * ak8975
   * ams-iaq-core
   * as3935
   * atlas-sensor
   * ds1803
   * hdc100x
   * htu21
   * icp10100
   * lmp91000
   * pulsedlight
   * max30102
   * max5432
   * max5481
   * mcp4018
   * mcp4131
   * mcp4531
   * mcp4725
   * ms5611
   * ms5637
   * si7020
   * sgp30
   * ti-dac082s085
   * ti-dac5571
   * tmp007
   * tsys01
   * vz89x
   * zpa2326
 
 kernel-doc fixes
   * iio-core
   * ad7303
   * ad7947
   * adis16080
   * adis16400
   * iio_dummy_evgen
   * sgp30
 
 Fixes for buffer alignment when passed to iio_push_to_buffers_with_timestamp()
 This is a long running effort.  There are a few more drivers to come.
   * inv_mpu6050
   * itg3200
   * si1145
   * st_lsm6dsx
   * ti-adc0832
   * ti-adc12138
 
 (not driver focused)
 * MAINTAINERS
   - Consolidate Analog Device IIO entries whilst removing Beniamin Bia.
   - Remove Hartmut Knaack as a listed IIO maintainer as he hasn't been
     active for a long time and people are getting intermitted bounces.
 * Add __printf() markings to a few functions that were missing them.
 * drop some rotted documentation from staging.
 * rework buffer sysfs file creation (precursor to multiple buffer support)
 
 (individual drivers)
 * ad5592r
   - Fix use of true for IIO_SHARED_BY_TYPE
   - Tidy up locking and indentation.
 * ad9467
   - Improve error message on chip-id missmatch.
   - Use more appropriate error value if chip-id not recognised.
 * adis-library
   - Simplify burst mode handling.
 * adxrs290
   - Make sure to switch device to standby mode during remove.
 * as73211
   - Increase measurement timeout as seems some devices are slower.
 * bma180
   - Fix use of true fo IIO_SHARED_BY_TYPE
 * exynos_adc
   - Update binding to require second interrut with touch screen.
   - Update binding to not require syscon on S5Pv210
 * hmc5843
   - Fix use of true for IIO_SHARED_BY_TYPE
 * inv_mpu6050
   - Use regmap_noinc_read() for fifo reading.
 * palmas_gpadc
   - Use module_platform_driver() to remove boilerplate.
 * meson-saradc
   - style consistency fixes
 * rockchip_saradc
   - Allow compile testing with !ARM.
 * st_lsm6dsx
   - Changing scaling factor to use IIO_VAL_INT_PLUS_NANO to improve precision.
   - Fix an issue with unchecked return value.
 * stm32-adc
   - Fix a missing return introduced in dev_err_probe() patch earlier in
     cycle.
 * sx9310
   - Prefer async mode for probe as paticularly slow startup.
 * vcnl4000
   - Add missing interrupt property to dt binding.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl9o+P4RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohJyRAAjEa6RhQkoJMn4QRp5gNj+BhWoYeM4yeL
 kjOTI9WIfi5acuJiQK/bscqPjVoa9xkp33Za6gRYLFHtxiY0M1c7IKxK7jdDIxyT
 ak5JkmhbklhpAqAaXtGhngBQ/pmctunefjfJbV6ltlZP4W+7aHhGgVEW74Qiagn0
 +FuT3g23pcaCelm7uf1hynxkPUSvH0HlYPUdCptuYhE1YeFSsaCxSVl8DxIK0a52
 MC/rVl4Psjn01mTtVTcwD/JlcO2LnoGC3kJThYguvY52mDqNZBYCseUKwB9ribAT
 AUj7X9rxbAsdQAoN/RF0umD6hxoTnEePf0B29NfdXM/6sn/nhMzWMpVPEPRPRN3B
 /g+WDBPCdOKs5mdyHgfSKhJko0p4jQ5dhGFbzBVA75Uq0yxxRrdXLI2D4rdBjUmF
 6MXgAqaaAGRMq7qg3t3Kt9scR5J0CoPTY7oQvcetu/ZItFmaLEP4zM6wpYp1YXQg
 4GnUKFmwSAb1/Ah4x4XWKkgtvAgJ0RjfebTifa0u/kqi4ZBjacdP7dd4ttEY/3pH
 Zg7OQuMZCF70tDkksSkdAWXEdTJuCZtzaCTdck3NS7yZv0d/MYq2aqDqmON1GbEU
 18yTcGQYGvCJgUq2IlMOpFmlzCzA32+FS5/d2VIiL9xPtS0/weEmIJqY7ONvkQ+A
 VQq0c2u9Xck=
 =yrII
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-5.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of features and cleanups for IIO in 5.10

We have a couple of changes that apply to large sets of drivers, so
I have grouped those to keep this short.

There are a few late breaking fixes in here that can wait for the
merge window.

dt yaml conversions
-------------------

* adi,ad7768-1
* adi,ad7949
* aspeed,ast2400
* cosmic,10001-adc
* dlg,da9150-gpadc
* fsl,imx25-gcq
* fsl,imx7d-adc
* fsl,vf610
* holt,hi8435
* marvell,berlin2-adc
* motorola,cpcap-adc
* nuvoton,nau7802
* nuvoton,npcm750-adc
* nxp,lpc1850-adc
* nxp,lpc3220
* sprd,sc2720-adc
* st,stmpe-adc
* ti,adc12138
* ti,ads1015
* ti,ads7950
* ti,twl4030-madc

Features
--------

* adxrs290
  - Add triggered buffer support and expose data ready signal as a possible
    trigger. Includes updating bindings.
  - Add debugfs hooks for register access.
* mlx90632
  - Add a clear user interface to override the measured ambient temperature.
* vl53l0x
  - Add IRQ support including dt bindings.

Cleanups and minor fixes
------------------------
(groups)
Replace mlock with local lock:
  * adf4350
  * exynos-adc
  * fls-imx25-gcq
  * stm32-dac

devm use to simplify probe error handling and remove functions.
  * adis16201
  * adis16203
  * adis16209
  * adis16240
  * adis16136
  * adis16260
  * adis16400
  * adis16460
  * adis16480
  * adis library - drop unused adis_setup_buffer_and_trigger()

of_match_ptr removal and incorrect ACPI binding removal
  of_match_ptr() rarely makes sense in an IIO driver as space saving
  is trivial and it breaks ACPI PRP0001 based instantiation.
  Mostly this series is about removing examples that get copied into new
  drivers.
  * ad2s1200
  * ad5272
  * ad5446
  * ad5592r
  * ad5593r
  * ad5703
  * ak8974
  * ak8975
  * ams-iaq-core
  * as3935
  * atlas-sensor
  * ds1803
  * hdc100x
  * htu21
  * icp10100
  * lmp91000
  * pulsedlight
  * max30102
  * max5432
  * max5481
  * mcp4018
  * mcp4131
  * mcp4531
  * mcp4725
  * ms5611
  * ms5637
  * si7020
  * sgp30
  * ti-dac082s085
  * ti-dac5571
  * tmp007
  * tsys01
  * vz89x
  * zpa2326

kernel-doc fixes
  * iio-core
  * ad7303
  * ad7947
  * adis16080
  * adis16400
  * iio_dummy_evgen
  * sgp30

Fixes for buffer alignment when passed to iio_push_to_buffers_with_timestamp()
This is a long running effort.  There are a few more drivers to come.
  * inv_mpu6050
  * itg3200
  * si1145
  * st_lsm6dsx
  * ti-adc0832
  * ti-adc12138

(not driver focused)
* MAINTAINERS
  - Consolidate Analog Device IIO entries whilst removing Beniamin Bia.
  - Remove Hartmut Knaack as a listed IIO maintainer as he hasn't been
    active for a long time and people are getting intermitted bounces.
* Add __printf() markings to a few functions that were missing them.
* drop some rotted documentation from staging.
* rework buffer sysfs file creation (precursor to multiple buffer support)

(individual drivers)
* ad5592r
  - Fix use of true for IIO_SHARED_BY_TYPE
  - Tidy up locking and indentation.
* ad9467
  - Improve error message on chip-id missmatch.
  - Use more appropriate error value if chip-id not recognised.
* adis-library
  - Simplify burst mode handling.
* adxrs290
  - Make sure to switch device to standby mode during remove.
* as73211
  - Increase measurement timeout as seems some devices are slower.
* bma180
  - Fix use of true fo IIO_SHARED_BY_TYPE
* exynos_adc
  - Update binding to require second interrut with touch screen.
  - Update binding to not require syscon on S5Pv210
* hmc5843
  - Fix use of true for IIO_SHARED_BY_TYPE
* inv_mpu6050
  - Use regmap_noinc_read() for fifo reading.
* palmas_gpadc
  - Use module_platform_driver() to remove boilerplate.
* meson-saradc
  - style consistency fixes
* rockchip_saradc
  - Allow compile testing with !ARM.
* st_lsm6dsx
  - Changing scaling factor to use IIO_VAL_INT_PLUS_NANO to improve precision.
  - Fix an issue with unchecked return value.
* stm32-adc
  - Fix a missing return introduced in dev_err_probe() patch earlier in
    cycle.
* sx9310
  - Prefer async mode for probe as paticularly slow startup.
* vcnl4000
  - Add missing interrupt property to dt binding.

* tag 'iio-for-5.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (126 commits)
  dt-bindings: iio: vishay,vcnl4000: add interrupts property
  iio:imu:inv_mpu6050: Use regmap_noinc_read for fifo reads.
  iio:imu:inv_mpu6050 Fix dma and ts alignment and data leak issues.
  iio:adc:ti-adc12138 Fix alignment issue with timestamp
  iio:adc:ti-adc0832 Fix alignment issue with timestamp
  iio:imu:st_lsm6dsx Fix alignment and data leak issues
  iio:light:si1145: Fix timestamp alignment and prevent data leak.
  iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
  iio:imu:st_lsm6dsx: check st_lsm6dsx_shub_read_output return
  iio: adc: exynos_adc: Replace indio_dev->mlock with own device lock
  dt-bindings:iio:adc:holt,hi8435 yaml conversion
  dt-bindings:iio:adc:adi,ad7768-1 yaml conversion
  dt-bindings:iio:adc:adi,ad7949 yaml conversion
  dt-bindings:iio:adc:dlg,da9150-gpadc yaml conversion
  dt-bindings:iio:adc:motorola,cpcap-adc yaml conversion
  dt-bindings:iio:adc:nxp,lpc3220-adc yaml conversion
  dt-bindings:iio:adc:nxp,lpc1850-adc yaml conversion
  dt-bindings:iio:adc:fsl,imx25-gcq yaml conversion
  dt-bindings:iio:adc:fsl,imx7d-adc yaml conversion
  dt-bindings:iio:adc:ti,ads1015 yaml conversion
  ...
2020-09-22 09:45:11 +02:00
Alexandru Ardelean
c8bb10c50d iio: dac: ad5592r: localize locks only where needed in ad5592r_read_raw()
Since there was a recently discovered issue with these locks, it probably
makes sense to cleanup the code a bit, to prevent it from being used as an
example/reference.

This change moves the lock only where it is explicitly needed to protect
resources from potential concurrent accesses.

It also reworks the switch statements to do direct returns vs caching the
return value on a variable.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200706110259.23947-3-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-21 18:54:18 +01:00
Alexandru Ardelean
b004fe3303 iio: dac: ad5592r: un-indent code-block for scale read
The next rework may require an unindentation of a code block in
ad5592r_read_raw(), which would make review a bit more difficult.

This change unindents the code block for reading the scale of the
non-temperature channels.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200706110259.23947-2-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-21 18:54:18 +01:00
Jonathan Cameron
5fe68a4d85 iio:dac:ad5592r: Fix use of true for IIO_SHARED_BY_TYPE
struct iio_chan_spec_ext_info shared element is of type
enum iio_shared_by, not boolean.   It's like the enum value
will for IIO_SHARED_BY_TYPE == 1 == true, hence no actual
problem has been observed.

  CC [M]  drivers/iio/dac/ad5592r-base.o
  491 |   .shared = true,
      |

Fixes: 56ca9db862 ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200722142515.897378-1-jic23@kernel.org
2020-09-21 18:53:23 +01:00
Lee Jones
1536a8ee14 iio: dac: ad5064: Fix a few kerneldoc misdemeanours
Misspelling, missing description.

Fixes the following W=1 kernel build warning(s):

 drivers/iio/dac/ad5064.c:71: warning: bad line:                         internal vref.
 drivers/iio/dac/ad5064.c:83: warning: Function parameter or member 'channels' not described in 'ad5064_chip_info'
 drivers/iio/dac/ad5064.c:125: warning: Function parameter or member 'lock' not described in 'ad5064_state'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20200716135928.1456727-20-lee.jones@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-21 18:41:36 +01:00
Lee Jones
6026292469 iio: dac: ad7303: Complete 'struct ad7303_state' doc
Fixes the following W=1 kernel build warning(s):

 drivers/iio/dac/ad7303.c:49: warning: Function parameter or member 'vdd_reg' not described in 'ad7303_state'
 drivers/iio/dac/ad7303.c:49: warning: Function parameter or member 'vref_reg' not described in 'ad7303_state'
 drivers/iio/dac/ad7303.c:49: warning: Function parameter or member 'lock' not described in 'ad7303_state'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20200716135928.1456727-31-lee.jones@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-21 18:41:36 +01:00
Jonathan Cameron
16723c6eaa iio:dac:ti-dac5571: Drop of_match_ptr and CONFIG_OF protections
These prevent the use of this driver with ACPI via PRP0001 and are
an example of an anti pattern I'm trying to remove from IIO.
Hence drop them from this driver.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Link: https://lore.kernel.org/r/20200910173242.621168-16-jic23@kernel.org
2020-09-21 18:41:28 +01:00
Jonathan Cameron
40f84dd0e6 iio:dac:ti-dac082s085: Drop of_match_ptr and CONFIG_OF protections
These prevent the use of this driver with ACPI via PRP0001 and are
an example of an anti pattern I'm trying to remove from IIO.
Hence drop them from this driver.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/20200910173242.621168-15-jic23@kernel.org
2020-09-21 18:41:28 +01:00
Jonathan Cameron
2de887b0cf iio:dac:mcp4725: drop of_match_ptr and use generic fw properties
This enables use of ACPI PRP0001 and removes an antipattern I am
trying to stop people copying in IIO.

This particular case is more complex than most because it allowed
probing via sysfs with out a fwnode but would presumably always
have then failed.   Now the code will assume that properties are
the defaults if not specified or the firmware node is not present.
This relaxation of the constraints should not break any existing
cases and may enable some new ones.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Link: https://lore.kernel.org/r/20200910173242.621168-14-jic23@kernel.org
2020-09-21 18:41:28 +01:00