]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.3-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Jun 2023 14:50:31 +0000 (16:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Jun 2023 14:50:31 +0000 (16:50 +0200)
added patches:
dt-bindings-iio-adc-renesas-rcar-gyroadc-fix-adi-ad7476-compatible-value.patch
hid-google-add-jewel-usb-id.patch
hid-wacom-avoid-integer-overflow-in-wacom_intuos_inout.patch
iio-accel-kx022a-fix-irq-getting.patch
iio-accel-st_accel-fix-invalid-mount_matrix-on-devices-without-acpi-_ont-method.patch
iio-ad4130-make-sure-clock-provider-gets-removed.patch
iio-adc-ad7192-change-shorted-channels-to-differential.patch
iio-adc-ad_sigma_delta-fix-irq-issue-by-setting-irq_disable_unlazy-flag.patch
iio-adc-mt6370-fix-ibus-and-ibat-scaling-value-of-some-specific-vendor-id-chips.patch
iio-adc-mxs-lradc-fix-the-order-of-two-cleanup-operations.patch
iio-adc-stm32-adc-skip-adc-channels-setup-if-none-is-present.patch
iio-adc-stm32-adc-skip-adc-diff-channels-setup-if-none-is-present.patch
iio-addac-ad74413-fix-resistance-input-processing.patch
iio-dac-build-ad5758-driver-when-ad5758-is-selected.patch
iio-dac-mcp4725-fix-i2c_master_send-return-value-handling.patch
iio-imu-inv_icm42600-fix-timestamp-reset.patch
iio-light-vcnl4035-fixed-chip-id-check.patch
iio-tmag5273-fix-runtime-pm-leak-on-measurement-error.patch

19 files changed:
queue-6.3/dt-bindings-iio-adc-renesas-rcar-gyroadc-fix-adi-ad7476-compatible-value.patch [new file with mode: 0644]
queue-6.3/hid-google-add-jewel-usb-id.patch [new file with mode: 0644]
queue-6.3/hid-wacom-avoid-integer-overflow-in-wacom_intuos_inout.patch [new file with mode: 0644]
queue-6.3/iio-accel-kx022a-fix-irq-getting.patch [new file with mode: 0644]
queue-6.3/iio-accel-st_accel-fix-invalid-mount_matrix-on-devices-without-acpi-_ont-method.patch [new file with mode: 0644]
queue-6.3/iio-ad4130-make-sure-clock-provider-gets-removed.patch [new file with mode: 0644]
queue-6.3/iio-adc-ad7192-change-shorted-channels-to-differential.patch [new file with mode: 0644]
queue-6.3/iio-adc-ad_sigma_delta-fix-irq-issue-by-setting-irq_disable_unlazy-flag.patch [new file with mode: 0644]
queue-6.3/iio-adc-mt6370-fix-ibus-and-ibat-scaling-value-of-some-specific-vendor-id-chips.patch [new file with mode: 0644]
queue-6.3/iio-adc-mxs-lradc-fix-the-order-of-two-cleanup-operations.patch [new file with mode: 0644]
queue-6.3/iio-adc-stm32-adc-skip-adc-channels-setup-if-none-is-present.patch [new file with mode: 0644]
queue-6.3/iio-adc-stm32-adc-skip-adc-diff-channels-setup-if-none-is-present.patch [new file with mode: 0644]
queue-6.3/iio-addac-ad74413-fix-resistance-input-processing.patch [new file with mode: 0644]
queue-6.3/iio-dac-build-ad5758-driver-when-ad5758-is-selected.patch [new file with mode: 0644]
queue-6.3/iio-dac-mcp4725-fix-i2c_master_send-return-value-handling.patch [new file with mode: 0644]
queue-6.3/iio-imu-inv_icm42600-fix-timestamp-reset.patch [new file with mode: 0644]
queue-6.3/iio-light-vcnl4035-fixed-chip-id-check.patch [new file with mode: 0644]
queue-6.3/iio-tmag5273-fix-runtime-pm-leak-on-measurement-error.patch [new file with mode: 0644]
queue-6.3/series

diff --git a/queue-6.3/dt-bindings-iio-adc-renesas-rcar-gyroadc-fix-adi-ad7476-compatible-value.patch b/queue-6.3/dt-bindings-iio-adc-renesas-rcar-gyroadc-fix-adi-ad7476-compatible-value.patch
new file mode 100644 (file)
index 0000000..6812021
--- /dev/null
@@ -0,0 +1,36 @@
+From 55720d242052e860b9fde445e302e0425722e7f1 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Tue, 9 May 2023 14:34:22 +0200
+Subject: dt-bindings: iio: adc: renesas,rcar-gyroadc: Fix adi,ad7476 compatible value
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+commit 55720d242052e860b9fde445e302e0425722e7f1 upstream.
+
+The conversion to json-schema accidentally dropped the "ad" part prefix
+from the compatible value.
+
+Fixes: 8c41245872e2 ("dt-bindings:iio:adc:renesas,rcar-gyroadc: txt to yaml conversion.")
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Link: https://lore.kernel.org/r/6b328a3f52657c20759f3a5bb2fe033d47644ba8.1683635404.git.geert+renesas@glider.be
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml
++++ b/Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml
+@@ -86,7 +86,7 @@ patternProperties:
+             of the MAX chips to the GyroADC, while MISO line of each Maxim
+             ADC connects to a shared input pin of the GyroADC.
+         enum:
+-          - adi,7476
++          - adi,ad7476
+           - fujitsu,mb88101a
+           - maxim,max1162
+           - maxim,max11100
diff --git a/queue-6.3/hid-google-add-jewel-usb-id.patch b/queue-6.3/hid-google-add-jewel-usb-id.patch
new file mode 100644 (file)
index 0000000..1175058
--- /dev/null
@@ -0,0 +1,40 @@
+From ed84c4517a5bc536e8572a01dfa11bc22a280d06 Mon Sep 17 00:00:00 2001
+From: Sung-Chi Li <lschyi@chromium.org>
+Date: Mon, 24 Apr 2023 10:37:36 +0800
+Subject: HID: google: add jewel USB id
+
+From: Sung-Chi Li <lschyi@chromium.org>
+
+commit ed84c4517a5bc536e8572a01dfa11bc22a280d06 upstream.
+
+Add 1 additional hammer-like device.
+
+Signed-off-by: Sung-Chi Li <lschyi@chromium.org>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/hid-google-hammer.c |    2 ++
+ drivers/hid/hid-ids.h           |    1 +
+ 2 files changed, 3 insertions(+)
+
+--- a/drivers/hid/hid-google-hammer.c
++++ b/drivers/hid/hid-google-hammer.c
+@@ -587,6 +587,8 @@ static const struct hid_device_id hammer
+       { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+                    USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
+       { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
++                   USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_JEWEL) },
++      { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+                    USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
+       { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+                    USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MASTERBALL) },
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -529,6 +529,7 @@
+ #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
+ #define USB_DEVICE_ID_GOOGLE_DON      0x5050
+ #define USB_DEVICE_ID_GOOGLE_EEL      0x5057
++#define USB_DEVICE_ID_GOOGLE_JEWEL    0x5061
+ #define USB_VENDOR_ID_GOTOP           0x08f2
+ #define USB_DEVICE_ID_SUPER_Q2                0x007f
diff --git a/queue-6.3/hid-wacom-avoid-integer-overflow-in-wacom_intuos_inout.patch b/queue-6.3/hid-wacom-avoid-integer-overflow-in-wacom_intuos_inout.patch
new file mode 100644 (file)
index 0000000..0016356
--- /dev/null
@@ -0,0 +1,39 @@
+From bd249b91977b768ea02bf84d04625d2690ad2b98 Mon Sep 17 00:00:00 2001
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Date: Mon, 17 Apr 2023 09:01:48 -0700
+Subject: HID: wacom: avoid integer overflow in wacom_intuos_inout()
+
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+
+commit bd249b91977b768ea02bf84d04625d2690ad2b98 upstream.
+
+If high bit is set to 1 in ((data[3] & 0x0f << 28), after all arithmetic
+operations and integer promotions are done, high bits in
+wacom->serial[idx] will be filled with 1s as well.
+Avoid this, albeit unlikely, issue by specifying left operand's __u64
+type for the right operand.
+
+Found by Linux Verification Center (linuxtesting.org) with static
+analysis tool SVACE.
+
+Fixes: 3bea733ab212 ("USB: wacom tablet driver reorganization")
+Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/wacom_wac.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/hid/wacom_wac.c
++++ b/drivers/hid/wacom_wac.c
+@@ -826,7 +826,7 @@ static int wacom_intuos_inout(struct wac
+       /* Enter report */
+       if ((data[1] & 0xfc) == 0xc0) {
+               /* serial number of the tool */
+-              wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
++              wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
+                       (data[4] << 20) + (data[5] << 12) +
+                       (data[6] << 4) + (data[7] >> 4);
diff --git a/queue-6.3/iio-accel-kx022a-fix-irq-getting.patch b/queue-6.3/iio-accel-kx022a-fix-irq-getting.patch
new file mode 100644 (file)
index 0000000..389be5e
--- /dev/null
@@ -0,0 +1,50 @@
+From 56cd3d1c5c5b073a1a444eafdcf97d4d866d351a Mon Sep 17 00:00:00 2001
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+Date: Fri, 12 May 2023 10:53:41 +0300
+Subject: iio: accel: kx022a fix irq getting
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+commit 56cd3d1c5c5b073a1a444eafdcf97d4d866d351a upstream.
+
+The fwnode_irq_get_byname() was returning 0 at device-tree mapping
+error. If this occurred, the KX022A driver did abort the probe but
+errorneously directly returned the return value from
+fwnode_irq_get_byname() from probe. In case of a device-tree mapping
+error this indicated success.
+
+The fwnode_irq_get_byname() has since been fixed to not return zero on
+error so the check for fwnode_irq_get_byname() can be relaxed to only
+treat negative values as errors. This will also do decent fix even when
+backported to branches where fwnode_irq_get_byname() can still return
+zero on error because KX022A probe should later fail at IRQ requesting
+and a prober error handling should follow.
+
+Relax the return value check for fwnode_irq_get_byname() to only treat
+negative values as errors.
+
+Reported-by: kernel test robot <lkp@intel.com>
+Reported-by: Dan Carpenter <error27@gmail.com>
+Closes: https://lore.kernel.org/r/202305110245.MFxC9bUj-lkp@intel.com/
+Link: https://lore.kernel.org/r/202305110245.MFxC9bUj-lkp@intel.com/
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer")
+Link: https://lore.kernel.org/r/b45b4b638db109c6078d243252df3a7b0485f7d5.1683875389.git.mazziesaccount@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/accel/kionix-kx022a.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/accel/kionix-kx022a.c
++++ b/drivers/iio/accel/kionix-kx022a.c
+@@ -1049,7 +1049,7 @@ int kx022a_probe_internal(struct device
+               data->ien_reg = KX022A_REG_INC4;
+       } else {
+               irq = fwnode_irq_get_byname(fwnode, "INT2");
+-              if (irq <= 0)
++              if (irq < 0)
+                       return dev_err_probe(dev, irq, "No suitable IRQ\n");
+               data->inc_reg = KX022A_REG_INC5;
diff --git a/queue-6.3/iio-accel-st_accel-fix-invalid-mount_matrix-on-devices-without-acpi-_ont-method.patch b/queue-6.3/iio-accel-st_accel-fix-invalid-mount_matrix-on-devices-without-acpi-_ont-method.patch
new file mode 100644 (file)
index 0000000..5477e5a
--- /dev/null
@@ -0,0 +1,53 @@
+From 79b8ded9d9c595db9bd5b2f62f5f738b36de1e22 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Sun, 16 Apr 2023 23:24:09 +0200
+Subject: iio: accel: st_accel: Fix invalid mount_matrix on devices without ACPI _ONT method
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 79b8ded9d9c595db9bd5b2f62f5f738b36de1e22 upstream.
+
+When apply_acpi_orientation() fails, st_accel_common_probe() will fall back
+to iio_read_mount_matrix(), which checks for a mount-matrix device property
+and if that is not set falls back to the identity matrix.
+
+But when a sensor has no ACPI companion fwnode, or when the ACPI fwnode
+does not have a "_ONT" method apply_acpi_orientation() was returning 0,
+causing iio_read_mount_matrix() to never get called resulting in an
+invalid mount_matrix:
+
+[root@fedora ~]# cat /sys/bus/iio/devices/iio\:device0/mount_matrix
+(null), (null), (null); (null), (null), (null); (null), (null), (null)
+
+Fix this by making apply_acpi_orientation() always return an error when
+it did not set the mount_matrix.
+
+Fixes: 3d8ad94bb175 ("iio: accel: st_sensors: Support generic mounting matrix")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Tested-by: Marius Hoch <mail@mariushoch.de>
+Link: https://lore.kernel.org/r/20230416212409.310936-1-hdegoede@redhat.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/accel/st_accel_core.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/accel/st_accel_core.c
++++ b/drivers/iio/accel/st_accel_core.c
+@@ -1290,12 +1290,12 @@ static int apply_acpi_orientation(struct
+       adev = ACPI_COMPANION(indio_dev->dev.parent);
+       if (!adev)
+-              return 0;
++              return -ENXIO;
+       /* Read _ONT data, which should be a package of 6 integers. */
+       status = acpi_evaluate_object(adev->handle, "_ONT", NULL, &buffer);
+       if (status == AE_NOT_FOUND) {
+-              return 0;
++              return -ENXIO;
+       } else if (ACPI_FAILURE(status)) {
+               dev_warn(&indio_dev->dev, "failed to execute _ONT: %d\n",
+                        status);
diff --git a/queue-6.3/iio-ad4130-make-sure-clock-provider-gets-removed.patch b/queue-6.3/iio-ad4130-make-sure-clock-provider-gets-removed.patch
new file mode 100644 (file)
index 0000000..b8f92ee
--- /dev/null
@@ -0,0 +1,61 @@
+From 28f73ded19d403697f87473c9b85a27eb8ed9cf2 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Fri, 14 Apr 2023 08:07:02 -0700
+Subject: iio: ad4130: Make sure clock provider gets removed
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+commit 28f73ded19d403697f87473c9b85a27eb8ed9cf2 upstream.
+
+The ad4130 driver registers a clock provider, but never removes it. This
+leaves a stale clock provider behind that references freed clocks when the
+device is unbound.
+
+Register a managed action to remove the clock provider when the device is
+removed.
+
+Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver")
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Link: https://lore.kernel.org/r/20230414150702.518441-1-lars@metafoo.de
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/ad4130.c |   12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/iio/adc/ad4130.c
++++ b/drivers/iio/adc/ad4130.c
+@@ -1817,6 +1817,11 @@ static const struct clk_ops ad4130_int_c
+       .unprepare = ad4130_int_clk_unprepare,
+ };
++static void ad4130_clk_del_provider(void *of_node)
++{
++      of_clk_del_provider(of_node);
++}
++
+ static int ad4130_setup_int_clk(struct ad4130_state *st)
+ {
+       struct device *dev = &st->spi->dev;
+@@ -1824,6 +1829,7 @@ static int ad4130_setup_int_clk(struct a
+       struct clk_init_data init;
+       const char *clk_name;
+       struct clk *clk;
++      int ret;
+       if (st->int_pin_sel == AD4130_INT_PIN_CLK ||
+           st->mclk_sel != AD4130_MCLK_76_8KHZ)
+@@ -1843,7 +1849,11 @@ static int ad4130_setup_int_clk(struct a
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+-      return of_clk_add_provider(of_node, of_clk_src_simple_get, clk);
++      ret = of_clk_add_provider(of_node, of_clk_src_simple_get, clk);
++      if (ret)
++              return ret;
++
++      return devm_add_action_or_reset(dev, ad4130_clk_del_provider, of_node);
+ }
+ static int ad4130_setup(struct iio_dev *indio_dev)
diff --git a/queue-6.3/iio-adc-ad7192-change-shorted-channels-to-differential.patch b/queue-6.3/iio-adc-ad7192-change-shorted-channels-to-differential.patch
new file mode 100644 (file)
index 0000000..dd190ca
--- /dev/null
@@ -0,0 +1,71 @@
+From e55245d115bb9054cb72cdd5dda5660f4484873a Mon Sep 17 00:00:00 2001
+From: Paul Cercueil <paul@crapouillou.net>
+Date: Thu, 30 Mar 2023 12:21:00 +0200
+Subject: iio: adc: ad7192: Change "shorted" channels to differential
+
+From: Paul Cercueil <paul@crapouillou.net>
+
+commit e55245d115bb9054cb72cdd5dda5660f4484873a upstream.
+
+The AD7192 provides a specific channel configuration where both negative
+and positive inputs are connected to AIN2. This was represented in the
+ad7192 driver as a IIO channel with .channel = 2 and .extended_name set
+to "shorted".
+
+The problem with this approach, is that the driver provided two IIO
+channels with the identifier .channel = 2; one "shorted" and the other
+not. This goes against the IIO ABI, as a channel identifier should be
+unique.
+
+Address this issue by changing "shorted" channels to being differential
+instead, with channel 2 vs. itself, as we're actually measuring AIN2 vs.
+itself.
+
+Note that the fix tag is for the commit that moved the driver out of
+staging. The bug existed before that, but backporting would become very
+complex further down and unlikely to happen.
+
+Fixes: b581f748cce0 ("staging: iio: adc: ad7192: move out of staging")
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+Co-developed-by: Alisa Roman <alisa.roman@analog.com>
+Signed-off-by: Alisa Roman <alisa.roman@analog.com>
+Reviewed-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20230330102100.17590-1-paul@crapouillou.net
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/ad7192.c |    8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/iio/adc/ad7192.c
++++ b/drivers/iio/adc/ad7192.c
+@@ -897,10 +897,6 @@ static const struct iio_info ad7195_info
+       __AD719x_CHANNEL(_si, _channel1, -1, _address, NULL, IIO_VOLTAGE, \
+               BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
+-#define AD719x_SHORTED_CHANNEL(_si, _channel1, _address) \
+-      __AD719x_CHANNEL(_si, _channel1, -1, _address, "shorted", IIO_VOLTAGE, \
+-              BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
+-
+ #define AD719x_TEMP_CHANNEL(_si, _address) \
+       __AD719x_CHANNEL(_si, 0, -1, _address, NULL, IIO_TEMP, 0, NULL)
+@@ -908,7 +904,7 @@ static const struct iio_chan_spec ad7192
+       AD719x_DIFF_CHANNEL(0, 1, 2, AD7192_CH_AIN1P_AIN2M),
+       AD719x_DIFF_CHANNEL(1, 3, 4, AD7192_CH_AIN3P_AIN4M),
+       AD719x_TEMP_CHANNEL(2, AD7192_CH_TEMP),
+-      AD719x_SHORTED_CHANNEL(3, 2, AD7192_CH_AIN2P_AIN2M),
++      AD719x_DIFF_CHANNEL(3, 2, 2, AD7192_CH_AIN2P_AIN2M),
+       AD719x_CHANNEL(4, 1, AD7192_CH_AIN1),
+       AD719x_CHANNEL(5, 2, AD7192_CH_AIN2),
+       AD719x_CHANNEL(6, 3, AD7192_CH_AIN3),
+@@ -922,7 +918,7 @@ static const struct iio_chan_spec ad7193
+       AD719x_DIFF_CHANNEL(2, 5, 6, AD7193_CH_AIN5P_AIN6M),
+       AD719x_DIFF_CHANNEL(3, 7, 8, AD7193_CH_AIN7P_AIN8M),
+       AD719x_TEMP_CHANNEL(4, AD7193_CH_TEMP),
+-      AD719x_SHORTED_CHANNEL(5, 2, AD7193_CH_AIN2P_AIN2M),
++      AD719x_DIFF_CHANNEL(5, 2, 2, AD7193_CH_AIN2P_AIN2M),
+       AD719x_CHANNEL(6, 1, AD7193_CH_AIN1),
+       AD719x_CHANNEL(7, 2, AD7193_CH_AIN2),
+       AD719x_CHANNEL(8, 3, AD7193_CH_AIN3),
diff --git a/queue-6.3/iio-adc-ad_sigma_delta-fix-irq-issue-by-setting-irq_disable_unlazy-flag.patch b/queue-6.3/iio-adc-ad_sigma_delta-fix-irq-issue-by-setting-irq_disable_unlazy-flag.patch
new file mode 100644 (file)
index 0000000..dc6355e
--- /dev/null
@@ -0,0 +1,49 @@
+From 626d312028bec44209d0ecd5beaa9b1aa8945f7d Mon Sep 17 00:00:00 2001
+From: Masahiro Honda <honda@mechatrax.com>
+Date: Thu, 18 May 2023 20:08:16 +0900
+Subject: iio: adc: ad_sigma_delta: Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag
+
+From: Masahiro Honda <honda@mechatrax.com>
+
+commit 626d312028bec44209d0ecd5beaa9b1aa8945f7d upstream.
+
+The Sigma-Delta ADCs supported by this driver can use SDO as an interrupt
+line to indicate the completion of a conversion. However, some devices
+cannot properly detect the completion of a conversion by an interrupt.
+This is for the reason mentioned in the following commit.
+
+commit e9849777d0e2 ("genirq: Add flag to force mask in
+                      disable_irq[_nosync]()")
+
+A read operation is performed by an extra interrupt before the completion
+of a conversion. At this time, the value read from the ADC data register
+is the same as the previous conversion result. This patch fixes the issue
+by setting IRQ_DISABLE_UNLAZY flag.
+
+Fixes: 0c6ef985a1fd ("iio: adc: ad7791: fix IRQ flags")
+Fixes: 1a913270e57a ("iio: adc: ad7793: Fix IRQ flag")
+Fixes: e081102f3077 ("iio: adc: ad7780: Fix IRQ flag")
+Fixes: 89a86da5cb8e ("iio: adc: ad7192: Add IRQ flag")
+Fixes: 79ef91493f54 ("iio: adc: ad7124: Set IRQ type to falling")
+Signed-off-by: Masahiro Honda <honda@mechatrax.com>
+Link: https://lore.kernel.org/r/20230518110816.248-1-honda@mechatrax.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/ad_sigma_delta.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/iio/adc/ad_sigma_delta.c
++++ b/drivers/iio/adc/ad_sigma_delta.c
+@@ -584,6 +584,10 @@ static int devm_ad_sd_probe_trigger(stru
+       init_completion(&sigma_delta->completion);
+       sigma_delta->irq_dis = true;
++
++      /* the IRQ core clears IRQ_DISABLE_UNLAZY flag when freeing an IRQ */
++      irq_set_status_flags(sigma_delta->spi->irq, IRQ_DISABLE_UNLAZY);
++
+       ret = devm_request_irq(dev, sigma_delta->spi->irq,
+                              ad_sd_data_rdy_trig_poll,
+                              sigma_delta->info->irq_flags | IRQF_NO_AUTOEN,
diff --git a/queue-6.3/iio-adc-mt6370-fix-ibus-and-ibat-scaling-value-of-some-specific-vendor-id-chips.patch b/queue-6.3/iio-adc-mt6370-fix-ibus-and-ibat-scaling-value-of-some-specific-vendor-id-chips.patch
new file mode 100644 (file)
index 0000000..8100380
--- /dev/null
@@ -0,0 +1,142 @@
+From 00ffdd6fa90298522d45ca0c348b23485584dcdc Mon Sep 17 00:00:00 2001
+From: ChiaEn Wu <chiaen_wu@richtek.com>
+Date: Mon, 10 Apr 2023 18:34:22 +0800
+Subject: iio: adc: mt6370: Fix ibus and ibat scaling value of some specific vendor ID chips
+
+From: ChiaEn Wu <chiaen_wu@richtek.com>
+
+commit 00ffdd6fa90298522d45ca0c348b23485584dcdc upstream.
+
+The scale value of ibus and ibat on the datasheet is incorrect due to the
+customer report after the experimentation with some specific vendor ID
+chips.
+
+Fixes: c1404d1b659f ("iio: adc: mt6370: Add MediaTek MT6370 support")
+Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
+Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
+Link: https://lore.kernel.org/r/1681122862-1994-1-git-send-email-chiaen_wu@richtek.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/mt6370-adc.c |   53 +++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 51 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/adc/mt6370-adc.c
++++ b/drivers/iio/adc/mt6370-adc.c
+@@ -19,6 +19,7 @@
+ #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h>
++#define MT6370_REG_DEV_INFO           0x100
+ #define MT6370_REG_CHG_CTRL3          0x113
+ #define MT6370_REG_CHG_CTRL7          0x117
+ #define MT6370_REG_CHG_ADC            0x121
+@@ -27,6 +28,7 @@
+ #define MT6370_ADC_START_MASK         BIT(0)
+ #define MT6370_ADC_IN_SEL_MASK                GENMASK(7, 4)
+ #define MT6370_AICR_ICHG_MASK         GENMASK(7, 2)
++#define MT6370_VENID_MASK             GENMASK(7, 4)
+ #define MT6370_AICR_100_mA            0x0
+ #define MT6370_AICR_150_mA            0x1
+@@ -47,6 +49,10 @@
+ #define ADC_CONV_TIME_MS              35
+ #define ADC_CONV_POLLING_TIME_US      1000
++#define MT6370_VID_RT5081             0x8
++#define MT6370_VID_RT5081A            0xA
++#define MT6370_VID_MT6370             0xE
++
+ struct mt6370_adc_data {
+       struct device *dev;
+       struct regmap *regmap;
+@@ -55,6 +61,7 @@ struct mt6370_adc_data {
+        * from being read at the same time.
+        */
+       struct mutex adc_lock;
++      unsigned int vid;
+ };
+ static int mt6370_adc_read_channel(struct mt6370_adc_data *priv, int chan,
+@@ -98,6 +105,30 @@ adc_unlock:
+       return ret;
+ }
++static int mt6370_adc_get_ibus_scale(struct mt6370_adc_data *priv)
++{
++      switch (priv->vid) {
++      case MT6370_VID_RT5081:
++      case MT6370_VID_RT5081A:
++      case MT6370_VID_MT6370:
++              return 3350;
++      default:
++              return 3875;
++      }
++}
++
++static int mt6370_adc_get_ibat_scale(struct mt6370_adc_data *priv)
++{
++      switch (priv->vid) {
++      case MT6370_VID_RT5081:
++      case MT6370_VID_RT5081A:
++      case MT6370_VID_MT6370:
++              return 2680;
++      default:
++              return 3870;
++      }
++}
++
+ static int mt6370_adc_read_scale(struct mt6370_adc_data *priv,
+                                int chan, int *val1, int *val2)
+ {
+@@ -123,7 +154,7 @@ static int mt6370_adc_read_scale(struct
+               case MT6370_AICR_250_mA:
+               case MT6370_AICR_300_mA:
+               case MT6370_AICR_350_mA:
+-                      *val1 = 3350;
++                      *val1 = mt6370_adc_get_ibus_scale(priv);
+                       break;
+               default:
+                       *val1 = 5000;
+@@ -150,7 +181,7 @@ static int mt6370_adc_read_scale(struct
+               case MT6370_ICHG_600_mA:
+               case MT6370_ICHG_700_mA:
+               case MT6370_ICHG_800_mA:
+-                      *val1 = 2680;
++                      *val1 = mt6370_adc_get_ibat_scale(priv);
+                       break;
+               default:
+                       *val1 = 5000;
+@@ -251,6 +282,20 @@ static const struct iio_chan_spec mt6370
+       MT6370_ADC_CHAN(TEMP_JC, IIO_TEMP, 12, BIT(IIO_CHAN_INFO_OFFSET)),
+ };
++static int mt6370_get_vendor_info(struct mt6370_adc_data *priv)
++{
++      unsigned int dev_info;
++      int ret;
++
++      ret = regmap_read(priv->regmap, MT6370_REG_DEV_INFO, &dev_info);
++      if (ret)
++              return ret;
++
++      priv->vid = FIELD_GET(MT6370_VENID_MASK, dev_info);
++
++      return 0;
++}
++
+ static int mt6370_adc_probe(struct platform_device *pdev)
+ {
+       struct device *dev = &pdev->dev;
+@@ -272,6 +317,10 @@ static int mt6370_adc_probe(struct platf
+       priv->regmap = regmap;
+       mutex_init(&priv->adc_lock);
++      ret = mt6370_get_vendor_info(priv);
++      if (ret)
++              return dev_err_probe(dev, ret, "Failed to get vid\n");
++
+       ret = regmap_write(priv->regmap, MT6370_REG_CHG_ADC, 0);
+       if (ret)
+               return dev_err_probe(dev, ret, "Failed to reset ADC\n");
diff --git a/queue-6.3/iio-adc-mxs-lradc-fix-the-order-of-two-cleanup-operations.patch b/queue-6.3/iio-adc-mxs-lradc-fix-the-order-of-two-cleanup-operations.patch
new file mode 100644 (file)
index 0000000..51adbd4
--- /dev/null
@@ -0,0 +1,83 @@
+From 27b2ed5b6d53cd62fc61c3f259ae52f5cac23b66 Mon Sep 17 00:00:00 2001
+From: Jiakai Luo <jkluo@hust.edu.cn>
+Date: Sat, 22 Apr 2023 06:34:06 -0700
+Subject: iio: adc: mxs-lradc: fix the order of two cleanup operations
+
+From: Jiakai Luo <jkluo@hust.edu.cn>
+
+commit 27b2ed5b6d53cd62fc61c3f259ae52f5cac23b66 upstream.
+
+Smatch reports:
+drivers/iio/adc/mxs-lradc-adc.c:766 mxs_lradc_adc_probe() warn:
+missing unwind goto?
+
+the order of three init operation:
+1.mxs_lradc_adc_trigger_init
+2.iio_triggered_buffer_setup
+3.mxs_lradc_adc_hw_init
+
+thus, the order of three cleanup operation should be:
+1.mxs_lradc_adc_hw_stop
+2.iio_triggered_buffer_cleanup
+3.mxs_lradc_adc_trigger_remove
+
+we exchange the order of two cleanup operations,
+introducing the following differences:
+1.if mxs_lradc_adc_trigger_init fails, returns directly;
+2.if trigger_init succeeds but iio_triggered_buffer_setup fails,
+goto err_trig and remove the trigger.
+
+In addition, we also reorder the unwind that goes on in the
+remove() callback to match the new ordering.
+
+Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver")
+Signed-off-by: Jiakai Luo <jkluo@hust.edu.cn>
+Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
+Link: https://lore.kernel.org/r/20230422133407.72908-1-jkluo@hust.edu.cn
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/mxs-lradc-adc.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/iio/adc/mxs-lradc-adc.c
++++ b/drivers/iio/adc/mxs-lradc-adc.c
+@@ -757,13 +757,13 @@ static int mxs_lradc_adc_probe(struct pl
+       ret = mxs_lradc_adc_trigger_init(iio);
+       if (ret)
+-              goto err_trig;
++              return ret;
+       ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time,
+                                        &mxs_lradc_adc_trigger_handler,
+                                        &mxs_lradc_adc_buffer_ops);
+       if (ret)
+-              return ret;
++              goto err_trig;
+       adc->vref_mv = mxs_lradc_adc_vref_mv[lradc->soc];
+@@ -801,9 +801,9 @@ static int mxs_lradc_adc_probe(struct pl
+ err_dev:
+       mxs_lradc_adc_hw_stop(adc);
+-      mxs_lradc_adc_trigger_remove(iio);
+-err_trig:
+       iio_triggered_buffer_cleanup(iio);
++err_trig:
++      mxs_lradc_adc_trigger_remove(iio);
+       return ret;
+ }
+@@ -814,8 +814,8 @@ static int mxs_lradc_adc_remove(struct p
+       iio_device_unregister(iio);
+       mxs_lradc_adc_hw_stop(adc);
+-      mxs_lradc_adc_trigger_remove(iio);
+       iio_triggered_buffer_cleanup(iio);
++      mxs_lradc_adc_trigger_remove(iio);
+       return 0;
+ }
diff --git a/queue-6.3/iio-adc-stm32-adc-skip-adc-channels-setup-if-none-is-present.patch b/queue-6.3/iio-adc-stm32-adc-skip-adc-channels-setup-if-none-is-present.patch
new file mode 100644 (file)
index 0000000..3dbcb6b
--- /dev/null
@@ -0,0 +1,97 @@
+From 3e27ef0ced49f8ae7883c25fadf76a2086e99025 Mon Sep 17 00:00:00 2001
+From: Sean Nyekjaer <sean@geanix.com>
+Date: Wed, 3 May 2023 18:20:29 +0200
+Subject: iio: adc: stm32-adc: skip adc-channels setup if none is present
+
+From: Sean Nyekjaer <sean@geanix.com>
+
+commit 3e27ef0ced49f8ae7883c25fadf76a2086e99025 upstream.
+
+If only adc differential channels are defined driver will fail with
+stm32-adc: probe of 48003000.adc:adc@0 failed with error -22
+
+Fix this by skipping the initialization if no channels are defined.
+
+This applies only to the legacy way of initializing adc channels.
+
+Fixes: d7705f35448a ("iio: adc: stm32-adc: convert to device properties")
+Signed-off-by: Sean Nyekjaer <sean@geanix.com>
+Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com>
+Link: https://lore.kernel.org/r/20230503162029.3654093-2-sean@geanix.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/stm32-adc.c |   42 +++++++++++++++++++++++-------------------
+ 1 file changed, 23 insertions(+), 19 deletions(-)
+
+--- a/drivers/iio/adc/stm32-adc.c
++++ b/drivers/iio/adc/stm32-adc.c
+@@ -2037,6 +2037,7 @@ static int stm32_adc_legacy_chan_init(st
+       struct stm32_adc_diff_channel diff[STM32_ADC_CH_MAX];
+       struct device *dev = &indio_dev->dev;
+       u32 num_diff = adc->num_diff;
++      int num_se = nchans - num_diff;
+       int size = num_diff * sizeof(*diff) / sizeof(u32);
+       int scan_index = 0, ret, i, c;
+       u32 smp = 0, smps[STM32_ADC_CH_MAX], chans[STM32_ADC_CH_MAX];
+@@ -2063,29 +2064,32 @@ static int stm32_adc_legacy_chan_init(st
+                       scan_index++;
+               }
+       }
+-
+-      ret = device_property_read_u32_array(dev, "st,adc-channels", chans,
+-                                           nchans);
+-      if (ret)
+-              return ret;
+-
+-      for (c = 0; c < nchans; c++) {
+-              if (chans[c] >= adc_info->max_channels) {
+-                      dev_err(&indio_dev->dev, "Invalid channel %d\n",
+-                              chans[c]);
+-                      return -EINVAL;
++      if (num_se > 0) {
++              ret = device_property_read_u32_array(dev, "st,adc-channels", chans, num_se);
++              if (ret) {
++                      dev_err(&indio_dev->dev, "Failed to get st,adc-channels %d\n", ret);
++                      return ret;
+               }
+-              /* Channel can't be configured both as single-ended & diff */
+-              for (i = 0; i < num_diff; i++) {
+-                      if (chans[c] == diff[i].vinp) {
+-                              dev_err(&indio_dev->dev, "channel %d misconfigured\n",  chans[c]);
++              for (c = 0; c < num_se; c++) {
++                      if (chans[c] >= adc_info->max_channels) {
++                              dev_err(&indio_dev->dev, "Invalid channel %d\n",
++                                      chans[c]);
+                               return -EINVAL;
+                       }
++
++                      /* Channel can't be configured both as single-ended & diff */
++                      for (i = 0; i < num_diff; i++) {
++                              if (chans[c] == diff[i].vinp) {
++                                      dev_err(&indio_dev->dev, "channel %d misconfigured\n",
++                                              chans[c]);
++                                      return -EINVAL;
++                              }
++                      }
++                      stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
++                                              chans[c], 0, scan_index, false);
++                      scan_index++;
+               }
+-              stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
+-                                      chans[c], 0, scan_index, false);
+-              scan_index++;
+       }
+       if (adc->nsmps > 0) {
+@@ -2306,7 +2310,7 @@ static int stm32_adc_chan_fw_init(struct
+       if (legacy)
+               ret = stm32_adc_legacy_chan_init(indio_dev, adc, channels,
+-                                               num_channels);
++                                               timestamping ? num_channels - 1 : num_channels);
+       else
+               ret = stm32_adc_generic_chan_init(indio_dev, adc, channels);
+       if (ret < 0)
diff --git a/queue-6.3/iio-adc-stm32-adc-skip-adc-diff-channels-setup-if-none-is-present.patch b/queue-6.3/iio-adc-stm32-adc-skip-adc-diff-channels-setup-if-none-is-present.patch
new file mode 100644 (file)
index 0000000..a28e604
--- /dev/null
@@ -0,0 +1,54 @@
+From 9c0d6ccd7d6bbd275e390b55a3390b4274291d95 Mon Sep 17 00:00:00 2001
+From: Sean Nyekjaer <sean@geanix.com>
+Date: Wed, 3 May 2023 18:20:28 +0200
+Subject: iio: adc: stm32-adc: skip adc-diff-channels setup if none is present
+
+From: Sean Nyekjaer <sean@geanix.com>
+
+commit 9c0d6ccd7d6bbd275e390b55a3390b4274291d95 upstream.
+
+If no adc differential channels are defined driver will fail with EINVAL:
+stm32-adc: probe of 48003000.adc:adc@0 failed with error -22
+
+Fix this by skipping the initialization if no channels are defined.
+
+This applies only to the legacy way of initializing adc channels.
+
+Fixes: d7705f35448a ("iio: adc: stm32-adc: convert to device properties")
+Signed-off-by: Sean Nyekjaer <sean@geanix.com>
+Link: https://lore.kernel.org/r/20230503162029.3654093-1-sean@geanix.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/stm32-adc.c |   19 +++++++++----------
+ 1 file changed, 9 insertions(+), 10 deletions(-)
+
+--- a/drivers/iio/adc/stm32-adc.c
++++ b/drivers/iio/adc/stm32-adc.c
+@@ -2006,16 +2006,15 @@ static int stm32_adc_get_legacy_chan_cou
+        * to get the *real* number of channels.
+        */
+       ret = device_property_count_u32(dev, "st,adc-diff-channels");
+-      if (ret < 0)
+-              return ret;
+-
+-      ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32));
+-      if (ret > adc_info->max_channels) {
+-              dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n");
+-              return -EINVAL;
+-      } else if (ret > 0) {
+-              adc->num_diff = ret;
+-              num_channels += ret;
++      if (ret > 0) {
++              ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32));
++              if (ret > adc_info->max_channels) {
++                      dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n");
++                      return -EINVAL;
++              } else if (ret > 0) {
++                      adc->num_diff = ret;
++                      num_channels += ret;
++              }
+       }
+       /* Optional sample time is provided either for each, or all channels */
diff --git a/queue-6.3/iio-addac-ad74413-fix-resistance-input-processing.patch b/queue-6.3/iio-addac-ad74413-fix-resistance-input-processing.patch
new file mode 100644 (file)
index 0000000..c3ed52f
--- /dev/null
@@ -0,0 +1,39 @@
+From 24febc99ca725dcf42d57168a2f4e8a75a5ade92 Mon Sep 17 00:00:00 2001
+From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
+Date: Wed, 3 May 2023 11:58:17 +0200
+Subject: iio: addac: ad74413: fix resistance input processing
+
+From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
+
+commit 24febc99ca725dcf42d57168a2f4e8a75a5ade92 upstream.
+
+On success, ad74413r_get_single_adc_result() returns IIO_VAL_INT aka
+1. So currently, the IIO_CHAN_INFO_PROCESSED case is effectively
+equivalent to the IIO_CHAN_INFO_RAW case, and we never call
+ad74413r_adc_to_resistance_result() to convert the adc measurement to
+ohms.
+
+Check ret for being negative rather than non-zero.
+
+Fixes: fea251b6a5dbd (iio: addac: add AD74413R driver)
+Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
+Reviewed-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20230503095817.452551-1-linux@rasmusvillemoes.dk
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/addac/ad74413r.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/addac/ad74413r.c
++++ b/drivers/iio/addac/ad74413r.c
+@@ -981,7 +981,7 @@ static int ad74413r_read_raw(struct iio_
+               ret = ad74413r_get_single_adc_result(indio_dev, chan->channel,
+                                                    val);
+-              if (ret)
++              if (ret < 0)
+                       return ret;
+               ad74413r_adc_to_resistance_result(*val, val);
diff --git a/queue-6.3/iio-dac-build-ad5758-driver-when-ad5758-is-selected.patch b/queue-6.3/iio-dac-build-ad5758-driver-when-ad5758-is-selected.patch
new file mode 100644 (file)
index 0000000..075accb
--- /dev/null
@@ -0,0 +1,39 @@
+From a146eccb68be161ae9eab5f3f68bb0ed7c0fbaa8 Mon Sep 17 00:00:00 2001
+From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
+Date: Mon, 8 May 2023 06:02:08 +0200
+Subject: iio: dac: build ad5758 driver when AD5758 is selected
+
+From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
+
+commit a146eccb68be161ae9eab5f3f68bb0ed7c0fbaa8 upstream.
+
+Commit 28d1a7ac2a0d ("iio: dac: Add AD5758 support") adds the config AD5758
+and the corresponding driver ad5758.c. In the Makefile, the ad5758 driver
+is however included when AD5755 is selected, not when AD5758 is selected.
+
+Probably, this was simply a mistake that happened by copy-and-paste and
+forgetting to adjust the actual line. Surprisingly, no one has ever noticed
+that this driver is actually only included when AD5755 is selected and that
+the config AD5758 has actually no effect on the build.
+
+Fixes: 28d1a7ac2a0d ("iio: dac: Add AD5758 support")
+Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
+Link: https://lore.kernel.org/r/20230508040208.12033-1-lukas.bulwahn@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/dac/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/dac/Makefile
++++ b/drivers/iio/dac/Makefile
+@@ -17,7 +17,7 @@ obj-$(CONFIG_AD5592R_BASE) += ad5592r-ba
+ obj-$(CONFIG_AD5592R) += ad5592r.o
+ obj-$(CONFIG_AD5593R) += ad5593r.o
+ obj-$(CONFIG_AD5755) += ad5755.o
+-obj-$(CONFIG_AD5755) += ad5758.o
++obj-$(CONFIG_AD5758) += ad5758.o
+ obj-$(CONFIG_AD5761) += ad5761.o
+ obj-$(CONFIG_AD5764) += ad5764.o
+ obj-$(CONFIG_AD5766) += ad5766.o
diff --git a/queue-6.3/iio-dac-mcp4725-fix-i2c_master_send-return-value-handling.patch b/queue-6.3/iio-dac-mcp4725-fix-i2c_master_send-return-value-handling.patch
new file mode 100644 (file)
index 0000000..8135bd0
--- /dev/null
@@ -0,0 +1,72 @@
+From 09d3bec7009186bdba77039df01e5834788b3f95 Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex@denx.de>
+Date: Thu, 11 May 2023 02:43:30 +0200
+Subject: iio: dac: mcp4725: Fix i2c_master_send() return value handling
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marek Vasut <marex@denx.de>
+
+commit 09d3bec7009186bdba77039df01e5834788b3f95 upstream.
+
+The i2c_master_send() returns number of sent bytes on success,
+or negative on error. The suspend/resume callbacks expect zero
+on success and non-zero on error. Adapt the return value of the
+i2c_master_send() to the expectation of the suspend and resume
+callbacks, including proper validation of the return value.
+
+Fixes: cf35ad61aca2 ("iio: add mcp4725 I2C DAC driver")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Link: https://lore.kernel.org/r/20230511004330.206942-1-marex@denx.de
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/dac/mcp4725.c |   16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/dac/mcp4725.c
++++ b/drivers/iio/dac/mcp4725.c
+@@ -47,12 +47,18 @@ static int mcp4725_suspend(struct device
+       struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
+               to_i2c_client(dev)));
+       u8 outbuf[2];
++      int ret;
+       outbuf[0] = (data->powerdown_mode + 1) << 4;
+       outbuf[1] = 0;
+       data->powerdown = true;
+-      return i2c_master_send(data->client, outbuf, 2);
++      ret = i2c_master_send(data->client, outbuf, 2);
++      if (ret < 0)
++              return ret;
++      else if (ret != 2)
++              return -EIO;
++      return 0;
+ }
+ static int mcp4725_resume(struct device *dev)
+@@ -60,13 +66,19 @@ static int mcp4725_resume(struct device
+       struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
+               to_i2c_client(dev)));
+       u8 outbuf[2];
++      int ret;
+       /* restore previous DAC value */
+       outbuf[0] = (data->dac_value >> 8) & 0xf;
+       outbuf[1] = data->dac_value & 0xff;
+       data->powerdown = false;
+-      return i2c_master_send(data->client, outbuf, 2);
++      ret = i2c_master_send(data->client, outbuf, 2);
++      if (ret < 0)
++              return ret;
++      else if (ret != 2)
++              return -EIO;
++      return 0;
+ }
+ static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend,
+                               mcp4725_resume);
diff --git a/queue-6.3/iio-imu-inv_icm42600-fix-timestamp-reset.patch b/queue-6.3/iio-imu-inv_icm42600-fix-timestamp-reset.patch
new file mode 100644 (file)
index 0000000..bbfdb30
--- /dev/null
@@ -0,0 +1,71 @@
+From bbaae0c79ebd49f61ad942a8bf9e12bfc7f821bb Mon Sep 17 00:00:00 2001
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Date: Tue, 9 May 2023 15:22:02 +0000
+Subject: iio: imu: inv_icm42600: fix timestamp reset
+
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+
+commit bbaae0c79ebd49f61ad942a8bf9e12bfc7f821bb upstream.
+
+Timestamp reset is not done in the correct place. It must be done
+before enabling buffer. The reason is that interrupt timestamping
+is always happening when the chip is on, even if the
+corresponding sensor is off. When the sensor restarts, timestamp
+is wrong if you don't do a reset first.
+
+Fixes: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping")
+Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230509152202.245444-1-inv.git-commit@tdk.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
+@@ -275,9 +275,14 @@ static int inv_icm42600_buffer_preenable
+ {
+       struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
+       struct device *dev = regmap_get_device(st->map);
++      struct inv_icm42600_timestamp *ts = iio_priv(indio_dev);
+       pm_runtime_get_sync(dev);
++      mutex_lock(&st->lock);
++      inv_icm42600_timestamp_reset(ts);
++      mutex_unlock(&st->lock);
++
+       return 0;
+ }
+@@ -375,7 +380,6 @@ static int inv_icm42600_buffer_postdisab
+       struct device *dev = regmap_get_device(st->map);
+       unsigned int sensor;
+       unsigned int *watermark;
+-      struct inv_icm42600_timestamp *ts;
+       struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT;
+       unsigned int sleep_temp = 0;
+       unsigned int sleep_sensor = 0;
+@@ -385,11 +389,9 @@ static int inv_icm42600_buffer_postdisab
+       if (indio_dev == st->indio_gyro) {
+               sensor = INV_ICM42600_SENSOR_GYRO;
+               watermark = &st->fifo.watermark.gyro;
+-              ts = iio_priv(st->indio_gyro);
+       } else if (indio_dev == st->indio_accel) {
+               sensor = INV_ICM42600_SENSOR_ACCEL;
+               watermark = &st->fifo.watermark.accel;
+-              ts = iio_priv(st->indio_accel);
+       } else {
+               return -EINVAL;
+       }
+@@ -417,8 +419,6 @@ static int inv_icm42600_buffer_postdisab
+       if (!st->fifo.on)
+               ret = inv_icm42600_set_temp_conf(st, false, &sleep_temp);
+-      inv_icm42600_timestamp_reset(ts);
+-
+ out_unlock:
+       mutex_unlock(&st->lock);
diff --git a/queue-6.3/iio-light-vcnl4035-fixed-chip-id-check.patch b/queue-6.3/iio-light-vcnl4035-fixed-chip-id-check.patch
new file mode 100644 (file)
index 0000000..083b5f2
--- /dev/null
@@ -0,0 +1,57 @@
+From a551c26e8e568fad42120843521529241b9bceec Mon Sep 17 00:00:00 2001
+From: Frank Li <Frank.Li@nxp.com>
+Date: Mon, 1 May 2023 10:36:04 -0400
+Subject: iio: light: vcnl4035: fixed chip ID check
+
+From: Frank Li <Frank.Li@nxp.com>
+
+commit a551c26e8e568fad42120843521529241b9bceec upstream.
+
+VCNL4035 register(0xE) ID_L and ID_M define as:
+
+ ID_L: 0x80
+ ID_H: 7:6 (0:0)
+       5:4 (0:0) slave address = 0x60 (7-bit)
+           (0:1) slave address = 0x51 (7-bit)
+           (1:0) slave address = 0x40 (7-bit)
+           (1:0) slave address = 0x41 (7-bit)
+       3:0 Version code default        (0:0:0:0)
+
+So just check ID_L.
+
+Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
+Signed-off-by: Frank Li <Frank.Li@nxp.com>
+Link: https://lore.kernel.org/r/20230501143605.1615549-1-Frank.Li@nxp.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/light/vcnl4035.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/iio/light/vcnl4035.c
++++ b/drivers/iio/light/vcnl4035.c
+@@ -8,6 +8,7 @@
+  * TODO: Proximity
+  */
+ #include <linux/bitops.h>
++#include <linux/bitfield.h>
+ #include <linux/i2c.h>
+ #include <linux/module.h>
+ #include <linux/pm_runtime.h>
+@@ -42,6 +43,7 @@
+ #define VCNL4035_ALS_PERS_MASK                GENMASK(3, 2)
+ #define VCNL4035_INT_ALS_IF_H_MASK    BIT(12)
+ #define VCNL4035_INT_ALS_IF_L_MASK    BIT(13)
++#define VCNL4035_DEV_ID_MASK          GENMASK(7, 0)
+ /* Default values */
+ #define VCNL4035_MODE_ALS_ENABLE      BIT(0)
+@@ -413,6 +415,7 @@ static int vcnl4035_init(struct vcnl4035
+               return ret;
+       }
++      id = FIELD_GET(VCNL4035_DEV_ID_MASK, id);
+       if (id != VCNL4035_DEV_ID_VAL) {
+               dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n",
+                       id, VCNL4035_DEV_ID_VAL);
diff --git a/queue-6.3/iio-tmag5273-fix-runtime-pm-leak-on-measurement-error.patch b/queue-6.3/iio-tmag5273-fix-runtime-pm-leak-on-measurement-error.patch
new file mode 100644 (file)
index 0000000..1462a74
--- /dev/null
@@ -0,0 +1,45 @@
+From 265c82ea8b172129cb6d4eff41af856c3aff6168 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Thu, 13 Apr 2023 18:37:52 -0700
+Subject: iio: tmag5273: Fix runtime PM leak on measurement error
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+commit 265c82ea8b172129cb6d4eff41af856c3aff6168 upstream.
+
+The tmag5273 gets a runtime PM reference before reading a measurement and
+releases it when done. But if the measurement fails the tmag5273_read_raw()
+function exits before releasing the reference.
+
+Make sure that this error path also releases the runtime PM reference.
+
+Fixes: 866a1389174b ("iio: magnetometer: add ti tmag5273 driver")
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Acked-by: Gerald Loacker <gerald.loacker@wolfvision.net>
+Reviewed-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20230414013752.498767-1-lars@metafoo.de
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/magnetometer/tmag5273.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/magnetometer/tmag5273.c
++++ b/drivers/iio/magnetometer/tmag5273.c
+@@ -296,12 +296,13 @@ static int tmag5273_read_raw(struct iio_
+                       return ret;
+               ret = tmag5273_get_measure(data, &t, &x, &y, &z, &angle, &magnitude);
+-              if (ret)
+-                      return ret;
+               pm_runtime_mark_last_busy(data->dev);
+               pm_runtime_put_autosuspend(data->dev);
++              if (ret)
++                      return ret;
++
+               switch (chan->address) {
+               case TEMPERATURE:
+                       *val = t;
index 116d41ace57ae876bd899ed7be7641b44a35a684..22271e0aa10239684563d4fb0d076d41025df7ed 100644 (file)
@@ -187,3 +187,21 @@ dt-bindings-serial-8250_omap-add-rs485-rts-active-hi.patch
 media-uvcvideo-don-t-expose-unsupported-formats-to-u.patch
 selftests-ftrace-choose-target-function-for-filter-t.patch
 drm-amd-display-only-wait-for-blank-completion-if-ot.patch
+iio-accel-st_accel-fix-invalid-mount_matrix-on-devices-without-acpi-_ont-method.patch
+iio-adc-mxs-lradc-fix-the-order-of-two-cleanup-operations.patch
+iio-tmag5273-fix-runtime-pm-leak-on-measurement-error.patch
+iio-ad4130-make-sure-clock-provider-gets-removed.patch
+iio-adc-mt6370-fix-ibus-and-ibat-scaling-value-of-some-specific-vendor-id-chips.patch
+hid-google-add-jewel-usb-id.patch
+hid-wacom-avoid-integer-overflow-in-wacom_intuos_inout.patch
+iio-imu-inv_icm42600-fix-timestamp-reset.patch
+dt-bindings-iio-adc-renesas-rcar-gyroadc-fix-adi-ad7476-compatible-value.patch
+iio-light-vcnl4035-fixed-chip-id-check.patch
+iio-accel-kx022a-fix-irq-getting.patch
+iio-adc-stm32-adc-skip-adc-channels-setup-if-none-is-present.patch
+iio-adc-ad_sigma_delta-fix-irq-issue-by-setting-irq_disable_unlazy-flag.patch
+iio-dac-mcp4725-fix-i2c_master_send-return-value-handling.patch
+iio-addac-ad74413-fix-resistance-input-processing.patch
+iio-adc-ad7192-change-shorted-channels-to-differential.patch
+iio-adc-stm32-adc-skip-adc-diff-channels-setup-if-none-is-present.patch
+iio-dac-build-ad5758-driver-when-ad5758-is-selected.patch