Loading drivers/power/qpnp-smbcharger.c +42 −4 Original line number Diff line number Diff line Loading @@ -1522,10 +1522,10 @@ static int smbchg_set_fastchg_current_raw(struct smbchg_chip *chip, dev_err(chip->dev, "cannot write to fcc cfg rc = %d\n", rc); return rc; } pr_smb(PR_STATUS, "fastcharge current set to %d\n", current_ma); pr_smb(PR_STATUS, "fastcharge current requested %d, set to %d\n", current_ma, usb_current_table[cur_val]); chip->fastchg_current_ma = usb_current_table[i]; chip->fastchg_current_ma = usb_current_table[cur_val]; return rc; } Loading Loading @@ -1716,6 +1716,7 @@ static int smbchg_get_aicl_level_ma(struct smbchg_chip *chip) return usb_current_table[reg]; } #define PARALLEL_CHG_THRESHOLD_CURRENT 1800 static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) { struct power_supply *parallel_psy = get_parallel_psy(chip); Loading @@ -1727,6 +1728,12 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) return; pr_smb(PR_STATUS, "Attempting to enable parallel charger\n"); /* Suspend the parallel charger if the charging current is < 1800 mA */ if (chip->cfg_fastchg_current_ma < PARALLEL_CHG_THRESHOLD_CURRENT) { pr_smb(PR_STATUS, "suspend parallel charger as FCC is %d\n", chip->cfg_fastchg_current_ma); goto disable_parallel; } min_current_thr_ma = smbchg_get_min_parallel_current_ma(chip); if (min_current_thr_ma <= 0) { pr_smb(PR_STATUS, "parallel charger unavailable for thr: %d\n", Loading Loading @@ -1858,6 +1865,37 @@ static int smbchg_usb_en(struct smbchg_chip *chip, bool enable, return rc; } static int smbchg_set_fastchg_current_user(struct smbchg_chip *chip, int current_ma) { int rc = 0; mutex_lock(&chip->parallel.lock); pr_smb(PR_STATUS, "User setting FCC to %d\n", current_ma); chip->cfg_fastchg_current_ma = current_ma; if (smbchg_is_parallel_usb_ok(chip)) { smbchg_parallel_usb_enable(chip); } else { if (chip->parallel.current_max_ma != 0) { /* * If parallel charging is not available, disable it. * FCC for main charger will be configured in that. */ pr_smb(PR_STATUS, "parallel charging unavailable\n"); smbchg_parallel_usb_disable(chip); goto out; } rc = smbchg_set_fastchg_current(chip, chip->cfg_fastchg_current_ma); if (rc) pr_err("Couldn't set fastchg current rc: %d\n", rc); } out: mutex_unlock(&chip->parallel.lock); return rc; } static struct ilim_entry *smbchg_wipower_find_entry(struct smbchg_chip *chip, struct ilim_map *map, int uv) { Loading Loading @@ -2466,7 +2504,7 @@ static int smbchg_battery_set_property(struct power_supply *psy, smbchg_system_temp_level_set(chip, val->intval); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: rc = smbchg_set_fastchg_current(chip, val->intval / 1000); rc = smbchg_set_fastchg_current_user(chip, val->intval / 1000); break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: rc = smbchg_float_voltage_set(chip, val->intval); Loading Loading
drivers/power/qpnp-smbcharger.c +42 −4 Original line number Diff line number Diff line Loading @@ -1522,10 +1522,10 @@ static int smbchg_set_fastchg_current_raw(struct smbchg_chip *chip, dev_err(chip->dev, "cannot write to fcc cfg rc = %d\n", rc); return rc; } pr_smb(PR_STATUS, "fastcharge current set to %d\n", current_ma); pr_smb(PR_STATUS, "fastcharge current requested %d, set to %d\n", current_ma, usb_current_table[cur_val]); chip->fastchg_current_ma = usb_current_table[i]; chip->fastchg_current_ma = usb_current_table[cur_val]; return rc; } Loading Loading @@ -1716,6 +1716,7 @@ static int smbchg_get_aicl_level_ma(struct smbchg_chip *chip) return usb_current_table[reg]; } #define PARALLEL_CHG_THRESHOLD_CURRENT 1800 static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) { struct power_supply *parallel_psy = get_parallel_psy(chip); Loading @@ -1727,6 +1728,12 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip) return; pr_smb(PR_STATUS, "Attempting to enable parallel charger\n"); /* Suspend the parallel charger if the charging current is < 1800 mA */ if (chip->cfg_fastchg_current_ma < PARALLEL_CHG_THRESHOLD_CURRENT) { pr_smb(PR_STATUS, "suspend parallel charger as FCC is %d\n", chip->cfg_fastchg_current_ma); goto disable_parallel; } min_current_thr_ma = smbchg_get_min_parallel_current_ma(chip); if (min_current_thr_ma <= 0) { pr_smb(PR_STATUS, "parallel charger unavailable for thr: %d\n", Loading Loading @@ -1858,6 +1865,37 @@ static int smbchg_usb_en(struct smbchg_chip *chip, bool enable, return rc; } static int smbchg_set_fastchg_current_user(struct smbchg_chip *chip, int current_ma) { int rc = 0; mutex_lock(&chip->parallel.lock); pr_smb(PR_STATUS, "User setting FCC to %d\n", current_ma); chip->cfg_fastchg_current_ma = current_ma; if (smbchg_is_parallel_usb_ok(chip)) { smbchg_parallel_usb_enable(chip); } else { if (chip->parallel.current_max_ma != 0) { /* * If parallel charging is not available, disable it. * FCC for main charger will be configured in that. */ pr_smb(PR_STATUS, "parallel charging unavailable\n"); smbchg_parallel_usb_disable(chip); goto out; } rc = smbchg_set_fastchg_current(chip, chip->cfg_fastchg_current_ma); if (rc) pr_err("Couldn't set fastchg current rc: %d\n", rc); } out: mutex_unlock(&chip->parallel.lock); return rc; } static struct ilim_entry *smbchg_wipower_find_entry(struct smbchg_chip *chip, struct ilim_map *map, int uv) { Loading Loading @@ -2466,7 +2504,7 @@ static int smbchg_battery_set_property(struct power_supply *psy, smbchg_system_temp_level_set(chip, val->intval); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: rc = smbchg_set_fastchg_current(chip, val->intval / 1000); rc = smbchg_set_fastchg_current_user(chip, val->intval / 1000); break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: rc = smbchg_float_voltage_set(chip, val->intval); Loading