From 466554f88405a1b74a4297bcb8c42c3c8a2f3173 Mon Sep 17 00:00:00 2001 From: Kenny Kessler Date: Fri, 12 Oct 2018 11:46:22 -0500 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/1255092 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1526255 Reviewed-by: Ling Jin Reviewed-on: https://gerrit.mot.com/1771036 Reviewed-by: Huosheng Liao --- drivers/power/supply/qcom/smb5-lib.c | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index 53dad590cf07..f8065ace4153 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -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; }