diff --git a/drivers/net/wireless/rtl8822cs/Makefile b/drivers/net/wireless/rtl8822cs/Makefile index d5144d361..dbb02fda6 100644 --- a/drivers/net/wireless/rtl8822cs/Makefile +++ b/drivers/net/wireless/rtl8822cs/Makefile @@ -144,7 +144,7 @@ EXTRA_CFLAGS += -DCONFIG_RTW_ANDROID=$(CONFIG_RTW_ANDROID) endif ########################## Debug ########################### -CONFIG_RTW_DEBUG = y +CONFIG_RTW_DEBUG = n # default log level is _DRV_INFO_ = 4, # please refer to "How_to_set_driver_debug_log_level.doc" to set the available level. CONFIG_RTW_LOG_LEVEL = 4 diff --git a/include/linux/rk_headset.h b/include/linux/rk_headset.h index b7ffd6588..9e4a94fb2 100755 --- a/include/linux/rk_headset.h +++ b/include/linux/rk_headset.h @@ -45,4 +45,5 @@ int rk_headset_adc_probe(struct platform_device *pdev, int rk_headset_adc_suspend(struct platform_device *pdev, pm_message_t state); int rk_headset_adc_resume(struct platform_device *pdev); int rk_headset_get_headset(void); +void headset_resume(void); #endif diff --git a/sound/soc/codecs/es8323.c b/sound/soc/codecs/es8323.c index 8aee9bd51..89f88fd01 100644 --- a/sound/soc/codecs/es8323.c +++ b/sound/soc/codecs/es8323.c @@ -129,10 +129,12 @@ struct es8323_priv { struct clk *mclk; struct snd_pcm_hw_constraint_list sysclk_constraints; struct snd_soc_component *component; + struct delayed_work pa_work; struct regmap *regmap; struct device_node *np; struct gpio_desc * hp_ctl_gpio; struct gpio_desc * spk_ctl_gpio; + bool playback; }; static int es8323_codec_ctl_gpio(struct es8323_priv *es8323, @@ -167,11 +169,14 @@ static int es8323_headset_switch(struct notifier_block *nb, snd_soc_component_write(g_es8323->component, ES8323_ADCCONTROL2, 0x00); es8323_codec_ctl_gpio(g_es8323, CODEC_SET_SPK, 0); es8323_codec_ctl_gpio(g_es8323, CODEC_SET_HP, 1); - } else { + } else if (g_es8323->playback) { snd_soc_component_write(g_es8323->component, ES8323_ADCCONTROL2, 0x50); es8323_codec_ctl_gpio(g_es8323, CODEC_SET_SPK, 1); es8323_codec_ctl_gpio(g_es8323, CODEC_SET_HP, 0); - } + } else { + es8323_codec_ctl_gpio(g_es8323, CODEC_SET_SPK, 0); + es8323_codec_ctl_gpio(g_es8323, CODEC_SET_HP, 0); + } return NOTIFY_OK; } @@ -767,6 +772,7 @@ static int es8323_pcm_startup(struct snd_pcm_substream *substream, } #endif + es8323->playback = false; switch (substream->stream) { case SNDRV_PCM_STREAM_CAPTURE: @@ -782,17 +788,8 @@ static int es8323_pcm_startup(struct snd_pcm_substream *substream, break; case SNDRV_PCM_STREAM_PLAYBACK: - #ifdef CONFIG_RK_HEADSET - if(!rk_headset_get_headset()) { - DBG("get headset out \n"); - es8323_codec_ctl_gpio(es8323, CODEC_SET_SPK, 1); - es8323_codec_ctl_gpio(es8323, CODEC_SET_HP, 0); - } else { - DBG("get headset in \n"); - es8323_codec_ctl_gpio(es8323, CODEC_SET_SPK, 0); - es8323_codec_ctl_gpio(es8323, CODEC_SET_HP, 1); - } - #endif + es8323->playback = true; + schedule_delayed_work(&es8323->pa_work, msecs_to_jiffies(20)); break; default: @@ -1169,6 +1166,23 @@ static int es8323_codec_parse_dt_property(struct device *dev, return 0; } +static void pa_delay_worker(struct work_struct *work) +{ + struct es8323_priv *es8323 = container_of(work, struct es8323_priv, pa_work.work); + + #ifdef CONFIG_RK_HEADSET + if(!rk_headset_get_headset()) { + DBG("get headset out \n"); + es8323_codec_ctl_gpio(es8323, CODEC_SET_SPK, 1); + es8323_codec_ctl_gpio(es8323, CODEC_SET_HP, 0); + } else { + DBG("get headset in \n"); + es8323_codec_ctl_gpio(es8323, CODEC_SET_SPK, 0); + es8323_codec_ctl_gpio(es8323, CODEC_SET_HP, 1); + } + #endif +} + static int es8323_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -1189,6 +1203,8 @@ static int es8323_i2c_probe(struct i2c_client *i2c, if (!es8323) return -ENOMEM; + es8323->playback = false; + INIT_DELAYED_WORK(&es8323->pa_work, pa_delay_worker); es8323->regmap = devm_regmap_init_i2c(i2c, &es8323_regmap_config); if (IS_ERR(es8323->regmap)) return PTR_ERR(es8323->regmap); diff --git a/sound/soc/headset_observe/rk_headset.c b/sound/soc/headset_observe/rk_headset.c index 20719ab28..8e1c6fb05 100755 --- a/sound/soc/headset_observe/rk_headset.c +++ b/sound/soc/headset_observe/rk_headset.c @@ -467,6 +467,13 @@ out: return; } +void headset_resume(void) +{ + schedule_delayed_work(&headset_info->h_delayed_work[HEADSET], + msecs_to_jiffies(10)); +} +EXPORT_SYMBOL_GPL(headset_resume); + #ifdef CONFIG_HAS_EARLYSUSPEND static void headset_early_resume(struct early_suspend *h) { diff --git a/sound/soc/headset_observe/rockchip_headset_core.c b/sound/soc/headset_observe/rockchip_headset_core.c index ad0b9378a..dcd32b63d 100755 --- a/sound/soc/headset_observe/rockchip_headset_core.c +++ b/sound/soc/headset_observe/rockchip_headset_core.c @@ -215,6 +215,7 @@ static int rockchip_headset_suspend(struct platform_device *pdev, static int rockchip_headset_resume(struct platform_device *pdev) { + headset_resume(); if (pdata_info->chan != 0) { return rk_headset_adc_resume(pdev); }