Commit 8e26c518 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 some problems with those codec
drivers.

This series aims to fix those issues.
parents 61b23b6b b9f098aa
......@@ -993,6 +993,7 @@ static void rt274_remove(struct snd_soc_component *component)
struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component);
cancel_delayed_work_sync(&rt274->jack_detect_work);
rt274->component = NULL;
}
#ifdef CONFIG_PM
......
......@@ -960,6 +960,7 @@ static void rt286_remove(struct snd_soc_component *component)
struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component);
cancel_delayed_work_sync(&rt286->jack_detect_work);
rt286->component = NULL;
}
#ifdef CONFIG_PM
......
......@@ -329,33 +329,31 @@ static void rt298_jack_detect_work(struct work_struct *work)
static int rt298_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 rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm;
bool hp = false;
bool mic = false;
int status = 0;
/* If jack in NULL, disable HS jack */
if (!jack) {
rt298->jack = jack;
if (jack) {
/* Enable IRQ */
if (rt298->jack->status & SND_JACK_HEADPHONE)
snd_soc_dapm_force_enable_pin(dapm, "LDO1");
if (rt298->jack->status & SND_JACK_MICROPHONE) {
snd_soc_dapm_force_enable_pin(dapm, "HV");
snd_soc_dapm_force_enable_pin(dapm, "VREF");
}
regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
/* Send an initial empty report */
snd_soc_jack_report(rt298->jack, rt298->jack->status,
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
} else {
/* Disable IRQ */
regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0);
dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_disable_pin(dapm, "HV");
snd_soc_dapm_disable_pin(dapm, "VREF");
snd_soc_dapm_disable_pin(dapm, "LDO1");
snd_soc_dapm_sync(dapm);
return 0;
}
rt298->jack = jack;
regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
rt298_jack_detect(rt298, &hp, &mic);
if (hp)
status |= SND_JACK_HEADPHONE;
if (mic)
status |= SND_JACK_MICROPHONE;
snd_soc_jack_report(rt298->jack, status,
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
snd_soc_dapm_sync(dapm);
return 0;
}
......@@ -1024,6 +1022,7 @@ static void rt298_remove(struct snd_soc_component *component)
struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
cancel_delayed_work_sync(&rt298->jack_detect_work);
rt298->component = NULL;
}
#ifdef CONFIG_PM
......
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