Skip to content

Commit 1565fce

Browse files
committed
Merge tag 'iio-for-6.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next
Jonathan writes: IIO: 2nd set of new device support, features and cleanup for 6.10 (take 2) The usual mixed bag from towards the end of the cycle. Changes since take 1. Fixed the fixes tag and indeed fixed a rebase I messed up on the same fix. New devices support =================== invensense,icm42600 - Support the ICM-42686-P a high range device going up to 32g and 4000 dps New features ============ adi,ad7944 - Add support for chain mode in which many ADCs may be daisy chained and read out via a single long read. adi,ad9467/backend library - Add bus tuning related interfaces. adi,axi-adc - Add control for the AXI clock - seems always enabled early in boot for other reasons, but the driver should not rely on that.. Cleanups and minor or late breaking fixes ========================================= Micrsoft/ACPI mount matrix handling. - Replace several implementations of the Microsoft defined ROTM ACPI method with a single one. multiple drivers - Don't call the result of wait_for_completion() timeout as it's more accurate as time_left. adi,ad7266 - Stop setting the iio_dev->masklength as it's done by the IIO core and should not be set from drivers. adi,ad799x - Some checkpatch type fixes. adi,ad9839 - Ensure compelte MU_CNT1 is written during lock phase. adi,axi-dac - Fix inverted parameter. adi,adis16475 - Drop documentation of non existent sysfs files. avago,apds9306 - Fix an off by one error that overly restricts the range of persistence and adaptive thresholds that the driver accepts. freescale,mxs-lradc - Stop setting the iio_dev->masklength as it's done by the IIO core and should not be set from drivers. invensense,timestamp library - Fix timestamp vs interupt alignment and aovid soms glitches that occured when switching sampling frequency. microchip,mcp3564 - Make use of device_for_each_child_node_scoped() to allow early release without manual fwnode_handle_put(). microchip,mcp9600 - Allow for negative temperatures. microchip,pac1934 - Avoid an out of bounds array index. richtek,rtq6056 - Use iio_device_claim_direct_scoped() to automate lock release and simplify the code. sensortek,stk3110 - Drop a likely incorrect ACPI ID. No known users of this ID and it's not a valid ACPI ID. ti,ads1015 - Make use of device_for_each_child_node_scoped() to allow early release without manual fwnode_handle_put(). * tag 'iio-for-6.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (41 commits) iio: temperature: mcp9600: Fix temperature reading for negative values iio: adc: PAC1934: fix accessing out of bounds array index iio: invensense: fix timestamp glitches when switching frequency iio: invensense: fix interrupt timestamp alignment iio: dac: ad9739a: write complete MU_CNT1 register during lock iio: pressure: zpa2326: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: twl6030-gpadc: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: stm32-dfsdm-adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: stm32-adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: intel_mrfld_adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: fsl-imx25-gcq: use 'time_left' variable with wait_for_completion_interruptible_timeout() iio: adc: exynos_adc: use 'time_left' variable with wait_for_completion_timeout() iio: adc: ad_sigma_delta: use 'time_left' variable with wait_for_completion_timeout() iio: adc: ti-ads1015: use device_for_each_child_node_scoped() iio: adc: ad799x: Prefer to use octal permission iio: adc: ad799x: add blank line to avoid warning messages iio: adc: ad799x: change 'unsigned' to 'unsigned int' declaration iio: adc: mcp3564: Use device_for_each_child_node_scoped() iio: adc: ad9467: support digital interface calibration iio: adc: adi-axi-adc: support digital interface calibration ...
2 parents eacdd8e + 827dca3 commit 1565fce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1282
-406
lines changed

Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ properties:
2828
reg:
2929
maxItems: 1
3030

31+
clocks:
32+
maxItems: 1
33+
3134
dmas:
3235
maxItems: 1
3336

@@ -48,6 +51,7 @@ required:
4851
- compatible
4952
- dmas
5053
- reg
54+
- clocks
5155

5256
additionalProperties: false
5357

@@ -58,6 +62,7 @@ examples:
5862
reg = <0x44a00000 0x10000>;
5963
dmas = <&rx_dma 0>;
6064
dma-names = "rx";
65+
clocks = <&axi_clk>;
6166
#io-backend-cells = <0>;
6267
};
6368
...

Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ properties:
3232
- invensense,icm42605
3333
- invensense,icm42622
3434
- invensense,icm42631
35+
- invensense,icm42686
3536
- invensense,icm42688
3637

3738
reg:

Documentation/iio/ad7944.rst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Supported features
2424
SPI wiring modes
2525
----------------
2626

27-
The driver currently supports two of the many possible SPI wiring configurations.
27+
The driver currently supports three of the many possible SPI wiring configurations.
2828

2929
CS mode, 3-wire, without busy indicator
3030
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,6 +68,27 @@ CS mode, 4-wire, without busy indicator
6868
To select this mode in the device tree, omit the ``adi,spi-mode`` property and
6969
provide the ``cnv-gpios`` property.
7070

71+
Chain mode, without busy indicator
72+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
74+
.. code-block::
75+
76+
+-------------+
77+
+-------------------------+--------------------| CS |
78+
v v | |
79+
+--------------------+ +--------------------+ | HOST |
80+
| CNV | | CNV | | |
81+
+--->| SDI AD7944 SDO |--->| SDI AD7944 SDO |-------->| SDI |
82+
| | SCK | | SCK | | |
83+
GND +--------------------+ +--------------------+ | |
84+
^ ^ | |
85+
+-------------------------+--------------------| SCLK |
86+
+-------------+
87+
88+
To select this mode in the device tree, set the ``adi,spi-mode`` property to
89+
``"chain"``, add the ``spi-cs-high`` flag, add the ``#daisy-chained-devices``
90+
property, and omit the ``cnv-gpios`` property.
91+
7192
Reference voltage
7293
-----------------
7394

@@ -86,7 +107,6 @@ Unimplemented features
86107

87108
- ``BUSY`` indication
88109
- ``TURBO`` mode
89-
- Daisy chain mode
90110

91111

92112
Device attributes
@@ -108,6 +128,9 @@ AD7944 and AD7985 are pseudo-differential ADCs and have the following attributes
108128
| ``in_voltage0_scale`` | Scale factor to convert raw value to mV. |
109129
+---------------------------------------+--------------------------------------------------------------+
110130

131+
In "chain" mode, additional chips will appear as additional voltage input
132+
channels, e.g. ``in_voltage1_raw``.
133+
111134
Fully-differential ADCs
112135
-----------------------
113136

@@ -121,6 +144,9 @@ AD7986 is a fully-differential ADC and has the following attributes:
121144
| ``in_voltage0-voltage1_scale`` | Scale factor to convert raw value to mV. |
122145
+---------------------------------------+--------------------------------------------------------------+
123146

147+
In "chain" mode, additional chips will appear as additional voltage input
148+
channels, e.g. ``in_voltage2-voltage3_raw``.
149+
124150

125151
Device buffers
126152
==============

Documentation/iio/adis16475.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.
6666
+-------------------------------------------+----------------------------------------------------------+
6767
| in_accel_x_calibbias | Calibration offset for the X-axis accelerometer channel. |
6868
+-------------------------------------------+----------------------------------------------------------+
69-
| in_accel_calibbias_x | x-axis acceleration offset correction |
70-
+-------------------------------------------+----------------------------------------------------------+
7169
| in_accel_x_raw | Raw X-axis accelerometer channel value. |
7270
+-------------------------------------------+----------------------------------------------------------+
73-
| in_accel_calibbias_y | y-axis acceleration offset correction |
71+
| in_accel_y_calibbias | Calibration offset for the Y-axis accelerometer channel. |
7472
+-------------------------------------------+----------------------------------------------------------+
7573
| in_accel_y_raw | Raw Y-axis accelerometer channel value. |
7674
+-------------------------------------------+----------------------------------------------------------+
@@ -94,11 +92,9 @@ specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.
9492
+---------------------------------------+------------------------------------------------------+
9593
| in_anglvel_x_calibbias | Calibration offset for the X-axis gyroscope channel. |
9694
+---------------------------------------+------------------------------------------------------+
97-
| in_anglvel_calibbias_x | x-axis gyroscope offset correction |
98-
+---------------------------------------+------------------------------------------------------+
9995
| in_anglvel_x_raw | Raw X-axis gyroscope channel value. |
10096
+---------------------------------------+------------------------------------------------------+
101-
| in_anglvel_calibbias_y | y-axis gyroscope offset correction |
97+
| in_anglvel_y_calibbias | Calibration offset for the Y-axis gyroscope channel. |
10298
+---------------------------------------+------------------------------------------------------+
10399
| in_anglvel_y_raw | Raw Y-axis gyroscope channel value. |
104100
+---------------------------------------+------------------------------------------------------+

drivers/iio/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ obj-$(CONFIG_IIO) += industrialio.o
77
industrialio-y := industrialio-core.o industrialio-event.o inkern.o
88
industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
99
industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
10+
industrialio-$(CONFIG_ACPI) += industrialio-acpi.o
1011

1112
obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o
1213
obj-$(CONFIG_IIO_GTS_HELPER) += industrialio-gts-helper.o

drivers/iio/accel/bmc150-accel-core.c

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,9 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
386386
static bool bmc150_apply_bosc0200_acpi_orientation(struct device *dev,
387387
struct iio_mount_matrix *orientation)
388388
{
389-
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
390389
struct iio_dev *indio_dev = dev_get_drvdata(dev);
391390
struct acpi_device *adev = ACPI_COMPANION(dev);
392-
char *name, *alt_name, *label, *str;
393-
union acpi_object *obj, *elements;
394-
acpi_status status;
395-
int i, j, val[3];
391+
char *name, *alt_name, *label;
396392

397393
if (strcmp(dev_name(dev), "i2c-BOSC0200:base") == 0) {
398394
alt_name = "ROMK";
@@ -411,43 +407,7 @@ static bool bmc150_apply_bosc0200_acpi_orientation(struct device *dev,
411407
return false;
412408
}
413409

414-
status = acpi_evaluate_object(adev->handle, name, NULL, &buffer);
415-
if (ACPI_FAILURE(status)) {
416-
dev_warn(dev, "Failed to get ACPI mount matrix: %d\n", status);
417-
return false;
418-
}
419-
420-
obj = buffer.pointer;
421-
if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 3)
422-
goto unknown_format;
423-
424-
elements = obj->package.elements;
425-
for (i = 0; i < 3; i++) {
426-
if (elements[i].type != ACPI_TYPE_STRING)
427-
goto unknown_format;
428-
429-
str = elements[i].string.pointer;
430-
if (sscanf(str, "%d %d %d", &val[0], &val[1], &val[2]) != 3)
431-
goto unknown_format;
432-
433-
for (j = 0; j < 3; j++) {
434-
switch (val[j]) {
435-
case -1: str = "-1"; break;
436-
case 0: str = "0"; break;
437-
case 1: str = "1"; break;
438-
default: goto unknown_format;
439-
}
440-
orientation->rotation[i * 3 + j] = str;
441-
}
442-
}
443-
444-
kfree(buffer.pointer);
445-
return true;
446-
447-
unknown_format:
448-
dev_warn(dev, "Unknown ACPI mount matrix format, ignoring\n");
449-
kfree(buffer.pointer);
450-
return false;
410+
return iio_read_acpi_mount_matrix(dev, orientation, name);
451411
}
452412

453413
static bool bmc150_apply_dual250e_acpi_orientation(struct device *dev,

drivers/iio/accel/kxcjk-1013.c

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -636,84 +636,6 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on)
636636
return 0;
637637
}
638638

639-
#ifdef CONFIG_ACPI
640-
static bool kxj_acpi_orientation(struct device *dev,
641-
struct iio_mount_matrix *orientation)
642-
{
643-
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
644-
struct acpi_device *adev = ACPI_COMPANION(dev);
645-
char *str;
646-
union acpi_object *obj, *elements;
647-
acpi_status status;
648-
int i, j, val[3];
649-
bool ret = false;
650-
651-
if (!acpi_has_method(adev->handle, "ROTM"))
652-
return false;
653-
654-
status = acpi_evaluate_object(adev->handle, "ROTM", NULL, &buffer);
655-
if (ACPI_FAILURE(status)) {
656-
dev_err(dev, "Failed to get ACPI mount matrix: %d\n", status);
657-
return false;
658-
}
659-
660-
obj = buffer.pointer;
661-
if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 3) {
662-
dev_err(dev, "Unknown ACPI mount matrix package format\n");
663-
goto out_free_buffer;
664-
}
665-
666-
elements = obj->package.elements;
667-
for (i = 0; i < 3; i++) {
668-
if (elements[i].type != ACPI_TYPE_STRING) {
669-
dev_err(dev, "Unknown ACPI mount matrix element format\n");
670-
goto out_free_buffer;
671-
}
672-
673-
str = elements[i].string.pointer;
674-
if (sscanf(str, "%d %d %d", &val[0], &val[1], &val[2]) != 3) {
675-
dev_err(dev, "Incorrect ACPI mount matrix string format\n");
676-
goto out_free_buffer;
677-
}
678-
679-
for (j = 0; j < 3; j++) {
680-
switch (val[j]) {
681-
case -1: str = "-1"; break;
682-
case 0: str = "0"; break;
683-
case 1: str = "1"; break;
684-
default:
685-
dev_err(dev, "Invalid value in ACPI mount matrix: %d\n", val[j]);
686-
goto out_free_buffer;
687-
}
688-
orientation->rotation[i * 3 + j] = str;
689-
}
690-
}
691-
692-
ret = true;
693-
694-
out_free_buffer:
695-
kfree(buffer.pointer);
696-
return ret;
697-
}
698-
699-
static bool kxj1009_apply_acpi_orientation(struct device *dev,
700-
struct iio_mount_matrix *orientation)
701-
{
702-
struct acpi_device *adev = ACPI_COMPANION(dev);
703-
704-
if (adev && acpi_dev_hid_uid_match(adev, "KIOX000A", NULL))
705-
return kxj_acpi_orientation(dev, orientation);
706-
707-
return false;
708-
}
709-
#else
710-
static bool kxj1009_apply_acpi_orientation(struct device *dev,
711-
struct iio_mount_matrix *orientation)
712-
{
713-
return false;
714-
}
715-
#endif
716-
717639
static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data)
718640
{
719641
int ret;
@@ -1544,7 +1466,7 @@ static int kxcjk1013_probe(struct i2c_client *client)
15441466
} else {
15451467
data->active_high_intr = true; /* default polarity */
15461468

1547-
if (!kxj1009_apply_acpi_orientation(&client->dev, &data->orientation)) {
1469+
if (!iio_read_acpi_mount_matrix(&client->dev, &data->orientation, "ROTM")) {
15481470
ret = iio_read_mount_matrix(&client->dev, &data->orientation);
15491471
if (ret)
15501472
return ret;

drivers/iio/accel/mxc4005.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct mxc4005_data {
5656
struct mutex mutex;
5757
struct regmap *regmap;
5858
struct iio_trigger *dready_trig;
59+
struct iio_mount_matrix orientation;
5960
/* Ensure timestamp is naturally aligned */
6061
struct {
6162
__be16 chans[3];
@@ -259,6 +260,20 @@ static int mxc4005_write_raw(struct iio_dev *indio_dev,
259260
}
260261
}
261262

263+
static const struct iio_mount_matrix *
264+
mxc4005_get_mount_matrix(const struct iio_dev *indio_dev,
265+
const struct iio_chan_spec *chan)
266+
{
267+
struct mxc4005_data *data = iio_priv(indio_dev);
268+
269+
return &data->orientation;
270+
}
271+
272+
static const struct iio_chan_spec_ext_info mxc4005_ext_info[] = {
273+
IIO_MOUNT_MATRIX(IIO_SHARED_BY_TYPE, mxc4005_get_mount_matrix),
274+
{ }
275+
};
276+
262277
static const struct iio_info mxc4005_info = {
263278
.read_raw = mxc4005_read_raw,
264279
.write_raw = mxc4005_write_raw,
@@ -285,6 +300,7 @@ static const unsigned long mxc4005_scan_masks[] = {
285300
.shift = 4, \
286301
.endianness = IIO_BE, \
287302
}, \
303+
.ext_info = mxc4005_ext_info, \
288304
}
289305

290306
static const struct iio_chan_spec mxc4005_channels[] = {
@@ -415,6 +431,12 @@ static int mxc4005_probe(struct i2c_client *client)
415431

416432
mutex_init(&data->mutex);
417433

434+
if (!iio_read_acpi_mount_matrix(&client->dev, &data->orientation, "ROTM")) {
435+
ret = iio_read_mount_matrix(&client->dev, &data->orientation);
436+
if (ret)
437+
return ret;
438+
}
439+
418440
indio_dev->channels = mxc4005_channels;
419441
indio_dev->num_channels = ARRAY_SIZE(mxc4005_channels);
420442
indio_dev->available_scan_masks = mxc4005_scan_masks;

drivers/iio/adc/ad7266.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ static void ad7266_init_channels(struct iio_dev *indio_dev)
371371
indio_dev->channels = chan_info->channels;
372372
indio_dev->num_channels = chan_info->num_channels;
373373
indio_dev->available_scan_masks = chan_info->scan_masks;
374-
indio_dev->masklength = chan_info->num_channels - 1;
375374
}
376375

377376
static const char * const ad7266_gpio_labels[] = {

0 commit comments

Comments
 (0)