case POWER_SUPPLY_PROP_CURRENT_MAX:
rc = smblib_set_prop_usb_current_max(chg, val);
break;
+ case POWER_SUPPLY_PROP_TYPE:
+ if (chg->pd_active && val->intval == POWER_SUPPLY_TYPE_USB_PD) {
+ chg->usb_psy_desc.type = val->intval;
+ } else {
+ pr_err("set type %d not allowed\n", val->intval);
+ rc = -EINVAL;
+ }
+ break;
case POWER_SUPPLY_PROP_TYPEC_POWER_ROLE:
rc = smblib_set_prop_typec_power_role(chg, val);
break;
int rc = 0;
const struct apsd_result *apsd_result;
- if (chg->pd_active) {
- chg->usb_psy_desc.type = POWER_SUPPLY_TYPE_USB_PD;
+ /* if PD is active, APSD is disabled so won't have a valid result */
+ if (chg->pd_active)
return rc;
- }
apsd_result = smblib_get_apsd_result(chg);
chg->usb_psy_desc.type = apsd_result->pst;
int rc;
cancel_delayed_work_sync(&chg->hvdcp_detect_work);
-
- rc = smblib_update_usb_type(chg);
- if (rc < 0) {
- dev_err(chg->dev, "Couldn't update usb type rc=%d\n", rc);
- return rc;
- }
+ chg->usb_psy_desc.type = POWER_SUPPLY_TYPE_UNKNOWN;
/* reconfigure allowed voltage for HVDCP */
rc = smblib_write(chg, USBIN_ADAPTER_ALLOW_CFG_REG,