aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/n810.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-11-05 09:53:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-06 11:28:29 -0400
commitce6120cca2589ede530200c7cfe11ac9f144333c (patch)
tree6ea7c26ce64dd4753e7cf9a3b048e74614b169dc /sound/soc/omap/n810.c
parent22e2fda5660cdf62513acabdb5c82a5af415f838 (diff)
ASoC: Decouple DAPM from CODECs
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is required when developing ASoC further. Such as for other ASoC components to have DAPM widgets or when extending DAPM to handle cross-device paths. This patch decouples DAPM related variables from struct snd_soc_codec and moves them to new struct snd_soc_dapm_context that is used to encapsulate DAPM context of a device. ASoC core and API of DAPM functions are modified to use DAPM context instead of codec. This patch does not change current functionality and a large part of changes come because of structure and internal API changes. Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some minor core changes, codecs and machine driver conversions from Jarkko Nikula <jhnikula@gmail.com>. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Timur Tabi <timur@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jassi Brar <jassi.brar@samsung.com> Cc: Daniel Gloeckner <dg@emlix.com> Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap/n810.c')
-rw-r--r--sound/soc/omap/n810.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index a3b6d897ad84..296cd9b7eecb 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -58,6 +58,7 @@ static int n810_dmic_func;
58 58
59static void n810_ext_control(struct snd_soc_codec *codec) 59static void n810_ext_control(struct snd_soc_codec *codec)
60{ 60{
61 struct snd_soc_dapm_context *dapm = &codec->dapm;
61 int hp = 0, line1l = 0; 62 int hp = 0, line1l = 0;
62 63
63 switch (n810_jack_func) { 64 switch (n810_jack_func) {
@@ -72,25 +73,25 @@ static void n810_ext_control(struct snd_soc_codec *codec)
72 } 73 }
73 74
74 if (n810_spk_func) 75 if (n810_spk_func)
75 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 76 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
76 else 77 else
77 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 78 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
78 79
79 if (hp) 80 if (hp)
80 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 81 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
81 else 82 else
82 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 83 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
83 if (line1l) 84 if (line1l)
84 snd_soc_dapm_enable_pin(codec, "LINE1L"); 85 snd_soc_dapm_enable_pin(dapm, "LINE1L");
85 else 86 else
86 snd_soc_dapm_disable_pin(codec, "LINE1L"); 87 snd_soc_dapm_disable_pin(dapm, "LINE1L");
87 88
88 if (n810_dmic_func) 89 if (n810_dmic_func)
89 snd_soc_dapm_enable_pin(codec, "DMic"); 90 snd_soc_dapm_enable_pin(dapm, "DMic");
90 else 91 else
91 snd_soc_dapm_disable_pin(codec, "DMic"); 92 snd_soc_dapm_disable_pin(dapm, "DMic");
92 93
93 snd_soc_dapm_sync(codec); 94 snd_soc_dapm_sync(dapm);
94} 95}
95 96
96static int n810_startup(struct snd_pcm_substream *substream) 97static int n810_startup(struct snd_pcm_substream *substream)
@@ -274,17 +275,18 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
274static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) 275static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
275{ 276{
276 struct snd_soc_codec *codec = rtd->codec; 277 struct snd_soc_codec *codec = rtd->codec;
278 struct snd_soc_dapm_context *dapm = &codec->dapm;
277 int err; 279 int err;
278 280
279 /* Not connected */ 281 /* Not connected */
280 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 282 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
281 snd_soc_dapm_nc_pin(codec, "HPLCOM"); 283 snd_soc_dapm_nc_pin(dapm, "HPLCOM");
282 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 284 snd_soc_dapm_nc_pin(dapm, "HPRCOM");
283 snd_soc_dapm_nc_pin(codec, "MIC3L"); 285 snd_soc_dapm_nc_pin(dapm, "MIC3L");
284 snd_soc_dapm_nc_pin(codec, "MIC3R"); 286 snd_soc_dapm_nc_pin(dapm, "MIC3R");
285 snd_soc_dapm_nc_pin(codec, "LINE1R"); 287 snd_soc_dapm_nc_pin(dapm, "LINE1R");
286 snd_soc_dapm_nc_pin(codec, "LINE2L"); 288 snd_soc_dapm_nc_pin(dapm, "LINE2L");
287 snd_soc_dapm_nc_pin(codec, "LINE2R"); 289 snd_soc_dapm_nc_pin(dapm, "LINE2R");
288 290
289 /* Add N810 specific controls */ 291 /* Add N810 specific controls */
290 err = snd_soc_add_controls(codec, aic33_n810_controls, 292 err = snd_soc_add_controls(codec, aic33_n810_controls,
@@ -293,13 +295,13 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
293 return err; 295 return err;
294 296
295 /* Add N810 specific widgets */ 297 /* Add N810 specific widgets */
296 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, 298 snd_soc_dapm_new_controls(dapm, aic33_dapm_widgets,
297 ARRAY_SIZE(aic33_dapm_widgets)); 299 ARRAY_SIZE(aic33_dapm_widgets));
298 300
299 /* Set up N810 specific audio path audio_map */ 301 /* Set up N810 specific audio path audio_map */
300 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 302 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
301 303
302 snd_soc_dapm_sync(codec); 304 snd_soc_dapm_sync(dapm);
303 305
304 return 0; 306 return 0;
305} 307}