aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)AuthorFilesLines
2023-09-11iio: adc: at91_adc: Use devm_request_irq() helper functionJinjie Ruan1-10/+8
Use devm_request_irq() to request the interrupt, so we can avoid having to manually clean this up. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: frequency: adf4350: Use device managed functions and fix power down issue.Jinjie Ruan1-52/+23
The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. Also replace devm_regulator_get() and regulator_enable() with devm_regulator_get_enable() helper and remove regulator_disable(). Replace iio_device_register() with devm_iio_device_register() and remove iio_device_unregister(). And st->reg is not used anymore, so remove it. As Jonathan pointed out, couple of things that are wrong: 1) The device is powered down 'before' we unregister it with the subsystem and as such userspace interfaces are still exposed which probably won't do the right thing if the chip is powered down. 2) This isn't done in the error paths in probe. To solve this problem, register a new callback adf4350_power_down() with devm_add_action_or_reset(), to enable software power down in both error and device detach path. So the remove function can be removed. Remove spi_set_drvdata() from the probe function, since spi_get_drvdata() is not used anymore. Fixes: e31166f0fd48 ("iio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers") Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mcp3911: add support for the whole MCP39xx familyMarcus Folkesson2-57/+415
Microchip does have many similar chips, add support for those. The new supported chips are: - microchip,mcp3910 - microchip,mcp3912 - microchip,mcp3913 - microchip,mcp3914 - microchip,mcp3918 - microchip,mcp3919 Signed-off-by: Marcus Folkesson <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mcp3911: avoid ambiguity parameters in macrosMarcus Folkesson1-4/+4
Name macro parameters after what they represent instead of 'x' and make sure the evaluation of that will have no side effects. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Marcus Folkesson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mcp3911: fix indentationMarcus Folkesson1-21/+20
The whole file does not make use of indentation properly. Do something about it. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Marcus Folkesson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mcp3911: simplify usage of spi->devMarcus Folkesson1-27/+23
Replace the usage of `adc->spi->dev` with `dev` to make the code prettier. Reviewed-by: Andy Shevchenko <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Marcus Folkesson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mcp3911: make use of dev_err_probe()Marcus Folkesson1-16/+7
Simplify code by switch to dev_err_probe(). Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Marcus Folkesson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mt6577_auxadc: Simplify with device managed functionJinjie Ruan1-25/+15
Add a device managed hook, via devm_add_action_or_reset() and mt6577_power_off(), to power off on device detach. Replace iio_device_register() by devm_iio_device_register() and remove the mt6577_auxadc_remove() function used to unregister the device and power off the device. Remove platform_set_drvdata() from the probe function, since platform_get_drvdata() is not used anymore. Remove mt6577_auxadc_mod_reg() call from the probe function error path. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mt6577_auxadc: Simplify with dev_err_probe()Jinjie Ruan1-12/+8
Use the dev_err_probe() helper to simplify error handling during probe. This also handle scenario, when EDEFER is returned and useless error is printed. Signed-off-by: Jinjie Ruan <[email protected]> Suggested-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: spear_adc: Use dev_err_probe()Jinjie Ruan1-16/+11
Use the dev_err_probe() helper to simplify error handling during probe. This also handle scenario, when EDEFER is returned and useless error is printed. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: spear_adc: Use device managed functionJinjie Ruan1-35/+8
The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. Switch to devm_iio_device_register() and drop the remove function. This simplifies the code. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-11iio: adc: mt6577_auxadc: Use devm_clk_get_enabled() helper functionJinjie Ruan1-14/+3
The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-09-01Merge tag 'char-misc-6.6-rc1' of ↵Linus Torvalds79-784/+3911
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver updates from Greg KH: "Here is the big set of char/misc and other small driver subsystem changes for 6.6-rc1. Stuff all over the place here, lots of driver updates and changes and new additions. Short summary is: - new IIO drivers and updates - Interconnect driver updates - fpga driver updates and additions - fsi driver updates - mei driver updates - coresight driver updates - nvmem driver updates - counter driver updates - lots of smaller misc and char driver updates and additions All of these have been in linux-next for a long time with no reported problems" * tag 'char-misc-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (267 commits) nvmem: core: Notify when a new layout is registered nvmem: core: Do not open-code existing functions nvmem: core: Return NULL when no nvmem layout is found nvmem: core: Create all cells before adding the nvmem device nvmem: u-boot-env:: Replace zero-length array with DECLARE_FLEX_ARRAY() helper nvmem: sec-qfprom: Add Qualcomm secure QFPROM support dt-bindings: nvmem: sec-qfprom: Add bindings for secure qfprom dt-bindings: nvmem: Add compatible for QCM2290 nvmem: Kconfig: Fix typo "drive" -> "driver" nvmem: Explicitly include correct DT includes nvmem: add new NXP QorIQ eFuse driver dt-bindings: nvmem: Add t1023-sfp efuse support dt-bindings: nvmem: qfprom: Add compatible for MSM8226 nvmem: uniphier: Use devm_platform_get_and_ioremap_resource() nvmem: qfprom: do some cleanup nvmem: stm32-romem: Use devm_platform_get_and_ioremap_resource() nvmem: rockchip-efuse: Use devm_platform_get_and_ioremap_resource() nvmem: meson-mx-efuse: Convert to devm_platform_ioremap_resource() nvmem: lpc18xx_otp: Convert to devm_platform_ioremap_resource() nvmem: brcm_nvram: Use devm_platform_get_and_ioremap_resource() ...
2023-08-22Add cs42l43 PC focused SoundWire CODECMark Brown9-33/+73
Merge series from Charles Keepax <[email protected]>: This patch chain adds support for the Cirrus Logic cs42l43 PC focused SoundWire CODEC. The chain is currently based of Lee's for-mfd-next branch. This series is mostly just a resend keeping pace with the kernel under it, except for a minor fixup in the ASoC stuff. Thanks, Charles Charles Keepax (4): dt-bindings: mfd: cirrus,cs42l43: Add initial DT binding mfd: cs42l43: Add support for cs42l43 core driver pinctrl: cs42l43: Add support for the cs42l43 ASoC: cs42l43: Add support for the cs42l43 Lucas Tanure (2): soundwire: bus: Allow SoundWire peripherals to register IRQ handlers spi: cs42l43: Add SPI controller support .../bindings/sound/cirrus,cs42l43.yaml | 313 +++ MAINTAINERS | 4 + drivers/mfd/Kconfig | 23 + drivers/mfd/Makefile | 3 + drivers/mfd/cs42l43-i2c.c | 98 + drivers/mfd/cs42l43-sdw.c | 239 ++ drivers/mfd/cs42l43.c | 1188 +++++++++ drivers/mfd/cs42l43.h | 28 + drivers/pinctrl/cirrus/Kconfig | 11 + drivers/pinctrl/cirrus/Makefile | 2 + drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 609 +++++ drivers/soundwire/bus.c | 32 + drivers/soundwire/bus_type.c | 12 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-cs42l43.c | 284 ++ include/linux/mfd/cs42l43-regs.h | 1184 +++++++++ include/linux/mfd/cs42l43.h | 102 + include/linux/soundwire/sdw.h | 9 + include/sound/cs42l43.h | 17 + sound/soc/codecs/Kconfig | 16 + sound/soc/codecs/Makefile | 4 + sound/soc/codecs/cs42l43-jack.c | 946 +++++++ sound/soc/codecs/cs42l43-sdw.c | 74 + sound/soc/codecs/cs42l43.c | 2278 +++++++++++++++++ sound/soc/codecs/cs42l43.h | 131 + 26 files changed, 7615 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/cirrus,cs42l43.yaml create mode 100644 drivers/mfd/cs42l43-i2c.c create mode 100644 drivers/mfd/cs42l43-sdw.c create mode 100644 drivers/mfd/cs42l43.c create mode 100644 drivers/mfd/cs42l43.h create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs42l43.c create mode 100644 drivers/spi/spi-cs42l43.c create mode 100644 include/linux/mfd/cs42l43-regs.h create mode 100644 include/linux/mfd/cs42l43.h create mode 100644 include/sound/cs42l43.h create mode 100644 sound/soc/codecs/cs42l43-jack.c create mode 100644 sound/soc/codecs/cs42l43-sdw.c create mode 100644 sound/soc/codecs/cs42l43.c create mode 100644 sound/soc/codecs/cs42l43.h -- 2.30.2
2023-08-13Merge 6.5-rc6 into char-misc-nextGreg Kroah-Hartman9-33/+73
We need the char/misc fixes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-08-08drivers: iio: filter: admv8818: add bypass modeAntoniu Miclaus1-9/+56
Add filter bypass mode, which bypasses the low pass filter, high pass filter and disables/unregister the clock rate notifier. Currently a feature like bypassing the filter is not achievable straightforward and not very deductive. The user has to look through the code and call the set_lpf_3db_frequency and set_hpf_3db_frequency iio attributes from the user interface using the corner cases (freq > largest lpf supported by the part, respectively freq < smallest hpf supported by the part). Moreover, in such case of bypassing the filter, the input clock rate change might mess up things so we want to make sure that it is disabled. Also, the feature will help emphasizing the filter behavior, therefore adding it in the userspace will ease the charcaterization of the filter's effects when active/disabled. It was requested by users of the driver to ease the interaction with different configuration modes of the device. Signed-off-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-08iio: light: bd27008: Support BD27010 RGBMatti Vaittinen1-2/+311
The ROHM BU27010 is an RGBC sensor with a flickering detection FIFO. The RGBC+IR sensor functionality is largely similar to what the BU27008 has. There are some notable things though: - gain setting is once again new and exotic. Now, there is 6bit gain setting where 4 of the bits are common to all channels and 2 bits can be configured separately for each channel. The BU27010 has similar "1X on other channels vs 2X on IR when selector is 0x0" gain design as BU27008 had. So, we use same gain setting policy for BU27010 as we did for BU27008 - driver sets same gain selector for all channels but shows the gains separately for all channels so users can (at least in theory) detect this 1X vs 2X madness... - BU27010 has suffled all the control register bitfields to new addresses and bit positions while still keeping the register naming same. - Some more power/reset control is added. - FIFO for "flickering detection" is added. The control register suffling made this slightly nasty. Still, it is easier for maintenance perspective to add the BU27010 support in BU27008 driver because - even though the bit positions/addresses were changed - most of the driver structure can be re-used. Writing own driver for BU27010 would mean plenty of duplicate code albeit a tad more clarity. The flickering FIFO is not supported by the driver. Add BU27010 RGBC+IR support to rohm-bu27008 driver. Signed-off-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/111cd217ccece1c1f16ab4287532dc4e1ddb8a3f.1690958450.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-08iio: light: bu27008: add chip infoMatti Vaittinen1-114/+207
The ROHM BU27010 RGB + flickering sensor is in many regards similar to the BU27008. Prepare for adding support for BU27010 by allowing chip-specific properties to be brought from the of_device_id data. Signed-off-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/d5994648033d5513993b8d72eb186ddda211b5ac.1690958450.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-05iio: add MCP4728 I2C DAC driverAndrea Collamati3-0/+630
MCP4728 is a 12-bit quad channel DAC with I2C interface. support for: * per-channel gain * per-channel power state * per-channel power down mode control * per-channel vref selection internal/vdd * store current state to on-chip EEPROM Signed-off-by: Andrea Collamati <[email protected]> Link: https://lore.kernel.org/r/a0933003ed3c855f9d80d6ce0a40add2b6f0ba36.1691066050.git.andrea.collamati@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-05drivers: iio: admv1013: add vcc regulatorsAntoniu Miclaus1-0/+14
Add regulators for the VCC supplies of the admv1013. The patch aims to align the implementation with the current admv1014 driver where all the VCC supplies are handled as regulators. Signed-off-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-05iio: trigger: stm32-lptimer-trigger: remove unneeded platform_set_drvdata()Andrei Coardos1-8/+1
This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Reviewed-by: Alexandru Ardelean <[email protected]> Signed-off-by: Andrei Coardos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-05iio: adc: men_z188_adc: Remove redundant initialization owner in men_z188_driverLi Zetao1-1/+0
The module_mcb_driver() will set "THIS_MODULE" to driver.owner when register a mcb_driver, so it is redundant initialization to set driver.owner in men_z188_driver statement. Remove it for clean code. Signed-off-by: Li Zetao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-01iio: cdc: ad7150: relax return value check for IRQ getMatti Vaittinen1-5/+5
fwnode_irq_get[_byname]() were changed to not return 0 anymore. The special error case where device-tree based IRQ mapping fails can't no longer be reliably detected from this return value. This yields a functional change in the driver where the mapping failure is treated as an error. The mapping failure can occur for example when the device-tree IRQ information translation call-back(s) (xlate) fail, IRQ domain is not found, IRQ type conflicts, etc. In most cases this indicates an error in the device-tree and special handling is not really required. One more thing to note is that ACPI APIs do not return zero for any failures so this special handling did only apply on device-tree based systems. Drop the special handling for DT mapping failures as these can no longer be separated from other errors at driver side. Change all failures in IRQ getting to be handled by continuing without the events instead of aborting the probe upon certain errors. Signed-off-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/3ad1c6f195ead3dfa8711235e1dead139d27f700.1690890774.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-08-01iio: mb1232: relax return value check for IRQ getMatti Vaittinen1-5/+2
fwnode_irq_get() was changed to not return 0 anymore. Drop check for return value 0. Signed-off-by: Matti Vaittinen <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/9e18cf49a8bb581a84c3fa548ea577e2a3eb840d.1690890774.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: adc: fix the return value handle for platform_get_irq()Ruan Jinjie4-8/+8
There is no possible for platform_get_irq() to return 0 and the return value of platform_get_irq() is more sensible to show the error reason. Signed-off-by: Ruan Jinjie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: potentiometer: mcp4531: Use i2c_get_match_data()Biju Das1-68/+71
Replace device_get_match_data() and i2c_match_id() by i2c_get_match _data() by making similar I2C and DT-based matching table. Signed-off-by: Biju Das <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: potentiometer: mcp4018: Use i2c_get_match_data()Biju Das1-16/+19
Replace of_device_get_match_data() and i2c_match_id() by i2c_get_match _data() by making similar I2C and DT-based matching table. Signed-off-by: Biju Das <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: core: Fix issues and style of the commentsAndy Shevchenko1-20/+37
The `scripts/kernel-doc -v -none -Wall` reports several issues with the kernel doc in IIO core C file. Update the comments accordingly. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: core: Switch to krealloc_array()Andy Shevchenko1-1/+1
Let the krealloc_array() copy the original data and check for a multiplication overflow. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: core: Use sysfs_match_string() helperAndy Shevchenko1-39/+32
Use sysfs_match_string() helper instead of open coded variant. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: accel: adxl313: Use i2c_get_match_dataBiju Das1-3/+1
Replace device_get_match_data() and i2c_match_id() by i2c_get_match _data() as we have similar I2C and DT-based matching table. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: accel: adxl313: Fix adxl313_i2c_id[] tableBiju Das1-2/+2
The .driver_data in adxl313_i2c_id[] for adxl312 and adxl314 is wrong. Fix this issue by adding corresponding adxl31x_chip_info data. Reported-by: Jonathan Cameron <[email protected]> Closes: https://lore.kernel.org/all/20230722172832.04ad7738@jic23-huawei Fixes: a7a1c60bc4c9 ("drivers: iio: accel: adxl312 and adxl314 support") Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: cros_ec: Fix the allocation size for cros_ec_commandYiyuan Guo1-1/+1
The struct cros_ec_command contains several integer fields and a trailing array. An allocation size neglecting the integer fields can lead to buffer overrun. Reviewed-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Yiyuan Guo <[email protected]> Fixes: 974e6f02e27e ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub.") Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-29iio: adc: Remove redundant dev_err_probe()Ruan Jinjie5-11/+7
There is no need to call the dev_err() function directly to print a custom message when handling an error from either the platform_get_irq() or platform_get_irq_byname() functions as both are going to display an appropriate error message in case of a failure. Signed-off-by: Ruan Jinjie <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: imu: lsm6dsx: Fix mount matrix retrievalAlejandro Tafalla1-1/+1
The function lsm6dsx_get_acpi_mount_matrix should return an error when ACPI support is not enabled to allow executing iio_read_mount_matrix in the probe function. Fixes: dc3d25f22b88 ("iio: imu: lsm6dsx: Add ACPI mount matrix retrieval") Signed-off-by: Alejandro Tafalla <[email protected]> Acked-by: Lorenzo Bianconi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: adc: Explicitly include correct DT includesRob Herring24-23/+17
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Acked-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: imu: adis16475.c: Add has_burst32 flag to adis16477 devicesRamona Bolboaca1-0/+3
adis16477 devices support burst32 function, thus has_burst32 flag should be set to true. Signed-off-by: Ramona Bolboaca <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: imu: adis16475.c: Remove unused enum elementsRamona Bolboaca1-2/+0
Remove unused enum elements ADIS16475_SCAN_DIAG_S_FLAGS and ADIS16475_SCAN_CRC_FAILURE. Signed-off-by: Ramona Bolboaca <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: Add driver for Murata IRS-D200Waqar Hameed3-0/+971
Murata IRS-D200 is a PIR sensor for human detection. It has support for raw data measurements and detection event notification. Add a driver with support for triggered buffer and events. Map the various settings to the `iio` framework, e.g. threshold values, sampling frequency, filter frequencies etc. Signed-off-by: Waqar Hameed <[email protected]> Link: https://lore.kernel.org/r/d218a1bc75402b5ebd6e12a563f7315f83fe966c.1689753076.git.waqar.hameed@axis.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: Add event enums for running period and countWaqar Hameed1-0/+2
There are devices (such as Murata IRS-D200 PIR proximity sensor) that check the data signal with a running period. I.e. for a specified time, they count the number of conditions that have occurred, and then signal if that is more than a specified amount. `IIO_EV_INFO_PERIOD` resets when the condition no longer is true and is therefore not suitable for these devices. Add a new `iio_event_info` `IIO_EV_INFO_RUNNING_PERIOD` that can be used as a running period. Also add a new `IIO_EV_INFO_RUNNING_COUNT` that can be used to specify the number of conditions that must occur during this running period. Signed-off-by: Waqar Hameed <[email protected]> Link: https://lore.kernel.org/r/ee4a801ae9b9c4716c7bd23d8f79f232351df8bd.1689753076.git.waqar.hameed@axis.com Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: amplifiers: ad8366: add support for HMC792A AttenuatorKim Seer Paller2-0/+16
This change adds support for the HMC792A Digital Attenuator. The HMC792A is a broadband 6-bit GaAs MMIC Digital Attenuator operating from DC to 6.0 GHz with 15.75 dB attenuation control range in 0.25 dB steps. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/hmc792a.pdf Signed-off-by: Kim Seer Paller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: core: Improve indentation in a few placesAndy Shevchenko1-13/+10
Improve an indentation in a few places to increase readability. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: core: Get rid of redundant 'else'Andy Shevchenko1-3/+3
In the snippets like the following if (...) return / goto / break / continue ...; else ... the 'else' is redundant. Get rid of it. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-23iio: core: Use min() instead of min_t() to make code more robustAndy Shevchenko1-1/+1
min() has strict type checking and preferred over min_t() for unsigned types to avoid overflow. Here it's unclear why min_t() was chosen since both variables are of the same type. In any case update to use min(). Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: adc: meson: fix core clock enable/disable momentGeorge Stark1-11/+12
Enable core clock at probe stage and disable it at remove stage. Core clock is responsible for turning on/off the entire SoC module so it should be on before the first module register is touched and be off at very last moment. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Signed-off-by: George Stark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: adc: meson: init voltage control bitsGeorge Stark1-0/+48
Define and init voltage configuration bits. Those bits are inited in vendor boot code (bl2, bl33) already so do it in the driver to not depend on other code. Introduced bits: REG11[0] - selects Vref. 0 - calibration voltage, 1 - VDDA. txlx and later SoCs support VDDA or calibration voltage as Vref, but others support only calibration voltage. For newer platforms vendor uses VDDA as default. REG11[1] - reserved bit. g12a and later SoCs must write 1, others SoCs write 0. REG11[5] - Vref voltage. 0 - 0.9v, 1 - 1.8v. g12a and later SoCs must write 0, others SoCs write 1. REG11[6] - selects common-mode voltage, 0: from AVDD, 1: from Vref. g12a and later SoCs must write 0, others SoCs write 1. Signed-off-by: George Stark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: adc: meson: init internal continuous ring counterGeorge Stark1-0/+9
Disable internal continuous ring counter at init stage. Disable value depends on SoC family: gxl and later SoCs write 1, others write 0. This bit are inited in vendor boot code (bl2, bl33) already so do it in the driver to not depend on other code. Signed-off-by: George Stark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: adc: meson: init channels 0,1 input muxesGeorge Stark1-0/+16
Set up input channels 0,1 muxes in the same way as for the channels 2-7 later in the code. Signed-off-by: George Stark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: core: Prevent invalid memory access when there is no parentMilan Zamazal1-2/+3
Commit 813665564b3d ("iio: core: Convert to use firmware node handle instead of OF node") switched the kind of nodes to use for label retrieval in device registration. Probably an unwanted change in that commit was that if the device has no parent then NULL pointer is accessed. This is what happens in the stock IIO dummy driver when a new entry is created in configfs: # mkdir /sys/kernel/config/iio/devices/dummy/foo BUG: kernel NULL pointer dereference, address: ... ... Call Trace: __iio_device_register iio_dummy_probe Since there seems to be no reason to make a parent device of an IIO dummy device mandatory, let’s prevent the invalid memory access in __iio_device_register when the parent device is NULL. With this change, the IIO dummy driver works fine with configfs. Fixes: 813665564b3d ("iio: core: Convert to use firmware node handle instead of OF node") Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Milan Zamazal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2023-07-22iio: frequency: admv1013: propagate errors from regulator_get_voltage()Dan Carpenter1-1/+4
The regulator_get_voltage() function returns negative error codes. This function saves it to an unsigned int and then does some range checking and, since the error code falls outside the correct range, it returns -EINVAL. Beyond the messiness, this is bad because the regulator_get_voltage() function can return -EPROBE_DEFER and it's important to propagate that back properly so it can be handled. Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>