diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-08-03 21:12:48 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-08-03 21:12:47 -0700 |
| commit | bb61ebf65458d9dd2cb00a942d88ff8cf686544a (patch) | |
| tree | 5f0333cbd546f3097425e04365dcc6c9a3e600ae | |
| parent | 9887341b46a92effa5853b07b4e656ec672857ae (diff) | |
| parent | 82ee420ef800a9d01bf602bb7acbafdbab4a7d73 (diff) | |
Merge "qcom-charger: qpnp-smb2: use values from hardware for default settings"
| -rw-r--r-- | drivers/power/qcom-charger/qpnp-smb2.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c index 08e64973d588..83cb87f94665 100644 --- a/drivers/power/qcom-charger/qpnp-smb2.c +++ b/drivers/power/qcom-charger/qpnp-smb2.c @@ -25,9 +25,6 @@ #include "smb-lib.h" #include "pmic-voter.h" -#define SMB2_DEFAULT_FCC_UA 3000000 -#define SMB2_DEFAULT_FV_UV 4350000 -#define SMB2_DEFAULT_ICL_UA 3000000 #define SMB2_DEFAULT_WPWR_UW 8000000 static struct smb_params v1_params = { @@ -159,22 +156,22 @@ static int smb2_parse_dt(struct smb2 *chip) rc = of_property_read_u32(node, "qcom,fcc-max-ua", &chip->dt.fcc_ua); if (rc < 0) - chip->dt.fcc_ua = SMB2_DEFAULT_FCC_UA; + chip->dt.fcc_ua = -EINVAL; rc = of_property_read_u32(node, "qcom,fv-max-uv", &chip->dt.fv_uv); if (rc < 0) - chip->dt.fv_uv = SMB2_DEFAULT_FV_UV; + chip->dt.fv_uv = -EINVAL; rc = of_property_read_u32(node, "qcom,usb-icl-ua", &chip->dt.usb_icl_ua); if (rc < 0) - chip->dt.usb_icl_ua = SMB2_DEFAULT_ICL_UA; + chip->dt.usb_icl_ua = -EINVAL; rc = of_property_read_u32(node, "qcom,dc-icl-ua", &chip->dt.dc_icl_ua); if (rc < 0) - chip->dt.dc_icl_ua = SMB2_DEFAULT_ICL_UA; + chip->dt.dc_icl_ua = -EINVAL; rc = of_property_read_u32(node, "qcom,wipower-max-uw", &chip->dt.wipower_max_uw); @@ -725,6 +722,20 @@ static int smb2_init_hw(struct smb2 *chip) struct smb_charger *chg = &chip->chg; int rc; + if (chip->dt.fcc_ua < 0) + smblib_get_charge_param(chg, &chg->param.fcc, &chip->dt.fcc_ua); + + if (chip->dt.fv_uv < 0) + smblib_get_charge_param(chg, &chg->param.fv, &chip->dt.fv_uv); + + if (chip->dt.usb_icl_ua < 0) + smblib_get_charge_param(chg, &chg->param.usb_icl, + &chip->dt.usb_icl_ua); + + if (chip->dt.dc_icl_ua < 0) + smblib_get_charge_param(chg, &chg->param.dc_icl, + &chip->dt.dc_icl_ua); + /* votes must be cast before configuring software control */ vote(chg->pl_disable_votable, USBIN_ICL_VOTER, true, 0); |
