mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
charging: add wls charging icl workaround for apple TX
add wls charging icl workaround for apple TX Change-Id: If6fcf4eecc937efdfc6b6abbf5f289fa8d3ff6e2 Signed-off-by: Haijian Ma <mahj8@motorola.com> Reviewed-on: https://gerrit.mot.com/2332334 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
eb15e8e279
commit
dcca2318bf
2 changed files with 46 additions and 1 deletions
|
|
@ -2850,6 +2850,18 @@ static int bq2589x_is_charging_halted(struct charger_device *chg_dev, bool *en)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int mmi_rerun_aicl(struct charger_device *chg_dev)
|
||||
{
|
||||
struct bq2589x *bq = dev_get_drvdata(&chg_dev->dev);
|
||||
int ret = 0;
|
||||
|
||||
ret = bq2589x_force_ico(bq);
|
||||
|
||||
dev_info(bq->dev,"%s force ico %s\n", __func__, ret ? "failed" : "success");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bq2589x_dump_registers(struct charger_device *chg_dev, struct seq_file *m)
|
||||
{
|
||||
struct bq2589x *bq = dev_get_drvdata(&chg_dev->dev);
|
||||
|
|
@ -2891,6 +2903,7 @@ static struct charger_ops bq2589x_chg_ops = {
|
|||
.enable_termination = bq2589x_enable_termination,
|
||||
.get_qc3p_power = mmi_get_qc3p_power,
|
||||
.config_pd_active = mmi_config_pd_active,
|
||||
.rerun_aicl = mmi_rerun_aicl,
|
||||
};
|
||||
|
||||
static int bq2589x_charger_probe(struct i2c_client *client,
|
||||
|
|
|
|||
|
|
@ -1084,11 +1084,17 @@ static void mmi_discrete_wireless_icl_work(struct work_struct *work)
|
|||
struct mmi_discrete_charger,
|
||||
wireless_icl_work.work);
|
||||
int wls_icl = 0;
|
||||
union power_supply_propval wls_output = {0, };
|
||||
int ret = 0;
|
||||
|
||||
wls_icl = get_client_vote(chip->usb_icl_votable, SW_ICL_MAX_VOTER);
|
||||
|
||||
if (wls_icl >= chip->wls_max_icl_ua)//wls icl have been setted
|
||||
return;
|
||||
|
||||
while((wls_icl + WLS_ICL_INCREASE_STEP) <= chip->wls_max_icl_ua) {
|
||||
if(!is_wls_online(chip))
|
||||
break;
|
||||
return;
|
||||
wls_icl += WLS_ICL_INCREASE_STEP;
|
||||
|
||||
if (wls_icl < WLS_ICL_MIN)
|
||||
|
|
@ -1099,6 +1105,32 @@ static void mmi_discrete_wireless_icl_work(struct work_struct *work)
|
|||
wls_icl = get_client_vote(chip->usb_icl_votable, SW_ICL_MAX_VOTER);
|
||||
mmi_info(chip, "vote wireless charging icl %d ua\n", wls_icl);
|
||||
}
|
||||
|
||||
if (!chip->wls_psy)
|
||||
return;
|
||||
|
||||
ret = power_supply_get_property(chip->wls_psy,
|
||||
POWER_SUPPLY_PROP_CURRENT_NOW, &wls_output);
|
||||
if (ret)
|
||||
mmi_err(chip, "Couldn't get wls current now prop rc=%d\n", ret);
|
||||
|
||||
mmi_info(chip, "get wls current now =%d\n", wls_output.intval);
|
||||
if (wls_output.intval >= 500)
|
||||
return;
|
||||
|
||||
wls_icl = 0;
|
||||
while((wls_icl + WLS_ICL_INCREASE_STEP) <= chip->wls_max_icl_ua) {
|
||||
if(!is_wls_online(chip))
|
||||
return;
|
||||
wls_icl += WLS_ICL_INCREASE_STEP;
|
||||
|
||||
vote(chip->usb_icl_votable, SW_ICL_MAX_VOTER, true, wls_icl);
|
||||
msleep(500);
|
||||
wls_icl = get_client_vote(chip->usb_icl_votable, SW_ICL_MAX_VOTER);
|
||||
mmi_info(chip, "vote wireless charging icl %d ua\n", wls_icl);
|
||||
}
|
||||
charger_dev_rerun_aicl(chip->master_chg_dev);
|
||||
|
||||
}
|
||||
|
||||
/*MIN is 2.5W -> default icl 500mA * input vol 5V*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue