Loading drivers/power/supply/qcom/qpnp-smb2.c +6 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,11 @@ module_param_named( try_sink_enabled, __try_sink_enabled, int, 0600 ); static int __audio_headset_drp_wait_ms = 100; module_param_named( audio_headset_drp_wait_ms, __audio_headset_drp_wait_ms, int, 0600 ); #define MICRO_1P5A 1500000 #define MICRO_P1A 100000 #define OTG_DEFAULT_DEGLITCH_TIME_MS 50 Loading Loading @@ -2272,6 +2277,7 @@ static int smb2_probe(struct platform_device *pdev) chg->irq_info = smb2_irqs; chg->die_health = -EINVAL; chg->name = "PMI"; chg->audio_headset_drp_wait_ms = &__audio_headset_drp_wait_ms; chg->regmap = dev_get_regmap(chg->dev->parent, NULL); if (!chg->regmap) { Loading drivers/power/supply/qcom/smb-lib.c +29 −11 Original line number Diff line number Diff line Loading @@ -3829,6 +3829,20 @@ static int typec_try_sink(struct smb_charger *chg) bool debounce_done, vbus_detected, sink; u8 stat; int exit_mode = ATTACHED_SRC, rc; int typec_mode; if (!(*chg->try_sink_enabled)) return ATTACHED_SRC; typec_mode = smblib_get_prop_typec_mode(chg); if (typec_mode == POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER || typec_mode == POWER_SUPPLY_TYPEC_SINK_DEBUG_ACCESSORY) return ATTACHED_SRC; /* * Try.SNK entry status - ATTACHWAIT.SRC state and detected Rd-open * or RD-Ra for TccDebounce time. */ /* ignore typec interrupt while try.snk WIP */ chg->try_sink_active = true; Loading Loading @@ -3967,20 +3981,18 @@ static int typec_try_sink(struct smb_charger *chg) static void typec_sink_insertion(struct smb_charger *chg) { int exit_mode; int typec_mode; /* * Try.SNK entry status - ATTACHWAIT.SRC state and detected Rd-open * or RD-Ra for TccDebounce time. */ if (*chg->try_sink_enabled) { exit_mode = typec_try_sink(chg); if (exit_mode != ATTACHED_SRC) { smblib_usb_typec_change(chg); return; } } typec_mode = smblib_get_prop_typec_mode(chg); if (typec_mode == POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER) chg->is_audio_adapter = true; /* when a sink is inserted we should not wait on hvdcp timeout to * enable pd Loading Loading @@ -4105,6 +4117,12 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) smblib_err(chg, "Couldn't set USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V rc=%d\n", rc); if (chg->is_audio_adapter == true) /* wait for the audio driver to lower its en gpio */ msleep(*chg->audio_headset_drp_wait_ms); chg->is_audio_adapter = false; /* enable DRP */ rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG, TYPEC_POWER_ROLE_CMD_MASK, 0); Loading drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,7 @@ struct smb_charger { struct smb_iio iio; int *debug_mask; int *try_sink_enabled; int *audio_headset_drp_wait_ms; enum smb_mode mode; struct smb_chg_freq chg_freq; int smb_version; Loading Loading @@ -345,6 +346,7 @@ struct smb_charger { u8 float_cfg; bool use_extcon; bool otg_present; bool is_audio_adapter; /* workaround flag */ u32 wa_flags; Loading Loading
drivers/power/supply/qcom/qpnp-smb2.c +6 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,11 @@ module_param_named( try_sink_enabled, __try_sink_enabled, int, 0600 ); static int __audio_headset_drp_wait_ms = 100; module_param_named( audio_headset_drp_wait_ms, __audio_headset_drp_wait_ms, int, 0600 ); #define MICRO_1P5A 1500000 #define MICRO_P1A 100000 #define OTG_DEFAULT_DEGLITCH_TIME_MS 50 Loading Loading @@ -2272,6 +2277,7 @@ static int smb2_probe(struct platform_device *pdev) chg->irq_info = smb2_irqs; chg->die_health = -EINVAL; chg->name = "PMI"; chg->audio_headset_drp_wait_ms = &__audio_headset_drp_wait_ms; chg->regmap = dev_get_regmap(chg->dev->parent, NULL); if (!chg->regmap) { Loading
drivers/power/supply/qcom/smb-lib.c +29 −11 Original line number Diff line number Diff line Loading @@ -3829,6 +3829,20 @@ static int typec_try_sink(struct smb_charger *chg) bool debounce_done, vbus_detected, sink; u8 stat; int exit_mode = ATTACHED_SRC, rc; int typec_mode; if (!(*chg->try_sink_enabled)) return ATTACHED_SRC; typec_mode = smblib_get_prop_typec_mode(chg); if (typec_mode == POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER || typec_mode == POWER_SUPPLY_TYPEC_SINK_DEBUG_ACCESSORY) return ATTACHED_SRC; /* * Try.SNK entry status - ATTACHWAIT.SRC state and detected Rd-open * or RD-Ra for TccDebounce time. */ /* ignore typec interrupt while try.snk WIP */ chg->try_sink_active = true; Loading Loading @@ -3967,20 +3981,18 @@ static int typec_try_sink(struct smb_charger *chg) static void typec_sink_insertion(struct smb_charger *chg) { int exit_mode; int typec_mode; /* * Try.SNK entry status - ATTACHWAIT.SRC state and detected Rd-open * or RD-Ra for TccDebounce time. */ if (*chg->try_sink_enabled) { exit_mode = typec_try_sink(chg); if (exit_mode != ATTACHED_SRC) { smblib_usb_typec_change(chg); return; } } typec_mode = smblib_get_prop_typec_mode(chg); if (typec_mode == POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER) chg->is_audio_adapter = true; /* when a sink is inserted we should not wait on hvdcp timeout to * enable pd Loading Loading @@ -4105,6 +4117,12 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) smblib_err(chg, "Couldn't set USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V rc=%d\n", rc); if (chg->is_audio_adapter == true) /* wait for the audio driver to lower its en gpio */ msleep(*chg->audio_headset_drp_wait_ms); chg->is_audio_adapter = false; /* enable DRP */ rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG, TYPEC_POWER_ROLE_CMD_MASK, 0); Loading
drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,7 @@ struct smb_charger { struct smb_iio iio; int *debug_mask; int *try_sink_enabled; int *audio_headset_drp_wait_ms; enum smb_mode mode; struct smb_chg_freq chg_freq; int smb_version; Loading Loading @@ -345,6 +346,7 @@ struct smb_charger { u8 float_cfg; bool use_extcon; bool otg_present; bool is_audio_adapter; /* workaround flag */ u32 wa_flags; Loading