mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
dynamic adjust vindpm
Details: dynamic adjust vindpm Change-Id: I1028138cbd5ee95c9a62d4c6114c5eeb8949ab58 Reviewed-on: https://gerrit.mot.com/2427536 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wei Xu <xuwei9@lenovo.com> Reviewed-by: Wang Wang <wangwang1@lenovo.com> Submit-Approved: Jira Key
This commit is contained in:
parent
fbda6c5497
commit
ede8130ea6
2 changed files with 41 additions and 0 deletions
|
|
@ -1635,6 +1635,8 @@ static void charger_monitor_work_func(struct work_struct *work)
|
|||
/* enable dynamic adjust battery voltage */
|
||||
union power_supply_propval val_battery = {0};
|
||||
int vbat_uv, ibat_ua;
|
||||
/* enable dynamic adjust battery voltage */
|
||||
int soc;
|
||||
|
||||
charge_monitor_work = container_of(work, struct delayed_work, work);
|
||||
if(charge_monitor_work == NULL) {
|
||||
|
|
@ -1679,6 +1681,25 @@ static void charger_monitor_work_func(struct work_struct *work)
|
|||
}
|
||||
}
|
||||
|
||||
/* enable dynamic adjust vindpm */
|
||||
if(sgm->enable_dynamic_adjust_vindpm){
|
||||
if (!sgm->battery)
|
||||
sgm->battery = power_supply_get_by_name ("battery");
|
||||
if (sgm->battery) {
|
||||
power_supply_get_property(sgm->battery, POWER_SUPPLY_PROP_CAPACITY, &val_battery);
|
||||
soc = val_battery.intval;
|
||||
dev_err(sgm->dev, "soc = %d\n", soc);
|
||||
if(soc > 80 && sgm->vindpm_flag == false){
|
||||
ret = sgm4154x_set_input_volt_lim(sgm, 4700000);
|
||||
sgm->vindpm_flag = true;
|
||||
}
|
||||
if(soc <= 80 && sgm->vindpm_flag){
|
||||
ret = sgm4154x_set_input_volt_lim(sgm, sgm->init_data.vlim);
|
||||
sgm->vindpm_flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sgm4154x_dump_register(sgm);
|
||||
pr_err("%s\n",__func__);
|
||||
OUT:
|
||||
|
|
@ -2216,6 +2237,8 @@ static bool mmi_start_bc12_charger_type_detect(struct sgm4154x_device *sgm, int
|
|||
|
||||
static void sgm4154x_vbus_remove(struct sgm4154x_device * sgm)
|
||||
{
|
||||
/* enable dynamic adjust vindpm */
|
||||
int ret = 0;
|
||||
dev_err(sgm->dev, "Vbus removed, disable charge\n");
|
||||
|
||||
#ifdef CONFIG_MMI_QC3P_TURBO_CHARGER
|
||||
|
|
@ -2231,6 +2254,13 @@ static void sgm4154x_vbus_remove(struct sgm4154x_device * sgm)
|
|||
sgm4154x_set_chrg_adjust_volt(sgm, sgm->final_cv, 0);
|
||||
mmi_regmap_update_bits(sgm, SGM4154x_CHRG_CTRL_f, SGM4154x_VREG_FT_MASK, 0);
|
||||
}
|
||||
|
||||
/* enable dynamic adjust vindpm */
|
||||
if(sgm->enable_dynamic_adjust_vindpm){
|
||||
ret = sgm4154x_set_input_volt_lim(sgm, sgm->init_data.vlim);
|
||||
sgm->vindpm_flag = false;
|
||||
}
|
||||
|
||||
sgm->pulse_cnt = 0;
|
||||
sgm->mmi_qc3p_rerun_done = false;
|
||||
sgm->mmi_qc3p_wa = false;
|
||||
|
|
@ -2675,6 +2705,13 @@ static int sgm4154x_parse_dt(struct sgm4154x_device *sgm)
|
|||
sgm->enable_dynamic_adjust_batvol = of_property_read_bool(sgm->dev->of_node, "enable_dynamic_adjust_batvol");
|
||||
dev_err(sgm->dev, "%s: enable_dynamic_adjust_batvol = %d \n", __func__, sgm->enable_dynamic_adjust_batvol);
|
||||
|
||||
/* enable dynamic adjust vindpm */
|
||||
sgm->enable_dynamic_adjust_vindpm = of_property_read_bool(sgm->dev->of_node, "enable_dynamic_adjust_vindpm");
|
||||
dev_err(sgm->dev, "%s: enable_dynamic_adjust_vindpm = %d \n", __func__, sgm->enable_dynamic_adjust_vindpm);
|
||||
if(sgm->enable_dynamic_adjust_vindpm){
|
||||
sgm->vindpm_flag = false;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(sgm->dev->of_node, "jeita_temp_above_t4_cv", &val) >= 0)
|
||||
sgm->data.jeita_temp_above_t4_cv = val;
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -364,6 +364,10 @@ struct sgm4154x_device {
|
|||
int final_cv;
|
||||
int cv_tune;
|
||||
|
||||
/* enable dynamic adjust vindpm */
|
||||
bool enable_dynamic_adjust_vindpm;
|
||||
bool vindpm_flag;
|
||||
|
||||
struct regulator *dpdm_reg;
|
||||
struct regulator *otg_vbus_reg;
|
||||
struct mutex regulator_lock;
|
||||
|
|
|
|||
Loading…
Reference in a new issue