aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-10 16:41:52 -0500
committerMark Brown <broonie@kernel.org>2014-11-18 10:38:03 -0500
commitbc2632140435cc84f9817f1c362479b23dbdfebc (patch)
treeb0fa79ee19c71ddd1a243721f1e91380a3fe1b19
parent4bafcf074aca3bd191e4d93c6a140ca52654f192 (diff)
ASoC: Rename snd_soc_dai_driver struct ac97_control field to bus_control
Setting the ac97_control field on a CPU DAI tells the ASoC core that this DAI in addition to audio data also transports control data to the CODEC. This causes the core to suspend the DAI after the CODEC and resume it before the CODEC so communication to the CODEC is still possible. This is not necessarily something that is specific to AC'97 and can be used by other buses with the same requirement. This patch renames the flag from ac97_control to bus_control to make this explicit. While we are at it also change the type from int to bool. The following semantich patch was used for automatic conversion of the drivers: // <smpl> @@ identifier drv; @@ struct snd_soc_dai_driver drv = { - .ac97_control + .bus_control = - 1 + true }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--sound/soc/au1x/ac97c.c2
-rw-r--r--sound/soc/au1x/psc-ac97.c2
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c2
-rw-r--r--sound/soc/cirrus/ep93xx-ac97.c2
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/fsl/imx-ssi.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c4
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c2
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c6
-rw-r--r--sound/soc/samsung/ac97.c4
-rw-r--r--sound/soc/sh/hac.c2
-rw-r--r--sound/soc/soc-core.c26
-rw-r--r--sound/soc/tegra/tegra20_ac97.c2
-rw-r--r--sound/soc/txx9/txx9aclc-ac97.c2
15 files changed, 33 insertions, 30 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index c0e04688c6ed..a3738be45563 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -206,7 +206,6 @@ struct snd_soc_dai_driver {
206 /* DAI description */ 206 /* DAI description */
207 const char *name; 207 const char *name;
208 unsigned int id; 208 unsigned int id;
209 int ac97_control;
210 unsigned int base; 209 unsigned int base;
211 210
212 /* DAI driver callbacks */ 211 /* DAI driver callbacks */
@@ -216,6 +215,8 @@ struct snd_soc_dai_driver {
216 int (*resume)(struct snd_soc_dai *dai); 215 int (*resume)(struct snd_soc_dai *dai);
217 /* compress dai */ 216 /* compress dai */
218 bool compress_dai; 217 bool compress_dai;
218 /* DAI is also used for the control bus */
219 bool bus_control;
219 220
220 /* ops */ 221 /* ops */
221 const struct snd_soc_dai_ops *ops; 222 const struct snd_soc_dai_ops *ops;
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index c8a2de103c5f..5159a50a45a6 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -205,7 +205,7 @@ static int au1xac97c_dai_probe(struct snd_soc_dai *dai)
205 205
206static struct snd_soc_dai_driver au1xac97c_dai_driver = { 206static struct snd_soc_dai_driver au1xac97c_dai_driver = {
207 .name = "alchemy-ac97c", 207 .name = "alchemy-ac97c",
208 .ac97_control = 1, 208 .bus_control = true,
209 .probe = au1xac97c_dai_probe, 209 .probe = au1xac97c_dai_probe,
210 .playback = { 210 .playback = {
211 .rates = AC97_RATES, 211 .rates = AC97_RATES,
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 84f31e1f9d24..c6daec98ff89 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -343,7 +343,7 @@ static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
343}; 343};
344 344
345static const struct snd_soc_dai_driver au1xpsc_ac97_dai_template = { 345static const struct snd_soc_dai_driver au1xpsc_ac97_dai_template = {
346 .ac97_control = 1, 346 .bus_control = true,
347 .probe = au1xpsc_ac97_probe, 347 .probe = au1xpsc_ac97_probe,
348 .playback = { 348 .playback = {
349 .rates = AC97_RATES, 349 .rates = AC97_RATES,
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index e82eb373a731..6bf21a6c02e4 100644
--- a/sound/soc/blackfin/bf5xx-ac97.c
+++ b/sound/soc/blackfin/bf5xx-ac97.c
@@ -260,7 +260,7 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai)
260#endif 260#endif
261 261
262static struct snd_soc_dai_driver bfin_ac97_dai = { 262static struct snd_soc_dai_driver bfin_ac97_dai = {
263 .ac97_control = 1, 263 .bus_control = true,
264 .suspend = bf5xx_ac97_suspend, 264 .suspend = bf5xx_ac97_suspend,
265 .resume = bf5xx_ac97_resume, 265 .resume = bf5xx_ac97_resume,
266 .playback = { 266 .playback = {
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index f30dadf85b99..6b8a366b0211 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -338,7 +338,7 @@ static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
338static struct snd_soc_dai_driver ep93xx_ac97_dai = { 338static struct snd_soc_dai_driver ep93xx_ac97_dai = {
339 .name = "ep93xx-ac97", 339 .name = "ep93xx-ac97",
340 .id = 0, 340 .id = 0,
341 .ac97_control = 1, 341 .bus_control = true,
342 .probe = ep93xx_ac97_dai_probe, 342 .probe = ep93xx_ac97_dai_probe,
343 .playback = { 343 .playback = {
344 .stream_name = "AC97 Playback", 344 .stream_name = "AC97 Playback",
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index e6955170dc42..7fd3cbcd74c0 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1099,7 +1099,7 @@ static const struct snd_soc_component_driver fsl_ssi_component = {
1099}; 1099};
1100 1100
1101static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { 1101static struct snd_soc_dai_driver fsl_ssi_ac97_dai = {
1102 .ac97_control = 1, 1102 .bus_control = true,
1103 .playback = { 1103 .playback = {
1104 .stream_name = "AC97 Playback", 1104 .stream_name = "AC97 Playback",
1105 .channels_min = 2, 1105 .channels_min = 2,
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index ab2fdd76b693..60b0a5b1f1f1 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -382,7 +382,7 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
382 382
383static struct snd_soc_dai_driver imx_ac97_dai = { 383static struct snd_soc_dai_driver imx_ac97_dai = {
384 .probe = imx_ssi_dai_probe, 384 .probe = imx_ssi_dai_probe,
385 .ac97_control = 1, 385 .bus_control = true,
386 .playback = { 386 .playback = {
387 .stream_name = "AC97 Playback", 387 .stream_name = "AC97 Playback",
388 .channels_min = 2, 388 .channels_min = 2,
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 640801a60c12..c6ed6ba965a9 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -237,7 +237,7 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops = {
237static struct snd_soc_dai_driver psc_ac97_dai[] = { 237static struct snd_soc_dai_driver psc_ac97_dai[] = {
238{ 238{
239 .name = "mpc5200-psc-ac97.0", 239 .name = "mpc5200-psc-ac97.0",
240 .ac97_control = 1, 240 .bus_control = true,
241 .probe = psc_ac97_probe, 241 .probe = psc_ac97_probe,
242 .playback = { 242 .playback = {
243 .stream_name = "AC97 Playback", 243 .stream_name = "AC97 Playback",
@@ -257,7 +257,7 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
257}, 257},
258{ 258{
259 .name = "mpc5200-psc-ac97.1", 259 .name = "mpc5200-psc-ac97.1",
260 .ac97_control = 1, 260 .bus_control = true,
261 .playback = { 261 .playback = {
262 .stream_name = "AC97 SPDIF", 262 .stream_name = "AC97 SPDIF",
263 .channels_min = 1, 263 .channels_min = 1,
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index f2f67942b229..dff443e4b657 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -298,7 +298,7 @@ static const struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
298static struct snd_soc_dai_driver nuc900_ac97_dai = { 298static struct snd_soc_dai_driver nuc900_ac97_dai = {
299 .probe = nuc900_ac97_probe, 299 .probe = nuc900_ac97_probe,
300 .remove = nuc900_ac97_remove, 300 .remove = nuc900_ac97_remove,
301 .ac97_control = 1, 301 .bus_control = true,
302 .playback = { 302 .playback = {
303 .rates = SNDRV_PCM_RATE_8000_48000, 303 .rates = SNDRV_PCM_RATE_8000_48000,
304 .formats = SNDRV_PCM_FMTBIT_S16_LE, 304 .formats = SNDRV_PCM_FMTBIT_S16_LE,
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index ae956e3f4b9d..73ca2820c08c 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -157,7 +157,7 @@ static const struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = {
157static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = { 157static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
158{ 158{
159 .name = "pxa2xx-ac97", 159 .name = "pxa2xx-ac97",
160 .ac97_control = 1, 160 .bus_control = true,
161 .playback = { 161 .playback = {
162 .stream_name = "AC97 Playback", 162 .stream_name = "AC97 Playback",
163 .channels_min = 2, 163 .channels_min = 2,
@@ -174,7 +174,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
174}, 174},
175{ 175{
176 .name = "pxa2xx-ac97-aux", 176 .name = "pxa2xx-ac97-aux",
177 .ac97_control = 1, 177 .bus_control = true,
178 .playback = { 178 .playback = {
179 .stream_name = "AC97 Aux Playback", 179 .stream_name = "AC97 Aux Playback",
180 .channels_min = 1, 180 .channels_min = 1,
@@ -191,7 +191,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
191}, 191},
192{ 192{
193 .name = "pxa2xx-ac97-mic", 193 .name = "pxa2xx-ac97-mic",
194 .ac97_control = 1, 194 .bus_control = true,
195 .capture = { 195 .capture = {
196 .stream_name = "AC97 Mic Capture", 196 .stream_name = "AC97 Mic Capture",
197 .channels_min = 1, 197 .channels_min = 1,
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index e1615113fd84..7952a625669d 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -288,7 +288,7 @@ static int s3c_ac97_mic_dai_probe(struct snd_soc_dai *dai)
288static struct snd_soc_dai_driver s3c_ac97_dai[] = { 288static struct snd_soc_dai_driver s3c_ac97_dai[] = {
289 [S3C_AC97_DAI_PCM] = { 289 [S3C_AC97_DAI_PCM] = {
290 .name = "samsung-ac97", 290 .name = "samsung-ac97",
291 .ac97_control = 1, 291 .bus_control = true,
292 .playback = { 292 .playback = {
293 .stream_name = "AC97 Playback", 293 .stream_name = "AC97 Playback",
294 .channels_min = 2, 294 .channels_min = 2,
@@ -306,7 +306,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
306 }, 306 },
307 [S3C_AC97_DAI_MIC] = { 307 [S3C_AC97_DAI_MIC] = {
308 .name = "samsung-ac97-mic", 308 .name = "samsung-ac97-mic",
309 .ac97_control = 1, 309 .bus_control = true,
310 .capture = { 310 .capture = {
311 .stream_name = "AC97 Mic Capture", 311 .stream_name = "AC97 Mic Capture",
312 .channels_min = 1, 312 .channels_min = 1,
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index 0af2e4dfd139..d5f567e085ff 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -272,7 +272,7 @@ static const struct snd_soc_dai_ops hac_dai_ops = {
272static struct snd_soc_dai_driver sh4_hac_dai[] = { 272static struct snd_soc_dai_driver sh4_hac_dai[] = {
273{ 273{
274 .name = "hac-dai.0", 274 .name = "hac-dai.0",
275 .ac97_control = 1, 275 .bus_control = true,
276 .playback = { 276 .playback = {
277 .rates = AC97_RATES, 277 .rates = AC97_RATES,
278 .formats = AC97_FMTS, 278 .formats = AC97_FMTS,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fba6e28e18d3..f5bebca84b71 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -550,7 +550,7 @@ int snd_soc_suspend(struct device *dev)
550 if (card->rtd[i].dai_link->ignore_suspend) 550 if (card->rtd[i].dai_link->ignore_suspend)
551 continue; 551 continue;
552 552
553 if (cpu_dai->driver->suspend && !cpu_dai->driver->ac97_control) 553 if (cpu_dai->driver->suspend && !cpu_dai->driver->bus_control)
554 cpu_dai->driver->suspend(cpu_dai); 554 cpu_dai->driver->suspend(cpu_dai);
555 if (platform->driver->suspend && !platform->suspended) { 555 if (platform->driver->suspend && !platform->suspended) {
556 platform->driver->suspend(cpu_dai); 556 platform->driver->suspend(cpu_dai);
@@ -629,7 +629,7 @@ int snd_soc_suspend(struct device *dev)
629 if (card->rtd[i].dai_link->ignore_suspend) 629 if (card->rtd[i].dai_link->ignore_suspend)
630 continue; 630 continue;
631 631
632 if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control) 632 if (cpu_dai->driver->suspend && cpu_dai->driver->bus_control)
633 cpu_dai->driver->suspend(cpu_dai); 633 cpu_dai->driver->suspend(cpu_dai);
634 634
635 /* deactivate pins to sleep state */ 635 /* deactivate pins to sleep state */
@@ -665,14 +665,14 @@ static void soc_resume_deferred(struct work_struct *work)
665 if (card->resume_pre) 665 if (card->resume_pre)
666 card->resume_pre(card); 666 card->resume_pre(card);
667 667
668 /* resume AC97 DAIs */ 668 /* resume control bus DAIs */
669 for (i = 0; i < card->num_rtd; i++) { 669 for (i = 0; i < card->num_rtd; i++) {
670 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; 670 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
671 671
672 if (card->rtd[i].dai_link->ignore_suspend) 672 if (card->rtd[i].dai_link->ignore_suspend)
673 continue; 673 continue;
674 674
675 if (cpu_dai->driver->resume && cpu_dai->driver->ac97_control) 675 if (cpu_dai->driver->resume && cpu_dai->driver->bus_control)
676 cpu_dai->driver->resume(cpu_dai); 676 cpu_dai->driver->resume(cpu_dai);
677 } 677 }
678 678
@@ -733,7 +733,7 @@ static void soc_resume_deferred(struct work_struct *work)
733 if (card->rtd[i].dai_link->ignore_suspend) 733 if (card->rtd[i].dai_link->ignore_suspend)
734 continue; 734 continue;
735 735
736 if (cpu_dai->driver->resume && !cpu_dai->driver->ac97_control) 736 if (cpu_dai->driver->resume && !cpu_dai->driver->bus_control)
737 cpu_dai->driver->resume(cpu_dai); 737 cpu_dai->driver->resume(cpu_dai);
738 if (platform->driver->resume && platform->suspended) { 738 if (platform->driver->resume && platform->suspended) {
739 platform->driver->resume(cpu_dai); 739 platform->driver->resume(cpu_dai);
@@ -758,7 +758,8 @@ static void soc_resume_deferred(struct work_struct *work)
758int snd_soc_resume(struct device *dev) 758int snd_soc_resume(struct device *dev)
759{ 759{
760 struct snd_soc_card *card = dev_get_drvdata(dev); 760 struct snd_soc_card *card = dev_get_drvdata(dev);
761 int i, ac97_control = 0; 761 bool bus_control = false;
762 int i;
762 763
763 /* If the card is not initialized yet there is nothing to do */ 764 /* If the card is not initialized yet there is nothing to do */
764 if (!card->instantiated) 765 if (!card->instantiated)
@@ -781,17 +782,18 @@ int snd_soc_resume(struct device *dev)
781 } 782 }
782 } 783 }
783 784
784 /* AC97 devices might have other drivers hanging off them so 785 /*
785 * need to resume immediately. Other drivers don't have that 786 * DAIs that also act as the control bus master might have other drivers
786 * problem and may take a substantial amount of time to resume 787 * hanging off them so need to resume immediately. Other drivers don't
788 * have that problem and may take a substantial amount of time to resume
787 * due to I/O costs and anti-pop so handle them out of line. 789 * due to I/O costs and anti-pop so handle them out of line.
788 */ 790 */
789 for (i = 0; i < card->num_rtd; i++) { 791 for (i = 0; i < card->num_rtd; i++) {
790 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; 792 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
791 ac97_control |= cpu_dai->driver->ac97_control; 793 bus_control |= cpu_dai->driver->bus_control;
792 } 794 }
793 if (ac97_control) { 795 if (bus_control) {
794 dev_dbg(dev, "ASoC: Resuming AC97 immediately\n"); 796 dev_dbg(dev, "ASoC: Resuming control bus master immediately\n");
795 soc_resume_deferred(&card->deferred_resume_work); 797 soc_resume_deferred(&card->deferred_resume_work);
796 } else { 798 } else {
797 dev_dbg(dev, "ASoC: Scheduling resume work\n"); 799 dev_dbg(dev, "ASoC: Scheduling resume work\n");
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 3b0fa12dbff7..29a9957d335a 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -228,7 +228,7 @@ static int tegra20_ac97_probe(struct snd_soc_dai *dai)
228 228
229static struct snd_soc_dai_driver tegra20_ac97_dai = { 229static struct snd_soc_dai_driver tegra20_ac97_dai = {
230 .name = "tegra-ac97-pcm", 230 .name = "tegra-ac97-pcm",
231 .ac97_control = 1, 231 .bus_control = true,
232 .probe = tegra20_ac97_probe, 232 .probe = tegra20_ac97_probe,
233 .playback = { 233 .playback = {
234 .stream_name = "PCM Playback", 234 .stream_name = "PCM Playback",
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c
index 9edd68db9f48..f7135cdaa2ca 100644
--- a/sound/soc/txx9/txx9aclc-ac97.c
+++ b/sound/soc/txx9/txx9aclc-ac97.c
@@ -152,7 +152,7 @@ static int txx9aclc_ac97_remove(struct snd_soc_dai *dai)
152} 152}
153 153
154static struct snd_soc_dai_driver txx9aclc_ac97_dai = { 154static struct snd_soc_dai_driver txx9aclc_ac97_dai = {
155 .ac97_control = 1, 155 .bus_control = true,
156 .probe = txx9aclc_ac97_probe, 156 .probe = txx9aclc_ac97_probe,
157 .remove = txx9aclc_ac97_remove, 157 .remove = txx9aclc_ac97_remove,
158 .playback = { 158 .playback = {