diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /sound/soc/sh | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/fsi-ak4642.c | 209 | ||||
-rw-r--r-- | sound/soc/sh/fsi-da7210.c | 79 | ||||
-rw-r--r-- | sound/soc/sh/fsi-hdmi.c | 127 |
3 files changed, 415 insertions, 0 deletions
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c new file mode 100644 index 00000000000..770a71a1536 --- /dev/null +++ b/sound/soc/sh/fsi-ak4642.c | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * FSI-AK464x sound support for ms7724se | ||
3 | * | ||
4 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/platform_device.h> | ||
13 | #include <sound/sh_fsi.h> | ||
14 | |||
15 | struct fsi_ak4642_data { | ||
16 | const char *name; | ||
17 | const char *card; | ||
18 | const char *cpu_dai; | ||
19 | const char *codec; | ||
20 | const char *platform; | ||
21 | int id; | ||
22 | }; | ||
23 | |||
24 | static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) | ||
25 | { | ||
26 | struct snd_soc_dai *codec = rtd->codec_dai; | ||
27 | struct snd_soc_dai *cpu = rtd->cpu_dai; | ||
28 | int ret; | ||
29 | |||
30 | ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J | | ||
31 | SND_SOC_DAIFMT_CBM_CFM); | ||
32 | if (ret < 0) | ||
33 | return ret; | ||
34 | |||
35 | ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0); | ||
36 | if (ret < 0) | ||
37 | return ret; | ||
38 | |||
39 | ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J | | ||
40 | SND_SOC_DAIFMT_CBS_CFS); | ||
41 | |||
42 | return ret; | ||
43 | } | ||
44 | |||
45 | static struct snd_soc_dai_link fsi_dai_link = { | ||
46 | .codec_dai_name = "ak4642-hifi", | ||
47 | .init = fsi_ak4642_dai_init, | ||
48 | }; | ||
49 | |||
50 | static struct snd_soc_card fsi_soc_card = { | ||
51 | .dai_link = &fsi_dai_link, | ||
52 | .num_links = 1, | ||
53 | }; | ||
54 | |||
55 | static struct platform_device *fsi_snd_device; | ||
56 | |||
57 | static int fsi_ak4642_probe(struct platform_device *pdev) | ||
58 | { | ||
59 | int ret = -ENOMEM; | ||
60 | const struct platform_device_id *id_entry; | ||
61 | struct fsi_ak4642_data *pdata; | ||
62 | |||
63 | id_entry = pdev->id_entry; | ||
64 | if (!id_entry) { | ||
65 | dev_err(&pdev->dev, "unknown fsi ak4642\n"); | ||
66 | return -ENODEV; | ||
67 | } | ||
68 | |||
69 | pdata = (struct fsi_ak4642_data *)id_entry->driver_data; | ||
70 | |||
71 | fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); | ||
72 | if (!fsi_snd_device) | ||
73 | goto out; | ||
74 | |||
75 | fsi_dai_link.name = pdata->name; | ||
76 | fsi_dai_link.stream_name = pdata->name; | ||
77 | fsi_dai_link.cpu_dai_name = pdata->cpu_dai; | ||
78 | fsi_dai_link.platform_name = pdata->platform; | ||
79 | fsi_dai_link.codec_name = pdata->codec; | ||
80 | fsi_soc_card.name = pdata->card; | ||
81 | |||
82 | platform_set_drvdata(fsi_snd_device, &fsi_soc_card); | ||
83 | ret = platform_device_add(fsi_snd_device); | ||
84 | |||
85 | if (ret) | ||
86 | platform_device_put(fsi_snd_device); | ||
87 | |||
88 | out: | ||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static int fsi_ak4642_remove(struct platform_device *pdev) | ||
93 | { | ||
94 | platform_device_unregister(fsi_snd_device); | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static struct fsi_ak4642_data fsi_a_ak4642 = { | ||
99 | .name = "AK4642", | ||
100 | .card = "FSIA-AK4642", | ||
101 | .cpu_dai = "fsia-dai", | ||
102 | .codec = "ak4642-codec.0-0012", | ||
103 | .platform = "sh_fsi.0", | ||
104 | .id = FSI_PORT_A, | ||
105 | }; | ||
106 | |||
107 | static struct fsi_ak4642_data fsi_b_ak4642 = { | ||
108 | .name = "AK4642", | ||
109 | .card = "FSIB-AK4642", | ||
110 | .cpu_dai = "fsib-dai", | ||
111 | .codec = "ak4642-codec.0-0012", | ||
112 | .platform = "sh_fsi.0", | ||
113 | .id = FSI_PORT_B, | ||
114 | }; | ||
115 | |||
116 | static struct fsi_ak4642_data fsi_a_ak4643 = { | ||
117 | .name = "AK4643", | ||
118 | .card = "FSIA-AK4643", | ||
119 | .cpu_dai = "fsia-dai", | ||
120 | .codec = "ak4642-codec.0-0013", | ||
121 | .platform = "sh_fsi.0", | ||
122 | .id = FSI_PORT_A, | ||
123 | }; | ||
124 | |||
125 | static struct fsi_ak4642_data fsi_b_ak4643 = { | ||
126 | .name = "AK4643", | ||
127 | .card = "FSIB-AK4643", | ||
128 | .cpu_dai = "fsib-dai", | ||
129 | .codec = "ak4642-codec.0-0013", | ||
130 | .platform = "sh_fsi.0", | ||
131 | .id = FSI_PORT_B, | ||
132 | }; | ||
133 | |||
134 | static struct fsi_ak4642_data fsi2_a_ak4642 = { | ||
135 | .name = "AK4642", | ||
136 | .card = "FSI2A-AK4642", | ||
137 | .cpu_dai = "fsia-dai", | ||
138 | .codec = "ak4642-codec.0-0012", | ||
139 | .platform = "sh_fsi2", | ||
140 | .id = FSI_PORT_A, | ||
141 | }; | ||
142 | |||
143 | static struct fsi_ak4642_data fsi2_b_ak4642 = { | ||
144 | .name = "AK4642", | ||
145 | .card = "FSI2B-AK4642", | ||
146 | .cpu_dai = "fsib-dai", | ||
147 | .codec = "ak4642-codec.0-0012", | ||
148 | .platform = "sh_fsi2", | ||
149 | .id = FSI_PORT_B, | ||
150 | }; | ||
151 | |||
152 | static struct fsi_ak4642_data fsi2_a_ak4643 = { | ||
153 | .name = "AK4643", | ||
154 | .card = "FSI2A-AK4643", | ||
155 | .cpu_dai = "fsia-dai", | ||
156 | .codec = "ak4642-codec.0-0013", | ||
157 | .platform = "sh_fsi2", | ||
158 | .id = FSI_PORT_A, | ||
159 | }; | ||
160 | |||
161 | static struct fsi_ak4642_data fsi2_b_ak4643 = { | ||
162 | .name = "AK4643", | ||
163 | .card = "FSI2B-AK4643", | ||
164 | .cpu_dai = "fsib-dai", | ||
165 | .codec = "ak4642-codec.0-0013", | ||
166 | .platform = "sh_fsi2", | ||
167 | .id = FSI_PORT_B, | ||
168 | }; | ||
169 | |||
170 | static struct platform_device_id fsi_id_table[] = { | ||
171 | /* FSI */ | ||
172 | { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 }, | ||
173 | { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 }, | ||
174 | { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 }, | ||
175 | { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 }, | ||
176 | |||
177 | /* FSI 2 */ | ||
178 | { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 }, | ||
179 | { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 }, | ||
180 | { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 }, | ||
181 | { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 }, | ||
182 | {}, | ||
183 | }; | ||
184 | |||
185 | static struct platform_driver fsi_ak4642 = { | ||
186 | .driver = { | ||
187 | .name = "fsi-ak4642-audio", | ||
188 | }, | ||
189 | .probe = fsi_ak4642_probe, | ||
190 | .remove = fsi_ak4642_remove, | ||
191 | .id_table = fsi_id_table, | ||
192 | }; | ||
193 | |||
194 | static int __init fsi_ak4642_init(void) | ||
195 | { | ||
196 | return platform_driver_register(&fsi_ak4642); | ||
197 | } | ||
198 | |||
199 | static void __exit fsi_ak4642_exit(void) | ||
200 | { | ||
201 | platform_driver_unregister(&fsi_ak4642); | ||
202 | } | ||
203 | |||
204 | module_init(fsi_ak4642_init); | ||
205 | module_exit(fsi_ak4642_exit); | ||
206 | |||
207 | MODULE_LICENSE("GPL"); | ||
208 | MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); | ||
209 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); | ||
diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c new file mode 100644 index 00000000000..59553fd8c2f --- /dev/null +++ b/sound/soc/sh/fsi-da7210.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * fsi-da7210.c | ||
3 | * | ||
4 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/platform_device.h> | ||
14 | #include <sound/sh_fsi.h> | ||
15 | |||
16 | static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) | ||
17 | { | ||
18 | struct snd_soc_dai *codec = rtd->codec_dai; | ||
19 | struct snd_soc_dai *cpu = rtd->cpu_dai; | ||
20 | int ret; | ||
21 | |||
22 | ret = snd_soc_dai_set_fmt(codec, | ||
23 | SND_SOC_DAIFMT_I2S | | ||
24 | SND_SOC_DAIFMT_CBM_CFM); | ||
25 | if (ret < 0) | ||
26 | return ret; | ||
27 | |||
28 | ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S | | ||
29 | SND_SOC_DAIFMT_CBS_CFS); | ||
30 | |||
31 | return ret; | ||
32 | } | ||
33 | |||
34 | static struct snd_soc_dai_link fsi_da7210_dai = { | ||
35 | .name = "DA7210", | ||
36 | .stream_name = "DA7210", | ||
37 | .cpu_dai_name = "fsib-dai", /* FSI B */ | ||
38 | .codec_dai_name = "da7210-hifi", | ||
39 | .platform_name = "sh_fsi.0", | ||
40 | .codec_name = "da7210-codec.0-001a", | ||
41 | .init = fsi_da7210_init, | ||
42 | }; | ||
43 | |||
44 | static struct snd_soc_card fsi_soc_card = { | ||
45 | .name = "FSI-DA7210", | ||
46 | .dai_link = &fsi_da7210_dai, | ||
47 | .num_links = 1, | ||
48 | }; | ||
49 | |||
50 | static struct platform_device *fsi_da7210_snd_device; | ||
51 | |||
52 | static int __init fsi_da7210_sound_init(void) | ||
53 | { | ||
54 | int ret; | ||
55 | |||
56 | fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); | ||
57 | if (!fsi_da7210_snd_device) | ||
58 | return -ENOMEM; | ||
59 | |||
60 | platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); | ||
61 | ret = platform_device_add(fsi_da7210_snd_device); | ||
62 | if (ret) | ||
63 | platform_device_put(fsi_da7210_snd_device); | ||
64 | |||
65 | return ret; | ||
66 | } | ||
67 | |||
68 | static void __exit fsi_da7210_sound_exit(void) | ||
69 | { | ||
70 | platform_device_unregister(fsi_da7210_snd_device); | ||
71 | } | ||
72 | |||
73 | module_init(fsi_da7210_sound_init); | ||
74 | module_exit(fsi_da7210_sound_exit); | ||
75 | |||
76 | /* Module information */ | ||
77 | MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); | ||
78 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); | ||
79 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c new file mode 100644 index 00000000000..d3d9fd88068 --- /dev/null +++ b/sound/soc/sh/fsi-hdmi.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * FSI - HDMI sound support | ||
3 | * | ||
4 | * Copyright (C) 2010 Renesas Solutions Corp. | ||
5 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/platform_device.h> | ||
13 | #include <sound/sh_fsi.h> | ||
14 | |||
15 | struct fsi_hdmi_data { | ||
16 | const char *cpu_dai; | ||
17 | const char *card; | ||
18 | int id; | ||
19 | }; | ||
20 | |||
21 | static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) | ||
22 | { | ||
23 | struct snd_soc_dai *cpu = rtd->cpu_dai; | ||
24 | int ret; | ||
25 | |||
26 | ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM); | ||
27 | |||
28 | return ret; | ||
29 | } | ||
30 | |||
31 | static struct snd_soc_dai_link fsi_dai_link = { | ||
32 | .name = "HDMI", | ||
33 | .stream_name = "HDMI", | ||
34 | .codec_dai_name = "sh_mobile_hdmi-hifi", | ||
35 | .platform_name = "sh_fsi2", | ||
36 | .codec_name = "sh-mobile-hdmi", | ||
37 | .init = fsi_hdmi_dai_init, | ||
38 | }; | ||
39 | |||
40 | static struct snd_soc_card fsi_soc_card = { | ||
41 | .dai_link = &fsi_dai_link, | ||
42 | .num_links = 1, | ||
43 | }; | ||
44 | |||
45 | static struct platform_device *fsi_snd_device; | ||
46 | |||
47 | static int fsi_hdmi_probe(struct platform_device *pdev) | ||
48 | { | ||
49 | int ret = -ENOMEM; | ||
50 | const struct platform_device_id *id_entry; | ||
51 | struct fsi_hdmi_data *pdata; | ||
52 | |||
53 | id_entry = pdev->id_entry; | ||
54 | if (!id_entry) { | ||
55 | dev_err(&pdev->dev, "unknown fsi hdmi\n"); | ||
56 | return -ENODEV; | ||
57 | } | ||
58 | |||
59 | pdata = (struct fsi_hdmi_data *)id_entry->driver_data; | ||
60 | |||
61 | fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); | ||
62 | if (!fsi_snd_device) | ||
63 | goto out; | ||
64 | |||
65 | fsi_dai_link.cpu_dai_name = pdata->cpu_dai; | ||
66 | fsi_soc_card.name = pdata->card; | ||
67 | |||
68 | platform_set_drvdata(fsi_snd_device, &fsi_soc_card); | ||
69 | ret = platform_device_add(fsi_snd_device); | ||
70 | |||
71 | if (ret) | ||
72 | platform_device_put(fsi_snd_device); | ||
73 | |||
74 | out: | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | static int fsi_hdmi_remove(struct platform_device *pdev) | ||
79 | { | ||
80 | platform_device_unregister(fsi_snd_device); | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | static struct fsi_hdmi_data fsi2_a_hdmi = { | ||
85 | .cpu_dai = "fsia-dai", | ||
86 | .card = "FSI2A-HDMI", | ||
87 | .id = FSI_PORT_A, | ||
88 | }; | ||
89 | |||
90 | static struct fsi_hdmi_data fsi2_b_hdmi = { | ||
91 | .cpu_dai = "fsib-dai", | ||
92 | .card = "FSI2B-HDMI", | ||
93 | .id = FSI_PORT_B, | ||
94 | }; | ||
95 | |||
96 | static struct platform_device_id fsi_id_table[] = { | ||
97 | /* FSI 2 */ | ||
98 | { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi }, | ||
99 | { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi }, | ||
100 | {}, | ||
101 | }; | ||
102 | |||
103 | static struct platform_driver fsi_hdmi = { | ||
104 | .driver = { | ||
105 | .name = "fsi-hdmi-audio", | ||
106 | }, | ||
107 | .probe = fsi_hdmi_probe, | ||
108 | .remove = fsi_hdmi_remove, | ||
109 | .id_table = fsi_id_table, | ||
110 | }; | ||
111 | |||
112 | static int __init fsi_hdmi_init(void) | ||
113 | { | ||
114 | return platform_driver_register(&fsi_hdmi); | ||
115 | } | ||
116 | |||
117 | static void __exit fsi_hdmi_exit(void) | ||
118 | { | ||
119 | platform_driver_unregister(&fsi_hdmi); | ||
120 | } | ||
121 | |||
122 | module_init(fsi_hdmi_init); | ||
123 | module_exit(fsi_hdmi_exit); | ||
124 | |||
125 | MODULE_LICENSE("GPL"); | ||
126 | MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); | ||
127 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); | ||