Matti Vaittinen
bb76cc45dc
iio: gts-helper: Fix division loop
...
The loop based 64bit division may run for a long time when dividend is a
lot bigger than the divider. Replace the division loop by the
div64_u64() which implementation may be significantly faster.
Tested-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com >
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com >
Fixes: 38416c28e1 ("iio: light: Add gain-time-scale helpers")
Link: https://lore.kernel.org/r/Zcn-6e-0-nh2WcfU@drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-19 19:32:12 +00:00
Dimitri Fedrau
3ad0e7e5f0
iio: humidity: hdc3020: add threshold events support
...
Add threshold events support for temperature and relative humidity. To
enable them the higher and lower threshold registers must be programmed
and the higher threshold must be greater then or equal to the lower
threshold. Otherwise the event is disabled. Invalid hysteresis values
are ignored by the device. There is no further configuration possible.
Tested by setting thresholds/hysteresis and turning the heater on/off.
Used iio_event_monitor in tools/iio to catch events while constantly
displaying temperature and humidity values.
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com >
Tested-by: Javier Carrasco <javier.carrasco.cruz@gmail.com >
Link: https://lore.kernel.org/r/20240214085350.19382-4-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:12 +00:00
Dimitri Fedrau
9f9bfae410
dt-bindings: iio: humidity: hdc3020: add interrupt bindings in example
...
Add interrupt bindings in example.
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com >
Acked-by: Rob Herring <robh@kernel.org >
Link: https://lore.kernel.org/r/20240214085350.19382-3-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:12 +00:00
Dimitri Fedrau
52882c6fb1
iio: humidity: hdc3020: switch to 16bit register defines
...
Switch to 16bit register defines and drop the const u8 register pairs.
By doing so we change the parameter of functions for reading and writing
to the device. Additionally create helper functions that are aware of the
new register format and apply them wherever possible.
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com >
Link: https://lore.kernel.org/r/20240214085350.19382-2-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:12 +00:00
Naresh Solanki
f1f99fcbf9
dt-bindings: iio: afe: voltage-divider: Add io-channel-cells
...
Enable the voltage divider to both receive and provide measurement
services by adding #io-channel-cells.
This is especially valuable in scenarios where an ADC has an analog
frontend, like a voltage divider, and obtaining its raw value isn't
interesting. It is desired to get the real voltage before the voltage
divider.
Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com >
Reviewed-by: Conor Dooley <conor.dooley@microchip.com >
Link: https://lore.kernel.org/r/20240206105502.648255-1-naresh.solanki@9elements.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:12 +00:00
Basavaraj Natikar
2ec17b1950
iio: hid-sensor-als: Add light chromaticity support
...
On some platforms, ambient color sensors also support the x and y light
colors, which represent the coordinates on the CIE 1931 chromaticity
diagram. Add light chromaticity x and y.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com >
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
Link: https://lore.kernel.org/r/20240205185926.3030521-5-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Basavaraj Natikar
3765d426fe
iio: hid-sensor-als: Add light color temperature support
...
On some platforms, ambient color sensors also support light color
temperature. Add support of light color temperature.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com >
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
Link: https://lore.kernel.org/r/20240205185926.3030521-4-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Srinivas Pandruvada
00c45c9ef9
iio: hid-sensor-als: Remove hardcoding of values for enums
...
Remove hardcoding of values for enum CHANNEL_SCAN_INDEX_INTENSITY and
CHANNEL_SCAN_INDEX_ILLUM.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
Link: https://lore.kernel.org/r/20240205185926.3030521-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Srinivas Pandruvada
f2a71ebdf2
iio: hid-sensor-als: Assign channels dynamically
...
Instead of assuming that every channel defined statically by
als_channels[] is present, assign dynamically based on presence of the
respective usage id in the descriptor. This will allow to register ALS
with limited channel support. Append the timestamp as the last channel.
Update available_scan_mask to specify all channels which are present.
There is no intentional function changes done.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com >
Link: https://lore.kernel.org/r/20240205185926.3030521-2-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jesus Gonzalez
ca2f16c315
Add 10EC5280 to bmi160_i2c ACPI IDs to allow binding on some devices
...
"10EC5280" is used by several manufacturers like Lenovo, GPD, or AYA (and
probably others) in their ACPI table as the ID for the bmi160 IMU. This
means the bmi160_i2c driver won't bind to it, and the IMU is unavailable
to the user. Manufacturers have been approached on several occasions to
try getting a BIOS with a fixed ID, mostly without actual positive
results, and since affected devices are already a few years old, this is
not expected to change. This patch enables using the bmi160_i2c driver for
the bmi160 IMU on these devices.
Here is the relevant extract from the DSDT of a GPD Win Max 2 (AMD 6800U
model) with the latest firmware 1.05 installed. GPD sees this as WONTFIX
with the argument of the device working with the Windows drivers.
Device (BMA2)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "10EC5280") // _HID: Hardware ID
Name (_CID, "10EC5280") // _CID: Compatible ID
Name (_DDN, "Accelerometer") // _DDN: DOS Device Name
Name (_UID, One) // _UID: Unique ID
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Name (RBUF, ResourceTemplate ()
{
I2cSerialBusV2 (0x0069, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.I2CC",
0x00, ResourceConsumer, , Exclusive,
)
})
Return (RBUF) /* \_SB_.I2CC.BMA2._CRS.RBUF */
}
...
}
Signed-off-by: Jesus Gonzalez <jesusmgh@gmail.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20240207195549.37994-2-jesusmgh@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Ricardo B. Marliere
89b1b86fc7
iio: core: make iio_bus_type const
...
Now that the driver core can properly handle constant struct bus_type,
move the iio_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net >
Acked-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20240208-bus_cleanup-iio-v1-1-4a167c3b5fb3@marliere.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Lorenzo Bianconi
7c28226cd0
dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhxg1
...
Add device bindings for asm330lhhxg1 IMU sensor.
The lsm6dsr supports the features and functionality provided by
the asm330lhhxg1 via identical interfaces and so is a suitable
fallback compatible.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Reviewed-by: Rob Herring <robh@kernel.org >
Link: https://lore.kernel.org/r/942452ec9626bc1166501cec0fa88c369e28ec6f.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Lorenzo Bianconi
16ac43a1b1
iio: imu: st_lsm6dsx: add support to ASM330LHHXG1
...
Add support to STM ASM330LHHXG1 (accelerometer and gyroscope) Mems
sensor.
The ASM330LHHXG1 sensor can use LSM6DSR as fallback device since LSM6DSR
implements all the ASM330LHHXG1 features currently implemented in
st_lsm6dsx.
Link: https://www.st.com/resource/en/datasheet/asm330lhhxg1.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org >
Link: https://lore.kernel.org/r/e3dbe4720cdf407d0152e93b1331306a8c7f5df3.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Lorenzo Bianconi
0e2bf22aed
iio: imu: st_lsm6dsx: improve kernel docs and comments
...
Improve kernel docs and comments reporting supported sensors in a list in
order to make more easy to add new devices in the future.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org >
Link: https://lore.kernel.org/r/d365d048253d2ff9ee0092d391bbaa9cf0737cff.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jonathan Cameron
129e8619fc
iio: adc: ad7091r-base: Use auto cleanup of locks.
...
Done to reduce boilerplate and simplify code flow by allowing early
returns with the lock automatically released.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jonathan Cameron
1fa220ec61
iio: adc: ad4130: Use automatic cleanup of locks and direct mode.
...
Reduces boilerplate and allows for simpler to follow direct returns.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jonathan Cameron
fb1f19713d
iio: proximity: sx9310: Use automated cleanup for locks and IIO mode claiming.
...
This simplifies error handling paths and generallly removes a bunch
of boilerplate.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jonathan Cameron
d62f68c13f
iio: proximity: sx9324: Use automated cleanup for locks and IIO mode claiming.
...
This simplifies error handling paths and generallly removes a bunch
of boilerplate.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:11 +00:00
Jonathan Cameron
fba730dd8a
iio: proximity: sx9360: Use automated cleanup for locks and IIO mode claiming.
...
This simplifies error handling paths and generallly removes a bunch
of boilerplate.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Jonathan Cameron
3d329bcd48
iio: adc: max1363: Use automatic cleanup for locks and iio mode claiming.
...
This simplifies error return paths.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Jonathan Cameron
b6dde10923
iio: imu: bmi323: Use cleanup handling for iio_device_claim_direct_mode()
...
Similar to existing use of guard() in this driver,
iio_device_claim_direct_scoped() will ensure that scope based cleanup
occurs.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Jonathan Cameron
eabc6b0847
iio: accel: adxl367: Use automated cleanup for locks and iio direct mode.
...
Switching to the iio_device_claim_direct_scoped() for state
and to guard() based unlocking of mutexes simplifies error handling
by allowing direct returns when an error is encountered.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Jonathan Cameron
366328e5ac
iio: dummy: Use automatic lock and direct mode cleanup.
...
Given we now have iio_device_claim_direct_scoped() to perform automatic
releasing of direct mode at exit from the scope that follows it, this can
be used in conjunction with guard(mutex) etc remove a lot of special case
handling.
Note that in this particular example code, there is no real reason you can't
read channels via sysfs at the same time as filling the software buffer.
To make it look more like a real driver constrain raw and processed
channel reads from occurring whilst the buffer is in use.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Jonathan Cameron
1dae0cb79c
iio: locking: introduce __cleanup() based direct mode claiming infrastructure
...
Allows use of:
iio_device_claim_direct_scoped(return -EBUSY, indio_dev) {
}
to automatically call iio_device_release_direct_mode() based on scope.
Typically seen in combination with local device specific locks which
are already have automated cleanup options via guard(mutex)(&st->lock)
and scoped_guard(). Using both together allows most error handling to
be automated.
Reviewed-by: Nuno Sa <nuno.a@analog.com >
Link: https://lore.kernel.org/r/20240128150537.44592-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Justin Stitt
f7b6443f34
iio: sx9324: avoid copying property strings
...
We're doing some needless string copies when trying to assign the proper
`prop` string. We can make `prop` a const char* and simply assign to
string literals.
For the case where a format string is used, let's extract the parsing
logic out into sx9324_parse_phase_prop(). We no longer need to create
copies or allocate new memory.
sx9324_parse_phase_prop() will simply return the default def value if it
fails.
This also cleans up some deprecated strncpy() uses [1].
Furthermore, let's clean up this code further by removing some unused
defines:
| #define SX9324_PIN_DEF "semtech,ph0-pin"
| #define SX9324_RESOLUTION_DEF "semtech,ph01-resolution"
| #define SX9324_PROXRAW_DEF "semtech,ph01-proxraw-strength"
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com >
Reviewed-by: Stephen Boyd <swboyd@chromium.org >
Link: https://lore.kernel.org/r/20240201-strncpy-drivers-iio-proximity-sx9324-c-v5-1-78dde23553bc@google.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Nikita Mikhailevich
c8f883a78f
iio: accel: mxc4005: new ACPI ID for the MXC6655 accelerometer
...
New ID was introduced by Chuwi on Minibook X 2023.
Signed-off-by: Nikita Mikhailevich <ermyril@gmail.com >
Link: https://lore.kernel.org/r/20240201151848.1666245-1-ermyril@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Kim Seer Paller
5659785a32
iio: frequency: admfm2000: New driver
...
Dual microwave down converter module with input RF and LO frequency
ranges from 0.5 to 32 GHz and an output IF frequency range from 0.1 to
8 GHz. It consists of a LNA, mixer, IF filter, DSA, and IF amplifier
for each down conversion path.
Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com >
Link: https://lore.kernel.org/r/20240123081059.5746-2-kimseer.paller@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Kim Seer Paller
7b5f651127
dt-bindings: iio: frequency: add admfm2000
...
Dual microwave down converter module with input RF and LO frequency
ranges from 0.5 to 32 GHz and an output IF frequency range from 0.1 to
8 GHz. It consists of a LNA, mixer, IF filter, DSA, and IF amplifier
for each down conversion path.
Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com >
Reviewed-by: Conor Dooley <conor.dooley@microchip.com >
Link: https://lore.kernel.org/r/20240123081059.5746-1-kimseer.paller@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Andrew Davis
044b432392
iio: health: afe4404: Use devm IIO helpers
...
Use a device lifecycle managed IIO helper functions. This helps prevent
mistakes like unregistering and freeing out of order in cleanup functions
and forgetting to unregister and free on error paths.
Signed-off-by: Andrew Davis <afd@ti.com >
Link: https://lore.kernel.org/r/20240123140918.215818-4-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Andrew Davis
5ff7ea503c
iio: health: afe4404: Use devm action helper for regulator disable
...
Use a device lifecycle managed action for regulator disable function.
This helps prevent mistakes like unregistering out of order in cleanup
functions and forgetting to unregister on error paths.
Signed-off-by: Andrew Davis <afd@ti.com >
Link: https://lore.kernel.org/r/20240123140918.215818-3-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:10 +00:00
Andrew Davis
e73a640fe3
iio: health: afe4403: Use devm IIO helpers
...
Use a device lifecycle managed IIO helper functions. This helps prevent
mistakes like unregistering and freeing out of order in cleanup functions
and forgetting to unregister and free on error paths.
Signed-off-by: Andrew Davis <afd@ti.com >
Link: https://lore.kernel.org/r/20240123140918.215818-2-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Andrew Davis
eeb4c24a5c
iio: health: afe4403: Use devm action helper for regulator disable
...
Use a device lifecycle managed action for regulator disable function.
This helps prevent mistakes like unregistering out of order in cleanup
functions and forgetting to unregister on error paths.
Signed-off-by: Andrew Davis <afd@ti.com >
Link: https://lore.kernel.org/r/20240123140918.215818-1-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Matti Vaittinen
e21b4321f9
MAINTAINERS: add IIO GTS tests
...
Add undersigned as a maintainer for IIO GTS helper's KUnit tests.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com >
Link: https://lore.kernel.org/r/52c66fe2798192529738ac2ab98a27230a6ad8cd.1705328293.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Matti Vaittinen
cf996f0396
iio: test: test gain-time-scale helpers
...
Some light sensors can adjust both the HW-gain and integration time.
There are cases where adjusting the integration time has similar impact
to the scale of the reported values as gain setting has.
IIO users do typically expect to handle scale by a single writable 'scale'
entry. Driver should then adjust the gain/time accordingly.
It however is difficult for a driver to know whether it should change
gain or integration time to meet the requested scale. Usually it is
preferred to have longer integration time which usually improves
accuracy, but there may be use-cases where long measurement times can be
an issue. Thus it can be preferable to allow also changing the
integration time - but mitigate the scale impact by also changing the gain
underneath. Eg, if integration time change doubles the measured values,
the driver can reduce the HW-gain to half.
The theory of the computations of gain-time-scale is simple. However,
some people (undersigned) got that implemented wrong for more than once.
Hence some gain-time-scale helpers were introduced.
Add some simple tests to verify the most hairy functions.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com >
Link: https://lore.kernel.org/r/0f7505b43f91394dc3bb636369489c897b7e01a7.1705328293.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Mårten Lindahl
44b9038345
iio: light: vcnl4000: Set ps high definition for 4040/4200
...
The vcnl4040/vcnl4200 proximity sensor defaults to 12 bit data
resolution, but the chip also supports 16 bit data resolution, which is
called proximity high definition (PS_HD).
Make the vcnl4040/vcnl4200 proximity sensor use the high definition for
all data readings. Please note that in order to preserve the 12 bit
integer part of the in_proximity_raw output, the format is changed from
integer to fixed point.
Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com >
Link: https://lore.kernel.org/r/20231221-vcnl4000-ps-hd-v3-1-6dcc889372be@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Nuno Sa
1ca53b5df1
iio: adc: ad_sigma_delta: allow overwriting the IRQ flags
...
Make sure we can specify the IRQ trigger type from firmware and drivers
won't ignore it. In fact, this how it should be done but since someone
might be already depending on the driver to hardcode the trigger type
(and not specifying it in firmware), let's do it like this so there's
no possible breakage.
Signed-off-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20240117-dev_sigma_delta_no_irq_flags-v1-2-db39261592cf@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Nuno Sa
32f28e19ff
iio: imu: adis16480: make use of irq_get_trigger_type()
...
There's no need to call both irq_get_irq_data() and
irqd_get_trigger_type() as we already have an helper for that. This
allows for code simplification.
Signed-off-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20240117-adis-improv-v1-3-7f90e9fad200@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Nuno Sa
689c0953b9
iio: imu: adis16475: make use of irq_get_trigger_type()
...
There's no need to call both irq_get_irq_data() and
irqd_get_trigger_type() as we already have an helper for that. This
allows for code simplification.
Signed-off-by: Nuno Sa <nuno.sa@analog.com >
Link: https://lore.kernel.org/r/20240117-adis-improv-v1-2-7f90e9fad200@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
Randy Dunlap
680ce1d3a3
iio: dummy_evgen: remove Excess kernel-doc comments
...
Drop kernel-doc comments for struct fields that were removed to
prevent kernel-doc warnings:
iio_dummy_evgen.c:43: warning: Excess struct member 'irq_sim' description in 'iio_dummy_eventgen'
iio_dummy_evgen.c:43: warning: Excess struct member 'base' description in 'iio_dummy_eventgen'
Fixes: 337cbeb2c1 ("genirq/irq_sim: Simplify the API")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org >
Link: https://lore.kernel.org/r/20240121055005.20042-1-rdunlap@infradead.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-02-17 16:16:09 +00:00
ChiYuan Huang
89a1034cd8
iio: adc: rtq6056: Add support for the whole RTQ6056 family
...
RTQ6053 and RTQ6059 are the same series of RTQ6056.
The respective differences with RTQ6056 are listed below
RTQ6053
- chip package type
RTQ6059
- Reduce the pinout for vbus sensing pin
- Some internal ADC scaling change
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com >
Link: https://lore.kernel.org/r/3541207c4727e3a76b9a3caf88ef812a4d47b764.1704676198.git.cy_huang@richtek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
ChiYuan Huang
41b5684e58
dt-bindings: iio: adc: rtq6056: add support for the whole RTQ6056 family
...
Add compatible support for RTQ6053 and RTQ6059.
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/c1abb261bb00846f456eb8fe9b5919f59f287c24.1704676198.git.cy_huang@richtek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Nuno Sa
82cc631881
iio: buffer-dmaengine: make use of the 'struct device *' argument
...
Respect the @dev argument in devm_iio_dmaengine_buffer_setup() and bind the
IIO DMA buffer lifetime to that device.
For the only user of this function, the IIO parent device is the
struct device being passed to the API so no real fix in here (just
consistency with other IIO APIs).
Signed-off-by: Nuno Sa <nuno.sa@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://lore.kernel.org/r/20240109-dmaengine_use_device-v1-1-1cbdb7fe9f29@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
David Lechner
e7748c17bd
iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()
...
This replaces use of individual buffer mode flags with
INDIO_ALL_BUFFER_MODES in the iio_buffer_enabled() function.
This simplifies the code and makes it robust in case of the addition of
new buffer modes.
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://lore.kernel.org/r/20240108200647.3916681-1-dlechner@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Amit Dhingra
66b5591697
MAINTAINERS: correct file entry for AD7091R
...
File entry has driver/iio/adc two times. Fix the file entry
Found by ./scripts/get_maintainer.pl --self-test=patterns
Signed-off-by: Amit Dhingra <mechanicalamit@gmail.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://lore.kernel.org/r/CAO=gReEUr4B+E2mQsSrncHf41f0A915SuoWgA522_2Ts-dZbSg@mail.gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Petre Rodan
4e6500bfa0
tools: iio: replace seekdir() in iio_generic_buffer
...
Replace seekdir() with rewinddir() in order to fix a localized glibc bug.
One of the glibc patches that stable Gentoo is using causes an improper
directory stream positioning bug on 32bit arm. That in turn ends up as a
floating point exception in iio_generic_buffer.
The attached patch provides a fix by using an equivalent function which
should not cause trouble for other distros and is easier to reason about
in general as it obviously always goes back to to the start.
https://sourceware.org/bugzilla/show_bug.cgi?id=31212
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro >
Link: https://lore.kernel.org/r/20240108103224.3986-1-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Colin Ian King
b58b13f156
iio: invensense: remove redundant initialization of variable period
...
The variable period is being initialized with a value that is never
read, it is being re-assigned a new value later on before it is read.
The initialization is redundant and can be removed.
Cleans up clang scan build warning:
Value stored to 'period' during its initialization is never
read [deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Link: https://lore.kernel.org/r/20240106153202.54861-1-colin.i.king@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Jun Yan
b2463c49ab
iio: accel: bmi088: add i2c support for bmi088 accel driver
...
The BMI088, BMI085 and BMI090L accelerometer also support
I2C protocol, so let's add the missing I2C support.
The I2C interface of the {BMI085,BMI088,BMI090L} is compatible with
the I2C Specification UM10204 Rev. 03 (19 June 2007), available at
http://www.nxp.com . The {BMI085,BMI088,BMI090L} supports I2C standard
mode and fast mode, only 7-bit address mode is supported.
Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi085-ds001.pdf
Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi088-ds001.pdf
Datasheet: https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/4807/BST-BMI090L-DS000-00.pdf
Signed-off-by: Jun Yan <jerrysteve1101@gmail.com >
Reported-by: kernel test robot <lkp@intel.com >
Closes: https://lore.kernel.org/oe-kbuild-all/202312191325.jfiyeL5F-lkp@intel.com/
Link: https://lore.kernel.org/r/20231219150440.264033-1-jerrysteve1101@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Jonathan Cameron
3ab574ee39
iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards
...
The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20231231183514.566609-25-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Jonathan Cameron
5291fed7e3
iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards
...
The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20231231183514.566609-24-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00
Jonathan Cameron
51feb3e358
iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards
...
The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20231231183514.566609-23-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-01-23 22:06:56 +00:00