smb5: add main charging on-off IIO prop

1. add main charging on-off IIO prop
2. define more mmi IIO prop for charger pump

Change-Id: Iaf49f816b53d64bb61e44fcb82fc25d8d7dd72dd
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1940727
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
mahj8 2021-05-20 12:57:41 +08:00 • committed by Xiaojun Ji
commit 5f87bbb9ec
3 changed files with 13 additions and 0 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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__ */