Loading drivers/power/supply/qcom/smb5-lib.c +15 −3 Original line number Diff line number Diff line Loading @@ -5028,11 +5028,23 @@ static bool smblib_src_lpd(struct smb_charger *chg) return lpd_flag; } static void typec_src_fault_condition_cfg(struct smb_charger *chg, bool src) { int rc; u8 mask = USBIN_MID_COMP_FAULT_EN_BIT | USBIN_COLLAPSE_FAULT_EN_BIT; rc = smblib_masked_write(chg, OTG_FAULT_CONDITION_CFG_REG, mask, src ? 0 : mask); if (rc < 0) smblib_err(chg, "Couldn't write OTG_FAULT_CONDITION_CFG_REG rc=%d\n", rc); } static void typec_sink_insertion(struct smb_charger *chg) { int rc; vote(chg->usb_icl_votable, OTG_VOTER, true, 0); typec_src_fault_condition_cfg(chg, true); rc = smblib_set_charge_param(chg, &chg->param.freq_switcher, chg->chg_freq.freq_above_otg_threshold); if (rc < 0) Loading Loading @@ -5076,7 +5088,7 @@ static void typec_sink_removal(struct smb_charger *chg) { int rc; vote(chg->usb_icl_votable, OTG_VOTER, false, 0); typec_src_fault_condition_cfg(chg, false); rc = smblib_set_charge_param(chg, &chg->param.freq_switcher, chg->chg_freq.freq_removal); if (rc < 0) Loading Loading @@ -5105,6 +5117,7 @@ static void typec_src_removal(struct smb_charger *chg) dev_err(chg->dev, "Couldn't disable secondary charger rc=%d\n", rc); typec_src_fault_condition_cfg(chg, false); smblib_hvdcp_detect_enable(chg, false); smblib_update_usb_type(chg); Loading @@ -5131,7 +5144,6 @@ static void typec_src_removal(struct smb_charger *chg) vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0); vote(chg->usb_icl_votable, DCP_VOTER, false, 0); vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0); vote(chg->usb_icl_votable, OTG_VOTER, false, 0); vote(chg->usb_icl_votable, CTM_VOTER, false, 0); vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0); vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); Loading drivers/power/supply/qcom/smb5-lib.h +0 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ enum print_reason { #define OTG_DELAY_VOTER "OTG_DELAY_VOTER" #define USBIN_I_VOTER "USBIN_I_VOTER" #define WEAK_CHARGER_VOTER "WEAK_CHARGER_VOTER" #define OTG_VOTER "OTG_VOTER" #define PL_FCC_LOW_VOTER "PL_FCC_LOW_VOTER" #define WBC_VOTER "WBC_VOTER" #define HW_LIMIT_VOTER "HW_LIMIT_VOTER" Loading drivers/power/supply/qcom/smb5-reg.h +4 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ enum { #define DCDC_OTG_CFG_REG (DCDC_BASE + 0x53) #define OTG_EN_SRC_CFG_BIT BIT(1) #define OTG_FAULT_CONDITION_CFG_REG (DCDC_BASE + 0x56) #define USBIN_MID_COMP_FAULT_EN_BIT BIT(5) #define USBIN_COLLAPSE_FAULT_EN_BIT BIT(4) #define DCDC_CFG_REF_MAX_PSNS_REG (DCDC_BASE + 0x8C) #define DCDC_ENG_SDCDC_CFG5_REG (DCDC_BASE + 0xC4) Loading Loading
drivers/power/supply/qcom/smb5-lib.c +15 −3 Original line number Diff line number Diff line Loading @@ -5028,11 +5028,23 @@ static bool smblib_src_lpd(struct smb_charger *chg) return lpd_flag; } static void typec_src_fault_condition_cfg(struct smb_charger *chg, bool src) { int rc; u8 mask = USBIN_MID_COMP_FAULT_EN_BIT | USBIN_COLLAPSE_FAULT_EN_BIT; rc = smblib_masked_write(chg, OTG_FAULT_CONDITION_CFG_REG, mask, src ? 0 : mask); if (rc < 0) smblib_err(chg, "Couldn't write OTG_FAULT_CONDITION_CFG_REG rc=%d\n", rc); } static void typec_sink_insertion(struct smb_charger *chg) { int rc; vote(chg->usb_icl_votable, OTG_VOTER, true, 0); typec_src_fault_condition_cfg(chg, true); rc = smblib_set_charge_param(chg, &chg->param.freq_switcher, chg->chg_freq.freq_above_otg_threshold); if (rc < 0) Loading Loading @@ -5076,7 +5088,7 @@ static void typec_sink_removal(struct smb_charger *chg) { int rc; vote(chg->usb_icl_votable, OTG_VOTER, false, 0); typec_src_fault_condition_cfg(chg, false); rc = smblib_set_charge_param(chg, &chg->param.freq_switcher, chg->chg_freq.freq_removal); if (rc < 0) Loading Loading @@ -5105,6 +5117,7 @@ static void typec_src_removal(struct smb_charger *chg) dev_err(chg->dev, "Couldn't disable secondary charger rc=%d\n", rc); typec_src_fault_condition_cfg(chg, false); smblib_hvdcp_detect_enable(chg, false); smblib_update_usb_type(chg); Loading @@ -5131,7 +5144,6 @@ static void typec_src_removal(struct smb_charger *chg) vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0); vote(chg->usb_icl_votable, DCP_VOTER, false, 0); vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0); vote(chg->usb_icl_votable, OTG_VOTER, false, 0); vote(chg->usb_icl_votable, CTM_VOTER, false, 0); vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0); vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); Loading
drivers/power/supply/qcom/smb5-lib.h +0 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ enum print_reason { #define OTG_DELAY_VOTER "OTG_DELAY_VOTER" #define USBIN_I_VOTER "USBIN_I_VOTER" #define WEAK_CHARGER_VOTER "WEAK_CHARGER_VOTER" #define OTG_VOTER "OTG_VOTER" #define PL_FCC_LOW_VOTER "PL_FCC_LOW_VOTER" #define WBC_VOTER "WBC_VOTER" #define HW_LIMIT_VOTER "HW_LIMIT_VOTER" Loading
drivers/power/supply/qcom/smb5-reg.h +4 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ enum { #define DCDC_OTG_CFG_REG (DCDC_BASE + 0x53) #define OTG_EN_SRC_CFG_BIT BIT(1) #define OTG_FAULT_CONDITION_CFG_REG (DCDC_BASE + 0x56) #define USBIN_MID_COMP_FAULT_EN_BIT BIT(5) #define USBIN_COLLAPSE_FAULT_EN_BIT BIT(4) #define DCDC_CFG_REF_MAX_PSNS_REG (DCDC_BASE + 0x8C) #define DCDC_ENG_SDCDC_CFG5_REG (DCDC_BASE + 0xC4) Loading