qpnp-smb2: Support faking input current limited state
Support faking input current limited state. This is very helpful in testing/debugging the software based vbus changing algorithms. Change-Id: I7cf548c94397ee680c9d65343c49ec7b16873e88 Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
parent
15a68a61bd
commit
9d0fdc3738
3 changed files with 20 additions and 0 deletions
|
@ -1166,6 +1166,9 @@ static int smb2_batt_set_prop(struct power_supply *psy,
|
||||||
case POWER_SUPPLY_PROP_DP_DM:
|
case POWER_SUPPLY_PROP_DP_DM:
|
||||||
rc = smblib_dp_dm(chg, val->intval);
|
rc = smblib_dp_dm(chg, val->intval);
|
||||||
break;
|
break;
|
||||||
|
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
|
||||||
|
rc = smblib_set_prop_input_current_limited(chg, val);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1183,6 +1186,7 @@ static int smb2_batt_prop_is_writeable(struct power_supply *psy,
|
||||||
case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
|
case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
|
||||||
case POWER_SUPPLY_PROP_DP_DM:
|
case POWER_SUPPLY_PROP_DP_DM:
|
||||||
case POWER_SUPPLY_PROP_RERUN_AICL:
|
case POWER_SUPPLY_PROP_RERUN_AICL:
|
||||||
|
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1707,6 +1707,11 @@ int smblib_get_prop_input_current_limited(struct smb_charger *chg,
|
||||||
u8 stat;
|
u8 stat;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (chg->fake_input_current_limited >= 0) {
|
||||||
|
val->intval = chg->fake_input_current_limited;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
rc = smblib_read(chg, AICL_STATUS_REG, &stat);
|
rc = smblib_read(chg, AICL_STATUS_REG, &stat);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
smblib_err(chg, "Couldn't read AICL_STATUS rc=%d\n", rc);
|
smblib_err(chg, "Couldn't read AICL_STATUS rc=%d\n", rc);
|
||||||
|
@ -1898,6 +1903,13 @@ int smblib_set_prop_charge_qnovo_enable(struct smb_charger *chg,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smblib_set_prop_input_current_limited(struct smb_charger *chg,
|
||||||
|
const union power_supply_propval *val)
|
||||||
|
{
|
||||||
|
chg->fake_input_current_limited = val->intval;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int smblib_rerun_aicl(struct smb_charger *chg)
|
int smblib_rerun_aicl(struct smb_charger *chg)
|
||||||
{
|
{
|
||||||
int rc, settled_icl_ua;
|
int rc, settled_icl_ua;
|
||||||
|
@ -4471,6 +4483,7 @@ int smblib_init(struct smb_charger *chg)
|
||||||
INIT_DELAYED_WORK(&chg->pl_enable_work, smblib_pl_enable_work);
|
INIT_DELAYED_WORK(&chg->pl_enable_work, smblib_pl_enable_work);
|
||||||
INIT_WORK(&chg->legacy_detection_work, smblib_legacy_detection_work);
|
INIT_WORK(&chg->legacy_detection_work, smblib_legacy_detection_work);
|
||||||
chg->fake_capacity = -EINVAL;
|
chg->fake_capacity = -EINVAL;
|
||||||
|
chg->fake_input_current_limited = -EINVAL;
|
||||||
|
|
||||||
switch (chg->mode) {
|
switch (chg->mode) {
|
||||||
case PARALLEL_MASTER:
|
case PARALLEL_MASTER:
|
||||||
|
|
|
@ -318,6 +318,7 @@ struct smb_charger {
|
||||||
bool typec_present;
|
bool typec_present;
|
||||||
u8 typec_status[5];
|
u8 typec_status[5];
|
||||||
bool typec_legacy_valid;
|
bool typec_legacy_valid;
|
||||||
|
int fake_input_current_limited;
|
||||||
|
|
||||||
/* workaround flag */
|
/* workaround flag */
|
||||||
u32 wa_flags;
|
u32 wa_flags;
|
||||||
|
@ -421,6 +422,8 @@ int smblib_set_prop_batt_capacity(struct smb_charger *chg,
|
||||||
const union power_supply_propval *val);
|
const union power_supply_propval *val);
|
||||||
int smblib_set_prop_system_temp_level(struct smb_charger *chg,
|
int smblib_set_prop_system_temp_level(struct smb_charger *chg,
|
||||||
const union power_supply_propval *val);
|
const union power_supply_propval *val);
|
||||||
|
int smblib_set_prop_input_current_limited(struct smb_charger *chg,
|
||||||
|
const union power_supply_propval *val);
|
||||||
|
|
||||||
int smblib_get_prop_dc_present(struct smb_charger *chg,
|
int smblib_get_prop_dc_present(struct smb_charger *chg,
|
||||||
union power_supply_propval *val);
|
union power_supply_propval *val);
|
||||||
|
|
Loading…
Add table
Reference in a new issue