power: qcom: smb5: Add MMI Factory Mode

Old ticket (CR)

MMI Factory mode needs to be followed so change base QCOM.
This patch is needed to ensure that from the time smb5
loads to the mmi DLKM loads there is no charging.

Only needed for Factory purposes.

Change-Id: I3011dbfc3382d382be2fb3c07c02597bfa953d77
Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com>
Reviewed-on: https://gerrit.mot.com/1255092
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1526255
Reviewed-by: Ling Jin <lingjin@motorola.com>
Reviewed-on: https://gerrit.mot.com/1771036
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
Kenny Kessler 2018-10-12 11:46:22 -05:00 • committed by Xiaojun Ji
commit 466554f884

View file

@ -8259,10 +8259,27 @@ relax:
pm_relax(chg->dev);
}
static bool mmi_factory_mode;
static void smblib_mmi_factory_check(void)
{
struct device_node *np = of_find_node_by_path("/chosen");
if (np)
mmi_factory_mode = of_property_read_bool(np,
"mmi,factory-cable");
of_node_put(np);
return;
}
static int smblib_create_votables(struct smb_charger *chg)
{
int rc = 0;
mmi_factory_mode = false;
smblib_mmi_factory_check();
chg->fcc_votable = find_votable("FCC");
if (chg->fcc_votable == NULL) {
rc = -EINVAL;
@ -8394,6 +8411,27 @@ static int smblib_create_votables(struct smb_charger *chg)
return rc;
}
if (mmi_factory_mode) {
smblib_err(chg, "MMI Factory Mode Force Charge Values!\n");
if(chg->chg_disable_votable) {
pmic_vote_force_val_set(chg->chg_disable_votable, 1);
pmic_vote_force_active_set(chg->chg_disable_votable, 1);
}
if(chg->fcc_votable) {
pmic_vote_force_val_set(chg->fcc_votable, 100000);
pmic_vote_force_active_set(chg->fcc_votable, 1);
}
if(chg->fv_votable) {
pmic_vote_force_val_set(chg->fv_votable, 4400000);
pmic_vote_force_active_set(chg->fv_votable, 1);
}
if(chg->usb_icl_votable) {
pmic_vote_force_val_set(chg->usb_icl_votable,
3000000);
pmic_vote_force_active_set(chg->usb_icl_votable, 1);
}
}
return rc;
}