Loading drivers/power/supply/qcom/qpnp-smb2.c +1 −1 Original line number Diff line number Diff line Loading @@ -1819,7 +1819,7 @@ static int smb2_chg_config_init(struct smb2 *chip) break; case PM660_SUBTYPE: chip->chg.smb_version = PM660_SUBTYPE; chip->chg.wa_flags |= BOOST_BACK_WA | OTG_WA; chip->chg.wa_flags |= BOOST_BACK_WA | OTG_WA | OV_IRQ_WA_BIT; chg->param.freq_buck = pm660_params.freq_buck; chg->param.freq_boost = pm660_params.freq_boost; chg->chg_freq.freq_5V = 650; Loading drivers/power/supply/qcom/smb-lib.c +30 −0 Original line number Diff line number Diff line Loading @@ -669,6 +669,7 @@ static void smblib_uusb_removal(struct smb_charger *chg) vote(chg->pl_enable_votable_indirect, USBIN_I_VOTER, false, 0); vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0); vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, false, 0); cancel_delayed_work_sync(&chg->hvdcp_detect_work); Loading Loading @@ -3451,6 +3452,33 @@ static void smblib_handle_sdp_enumeration_done(struct smb_charger *chg, rising ? "rising" : "falling"); } #define MICRO_10P3V 10300000 static void smblib_check_ov_condition(struct smb_charger *chg) { union power_supply_propval pval = {0, }; int rc; if (chg->wa_flags & OV_IRQ_WA_BIT) { rc = power_supply_get_property(chg->usb_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval); if (rc < 0) { smblib_err(chg, "Couldn't get current voltage, rc=%d\n", rc); return; } if (pval.intval > MICRO_10P3V) { smblib_err(chg, "USBIN OV detected\n"); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, true, 0); pval.intval = POWER_SUPPLY_DP_DM_FORCE_5V; rc = power_supply_set_property(chg->batt_psy, POWER_SUPPLY_PROP_DP_DM, &pval); return; } } } #define QC3_PULSES_FOR_6V 5 #define QC3_PULSES_FOR_9V 20 #define QC3_PULSES_FOR_12V 35 Loading @@ -3460,6 +3488,7 @@ static void smblib_hvdcp_adaptive_voltage_change(struct smb_charger *chg) u8 stat; int pulses; smblib_check_ov_condition(chg); power_supply_changed(chg->usb_main_psy); if (chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP) { rc = smblib_read(chg, QC_CHANGE_STATUS_REG, &stat); Loading Loading @@ -3828,6 +3857,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) /* reset hvdcp voters */ vote(chg->hvdcp_disable_votable_indirect, VBUS_CC_SHORT_VOTER, true, 0); vote(chg->hvdcp_disable_votable_indirect, PD_INACTIVE_VOTER, true, 0); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, false, 0); /* reset power delivery voters */ vote(chg->pd_allowed_votable, PD_VOTER, false, 0); Loading drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ 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 OV_VOTER "OV_VOTER" #define VCONN_MAX_ATTEMPTS 3 #define OTG_MAX_ATTEMPTS 3 Loading @@ -83,6 +84,7 @@ enum { TYPEC_CC2_REMOVAL_WA_BIT = BIT(2), QC_AUTH_INTERRUPT_WA_BIT = BIT(3), OTG_WA = BIT(4), OV_IRQ_WA_BIT = BIT(5), }; enum smb_irq_index { Loading Loading
drivers/power/supply/qcom/qpnp-smb2.c +1 −1 Original line number Diff line number Diff line Loading @@ -1819,7 +1819,7 @@ static int smb2_chg_config_init(struct smb2 *chip) break; case PM660_SUBTYPE: chip->chg.smb_version = PM660_SUBTYPE; chip->chg.wa_flags |= BOOST_BACK_WA | OTG_WA; chip->chg.wa_flags |= BOOST_BACK_WA | OTG_WA | OV_IRQ_WA_BIT; chg->param.freq_buck = pm660_params.freq_buck; chg->param.freq_boost = pm660_params.freq_boost; chg->chg_freq.freq_5V = 650; Loading
drivers/power/supply/qcom/smb-lib.c +30 −0 Original line number Diff line number Diff line Loading @@ -669,6 +669,7 @@ static void smblib_uusb_removal(struct smb_charger *chg) vote(chg->pl_enable_votable_indirect, USBIN_I_VOTER, false, 0); vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0); vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, false, 0); cancel_delayed_work_sync(&chg->hvdcp_detect_work); Loading Loading @@ -3451,6 +3452,33 @@ static void smblib_handle_sdp_enumeration_done(struct smb_charger *chg, rising ? "rising" : "falling"); } #define MICRO_10P3V 10300000 static void smblib_check_ov_condition(struct smb_charger *chg) { union power_supply_propval pval = {0, }; int rc; if (chg->wa_flags & OV_IRQ_WA_BIT) { rc = power_supply_get_property(chg->usb_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval); if (rc < 0) { smblib_err(chg, "Couldn't get current voltage, rc=%d\n", rc); return; } if (pval.intval > MICRO_10P3V) { smblib_err(chg, "USBIN OV detected\n"); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, true, 0); pval.intval = POWER_SUPPLY_DP_DM_FORCE_5V; rc = power_supply_set_property(chg->batt_psy, POWER_SUPPLY_PROP_DP_DM, &pval); return; } } } #define QC3_PULSES_FOR_6V 5 #define QC3_PULSES_FOR_9V 20 #define QC3_PULSES_FOR_12V 35 Loading @@ -3460,6 +3488,7 @@ static void smblib_hvdcp_adaptive_voltage_change(struct smb_charger *chg) u8 stat; int pulses; smblib_check_ov_condition(chg); power_supply_changed(chg->usb_main_psy); if (chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP) { rc = smblib_read(chg, QC_CHANGE_STATUS_REG, &stat); Loading Loading @@ -3828,6 +3857,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) /* reset hvdcp voters */ vote(chg->hvdcp_disable_votable_indirect, VBUS_CC_SHORT_VOTER, true, 0); vote(chg->hvdcp_disable_votable_indirect, PD_INACTIVE_VOTER, true, 0); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, false, 0); /* reset power delivery voters */ vote(chg->pd_allowed_votable, PD_VOTER, false, 0); Loading
drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ 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 OV_VOTER "OV_VOTER" #define VCONN_MAX_ATTEMPTS 3 #define OTG_MAX_ATTEMPTS 3 Loading @@ -83,6 +84,7 @@ enum { TYPEC_CC2_REMOVAL_WA_BIT = BIT(2), QC_AUTH_INTERRUPT_WA_BIT = BIT(3), OTG_WA = BIT(4), OV_IRQ_WA_BIT = BIT(5), }; enum smb_irq_index { Loading