aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c35
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c34
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c20
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c35
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c19
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c21
-rw-r--r--include/sound/simple_card.h12
-rw-r--r--sound/soc/generic/simple-card.c58
8 files changed, 116 insertions, 118 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 4c979039d97e..08294fa9e0d4 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -686,21 +686,21 @@ static struct platform_device fsi_device = {
686 }, 686 },
687}; 687};
688 688
689static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = {
690 .fmt = SND_SOC_DAIFMT_LEFT_J,
691 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
692 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
693 .sysclk = 11289600,
694};
695
696static struct asoc_simple_card_info fsi2_ak4643_info = { 689static struct asoc_simple_card_info fsi2_ak4643_info = {
697 .name = "AK4643", 690 .name = "AK4643",
698 .card = "FSI2A-AK4643", 691 .card = "FSI2A-AK4643",
699 .cpu_dai = "fsia-dai",
700 .codec = "ak4642-codec.0-0013", 692 .codec = "ak4642-codec.0-0013",
701 .platform = "sh_fsi2", 693 .platform = "sh_fsi2",
702 .codec_dai = "ak4642-hifi", 694 .daifmt = SND_SOC_DAIFMT_LEFT_J,
703 .init = &fsi2_ak4643_init_info, 695 .cpu_dai = {
696 .name = "fsia-dai",
697 .fmt = SND_SOC_DAIFMT_CBS_CFS,
698 },
699 .codec_dai = {
700 .name = "ak4642-hifi",
701 .fmt = SND_SOC_DAIFMT_CBM_CFM,
702 .sysclk = 11289600,
703 },
704}; 704};
705 705
706static struct platform_device fsi_ak4643_device = { 706static struct platform_device fsi_ak4643_device = {
@@ -809,19 +809,18 @@ static struct platform_device lcdc1_device = {
809 }, 809 },
810}; 810};
811 811
812static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
813 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM |
814 SND_SOC_DAIFMT_IB_NF,
815};
816
817static struct asoc_simple_card_info fsi2_hdmi_info = { 812static struct asoc_simple_card_info fsi2_hdmi_info = {
818 .name = "HDMI", 813 .name = "HDMI",
819 .card = "FSI2B-HDMI", 814 .card = "FSI2B-HDMI",
820 .cpu_dai = "fsib-dai",
821 .codec = "sh-mobile-hdmi", 815 .codec = "sh-mobile-hdmi",
822 .platform = "sh_fsi2", 816 .platform = "sh_fsi2",
823 .codec_dai = "sh_mobile_hdmi-hifi", 817 .cpu_dai = {
824 .init = &fsi2_hdmi_init_info, 818 .name = "fsib-dai",
819 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
820 },
821 .codec_dai = {
822 .name = "sh_mobile_hdmi-hifi",
823 },
825}; 824};
826 825
827static struct platform_device fsi_hdmi_device = { 826static struct platform_device fsi_hdmi_device = {
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 5353adf6b828..0679ca6bf1f6 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -806,21 +806,21 @@ static struct platform_device fsi_device = {
806}; 806};
807 807
808/* FSI-WM8978 */ 808/* FSI-WM8978 */
809static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
810 .fmt = SND_SOC_DAIFMT_I2S,
811 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
812 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
813 .sysclk = 12288000,
814};
815
816static struct asoc_simple_card_info fsi_wm8978_info = { 809static struct asoc_simple_card_info fsi_wm8978_info = {
817 .name = "wm8978", 810 .name = "wm8978",
818 .card = "FSI2A-WM8978", 811 .card = "FSI2A-WM8978",
819 .cpu_dai = "fsia-dai",
820 .codec = "wm8978.0-001a", 812 .codec = "wm8978.0-001a",
821 .platform = "sh_fsi2", 813 .platform = "sh_fsi2",
822 .codec_dai = "wm8978-hifi", 814 .daifmt = SND_SOC_DAIFMT_I2S,
823 .init = &fsi_wm8978_init_info, 815 .cpu_dai = {
816 .name = "fsia-dai",
817 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
818 },
819 .codec_dai = {
820 .name = "wm8978-hifi",
821 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
822 .sysclk = 12288000,
823 },
824}; 824};
825 825
826static struct platform_device fsi_wm8978_device = { 826static struct platform_device fsi_wm8978_device = {
@@ -832,18 +832,18 @@ static struct platform_device fsi_wm8978_device = {
832}; 832};
833 833
834/* FSI-HDMI */ 834/* FSI-HDMI */
835static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
836 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
837};
838
839static struct asoc_simple_card_info fsi2_hdmi_info = { 835static struct asoc_simple_card_info fsi2_hdmi_info = {
840 .name = "HDMI", 836 .name = "HDMI",
841 .card = "FSI2B-HDMI", 837 .card = "FSI2B-HDMI",
842 .cpu_dai = "fsib-dai",
843 .codec = "sh-mobile-hdmi", 838 .codec = "sh-mobile-hdmi",
844 .platform = "sh_fsi2", 839 .platform = "sh_fsi2",
845 .codec_dai = "sh_mobile_hdmi-hifi", 840 .cpu_dai = {
846 .init = &fsi2_hdmi_init_info, 841 .name = "fsib-dai",
842 .fmt = SND_SOC_DAIFMT_CBM_CFM,
843 },
844 .codec_dai = {
845 .name = "sh_mobile_hdmi-hifi",
846 },
847}; 847};
848 848
849static struct platform_device fsi_hdmi_device = { 849static struct platform_device fsi_hdmi_device = {
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index c02448d6847f..f41b71e8df3e 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -525,21 +525,21 @@ static struct platform_device fsi_device = {
525 }, 525 },
526}; 526};
527 527
528static struct asoc_simple_dai_init_info fsi2_ak4648_init_info = {
529 .fmt = SND_SOC_DAIFMT_LEFT_J,
530 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
531 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
532 .sysclk = 11289600,
533};
534
535static struct asoc_simple_card_info fsi2_ak4648_info = { 528static struct asoc_simple_card_info fsi2_ak4648_info = {
536 .name = "AK4648", 529 .name = "AK4648",
537 .card = "FSI2A-AK4648", 530 .card = "FSI2A-AK4648",
538 .cpu_dai = "fsia-dai",
539 .codec = "ak4642-codec.0-0012", 531 .codec = "ak4642-codec.0-0012",
540 .platform = "sh_fsi2", 532 .platform = "sh_fsi2",
541 .codec_dai = "ak4642-hifi", 533 .daifmt = SND_SOC_DAIFMT_LEFT_J,
542 .init = &fsi2_ak4648_init_info, 534 .cpu_dai = {
535 .name = "fsia-dai",
536 .fmt = SND_SOC_DAIFMT_CBS_CFS,
537 },
538 .codec_dai = {
539 .name = "ak4642-hifi",
540 .fmt = SND_SOC_DAIFMT_CBM_CFM,
541 .sysclk = 11289600,
542 },
543}; 543};
544 544
545static struct platform_device fsi_ak4648_device = { 545static struct platform_device fsi_ak4648_device = {
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index b5d210b4264c..3fd716dae405 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -502,19 +502,18 @@ static struct platform_device hdmi_lcdc_device = {
502 }, 502 },
503}; 503};
504 504
505static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
506 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM |
507 SND_SOC_DAIFMT_IB_NF,
508};
509
510static struct asoc_simple_card_info fsi2_hdmi_info = { 505static struct asoc_simple_card_info fsi2_hdmi_info = {
511 .name = "HDMI", 506 .name = "HDMI",
512 .card = "FSI2B-HDMI", 507 .card = "FSI2B-HDMI",
513 .cpu_dai = "fsib-dai",
514 .codec = "sh-mobile-hdmi", 508 .codec = "sh-mobile-hdmi",
515 .platform = "sh_fsi2", 509 .platform = "sh_fsi2",
516 .codec_dai = "sh_mobile_hdmi-hifi", 510 .cpu_dai = {
517 .init = &fsi2_hdmi_init_info, 511 .name = "fsib-dai",
512 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
513 },
514 .codec_dai = {
515 .name = "sh_mobile_hdmi-hifi",
516 },
518}; 517};
519 518
520static struct platform_device fsi_hdmi_device = { 519static struct platform_device fsi_hdmi_device = {
@@ -893,21 +892,21 @@ static struct platform_device fsi_device = {
893 }, 892 },
894}; 893};
895 894
896static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = {
897 .fmt = SND_SOC_DAIFMT_LEFT_J,
898 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
899 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
900 .sysclk = 11289600,
901};
902
903static struct asoc_simple_card_info fsi2_ak4643_info = { 895static struct asoc_simple_card_info fsi2_ak4643_info = {
904 .name = "AK4643", 896 .name = "AK4643",
905 .card = "FSI2A-AK4643", 897 .card = "FSI2A-AK4643",
906 .cpu_dai = "fsia-dai",
907 .codec = "ak4642-codec.0-0013", 898 .codec = "ak4642-codec.0-0013",
908 .platform = "sh_fsi2", 899 .platform = "sh_fsi2",
909 .codec_dai = "ak4642-hifi", 900 .daifmt = SND_SOC_DAIFMT_LEFT_J,
910 .init = &fsi2_ak4643_init_info, 901 .cpu_dai = {
902 .name = "fsia-dai",
903 .fmt = SND_SOC_DAIFMT_CBS_CFS,
904 },
905 .codec_dai = {
906 .name = "ak4642-hifi",
907 .fmt = SND_SOC_DAIFMT_CBM_CFM,
908 .sysclk = 11289600,
909 },
911}; 910};
912 911
913static struct platform_device fsi_ak4643_device = { 912static struct platform_device fsi_ak4643_device = {
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 8ebe4c7a766b..065e9600fae6 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -897,21 +897,20 @@ static struct platform_device fsi_device = {
897 .resource = fsi_resources, 897 .resource = fsi_resources,
898}; 898};
899 899
900static struct asoc_simple_dai_init_info fsi_da7210_init_info = {
901 .fmt = SND_SOC_DAIFMT_I2S,
902 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
903 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS |
904 SND_SOC_DAIFMT_IB_NF,
905};
906
907static struct asoc_simple_card_info fsi_da7210_info = { 900static struct asoc_simple_card_info fsi_da7210_info = {
908 .name = "DA7210", 901 .name = "DA7210",
909 .card = "FSIB-DA7210", 902 .card = "FSIB-DA7210",
910 .cpu_dai = "fsib-dai",
911 .codec = "da7210.0-001a", 903 .codec = "da7210.0-001a",
912 .platform = "sh_fsi.0", 904 .platform = "sh_fsi.0",
913 .codec_dai = "da7210-hifi", 905 .daifmt = SND_SOC_DAIFMT_I2S,
914 .init = &fsi_da7210_init_info, 906 .cpu_dai = {
907 .name = "fsib-dai",
908 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
909 },
910 .codec_dai = {
911 .name = "da7210-hifi",
912 .fmt = SND_SOC_DAIFMT_CBM_CFM,
913 },
915}; 914};
916 915
917static struct platform_device fsi_da7210_device = { 916static struct platform_device fsi_da7210_device = {
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 975608f5e805..4010e63e82d8 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -299,22 +299,21 @@ static struct platform_device fsi_device = {
299 .resource = fsi_resources, 299 .resource = fsi_resources,
300}; 300};
301 301
302static struct asoc_simple_dai_init_info fsi2_ak4642_init_info = {
303 .fmt = SND_SOC_DAIFMT_LEFT_J,
304 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
305 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS |
306 SND_SOC_DAIFMT_IB_NF,
307 .sysclk = 11289600,
308};
309
310static struct asoc_simple_card_info fsi_ak4642_info = { 302static struct asoc_simple_card_info fsi_ak4642_info = {
311 .name = "AK4642", 303 .name = "AK4642",
312 .card = "FSIA-AK4642", 304 .card = "FSIA-AK4642",
313 .cpu_dai = "fsia-dai",
314 .codec = "ak4642-codec.0-0012", 305 .codec = "ak4642-codec.0-0012",
315 .platform = "sh_fsi.0", 306 .platform = "sh_fsi.0",
316 .codec_dai = "ak4642-hifi", 307 .daifmt = SND_SOC_DAIFMT_LEFT_J,
317 .init = &fsi2_ak4642_init_info, 308 .cpu_dai = {
309 .name = "fsia-dai",
310 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
311 },
312 .codec_dai = {
313 .name = "ak4642-hifi",
314 .fmt = SND_SOC_DAIFMT_CBM_CFM,
315 .sysclk = 11289600,
316 },
318}; 317};
319 318
320static struct platform_device fsi_ak4642_device = { 319static struct platform_device fsi_ak4642_device = {
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 4b62b8dc6a4f..6c74527d4926 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -14,21 +14,21 @@
14 14
15#include <sound/soc.h> 15#include <sound/soc.h>
16 16
17struct asoc_simple_dai_init_info { 17struct asoc_simple_dai {
18 const char *name;
18 unsigned int fmt; 19 unsigned int fmt;
19 unsigned int cpu_daifmt;
20 unsigned int codec_daifmt;
21 unsigned int sysclk; 20 unsigned int sysclk;
22}; 21};
23 22
24struct asoc_simple_card_info { 23struct asoc_simple_card_info {
25 const char *name; 24 const char *name;
26 const char *card; 25 const char *card;
27 const char *cpu_dai;
28 const char *codec; 26 const char *codec;
29 const char *platform; 27 const char *platform;
30 const char *codec_dai; 28
31 struct asoc_simple_dai_init_info *init; /* for snd_link.init */ 29 unsigned int daifmt;
30 struct asoc_simple_dai cpu_dai;
31 struct asoc_simple_dai codec_dai;
32 32
33 /* used in simple-card.c */ 33 /* used in simple-card.c */
34 struct snd_soc_dai_link snd_link; 34 struct snd_soc_dai_link snd_link;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index bc050ec8680a..6cf8355a8542 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -16,33 +16,38 @@
16#define asoc_simple_get_card_info(p) \ 16#define asoc_simple_get_card_info(p) \
17 container_of(p->dai_link, struct asoc_simple_card_info, snd_link) 17 container_of(p->dai_link, struct asoc_simple_card_info, snd_link)
18 18
19static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
20 struct asoc_simple_dai *set,
21 unsigned int daifmt)
22{
23 int ret = 0;
24
25 daifmt |= set->fmt;
26
27 if (!ret && daifmt)
28 ret = snd_soc_dai_set_fmt(dai, daifmt);
29
30 if (!ret && set->sysclk)
31 ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
32
33 return ret;
34}
35
19static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) 36static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
20{ 37{
21 struct asoc_simple_card_info *cinfo = asoc_simple_get_card_info(rtd); 38 struct asoc_simple_card_info *info = asoc_simple_get_card_info(rtd);
22 struct asoc_simple_dai_init_info *iinfo = cinfo->init;
23 struct snd_soc_dai *codec = rtd->codec_dai; 39 struct snd_soc_dai *codec = rtd->codec_dai;
24 struct snd_soc_dai *cpu = rtd->cpu_dai; 40 struct snd_soc_dai *cpu = rtd->cpu_dai;
25 unsigned int cpu_daifmt = iinfo->fmt | iinfo->cpu_daifmt; 41 unsigned int daifmt = info->daifmt;
26 unsigned int codec_daifmt = iinfo->fmt | iinfo->codec_daifmt;
27 int ret; 42 int ret;
28 43
29 if (codec_daifmt) { 44 ret = __asoc_simple_card_dai_init(codec, &info->codec_dai, daifmt);
30 ret = snd_soc_dai_set_fmt(codec, codec_daifmt); 45 if (ret < 0)
31 if (ret < 0) 46 return ret;
32 return ret;
33 }
34
35 if (iinfo->sysclk) {
36 ret = snd_soc_dai_set_sysclk(codec, 0, iinfo->sysclk, 0);
37 if (ret < 0)
38 return ret;
39 }
40 47
41 if (cpu_daifmt) { 48 ret = __asoc_simple_card_dai_init(cpu, &info->cpu_dai, daifmt);
42 ret = snd_soc_dai_set_fmt(cpu, cpu_daifmt); 49 if (ret < 0)
43 if (ret < 0) 50 return ret;
44 return ret;
45 }
46 51
47 return 0; 52 return 0;
48} 53}
@@ -59,10 +64,10 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
59 64
60 if (!cinfo->name || 65 if (!cinfo->name ||
61 !cinfo->card || 66 !cinfo->card ||
62 !cinfo->cpu_dai ||
63 !cinfo->codec || 67 !cinfo->codec ||
64 !cinfo->platform || 68 !cinfo->platform ||
65 !cinfo->codec_dai) { 69 !cinfo->cpu_dai.name ||
70 !cinfo->codec_dai.name) {
66 dev_err(dev, "insufficient asoc_simple_card_info settings\n"); 71 dev_err(dev, "insufficient asoc_simple_card_info settings\n");
67 return -EINVAL; 72 return -EINVAL;
68 } 73 }
@@ -72,14 +77,11 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
72 */ 77 */
73 cinfo->snd_link.name = cinfo->name; 78 cinfo->snd_link.name = cinfo->name;
74 cinfo->snd_link.stream_name = cinfo->name; 79 cinfo->snd_link.stream_name = cinfo->name;
75 cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai; 80 cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name;
76 cinfo->snd_link.platform_name = cinfo->platform; 81 cinfo->snd_link.platform_name = cinfo->platform;
77 cinfo->snd_link.codec_name = cinfo->codec; 82 cinfo->snd_link.codec_name = cinfo->codec;
78 cinfo->snd_link.codec_dai_name = cinfo->codec_dai; 83 cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name;
79 84 cinfo->snd_link.init = asoc_simple_card_dai_init;
80 /* enable snd_link.init if cinfo has settings */
81 if (cinfo->init)
82 cinfo->snd_link.init = asoc_simple_card_dai_init;
83 85
84 /* 86 /*
85 * init snd_soc_card 87 * init snd_soc_card