Loading drivers/power/smb-lib.c +24 −8 Original line number Diff line number Diff line Loading @@ -2654,17 +2654,13 @@ int smblib_set_prop_usb_voltage_max(struct smb_charger *chg, return rc; } int smblib_set_prop_pd_active(struct smb_charger *chg, const union power_supply_propval *val) static int __smblib_set_prop_pd_active(struct smb_charger *chg, bool pd_active) { int rc; bool orientation, sink_attached, hvdcp; u8 stat; if (!get_effective_result(chg->pd_allowed_votable)) return -EINVAL; chg->pd_active = val->intval; chg->pd_active = pd_active; if (chg->pd_active) { vote(chg->apsd_disable_votable, PD_VOTER, true, 0); vote(chg->pd_allowed_votable, PD_VOTER, true, 0); Loading Loading @@ -2752,6 +2748,15 @@ int smblib_set_prop_pd_active(struct smb_charger *chg, return rc; } int smblib_set_prop_pd_active(struct smb_charger *chg, const union power_supply_propval *val) { if (!get_effective_result(chg->pd_allowed_votable)) return -EINVAL; return __smblib_set_prop_pd_active(chg, val->intval); } int smblib_set_prop_ship_mode(struct smb_charger *chg, const union power_supply_propval *val) { Loading Loading @@ -3496,6 +3501,13 @@ static void smblib_handle_hvdcp_check_timeout(struct smb_charger *chg, /* enforce DCP ICL if specified */ vote(chg->usb_icl_votable, DCP_VOTER, chg->dcp_icl_ua != -EINVAL, chg->dcp_icl_ua); /* * if pd is not allowed, then set pd_active = false right here, * so that it starts the hvdcp engine */ if (!get_effective_result(chg->pd_allowed_votable)) __smblib_set_prop_pd_active(chg, 0); } smblib_dbg(chg, PR_INTERRUPT, "IRQ: smblib_handle_hvdcp_check_timeout %s\n", Loading Loading @@ -4469,7 +4481,9 @@ static void smblib_legacy_detection_work(struct work_struct *work) smblib_err(chg, "Couldn't disable type-c rc=%d\n", rc); /* wait for the adapter to turn off VBUS */ msleep(500); msleep(1000); smblib_dbg(chg, PR_MISC, "legacy workaround enabling typec\n"); rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG, Loading @@ -4478,7 +4492,7 @@ static void smblib_legacy_detection_work(struct work_struct *work) smblib_err(chg, "Couldn't enable type-c rc=%d\n", rc); /* wait for type-c detection to complete */ msleep(100); msleep(400); rc = smblib_read(chg, TYPE_C_STATUS_5_REG, &stat); if (rc < 0) { Loading @@ -4490,6 +4504,8 @@ static void smblib_legacy_detection_work(struct work_struct *work) vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, false, 0); legacy = stat & TYPEC_LEGACY_CABLE_STATUS_BIT; rp_high = chg->typec_mode == POWER_SUPPLY_TYPEC_SOURCE_HIGH; smblib_dbg(chg, PR_MISC, "legacy workaround done legacy = %d rp_high = %d\n", legacy, rp_high); if (!legacy || !rp_high) vote(chg->hvdcp_disable_votable_indirect, VBUS_CC_SHORT_VOTER, false, 0); Loading Loading
drivers/power/smb-lib.c +24 −8 Original line number Diff line number Diff line Loading @@ -2654,17 +2654,13 @@ int smblib_set_prop_usb_voltage_max(struct smb_charger *chg, return rc; } int smblib_set_prop_pd_active(struct smb_charger *chg, const union power_supply_propval *val) static int __smblib_set_prop_pd_active(struct smb_charger *chg, bool pd_active) { int rc; bool orientation, sink_attached, hvdcp; u8 stat; if (!get_effective_result(chg->pd_allowed_votable)) return -EINVAL; chg->pd_active = val->intval; chg->pd_active = pd_active; if (chg->pd_active) { vote(chg->apsd_disable_votable, PD_VOTER, true, 0); vote(chg->pd_allowed_votable, PD_VOTER, true, 0); Loading Loading @@ -2752,6 +2748,15 @@ int smblib_set_prop_pd_active(struct smb_charger *chg, return rc; } int smblib_set_prop_pd_active(struct smb_charger *chg, const union power_supply_propval *val) { if (!get_effective_result(chg->pd_allowed_votable)) return -EINVAL; return __smblib_set_prop_pd_active(chg, val->intval); } int smblib_set_prop_ship_mode(struct smb_charger *chg, const union power_supply_propval *val) { Loading Loading @@ -3496,6 +3501,13 @@ static void smblib_handle_hvdcp_check_timeout(struct smb_charger *chg, /* enforce DCP ICL if specified */ vote(chg->usb_icl_votable, DCP_VOTER, chg->dcp_icl_ua != -EINVAL, chg->dcp_icl_ua); /* * if pd is not allowed, then set pd_active = false right here, * so that it starts the hvdcp engine */ if (!get_effective_result(chg->pd_allowed_votable)) __smblib_set_prop_pd_active(chg, 0); } smblib_dbg(chg, PR_INTERRUPT, "IRQ: smblib_handle_hvdcp_check_timeout %s\n", Loading Loading @@ -4469,7 +4481,9 @@ static void smblib_legacy_detection_work(struct work_struct *work) smblib_err(chg, "Couldn't disable type-c rc=%d\n", rc); /* wait for the adapter to turn off VBUS */ msleep(500); msleep(1000); smblib_dbg(chg, PR_MISC, "legacy workaround enabling typec\n"); rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG, Loading @@ -4478,7 +4492,7 @@ static void smblib_legacy_detection_work(struct work_struct *work) smblib_err(chg, "Couldn't enable type-c rc=%d\n", rc); /* wait for type-c detection to complete */ msleep(100); msleep(400); rc = smblib_read(chg, TYPE_C_STATUS_5_REG, &stat); if (rc < 0) { Loading @@ -4490,6 +4504,8 @@ static void smblib_legacy_detection_work(struct work_struct *work) vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, false, 0); legacy = stat & TYPEC_LEGACY_CABLE_STATUS_BIT; rp_high = chg->typec_mode == POWER_SUPPLY_TYPEC_SOURCE_HIGH; smblib_dbg(chg, PR_MISC, "legacy workaround done legacy = %d rp_high = %d\n", legacy, rp_high); if (!legacy || !rp_high) vote(chg->hvdcp_disable_votable_indirect, VBUS_CC_SHORT_VOTER, false, 0); Loading