Vasileios Amoiridis
80b9f3a80e
iio: chemical: bme680: Add triggered buffer support
...
Add triggered buffer and soft timestamp support. The available scan mask
enables all the channels of the sensor in order to follow the operation of
the sensor. The sensor basically starts to capture from all channels
as long as it enters into FORCED mode.
The bulk read, reads a total of 15 registers from the sensor, 0x1D..0x2B.
Even though some of those registers are not reported in the register map
of the device, this is how the BME680 Sensor API [1] proposes to do it.
This allows to have one bulk read instead of multiple ones.
Link: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L1200
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com >
Link: https://patch.msgid.link/20241102131311.36210-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
Vasileios Amoiridis
f51171ce22
iio: chemical: bme680: Add SCALE and RAW channels
...
Add SCALE,RAW channels to the device. Even though PROCESSED should be
kept for backwards compatibility add comment to avoid using it if the
value is not actually reported in IIO values.
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com >
Link: https://patch.msgid.link/20241102131311.36210-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
Vasileios Amoiridis
4865ee12c8
iio: chemical: bme680: refactorize set_mode() mode
...
Refactorize the set_mode() function to use an external enum that
describes the possible modes of the BME680 device instead of using
true/false variables for selecting SLEEPING/FORCED mode.
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com >
Link: https://patch.msgid.link/20241102131311.36210-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
David Lechner
01f567d221
iio: events: make IIO_EVENT_CODE macro private
...
Make IIO_EVENT_CODE "private" by adding a leading underscore.
There are no more users of this macro in the kernel so we can make it
"private" and encourage developers to use the specialized versions of
the macro instead.
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-3-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
David Lechner
dff100b0f3
iio: accel: mma9553: use specialized event code macros
...
Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-2-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
David Lechner
c4d4f112bb
iio: dummy: use specialized event code macros
...
Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-1-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
Julien Stephan
7f4f3c4e97
iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper
...
The IIO_DIFF_EVENT_CODE macro helper was introduced to provide a more
specific alternative to the generic IIO_EVENT_CODE macro for handling
differential channels. This commit updates the code to use
IIO_DIFF_EVENT_CODE for better clarity and maintainability.
However, the current implementation incorrectly sets both chan1 and
chan2 to 0. To maintain compatibility and avoid breaking existing
user space applications, this behavior is preserved for now.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-2-b452c90f7ea6@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
Julien Stephan
5d8173b849
iio: events.h: add event identifier macros for differential channel
...
Currently, there are 3 helper macros in iio/events.h to create event
identifiers:
- IIO_EVENT_CODE : create generic event identifier for differential and non
differential channels
- IIO_MOD_EVENT_CODE : create event identifier for modified (non
differential) channels
- IIO_UNMOD_EVENT_CODE : create event identifier for unmodified (non
differential) channels
For differential channels, drivers are expected to use IIO_EVENT_CODE.
However, only one driver in drivers/iio currently uses it correctly,
leading to inconsistent event identifiers for differential channels that
don’t match the intended attributes (such as max1363.c that supports
differential channels, but only uses IIO_UNMOD_EVENT_CODE).
To prevent such issues in future drivers, a new helper macro,
IIO_DIFF_EVENT_CODE, is introduced to specifically create event identifiers
for differential channels. Only one helper is needed for differential
channels since they cannot have modifiers.
Additionally, the descriptions for IIO_MOD_EVENT_CODE and
IIO_UNMOD_EVENT_CODE have been updated to clarify that they are intended
for non-differential channels,
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-1-b452c90f7ea6@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:45 +00:00
Neil Armstrong
3c9b6fd741
iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver
...
The Allegro MicroSystems ALS31300 is a 3-D Linear Hall Effect Sensor
mainly used for 3D head-on motion sensing applications.
The device is configured over I2C, and as part of the Sensor data the
temperature core is also provided.
While the device provides an IRQ gpio, it depends on a configuration
programmed into the internal EEPROM, thus only the default mode is
supported and buffered input via trigger is also supported to allow
streaming values with the same sensing timestamp.
The device can be configured with different sensitivities in factory,
but the sensitivity value used to calculate value into the Gauss
unit is not available from registers, thus the sensitivity is provided
by the compatible/device-id string which is based on the part number
as described in the datasheet page 2.
Reviewed-by: Andy Shevchenko <andy@kernel.org >
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org >
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-3-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Neil Armstrong
6f6291f7a5
dt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor
...
Document the bindings for the Allegro MicroSystems ALS31300 3-D Linear
Hall Effect Sensor controller by an I2C interface, mainly used in 3D
head-on motion sensing applications.
The device can be configured with different sensitivities in factory,
but the sensitivity value used to calculate value into the Gauss unit
is not available from registers, thus the sensitivity is provided by
the compatible/device-id string which is based on the part number as
described in the datasheet page 2.
Datasheet: https://www.allegromicro.com/-/media/files/datasheets/als31300-datasheet.pdf
Reviewed-by: Rob Herring (Arm) <robh@kernel.org >
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org >
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-2-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Neil Armstrong
8122339406
dt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc
...
Link: https://www.allegromicro.com/en/about-allegro
Acked-by: Rob Herring (Arm) <robh@kernel.org >
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org >
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-1-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
e44a4e6c21
iio: light: apds9960: remove useless return
...
return 0 statement at the end of apds9960_read_event_config is useless.
Remove it.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-15-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
6921a89dc1
iio: light: apds9960: convert als_int and pxs_int to bool
...
Since the write_event_config callback now uses a bool for the state
parameter, update type of als_int and pxs_int to bool.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-14-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
86b8843ee2
iio: light: apds9306: simplifies if branch in apds9306_write_event_config
...
Simplifies the regmap_wite if branch in apds9306_write_event_config.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-13-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
ad531aa484
iio: light: apds9300: use bool for event state
...
Since the write_event_config callback now uses a bool for the state
parameter, update apds9300_set_intr_state accordingly and change intr_en
to bool.
Also update apds9300_set_power_state and power_state for consistency.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-12-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
3121da857c
iio: imu: st_lsm6dsx: use bool for event state
...
Since the write_event_config callback now uses a bool for the state
parameter, update the signature of the function it calls accordingly.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-11-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
96a59e302c
iio: imu: bmi323: use bool for event state
...
Since the write_event_config callback now uses a bool for the state
parameter, update the signatures of the functions it calls accordingly.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-10-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
4880978294
iio: accel: sca3000: use bool for event state
...
Since the write_event_config callback now uses a bool for the state
parameter, update the signatures of the functions it calls accordingly.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-9-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
1d3086459d
iio: accel: mma9551: use bool for event state
...
Since the write_event_config callback now uses a bool for the state
parameter, update the signature of the function it calls accordingly,
and use a bool array for event_enabled.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-8-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
b4b42f28a0
iio: fix write_event_config signature
...
write_event_config callback use an int for state, but it is actually a
boolean. iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to write_event_config.
Fix signature and update all iio drivers to use the new signature.
This patch has been partially written using coccinelle with the
following script:
$ cat iio-bool.cocci
// Options: --all-includes
virtual patch
@c1@
identifier iioinfo;
identifier wecfunc;
@@
static const struct iio_info iioinfo = {
...,
.write_event_config =
(
wecfunc
|
&wecfunc
),
...,
};
@@
identifier c1.wecfunc;
identifier indio_dev, chan, type, dir, state;
@@
int wecfunc(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir,
-int
+bool
state) {
...
}
make coccicheck MODE=patch COCCI=iio-bool.cocci M=drivers/iio
Unfortunately, this script didn't match all files:
* all write_event_config callbacks using iio_device_claim_direct_scoped
were not detected and not patched.
* all files that do not assign and declare the write_event_config
callback in the same file.
iio.h was also manually updated.
The patch was build tested using allmodconfig config.
cc: Julia Lawall <julia.lawall@inria.fr >
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-7-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:44 +00:00
Julien Stephan
2cc86e9409
iio: light: adux1020: write_event_config: use local variable for interrupt value
...
state parameter is currently an int, but it is actually a boolean.
iio_ev_state_store is actually using kstrtobool to check user input,
then gives the converted boolean value to write_event_config. The code
in adux1020_write_event_config re-uses state parameter to store an
integer value. To prepare for updating the write_event_config signature
to use a boolean for state, introduce a new local int variable.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-6-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Julien Stephan
18aa930a51
iio: proximity: sx9500: simplify code in write_event_config callback
...
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-5-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Julien Stephan
63023e8aa3
iio: proximity: irsd200: simplify code in write_event_config callback
...
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-4-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Julien Stephan
e41edccbfc
iio: light: tsl2772: simplify code in write_event_config callback
...
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-3-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Julien Stephan
122679a62f
iio: proximity: hx9023s: simplify code in write_event_config callback
...
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-2-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Julien Stephan
04392fa8af
iio: light: ltr390: simplify code in write_event_config callback
...
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com >
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-1-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Ricardo Ribalda
596ef5cf65
iio: hid-sensor-prox: Add support for more channels
...
Egis620 supports 3 channels: presense, proximity and attention.
Modify the driver so it can read those channels as well.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org >
Link: https://patch.msgid.link/20241101-hpd-v3-5-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Ricardo Ribalda
f7a1fc1ae0
iio: hid-sensors-prox: Make proximity channel indexed
...
We are going to introduce more proximity channels. Make proximity a
indexed channel now, in a simple patch, so the change can be easily
bisected if there are any issues.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org >
Link: https://patch.msgid.link/20241101-hpd-v3-4-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Ricardo Ribalda
9d2fe9cd02
iio: Add channel type for attention
...
Add a new channel type representing if the user's attention state to the
the system. This usually means if the user is looking at the screen or
not.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org >
Link: https://patch.msgid.link/20241101-hpd-v3-3-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Ricardo Ribalda
9b20c3fe68
iio: hid-sensors-prox: Factor-in hid_sensor_push_data
...
The function is only called from one place and it is a one-liner.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org >
Link: https://patch.msgid.link/20241101-hpd-v3-2-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Ricardo Ribalda
6e6738398d
iio: hid-sensors: Add proximity and attention IDs
...
The HID Usage Table at https://usb.org/sites/default/files/hut1_5.pdf
reserves:
- 0x4b2 for Human Proximity Range
Distance between a human and the computer. Default unit of
measure is meters;
https://www.usb.org/sites/default/files/hutrr39b_0.pdf
- 0x4bd for Human Attention Detected
Human-Presence sensors detect the presence of humans in the sensor’s
field-of-view using diverse and evolving technologies. Some presence
sensors are implemented with low resolution video cameras, which can
additionally track a subject’s attention (i.e. if the
user is ‘looking’ at the system with the integrated sensor).
A Human-Presence sensor, providing a Host with the user’s attention
state, allows the Host to optimize its behavior. For example, to
brighten/dim the system display, based on the user’s attention to the
system (potentially prolonging battery life). Default unit is
true/false;
https://www.usb.org/sites/default/files/hutrr107-humanpresenceattention_1.pdf
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org >
Link: https://patch.msgid.link/20241101-hpd-v3-1-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:43 +00:00
Andy Shevchenko
9a5a2483bc
iio: Mark iio_dev::priv member with __private
...
The member is not supposed to be accessed directly, mark it with
__private to catch the misuses up.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://patch.msgid.link/20241101105342.3645018-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Andy Shevchenko
9727098a52
iio: accel: kxcjk-1013: Deduplicate ODR startup time array
...
The content of kxcj91008_odr_start_up_times and kxcjk1013_odr_start_up_times
is identical, deduplicate it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://patch.msgid.link/20241101081203.3360421-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Javier Carrasco
bb18885ed8
iio: light: veml6070: add support for integration time
...
The integration time of the veml6070 depends on an external resistor
(called Rset in the datasheet) and the value configured in the IT
field of the command register, whose supported values are 1/2x, 1x,
2x and 4x.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com >
Link: https://patch.msgid.link/20241031-veml6070-integration-time-v4-2-c66da6788256@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Javier Carrasco
4c5e18bf75
dt-bindings: iio: light: veml6075: document vishay,rset-ohms
...
The veml6070 provides a configurable integration time by means of an
external resistor (Rset in the datasheet) with values between 75 and
1200 kohms.
Document vishay,rset-ohms to select the integration time.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patch.msgid.link/20241031-veml6070-integration-time-v4-1-c66da6788256@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
7f36074c0f
iio: dac: ad5791: Use devm_iio_device_register
...
Use devm_iio_device_register to automatically free the iio device.
since this is the last remaining resource that was not automatically
freed, we can drop the ".remove" callback.
Suggested-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-7-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
7bf7b297b6
iio: dac: ad5791: Use devm_regulator_get_enable_read_voltage
...
Simplify probe by using of the devm_regulator_get_enable_read_voltage.
Suggested-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-6-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
120c678aa9
iio: dac: ad5791: Add reset, clr and ldac gpios
...
The ad7591 has reset, clr and ldac gpios. For the DAC to output data
continuously written to the data register the state of these gpios needs
to be set by the driver.
Add these gpios to the driver making them optional in case they are fixed
on the pcb.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-5-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
080a79f8f5
iio: dac: ad5791: Include chip_info in device match tables
...
Include a chip info struct in device SPI and device OF match tables to
provide channel definitions for each particular ADC model and drop
device enum.
Suggested-by: Nuno Sa <nuno.sa@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-4-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
6e0ba34bfe
dt-bindings: iio: dac: ad5791: Add required voltage supplies
...
Vcc, iovcc, vrefp, and vrefn are needed for the DAC to work.
Add them as required bindings for ad5791.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-3-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Axel Haslam
baaa92d284
dt-bindings: iio: dac: ad5791: Add optional reset, clr and ldac gpios
...
Depending on board layout, the ad57xx may need control of reset, clear,
and ldac pins by the host driver. Add optional bindings for these gpios.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Signed-off-by: Axel Haslam <ahaslam@baylibre.com >
Link: https://patch.msgid.link/20241031071746.848694-2-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Angelo Dureghello
248da097f6
iio: dac: adi-axi-dac: add registering of child fdt node
...
Change to obtain the fdt use case as reported in the
adi,ad3552r.yaml file in this patchset.
The DAC device is defined as a child node of the backend.
Registering the child fdt node as a platform devices.
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-8-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:42 +00:00
Angelo Dureghello
0b4d9fe58b
iio: dac: ad3552r: add high-speed platform driver
...
Add High Speed ad3552r platform driver.
The ad3552r DAC is controlled by a custom (fpga-based) DAC IP
through the current AXI backend, or similar alternative IIO backend.
Compared to the existing driver (ad3552r.c), that is a simple SPI
driver, this driver is coupled with a DAC IIO backend that finally
controls the ad3552r by a fpga-based "QSPI+DDR" interface, to reach
maximum transfer rate of 33MUPS using dma stream capabilities.
All commands involving QSPI bus read/write are delegated to the backend
through the provided APIs for bus read/write.
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-7-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-03 20:33:32 +00:00
Angelo Dureghello
f665d7d33d
iio: dac: ad3552r: extract common code (no changes in behavior intended)
...
Extracting common code, to share common code to be used later
by the AXI driver version (ad3552r-axi.c).
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-6-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Angelo Dureghello
d5ac6cb1c8
iio: dac: ad3552r: changes to use FIELD_PREP
...
Changes to use FIELD_PREP, so that driver-specific ad3552r_field_prep
is removed. Variables (arrays) that was used to call ad3552r_field_prep
are removed too.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-5-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Angelo Dureghello
e61d717842
iio: dac: adi-axi-dac: extend features
...
Extend AXI-DAC backend with new features required to interface
to the ad3552r DAC. Mainly, a new compatible string is added to
support the ad3552r-axi DAC IP, very similar to the generic DAC
IP but with some customizations to work with the ad3552r.
Then, a series of generic functions has been added to match with
ad3552r needs. Function names has been kept generic as much as
possible, to allow re-utilization from other frontend drivers.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-4-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Angelo Dureghello
d3eeb1ac0b
iio: backend: extend features
...
Extend backend features with new calls needed later on this
patchset from axi version of ad3552r.
The follwoing calls are added:
iio_backend_ddr_enable()
enable ddr bus transfer
iio_backend_ddr_disable()
disable ddr bus transfer
iio_backend_data_stream_enable()
enable data stream over bus interface
iio_backend_data_stream_disable()
disable data stream over bus interface
iio_backend_data_transfer_addr()
define the target register address where the DAC sample
will be written.
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-3-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Angelo Dureghello
043e4e514c
dt-bindings: iio: dac: adi-axi-dac: add ad3552r axi variant
...
Add a new compatible and related bindigns for the fpga-based
"ad3552r" AXI IP core, a variant of the generic AXI DAC IP.
The AXI "ad3552r" IP is a very similar HDL (fpga) variant of the
generic AXI "DAC" IP, intended to control ad3552r and similar chips,
mainly to reach high speed transfer rates using a QSPI DDR
(dobule-data-rate) interface.
The ad3552r device is defined as a child of the AXI DAC, that in
this case is acting as an SPI controller.
Note, #io-backend is present because it is possible (in theory anyway)
to use a separate controller for the control path than that used
for the datapath.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: Rob Herring (Arm) <robh@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-2-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Angelo Dureghello
7683092632
dt-bindings: iio: dac: ad3552r: add iio backend support
...
There is a version of AXI DAC IP block (for FPGAs) that provides
a physical QSPI bus for AD3552R and similar chips, so supporting
spi-controller functionalities.
For this case, the binding is modified to include some additional
properties.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org >
Acked-by: Conor Dooley <conor.dooley@microchip.com >
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-1-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00
Vasileios Amoiridis
f928099e5f
iio: chemical: bme680: use s16 variable for temp value to avoid casting
...
Use local s16 variable for the temperature channel to avoid casting it
later before passing it to the bme680_read_temp() function. This way,
possible endianness and initialization issues are avoided.
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com >
Link: https://patch.msgid.link/20241030235424.214935-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2024-11-01 14:54:48 +00:00