diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-23 19:55:34 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-24 05:31:26 -0500 |
commit | 45f3121615b2b354f7d95d30f795bc5fe0043e92 (patch) | |
tree | 25f1e1be27e08c5b955fb5b31150a47032df1251 /sound/soc/sh | |
parent | 39afd66cead742e99c051d6f3b07f89d09eebbbb (diff) |
ASoC: fsi-ak4642: modify specification method of FSI / ak464x
Current fsi-ak4642 was using id_entry name in order to specify
FSI port and ak464x codec.
But it was no sense, no flexibility.
Platform can specify FSI/ak464x pair by this patch.
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/fsi-ak4642.c | 114 |
1 files changed, 11 insertions, 103 deletions
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index dff64b95f5dc..11d2d7ff29d9 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c | |||
@@ -58,27 +58,23 @@ static struct platform_device *fsi_snd_device; | |||
58 | static int fsi_ak4642_probe(struct platform_device *pdev) | 58 | static int fsi_ak4642_probe(struct platform_device *pdev) |
59 | { | 59 | { |
60 | int ret = -ENOMEM; | 60 | int ret = -ENOMEM; |
61 | const struct platform_device_id *id_entry; | 61 | struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; |
62 | struct fsi_ak4642_data *pdata; | ||
63 | 62 | ||
64 | id_entry = pdev->id_entry; | 63 | if (!pinfo) { |
65 | if (!id_entry) { | 64 | dev_err(&pdev->dev, "no info for fsi ak4642\n"); |
66 | dev_err(&pdev->dev, "unknown fsi ak4642\n"); | 65 | goto out; |
67 | return -ENODEV; | ||
68 | } | 66 | } |
69 | 67 | ||
70 | pdata = (struct fsi_ak4642_data *)id_entry->driver_data; | 68 | fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); |
71 | |||
72 | fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); | ||
73 | if (!fsi_snd_device) | 69 | if (!fsi_snd_device) |
74 | goto out; | 70 | goto out; |
75 | 71 | ||
76 | fsi_dai_link.name = pdata->name; | 72 | fsi_dai_link.name = pinfo->name; |
77 | fsi_dai_link.stream_name = pdata->name; | 73 | fsi_dai_link.stream_name = pinfo->name; |
78 | fsi_dai_link.cpu_dai_name = pdata->cpu_dai; | 74 | fsi_dai_link.cpu_dai_name = pinfo->cpu_dai; |
79 | fsi_dai_link.platform_name = pdata->platform; | 75 | fsi_dai_link.platform_name = pinfo->platform; |
80 | fsi_dai_link.codec_name = pdata->codec; | 76 | fsi_dai_link.codec_name = pinfo->codec; |
81 | fsi_soc_card.name = pdata->card; | 77 | fsi_soc_card.name = pinfo->card; |
82 | 78 | ||
83 | platform_set_drvdata(fsi_snd_device, &fsi_soc_card); | 79 | platform_set_drvdata(fsi_snd_device, &fsi_soc_card); |
84 | ret = platform_device_add(fsi_snd_device); | 80 | ret = platform_device_add(fsi_snd_device); |
@@ -96,100 +92,12 @@ static int fsi_ak4642_remove(struct platform_device *pdev) | |||
96 | return 0; | 92 | return 0; |
97 | } | 93 | } |
98 | 94 | ||
99 | static struct fsi_ak4642_data fsi_a_ak4642 = { | ||
100 | .name = "AK4642", | ||
101 | .card = "FSIA-AK4642", | ||
102 | .cpu_dai = "fsia-dai", | ||
103 | .codec = "ak4642-codec.0-0012", | ||
104 | .platform = "sh_fsi.0", | ||
105 | .id = FSI_PORT_A, | ||
106 | }; | ||
107 | |||
108 | static struct fsi_ak4642_data fsi_b_ak4642 = { | ||
109 | .name = "AK4642", | ||
110 | .card = "FSIB-AK4642", | ||
111 | .cpu_dai = "fsib-dai", | ||
112 | .codec = "ak4642-codec.0-0012", | ||
113 | .platform = "sh_fsi.0", | ||
114 | .id = FSI_PORT_B, | ||
115 | }; | ||
116 | |||
117 | static struct fsi_ak4642_data fsi_a_ak4643 = { | ||
118 | .name = "AK4643", | ||
119 | .card = "FSIA-AK4643", | ||
120 | .cpu_dai = "fsia-dai", | ||
121 | .codec = "ak4642-codec.0-0013", | ||
122 | .platform = "sh_fsi.0", | ||
123 | .id = FSI_PORT_A, | ||
124 | }; | ||
125 | |||
126 | static struct fsi_ak4642_data fsi_b_ak4643 = { | ||
127 | .name = "AK4643", | ||
128 | .card = "FSIB-AK4643", | ||
129 | .cpu_dai = "fsib-dai", | ||
130 | .codec = "ak4642-codec.0-0013", | ||
131 | .platform = "sh_fsi.0", | ||
132 | .id = FSI_PORT_B, | ||
133 | }; | ||
134 | |||
135 | static struct fsi_ak4642_data fsi2_a_ak4642 = { | ||
136 | .name = "AK4642", | ||
137 | .card = "FSI2A-AK4642", | ||
138 | .cpu_dai = "fsia-dai", | ||
139 | .codec = "ak4642-codec.0-0012", | ||
140 | .platform = "sh_fsi2", | ||
141 | .id = FSI_PORT_A, | ||
142 | }; | ||
143 | |||
144 | static struct fsi_ak4642_data fsi2_b_ak4642 = { | ||
145 | .name = "AK4642", | ||
146 | .card = "FSI2B-AK4642", | ||
147 | .cpu_dai = "fsib-dai", | ||
148 | .codec = "ak4642-codec.0-0012", | ||
149 | .platform = "sh_fsi2", | ||
150 | .id = FSI_PORT_B, | ||
151 | }; | ||
152 | |||
153 | static struct fsi_ak4642_data fsi2_a_ak4643 = { | ||
154 | .name = "AK4643", | ||
155 | .card = "FSI2A-AK4643", | ||
156 | .cpu_dai = "fsia-dai", | ||
157 | .codec = "ak4642-codec.0-0013", | ||
158 | .platform = "sh_fsi2", | ||
159 | .id = FSI_PORT_A, | ||
160 | }; | ||
161 | |||
162 | static struct fsi_ak4642_data fsi2_b_ak4643 = { | ||
163 | .name = "AK4643", | ||
164 | .card = "FSI2B-AK4643", | ||
165 | .cpu_dai = "fsib-dai", | ||
166 | .codec = "ak4642-codec.0-0013", | ||
167 | .platform = "sh_fsi2", | ||
168 | .id = FSI_PORT_B, | ||
169 | }; | ||
170 | |||
171 | static struct platform_device_id fsi_id_table[] = { | ||
172 | /* FSI */ | ||
173 | { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 }, | ||
174 | { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 }, | ||
175 | { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 }, | ||
176 | { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 }, | ||
177 | |||
178 | /* FSI 2 */ | ||
179 | { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 }, | ||
180 | { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 }, | ||
181 | { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 }, | ||
182 | { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 }, | ||
183 | {}, | ||
184 | }; | ||
185 | |||
186 | static struct platform_driver fsi_ak4642 = { | 95 | static struct platform_driver fsi_ak4642 = { |
187 | .driver = { | 96 | .driver = { |
188 | .name = "fsi-ak4642-audio", | 97 | .name = "fsi-ak4642-audio", |
189 | }, | 98 | }, |
190 | .probe = fsi_ak4642_probe, | 99 | .probe = fsi_ak4642_probe, |
191 | .remove = fsi_ak4642_remove, | 100 | .remove = fsi_ak4642_remove, |
192 | .id_table = fsi_id_table, | ||
193 | }; | 101 | }; |
194 | 102 | ||
195 | static int __init fsi_ak4642_init(void) | 103 | static int __init fsi_ak4642_init(void) |