Loading Documentation/devicetree/bindings/power/qpnp-smbcharger.txt +5 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,11 @@ Optional Properties: charger if one exists. Do not define this property if no parallel chargers exist. - qcom,parallel-allowed-lowering-ma Acceptable current drop from the initial limit to keep parallel charger activated. If the charger current reduces beyond this threshold parallel charger is disabled. Must be specified if parallel charger is used. Example: qcom,qpnp-smbcharger { Loading arch/arm/boot/dts/qcom/msm-pmi8994.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,7 @@ qcom,thermal-mitigation = <1500 700 600 0>; qcom,parallel-usb-min-current-ma = <1400>; qcom,parallel-9v-usb-min-current-ma = <900>; qcom,parallel-allowed-lowering-ma = <500>; regulator-name = "pmi8994_otg_vreg"; qcom,chgr@1000 { Loading drivers/power/qpnp-smbcharger.c +23 −4 Original line number Diff line number Diff line Loading @@ -47,9 +47,11 @@ struct parallel_usb_cfg { struct power_supply *psy; int min_current_thr_ma; int min_9v_current_thr_ma; int allowed_lowering_ma; int current_max_ma; bool avail; struct mutex lock; int initial_aicl_ma; }; struct smbchg_chip { Loading Loading @@ -1159,7 +1161,7 @@ static bool smbchg_is_parallel_usb_ok(struct smbchg_chip *chip) return false; } if (chip->usb_tl_current_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Too little current to enable: %d < %d\n", pr_smb(PR_STATUS, "Weak USB chg skip enable: %d < %d\n", chip->usb_tl_current_ma, min_current_thr_ma); return false; } Loading Loading @@ -1245,6 +1247,7 @@ static void smbchg_parallel_usb_disable(struct smbchg_chip *chip) return; pr_smb(PR_STATUS, "disabling parallel charger\n"); taper_irq_en(chip, false); chip->parallel.initial_aicl_ma = 0; chip->parallel.current_max_ma = 0; power_supply_set_current_limit(parallel_psy, SUSPEND_CURRENT_MA * 1000); Loading Loading @@ -1355,6 +1358,15 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) if (current_limit_ma <= 0) goto disable_parallel; if (chip->parallel.initial_aicl_ma == 0) { if (current_limit_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Initial AICL very low: %d < %d\n", current_limit_ma, min_current_thr_ma); goto disable_parallel; } chip->parallel.initial_aicl_ma = current_limit_ma; } /* * Use the previous set current from the parallel charger. * Treat 2mA as 0 because that is the suspend current setting Loading @@ -1369,9 +1381,14 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) */ total_current_ma = current_limit_ma + parallel_cl_ma; if (total_current_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Too little current to enable: %d < %d\n", total_current_ma, min_current_thr_ma); if (total_current_ma < chip->parallel.initial_aicl_ma - chip->parallel.allowed_lowering_ma) { pr_smb(PR_STATUS, "Too little total current : %d (%d + %d) < %d - %d\n", total_current_ma, current_limit_ma, parallel_cl_ma, chip->parallel.initial_aicl_ma, chip->parallel.allowed_lowering_ma); goto disable_parallel; } Loading Loading @@ -2932,6 +2949,8 @@ static int smb_parse_dt(struct smbchg_chip *chip) "parallel-usb-min-current-ma", rc, 1); OF_PROP_READ(chip, chip->parallel.min_9v_current_thr_ma, "parallel-usb-9v-min-current-ma", rc, 1); OF_PROP_READ(chip, chip->parallel.allowed_lowering_ma, "parallel-allowed-lowering-ma", rc, 1); if (chip->parallel.min_current_thr_ma != -EINVAL) chip->parallel.avail = true; pr_smb(PR_STATUS, "parallel usb thr: %d, 9v thr: %d\n", Loading Loading
Documentation/devicetree/bindings/power/qpnp-smbcharger.txt +5 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,11 @@ Optional Properties: charger if one exists. Do not define this property if no parallel chargers exist. - qcom,parallel-allowed-lowering-ma Acceptable current drop from the initial limit to keep parallel charger activated. If the charger current reduces beyond this threshold parallel charger is disabled. Must be specified if parallel charger is used. Example: qcom,qpnp-smbcharger { Loading
arch/arm/boot/dts/qcom/msm-pmi8994.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,7 @@ qcom,thermal-mitigation = <1500 700 600 0>; qcom,parallel-usb-min-current-ma = <1400>; qcom,parallel-9v-usb-min-current-ma = <900>; qcom,parallel-allowed-lowering-ma = <500>; regulator-name = "pmi8994_otg_vreg"; qcom,chgr@1000 { Loading
drivers/power/qpnp-smbcharger.c +23 −4 Original line number Diff line number Diff line Loading @@ -47,9 +47,11 @@ struct parallel_usb_cfg { struct power_supply *psy; int min_current_thr_ma; int min_9v_current_thr_ma; int allowed_lowering_ma; int current_max_ma; bool avail; struct mutex lock; int initial_aicl_ma; }; struct smbchg_chip { Loading Loading @@ -1159,7 +1161,7 @@ static bool smbchg_is_parallel_usb_ok(struct smbchg_chip *chip) return false; } if (chip->usb_tl_current_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Too little current to enable: %d < %d\n", pr_smb(PR_STATUS, "Weak USB chg skip enable: %d < %d\n", chip->usb_tl_current_ma, min_current_thr_ma); return false; } Loading Loading @@ -1245,6 +1247,7 @@ static void smbchg_parallel_usb_disable(struct smbchg_chip *chip) return; pr_smb(PR_STATUS, "disabling parallel charger\n"); taper_irq_en(chip, false); chip->parallel.initial_aicl_ma = 0; chip->parallel.current_max_ma = 0; power_supply_set_current_limit(parallel_psy, SUSPEND_CURRENT_MA * 1000); Loading Loading @@ -1355,6 +1358,15 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) if (current_limit_ma <= 0) goto disable_parallel; if (chip->parallel.initial_aicl_ma == 0) { if (current_limit_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Initial AICL very low: %d < %d\n", current_limit_ma, min_current_thr_ma); goto disable_parallel; } chip->parallel.initial_aicl_ma = current_limit_ma; } /* * Use the previous set current from the parallel charger. * Treat 2mA as 0 because that is the suspend current setting Loading @@ -1369,9 +1381,14 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) */ total_current_ma = current_limit_ma + parallel_cl_ma; if (total_current_ma < min_current_thr_ma) { pr_smb(PR_STATUS, "Too little current to enable: %d < %d\n", total_current_ma, min_current_thr_ma); if (total_current_ma < chip->parallel.initial_aicl_ma - chip->parallel.allowed_lowering_ma) { pr_smb(PR_STATUS, "Too little total current : %d (%d + %d) < %d - %d\n", total_current_ma, current_limit_ma, parallel_cl_ma, chip->parallel.initial_aicl_ma, chip->parallel.allowed_lowering_ma); goto disable_parallel; } Loading Loading @@ -2932,6 +2949,8 @@ static int smb_parse_dt(struct smbchg_chip *chip) "parallel-usb-min-current-ma", rc, 1); OF_PROP_READ(chip, chip->parallel.min_9v_current_thr_ma, "parallel-usb-9v-min-current-ma", rc, 1); OF_PROP_READ(chip, chip->parallel.allowed_lowering_ma, "parallel-allowed-lowering-ma", rc, 1); if (chip->parallel.min_current_thr_ma != -EINVAL) chip->parallel.avail = true; pr_smb(PR_STATUS, "parallel usb thr: %d, 9v thr: %d\n", Loading