aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap3pandora.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/omap3pandora.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/omap3pandora.c')
-rw-r--r--sound/soc/omap/omap3pandora.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index dbd9d96b5f9..93e83c0f666 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -170,51 +170,53 @@ static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
170static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) 170static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
171{ 171{
172 struct snd_soc_codec *codec = rtd->codec; 172 struct snd_soc_codec *codec = rtd->codec;
173 struct snd_soc_dapm_context *dapm = &codec->dapm;
173 int ret; 174 int ret;
174 175
175 /* All TWL4030 output pins are floating */ 176 /* All TWL4030 output pins are floating */
176 snd_soc_dapm_nc_pin(codec, "EARPIECE"); 177 snd_soc_dapm_nc_pin(dapm, "EARPIECE");
177 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); 178 snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
178 snd_soc_dapm_nc_pin(codec, "PREDRIVER"); 179 snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
179 snd_soc_dapm_nc_pin(codec, "HSOL"); 180 snd_soc_dapm_nc_pin(dapm, "HSOL");
180 snd_soc_dapm_nc_pin(codec, "HSOR"); 181 snd_soc_dapm_nc_pin(dapm, "HSOR");
181 snd_soc_dapm_nc_pin(codec, "CARKITL"); 182 snd_soc_dapm_nc_pin(dapm, "CARKITL");
182 snd_soc_dapm_nc_pin(codec, "CARKITR"); 183 snd_soc_dapm_nc_pin(dapm, "CARKITR");
183 snd_soc_dapm_nc_pin(codec, "HFL"); 184 snd_soc_dapm_nc_pin(dapm, "HFL");
184 snd_soc_dapm_nc_pin(codec, "HFR"); 185 snd_soc_dapm_nc_pin(dapm, "HFR");
185 snd_soc_dapm_nc_pin(codec, "VIBRA"); 186 snd_soc_dapm_nc_pin(dapm, "VIBRA");
186 187
187 ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, 188 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets,
188 ARRAY_SIZE(omap3pandora_out_dapm_widgets)); 189 ARRAY_SIZE(omap3pandora_out_dapm_widgets));
189 if (ret < 0) 190 if (ret < 0)
190 return ret; 191 return ret;
191 192
192 snd_soc_dapm_add_routes(codec, omap3pandora_out_map, 193 snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
193 ARRAY_SIZE(omap3pandora_out_map)); 194 ARRAY_SIZE(omap3pandora_out_map));
194 195
195 return snd_soc_dapm_sync(codec); 196 return snd_soc_dapm_sync(dapm);
196} 197}
197 198
198static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) 199static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
199{ 200{
200 struct snd_soc_codec *codec = rtd->codec; 201 struct snd_soc_codec *codec = rtd->codec;
202 struct snd_soc_dapm_context *dapm = &codec->dapm;
201 int ret; 203 int ret;
202 204
203 /* Not comnnected */ 205 /* Not comnnected */
204 snd_soc_dapm_nc_pin(codec, "HSMIC"); 206 snd_soc_dapm_nc_pin(dapm, "HSMIC");
205 snd_soc_dapm_nc_pin(codec, "CARKITMIC"); 207 snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
206 snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); 208 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
207 snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); 209 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
208 210
209 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, 211 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets,
210 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); 212 ARRAY_SIZE(omap3pandora_in_dapm_widgets));
211 if (ret < 0) 213 if (ret < 0)
212 return ret; 214 return ret;
213 215
214 snd_soc_dapm_add_routes(codec, omap3pandora_in_map, 216 snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
215 ARRAY_SIZE(omap3pandora_in_map)); 217 ARRAY_SIZE(omap3pandora_in_map));
216 218
217 return snd_soc_dapm_sync(codec); 219 return snd_soc_dapm_sync(dapm);
218} 220}
219 221
220static struct snd_soc_ops omap3pandora_ops = { 222static struct snd_soc_ops omap3pandora_ops = {