Commit 45f3121615b2b354f7d95d30f795bc5fe0043e92

Authored by Kuninori Morimoto
Committed by Mark Brown
1 parent 39afd66cea

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>

Showing 5 changed files with 63 additions and 106 deletions Side-by-side Diff

arch/arm/mach-shmobile/board-ap4evb.c
... ... @@ -762,9 +762,22 @@
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 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 781 static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
769 782 .icb[0] = {
770 783 .marker_icb = 30,
arch/arm/mach-shmobile/board-mackerel.c
... ... @@ -990,8 +990,20 @@
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 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 /*
arch/sh/boards/mach-se/7724/setup.c
... ... @@ -315,8 +315,20 @@
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 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 334 /* KEYSC in SoC (Needs SW33-2 set to ON) */
include/sound/sh_fsi.h
... ... @@ -78,5 +78,17 @@
78 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 93 #endif /* __SOUND_FSI_H */
sound/soc/sh/fsi-ak4642.c
... ... @@ -58,27 +58,23 @@
58 58 static int fsi_ak4642_probe(struct platform_device *pdev)
59 59 {
60 60 int ret = -ENOMEM;
61   - const struct platform_device_id *id_entry;
62   - struct fsi_ak4642_data *pdata;
  61 + struct fsi_ak4642_info *pinfo = pdev->dev.platform_data;
63 62  
64   - id_entry = pdev->id_entry;
65   - if (!id_entry) {
66   - dev_err(&pdev->dev, "unknown fsi ak4642\n");
67   - return -ENODEV;
  63 + if (!pinfo) {
  64 + dev_err(&pdev->dev, "no info for fsi ak4642\n");
  65 + goto out;
68 66 }
69 67  
70   - pdata = (struct fsi_ak4642_data *)id_entry->driver_data;
71   -
72   - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
  68 + fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id);
73 69 if (!fsi_snd_device)
74 70 goto out;
75 71  
76   - fsi_dai_link.name = pdata->name;
77   - fsi_dai_link.stream_name = pdata->name;
78   - fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
79   - fsi_dai_link.platform_name = pdata->platform;
80   - fsi_dai_link.codec_name = pdata->codec;
81   - fsi_soc_card.name = pdata->card;
  72 + fsi_dai_link.name = pinfo->name;
  73 + fsi_dai_link.stream_name = pinfo->name;
  74 + fsi_dai_link.cpu_dai_name = pinfo->cpu_dai;
  75 + fsi_dai_link.platform_name = pinfo->platform;
  76 + fsi_dai_link.codec_name = pinfo->codec;
  77 + fsi_soc_card.name = pinfo->card;
82 78  
83 79 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
84 80 ret = platform_device_add(fsi_snd_device);
85 81  
... ... @@ -96,100 +92,12 @@
96 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 95 static struct platform_driver fsi_ak4642 = {
187 96 .driver = {
188 97 .name = "fsi-ak4642-audio",
189 98 },
190 99 .probe = fsi_ak4642_probe,
191 100 .remove = fsi_ak4642_remove,
192   - .id_table = fsi_id_table,
193 101 };
194 102  
195 103 static int __init fsi_ak4642_init(void)