Loading drivers/power/supply/qcom/qpnp-smb5.c +10 −14 Original line number Diff line number Diff line Loading @@ -402,7 +402,7 @@ static int smb5_parse_dt(struct smb5 *chip) chip->dt.hvdcp_disable = of_property_read_bool(node, "qcom,hvdcp-disable"); chg->hvdcp_disable = chip->dt.hvdcp_disable; rc = of_property_read_u32(node, "qcom,chg-inhibit-threshold-mv", &chip->dt.chg_inhibit_thr_mv); Loading Loading @@ -1660,16 +1660,6 @@ static int smb5_configure_micro_usb(struct smb_charger *chg) return rc; } /* Enable HVDCP and BC 1.2 source detection */ rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT, HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT); if (rc < 0) { dev_err(chg->dev, "Couldn't enable HVDCP detection rc=%d\n", rc); return rc; } return rc; } Loading Loading @@ -1800,10 +1790,16 @@ static int smb5_init_hw(struct smb5 *chip) } } /* Use SW based VBUS control, disable HW autonomous mode */ /* * Disable HVDCP autonomous mode operation by default. 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); rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, HVDCP_AUTH_ALG_EN_CFG_BIT); (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; Loading drivers/power/supply/qcom/smb5-lib.c +6 −2 Original line number Diff line number Diff line Loading @@ -801,13 +801,17 @@ int smblib_get_prop_from_bms(struct smb_charger *chg, int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable) { int rc; u8 mask = HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT; u8 mask = (BC1P2_SRC_DETECT_BIT | HVDCP_EN_BIT | HVDCP_AUTH_ALG_EN_CFG_BIT); u8 val = BC1P2_SRC_DETECT_BIT | (chg->hvdcp_disable ? 0 : (HVDCP_EN_BIT | HVDCP_AUTH_ALG_EN_CFG_BIT)); if (chg->pd_not_supported) return 0; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, mask, enable ? mask : 0); enable ? val : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); Loading drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,7 @@ struct smb_charger { u8 float_cfg; bool use_extcon; bool otg_present; bool hvdcp_disable; int hw_max_icl_ua; int auto_recharge_soc; enum sink_src_mode sink_src_mode; Loading Loading
drivers/power/supply/qcom/qpnp-smb5.c +10 −14 Original line number Diff line number Diff line Loading @@ -402,7 +402,7 @@ static int smb5_parse_dt(struct smb5 *chip) chip->dt.hvdcp_disable = of_property_read_bool(node, "qcom,hvdcp-disable"); chg->hvdcp_disable = chip->dt.hvdcp_disable; rc = of_property_read_u32(node, "qcom,chg-inhibit-threshold-mv", &chip->dt.chg_inhibit_thr_mv); Loading Loading @@ -1660,16 +1660,6 @@ static int smb5_configure_micro_usb(struct smb_charger *chg) return rc; } /* Enable HVDCP and BC 1.2 source detection */ rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT, HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT); if (rc < 0) { dev_err(chg->dev, "Couldn't enable HVDCP detection rc=%d\n", rc); return rc; } return rc; } Loading Loading @@ -1800,10 +1790,16 @@ static int smb5_init_hw(struct smb5 *chip) } } /* Use SW based VBUS control, disable HW autonomous mode */ /* * Disable HVDCP autonomous mode operation by default. 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); rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, HVDCP_AUTH_ALG_EN_CFG_BIT); (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; Loading
drivers/power/supply/qcom/smb5-lib.c +6 −2 Original line number Diff line number Diff line Loading @@ -801,13 +801,17 @@ int smblib_get_prop_from_bms(struct smb_charger *chg, int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable) { int rc; u8 mask = HVDCP_EN_BIT | BC1P2_SRC_DETECT_BIT; u8 mask = (BC1P2_SRC_DETECT_BIT | HVDCP_EN_BIT | HVDCP_AUTH_ALG_EN_CFG_BIT); u8 val = BC1P2_SRC_DETECT_BIT | (chg->hvdcp_disable ? 0 : (HVDCP_EN_BIT | HVDCP_AUTH_ALG_EN_CFG_BIT)); if (chg->pd_not_supported) return 0; rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, mask, enable ? mask : 0); enable ? val : 0); if (rc < 0) smblib_err(chg, "failed to write USBIN_OPTIONS_1_CFG rc=%d\n", rc); Loading
drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,7 @@ struct smb_charger { u8 float_cfg; bool use_extcon; bool otg_present; bool hvdcp_disable; int hw_max_icl_ua; int auto_recharge_soc; enum sink_src_mode sink_src_mode; Loading