Loading drivers/power/supply/qcom/qpnp-smb2.c +6 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,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 @@ -2398,6 +2403,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 @@ -4069,6 +4069,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 @@ -4207,20 +4221,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 @@ -4369,6 +4381,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 */ val.intval = POWER_SUPPLY_TYPEC_PR_DUAL; rc = smblib_set_prop_typec_power_role(chg, &val); Loading drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -247,6 +247,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; struct charger_param chg_param; Loading Loading @@ -357,6 +358,7 @@ struct smb_charger { bool disable_stat_sw_override; bool fcc_stepper_enable; bool ufp_only_mode; 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 @@ -194,6 +194,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 @@ -2398,6 +2403,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 @@ -4069,6 +4069,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 @@ -4207,20 +4221,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 @@ -4369,6 +4381,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 */ val.intval = POWER_SUPPLY_TYPEC_PR_DUAL; rc = smblib_set_prop_typec_power_role(chg, &val); Loading
drivers/power/supply/qcom/smb-lib.h +2 −0 Original line number Diff line number Diff line Loading @@ -247,6 +247,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; struct charger_param chg_param; Loading Loading @@ -357,6 +358,7 @@ struct smb_charger { bool disable_stat_sw_override; bool fcc_stepper_enable; bool ufp_only_mode; bool is_audio_adapter; /* workaround flag */ u32 wa_flags; Loading