diff --git a/drivers/power/supply/qcom/smb5-iio.c b/drivers/power/supply/qcom/smb5-iio.c index c3cdd4416588..7a2f368b82dd 100644 --- a/drivers/power/supply/qcom/smb5-iio.c +++ b/drivers/power/supply/qcom/smb5-iio.c @@ -266,6 +266,9 @@ int smb5_iio_get_prop(struct smb_charger *chg, int channel, int *val) case PSY_IIO_TYPEC_ACCESSORY_MODE: rc = smblib_get_usb_prop_typec_accessory_mode(chg, val); break; + case PSY_IIO_CHARGING_ENABLED: + *val = !get_effective_result(chg->chg_disable_votable); + break; default: pr_err("get prop %d is not supported\n", channel); rc = -EINVAL; @@ -495,6 +498,9 @@ int smb5_iio_set_prop(struct smb_charger *chg, int channel, int val) case PSY_IIO_FCC_STEPPER_ENABLE: chg->fcc_stepper_enable = val; break; + case PSY_IIO_CHARGING_ENABLED: + vote(chg->chg_disable_votable, USER_VOTER, !!!val, 0); + break; default: pr_err("get prop %d is not supported\n", channel); rc = -EINVAL; diff --git a/drivers/power/supply/qcom/smb5-iio.h b/drivers/power/supply/qcom/smb5-iio.h index 40753d0d28a2..800deefe37d0 100644 --- a/drivers/power/supply/qcom/smb5-iio.h +++ b/drivers/power/supply/qcom/smb5-iio.h @@ -201,6 +201,7 @@ static const struct smb5_iio_prop_channels smb5_chans_pmic[] = { SMB5_CHAN_ACTIVITY("battery_force_recharge", FORCE_RECHARGE) SMB5_CHAN_ACTIVITY("battery_fcc_stepper_enable", FCC_STEPPER_ENABLE) SMB5_CHAN_INDEX("usb_typec_accessory_mode", TYPEC_ACCESSORY_MODE) + SMB5_CHAN_INDEX("charging_enabled", CHARGING_ENABLED) }; struct iio_channel **get_ext_channels(struct device *dev, diff --git a/include/dt-bindings/iio/qti_power_supply_iio.h b/include/dt-bindings/iio/qti_power_supply_iio.h index 84611eb3bcc6..d4bd059af5f5 100644 --- a/include/dt-bindings/iio/qti_power_supply_iio.h +++ b/include/dt-bindings/iio/qti_power_supply_iio.h @@ -154,4 +154,10 @@ /* BMS */ #define PSY_IIO_CLEAR_SOH 0x7c + +/*MMI add PSY_IIO properties*/ +#define PSY_IIO_MMI_CP_INPUT_CURRENT_NOW 0x100 +#define PSY_IIO_MMI_CP_INPUT_VOLTAGE_NOW 0x101 +#define PSY_IIO_MMI_CP_STATUS1 0x102 +#define PSY_IIO_MMI_CP_CLEAR_ERROR 0x103 #endif /* __QTI_POWER_SUPPLY_IIO_H__ */