aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-18 17:11:38 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-21 09:12:10 -0500
commitdee89c4d94433520e4e3977ae203d4cfbfe385fb (patch)
treebdbe4c54cd9789b02a6d0bf5f75a47b8721e073e /sound/soc/soc-core.c
parenta47cbe7263236691ee0bbc392f7fd4ec0da1159f (diff)
ASoC: Merge snd_soc_ops into snd_soc_dai_ops
Liam Girdwood's ASoC v2 work avoids having two different ops structures for DAIs by merging the members of struct snd_soc_ops into struct snd_soc_dai_ops, allowing per DAI configuration for everything. Backport this change. This paves the way for future work allowing any combination of DAIs to be connected rather than having fixed purpose CODEC and CPU DAIs and only allowing CODEC<->CPU interconnections. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c5cb9516fea4..43f4060dbe75 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -134,7 +134,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
134 134
135 /* startup the audio subsystem */ 135 /* startup the audio subsystem */
136 if (cpu_dai->ops.startup) { 136 if (cpu_dai->ops.startup) {
137 ret = cpu_dai->ops.startup(substream); 137 ret = cpu_dai->ops.startup(substream, cpu_dai);
138 if (ret < 0) { 138 if (ret < 0) {
139 printk(KERN_ERR "asoc: can't open interface %s\n", 139 printk(KERN_ERR "asoc: can't open interface %s\n",
140 cpu_dai->name); 140 cpu_dai->name);
@@ -151,7 +151,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
151 } 151 }
152 152
153 if (codec_dai->ops.startup) { 153 if (codec_dai->ops.startup) {
154 ret = codec_dai->ops.startup(substream); 154 ret = codec_dai->ops.startup(substream, codec_dai);
155 if (ret < 0) { 155 if (ret < 0) {
156 printk(KERN_ERR "asoc: can't open codec %s\n", 156 printk(KERN_ERR "asoc: can't open codec %s\n",
157 codec_dai->name); 157 codec_dai->name);
@@ -248,7 +248,7 @@ codec_dai_err:
248 248
249platform_err: 249platform_err:
250 if (cpu_dai->ops.shutdown) 250 if (cpu_dai->ops.shutdown)
251 cpu_dai->ops.shutdown(substream); 251 cpu_dai->ops.shutdown(substream, cpu_dai);
252out: 252out:
253 mutex_unlock(&pcm_mutex); 253 mutex_unlock(&pcm_mutex);
254 return ret; 254 return ret;
@@ -339,10 +339,10 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
339 snd_soc_dai_digital_mute(codec_dai, 1); 339 snd_soc_dai_digital_mute(codec_dai, 1);
340 340
341 if (cpu_dai->ops.shutdown) 341 if (cpu_dai->ops.shutdown)
342 cpu_dai->ops.shutdown(substream); 342 cpu_dai->ops.shutdown(substream, cpu_dai);
343 343
344 if (codec_dai->ops.shutdown) 344 if (codec_dai->ops.shutdown)
345 codec_dai->ops.shutdown(substream); 345 codec_dai->ops.shutdown(substream, codec_dai);
346 346
347 if (machine->ops && machine->ops->shutdown) 347 if (machine->ops && machine->ops->shutdown)
348 machine->ops->shutdown(substream); 348 machine->ops->shutdown(substream);
@@ -406,7 +406,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
406 } 406 }
407 407
408 if (codec_dai->ops.prepare) { 408 if (codec_dai->ops.prepare) {
409 ret = codec_dai->ops.prepare(substream); 409 ret = codec_dai->ops.prepare(substream, codec_dai);
410 if (ret < 0) { 410 if (ret < 0) {
411 printk(KERN_ERR "asoc: codec DAI prepare error\n"); 411 printk(KERN_ERR "asoc: codec DAI prepare error\n");
412 goto out; 412 goto out;
@@ -414,7 +414,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
414 } 414 }
415 415
416 if (cpu_dai->ops.prepare) { 416 if (cpu_dai->ops.prepare) {
417 ret = cpu_dai->ops.prepare(substream); 417 ret = cpu_dai->ops.prepare(substream, cpu_dai);
418 if (ret < 0) { 418 if (ret < 0) {
419 printk(KERN_ERR "asoc: cpu DAI prepare error\n"); 419 printk(KERN_ERR "asoc: cpu DAI prepare error\n");
420 goto out; 420 goto out;
@@ -491,7 +491,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
491 } 491 }
492 492
493 if (codec_dai->ops.hw_params) { 493 if (codec_dai->ops.hw_params) {
494 ret = codec_dai->ops.hw_params(substream, params); 494 ret = codec_dai->ops.hw_params(substream, params, codec_dai);
495 if (ret < 0) { 495 if (ret < 0) {
496 printk(KERN_ERR "asoc: can't set codec %s hw params\n", 496 printk(KERN_ERR "asoc: can't set codec %s hw params\n",
497 codec_dai->name); 497 codec_dai->name);
@@ -500,7 +500,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
500 } 500 }
501 501
502 if (cpu_dai->ops.hw_params) { 502 if (cpu_dai->ops.hw_params) {
503 ret = cpu_dai->ops.hw_params(substream, params); 503 ret = cpu_dai->ops.hw_params(substream, params, cpu_dai);
504 if (ret < 0) { 504 if (ret < 0) {
505 printk(KERN_ERR "asoc: interface %s hw params failed\n", 505 printk(KERN_ERR "asoc: interface %s hw params failed\n",
506 cpu_dai->name); 506 cpu_dai->name);
@@ -523,11 +523,11 @@ out:
523 523
524platform_err: 524platform_err:
525 if (cpu_dai->ops.hw_free) 525 if (cpu_dai->ops.hw_free)
526 cpu_dai->ops.hw_free(substream); 526 cpu_dai->ops.hw_free(substream, cpu_dai);
527 527
528interface_err: 528interface_err:
529 if (codec_dai->ops.hw_free) 529 if (codec_dai->ops.hw_free)
530 codec_dai->ops.hw_free(substream); 530 codec_dai->ops.hw_free(substream, codec_dai);
531 531
532codec_err: 532codec_err:
533 if (machine->ops && machine->ops->hw_free) 533 if (machine->ops && machine->ops->hw_free)
@@ -566,10 +566,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
566 566
567 /* now free hw params for the DAI's */ 567 /* now free hw params for the DAI's */
568 if (codec_dai->ops.hw_free) 568 if (codec_dai->ops.hw_free)
569 codec_dai->ops.hw_free(substream); 569 codec_dai->ops.hw_free(substream, codec_dai);
570 570
571 if (cpu_dai->ops.hw_free) 571 if (cpu_dai->ops.hw_free)
572 cpu_dai->ops.hw_free(substream); 572 cpu_dai->ops.hw_free(substream, cpu_dai);
573 573
574 mutex_unlock(&pcm_mutex); 574 mutex_unlock(&pcm_mutex);
575 return 0; 575 return 0;
@@ -586,7 +586,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
586 int ret; 586 int ret;
587 587
588 if (codec_dai->ops.trigger) { 588 if (codec_dai->ops.trigger) {
589 ret = codec_dai->ops.trigger(substream, cmd); 589 ret = codec_dai->ops.trigger(substream, cmd, codec_dai);
590 if (ret < 0) 590 if (ret < 0)
591 return ret; 591 return ret;
592 } 592 }
@@ -598,7 +598,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
598 } 598 }
599 599
600 if (cpu_dai->ops.trigger) { 600 if (cpu_dai->ops.trigger) {
601 ret = cpu_dai->ops.trigger(substream, cmd); 601 ret = cpu_dai->ops.trigger(substream, cmd, cpu_dai);
602 if (ret < 0) 602 if (ret < 0)
603 return ret; 603 return ret;
604 } 604 }
@@ -637,10 +637,10 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
637 snd_power_change_state(codec->card, SNDRV_CTL_POWER_D3hot); 637 snd_power_change_state(codec->card, SNDRV_CTL_POWER_D3hot);
638 638
639 /* mute any active DAC's */ 639 /* mute any active DAC's */
640 for (i = 0; i < machine->num_links; i++) { 640 for (i = 0; i < card->num_links; i++) {
641 struct snd_soc_dai *dai = machine->dai_link[i].codec_dai; 641 struct snd_soc_dai *dai = card->dai_link[i].codec_dai;
642 if (dai->dai_ops.digital_mute && dai->playback.active) 642 if (dai->ops.digital_mute && dai->playback.active)
643 dai->dai_ops.digital_mute(dai, 1); 643 dai->ops.digital_mute(dai, 1);
644 } 644 }
645 645
646 /* suspend all pcms */ 646 /* suspend all pcms */
@@ -733,10 +733,10 @@ static void soc_resume_deferred(struct work_struct *work)
733 } 733 }
734 734
735 /* unmute any active DACs */ 735 /* unmute any active DACs */
736 for (i = 0; i < machine->num_links; i++) { 736 for (i = 0; i < card->num_links; i++) {
737 struct snd_soc_dai *dai = machine->dai_link[i].codec_dai; 737 struct snd_soc_dai *dai = card->dai_link[i].codec_dai;
738 if (dai->dai_ops.digital_mute && dai->playback.active) 738 if (dai->ops.digital_mute && dai->playback.active)
739 dai->dai_ops.digital_mute(dai, 0); 739 dai->ops.digital_mute(dai, 0);
740 } 740 }
741 741
742 for (i = 0; i < card->num_links; i++) { 742 for (i = 0; i < card->num_links; i++) {
@@ -1849,8 +1849,8 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_s8);
1849int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, 1849int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
1850 unsigned int freq, int dir) 1850 unsigned int freq, int dir)
1851{ 1851{
1852 if (dai->dai_ops.set_sysclk) 1852 if (dai->ops.set_sysclk)
1853 return dai->dai_ops.set_sysclk(dai, clk_id, freq, dir); 1853 return dai->ops.set_sysclk(dai, clk_id, freq, dir);
1854 else 1854 else
1855 return -EINVAL; 1855 return -EINVAL;
1856} 1856}
@@ -1869,8 +1869,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
1869int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, 1869int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
1870 int div_id, int div) 1870 int div_id, int div)
1871{ 1871{
1872 if (dai->dai_ops.set_clkdiv) 1872 if (dai->ops.set_clkdiv)
1873 return dai->dai_ops.set_clkdiv(dai, div_id, div); 1873 return dai->ops.set_clkdiv(dai, div_id, div);
1874 else 1874 else
1875 return -EINVAL; 1875 return -EINVAL;
1876} 1876}
@@ -1888,8 +1888,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv);
1888int snd_soc_dai_set_pll(struct snd_soc_dai *dai, 1888int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
1889 int pll_id, unsigned int freq_in, unsigned int freq_out) 1889 int pll_id, unsigned int freq_in, unsigned int freq_out)
1890{ 1890{
1891 if (dai->dai_ops.set_pll) 1891 if (dai->ops.set_pll)
1892 return dai->dai_ops.set_pll(dai, pll_id, freq_in, freq_out); 1892 return dai->ops.set_pll(dai, pll_id, freq_in, freq_out);
1893 else 1893 else
1894 return -EINVAL; 1894 return -EINVAL;
1895} 1895}
@@ -1905,8 +1905,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll);
1905 */ 1905 */
1906int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 1906int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1907{ 1907{
1908 if (dai->dai_ops.set_fmt) 1908 if (dai->ops.set_fmt)
1909 return dai->dai_ops.set_fmt(dai, fmt); 1909 return dai->ops.set_fmt(dai, fmt);
1910 else 1910 else
1911 return -EINVAL; 1911 return -EINVAL;
1912} 1912}
@@ -1924,8 +1924,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt);
1924int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 1924int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
1925 unsigned int mask, int slots) 1925 unsigned int mask, int slots)
1926{ 1926{
1927 if (dai->dai_ops.set_sysclk) 1927 if (dai->ops.set_sysclk)
1928 return dai->dai_ops.set_tdm_slot(dai, mask, slots); 1928 return dai->ops.set_tdm_slot(dai, mask, slots);
1929 else 1929 else
1930 return -EINVAL; 1930 return -EINVAL;
1931} 1931}
@@ -1940,8 +1940,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);
1940 */ 1940 */
1941int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) 1941int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate)
1942{ 1942{
1943 if (dai->dai_ops.set_sysclk) 1943 if (dai->ops.set_sysclk)
1944 return dai->dai_ops.set_tristate(dai, tristate); 1944 return dai->ops.set_tristate(dai, tristate);
1945 else 1945 else
1946 return -EINVAL; 1946 return -EINVAL;
1947} 1947}
@@ -1956,8 +1956,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate);
1956 */ 1956 */
1957int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute) 1957int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute)
1958{ 1958{
1959 if (dai->dai_ops.digital_mute) 1959 if (dai->ops.digital_mute)
1960 return dai->dai_ops.digital_mute(dai, mute); 1960 return dai->ops.digital_mute(dai, mute);
1961 else 1961 else
1962 return -EINVAL; 1962 return -EINVAL;
1963} 1963}