mfd: pm8921-adc: Add BTM thermistor table
BTM (Battery Temperature Module) thermistor lookup
table is computed based on the resistor divider's
used on the board and the specifications of the
thermistor. Its a function of temperature vs the
ADC code for PM8921 ADC and is used to set the
cool/warm thresholds on the BTM.
CRs-Fixed: 299646
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
diff --git a/drivers/mfd/msmproc_adc.c b/drivers/mfd/msmproc_adc.c
index a47486a..b2e9491 100644
--- a/drivers/mfd/msmproc_adc.c
+++ b/drivers/mfd/msmproc_adc.c
@@ -20,19 +20,97 @@
#define PM8921_ADC_CODE_SCALE 24576
static const struct pm8921_adc_map_pt adcmap_batttherm[] = {
- {2020, -30},
- {1923, -20},
- {1796, -10},
- {1640, 0},
- {1459, 10},
- {1260, 20},
- {1159, 25},
- {1059, 30},
- {871, 40},
- {706, 50},
- {567, 60},
- {453, 70},
- {364, 80}
+ {41001, -30},
+ {40017, -20},
+ {38721, -10},
+ {37186, 0},
+ {35554, 10},
+ {33980, 20},
+ {33253, 25},
+ {32580, 30},
+ {31412, 40},
+ {30481, 50},
+ {29759, 60},
+ {29209, 70},
+ {28794, 80}
+};
+
+static const struct pm8921_adc_map_pt adcmap_btm_threshold[] = {
+ {-30, 41001},
+ {-20, 40017},
+ {-10, 38721},
+ {0, 37186},
+ {10, 35554},
+ {11, 35392},
+ {12, 35230},
+ {13, 35070},
+ {14, 34910},
+ {15, 34751},
+ {16, 34594},
+ {17, 34438},
+ {18, 34284},
+ {19, 34131},
+ {20, 33980},
+ {21, 33830},
+ {22, 33683},
+ {23, 33538},
+ {24, 33394},
+ {25, 33253},
+ {26, 33114},
+ {27, 32977},
+ {28, 32842},
+ {29, 32710},
+ {30, 32580},
+ {31, 32452},
+ {32, 32327},
+ {33, 32204},
+ {34, 32084},
+ {35, 31966},
+ {36, 31850},
+ {37, 31737},
+ {38, 31627},
+ {39, 31518},
+ {40, 31412},
+ {41, 31309},
+ {42, 31208},
+ {43, 31109},
+ {44, 31013},
+ {45, 30918},
+ {46, 30827},
+ {47, 30737},
+ {48, 30649},
+ {49, 30564},
+ {50, 30481},
+ {51, 30400},
+ {52, 30321},
+ {53, 30244},
+ {54, 30169},
+ {55, 30096},
+ {56, 30025},
+ {57, 29956},
+ {58, 29889},
+ {59, 29823},
+ {60, 29759},
+ {61, 29697},
+ {62, 29637},
+ {63, 29578},
+ {64, 29521},
+ {65, 29465},
+ {66, 29411},
+ {67, 29359},
+ {68, 29308},
+ {69, 29258},
+ {70, 29209},
+ {71, 29162},
+ {72, 29117},
+ {73, 29072},
+ {74, 29029},
+ {75, 28987},
+ {76, 28946},
+ {77, 28906},
+ {78, 28868},
+ {79, 28830},
+ {80, 28794}
};
static const struct pm8921_adc_map_pt adcmap_ntcg_104ef_104fb[] = {
@@ -306,19 +384,11 @@
const struct pm8921_adc_chan_properties *chan_properties,
struct pm8921_adc_chan_result *adc_chan_result)
{
- int rc;
-
- rc = pm8921_adc_scale_default(adc_code, adc_properties, chan_properties,
- adc_chan_result);
- if (rc < 0) {
- pr_debug("PM8921 ADC scale default error with %d\n", rc);
- return rc;
- }
/* convert mV ---> degC using the table */
return pm8921_adc_map_linear(
adcmap_batttherm,
- sizeof(adcmap_batttherm)/sizeof(adcmap_batttherm[0]),
- adc_chan_result->physical,
+ ARRAY_SIZE(adcmap_batttherm),
+ adc_code,
&adc_chan_result->physical);
}
EXPORT_SYMBOL_GPL(pm8921_adc_scale_batt_therm);
@@ -459,10 +529,22 @@
int32_t pm8921_adc_batt_scaler(struct pm8921_adc_arb_btm_param *btm_param)
{
- /* TODO based on the schematics for the batt thermistor
- parameters and the HW/SW doc for the device. This is the
- external batt therm */
+ int rc;
- return 0;
+ rc = pm8921_adc_map_linear(
+ adcmap_btm_threshold,
+ ARRAY_SIZE(adcmap_btm_threshold),
+ btm_param->low_thr_temp,
+ &btm_param->low_thr_voltage);
+
+ if (!rc) {
+ rc = pm8921_adc_map_linear(
+ adcmap_btm_threshold,
+ ARRAY_SIZE(adcmap_btm_threshold),
+ btm_param->high_thr_temp,
+ &btm_param->high_thr_voltage);
+ }
+
+ return rc;
}
EXPORT_SYMBOL_GPL(pm8921_adc_batt_scaler);
diff --git a/drivers/mfd/pm8921-adc.c b/drivers/mfd/pm8921-adc.c
index 507f46c..e9b6e34 100644
--- a/drivers/mfd/pm8921-adc.c
+++ b/drivers/mfd/pm8921-adc.c
@@ -97,6 +97,7 @@
#define PM8921_ADC_ARB_BTM_BAT_WARM_THR0 0x188
#define PM8921_ADC_ARB_ANA_DIG 0xa0
+#define PM8921_ADC_BTM_RSV 0x10
#define PM8921_ADC_AMUX_MPP_SEL 2
#define PM8921_ADC_AMUX_SEL 4
#define PM8921_ADC_RSV_IP_SEL 4
@@ -105,7 +106,8 @@
#define PM8921_ADC_IRQ_0 0
#define PM8921_ADC_IRQ_1 1
#define PM8921_ADC_IRQ_2 2
-#define PM8921_ADC_BTM_INTERVAL_SEL 5
+#define PM8921_ADC_BTM_INTERVAL_SEL_MASK 0xF
+#define PM8921_ADC_BTM_INTERVAL_SEL_SHIFT 2
#define PM8921_ADC_BTM_DECIMATION_SEL 5
#define PM8921_ADC_MUL 10
#define PM8921_ADC_CONV_TIME_MIN 2000
@@ -116,15 +118,17 @@
struct pm8921_adc_properties *adc_prop;
int adc_irq;
struct mutex adc_lock;
- struct mutex btm_lock;
+ spinlock_t btm_lock;
uint32_t adc_num_channel;
struct completion adc_rslt_completion;
struct pm8921_adc_amux *adc_channel;
struct pm8921_adc_amux_properties *conv;
- struct pm8921_adc_arb_btm *batt;
+ struct pm8921_adc_arb_btm_param *batt;
int btm_warm_irq;
- int btm_cold_irq;
+ int btm_cool_irq;
struct dentry *dent;
+ struct work_struct warm_work;
+ struct work_struct cool_work;
};
struct pm8921_adc_amux_properties {
@@ -151,7 +155,7 @@
[ADC_SCALE_XTERN_CHGR_CUR] = {pm8921_adc_scale_xtern_chgr_cur},
};
-static bool pm8921_adc_calib_first_adc, pm8921_btm_calib_first_adc;
+static bool pm8921_adc_calib_first_adc;
static bool pm8921_adc_initialized, pm8921_adc_calib_device_init;
static int32_t pm8921_adc_arb_cntrl(uint32_t arb_cntrl)
@@ -322,6 +326,34 @@
return 0;
}
+static void pm8921_adc_btm_warm_scheduler_fn(struct work_struct *work)
+{
+ struct pm8921_adc *adc_pmic = container_of(work, struct pm8921_adc,
+ warm_work);
+ unsigned long flags = 0;
+ bool warm_status;
+
+ spin_lock_irqsave(&adc_pmic->btm_lock, flags);
+ warm_status = irq_read_line(adc_pmic->btm_warm_irq);
+ if (adc_pmic->batt->btm_warm_fn != NULL)
+ adc_pmic->batt->btm_warm_fn(warm_status);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
+}
+
+static void pm8921_adc_btm_cool_scheduler_fn(struct work_struct *work)
+{
+ struct pm8921_adc *adc_pmic = container_of(work, struct pm8921_adc,
+ cool_work);
+ unsigned long flags = 0;
+ bool cool_status;
+
+ spin_lock_irqsave(&adc_pmic->btm_lock, flags);
+ cool_status = irq_read_line(adc_pmic->btm_cool_irq);
+ if (adc_pmic->batt->btm_cool_fn != NULL)
+ adc_pmic->batt->btm_cool_fn(cool_status);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
+}
+
static irqreturn_t pm8921_adc_isr(int irq, void *dev_id)
{
struct pm8921_adc *adc_8921 = dev_id;
@@ -340,28 +372,16 @@
{
struct pm8921_adc *btm_8921 = dev_id;
- disable_irq_nosync(btm_8921->btm_warm_irq);
-
- if (pm8921_btm_calib_first_adc)
- return IRQ_HANDLED;
-
- if (btm_8921->batt->btm_param->btm_warm_fn != NULL)
- btm_8921->batt->btm_param->btm_warm_fn();
+ schedule_work(&btm_8921->warm_work);
return IRQ_HANDLED;
}
-static irqreturn_t pm8921_btm_cold_isr(int irq, void *dev_id)
+static irqreturn_t pm8921_btm_cool_isr(int irq, void *dev_id)
{
struct pm8921_adc *btm_8921 = dev_id;
- disable_irq_nosync(btm_8921->btm_cold_irq);
-
- if (pm8921_btm_calib_first_adc)
- return IRQ_HANDLED;
-
- if (btm_8921->batt->btm_param->btm_cold_fn != NULL)
- btm_8921->batt->btm_param->btm_cold_fn();
+ schedule_work(&btm_8921->cool_work);
return IRQ_HANDLED;
}
@@ -615,50 +635,80 @@
u8 data_btm_cool_thr0, data_btm_cool_thr1;
u8 data_btm_warm_thr0, data_btm_warm_thr1;
u8 arb_btm_cntrl1;
+ unsigned long flags = 0;
int rc;
- mutex_lock(&adc_pmic->btm_lock);
+ if (adc_pmic == NULL) {
+ pr_err("PMIC ADC not valid\n");
+ return -EINVAL;
+ }
+
+ if ((btm_param->btm_cool_fn == NULL) &&
+ (btm_param->btm_warm_fn == NULL)) {
+ pr_err("No BTM warm/cool notification??\n");
+ return -EINVAL;
+ }
+
+ rc = pm8921_adc_batt_scaler(btm_param);
+ if (rc < 0) {
+ pr_err("Failed to lookup the BTM thresholds\n");
+ return rc;
+ }
+
+ spin_lock_irqsave(&adc_pmic->btm_lock, flags);
data_btm_cool_thr0 = ((btm_param->low_thr_voltage << 24) >> 24);
data_btm_cool_thr1 = ((btm_param->low_thr_voltage << 16) >> 24);
data_btm_warm_thr0 = ((btm_param->high_thr_voltage << 24) >> 24);
data_btm_warm_thr1 = ((btm_param->high_thr_voltage << 16) >> 24);
- rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_COOL_THR0,
- data_btm_cool_thr0);
- if (rc < 0)
- goto write_err;
+ if (btm_param->btm_cool_fn != NULL) {
+ rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_COOL_THR0,
+ data_btm_cool_thr0);
+ if (rc < 0)
+ goto write_err;
- rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_COOL_THR1,
- data_btm_cool_thr0);
- if (rc < 0)
- goto write_err;
+ rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_COOL_THR1,
+ data_btm_cool_thr1);
+ if (rc < 0)
+ goto write_err;
- rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_WARM_THR0,
- data_btm_warm_thr0);
- if (rc < 0)
- goto write_err;
+ adc_pmic->batt->btm_cool_fn = btm_param->btm_cool_fn;
+ }
- rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_WARM_THR1,
- data_btm_warm_thr1);
- if (rc < 0)
- goto write_err;
+ if (btm_param->btm_warm_fn != NULL) {
+ rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_WARM_THR0,
+ data_btm_warm_thr0);
+ if (rc < 0)
+ goto write_err;
- arb_btm_cntrl1 = btm_param->interval << PM8921_ADC_BTM_INTERVAL_SEL;
+ rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_BAT_WARM_THR1,
+ data_btm_warm_thr1);
+ if (rc < 0)
+ goto write_err;
+
+ adc_pmic->batt->btm_warm_fn = btm_param->btm_warm_fn;
+ }
+
+ rc = pm8921_adc_read_reg(PM8921_ADC_ARB_BTM_CNTRL1, &arb_btm_cntrl1);
+ if (rc < 0)
+ goto bail_out;
+
+ btm_param->interval &= PM8921_ADC_BTM_INTERVAL_SEL_MASK;
+ arb_btm_cntrl1 |=
+ btm_param->interval << PM8921_ADC_BTM_INTERVAL_SEL_SHIFT;
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_CNTRL1, arb_btm_cntrl1);
if (rc < 0)
goto write_err;
- adc_pmic->batt->btm_param->btm_warm_fn = btm_param->btm_warm_fn;
- adc_pmic->batt->btm_param->btm_cold_fn = btm_param->btm_cold_fn;
-
- mutex_unlock(&adc_pmic->btm_lock);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
return rc;
-
+bail_out:
write_err:
- mutex_unlock(&adc_pmic->btm_lock);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
+ pr_debug("%s: with error code %d\n", __func__, rc);
return rc;
}
EXPORT_SYMBOL_GPL(pm8921_adc_btm_configure);
@@ -668,27 +718,26 @@
struct pm8921_adc *adc_pmic = pmic_adc;
int rc, i;
u8 arb_btm_dig_param, arb_btm_ana_param, arb_btm_rsv;
- u8 arb_btm_amux_cntrl, arb_btm_decimation, data_arb_btm_cntrl;
+ u8 arb_btm_amux_cntrl, data_arb_btm_cntrl = 0;
+ unsigned long flags;
arb_btm_amux_cntrl = channel << PM8921_ADC_BTM_CHANNEL_SEL;
arb_btm_rsv = adc_pmic->adc_channel[channel].adc_rsv;
- arb_btm_decimation =
- adc_pmic->adc_channel[channel].adc_decimation;
- arb_btm_ana_param = PM8921_ADC_ARB_ANA_DIG;
+ arb_btm_dig_param = arb_btm_ana_param = PM8921_ADC_ARB_ANA_DIG;
- mutex_lock(&adc_pmic->btm_lock);
+ spin_lock_irqsave(&adc_pmic->btm_lock, flags);
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_AMUX_CNTRL,
arb_btm_amux_cntrl);
if (rc < 0)
goto write_err;
+ arb_btm_rsv = PM8921_ADC_BTM_RSV;
+
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_RSV, arb_btm_rsv);
if (rc < 0)
goto write_err;
- arb_btm_dig_param = arb_btm_decimation <<
- PM8921_ADC_BTM_DECIMATION_SEL;
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_DIG_PARAM,
arb_btm_dig_param);
if (rc < 0)
@@ -699,11 +748,8 @@
if (rc < 0)
goto write_err;
- data_arb_btm_cntrl = PM8921_ADC_ARB_BTM_CNTRL1_EOC |
- PM8921_ADC_ARB_BTM_CNTRL1_EN_BTM;
+ data_arb_btm_cntrl |= PM8921_ADC_ARB_BTM_CNTRL1_EN_BTM;
- /* Write twice to the CNTRL register for the arbiter settings
- to take into effect */
for (i = 0; i < 2; i++) {
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_CNTRL1,
data_arb_btm_cntrl);
@@ -711,21 +757,28 @@
goto write_err;
}
- mutex_unlock(&adc_pmic->btm_lock);
+ data_arb_btm_cntrl |= PM8921_ADC_ARB_BTM_CNTRL1_REQ
+ | PM8921_ADC_ARB_BTM_CNTRL1_SEL_OP_MODE;
- return 0;
+ rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_CNTRL1,
+ data_arb_btm_cntrl);
+ if (rc < 0)
+ goto write_err;
+
+ if (pmic_adc->batt->btm_warm_fn != NULL)
+ enable_irq(adc_pmic->btm_warm_irq);
+
+ if (pmic_adc->batt->btm_cool_fn != NULL)
+ enable_irq(adc_pmic->btm_cool_irq);
write_err:
- mutex_unlock(&adc_pmic->btm_lock);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
return rc;
}
uint32_t pm8921_adc_btm_start(void)
{
- int rc;
-
- rc = pm8921_adc_btm_read(CHANNEL_BATT_THERM);
- return rc;
+ return pm8921_adc_btm_read(CHANNEL_BATT_THERM);
}
EXPORT_SYMBOL_GPL(pm8921_adc_btm_start);
@@ -734,22 +787,33 @@
struct pm8921_adc *adc_pmic = pmic_adc;
int i, rc;
u8 data_arb_btm_cntrl;
+ unsigned long flags;
+ disable_irq_nosync(adc_pmic->btm_warm_irq);
+ disable_irq_nosync(adc_pmic->btm_cool_irq);
+
+ spin_lock_irqsave(&adc_pmic->btm_lock, flags);
/* Set BTM registers to Disable mode */
- data_arb_btm_cntrl = PM8921_ADC_ARB_BTM_CNTRL1_EOC;
+ rc = pm8921_adc_read_reg(PM8921_ADC_ARB_BTM_CNTRL1,
+ &data_arb_btm_cntrl);
+ if (rc < 0) {
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
+ return rc;
+ }
- mutex_lock(&adc_pmic->btm_lock);
+ data_arb_btm_cntrl |= ~PM8921_ADC_ARB_BTM_CNTRL1_EN_BTM;
/* Write twice to the CNTRL register for the arbiter settings
to take into effect */
for (i = 0; i < 2; i++) {
rc = pm8921_adc_write_reg(PM8921_ADC_ARB_BTM_CNTRL1,
data_arb_btm_cntrl);
if (rc < 0) {
- mutex_unlock(&adc_pmic->btm_lock);
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
return rc;
}
}
- mutex_unlock(&adc_pmic->btm_lock);
+
+ spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
return rc;
}
@@ -762,10 +826,10 @@
int rc;
rc = pm8921_adc_read(i, &result);
-
pr_info("ADC value raw:%x physical:%lld\n",
result.adc_code, result.physical);
*val = result.physical;
+
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(reg_fops, get_adc, NULL, "%llu\n");
@@ -820,11 +884,12 @@
device_init_wakeup(&pdev->dev, 0);
free_irq(adc_pmic->adc_irq, adc_pmic);
free_irq(adc_pmic->btm_warm_irq, adc_pmic);
- free_irq(adc_pmic->btm_cold_irq, adc_pmic);
+ free_irq(adc_pmic->btm_cool_irq, adc_pmic);
platform_set_drvdata(pdev, NULL);
pmic_adc = NULL;
kfree(adc_pmic->conv->chan_prop);
kfree(adc_pmic->adc_channel);
+ kfree(adc_pmic->batt);
kfree(adc_pmic);
pm8921_adc_initialized = false;
@@ -837,6 +902,7 @@
struct pm8921_adc *adc_pmic;
struct pm8921_adc_amux_properties *adc_amux_prop;
struct pm8921_adc_chan_properties *adc_pmic_chanprop;
+ struct pm8921_adc_arb_btm_param *adc_btm;
int rc = 0;
if (!pdata) {
@@ -865,17 +931,25 @@
return -ENOMEM;
}
+ adc_btm = kzalloc(sizeof(struct pm8921_adc_arb_btm_param),
+ GFP_KERNEL);
+ if (!adc_btm) {
+ dev_err(&pdev->dev, "Unable to allocate memory\n");
+ return -ENOMEM;
+ }
+
adc_pmic->dev = &pdev->dev;
adc_pmic->adc_prop = pdata->adc_prop;
adc_pmic->conv = adc_amux_prop;
adc_pmic->conv->chan_prop = adc_pmic_chanprop;
+ adc_pmic->batt = adc_btm;
init_completion(&adc_pmic->adc_rslt_completion);
adc_pmic->adc_channel = pdata->adc_channel;
adc_pmic->adc_num_channel = pdata->adc_num_channel;
mutex_init(&adc_pmic->adc_lock);
- mutex_init(&adc_pmic->btm_lock);
+ spin_lock_init(&adc_pmic->btm_lock);
adc_pmic->adc_irq = platform_get_irq(pdev, PM8921_ADC_IRQ_0);
if (adc_pmic->adc_irq < 0) {
@@ -902,7 +976,8 @@
rc = request_irq(adc_pmic->btm_warm_irq,
pm8921_btm_warm_isr,
- IRQF_TRIGGER_RISING, "pm8921_btm_warm_interrupt", adc_pmic);
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "pm8921_btm_warm_interrupt", adc_pmic);
if (rc) {
pr_err("btm warm irq failed %d with interrupt number %d\n",
rc, adc_pmic->btm_warm_irq);
@@ -912,30 +987,32 @@
disable_irq_nosync(adc_pmic->btm_warm_irq);
- adc_pmic->btm_cold_irq = platform_get_irq(pdev, PM8921_ADC_IRQ_2);
- if (adc_pmic->btm_cold_irq < 0) {
+ adc_pmic->btm_cool_irq = platform_get_irq(pdev, PM8921_ADC_IRQ_2);
+ if (adc_pmic->btm_cool_irq < 0) {
rc = -ENXIO;
goto err_cleanup;
}
- rc = request_irq(adc_pmic->btm_cold_irq,
- pm8921_btm_cold_isr,
- IRQF_TRIGGER_RISING, "pm8921_btm_cold_interrupt", adc_pmic);
+ rc = request_irq(adc_pmic->btm_cool_irq,
+ pm8921_btm_cool_isr,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "pm8921_btm_cool_interrupt", adc_pmic);
if (rc) {
- pr_err("btm cold irq failed with return %d and number %d\n",
- rc, adc_pmic->btm_cold_irq);
+ pr_err("btm cool irq failed with return %d and number %d\n",
+ rc, adc_pmic->btm_cool_irq);
dev_err(&pdev->dev, "failed to request btm irq\n");
goto err_cleanup;
}
- disable_irq_nosync(adc_pmic->btm_cold_irq);
+ disable_irq_nosync(adc_pmic->btm_cool_irq);
device_init_wakeup(&pdev->dev, pdata->adc_wakeup);
platform_set_drvdata(pdev, adc_pmic);
pmic_adc = adc_pmic;
+ INIT_WORK(&adc_pmic->warm_work, pm8921_adc_btm_warm_scheduler_fn);
+ INIT_WORK(&adc_pmic->cool_work, pm8921_adc_btm_cool_scheduler_fn);
create_debugfs_entries();
pm8921_adc_calib_first_adc = false;
- pm8921_btm_calib_first_adc = false;
pm8921_adc_calib_device_init = false;
pm8921_adc_initialized = true;
return 0;