Andrea Collamati
7b24a034ad
iio: add MCP4728 I2C DAC driver
...
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 <andrea.collamati@gmail.com >
Link: https://lore.kernel.org/r/a0933003ed3c855f9d80d6ce0a40add2b6f0ba36.1691066050.git.andrea.collamati@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 19:29:39 +01:00
Andrea Collamati
74d4cd7a91
dt-bindings: iio: dac: add mcp4728.yaml
...
Add documentation for MCP4728
Signed-off-by: Andrea Collamati <andrea.collamati@gmail.com >
Reviewed-by: Conor Dooley <conor.dooley@microchip.com >
Link: https://lore.kernel.org/r/d93dd116cfa7f958c038c0c62993071ea48451d2.1691066050.git.andrea.collamati@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 19:29:39 +01:00
Antoniu Miclaus
320b92a4c1
drivers: iio: admv1013: add vcc regulators
...
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 <antoniu.miclaus@analog.com >
Link: https://lore.kernel.org/r/20230731094455.26742-2-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 19:29:39 +01:00
Antoniu Miclaus
eaf3ada827
dt-bindings: iio: admv1013: add vcc regulators
...
Add bindings for the VCC regulators of the ADMV1013 microware
upconverter.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Acked-by: Conor Dooley <conor.dooley@microchip.com >
Link: https://lore.kernel.org/r/20230731094455.26742-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 19:29:39 +01:00
Andrei Coardos
d866f14071
iio: trigger: stm32-lptimer-trigger: remove unneeded platform_set_drvdata()
...
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 <alex@shruggie.ro >
Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com >
Link: https://lore.kernel.org/r/20230802120915.25631-1-aboutphysycs@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 19:29:39 +01:00
Li Zetao
e19480dded
iio: adc: men_z188_adc: Remove redundant initialization owner in men_z188_driver
...
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 <lizetao1@huawei.com >
Link: https://lore.kernel.org/r/20230804100938.100435-1-lizetao1@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-05 17:43:17 +01:00
Antoniu Miclaus
6d9c5ae6a7
dt-bindings: iio: admv1014: make all regs required
...
Make the regulators required in the dt bindings.
Despite the fact that the datasheet is not explicit enough, all the
specifications of the part are built around these pins being supplied.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20230731144404.389255-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-01 19:12:00 +01:00
Matti Vaittinen
b20f5801ec
iio: cdc: ad7150: relax return value check for IRQ get
...
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 <mazziesaccount@gmail.com >
Link: https://lore.kernel.org/r/3ad1c6f195ead3dfa8711235e1dead139d27f700.1690890774.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-01 18:55:55 +01:00
Matti Vaittinen
1402913c92
iio: mb1232: relax return value check for IRQ get
...
fwnode_irq_get() was changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/9e18cf49a8bb581a84c3fa548ea577e2a3eb840d.1690890774.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-08-01 18:55:46 +01:00
Ruan Jinjie
c09ddcdd4d
iio: adc: fix the return value handle for platform_get_irq()
...
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 <ruanjinjie@huawei.com >
Link: https://lore.kernel.org/r/20230727131607.2897937-1-ruanjinjie@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 16:23:45 +01:00
Chenyuan Mi
49d736313d
tools: iio: iio_generic_buffer: Fix some integer type and calculation
...
In function size_from_channelarray(), the return value 'bytes' is defined
as int type. However, the calcution of 'bytes' in this function is designed
to use the unsigned int type. So it is necessary to change 'bytes' type to
unsigned int to avoid integer overflow.
The size_from_channelarray() is called in main() function, its return value
is directly multipled by 'buf_len' and then used as the malloc() parameter.
The 'buf_len' is completely controllable by user, thus a multiplication
overflow may occur here. This could allocate an unexpected small area.
Signed-off-by: Chenyuan Mi <michenyuan@huawei.com >
Link: https://lore.kernel.org/r/20230725092407.62545-1-michenyuan@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 15:59:20 +01:00
Biju Das
9afc8c6dc6
iio: potentiometer: mcp4531: Use i2c_get_match_data()
...
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 <biju.das.jz@bp.renesas.com >
Link: https://lore.kernel.org/r/20230723102743.102284-1-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 15:55:48 +01:00
Biju Das
b68adc0ee5
iio: potentiometer: mcp4018: Use i2c_get_match_data()
...
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 <biju.das.jz@bp.renesas.com >
Link: https://lore.kernel.org/r/20230723105209.175545-1-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 15:53:59 +01:00
Andy Shevchenko
65659a8df1
iio: core: Fix issues and style of the comments
...
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 <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Reviewed-by: Randy Dunlap <rdunlap@infradead.org >
Link: https://lore.kernel.org/r/20230724110204.46285-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:48:09 +01:00
Andy Shevchenko
5a0821e0e3
iio: core: Switch to krealloc_array()
...
Let the krealloc_array() copy the original data and
check for a multiplication overflow.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230724110204.46285-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:47:28 +01:00
Andy Shevchenko
971ddd4b4d
iio: core: Use sysfs_match_string() helper
...
Use sysfs_match_string() helper instead of open coded variant.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230724110204.46285-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:34:59 +01:00
Biju Das
579f6b003a
iio: accel: adxl313: Use i2c_get_match_data
...
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 <biju.das.jz@bp.renesas.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Link: https://lore.kernel.org/r/20230725171624.331283-3-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:30:39 +01:00
Biju Das
f636554c4c
iio: accel: adxl313: Fix adxl313_i2c_id[] table
...
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 <jic23@kernel.org >
Closes: https://lore.kernel.org/all/20230722172832.04ad7738@jic23-huawei
Fixes: a7a1c60bc4 ("drivers: iio: accel: adxl312 and adxl314 support")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Link: https://lore.kernel.org/r/20230725171624.331283-2-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:30:39 +01:00
Ruan Jinjie
089c1e1132
iio: adc: Remove redundant dev_err_probe()
...
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 <ruanjinjie@huawei.com >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Acked-by: Heiko Stuebner <heiko@sntech.de >
Link: https://lore.kernel.org/r/20230727073912.4178659-1-ruanjinjie@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-29 12:13:17 +01:00
Rob Herring
1240c94ce8
iio: adc: Explicitly include correct DT includes
...
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 <robh@kernel.org >
Acked-by: Heiko Stuebner <heiko@sntech.de >
Link: https://lore.kernel.org/r/20230714174628.4057920-1-robh@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:38:13 +01:00
Ramona Bolboaca
c1f10bff16
iio: imu: adis16475.c: Add has_burst32 flag to adis16477 devices
...
adis16477 devices support burst32 function, thus has_burst32
flag should be set to true.
Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230719123152.309624-3-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:24:33 +01:00
Ramona Bolboaca
a216d411b5
iio: imu: adis16475.c: Remove unused enum elements
...
Remove unused enum elements ADIS16475_SCAN_DIAG_S_FLAGS and
ADIS16475_SCAN_CRC_FAILURE.
Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230719123152.309624-2-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:23:22 +01:00
Waqar Hameed
3db3562bc6
iio: Add driver for Murata IRS-D200
...
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 <waqar.hameed@axis.com >
Link: https://lore.kernel.org/r/d218a1bc75402b5ebd6e12a563f7315f83fe966c.1689753076.git.waqar.hameed@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:21:54 +01:00
Waqar Hameed
5e1cd3e97e
iio: Add event enums for running period and count
...
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 <waqar.hameed@axis.com >
Link: https://lore.kernel.org/r/ee4a801ae9b9c4716c7bd23d8f79f232351df8bd.1689753076.git.waqar.hameed@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:16:18 +01:00
Waqar Hameed
67060927aa
dt-bindings: iio: proximity: Add Murata IRS-D200
...
Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus
for communication with interrupt support. Add devicetree bindings
requiring the compatible string, I2C slave address (reg), power supply
and interrupts.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com >
Link: https://lore.kernel.org/r/09975910ea638a9aa893411124bbd2a5c98e45c3.1689753076.git.waqar.hameed@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 13:16:18 +01:00
Kim Seer Paller
247d3b6321
iio: amplifiers: ad8366: add support for HMC792A Attenuator
...
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 <kimseer.paller@analog.com >
Link: https://lore.kernel.org/r/20230721121038.183404-1-kimseer.paller@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 12:22:56 +01:00
Andy Shevchenko
b662f4ba20
iio: core: Improve indentation in a few places
...
Improve an indentation in a few places to increase readability.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230721170022.3461-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 10:24:16 +01:00
Andy Shevchenko
1702df5d8f
iio: core: Get rid of redundant 'else'
...
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 <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230721170022.3461-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 10:15:42 +01:00
Andy Shevchenko
cb1d175350
iio: core: Use min() instead of min_t() to make code more robust
...
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 <andriy.shevchenko@linux.intel.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230721170022.3461-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-23 10:13:47 +01:00
George Stark
90c6241860
iio: adc: meson: init voltage control bits
...
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 <gnstark@sberdevices.ru >
Link: https://lore.kernel.org/r/20230715110654.6035-4-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-22 17:58:23 +01:00
George Stark
d1adcaf7a4
iio: adc: meson: init internal continuous ring counter
...
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 <gnstark@sberdevices.ru >
Link: https://lore.kernel.org/r/20230715110654.6035-3-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-22 17:58:23 +01:00
George Stark
6ad9f01cf4
iio: adc: meson: init channels 0,1 input muxes
...
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 <gnstark@sberdevices.ru >
Link: https://lore.kernel.org/r/20230715110654.6035-2-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-22 17:58:23 +01:00
Biju Das
ad25fc289b
iio: accel: adxl355: Simplify probe()
...
Simplify the probe() by replacing of_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 <biju.das.jz@bp.renesas.com >
Reviewed-by: Puranjay Mohan <puranjay12@gmail.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Link: https://lore.kernel.org/r/20230716175218.130557-2-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-22 17:24:51 +01:00
George Stark
3a06b2845a
iio: adc: meson: support reading from channel 7 mux inputs
...
Add IIO channel for all muxed inputs of channel 7.
Meson saradc channel 7 is connected to a mux that can switch input
to well-known sources like Vdd, GND and several Vdd dividers.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-7-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:31 +01:00
George Stark
b593ce5db2
iio: adc: meson: add channel labels
...
Add channel labels to provide human-readable names for the inputs.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-6-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:31 +01:00
George Stark
c38180bf3d
iio: adc: meson: add enum for iio channel numbers
...
Channels could be referenced in the driver code and using enum allows
to make it more robust.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-5-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:31 +01:00
George Stark
2b592ff48e
iio: adc: meson: move meson_sar_adc_set_chan7_mux routine upper
...
meson_sar_adc_set_chan7_mux is a basic func() for writing single register,
defined as static. Moved it up so it could be used in more places.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-4-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
George Stark
d26f0514f0
iio: adc: meson: move enums declaration before variables declaration
...
Allow to use enum items for variables initialization.
For this, move enums upper in the code.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-3-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
George Stark
1a0dabd4df
iio: adc: meson: remove unused timestamp channel
...
Remove IIO_CHAN_SOFT_TIMESTAMP channel because it's used only for
buffering mode which is not implemented.
Signed-off-by: George Stark <GNStark@sberdevices.ru >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230714114010.293440-2-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Roan van Dijk
3f3caf5b2e
iio: chemical: scd4x: Add pressure compensation
...
This patch adds pressure compensation to the scd4x driver. The pressure can
be written to the sensor in hPa. The pressure will be compensated
internally by the sensor.
Signed-off-by: Roan van Dijk <roan@protonic.nl >
Link: https://lore.kernel.org/r/20230711101419.2065107-1-roan@protonic.nl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Waqar Hameed
4dc8f99dab
iio: Make return value check for set_trigger_state() consistent
...
In `iio_trigger_detach_poll_func()` the return value from
`trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`.
However, in `iio_trigger_attach_poll_func()` it is checked with
`if (ret < 0)`. Resolve this mismatch by only checking for `if (ret)` in
both places.
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com >
Link: https://lore.kernel.org/r/pndv8eojdey.fsf@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Dmitry Baryshkov
b7297d4566
dt-bindings: iio: adc: qcom,spmi-adc7: use predefined channel ids
...
Each of qcom,spmi-adc7-pm*.h headers define a set of ADC channels that
can be used for monitoring on thie particular chip. Switch them to use
channel IDs defined in the dt-bindings/iio/qcom,spmi-vadc.h header
instead of specifying the numeric IDs.
Suggested-by: Konrad Dybcio <konrad.dybcio@linaro.org >
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20230707123027.1510723-2-dmitry.baryshkov@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Leonard Göhrs
6c7bc1d27b
iio: adc: ti-lmp92064: add buffering support
...
Enable buffered reading of samples from the LMP92064 ADC.
The main benefit of this change is being able to read out current and
voltage measurements in a single transfer, allowing instantaneous power
measurements.
Reads into the buffer can be triggered by any software triggers, e.g.
the iio-trig-hrtimer:
$ mkdir /sys/kernel/config/iio/triggers/hrtimer/my-trigger
$ cat /sys/bus/iio/devices/iio\:device3/name
lmp92064
$ iio_readdev -t my-trigger -b 16 iio:device3 | hexdump
WARNING: High-speed mode not enabled
0000000 0000 0176 0101 0001 5507 abd5 7645 1768
0000010 0000 016d 0101 0001 ee1e ac6b 7645 1768
...
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230707063635.1496437-1-l.goehrs@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Yangtao Li
1f2a4d506f
iio: adc: stm32-adc: Use devm_platform_get_and_ioremap_resource()
...
Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.
Signed-off-by: Yangtao Li <frank.li@vivo.com >
Link: https://lore.kernel.org/r/20230704095808.33780-1-frank.li@vivo.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Konrad Dybcio
96543470d5
iio: adc: qcom-spmi-adc5: Add ADC5_GPIO2_100K_PU
...
Even though it existed in bindings for the longest time,
ADC5_GPIO2_100K_PU was never assigned in the driver. Do so.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org >
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org >
Link: https://lore.kernel.org/r/20230627-topic-adc-v1-1-c61581abffa3@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Jean-Baptiste Maneyrol
0829edc43e
iio: imu: inv_mpu6050: read the full fifo when processing data
...
When processing data read the full fifo data in 1 time. If there
are several samples in the FIFO, it means we are experiencing
system delay. In this case, it is better to read all data with 1
bus access than to add additional latency by doing several ones.
This requires to use a bigger buffer depending on chip FIFO size
and do an additional local data copy before sending. But the cost
is minimal and behavior is still better like this under system
heavy load.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Link: https://lore.kernel.org/r/20230623082924.283967-1-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Marco Felsch
21a12e614b
dt-bindings: iio: adc: ti,ads1015: fix datarate max value and meaning
...
Datarate (dr) is a 3-bit wide register field. Values from 0 to 7 are
allowed for all devices but only for the ADS1115 devices a value of 7
does make a difference.
While on it fix the description of the datarate for ADS1115 devices as
well.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Reviewed-by: Rob Herring <robh@kernel.org >
Link: https://lore.kernel.org/r/20230621160857.3400747-1-m.felsch@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Alisa Roman
1cbf2c4bea
iio: adc: ad7192: Use sysfs_emit_at
...
Replace scnprintf with sysfs_emit_at which is the preferred alternative.
Also make sure each fractional digit is in its place by padding with
zeros up to 3 digits: "...%03d...".
Signed-off-by: Alisa Roman <alisa.roman@analog.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20230620163135.93780-1-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:30 +01:00
Maksim Kiselev
e85f46433a
dt-bindings: iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
...
Allwinner's D1/T113s/R329/T507 SoCs have a new general purpose ADC.
This ADC is the same for all of this SoCs. The only difference is
the number of available channels.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com >
Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com >
Link: https://lore.kernel.org/r/20230619154252.3951913-4-bigunclemax@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:29 +01:00
Maksim Kiselev
046dd089eb
iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC
...
The General Purpose ADC (GPADC) can convert the external signal into
a certain proportion of digital value, to realize the measurement of
analog signal, which can be applied to power detection and key detection.
Theoretically, this ADC can support up to 16 channels. All SoCs below
contain this GPADC IP. The only difference between them is the number
of available channels:
T113 - 1 channel
D1 - 2 channels
R329 - 4 channels
T507 - 4 channels
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com >
Link: https://lore.kernel.org/r/20230619154252.3951913-3-bigunclemax@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:29 +01:00