Commit 1149ebb6 authored by Mark Brown's avatar Mark Brown

ASoC: codecs: Series of fixes for realtek codecs used on RVPs

Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:

Our tests platforms do use realtek codecs, while implementing avs driver
and machine boards for it, we identified quite a lot of problems with
those codec drivers.
parents c7b6c95c 1eb73102
...@@ -980,14 +980,11 @@ static int rt274_probe(struct snd_soc_component *component) ...@@ -980,14 +980,11 @@ static int rt274_probe(struct snd_soc_component *component)
struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component);
rt274->component = component; rt274->component = component;
INIT_DELAYED_WORK(&rt274->jack_detect_work, rt274_jack_detect_work);
if (rt274->i2c->irq) { if (rt274->i2c->irq)
INIT_DELAYED_WORK(&rt274->jack_detect_work,
rt274_jack_detect_work);
schedule_delayed_work(&rt274->jack_detect_work, schedule_delayed_work(&rt274->jack_detect_work,
msecs_to_jiffies(1250)); msecs_to_jiffies(1250));
}
return 0; return 0;
} }
......
...@@ -311,7 +311,8 @@ static void rt286_jack_detect_work(struct work_struct *work) ...@@ -311,7 +311,8 @@ static void rt286_jack_detect_work(struct work_struct *work)
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
} }
int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack) static int rt286_mic_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component);
...@@ -335,7 +336,6 @@ int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j ...@@ -335,7 +336,6 @@ int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(rt286_mic_detect);
static int is_mclk_mode(struct snd_soc_dapm_widget *source, static int is_mclk_mode(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
...@@ -947,17 +947,11 @@ static int rt286_probe(struct snd_soc_component *component) ...@@ -947,17 +947,11 @@ static int rt286_probe(struct snd_soc_component *component)
struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component);
rt286->component = component; rt286->component = component;
INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work);
if (rt286->i2c->irq) { if (rt286->i2c->irq)
regmap_update_bits(rt286->regmap,
RT286_IRQ_CTRL, 0x2, 0x2);
INIT_DELAYED_WORK(&rt286->jack_detect_work,
rt286_jack_detect_work);
schedule_delayed_work(&rt286->jack_detect_work, schedule_delayed_work(&rt286->jack_detect_work,
msecs_to_jiffies(1250)); msecs_to_jiffies(50));
}
return 0; return 0;
} }
...@@ -1055,6 +1049,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt286 = { ...@@ -1055,6 +1049,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt286 = {
.suspend = rt286_suspend, .suspend = rt286_suspend,
.resume = rt286_resume, .resume = rt286_resume,
.set_bias_level = rt286_set_bias_level, .set_bias_level = rt286_set_bias_level,
.set_jack = rt286_mic_detect,
.controls = rt286_snd_controls, .controls = rt286_snd_controls,
.num_controls = ARRAY_SIZE(rt286_snd_controls), .num_controls = ARRAY_SIZE(rt286_snd_controls),
.dapm_widgets = rt286_dapm_widgets, .dapm_widgets = rt286_dapm_widgets,
......
...@@ -196,7 +196,5 @@ enum { ...@@ -196,7 +196,5 @@ enum {
RT286_AIFS, RT286_AIFS,
}; };
int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack);
#endif /* __RT286_H__ */ #endif /* __RT286_H__ */
...@@ -326,7 +326,8 @@ static void rt298_jack_detect_work(struct work_struct *work) ...@@ -326,7 +326,8 @@ static void rt298_jack_detect_work(struct work_struct *work)
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
} }
int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack) static int rt298_mic_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data)
{ {
struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_context *dapm;
...@@ -358,7 +359,6 @@ int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j ...@@ -358,7 +359,6 @@ int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(rt298_mic_detect);
static int is_mclk_mode(struct snd_soc_dapm_widget *source, static int is_mclk_mode(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
...@@ -1011,17 +1011,11 @@ static int rt298_probe(struct snd_soc_component *component) ...@@ -1011,17 +1011,11 @@ static int rt298_probe(struct snd_soc_component *component)
struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
rt298->component = component; rt298->component = component;
INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work);
if (rt298->i2c->irq) { if (rt298->i2c->irq)
regmap_update_bits(rt298->regmap,
RT298_IRQ_CTRL, 0x2, 0x2);
INIT_DELAYED_WORK(&rt298->jack_detect_work,
rt298_jack_detect_work);
schedule_delayed_work(&rt298->jack_detect_work, schedule_delayed_work(&rt298->jack_detect_work,
msecs_to_jiffies(1250)); msecs_to_jiffies(1250));
}
return 0; return 0;
} }
...@@ -1120,6 +1114,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt298 = { ...@@ -1120,6 +1114,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt298 = {
.suspend = rt298_suspend, .suspend = rt298_suspend,
.resume = rt298_resume, .resume = rt298_resume,
.set_bias_level = rt298_set_bias_level, .set_bias_level = rt298_set_bias_level,
.set_jack = rt298_mic_detect,
.controls = rt298_snd_controls, .controls = rt298_snd_controls,
.num_controls = ARRAY_SIZE(rt298_snd_controls), .num_controls = ARRAY_SIZE(rt298_snd_controls),
.dapm_widgets = rt298_dapm_widgets, .dapm_widgets = rt298_dapm_widgets,
......
...@@ -207,7 +207,5 @@ enum { ...@@ -207,7 +207,5 @@ enum {
RT298_AIFS, RT298_AIFS,
}; };
int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack);
#endif /* __RT298_H__ */ #endif /* __RT298_H__ */
...@@ -75,7 +75,7 @@ static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -75,7 +75,7 @@ static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
if (ret) if (ret)
return ret; return ret;
rt286_mic_detect(component, &broadwell_headset); snd_soc_component_set_jack(component, &broadwell_headset, NULL);
return 0; return 0;
} }
...@@ -235,7 +235,7 @@ static void broadwell_disable_jack(struct snd_soc_card *card) ...@@ -235,7 +235,7 @@ static void broadwell_disable_jack(struct snd_soc_card *card)
if (!strcmp(component->name, "i2c-INT343A:00")) { if (!strcmp(component->name, "i2c-INT343A:00")) {
dev_dbg(component->dev, "disabling jack detect before going to suspend.\n"); dev_dbg(component->dev, "disabling jack detect before going to suspend.\n");
rt286_mic_detect(component, NULL); snd_soc_component_set_jack(component, NULL, NULL);
break; break;
} }
} }
...@@ -255,7 +255,7 @@ static int broadwell_resume(struct snd_soc_card *card){ ...@@ -255,7 +255,7 @@ static int broadwell_resume(struct snd_soc_card *card){
if (!strcmp(component->name, "i2c-INT343A:00")) { if (!strcmp(component->name, "i2c-INT343A:00")) {
dev_dbg(component->dev, "enabling jack detect for resume.\n"); dev_dbg(component->dev, "enabling jack detect for resume.\n");
rt286_mic_detect(component, &broadwell_headset); snd_soc_component_set_jack(component, &broadwell_headset, NULL);
break; break;
} }
} }
......
...@@ -176,7 +176,7 @@ static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -176,7 +176,7 @@ static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd)
if (ret) if (ret)
return ret; return ret;
rt298_mic_detect(component, &broxton_headset); snd_soc_component_set_jack(component, &broxton_headset, NULL);
snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
......
...@@ -133,7 +133,7 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -133,7 +133,7 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
if (ret) if (ret)
return ret; return ret;
rt286_mic_detect(component, &skylake_headset); snd_soc_component_set_jack(component, &skylake_headset, NULL);
snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment