mfd: pm8921-adc: Fix scaling and PM8921 MPP ADC read
-Modify the existing PM8921 ADC read api to include
reading ADC mapped to devices on the MPP.
-Modify scaling function to support XOTHERM and PATHERM
on PM8921.
-Remove post scaling functions for external charger
as its not used on PM8921.
CRs-Fixed: 307164
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
diff --git a/drivers/mfd/msmproc_adc.c b/drivers/mfd/msmproc_adc.c
index b2e9491..5f2f975 100644
--- a/drivers/mfd/msmproc_adc.c
+++ b/drivers/mfd/msmproc_adc.c
@@ -16,8 +16,6 @@
#include <linux/module.h>
#include <linux/mfd/pm8921-adc.h>
#define KELVINMIL_DEGMIL 273160
-#define PM8921_ADC_SLOPE 10
-#define PM8921_ADC_CODE_SCALE 24576
static const struct pm8921_adc_map_pt adcmap_batttherm[] = {
{41001, -30},
@@ -113,6 +111,130 @@
{80, 28794}
};
+static const struct pm8921_adc_map_pt adcmap_pa_therm[] = {
+ {41350, -30},
+ {41282, -29},
+ {41211, -28},
+ {41137, -27},
+ {41060, -26},
+ {40980, -25},
+ {40897, -24},
+ {40811, -23},
+ {40721, -22},
+ {40629, -21},
+ {40533, -20},
+ {40434, -19},
+ {40331, -18},
+ {40226, -17},
+ {40116, -16},
+ {40004, -15},
+ {39888, -14},
+ {39769, -13},
+ {39647, -12},
+ {39521, -11},
+ {39392, -10},
+ {39260, -9},
+ {39124, -8},
+ {38986, -7},
+ {38845, -6},
+ {38700, -5},
+ {38553, -4},
+ {38403, -3},
+ {38250, -2},
+ {38094, -1},
+ {37936, 0},
+ {37776, 1},
+ {37613, 2},
+ {37448, 3},
+ {37281, 4},
+ {37112, 5},
+ {36942, 6},
+ {36770, 7},
+ {36596, 8},
+ {36421, 9},
+ {36245, 10},
+ {36068, 11},
+ {35890, 12},
+ {35712, 13},
+ {35532, 14},
+ {35353, 15},
+ {35173, 16},
+ {34993, 17},
+ {34813, 18},
+ {34634, 19},
+ {34455, 20},
+ {34276, 21},
+ {34098, 22},
+ {33921, 23},
+ {33745, 24},
+ {33569, 25},
+ {33395, 26},
+ {33223, 27},
+ {33051, 28},
+ {32881, 29},
+ {32713, 30},
+ {32547, 31},
+ {32382, 32},
+ {32219, 33},
+ {32058, 34},
+ {31899, 35},
+ {31743, 36},
+ {31588, 37},
+ {31436, 38},
+ {31285, 39},
+ {31138, 40},
+ {30992, 41},
+ {30849, 42},
+ {30708, 43},
+ {30570, 44},
+ {30434, 45},
+ {30300, 46},
+ {30169, 47},
+ {30041, 48},
+ {29915, 49},
+ {29791, 50},
+ {29670, 51},
+ {29551, 52},
+ {29435, 53},
+ {29321, 54},
+ {29210, 55},
+ {29101, 56},
+ {28994, 57},
+ {28890, 58},
+ {28788, 59},
+ {28688, 60},
+ {28590, 61},
+ {28495, 62},
+ {28402, 63},
+ {28311, 64},
+ {28222, 65},
+ {28136, 66},
+ {28051, 67},
+ {27968, 68},
+ {27888, 69},
+ {27809, 70},
+ {27732, 71},
+ {27658, 72},
+ {27584, 73},
+ {27513, 74},
+ {27444, 75},
+ {27376, 76},
+ {27310, 77},
+ {27245, 78},
+ {27183, 79},
+ {27121, 80},
+ {27062, 81},
+ {27004, 82},
+ {26947, 83},
+ {26892, 84},
+ {26838, 85},
+ {26785, 86},
+ {26734, 87},
+ {26684, 88},
+ {26636, 89},
+ {26588, 90}
+};
+
static const struct pm8921_adc_map_pt adcmap_ntcg_104ef_104fb[] = {
{696483, -40960},
{649148, -39936},
@@ -393,6 +515,20 @@
}
EXPORT_SYMBOL_GPL(pm8921_adc_scale_batt_therm);
+int32_t pm8921_adc_scale_pa_therm(int32_t adc_code,
+ const struct pm8921_adc_properties *adc_properties,
+ const struct pm8921_adc_chan_properties *chan_properties,
+ struct pm8921_adc_chan_result *adc_chan_result)
+{
+ /* convert mV ---> degC using the table */
+ return pm8921_adc_map_linear(
+ adcmap_pa_therm,
+ ARRAY_SIZE(adcmap_pa_therm),
+ adc_code,
+ &adc_chan_result->physical);
+}
+EXPORT_SYMBOL_GPL(pm8921_adc_scale_pa_therm);
+
int32_t pm8921_adc_scale_pmic_therm(int32_t adc_code,
const struct pm8921_adc_properties *adc_properties,
const struct pm8921_adc_chan_properties *chan_properties,
@@ -442,91 +578,19 @@
const struct pm8921_adc_chan_properties *chan_properties,
struct pm8921_adc_chan_result *adc_chan_result)
{
- uint32_t num1, num2, denom, rt_r25;
- int32_t offset = chan_properties->adc_graph->offset,
- dy = chan_properties->adc_graph->dy,
- dx = chan_properties->adc_graph->dx,
- fullscale_calibrated_adc_code;
+ int32_t rt_r25;
+ int32_t offset = chan_properties->adc_graph[ADC_CALIB_ABSOLUTE].offset;
- adc_chan_result->adc_code = adc_code;
- fullscale_calibrated_adc_code = dy + offset;
- /* The above is a short cut in math that would reduce a lot of
- computation whereas the below expression
- (adc_properties->adc_reference*dy+dx*offset+(dx>>1))/dx
- is a more generic formula when the 2 reference voltages are
- different than 0 and full scale voltage. */
+ rt_r25 = adc_code - offset;
- if ((dy == 0) || (dx == 0) ||
- (offset >= fullscale_calibrated_adc_code)) {
- return -EINVAL;
- } else {
- if (adc_code >= fullscale_calibrated_adc_code) {
- rt_r25 = (uint32_t)-1;
- } else if (adc_code <= offset) {
- rt_r25 = 0;
- } else {
- /* The formula used is (adc_code of current reading - offset)/
- * (the calibrated fullscale adc code - adc_code of current
- * reading). For this channel, at this time, chan_properties->
- * offset_gain_numerator = chan_properties->
- * offset_gain_denominator = 1, so no need to incorporate into
- * the formula even though it could be multiplied/divided by 1
- * which yields the same result but
- * expensive on computation. */
- num1 = (adc_code - offset) << 14;
- num2 = (fullscale_calibrated_adc_code - adc_code) >> 1;
- denom = fullscale_calibrated_adc_code - adc_code;
-
- if ((int)denom <= 0)
- rt_r25 = 0x7FFFFFFF;
- else
- rt_r25 = (num1 + num2) / denom;
- }
-
- if (rt_r25 > 0x7FFFFFFF)
- rt_r25 = 0x7FFFFFFF;
-
- pm8921_adc_map_linear(adcmap_ntcg_104ef_104fb,
- sizeof(adcmap_ntcg_104ef_104fb)/
- sizeof(adcmap_ntcg_104ef_104fb[0]),
- (int32_t)rt_r25, &adc_chan_result->physical);
- }
+ pm8921_adc_map_linear(adcmap_ntcg_104ef_104fb,
+ ARRAY_SIZE(adcmap_ntcg_104ef_104fb),
+ rt_r25, &adc_chan_result->physical);
return 0;
}
EXPORT_SYMBOL_GPL(pm8921_adc_tdkntcg_therm);
-int32_t pm8921_adc_scale_xtern_chgr_cur(int32_t adc_code,
- const struct pm8921_adc_properties *adc_properties,
- const struct pm8921_adc_chan_properties *chan_properties,
- struct pm8921_adc_chan_result *adc_chan_result)
-{
- int32_t rawfromoffset = (adc_code - PM8921_ADC_CODE_SCALE)
- /PM8921_ADC_SLOPE;
-
- if (!chan_properties || !chan_properties->offset_gain_numerator ||
- !chan_properties->offset_gain_denominator || !adc_properties
- || !adc_chan_result)
- return -EINVAL;
-
- adc_chan_result->adc_code = adc_code;
- if (rawfromoffset > 0) {
- if (rawfromoffset >= 1 << adc_properties->bitresolution)
- rawfromoffset = (1 << adc_properties->bitresolution)
- - 1;
- adc_chan_result->measurement = ((int64_t)rawfromoffset * 5)*
- chan_properties->offset_gain_denominator;
- do_div(adc_chan_result->measurement,
- chan_properties->offset_gain_numerator);
- } else {
- adc_chan_result->measurement = 0;
- }
- adc_chan_result->physical = (int32_t) adc_chan_result->measurement;
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(pm8921_adc_scale_xtern_chgr_cur);
-
int32_t pm8921_adc_batt_scaler(struct pm8921_adc_arb_btm_param *btm_param)
{
int rc;
diff --git a/drivers/mfd/pm8921-adc.c b/drivers/mfd/pm8921-adc.c
index e9b6e34..1c37f27 100644
--- a/drivers/mfd/pm8921-adc.c
+++ b/drivers/mfd/pm8921-adc.c
@@ -28,6 +28,7 @@
#include <linux/mfd/pm8xxx/mpp.h>
#include <linux/mfd/pm8921-adc.h>
#include <linux/debugfs.h>
+#include <linux/regulator/consumer.h>
/* User Bank register set */
#define PM8921_ADC_ARB_USRP_CNTRL1 0x197
@@ -112,6 +113,9 @@
#define PM8921_ADC_MUL 10
#define PM8921_ADC_CONV_TIME_MIN 2000
#define PM8921_ADC_CONV_TIME_MAX 2100
+#define PM8921_ADC_PA_THERM_VREG_UV_MIN 1800000
+#define PM8921_ADC_PA_THERM_VREG_UV_MAX 1800000
+#define PM8921_ADC_PA_THERM_VREG_UA_LOAD 100000
struct pm8921_adc {
struct device *dev;
@@ -151,8 +155,9 @@
static struct pm8921_adc_scale_fn adc_scale_fn[] = {
[ADC_SCALE_DEFAULT] = {pm8921_adc_scale_default},
[ADC_SCALE_BATT_THERM] = {pm8921_adc_scale_batt_therm},
+ [ADC_SCALE_PA_THERM] = {pm8921_adc_scale_pa_therm},
[ADC_SCALE_PMIC_THERM] = {pm8921_adc_scale_pmic_therm},
- [ADC_SCALE_XTERN_CHGR_CUR] = {pm8921_adc_scale_xtern_chgr_cur},
+ [ADC_SCALE_XOTHERM] = {pm8921_adc_tdkntcg_therm},
};
static bool pm8921_adc_calib_first_adc;
@@ -187,6 +192,69 @@
return 0;
}
+static int32_t pm8921_adc_patherm_power(bool on)
+{
+ static struct regulator *pa_therm;
+ struct pm8921_adc *adc_pmic = pmic_adc;
+ int rc = 0;
+ if (on) {
+ pa_therm = regulator_get(adc_pmic->dev,
+ "pa_therm");
+ if (IS_ERR(pa_therm)) {
+ rc = PTR_ERR(pa_therm);
+ pr_err("failed to request pa_therm vreg "
+ "with error %d\n", rc);
+ return rc;
+ }
+
+ rc = regulator_set_voltage(pa_therm,
+ PM8921_ADC_PA_THERM_VREG_UV_MIN,
+ PM8921_ADC_PA_THERM_VREG_UV_MAX);
+ if (rc < 0) {
+ pr_err("failed to set the voltage for "
+ "pa_therm with error %d\n", rc);
+ goto fail;
+ }
+
+ rc = regulator_set_optimum_mode(pa_therm,
+ PM8921_ADC_PA_THERM_VREG_UA_LOAD);
+ if (rc < 0) {
+ pr_err("failed to set optimum mode for "
+ "pa_therm with error %d\n", rc);
+ goto fail;
+ }
+
+ if (regulator_enable(pa_therm)) {
+ pr_err("failed to enable pa_therm vreg with "
+ "error %d\n", rc);
+ goto fail;
+ }
+ } else {
+ if (pa_therm != NULL) {
+ regulator_disable(pa_therm);
+ regulator_put(pa_therm);
+ }
+ }
+
+ return rc;
+fail:
+ regulator_put(pa_therm);
+ return rc;
+}
+
+static int32_t pm8921_adc_channel_power_enable(uint32_t channel,
+ bool power_cntrl)
+{
+ int rc = 0;
+
+ switch (channel)
+ case ADC_MPP_1_AMUX8:
+ pm8921_adc_patherm_power(power_cntrl);
+
+ return rc;
+}
+
+
static uint32_t pm8921_adc_read_reg(uint32_t reg, u8 *data)
{
struct pm8921_adc *adc_pmic = pmic_adc;
@@ -557,16 +625,9 @@
uint32_t pm8921_adc_read(enum pm8921_adc_channels channel,
struct pm8921_adc_chan_result *result)
{
- return pm8921_adc_mpp_read(channel, result, PREMUX_MPP_SCALE_0);
-}
-EXPORT_SYMBOL_GPL(pm8921_adc_read);
-
-uint32_t pm8921_adc_mpp_read(enum pm8921_adc_mpp_channels channel,
- struct pm8921_adc_chan_result *result,
- enum pm8921_adc_premux_mpp_scale_type mpp_scale)
-{
struct pm8921_adc *adc_pmic = pmic_adc;
- int i = 0, rc, amux_prescaling, scale_type;
+ int i = 0, rc = 0, rc_fail, amux_prescaling, scale_type;
+ enum pm8921_adc_premux_mpp_scale_type mpp_scale;
if (!pm8921_adc_initialized)
return -ENODEV;
@@ -584,13 +645,24 @@
}
if (i == adc_pmic->adc_num_channel) {
- mutex_unlock(&adc_pmic->adc_lock);
- return -EBADF; /* unknown channel */
+ rc = -EBADF;
+ goto fail_unlock;
}
- adc_pmic->conv->amux_channel = i;
- adc_pmic->conv->amux_mpp_channel = mpp_scale;
+ if (channel < PM8921_CHANNEL_MPP_SCALE1_IDX) {
+ mpp_scale = PREMUX_MPP_SCALE_0;
+ adc_pmic->conv->amux_channel = channel;
+ } else if (channel >= PM8921_CHANNEL_MPP_SCALE1_IDX) {
+ mpp_scale = PREMUX_MPP_SCALE_1;
+ adc_pmic->conv->amux_channel = channel %
+ PM8921_CHANNEL_MPP_SCALE1_IDX;
+ } else if (channel >= PM8921_CHANNEL_MPP_SCALE3_IDX) {
+ mpp_scale = PREMUX_MPP_SCALE_1_DIV3;
+ adc_pmic->conv->amux_channel = channel %
+ PM8921_CHANNEL_MPP_SCALE3_IDX;
+ }
+ adc_pmic->conv->amux_mpp_channel = mpp_scale;
adc_pmic->conv->amux_ip_rsv = adc_pmic->adc_channel[i].adc_rsv;
adc_pmic->conv->decimation = adc_pmic->adc_channel[i].adc_decimation;
amux_prescaling = adc_pmic->adc_channel[i].chan_path_prescaling;
@@ -600,34 +672,54 @@
adc_pmic->conv->chan_prop->offset_gain_denominator =
pm8921_amux_scaling_ratio[amux_prescaling].den;
+ rc = pm8921_adc_channel_power_enable(channel, true);
+ if (rc) {
+ rc = -EINVAL;
+ goto fail_unlock;
+ }
+
rc = pm8921_adc_configure(adc_pmic->conv);
if (rc) {
- mutex_unlock(&adc_pmic->adc_lock);
- return -EINVAL;
+ rc = -EINVAL;
+ goto fail;
}
wait_for_completion(&adc_pmic->adc_rslt_completion);
rc = pm8921_adc_read_adc_code(&result->adc_code);
if (rc) {
- mutex_unlock(&adc_pmic->adc_lock);
- return -EINVAL;
+ rc = -EINVAL;
+ goto fail;
}
scale_type = adc_pmic->adc_channel[i].adc_scale_fn;
if (scale_type >= ADC_SCALE_NONE) {
- mutex_unlock(&adc_pmic->adc_lock);
- return -EBADF;
+ rc = -EBADF;
+ goto fail;
}
adc_scale_fn[scale_type].chan(result->adc_code,
adc_pmic->adc_prop, adc_pmic->conv->chan_prop, result);
+ rc = pm8921_adc_channel_power_enable(channel, false);
+ if (rc) {
+ rc = -EINVAL;
+ goto fail_unlock;
+ }
+
mutex_unlock(&adc_pmic->adc_lock);
return 0;
+fail:
+ rc_fail = pm8921_adc_channel_power_enable(channel, false);
+ if (rc_fail)
+ pr_err("pm8921 adc power disable failed\n");
+fail_unlock:
+ mutex_unlock(&adc_pmic->adc_lock);
+ pr_err("pm8921 adc error with %d\n", rc);
+ return rc;
}
-EXPORT_SYMBOL_GPL(pm8921_adc_mpp_read);
+EXPORT_SYMBOL_GPL(pm8921_adc_read);
uint32_t pm8921_adc_btm_configure(struct pm8921_adc_arb_btm_param *btm_param)
{
@@ -870,6 +962,10 @@
(void *)CHANNEL_ICHG, ®_fops);
debugfs_create_file("ibat", 0644, pmic_adc->dent,
(void *)CHANNEL_IBAT, ®_fops);
+ debugfs_create_file("pa_therm", 0644, pmic_adc->dent,
+ (void *)ADC_MPP_1_AMUX8, ®_fops);
+ debugfs_create_file("xo_therm", 0644, pmic_adc->dent,
+ (void *)CHANNEL_MUXOFF, ®_fops);
}
#else
static inline void create_debugfs_entries(void)
@@ -946,7 +1042,7 @@
init_completion(&adc_pmic->adc_rslt_completion);
adc_pmic->adc_channel = pdata->adc_channel;
- adc_pmic->adc_num_channel = pdata->adc_num_channel;
+ adc_pmic->adc_num_channel = ADC_MPP_2_CHANNEL_NONE;
mutex_init(&adc_pmic->adc_lock);
spin_lock_init(&adc_pmic->btm_lock);
diff --git a/include/linux/mfd/pm8921-adc.h b/include/linux/mfd/pm8921-adc.h
index 99ef0bb..46ac155 100644
--- a/include/linux/mfd/pm8921-adc.h
+++ b/include/linux/mfd/pm8921-adc.h
@@ -59,42 +59,53 @@
CHANNEL_CHG_TEMP,
CHANNEL_MUXOFF,
CHANNEL_NONE,
-};
-
-/**
- * enum pm8921_adc_mpp_channels - PM8921 AMUX arbiter MPP channels
- * Yet to be defined, each of the value is representative
- * of the device connected to the MPP
- * %ADC_MPP_AMUX8: Fixed mappaing to PA THERM
- */
-enum pm8921_adc_mpp_channels {
- ADC_MPP_ATEST_8 = 0,
- ADC_MPP_USB_SNS_DIV20,
- ADC_MPP_DCIN_SNS_DIV20,
- ADC_MPP_AMUX3,
- ADC_MPP_AMUX4,
- ADC_MPP_AMUX5,
- ADC_MPP_AMUX6,
- ADC_MPP_AMUX7,
- ADC_MPP_AMUX8,
- ADC_MPP_ATEST_1,
- ADC_MPP_ATEST_2,
- ADC_MPP_ATEST_3,
- ADC_MPP_ATEST_4,
- ADC_MPP_ATEST_5,
- ADC_MPP_ATEST_6,
- ADC_MPP_ATEST_7,
- ADC_MPP_CHANNEL_NONE,
+ ADC_MPP_1_ATEST_8 = 20,
+ ADC_MPP_1_USB_SNS_DIV20,
+ ADC_MPP_1_DCIN_SNS_DIV20,
+ ADC_MPP_1_AMUX3,
+ ADC_MPP_1_AMUX4,
+ ADC_MPP_1_AMUX5,
+ ADC_MPP_1_AMUX6,
+ ADC_MPP_1_AMUX7,
+ ADC_MPP_1_AMUX8,
+ ADC_MPP_1_ATEST_1,
+ ADC_MPP_1_ATEST_2,
+ ADC_MPP_1_ATEST_3,
+ ADC_MPP_1_ATEST_4,
+ ADC_MPP_1_ATEST_5,
+ ADC_MPP_1_ATEST_6,
+ ADC_MPP_1_ATEST_7,
+ ADC_MPP_1_CHANNEL_NONE,
+ ADC_MPP_2_ATEST_8 = 40,
+ ADC_MPP_2_USB_SNS_DIV20,
+ ADC_MPP_2_DCIN_SNS_DIV20,
+ ADC_MPP_2_AMUX3,
+ ADC_MPP_2_AMUX4,
+ ADC_MPP_2_AMUX5,
+ ADC_MPP_2_AMUX6,
+ ADC_MPP_2_AMUX7,
+ ADC_MPP_2_AMUX8,
+ ADC_MPP_2_ATEST_1,
+ ADC_MPP_2_ATEST_2,
+ ADC_MPP_2_ATEST_3,
+ ADC_MPP_2_ATEST_4,
+ ADC_MPP_2_ATEST_5,
+ ADC_MPP_2_ATEST_6,
+ ADC_MPP_2_ATEST_7,
+ ADC_MPP_2_CHANNEL_NONE,
};
#define PM8921_ADC_PMIC_0 0x0
#define PM8921_CHANNEL_ADC_625_MV 625
+#define PM8921_CHANNEL_MPP_SCALE1_IDX 20
+#define PM8921_CHANNEL_MPP_SCALE3_IDX 40
#define PM8921_AMUX_MPP_3 0x3
#define PM8921_AMUX_MPP_4 0x4
#define PM8921_AMUX_MPP_5 0x5
#define PM8921_AMUX_MPP_6 0x6
+#define PM8921_AMUX_MPP_7 0x7
#define PM8921_AMUX_MPP_8 0x8
#define PM8921_ADC_DEV_NAME "pm8921-adc"
@@ -130,7 +141,7 @@
enum pm8921_adc_calib_type {
ADC_CALIB_ABSOLUTE = 0,
ADC_CALIB_RATIOMETRIC,
- ADC_CALIB_CONFIG_NONE,
+ ADC_CALIB_NONE,
};
/**
@@ -193,13 +204,15 @@
* %ADC_SCALE_BATT_THERM: Conversion to temperature based on btm parameters
* %ADC_SCALE_PMIC_THERM: Returns result in milli degree's Centigrade
* %ADC_SCALE_XTERN_CHGR_CUR: Returns current across 0.1 ohm resistor
+ * %ADC_SCALE_XOTHERM: Returns XO thermistor voltage in degree's Centigrade
* %ADC_SCALE_NONE: Do not use this scaling type
*/
enum pm8921_adc_scale_fn_type {
ADC_SCALE_DEFAULT = 0,
ADC_SCALE_BATT_THERM,
+ ADC_SCALE_PA_THERM,
ADC_SCALE_PMIC_THERM,
- ADC_SCALE_XTERN_CHGR_CUR,
+ ADC_SCALE_XOTHERM,
ADC_SCALE_NONE,
};
@@ -331,6 +344,21 @@
const struct pm8921_adc_chan_properties *chan_prop,
struct pm8921_adc_chan_result *chan_rslt);
/**
+ * pm8921_adc_scale_pa_therm() - Scales the pre-calibrated digital output
+ * of an ADC to the ADC reference and compensates for the
+ * gain and offset. Returns the temperature in degC.
+ * @adc_code: pre-calibrated digital ouput of the ADC.
+ * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
+ * reference voltage.
+ * @chan_prop: individual channel properties to compensate the i/p scaling,
+ * slope and offset.
+ * @chan_rslt: physical result to be stored.
+ */
+int32_t pm8921_adc_scale_pa_therm(int32_t adc_code,
+ const struct pm8921_adc_properties *adc_prop,
+ const struct pm8921_adc_chan_properties *chan_prop,
+ struct pm8921_adc_chan_result *chan_rslt);
+/**
* pm8921_adc_scale_pmic_therm() - Scales the pre-calibrated digital output
* of an ADC to the ADC reference and compensates for the
* gain and offset. Performs the AMUX out as 2mv/K and returns
@@ -346,23 +374,6 @@
const struct pm8921_adc_properties *adc_prop,
const struct pm8921_adc_chan_properties *chan_prop,
struct pm8921_adc_chan_result *chan_rslt);
-/**
- * pm8921_adc_scale_xtern_chgr_cur() - Scales the pre-calibrated digital output
- * of an ADC to the ADC reference and compensates for the
- * gain and offset. Returns the current across the 10m ohm
- * resistor.
- * @adc_code: pre-calibrated digital ouput of the ADC.
- * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
- * reference voltage.
- * @chan_prop: individual channel properties to compensate the i/p scaling,
- * slope and offset.
- * @chan_rslt: physical result to be stored.
- */
-int32_t pm8921_adc_scale_xtern_chgr_cur(int32_t adc_code,
- const struct pm8921_adc_properties *adc_prop,
- const struct pm8921_adc_chan_properties *chan_prop,
- struct pm8921_adc_chan_result *chan_rslt);
-
#else
static inline int32_t pm8921_adc_scale_default(int32_t adc_code,
const struct pm8921_adc_properties *adc_prop,
@@ -379,12 +390,12 @@
const struct pm8921_adc_chan_properties *chan_prop,
struct pm8921_adc_chan_result *chan_rslt)
{ return -ENXIO; }
-static inline int32_t pm8921_adc_scale_pmic_therm(int32_t adc_code,
+static inline int32_t pm8921_adc_scale_pa_therm(int32_t adc_code,
const struct pm8921_adc_properties *adc_prop,
const struct pm8921_adc_chan_properties *chan_prop,
struct pm8921_adc_chan_result *chan_rslt)
{ return -ENXIO; }
-static inline int32_t pm8921_adc_scale_xtern_chgr_cur(int32_t adc_code,
+static inline int32_t pm8921_adc_scale_pmic_therm(int32_t adc_code,
const struct pm8921_adc_properties *adc_prop,
const struct pm8921_adc_chan_properties *chan_prop,
struct pm8921_adc_chan_result *chan_rslt)
@@ -476,17 +487,6 @@
uint32_t pm8921_adc_read(enum pm8921_adc_channels channel,
struct pm8921_adc_chan_result *result);
/**
- * pm8921_mpp_adc_read() - Performs ADC read on the channel.
- * @channel: Input channel to perform the ADC read.
- * @result: Structure pointer of type adc_chan_result
- * in which the ADC read results are stored.
- * @mpp_scale: The pre scale value to be performed to the input signal
- * passed. Currently the pre-scale support is for 1 and 1/3.
- */
-uint32_t pm8921_adc_mpp_read(enum pm8921_adc_mpp_channels channel,
- struct pm8921_adc_chan_result *result,
- enum pm8921_adc_premux_mpp_scale_type);
-/**
* pm8921_adc_btm_start() - Configure the BTM registers and start
monitoring the BATT_THERM channel for
threshold warm/cold temperature set
@@ -524,10 +524,6 @@
static inline uint32_t pm8921_adc_read(uint32_t channel,
struct pm8921_adc_chan_result *result)
{ return -ENXIO; }
-static inline uint32_t pm8921_mpp_adc_read(uint32_t channel,
- struct pm8921_adc_chan_result *result,
- enum pm8921_adc_premux_mpp_scale_type scale)
-{ return -ENXIO; }
static inline uint32_t pm8921_adc_btm_start(void)
{ return -ENXIO; }
static inline uint32_t pm8921_adc_btm_end(void)