From: Greg Kroah-Hartman Date: Thu, 28 Dec 2023 10:57:29 +0000 (+0000) Subject: 5.10-stable patches X-Git-Tag: v6.1.70~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e067b2c0ce32978486fa8766455bb881961a7d7e;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: iio-adc-ti_am335x_adc-fix-return-value-check-of-tiadc_request_dma.patch iio-common-ms_sensors-ms_sensors_i2c-fix-humidity-conversion-time-table.patch iio-imu-adis16475-add-spi_device_id-table.patch --- diff --git a/queue-5.10/iio-adc-ti_am335x_adc-fix-return-value-check-of-tiadc_request_dma.patch b/queue-5.10/iio-adc-ti_am335x_adc-fix-return-value-check-of-tiadc_request_dma.patch new file mode 100644 index 00000000000..4bd342ef7bb --- /dev/null +++ b/queue-5.10/iio-adc-ti_am335x_adc-fix-return-value-check-of-tiadc_request_dma.patch @@ -0,0 +1,40 @@ +From 60576e84c187043cef11f11d015249e71151d35a Mon Sep 17 00:00:00 2001 +From: Wadim Egorov +Date: Mon, 25 Sep 2023 15:44:27 +0200 +Subject: iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() + +From: Wadim Egorov + +commit 60576e84c187043cef11f11d015249e71151d35a upstream. + +Fix wrong handling of a DMA request where the probing only failed +if -EPROPE_DEFER was returned. Instead, let us fail if a non -ENODEV +value is returned. This makes DMAs explicitly optional. Even if the +DMA request is unsuccessfully, the ADC can still work properly. +We do also handle the defer probe case by making use of dev_err_probe(). + +Fixes: f438b9da75eb ("drivers: iio: ti_am335x_adc: add dma support") +Signed-off-by: Wadim Egorov +Reviewed-by: Bhavya Kapoor +Link: https://lore.kernel.org/r/20230925134427.214556-1-w.egorov@phytec.de +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/ti_am335x_adc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/iio/adc/ti_am335x_adc.c ++++ b/drivers/iio/adc/ti_am335x_adc.c +@@ -640,8 +640,10 @@ static int tiadc_probe(struct platform_d + platform_set_drvdata(pdev, indio_dev); + + err = tiadc_request_dma(pdev, adc_dev); +- if (err && err == -EPROBE_DEFER) ++ if (err && err != -ENODEV) { ++ dev_err_probe(&pdev->dev, err, "DMA request failed\n"); + goto err_dma; ++ } + + return 0; + diff --git a/queue-5.10/iio-common-ms_sensors-ms_sensors_i2c-fix-humidity-conversion-time-table.patch b/queue-5.10/iio-common-ms_sensors-ms_sensors_i2c-fix-humidity-conversion-time-table.patch new file mode 100644 index 00000000000..0e48d2dce1f --- /dev/null +++ b/queue-5.10/iio-common-ms_sensors-ms_sensors_i2c-fix-humidity-conversion-time-table.patch @@ -0,0 +1,106 @@ +From 54cf39ec16335dadbe1ba008d8e5e98dae3e26f8 Mon Sep 17 00:00:00 2001 +From: Javier Carrasco +Date: Thu, 26 Oct 2023 17:44:49 +0200 +Subject: iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table + +From: Javier Carrasco + +commit 54cf39ec16335dadbe1ba008d8e5e98dae3e26f8 upstream. + +The HTU21 offers 4 sampling frequencies: 20, 40, 70 and 120, which are +associated to an index that is used to select the right measurement +resolution and its corresponding measurement time. The current +implementation selects the measurement resolution and the temperature +measurement time properly, but it does not select the right humidity +measurement time in all cases. + +In summary, the 40 and 70 humidity measurement times are swapped. + +The reason for that is probably the unusual coding for the measurement +resolution. According to the datasheet, the bits [7,0] of the "user +register" are used as follows to select the bit resolution: + +-------------------------------------------------- +| Bit 7 | Bit 0 | RH | Temp | Trh (us) | Tt (us) | +-------------------------------------------------- +| 0 | 0 | 12 | 14 | 16000 | 50000 | +-------------------------------------------------- +| 0 | 1 | 8 | 12 | 3000 | 13000 | +-------------------------------------------------- +| 1 | 0 | 10 | 13 | 5000 | 25000 | +-------------------------------------------------- +| 1 | 1 | 11 | 11 | 8000 | 7000 | +-------------------------------------------------- +*This table is available in the official datasheet, page 13/21. I have +just appended the times provided in the humidity/temperature tables, +pages 3/21, 5/21. Note that always a pair of resolutions is selected. + +The sampling frequencies [20, 40, 70, 120] are assigned to a linear +index [0..3] which is then coded as follows [1]: + +Index [7,0] +-------------- +idx 0 0,0 +idx 1 1,0 +idx 2 0,1 +idx 3 1,1 + +That is done that way because the temperature measurements are being +used as the reference for the sampling frequency (the frequencies and +the temperature measurement times are correlated), so increasing the +index always reduces the temperature measurement time and its +resolution. Therefore, the temperature measurement time array is as +simple as [50000, 25000, 13000, 7000] + +On the other hand, the humidity resolution cannot follow the same +pattern because of the way it is coded in the "user register", where +both resolutions are selected at the same time. The humidity measurement +time array is the following: [16000, 3000, 5000, 8000], which defines +the following assignments: + +Index [7,0] Trh +----------------------- +idx 0 0,0 16000 -> right, [0,0] selects 12 bits (Trh = 16000) +idx 1 1,0 3000 -> wrong! [1,0] selects 10 bits (Trh = 5000) +idx 2 0,1 5000 -> wrong! [0,1] selects 8 bits (Trh = 3000) +idx 3 1,1 8000 -> right, [1,1] selects 11 bits (Trh = 8000) + +The times have been ordered as if idx = 1 -> [0,1] and idx = 2 -> [1,0], +which is not the case for the reason explained above. + +So a simple modification is required to obtain the right humidity +measurement time array, swapping the values in the positions 1 and 2. + +The right table should be the following: [16000, 5000, 3000, 8000] + +Fix the humidity measurement time array with the right idex/value +coding. + +[1] The actual code that makes this coding and assigns it to the current +value of the "user register" is the following: +config_reg &= 0x7E; +config_reg |= ((i & 1) << 7) + ((i & 2) >> 1); + +Fixes: d574a87cc311 ("Add meas-spec sensors common part") +Signed-off-by: Javier Carrasco +Link: https://lore.kernel.org/r/20231026-topic-htu21_conversion_time-v1-1-bd257dc44209@gmail.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c ++++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c +@@ -15,8 +15,8 @@ + /* Conversion times in us */ + static const u16 ms_sensors_ht_t_conversion_time[] = { 50000, 25000, + 13000, 7000 }; +-static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 3000, +- 5000, 8000 }; ++static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 5000, ++ 3000, 8000 }; + static const u16 ms_sensors_tp_conversion_time[] = { 500, 1100, 2100, + 4100, 8220, 16440 }; + diff --git a/queue-5.10/iio-imu-adis16475-add-spi_device_id-table.patch b/queue-5.10/iio-imu-adis16475-add-spi_device_id-table.patch new file mode 100644 index 00000000000..a9981bef380 --- /dev/null +++ b/queue-5.10/iio-imu-adis16475-add-spi_device_id-table.patch @@ -0,0 +1,171 @@ +From ee4d79055aeea27f1b8c42233cc0c90d0a8b5355 Mon Sep 17 00:00:00 2001 +From: Nuno Sa +Date: Thu, 2 Nov 2023 13:52:58 +0100 +Subject: iio: imu: adis16475: add spi_device_id table + +From: Nuno Sa + +commit ee4d79055aeea27f1b8c42233cc0c90d0a8b5355 upstream. + +This prevents the warning message "SPI driver has no spi_device_id for..." +when registering the driver. More importantly, it makes sure that +module autoloading works as spi relies on spi: modaliases and not of. + +While at it, move the of_device_id table to it's natural place. + +Fixes: fff7352bf7a3c ("iio: imu: Add support for adis16475") +Signed-off-by: Nuno Sa +Link: https://lore.kernel.org/r/20231102125258.3284830-1-nuno.sa@analog.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/adis16475.c | 117 +++++++++++++++++++++++++++----------------- + 1 file changed, 72 insertions(+), 45 deletions(-) + +--- a/drivers/iio/imu/adis16475.c ++++ b/drivers/iio/imu/adis16475.c +@@ -1214,50 +1214,6 @@ static int adis16475_config_irq_pin(stru + return 0; + } + +-static const struct of_device_id adis16475_of_match[] = { +- { .compatible = "adi,adis16470", +- .data = &adis16475_chip_info[ADIS16470] }, +- { .compatible = "adi,adis16475-1", +- .data = &adis16475_chip_info[ADIS16475_1] }, +- { .compatible = "adi,adis16475-2", +- .data = &adis16475_chip_info[ADIS16475_2] }, +- { .compatible = "adi,adis16475-3", +- .data = &adis16475_chip_info[ADIS16475_3] }, +- { .compatible = "adi,adis16477-1", +- .data = &adis16475_chip_info[ADIS16477_1] }, +- { .compatible = "adi,adis16477-2", +- .data = &adis16475_chip_info[ADIS16477_2] }, +- { .compatible = "adi,adis16477-3", +- .data = &adis16475_chip_info[ADIS16477_3] }, +- { .compatible = "adi,adis16465-1", +- .data = &adis16475_chip_info[ADIS16465_1] }, +- { .compatible = "adi,adis16465-2", +- .data = &adis16475_chip_info[ADIS16465_2] }, +- { .compatible = "adi,adis16465-3", +- .data = &adis16475_chip_info[ADIS16465_3] }, +- { .compatible = "adi,adis16467-1", +- .data = &adis16475_chip_info[ADIS16467_1] }, +- { .compatible = "adi,adis16467-2", +- .data = &adis16475_chip_info[ADIS16467_2] }, +- { .compatible = "adi,adis16467-3", +- .data = &adis16475_chip_info[ADIS16467_3] }, +- { .compatible = "adi,adis16500", +- .data = &adis16475_chip_info[ADIS16500] }, +- { .compatible = "adi,adis16505-1", +- .data = &adis16475_chip_info[ADIS16505_1] }, +- { .compatible = "adi,adis16505-2", +- .data = &adis16475_chip_info[ADIS16505_2] }, +- { .compatible = "adi,adis16505-3", +- .data = &adis16475_chip_info[ADIS16505_3] }, +- { .compatible = "adi,adis16507-1", +- .data = &adis16475_chip_info[ADIS16507_1] }, +- { .compatible = "adi,adis16507-2", +- .data = &adis16475_chip_info[ADIS16507_2] }, +- { .compatible = "adi,adis16507-3", +- .data = &adis16475_chip_info[ADIS16507_3] }, +- { }, +-}; +-MODULE_DEVICE_TABLE(of, adis16475_of_match); + + static int adis16475_probe(struct spi_device *spi) + { +@@ -1272,7 +1228,7 @@ static int adis16475_probe(struct spi_de + st = iio_priv(indio_dev); + spi_set_drvdata(spi, indio_dev); + +- st->info = device_get_match_data(&spi->dev); ++ st->info = spi_get_device_match_data(spi); + if (!st->info) + return -EINVAL; + +@@ -1312,12 +1268,83 @@ static int adis16475_probe(struct spi_de + return 0; + } + ++static const struct of_device_id adis16475_of_match[] = { ++ { .compatible = "adi,adis16470", ++ .data = &adis16475_chip_info[ADIS16470] }, ++ { .compatible = "adi,adis16475-1", ++ .data = &adis16475_chip_info[ADIS16475_1] }, ++ { .compatible = "adi,adis16475-2", ++ .data = &adis16475_chip_info[ADIS16475_2] }, ++ { .compatible = "adi,adis16475-3", ++ .data = &adis16475_chip_info[ADIS16475_3] }, ++ { .compatible = "adi,adis16477-1", ++ .data = &adis16475_chip_info[ADIS16477_1] }, ++ { .compatible = "adi,adis16477-2", ++ .data = &adis16475_chip_info[ADIS16477_2] }, ++ { .compatible = "adi,adis16477-3", ++ .data = &adis16475_chip_info[ADIS16477_3] }, ++ { .compatible = "adi,adis16465-1", ++ .data = &adis16475_chip_info[ADIS16465_1] }, ++ { .compatible = "adi,adis16465-2", ++ .data = &adis16475_chip_info[ADIS16465_2] }, ++ { .compatible = "adi,adis16465-3", ++ .data = &adis16475_chip_info[ADIS16465_3] }, ++ { .compatible = "adi,adis16467-1", ++ .data = &adis16475_chip_info[ADIS16467_1] }, ++ { .compatible = "adi,adis16467-2", ++ .data = &adis16475_chip_info[ADIS16467_2] }, ++ { .compatible = "adi,adis16467-3", ++ .data = &adis16475_chip_info[ADIS16467_3] }, ++ { .compatible = "adi,adis16500", ++ .data = &adis16475_chip_info[ADIS16500] }, ++ { .compatible = "adi,adis16505-1", ++ .data = &adis16475_chip_info[ADIS16505_1] }, ++ { .compatible = "adi,adis16505-2", ++ .data = &adis16475_chip_info[ADIS16505_2] }, ++ { .compatible = "adi,adis16505-3", ++ .data = &adis16475_chip_info[ADIS16505_3] }, ++ { .compatible = "adi,adis16507-1", ++ .data = &adis16475_chip_info[ADIS16507_1] }, ++ { .compatible = "adi,adis16507-2", ++ .data = &adis16475_chip_info[ADIS16507_2] }, ++ { .compatible = "adi,adis16507-3", ++ .data = &adis16475_chip_info[ADIS16507_3] }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, adis16475_of_match); ++ ++static const struct spi_device_id adis16475_ids[] = { ++ { "adis16470", (kernel_ulong_t)&adis16475_chip_info[ADIS16470] }, ++ { "adis16475-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_1] }, ++ { "adis16475-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_2] }, ++ { "adis16475-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_3] }, ++ { "adis16477-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_1] }, ++ { "adis16477-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_2] }, ++ { "adis16477-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_3] }, ++ { "adis16465-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_1] }, ++ { "adis16465-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_2] }, ++ { "adis16465-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_3] }, ++ { "adis16467-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_1] }, ++ { "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] }, ++ { "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] }, ++ { "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] }, ++ { "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] }, ++ { "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] }, ++ { "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] }, ++ { "adis16507-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_1] }, ++ { "adis16507-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_2] }, ++ { "adis16507-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_3] }, ++ { } ++}; ++MODULE_DEVICE_TABLE(spi, adis16475_ids); ++ + static struct spi_driver adis16475_driver = { + .driver = { + .name = "adis16475", + .of_match_table = adis16475_of_match, + }, + .probe = adis16475_probe, ++ .id_table = adis16475_ids, + }; + module_spi_driver(adis16475_driver); + diff --git a/queue-5.10/series b/queue-5.10/series index 9717e1a2ead..e395d5617e2 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -29,3 +29,6 @@ iio-imu-inv_mpu6050-fix-an-error-code-problem-in-inv.patch interconnect-qcom-sm8250-enable-sync_state.patch input-ipaq-micro-keys-add-error-handling-for-devm_km.patch scsi-bnx2fc-fix-skb-double-free-in-bnx2fc_rcv.patch +iio-common-ms_sensors-ms_sensors_i2c-fix-humidity-conversion-time-table.patch +iio-imu-adis16475-add-spi_device_id-table.patch +iio-adc-ti_am335x_adc-fix-return-value-check-of-tiadc_request_dma.patch