aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>2015-06-11 06:32:30 -0400
committerMark Brown <broonie@kernel.org>2015-06-11 06:39:39 -0400
commitf5e2ce92bd96df99de1ef33fad05e3b3b2d34e54 (patch)
treef6875032600a2adee9ed607be4f9bf9922994f74
parent69a6582eeb17dc083b2510f1ca2eaa54ff679b49 (diff)
ASoC: wm_adsp: Add codec_probe and codec_remove stubs
Currently the only init function in wm_adsp is called by the codec driver early in its probe before the codec has been registered with SOC. This patch adds stubs for the codec_probe and codec_remove stages and calls them from WM5102 and WM5110 codec drivers. This allows us to hang anything that needs setup during the codec probe stage off these functions without further modification of the codec drivers. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wm5102.c6
-rw-r--r--sound/soc/codecs/wm5110.c12
-rw-r--r--sound/soc/codecs/wm_adsp.c12
-rw-r--r--sound/soc/codecs/wm_adsp.h2
4 files changed, 31 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 11eba0e58fc0..341d96e3376c 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -1875,6 +1875,10 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
1875 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); 1875 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1876 int ret; 1876 int ret;
1877 1877
1878 ret = wm_adsp2_codec_probe(&priv->core.adsp[0], codec);
1879 if (ret)
1880 return ret;
1881
1878 ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 2); 1882 ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 2);
1879 if (ret != 0) 1883 if (ret != 0)
1880 return ret; 1884 return ret;
@@ -1893,6 +1897,8 @@ static int wm5102_codec_remove(struct snd_soc_codec *codec)
1893{ 1897{
1894 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); 1898 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1895 1899
1900 wm_adsp2_codec_remove(&priv->core.adsp[0], codec);
1901
1896 priv->core.arizona->dapm = NULL; 1902 priv->core.arizona->dapm = NULL;
1897 1903
1898 return 0; 1904 return 0;
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index d65364e91532..6e15d9c7ec23 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -1599,7 +1599,7 @@ static struct snd_soc_dai_driver wm5110_dai[] = {
1599static int wm5110_codec_probe(struct snd_soc_codec *codec) 1599static int wm5110_codec_probe(struct snd_soc_codec *codec)
1600{ 1600{
1601 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); 1601 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1602 int ret; 1602 int i, ret;
1603 1603
1604 priv->core.arizona->dapm = &codec->dapm; 1604 priv->core.arizona->dapm = &codec->dapm;
1605 1605
@@ -1607,6 +1607,12 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
1607 arizona_init_gpio(codec); 1607 arizona_init_gpio(codec);
1608 arizona_init_mono(codec); 1608 arizona_init_mono(codec);
1609 1609
1610 for (i = 0; i < WM5110_NUM_ADSP; ++i) {
1611 ret = wm_adsp2_codec_probe(&priv->core.adsp[i], codec);
1612 if (ret)
1613 return ret;
1614 }
1615
1610 ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 8); 1616 ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 8);
1611 if (ret != 0) 1617 if (ret != 0)
1612 return ret; 1618 return ret;
@@ -1621,6 +1627,10 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
1621static int wm5110_codec_remove(struct snd_soc_codec *codec) 1627static int wm5110_codec_remove(struct snd_soc_codec *codec)
1622{ 1628{
1623 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); 1629 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1630 int i;
1631
1632 for (i = 0; i < WM5110_NUM_ADSP; ++i)
1633 wm_adsp2_codec_remove(&priv->core.adsp[i], codec);
1624 1634
1625 priv->core.arizona->dapm = NULL; 1635 priv->core.arizona->dapm = NULL;
1626 1636
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b62ffd0c133e..9fad2fdf1264 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1933,6 +1933,18 @@ err:
1933} 1933}
1934EXPORT_SYMBOL_GPL(wm_adsp2_event); 1934EXPORT_SYMBOL_GPL(wm_adsp2_event);
1935 1935
1936int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec)
1937{
1938 return 0;
1939}
1940EXPORT_SYMBOL_GPL(wm_adsp2_codec_probe);
1941
1942int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec)
1943{
1944 return 0;
1945}
1946EXPORT_SYMBOL_GPL(wm_adsp2_codec_remove);
1947
1936int wm_adsp2_init(struct wm_adsp *dsp) 1948int wm_adsp2_init(struct wm_adsp *dsp)
1937{ 1949{
1938 int ret; 1950 int ret;
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index 0e5f07c35d50..5584e34e9a01 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -79,6 +79,8 @@ extern const struct snd_kcontrol_new wm_adsp2_fw_controls[];
79 79
80int wm_adsp1_init(struct wm_adsp *dsp); 80int wm_adsp1_init(struct wm_adsp *dsp);
81int wm_adsp2_init(struct wm_adsp *dsp); 81int wm_adsp2_init(struct wm_adsp *dsp);
82int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec);
83int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec);
82int wm_adsp1_event(struct snd_soc_dapm_widget *w, 84int wm_adsp1_event(struct snd_soc_dapm_widget *w,
83 struct snd_kcontrol *kcontrol, int event); 85 struct snd_kcontrol *kcontrol, int event);
84int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, 86int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,