Skip to content

Commit 4f88a6c

Browse files
committed
iio: adc: at91-sama5d2_adc: align otp members with latest documentation
Align OTP memers naming used for temperature calibration with latest available documentation. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 04c1188 commit 4f88a6c

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -469,29 +469,29 @@ struct at91_adc_platform {
469469
/**
470470
* struct at91_adc_temp_sensor_clb - at91-sama5d2 temperature sensor
471471
* calibration data structure
472-
* @t3: OTP_T3 calibration temperature
473-
* @vtemp: OTP_VTEMP calibration voltage
474-
* @vbg2: OTP_VBG2 calibration voltage
472+
* @p1: P1 calibration temperature
473+
* @p4: P4 calibration voltage
474+
* @p6: P6 calibration voltage
475475
* @offset: calibration offset
476476
*/
477477
struct at91_adc_temp_sensor_clb {
478-
u32 t3;
479-
u32 vtemp;
480-
u32 vbg2;
478+
u32 p1;
479+
u32 p4;
480+
u32 p6;
481481
u32 offset;
482482
};
483483

484484
/**
485485
* enum at91_adc_ts_clb_idx - calibration indexes in NVMEM buffer
486-
* @AT91_ADC_TS_CLB_IDX_OTP_T3: index for OTP_T3
487-
* @AT91_ADC_TS_CLB_IDX_OTP_VTEMP: index for OTP_VTEMP
488-
* @AT91_ADC_TS_CLB_IDX_OTP_VBG2: index for OTP_VBG2
486+
* @AT91_ADC_TS_CLB_IDX_P1: index for P1
487+
* @AT91_ADC_TS_CLB_IDX_P4: index for P4
488+
* @AT91_ADC_TS_CLB_IDX_P6: index for P6
489489
* @AT91_ADC_TS_CLB_IDX_MAX: max index for temperature calibration packet in OTP
490490
*/
491491
enum at91_adc_ts_clb_idx {
492-
AT91_ADC_TS_CLB_IDX_OTP_T3 = 2,
493-
AT91_ADC_TS_CLB_IDX_OTP_VTEMP = 5,
494-
AT91_ADC_TS_CLB_IDX_OTP_VBG2 = 7,
492+
AT91_ADC_TS_CLB_IDX_P1 = 2,
493+
AT91_ADC_TS_CLB_IDX_P4 = 5,
494+
AT91_ADC_TS_CLB_IDX_P6 = 7,
495495
AT91_ADC_TS_CLB_IDX_MAX = OTP_PKT_SAMA7G5_TEMP_CALIB_LEN / 4,
496496
};
497497

@@ -1841,16 +1841,16 @@ static int at91_adc_read_temp(struct iio_dev *indio_dev,
18411841
return ret;
18421842

18431843
/*
1844-
* Temp[mili] = t3[mili] + (vref * (vtemp * clb->vbg2 - clb->vtemp * vbg))/
1845-
* ((clb->offset * clb->vbg2)
1844+
* Temp[mili] = p1[mili] + (vref * (vtemp * clb->p6 - clb->p4 * vbg))/
1845+
* ((clb->offset * clb->p6)
18461846
*/
1847-
div1 = DIV_ROUND_CLOSEST_ULL(((u64)st->vref_uv * vtemp * clb->vbg2),
1848-
clb->vbg2);
1847+
div1 = DIV_ROUND_CLOSEST_ULL(((u64)st->vref_uv * vtemp * clb->p6),
1848+
clb->p6);
18491849
div1 = DIV_ROUND_CLOSEST_ULL((div1 * 1000), clb->offset);
1850-
div2 = DIV_ROUND_CLOSEST_ULL(((u64)st->vref_uv * clb->vtemp * vbg),
1851-
clb->vbg2);
1850+
div2 = DIV_ROUND_CLOSEST_ULL(((u64)st->vref_uv * clb->p4 * vbg),
1851+
clb->p6);
18521852
div2 = DIV_ROUND_CLOSEST_ULL((div2 * 1000), clb->offset);
1853-
*val = clb->t3 * 1000 + (int)div1 - (int)div2;
1853+
*val = clb->p1 * 1000 + (int)div1 - (int)div2;
18541854

18551855
return ret;
18561856
}
@@ -2225,9 +2225,9 @@ static void at91_adc_temp_sensor_init(struct at91_adc_state *st,
22252225
}
22262226

22272227
/* Store calibration data for later use. */
2228-
clb->t3 = buf[AT91_ADC_TS_CLB_IDX_OTP_T3];
2229-
clb->vtemp = buf[AT91_ADC_TS_CLB_IDX_OTP_VTEMP];
2230-
clb->vbg2 = buf[AT91_ADC_TS_CLB_IDX_OTP_VBG2];
2228+
clb->p1 = buf[AT91_ADC_TS_CLB_IDX_P1];
2229+
clb->p4 = buf[AT91_ADC_TS_CLB_IDX_P4];
2230+
clb->p6 = buf[AT91_ADC_TS_CLB_IDX_P6];
22312231
clb->offset = AT91_ADC_TS_CLB_TSG * AT91_ADC_TS_CLB_FS;
22322232

22332233
st->temp_st.init = true;

0 commit comments

Comments
 (0)