mirror of
https://github.com/revyos/thead-kernel.git
synced 2026-06-21 09:12:26 +02:00
merge into 90b98daba35e6e8d3d64be18d6905adce98b1098
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user