[PATCH 06/11] power: supply: qcom_smbx: respect battery charge-term-current-microamp

From: Casey Connolly
Date: Thu Jun 19 2025 - 10:57:20 EST


Respect the max current limit set on the battery node, one some devices
this is set conservatively to avoid overheating since they only have a
single charger IC (instead of two in parallel).

Signed-off-by: Casey Connolly <casey.connolly@xxxxxxxxxx>
---
drivers/power/supply/qcom_smbx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/qcom_smbx.c b/drivers/power/supply/qcom_smbx.c
index fc2a8e20435639a9da4d966c43271beaeb57a03f..7fc232fa7260a7422ac12a48686cd7d396edd9a4 100644
--- a/drivers/power/supply/qcom_smbx.c
+++ b/drivers/power/supply/qcom_smbx.c
@@ -583,9 +583,9 @@ static void smb_status_change_work(struct work_struct *work)
case POWER_SUPPLY_USB_TYPE_CDP:
current_ua = CDP_CURRENT_UA;
break;
case POWER_SUPPLY_USB_TYPE_DCP:
- current_ua = DCP_CURRENT_UA;
+ current_ua = chip->batt_info->constant_charge_current_max_ua;
break;
case POWER_SUPPLY_USB_TYPE_SDP:
default:
current_ua = SDP_CURRENT_UA;
@@ -989,8 +989,10 @@ static int smb_probe(struct platform_device *pdev)
rc = power_supply_get_battery_info(chip->chg_psy, &chip->batt_info);
if (rc)
return dev_err_probe(chip->dev, rc,
"Failed to get battery info\n");
+ if (chip->batt_info->constant_charge_current_max_ua == -EINVAL)
+ chip->batt_info->constant_charge_current_max_ua = DCP_CURRENT_UA;

rc = devm_delayed_work_autocancel(chip->dev, &chip->status_change_work,
smb_status_change_work);
if (rc)

--
2.49.0