From: Sasha Levin Date: Sun, 6 Nov 2022 16:58:53 +0000 (-0500) Subject: Fixes for 6.0 X-Git-Tag: v4.9.333~83 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=098f4d20325b2104c7f9b6100d15fc074e639dd3;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.0 Signed-off-by: Sasha Levin --- diff --git a/queue-6.0/iio-adc-stm32-adc-fix-channel-sampling-time-init.patch b/queue-6.0/iio-adc-stm32-adc-fix-channel-sampling-time-init.patch new file mode 100644 index 00000000000..7ccc7e769fe --- /dev/null +++ b/queue-6.0/iio-adc-stm32-adc-fix-channel-sampling-time-init.patch @@ -0,0 +1,62 @@ +From 34b45703c294b6a5e7326d4e2e5f1c6f928bb1b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Oct 2022 16:21:58 +0200 +Subject: iio: adc: stm32-adc: fix channel sampling time init + +From: Olivier Moysan + +[ Upstream commit 174dac5dc800e4e2e4552baf6340846a344d01a3 ] + +Fix channel init for ADC generic channel bindings. +In generic channel initialization, stm32_adc_smpr_init() is called to +initialize channel sampling time. The "st,min-sample-time-ns" property +is an optional property. If it is not defined, stm32_adc_smpr_init() is +currently skipped. +However stm32_adc_smpr_init() must always be called, to force a minimum +sampling time for the internal channels, as the minimum sampling time is +known. Make stm32_adc_smpr_init() call unconditional. + +Fixes: 796e5d0b1e9b ("iio: adc: stm32-adc: use generic binding for sample-time") +Signed-off-by: Olivier Moysan +Reviewed-by: Andy Shevchenko +Reviewed-by: Fabrice Gasnier +Link: https://lore.kernel.org/r/20221012142205.13041-2-olivier.moysan@foss.st.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/adc/stm32-adc.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c +index 130e8dd6f0c8..7719f7f93c3f 100644 +--- a/drivers/iio/adc/stm32-adc.c ++++ b/drivers/iio/adc/stm32-adc.c +@@ -2064,18 +2064,19 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, + stm32_adc_chan_init_one(indio_dev, &channels[scan_index], val, + vin[1], scan_index, differential); + ++ val = 0; + ret = of_property_read_u32(child, "st,min-sample-time-ns", &val); + /* st,min-sample-time-ns is optional */ +- if (!ret) { +- stm32_adc_smpr_init(adc, channels[scan_index].channel, val); +- if (differential) +- stm32_adc_smpr_init(adc, vin[1], val); +- } else if (ret != -EINVAL) { ++ if (ret && ret != -EINVAL) { + dev_err(&indio_dev->dev, "Invalid st,min-sample-time-ns property %d\n", + ret); + goto err; + } + ++ stm32_adc_smpr_init(adc, channels[scan_index].channel, val); ++ if (differential) ++ stm32_adc_smpr_init(adc, vin[1], val); ++ + scan_index++; + } + +-- +2.35.1 + diff --git a/queue-6.0/series b/queue-6.0/series index ee58cc76993..4f537a6fa8a 100644 --- a/queue-6.0/series +++ b/queue-6.0/series @@ -62,3 +62,4 @@ net-neigh-fix-null-ptr-deref-in-neigh_table_clear.patch bridge-fix-flushing-of-dynamic-fdb-entries.patch ipv6-fix-warning-in-ip6_route_net_exit_late.patch vsock-fix-possible-infinite-sleep-in-vsock_connectib.patch +iio-adc-stm32-adc-fix-channel-sampling-time-init.patch