Loading drivers/power/supply/qcom/qpnp-smb5.c +6 −19 Original line number Diff line number Diff line Loading @@ -1846,7 +1846,6 @@ static int smb5_configure_typec(struct smb_charger *chg) } smblib_apsd_enable(chg, true); smblib_hvdcp_detect_enable(chg, false); rc = smblib_masked_write(chg, TYPE_C_CFG_REG, BC1P2_START_ON_CC_BIT, 0); Loading Loading @@ -2374,24 +2373,12 @@ static int smb5_init_hw(struct smb5 *chip) } } /* * Disable HVDCP autonomous mode operation by default, providing a DT * knob to turn it on if required. Additionally, if specified in DT, * disable HVDCP and HVDCP authentication algorithm. */ val = (chg->hvdcp_disable) ? 0 : (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT); if (chip->dt.hvdcp_autonomous) val |= HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT | HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT), val); if (rc < 0) { dev_err(chg->dev, "Couldn't configure HVDCP rc=%d\n", rc); return rc; } /* Set HVDCP autonomous mode per DT option */ smblib_hvdcp_hw_inov_enable(chg, chip->dt.hvdcp_autonomous); /* Disable HVDCP and authentication algorithm if specified in DT */ if (chg->hvdcp_disable) smblib_hvdcp_detect_enable(chg, false); rc = smb5_init_connector_type(chg); if (rc < 0) { Loading drivers/power/supply/qcom/smb5-lib.c +21 −7 Original line number Diff line number Diff line Loading @@ -904,17 +904,31 @@ void smblib_hvdcp_detect_enable(struct smb_charger *chg, bool enable) int rc; u8 mask; if (chg->hvdcp_disable || chg->pd_not_supported) return; mask = HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, mask, enable ? mask : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); } static void smblib_hvdcp_detect_try_enable(struct smb_charger *chg, bool enable) { if (chg->hvdcp_disable || chg->pd_not_supported) return; smblib_hvdcp_detect_enable(chg, enable); } void smblib_hvdcp_hw_inov_enable(struct smb_charger *chg, bool enable) { int rc; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, enable ? HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); } void smblib_hvdcp_exit_config(struct smb_charger *chg) Loading Loading @@ -4004,7 +4018,7 @@ int smblib_set_prop_pd_active(struct smb_charger *chg, /* PD hard resets failed, proceed to detect QC2/3 */ if (chg->ok_to_pd) { chg->ok_to_pd = false; smblib_hvdcp_detect_enable(chg, true); smblib_hvdcp_detect_try_enable(chg, true); } } Loading Loading @@ -5121,7 +5135,7 @@ static void typec_src_insertion(struct smb_charger *chg) /* allow apsd proceed to detect QC2/3 */ if (!chg->ok_to_pd) smblib_hvdcp_detect_enable(chg, true); smblib_hvdcp_detect_try_enable(chg, true); } static void typec_sink_removal(struct smb_charger *chg) Loading Loading @@ -5158,7 +5172,7 @@ static void typec_src_removal(struct smb_charger *chg) "Couldn't disable secondary charger rc=%d\n", rc); typec_src_fault_condition_cfg(chg, false); smblib_hvdcp_detect_enable(chg, false); smblib_hvdcp_detect_try_enable(chg, false); smblib_update_usb_type(chg); if (chg->wa_flags & BOOST_BACK_WA) { Loading drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -722,6 +722,7 @@ enum alarmtimer_restart smblib_lpd_recheck_timer(struct alarm *alarm, ktime_t time); int smblib_toggle_smb_en(struct smb_charger *chg, int toggle); void smblib_hvdcp_detect_enable(struct smb_charger *chg, bool enable); void smblib_hvdcp_hw_inov_enable(struct smb_charger *chg, bool enable); void smblib_hvdcp_exit_config(struct smb_charger *chg); void smblib_apsd_enable(struct smb_charger *chg, bool enable); int smblib_force_vbus_voltage(struct smb_charger *chg, u8 val); Loading Loading
drivers/power/supply/qcom/qpnp-smb5.c +6 −19 Original line number Diff line number Diff line Loading @@ -1846,7 +1846,6 @@ static int smb5_configure_typec(struct smb_charger *chg) } smblib_apsd_enable(chg, true); smblib_hvdcp_detect_enable(chg, false); rc = smblib_masked_write(chg, TYPE_C_CFG_REG, BC1P2_START_ON_CC_BIT, 0); Loading Loading @@ -2374,24 +2373,12 @@ static int smb5_init_hw(struct smb5 *chip) } } /* * Disable HVDCP autonomous mode operation by default, providing a DT * knob to turn it on if required. Additionally, if specified in DT, * disable HVDCP and HVDCP authentication algorithm. */ val = (chg->hvdcp_disable) ? 0 : (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT); if (chip->dt.hvdcp_autonomous) val |= HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT | HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT), val); if (rc < 0) { dev_err(chg->dev, "Couldn't configure HVDCP rc=%d\n", rc); return rc; } /* Set HVDCP autonomous mode per DT option */ smblib_hvdcp_hw_inov_enable(chg, chip->dt.hvdcp_autonomous); /* Disable HVDCP and authentication algorithm if specified in DT */ if (chg->hvdcp_disable) smblib_hvdcp_detect_enable(chg, false); rc = smb5_init_connector_type(chg); if (rc < 0) { Loading
drivers/power/supply/qcom/smb5-lib.c +21 −7 Original line number Diff line number Diff line Loading @@ -904,17 +904,31 @@ void smblib_hvdcp_detect_enable(struct smb_charger *chg, bool enable) int rc; u8 mask; if (chg->hvdcp_disable || chg->pd_not_supported) return; mask = HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, mask, enable ? mask : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); } static void smblib_hvdcp_detect_try_enable(struct smb_charger *chg, bool enable) { if (chg->hvdcp_disable || chg->pd_not_supported) return; smblib_hvdcp_detect_enable(chg, enable); } void smblib_hvdcp_hw_inov_enable(struct smb_charger *chg, bool enable) { int rc; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, enable ? HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); } void smblib_hvdcp_exit_config(struct smb_charger *chg) Loading Loading @@ -4004,7 +4018,7 @@ int smblib_set_prop_pd_active(struct smb_charger *chg, /* PD hard resets failed, proceed to detect QC2/3 */ if (chg->ok_to_pd) { chg->ok_to_pd = false; smblib_hvdcp_detect_enable(chg, true); smblib_hvdcp_detect_try_enable(chg, true); } } Loading Loading @@ -5121,7 +5135,7 @@ static void typec_src_insertion(struct smb_charger *chg) /* allow apsd proceed to detect QC2/3 */ if (!chg->ok_to_pd) smblib_hvdcp_detect_enable(chg, true); smblib_hvdcp_detect_try_enable(chg, true); } static void typec_sink_removal(struct smb_charger *chg) Loading Loading @@ -5158,7 +5172,7 @@ static void typec_src_removal(struct smb_charger *chg) "Couldn't disable secondary charger rc=%d\n", rc); typec_src_fault_condition_cfg(chg, false); smblib_hvdcp_detect_enable(chg, false); smblib_hvdcp_detect_try_enable(chg, false); smblib_update_usb_type(chg); if (chg->wa_flags & BOOST_BACK_WA) { Loading
drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -722,6 +722,7 @@ enum alarmtimer_restart smblib_lpd_recheck_timer(struct alarm *alarm, ktime_t time); int smblib_toggle_smb_en(struct smb_charger *chg, int toggle); void smblib_hvdcp_detect_enable(struct smb_charger *chg, bool enable); void smblib_hvdcp_hw_inov_enable(struct smb_charger *chg, bool enable); void smblib_hvdcp_exit_config(struct smb_charger *chg); void smblib_apsd_enable(struct smb_charger *chg, bool enable); int smblib_force_vbus_voltage(struct smb_charger *chg, u8 val); Loading