mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
support transfer the flip target fcc to main battery.
Transfer the target fcc value of the flip battery to the main battery through glink for power dynamic configuration. Change-Id: I3b8b2029e5f5cdf1b7ccc49fd7ce32a63b94c957 Reviewed-on: https://gerrit.mot.com/2520452 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-by: Guobin Zhang <zhanggb@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
e6e27dc858
commit
d18cb2d891
3 changed files with 50 additions and 5 deletions
|
|
@ -223,6 +223,8 @@ struct qti_charger {
|
|||
struct mmi_charger_constraint constraint;
|
||||
struct mmi_charger_driver *driver;
|
||||
struct power_supply *wls_psy;
|
||||
struct power_supply *partner_charger;
|
||||
u32 partner_charger_icl;
|
||||
u32 *profile_data;
|
||||
struct charger_profile_info profile_info;
|
||||
struct lpd_info lpd_info;
|
||||
|
|
@ -748,6 +750,36 @@ static int qti_charger_get_chg_info(void *data, struct mmi_charger_info *chg_inf
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int qti_charger_get_partner_icl(struct qti_charger *chg, u32 *icl)
|
||||
{
|
||||
int rc;
|
||||
union power_supply_propval propval;
|
||||
static const char *partner_psy_name = NULL;
|
||||
|
||||
if (NULL == partner_psy_name) {
|
||||
rc = of_property_read_string(chg->dev->of_node,
|
||||
"mmi,partner_psy_name", &partner_psy_name);
|
||||
if (rc) {
|
||||
mmi_err(chg, "Failed get the partner psy name");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
if (!chg->partner_charger) {
|
||||
chg->partner_charger = power_supply_get_by_name(partner_psy_name);
|
||||
if (!chg->partner_charger)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
rc = power_supply_get_property(chg->partner_charger, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &propval);
|
||||
if (rc < 0) {
|
||||
mmi_err(chg, "get property failed, rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
*icl = propval.intval;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int qti_charger_config_charge(void *data, struct mmi_charger_cfg *config)
|
||||
{
|
||||
int rc;
|
||||
|
|
@ -829,6 +861,15 @@ static int qti_charger_config_charge(void *data, struct mmi_charger_cfg *config)
|
|||
chg->chg_cfg.charging_reset = config->charging_reset;
|
||||
}
|
||||
|
||||
rc = qti_charger_get_partner_icl(chg, &value);
|
||||
if (!rc && chg->partner_charger_icl != value) {
|
||||
rc = qti_charger_write(chg, OEM_PROP_CHG_PARTNER_ICL,
|
||||
&value,
|
||||
sizeof(value));
|
||||
if (!rc)
|
||||
chg->partner_charger_icl = value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2663,6 +2704,7 @@ static int qti_charger_init(struct qti_charger *chg)
|
|||
bm_ulog_print_mask_log(BM_ALL, BM_LOG_LEVEL_INFO, OEM_BM_ULOG_SIZE);
|
||||
|
||||
wireless_psy_init(chg);
|
||||
|
||||
create_debugfs_entries(chg);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ enum oem_property_type {
|
|||
OEM_PROP_WLS_WLC_TX_ID,
|
||||
OEM_PROP_WLS_WLC_TX_SN,
|
||||
OEM_PROP_LPD_MITIGATE_MODE,
|
||||
OEM_PROP_CHG_PARTNER_ICL,
|
||||
OEM_PROP_MAX,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1184,6 +1184,7 @@ static int sgm4154x_charger_get_property(struct power_supply *psy,
|
|||
struct sgm4154x_device *sgm = power_supply_get_drvdata(psy);
|
||||
struct sgm4154x_state state;
|
||||
int chrg_status = 0;
|
||||
int ibus_ua = 0;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&sgm->lock);
|
||||
|
|
@ -1289,11 +1290,12 @@ static int sgm4154x_charger_get_property(struct power_supply *psy,
|
|||
break;
|
||||
|
||||
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
|
||||
ret = sgm4154x_get_input_curr_lim(sgm);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val->intval = ret;
|
||||
val->intval = sgm->ilim;
|
||||
if (sgm->init_data.vlim > 0 && state.vbus_adc >= sgm->init_data.vlim) {
|
||||
ibus_ua = (sgm->ichg / 1000) * (sgm->vreg / 1000) / (state.vbus_adc / 1000) * 1000;
|
||||
if (ibus_ua < sgm->ilim)
|
||||
val->intval = ibus_ua;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
|
||||
|
|
|
|||
Loading…
Reference in a new issue