power: qpnp-smbcharger: add support for high current SDP/floating charger
Add support to configure high ICL for SDP chargers, this is useful in case of SDP or floating chargers which supports high current. If 'qcom,override-usb-current' property is present override and set ICL based on current reported by the USB driver otherwise set to USB500 mode. CRs-Fixed: 963417 Change-Id: I31304cd2a4e710f4e450e6ec5a4da90c50fdfc88 Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
This commit is contained in:
parent
53357feb74
commit
979a694b75
|
@ -285,6 +285,9 @@ Optional Properties:
|
|||
detected based on GPIO.
|
||||
- qcom,vchg_sns-adc Phandle of the VADC node.
|
||||
- qcom,vchg-adc-channel-id The ADC channel to which the VCHG is routed.
|
||||
- qcom,override-usb-current A boolean property to override the ICL limit
|
||||
for USB charger(SDP) based on the current
|
||||
reported by USB driver.
|
||||
|
||||
Example:
|
||||
qcom,qpnp-smbcharger {
|
||||
|
|
|
@ -140,6 +140,7 @@ struct smbchg_chip {
|
|||
bool force_aicl_rerun;
|
||||
bool hvdcp3_supported;
|
||||
bool restricted_charging;
|
||||
bool cfg_override_usb_current;
|
||||
u8 original_usbin_allowance;
|
||||
struct parallel_usb_cfg parallel;
|
||||
struct delayed_work parallel_en_work;
|
||||
|
@ -1558,6 +1559,35 @@ static int smbchg_set_usb_current_max(struct smbchg_chip *chip,
|
|||
(chip->wa_flags & SMBCHG_USB100_WA))
|
||||
current_ma = CURRENT_150_MA;
|
||||
|
||||
/* handle special SDP case when USB reports high current */
|
||||
if (current_ma > CURRENT_900_MA) {
|
||||
if (chip->cfg_override_usb_current) {
|
||||
/*
|
||||
* allow setting the current value as reported
|
||||
* by USB driver.
|
||||
*/
|
||||
rc = smbchg_set_high_usb_chg_current(chip,
|
||||
current_ma);
|
||||
if (rc < 0) {
|
||||
pr_err("Couldn't set %dmA rc = %d\n",
|
||||
current_ma, rc);
|
||||
goto out;
|
||||
}
|
||||
rc = smbchg_masked_write(chip,
|
||||
chip->usb_chgpth_base + CMD_IL,
|
||||
ICL_OVERRIDE_BIT, ICL_OVERRIDE_BIT);
|
||||
if (rc < 0)
|
||||
pr_err("Couldn't set ICL override rc = %d\n",
|
||||
rc);
|
||||
} else {
|
||||
/* default to 500mA */
|
||||
current_ma = CURRENT_500_MA;
|
||||
}
|
||||
pr_smb(PR_STATUS,
|
||||
"override_usb_current=%d current_ma set to %d\n",
|
||||
chip->cfg_override_usb_current, current_ma);
|
||||
}
|
||||
|
||||
if (current_ma < CURRENT_150_MA) {
|
||||
/* force 100mA */
|
||||
rc = smbchg_sec_masked_write(chip,
|
||||
|
@ -7079,6 +7109,10 @@ static int smb_parse_dt(struct smbchg_chip *chip)
|
|||
chip->skip_usb_notification
|
||||
= of_property_read_bool(node,
|
||||
"qcom,skip-usb-notification");
|
||||
|
||||
chip->cfg_override_usb_current = of_property_read_bool(node,
|
||||
"qcom,override-usb-current");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue