pnangn:2nd main charger sc8989 disable adc conversion

2nd main charger sc8989 disable adc conversion by reading dtsi config value

to prevent current leak

Change-Id: Ic647a9c2dd3bbc60ef5b82b758716e35c8fe6c75
Reviewed-on: https://gerrit.mot.com/2447457
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Qiong Xie <xieq2@motorola.com>
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
lbh 2022-12-01 12:10:25 +08:00 • committed by longc136
commit 809c507901

View file

@ -244,6 +244,7 @@ struct bq2589x {
struct iio_channel **ext_iio_chans;
#endif
bool factory_mode;
bool sc8989_adc_stop;
};
struct pe_ctrl {
@ -1135,7 +1136,10 @@ static int bq2589x_init_device(struct bq2589x *bq)
return ret;
}
bq2589x_adc_start(bq, false);
if(bq->sc8989_adc_stop)
bq2589x_adc_stop(bq);
else
bq2589x_adc_start(bq, false);
ret = bq2589x_pumpx_enable(bq, 0);
if (ret) {
@ -1552,6 +1556,8 @@ static int bq2589x_parse_dt(struct device *dev, struct bq2589x *bq)
bq->mmi_qc3_support = of_property_read_bool(np, "mmi,qc3-support");
bq->sc8989_adc_stop = of_property_read_bool(np, "sc,sc8989_adc_stop");
ret = mmi_parse_dt_adc_channels(bq);
if (ret) {
dev_err(dev, "Failed to get adc channels%d\n", ret);
@ -2385,6 +2391,10 @@ static void bq2589x_adapter_in_func(struct bq2589x *bq)
dev_info(bq->dev,"%s:reset vindpm threshold to %d successfully\n",__func__,bq->cfg.vindpm);
}
if(bq->sc8989_adc_stop){
bq2589x_adc_start(bq, false);
}
schedule_delayed_work(&bq->monitor_work, 0);
bq->chg_dev->noti.apsd_done = true;
@ -2428,6 +2438,9 @@ static void bq2589x_adapter_out_func(struct bq2589x *bq)
bq->real_charger_type = POWER_SUPPLY_TYPE_UNKNOWN;
bq->mmi_qc3p_power = MMI_POWER_SUPPLY_QC3P_NONE;
bq2589x_reuqest_dpdm(bq, false);
if(bq->sc8989_adc_stop){
bq2589x_adc_stop(bq);
}
charger_dev_notify(bq->chg_dev);
}