mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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>
This commit is contained in:
committed by
Sebastian Reichel
parent
0629c33fe1
commit
98d68b74eb
@@ -134,6 +134,9 @@
|
||||
#define OCP_CHARGER_BIT BIT(1)
|
||||
#define SDP_CHARGER_BIT BIT(0)
|
||||
|
||||
#define USBIN_CMD_IL 0x340
|
||||
#define USBIN_SUSPEND_BIT BIT(0)
|
||||
|
||||
#define TYPE_C_STATUS_1 0x30B
|
||||
#define UFP_TYPEC_MASK GENMASK(7, 5)
|
||||
#define UFP_TYPEC_RDSTD_BIT BIT(7)
|
||||
@@ -693,6 +696,9 @@ static int smb_set_property(struct power_supply *psy,
|
||||
struct smb_chip *chip = power_supply_get_drvdata(psy);
|
||||
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
return regmap_update_bits(chip->regmap, chip->base + USBIN_CMD_IL,
|
||||
USBIN_SUSPEND_BIT, !val->intval);
|
||||
case POWER_SUPPLY_PROP_CURRENT_MAX:
|
||||
return smb_set_current_limit(chip, val->intval);
|
||||
default:
|
||||
@@ -705,6 +711,7 @@ static int smb_property_is_writable(struct power_supply *psy,
|
||||
enum power_supply_property psp)
|
||||
{
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
case POWER_SUPPLY_PROP_CURRENT_MAX:
|
||||
return 1;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user