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 | |
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>
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 14 | ||||
-rw-r--r-- | arch/sh/boards/mach-se/7724/setup.c | 14 | ||||
-rw-r--r-- | include/sound/sh_fsi.h | 12 | ||||
-rw-r--r-- | sound/soc/sh/fsi-ak4642.c | 114 |
5 files changed, 63 insertions, 106 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index a3aa0f6df964..ade98c2d9e81 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -762,9 +762,22 @@ static struct platform_device fsi_device = { | |||
762 | }, | 762 | }, |
763 | }; | 763 | }; |
764 | 764 | ||
765 | static struct fsi_ak4642_info fsi2_ak4643_info = { | ||
766 | .name = "AK4643", | ||
767 | .card = "FSI2A-AK4643", | ||
768 | .cpu_dai = "fsia-dai", | ||
769 | .codec = "ak4642-codec.0-0013", | ||
770 | .platform = "sh_fsi2", | ||
771 | .id = FSI_PORT_A, | ||
772 | }; | ||
773 | |||
765 | static struct platform_device fsi_ak4643_device = { | 774 | static struct platform_device fsi_ak4643_device = { |
766 | .name = "sh_fsi2_a_ak4643", | 775 | .name = "fsi-ak4642-audio", |
776 | .dev = { | ||
777 | .platform_data = &fsi_info, | ||
778 | }, | ||
767 | }; | 779 | }; |
780 | |||
768 | static struct sh_mobile_meram_cfg hdmi_meram_cfg = { | 781 | static struct sh_mobile_meram_cfg hdmi_meram_cfg = { |
769 | .icb[0] = { | 782 | .icb[0] = { |
770 | .marker_icb = 30, | 783 | .marker_icb = 30, |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 9c5e598e0e3d..a2908d49a6df 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -990,8 +990,20 @@ static struct platform_device fsi_device = { | |||
990 | }, | 990 | }, |
991 | }; | 991 | }; |
992 | 992 | ||
993 | static struct fsi_ak4642_info fsi2_ak4643_info = { | ||
994 | .name = "AK4643", | ||
995 | .card = "FSI2A-AK4643", | ||
996 | .cpu_dai = "fsia-dai", | ||
997 | .codec = "ak4642-codec.0-0013", | ||
998 | .platform = "sh_fsi2", | ||
999 | .id = FSI_PORT_A, | ||
1000 | }; | ||
1001 | |||
993 | static struct platform_device fsi_ak4643_device = { | 1002 | static struct platform_device fsi_ak4643_device = { |
994 | .name = "sh_fsi2_a_ak4643", | 1003 | .name = "fsi-ak4642-audio", |
1004 | .dev = { | ||
1005 | .platform_data = &fsi2_ak4643_info, | ||
1006 | }, | ||
995 | }; | 1007 | }; |
996 | 1008 | ||
997 | /* | 1009 | /* |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index b747c0ab9264..b49723b21912 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -315,8 +315,20 @@ static struct platform_device fsi_device = { | |||
315 | }, | 315 | }, |
316 | }; | 316 | }; |
317 | 317 | ||
318 | static struct fsi_ak4642_info fsi_ak4642_info = { | ||
319 | .name = "AK4642", | ||
320 | .card = "FSIA-AK4642", | ||
321 | .cpu_dai = "fsia-dai", | ||
322 | .codec = "ak4642-codec.0-0012", | ||
323 | .platform = "sh_fsi.0", | ||
324 | .id = FSI_PORT_A, | ||
325 | }; | ||
326 | |||
318 | static struct platform_device fsi_ak4642_device = { | 327 | static struct platform_device fsi_ak4642_device = { |
319 | .name = "sh_fsi_a_ak4642", | 328 | .name = "fsi-ak4642-audio", |
329 | .dev = { | ||
330 | .platform_data = &fsi_ak4642_info, | ||
331 | }, | ||
320 | }; | 332 | }; |
321 | 333 | ||
322 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ | 334 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ |
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index 9a155f9d0a12..9b1aacaa82fe 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h | |||
@@ -78,4 +78,16 @@ struct sh_fsi_platform_info { | |||
78 | int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); | 78 | int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /* | ||
82 | * for fsi-ak4642 | ||
83 | */ | ||
84 | struct fsi_ak4642_info { | ||
85 | const char *name; | ||
86 | const char *card; | ||
87 | const char *cpu_dai; | ||
88 | const char *codec; | ||
89 | const char *platform; | ||
90 | int id; | ||
91 | }; | ||
92 | |||
81 | #endif /* __SOUND_FSI_H */ | 93 | #endif /* __SOUND_FSI_H */ |
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) |