mbox series

[0/3] iio: adc: stm32: add smart calibration

Message ID 20221115103124.70074-1-olivier.moysan@foss.st.com (mailing list archive)
Headers show
Series iio: adc: stm32: add smart calibration | expand

Message

Olivier Moysan Nov. 15, 2022, 10:31 a.m. UTC
Refine offset and linear calibration strategy for STM32MP15 and
STM32MP13 SoCs:

- offset calibration
This calibration depends on factors such as temperature and voltage.
As it is not time consuming, it's worth doing it on each ADC
start, to get the best accuracy. There is no need to save these data.

- linear calibration
This calibration is basically SoC dependent, so it can be done only once.
When this calibration has been performed at boot stage, the ADC kernel
driver can retrieve the calibration data from the ADC registers.
Otherwise, the linear calibration is performed once by the ADC driver.
The backup of these data, allows to restore them on successive ADC starts.

Olivier Moysan (3):
  iio: adc: stm32-adc: smart calibration support
  iio: adc: stm32-adc: improve calibration error log
  iio: adc: stm32-adc: add debugfs to read raw calibration result

 drivers/iio/adc/stm32-adc-core.h |   1 +
 drivers/iio/adc/stm32-adc.c      | 135 ++++++++++++++++++-------------
 2 files changed, 78 insertions(+), 58 deletions(-)

Comments

Fabrice Gasnier Nov. 23, 2022, 11:04 a.m. UTC | #1
On 11/15/22 11:31, Olivier Moysan wrote:
> Refine offset and linear calibration strategy for STM32MP15 and
> STM32MP13 SoCs:
> 
> - offset calibration
> This calibration depends on factors such as temperature and voltage.
> As it is not time consuming, it's worth doing it on each ADC
> start, to get the best accuracy. There is no need to save these data.
> 
> - linear calibration
> This calibration is basically SoC dependent, so it can be done only once.
> When this calibration has been performed at boot stage, the ADC kernel
> driver can retrieve the calibration data from the ADC registers.
> Otherwise, the linear calibration is performed once by the ADC driver.
> The backup of these data, allows to restore them on successive ADC starts.
> 
> Olivier Moysan (3):
>   iio: adc: stm32-adc: smart calibration support
>   iio: adc: stm32-adc: improve calibration error log
>   iio: adc: stm32-adc: add debugfs to read raw calibration result

Hi Olivier,

For the series, you can add my:
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Thanks,
Fabrice

> 
>  drivers/iio/adc/stm32-adc-core.h |   1 +
>  drivers/iio/adc/stm32-adc.c      | 135 ++++++++++++++++++-------------
>  2 files changed, 78 insertions(+), 58 deletions(-)
>
Jonathan Cameron Nov. 23, 2022, 8:56 p.m. UTC | #2
On Wed, 23 Nov 2022 12:04:36 +0100
Fabrice Gasnier <fabrice.gasnier@foss.st.com> wrote:

> On 11/15/22 11:31, Olivier Moysan wrote:
> > Refine offset and linear calibration strategy for STM32MP15 and
> > STM32MP13 SoCs:
> > 
> > - offset calibration
> > This calibration depends on factors such as temperature and voltage.
> > As it is not time consuming, it's worth doing it on each ADC
> > start, to get the best accuracy. There is no need to save these data.
> > 
> > - linear calibration
> > This calibration is basically SoC dependent, so it can be done only once.
> > When this calibration has been performed at boot stage, the ADC kernel
> > driver can retrieve the calibration data from the ADC registers.
> > Otherwise, the linear calibration is performed once by the ADC driver.
> > The backup of these data, allows to restore them on successive ADC starts.
> > 
> > Olivier Moysan (3):
> >   iio: adc: stm32-adc: smart calibration support
> >   iio: adc: stm32-adc: improve calibration error log
> >   iio: adc: stm32-adc: add debugfs to read raw calibration result  
> 
> Hi Olivier,
> 
> For the series, you can add my:
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Applied to the togreg branch of iio.git and pushed out as testing to let
0-day have a first look at it.

Thanks,

Jonathan

> 
> Thanks,
> Fabrice
> 
> > 
> >  drivers/iio/adc/stm32-adc-core.h |   1 +
> >  drivers/iio/adc/stm32-adc.c      | 135 ++++++++++++++++++-------------
> >  2 files changed, 78 insertions(+), 58 deletions(-)
> >