iio: adc: at91-sama5d2_adc: get rid of 5 degrees Celsius adjustment

Message ID 20221020102705.3639204-1-claudiu.beznea@microchip.com
State New
Headers
Series iio: adc: at91-sama5d2_adc: get rid of 5 degrees Celsius adjustment |

Commit Message

Claudiu Beznea Oct. 20, 2022, 10:27 a.m. UTC
  On SAMA7G5 final chip version there is no need for 5 degrees Celsius
adjustment when computing junction temperature, thus, remove it.

Fixes: 5ab38b81895c ("iio: adc: at91-sama5d2_adc: add support for temperature sensor")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Jonathan Cameron Oct. 23, 2022, 12:21 p.m. UTC | #1
On Thu, 20 Oct 2022 13:27:05 +0300
Claudiu Beznea <claudiu.beznea@microchip.com> wrote:

> On SAMA7G5 final chip version there is no need for 5 degrees Celsius
> adjustment when computing junction temperature, thus, remove it.
> 
> Fixes: 5ab38b81895c ("iio: adc: at91-sama5d2_adc: add support for temperature sensor")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index 33e251552214..870f4cb60923 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -2307,11 +2307,9 @@ static int at91_adc_temp_sensor_init(struct at91_adc_state *st,
>  	clb->p6 = buf[AT91_ADC_TS_CLB_IDX_P6];
>  
>  	/*
> -	 * We prepare here the conversion to milli and also add constant
> -	 * factor (5 degrees Celsius) to p1 here to avoid doing it on
> -	 * hotpath.
> +	 * We prepare here the conversion to milli to avoid doing it on hotpath.
>  	 */
> -	clb->p1 = clb->p1 * 1000 + 5000;
> +	clb->p1 = clb->p1 * 1000;
>  
>  free_buf:
>  	kfree(buf);
  

Patch

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index 33e251552214..870f4cb60923 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2307,11 +2307,9 @@  static int at91_adc_temp_sensor_init(struct at91_adc_state *st,
 	clb->p6 = buf[AT91_ADC_TS_CLB_IDX_P6];
 
 	/*
-	 * We prepare here the conversion to milli and also add constant
-	 * factor (5 degrees Celsius) to p1 here to avoid doing it on
-	 * hotpath.
+	 * We prepare here the conversion to milli to avoid doing it on hotpath.
 	 */
-	clb->p1 = clb->p1 * 1000 + 5000;
+	clb->p1 = clb->p1 * 1000;
 
 free_buf:
 	kfree(buf);