From 93e9068acf669bfd61bb659cd89f3f216af324be Mon Sep 17 00:00:00 2001 From: Yonghua Yan Date: Mon, 29 Apr 2019 11:41:05 +0800 Subject: [PATCH] power: use force voter in factory FCC and ICL config Use force voter for factory FCC and ICL configuration during factory test in case the configuration is overridden by SMB5 charger driver. Mot-CRs-fixed: (CR) Change-Id: I8647b42b6ca420a02312198fb56c7ee09edfbde3 Signed-off-by: Yonghua Yan Reviewed-on: https://gerrit.mot.com/1345281 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Huosheng Liao Reviewed-by: Haijian Ma Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1355881 --- .../qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c index 351a95712b9f..da86ac96f680 100644 --- a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c +++ b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c @@ -843,11 +843,9 @@ static ssize_t force_chg_ibatt_store(struct device *dev, } chg_current *= 1000; /* Convert to uA */ - r = smblib_set_charge_param(mmi_chip, &mmi_chip->param.fcc, chg_current); - if (r < 0) { - pr_err("Factory Couldn't set masterfcc = %d rc=%d\n", - (int)chg_current, (int)r); - return r; + if(mmi_chip->fcc_votable) { + pmic_vote_force_val_set(mmi_chip->fcc_votable, chg_current); + pmic_vote_force_active_set(mmi_chip->fcc_votable, 1); } return r ? r : count; @@ -904,11 +902,9 @@ static ssize_t force_chg_iusb_store(struct device *dev, } usb_curr *= 1000; /* Convert to uA */ - r = smblib_set_charge_param(mmi_chip, &mmi_chip->param.usb_icl, usb_curr); - if (r < 0) { - pr_err("Factory Couldn't set usb icl = %d rc=%d\n", - (int)usb_curr, (int)r); - return r; + if (mmi_chip->usb_icl_votable) { + pmic_vote_force_val_set(mmi_chip->usb_icl_votable, usb_curr); + pmic_vote_force_active_set(mmi_chip->usb_icl_votable, 1); } r = smblib_masked_write_mmi(mmi_chip, USBIN_ICL_OPTIONS_REG,