summaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel
AgeCommit message (Collapse)AuthorFilesLines
2022-11-27Merge tag 'iio-fixes-for-6.1d' of ↵Greg Kroah-Hartman1-1/+3
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 4th set of IIO fixes for 6.1 Single patch fixing a memory leak in an error path. Fine to queue either for 6.2 if too late for 6.1 * tag 'iio-fixes-for-6.1d' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: fix memory leak in iio_device_register_eventset() dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid" iio: adc: aspeed: Remove the trim valid dts property. iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails iio: accel: bma400: Fix memory leak in bma400_get_steps_reg() iio: light: rpr0521: add missing Kconfig dependencies iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw iio: health: afe4403: Fix oob read in afe4403_read_raw iio: light: apds9960: fix wrong register for gesture gain
2022-11-27Merge tag 'iio-for-6.2b' of ↵Greg Kroah-Hartman12-32/+32
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 2nd set of IIO new device support, cleanups etc for 6.2 Includes a few late breaking fixes for old issues. Contains a large set of conversions from i2c probe() to probe_new() as part of an attempt to finally get rid of the old style probe(). New devices support * adi,ad74115 - New driver for this complex input/output device with 16 bit ADCs, 14 bit DACs amongst other features. - A few tidy ups / removal of unused data patches followed. * adi,adf4377 - New driver for this dual output integer-N phased locked loop and VCO chip. * maxim,max30208 - New driver for this high accuracy digital temperature sensor. * st,lsm6dsx - Support for LSM6DS016IS (chip specific data) - Support for ISM330IS (id entry only) Minor cleanups etc * adi,adis - Fix a deadlock on device instance specific mutex. - Tidy up by calling unlocked form of __adis_initial_startup() in all cases and dropping the locked version. * adi,ad4130 - Reference spi-peripehral-props.yaml in the dt-binding. * adi,ad74413r - Fix a bug brought on by integer promotion of signed value to unsigned type. - Add an spi_device_id table to allow module autoloading to work. - Add support for reset pin. * adi,ad7606_par - devm_platform_get_and_ioremap_resource() instead of opencoding. * adi,ad7923 - Add dt-bindings docs for ad7927 via a fallback to ad7928 and do similar for ad7924. * adi,ltc2983 - Drop a now unneeded $ref for -nanoamp property as dt-schema no covers this unit. * maxim,max11410 - Fix mask due to repeated use of VREFN instead of one of them being VREFP. * qcom,spmi-iadc - Add fallback compatibles to dt-binding. * renesas,rzg2l - Document use for RZ/Five SoC. * st,stm32-adc - Improved calibration support with error logging and a debugfs interface to read back the result. * ti,adc128s052 - Fix an issue with missing data members in the adc128_of_match table that meant all device were being handled as adc128s052 ADCs. * tag 'iio-for-6.2b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (178 commits) iio: addac: ad74413r: fix blank line after declaration warning iio: addac: ad74115: remove unused ad74115_dac_slew_rate_hz_tbl dt-bindings: iio: imu: st_lsm6dsx: add ism330is iio: imu: st_lsm6dsx: add support to ISM330IS iio: frequency: adf4377: add support for ADF4377 dt-bindings: iio: frequency: add adf4377 doc dt-bindings: iio: adc: ad4130: use spi-peripheral-props.yaml dt-bindings: iio: temperature: ltc2983: drop $ref for -nanoamp properties dt-bindings: iio: adc: renesas,rzg2l-adc: Document RZ/Five SoC iio: adc128s052: add proper .data members in adc128_of_match table iio: adc: stm32-adc: add debugfs to read raw calibration result iio: adc: stm32-adc: improve calibration error log iio: adc: stm32-adc: smart calibration support iio: addac: ad74413r: add support for reset-gpio dt-bindings: iio: ad74413r: add optional reset-gpios iio: addac: ad74413r: add spi_device_id table dt-bindings: iio/adc: qcom,spmi-iadc: use double compatibles dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is iio: imu: st_lsm6dsx: add support to LSM6DSO16IS iio: addac: add AD74115 driver ...
2022-11-25Merge tag 'iio-for-6.2a-take2' of ↵Greg Kroah-Hartman32-236/+1564
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 1st set of IIO new device support, feature and cleanup for 6.2 (take2) We have finally managed to take the mlock mutex entirely private so as to avoid it being used for multiple purposes. Now it is just used to protect device mode transitions (typically to and from buffered capture). Includes merge of an immutable i2c branch to get the new i2c_client_get_device_id() (thanks to Wolfram for providing the branch). Based on rc3 to pick up some precursor fixes from early in the cycle and avoid an unnecessarily messy history. New device support * adi,ad4310 - New driver to support this very flexible measurement device including a 24 bit ADC. Later fix for documentation build issue. * adi,adxl355 - Add support of the ADXL359 accelerometer. * adi,ltc2983 - Support additional variants of the temperatures sensor: LTC2984 with an EEPROM LTC2985, LTC2986 with only 10 channels. * invensense,icm42600 - Add support for icm42631 (needed only ID and WHOAMI) * kionix,kx022a - New driver for this 3 axis accelerometer. * maxim,max11401 - New driver to support this 24-bit 10 channel ADC. Includes some new ABI to support configuration of notch filters. * mediatek,mt6370 - Add new driver to support the ADC part of the mt6370. * st,lsm6dsx - Add support for LSM6DSV accelerometer and gyroscope. Simple additional of chip specific data and IDs. - Add support for LSM6DSV16X accelerometer and gyroscope. Compatible with features currently implemented for the LSM6DSV. * st,stm32-adc - Add support for stm32pm13x SoCs. core / subsystem wide: - Add new IIO_STATIC_CONST_DEVICE_ATTR() which is a dance necessary to allow for the wrapping of attributes in the code that duplicates them for multiple buffers. - Harden against future issues with expectation that all buffer attributes are iio_dev_attrs by changing the code to take an array of pointers of the correct type. - Last transitions of drivers to local locks rather than missuses of mlock. - Add an iio_device_claim_buffer_mode() callback to avoid a race in the max30100 driver without directly using mlock. - Move mlock to the opaque IIO device structure to prevent misuse. - Add missing spi_device_id tables to support auto loading of modules. - Update some ADI maintainers in DT bindings. - A few more moves of bus drivers and core module sets to export name spaces. - Extensive use of new devm_regulator_get_enable() and friends. - Switch a bunch of i2c drivers to probe_new() including the bmp280 which makes use of the new i2c_client_get_device_id() helper to simplify this change. dt-bindings: - More use of spi-peripheral-props.yaml. Features * freescale,mpl115 - Use runtime PM to implement shutdown GPIO support. * melexis,mlx90632 - More sophisticated runtime power management - Provide access to sampling frequency. - Trivial follow up fixes. * microchip,mcp3911 - Support control of PGA. * st,lsm6dsx - Add support for software triggers for cases where the IRQ lines are not wired up. * vishay,vcnl4000 - Add control of integration time. Minor cleanups and fixes * adi,ad4130 - Improve ABI documentation formatting. - Kconfig dependency fixup. * adi,ad5758 - Minor dt binding fix. * adi,ad9834 - Tidy up line breaks. * adi,ade7854 - Minor improvement in code clarity by replacing a ternary. * adi,admv8818 - Harden code against hardware returning wrong values. * adi,adxl355 - Warn only if unknown device ID detected to allow for fall back device tree compatibles on future devices. * adi,ltc2983 - dt-bindings clarifications and general improvements. - Ensure DMA safe buffer for bulk writes without relying on current regmap implementation choices. * avago,adps9960 - Fix up a disconnect between event enable attributes and what was enabled. * bosch,bma400 - Switch to dev_err_probe() from open coded EPROBE_DEFER handling. * cosmic,cc10001 - Fully devm managed probe() and related tidying up. * meas,ms5611 - Add an example of spi-max-frequency. * meleixs,mlx90632 - Tidy up confusing error return value. - Style improvements. * multiplexer - Switch to dev_err_probe() from open coded EPROBE_DEFER handling. * qcom,spmi-vadc - Minor dt binding improvements. * rockchip,saradc - Add ID for rv1126. * semtech,sx9360 - Add SAMM0208 ACPI ID. Doesn't appear to be a valid vendor prefix but is in the wild. * st,lsm6dsx - Factor out common code as _device_set_enable(). - Fix up wrong docs after LSM6DSV addition. * st,stm32-adc - Manage the min sampling time on all internal channels. * trig,sysfs - Improve error labels. * tag 'iio-for-6.2a-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (146 commits) iio: pressure: bmp280: convert to i2c's .probe_new() iio: imu: st_lsm6dsx: fix LSM6DSV sensor description iio: adc: ad4130: depend on GPIOLIB staging: iio: meter: replace ternary operator by if condition iio: light: apds9960: Fix iio_event_spec structures dt-bindings: iio: imu: Add inv_icm42600 documentation iio: imu: inv_icm42600: Add support for icm42631 dt-bindings: iio: adc: rockchip-saradc: Add saradc for rv1126 dt-bindings: iio: dac: adi,ad5758: Drop 'contains' from 'adi,dc-dc-mode' dt-bindings: iio: imu: st_lsm6dsx: add lsm6dsv16x iio: imu: st_lsm6dsx: add support to LSM6DSV16X iio: proximity: sx9360: Add a new ACPI hardware ID iio: temperature: mlx90632: Add missing static marking on devm_pm_ops iio: temperature: mlx90632: Add error handling for devm_pm_runtime_enable() iio: temperature: ltc2983: support more parts dt-bindings: iio: temperature: ltc2983: support more parts dt-bindings: iio: temperature: ltc2983: use generic node name in example dt-bindings: iio: temperature: ltc2983: describe broken mux delay property dt-bindings: iio: temperature: ltc2983: refine descriptions dt-bindings: iio: temperature: ltc2983: change default excitation for custom thermistors ...
2022-11-23iio: accel: adis16209: Call '__adis_initial_startup()' in probeRamona Bolboaca1-1/+1
Call '__adis_initial_startup()' instead of its locked variant in 'adis16209_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-4-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: adis16201: Call '__adis_initial_startup()' in probeRamona Bolboaca1-1/+1
Call '__adis_initial_startup()' instead of its locked variant in 'adis16201_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-3-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mma9553: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-59-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mma9551: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-58-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mma8452: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-57-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mma7455_i2c: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-56-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: kxcjk-1013: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-55-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: da280: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-54-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: bmc150: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-53-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: bma400: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-52-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: bma180: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-51-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: adxl372_i2c: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.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> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-50-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23drivers: iio: accel: Add support for ADXL359 deviceRamona Bolboaca4-27/+121
Add support for ADXL359 device in already existing ADXL355 driver. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adxl359.pdf Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com> Link: https://lore.kernel.org/r/20221031105129.47740-4-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23drivers: iio: accel: Use warning if invalid device id is detectedRamona Bolboaca1-4/+2
Use warning instead of failing driver probe if invalid device id is detected for ADXL355 device. Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com> Link: https://lore.kernel.org/r/20221031105129.47740-2-ramona.bolboaca@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: Don't silently expect attribute typesMatti Vaittinen4-19/+19
The iio_triggered_buffer_setup_ext() and the devm_iio_kfifo_buffer_setup_ext() were changed by commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") to silently expect that all attributes given in buffer_attrs array are device-attributes. This expectation was not forced by the API - and some drivers did register attributes created by IIO_CONST_ATTR(). When using IIO_CONST_ATTRs the added attribute "wrapping" does not copy the pointer to stored string constant and when the sysfs file is read the kernel will access to invalid location. Change the function signatures to expect an array of iio_dev_attrs to avoid similar errors in the future. Merge conflict resolved whilst applying due to patch crossing with two new drivers (kx022a accelerometer and ad4130 ADC). Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/63f54787a684eb1232f1c5d275a09c786987fe4a.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: bmc150-accel-core: Use IIO_STATIC_CONST_DEVICE_ATTR()Matti Vaittinen1-16/+3
Slightly simplify by dropping open-coded constant data iio_dev_attr functions and using the IIO_STATIC_CONST_DEVICE_ATTR() instead. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/b1b0d662705b43d68594639fb7719bc431101f79.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: adxl372: Use IIO_STATIC_CONST_DEVICE_ATTR()Matti Vaittinen1-16/+3
Slightly simplify by dropping open-coded constant data iio_dev_attr functions and using the IIO_STATIC_CONST_DEVICE_ATTR() instead. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/3632af8849ef101c54ec1f739596f22c773b067c.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: adxl367: Use IIO_STATIC_CONST_DEVICE_ATTR()Matti Vaittinen1-16/+3
Slightly simplify by dropping open-coded constant data iio_dev_attr functions and using the IIO_STATIC_CONST_DEVICE_ATTR() instead. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/c96c55363b8f36017ef7f18fdfe810cd3990e2a4.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: Support Kionix/ROHM KX022A accelerometerMatti Vaittinen6-0/+1357
KX022A is a 3-axis accelerometer from ROHM/Kionix. The sensor features include variable ODRs, I2C and SPI control, FIFO/LIFO with watermark IRQ, tap/motion detection, wake-up & back-to-sleep events, four acceleration ranges (2, 4, 8 and 16g), and probably some other cool features. Add support for the basic accelerometer features such as getting the acceleration data via IIO. (raw reads, triggered buffer [data-ready] or using the WMI IRQ). Important things to be added include the double-tap, motion detection and wake-up as well as the runtime power management. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/758b00d6aea0a6431a5a3a78d557d449c113b21e.1666614295.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: stk8ba50: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-22-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: stk8312: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-21-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mxc6255: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-20-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mxc4005: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-19-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mma7660: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-15-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: mc3230: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-13-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: kxsd9: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-12-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: dmard10: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-10-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: dmard09: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-9-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: dmard06: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-8-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: da311: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-7-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: adxl367: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
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/20221023132302.911644-2-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: msa311: Use devm_regulator_get_enable()Jonathan Cameron1-19/+2
This driver only turns the power on at probe and off via a custom devm_add_action_or_reset() callback. The new devm_regulator_get_enable() replaces this boilerplate code. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Dmitry Rokosov <DDRokosov@sberdevices.ru> Reviewed-by: Dmitry Rokosov <ddrokosov@sberdevices.ru> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221016163409.320197-6-jic23@kernel.org
2022-11-23iio: accel: kxcjk-1013: Use devm_regulator_bulk_get_enable()Jonathan Cameron1-21/+4
This driver only turns the power on at probe and off via a custom devm_add_action_or_reset() callback. The new devm_regulator_bulk_get_enable() replaces this boilerplate code. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221016163409.320197-5-jic23@kernel.org
2022-11-23iio: accel: fxls8962af: Use devm_regulator_get_enable()Jonathan Cameron1-21/+3
This driver only turns the power on at probe and off via a custom devm_add_action_or_reset() callback. The new devm_regulator_get_enable() replaces this boilerplate code. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221016163409.320197-4-jic23@kernel.org
2022-11-23iio: accel: adxl367: Use devm_regulator_bulk_get_enable()Jonathan Cameron1-24/+4
This driver only turns the power on at probe and off via a custom devm_add_action_or_reset() callback. The new devm_regulator_bulk_get_enable() replaces this boilerplate code. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221016163409.320197-2-jic23@kernel.org
2022-11-23iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS()Jonathan Cameron3-11/+9
Using this macro allows the compiler to remove unused structures and callbacks if we are not building with CONFIG_PM* without needing __maybe_unused markings. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Sean Nyekjaer <sean@geanix.com> -- Switched to Paul Cercueil's more flexible implementation fo the macro. Dropped Sean's Ack given new form of macro being used. Acked-by: Sean Nyekjaer <sean@geanix.com> Link: https://lore.kernel.org/r/20220925155719.3316280-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: sca3300: Silence no spi_device_id warningWei Yongjun1-2/+10
SPI devices use the spi_device_id for module autoloading even on systems using device tree, after commit 5fa6863ba692 ("spi: Check we have a spi_device_id for each DT compatible"), kernel warns as follows since the spi_device_id is missing: SPI driver sca3300 has no spi_device_id for murata,scl3300 Add spi_device_id entries to silence the warning, and ensure driver module autoloading works. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Tomas Melin <tomas.melin@vaisala.com> Link: https://lore.kernel.org/r/20220921163620.805879-3-weiyongjun@huaweicloud.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: accel: bma400: Switch to use dev_err_probe() helperYuan Can1-7/+3
In the probe path, dev_err() can be replace with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. Signed-off-by: Yuan Can <yuancan@huawei.com> Link: https://lore.kernel.org/r/20220921023915.47300-1-yuancan@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-12iio: accel: bma400: Fix memory leak in bma400_get_steps_reg()Dong Chenchen1-1/+3
When regmap_bulk_read() fails, it does not free steps_raw, which will cause a memory leak issue, this patch fixes it. Fixes: d221de60eee3 ("iio: accel: bma400: Add separate channel for step counter") Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com> Reviewed-by: Jagath Jog J <jagathjog1996@gmail.com> Link: https://lore.kernel.org/r/20221110010726.235601-1-dongchenchen2@huawei.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-10-29iio: accel: bma400: Ensure VDDIO is enable defore reading the chip ID.Jonathan Cameron1-12/+12
The regulator enables were after the check on the chip variant, which was very unlikely to return a correct value when not powered. Presumably all the device anyone is testing on have a regulator that is already powered up when this code runs for reasons beyond the scope of this driver. Move the read call down a few lines. Fixes: 3cf7ded15e40 ("iio: accel: bma400: basic regulator support") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dan Robertson <dan@dlrobertson.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20221002144133.3771029-1-jic23@kernel.org
2022-10-17iio: bmc150-accel-core: Fix unsafe buffer attributesMatti Vaittinen1-5/+18
The iio_triggered_buffer_setup_ext() was changed by commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") to silently expect that all attributes given in buffer_attrs array are device-attributes. This expectation was not forced by the API - and some drivers did register attributes created by IIO_CONST_ATTR(). The added attribute "wrapping" does not copy the pointer to stored string constant and when the sysfs file is read the kernel will access to invalid location. Change the IIO_CONST_ATTRs from the driver to IIO_DEVICE_ATTR in order to prevent the invalid memory access. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") Link: https://lore.kernel.org/r/cf8a56658fc38db8bed64f456d898f5ad5a2814f.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-10-17iio: adxl367: Fix unsafe buffer attributesMatti Vaittinen1-5/+18
The devm_iio_kfifo_buffer_setup_ext() was changed by commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") to silently expect that all attributes given in buffer_attrs array are device-attributes. This expectation was not forced by the API - and some drivers did register attributes created by IIO_CONST_ATTR(). The added attribute "wrapping" does not copy the pointer to stored string constant and when the sysfs file is read the kernel will access to invalid location. Change the IIO_CONST_ATTRs from the driver to IIO_DEVICE_ATTR in order to prevent the invalid memory access. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/2e2d9ec34fb1df8ab8e2749199822db8cc91d302.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-10-17iio: adxl372: Fix unsafe buffer attributesMatti Vaittinen1-5/+18
The iio_triggered_buffer_setup_ext() was changed by commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") to silently expect that all attributes given in buffer_attrs array are device-attributes. This expectation was not forced by the API - and some drivers did register attributes created by IIO_CONST_ATTR(). The added attribute "wrapping" does not copy the pointer to stored string constant and when the sysfs file is read the kernel will access to invalid location. Change the IIO_CONST_ATTRs from the driver to IIO_DEVICE_ATTR in order to prevent the invalid memory access. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/19158499623cdf7f9c5efae1f13c9f1a918ff75f.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-10-08Merge tag 'char-misc-6.1-rc1' of ↵Linus Torvalds13-118/+1978
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc and other driver updates from Greg KH: "Here is the large set of char/misc and other small driver subsystem changes for 6.1-rc1. Loads of different things in here: - IIO driver updates, additions, and changes. Probably the largest part of the diffstat - habanalabs driver update with support for new hardware and features, the second largest part of the diff. - fpga subsystem driver updates and additions - mhi subsystem updates - Coresight driver updates - gnss subsystem updates - extcon driver updates - icc subsystem updates - fsi subsystem updates - nvmem subsystem and driver updates - misc driver updates - speakup driver additions for new features - lots of tiny driver updates and cleanups All of these have been in the linux-next tree for a while with no reported issues" * tag 'char-misc-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (411 commits) w1: Split memcpy() of struct cn_msg flexible array spmi: pmic-arb: increase SPMI transaction timeout delay spmi: pmic-arb: block access for invalid PMIC arbiter v5 SPMI writes spmi: pmic-arb: correct duplicate APID to PPID mapping logic spmi: pmic-arb: add support to dispatch interrupt based on IRQ status spmi: pmic-arb: check apid against limits before calling irq handler spmi: pmic-arb: do not ack and clear peripheral interrupts in cleanup_irq spmi: pmic-arb: handle spurious interrupt spmi: pmic-arb: add a print in cleanup_irq drivers: spmi: Directly use ida_alloc()/free() MAINTAINERS: add TI ECAP driver info counter: ti-ecap-capture: capture driver support for ECAP Documentation: ABI: sysfs-bus-counter: add frequency & num_overflows items dt-bindings: counter: add ti,am62-ecap-capture.yaml counter: Introduce the COUNTER_COMP_ARRAY component type counter: Consolidate Counter extension sysfs attribute creation counter: Introduce the Count capture component counter: 104-quad-8: Add Signal polarity component counter: Introduce the Signal polarity component counter: interrupt-cnt: Implement watch_validate callback ...
2022-09-21iio: accel: bma400: Fix smatch warning based on use of unintialized value.Jonathan Cameron1-1/+2
Only specific bits in this value are ever used and those are initialized, but that is complex to reason about in a checker. Hence, initialize the value to zero and avoid the complexity. Smatch warning: drivers/iio/accel/bma400_core.c:1287 bma400_tap_event_en() error: uninitialized symbol 'field_value'. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Jagath Jog J <jagathjog1996@gmail.com> Cc: Alexander Potapenko <glider@google.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Jagath Jog J <jagathjog1996@gmail.com> Fixes: 961db2da159d ("iio: accel: bma400: Add support for single and double tap events") Link: https://lore.kernel.org/r/20220917131401.2815486-1-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-09-21iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr()Jonathan Cameron2-10/+7
These macros allow the compiler to remove unused pm ops functions without needing to mark them maybe unused. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn> Cc: Mike Looijmans <mike.looijmans@topic.nl> Link: https://lore.kernel.org/r/20220807185618.1038812-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-09-21drivers: iio: accel: adxl312 and adxl314 supportGeorge Mois4-93/+281
ADXL312 and ADXL314 are small, thin, low power, 3-axis accelerometers with high resolution (13-bit) measurement up to +/-12 g and +/- 200 g respectively. Implement support for ADXL312 and ADXL314 by extending the ADXL313 driver. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL312.pdf Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL314.pdf Signed-off-by: George Mois <george.mois@analog.com> Link: https://lore.kernel.org/r/20220905132018.364900-2-george.mois@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>