hwmon: qpnp-adc: Remove function qpnp_vadc_check_result()

The function qpnp_vadc_check_result() checks the code against
ideal min/max for 0V and 1.8V and truncates the result within
these values. However if there is a positive offset the ADC
value can be greater than 0xA800 when applying a voltage of
1.8V. Similarly if the offset is negative the value can be
less than 0x6000 when applying 0V. Having this check can
result in incorrect ratiometric calibration if the value
read for 0V and 1.8V is outside the ideal ADC code and
the value is truncated by this function call.

Change-Id: If0c89ac4bffdea5438e256233860b2aca80e826b
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
This commit is contained in:
Siddartha Mohanadoss 2015-04-24 14:22:15 -07:00
parent 2ea5c8105a
commit bd037065f4
3 changed files with 0 additions and 32 deletions

View File

@ -30,10 +30,6 @@
#include <linux/qpnp/qpnp-adc.h>
#include <linux/platform_device.h>
/* Min ADC code represets 0V */
#define QPNP_VADC_MIN_ADC_CODE 0x6000
/* Max ADC code represents full-scale range of 1.8V */
#define QPNP_VADC_MAX_ADC_CODE 0xA800
#define KELVINMIL_DEGMIL 273160
#define QPNP_VADC_LDO_VOLTAGE_MIN 1800000
#define QPNP_VADC_LDO_VOLTAGE_MAX 1800000
@ -1845,20 +1841,6 @@ 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, 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)
*data = QPNP_VADC_MAX_ADC_CODE;
return 0;
}
EXPORT_SYMBOL(qpnp_vadc_check_result);
int32_t qpnp_adc_enable_voltage(struct qpnp_adc_drv *adc)
{
int rc = 0;

View File

@ -483,13 +483,6 @@ 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,
(vadc->vadc_recalib_check ? true : false));
if (status < 0) {
pr_err("VADC data check failed\n");
goto fail;
}
fail:
rc = qpnp_vadc_enable(vadc, false);
if (rc)

View File

@ -1136,13 +1136,6 @@ int32_t qpnp_vadc_conv_seq_request(struct qpnp_vadc_chip *dev,
enum qpnp_vadc_channels channel,
struct qpnp_vadc_result *result);
/**
* 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, bool recalib_check);
/**
* qpnp_adc_get_devicetree_data() - Abstracts the ADC devicetree data.
* @spmi: spmi ADC device.