Skip to content

Commit 98d68b7

Browse files
kcxtsre
authored andcommitted
power: supply: qcom_smbx: allow disabling charging
Hook up USBIN_CMD_IL so that writing "0" to the status register will disable charging, this is useful to let users limit charging automatically. Signed-off-by: Casey Connolly <casey.connolly@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20260315-smb2-cherry-pick-v1-1-b2710e470490@ixit.cz Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 0629c33 commit 98d68b7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/power/supply/qcom_smbx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
#define OCP_CHARGER_BIT BIT(1)
135135
#define SDP_CHARGER_BIT BIT(0)
136136

137+
#define USBIN_CMD_IL 0x340
138+
#define USBIN_SUSPEND_BIT BIT(0)
139+
137140
#define TYPE_C_STATUS_1 0x30B
138141
#define UFP_TYPEC_MASK GENMASK(7, 5)
139142
#define UFP_TYPEC_RDSTD_BIT BIT(7)
@@ -693,6 +696,9 @@ static int smb_set_property(struct power_supply *psy,
693696
struct smb_chip *chip = power_supply_get_drvdata(psy);
694697

695698
switch (psp) {
699+
case POWER_SUPPLY_PROP_STATUS:
700+
return regmap_update_bits(chip->regmap, chip->base + USBIN_CMD_IL,
701+
USBIN_SUSPEND_BIT, !val->intval);
696702
case POWER_SUPPLY_PROP_CURRENT_MAX:
697703
return smb_set_current_limit(chip, val->intval);
698704
default:
@@ -705,6 +711,7 @@ static int smb_property_is_writable(struct power_supply *psy,
705711
enum power_supply_property psp)
706712
{
707713
switch (psp) {
714+
case POWER_SUPPLY_PROP_STATUS:
708715
case POWER_SUPPLY_PROP_CURRENT_MAX:
709716
return 1;
710717
default:

0 commit comments

Comments
 (0)