hwmon: qpnp-adc-voltage: Avoid adc code check with recalibration
In VADC driver with recalibration parameter enabled and MPP2 or MPP4 current sink configuration some ratiometric channels report the adc code higher than maximum permitted value. VADC driver checks the adc code against the permitted maximum value and overwrites adc code to permitted maximum value if it is higher and this results into incorrect adc readings. Fix this problem by avoiding the adc code check when recalibration parameter enabled. Change-Id: Ic1bcc8b4e52cddc013cf1654c229c22fd348159e Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
This commit is contained in:
parent
e9f04b9aa1
commit
01d25e1586
|
@ -1529,8 +1529,11 @@ int32_t qpnp_adc_smb_btm_rscaler(struct qpnp_vadc_chip *chip,
|
|||
}
|
||||
EXPORT_SYMBOL(qpnp_adc_smb_btm_rscaler);
|
||||
|
||||
int32_t qpnp_vadc_check_result(int32_t *data)
|
||||
int32_t qpnp_vadc_check_result(int32_t *data, bool recalib_check)
|
||||
{
|
||||
if (recalib_check)
|
||||
return 0;
|
||||
|
||||
if (*data < QPNP_VADC_MIN_ADC_CODE)
|
||||
*data = QPNP_VADC_MIN_ADC_CODE;
|
||||
else if (*data > QPNP_VADC_MAX_ADC_CODE)
|
||||
|
|
|
@ -459,7 +459,8 @@ static int32_t qpnp_vadc_read_conversion_result(struct qpnp_vadc_chip *vadc,
|
|||
|
||||
*data = (rslt_msb << 8) | rslt_lsb;
|
||||
|
||||
status = qpnp_vadc_check_result(data);
|
||||
status = qpnp_vadc_check_result(data,
|
||||
(vadc->vadc_recalib_check ? true : false));
|
||||
if (status < 0) {
|
||||
pr_err("VADC data check failed\n");
|
||||
goto fail;
|
||||
|
|
|
@ -1123,8 +1123,9 @@ int32_t qpnp_vadc_conv_seq_request(struct qpnp_vadc_chip *dev,
|
|||
/**
|
||||
* qpnp_vadc_check_result() - Performs check on the ADC raw code.
|
||||
* @data: Data used for verifying the range of the ADC code.
|
||||
* @recalib_check: Recalibration check to ignore result check.
|
||||
*/
|
||||
int32_t qpnp_vadc_check_result(int32_t *data);
|
||||
int32_t qpnp_vadc_check_result(int32_t *data, bool recalib_check);
|
||||
|
||||
/**
|
||||
* qpnp_adc_get_devicetree_data() - Abstracts the ADC devicetree data.
|
||||
|
|
Loading…
Reference in New Issue