patch "iio: adc: stm32-adc: fix channel sampling time init" added to char-misc-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: adc: stm32-adc: fix channel sampling time init
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 174dac5dc800e4e2e4552baf6340846a344d01a3 Mon Sep 17 00:00:00 2001
From: Olivier Moysan <[email protected]>
Date: Wed, 12 Oct 2022 16:21:58 +0200
Subject: iio: adc: stm32-adc: fix channel sampling time init
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.
--- drivers/iio/adc/stm32-adc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/iio/adc/stm32-adc.c +6 -5
@@ -2086,18 +2086,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 =fwnode_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++; }
Signature · 1 line
2.38.1