2 * FSI-AK464x sound support for ms7724se
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
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
12 #include <linux/platform_device.h>
13 #include <sound/sh_fsi.h>
15 struct fsi_ak4642_data
{
24 static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime
*rtd
)
26 struct snd_soc_dai
*dai
= rtd
->codec_dai
;
29 ret
= snd_soc_dai_set_fmt(dai
, SND_SOC_DAIFMT_CBM_CFM
);
33 ret
= snd_soc_dai_set_sysclk(dai
, 0, 11289600, 0);
38 static struct snd_soc_dai_link fsi_dai_link
= {
39 .codec_dai_name
= "ak4642-hifi",
40 .init
= fsi_ak4642_dai_init
,
43 static struct snd_soc_card fsi_soc_card
= {
44 .dai_link
= &fsi_dai_link
,
48 static struct platform_device
*fsi_snd_device
;
50 static int fsi_ak4642_probe(struct platform_device
*pdev
)
53 const struct platform_device_id
*id_entry
;
54 struct fsi_ak4642_data
*pdata
;
56 id_entry
= pdev
->id_entry
;
58 dev_err(&pdev
->dev
, "unknown fsi ak4642\n");
62 pdata
= (struct fsi_ak4642_data
*)id_entry
->driver_data
;
64 fsi_snd_device
= platform_device_alloc("soc-audio", pdata
->id
);
68 fsi_dai_link
.name
= pdata
->name
;
69 fsi_dai_link
.stream_name
= pdata
->name
;
70 fsi_dai_link
.cpu_dai_name
= pdata
->cpu_dai
;
71 fsi_dai_link
.platform_name
= pdata
->platform
;
72 fsi_dai_link
.codec_name
= pdata
->codec
;
73 fsi_soc_card
.name
= pdata
->card
;
75 platform_set_drvdata(fsi_snd_device
, &fsi_soc_card
);
76 ret
= platform_device_add(fsi_snd_device
);
79 platform_device_put(fsi_snd_device
);
85 static int fsi_ak4642_remove(struct platform_device
*pdev
)
87 platform_device_unregister(fsi_snd_device
);
91 static struct fsi_ak4642_data fsi_a_ak4642
= {
93 .card
= "FSIA (AK4642)",
94 .cpu_dai
= "fsia-dai",
95 .codec
= "ak4642-codec.0-0012",
96 .platform
= "sh_fsi.0",
100 static struct fsi_ak4642_data fsi_b_ak4642
= {
102 .card
= "FSIB (AK4642)",
103 .cpu_dai
= "fsib-dai",
104 .codec
= "ak4642-codec.0-0012",
105 .platform
= "sh_fsi.0",
109 static struct fsi_ak4642_data fsi_a_ak4643
= {
111 .card
= "FSIA (AK4643)",
112 .cpu_dai
= "fsia-dai",
113 .codec
= "ak4642-codec.0-0013",
114 .platform
= "sh_fsi.0",
118 static struct fsi_ak4642_data fsi_b_ak4643
= {
120 .card
= "FSIB (AK4643)",
121 .cpu_dai
= "fsib-dai",
122 .codec
= "ak4642-codec.0-0013",
123 .platform
= "sh_fsi.0",
127 static struct fsi_ak4642_data fsi2_a_ak4642
= {
129 .card
= "FSI2A (AK4642)",
130 .cpu_dai
= "fsia-dai",
131 .codec
= "ak4642-codec.0-0012",
132 .platform
= "sh_fsi2",
136 static struct fsi_ak4642_data fsi2_b_ak4642
= {
138 .card
= "FSI2B (AK4642)",
139 .cpu_dai
= "fsib-dai",
140 .codec
= "ak4642-codec.0-0012",
141 .platform
= "sh_fsi2",
145 static struct fsi_ak4642_data fsi2_a_ak4643
= {
147 .card
= "FSI2A (AK4643)",
148 .cpu_dai
= "fsia-dai",
149 .codec
= "ak4642-codec.0-0013",
150 .platform
= "sh_fsi2",
154 static struct fsi_ak4642_data fsi2_b_ak4643
= {
156 .card
= "FSI2B (AK4643)",
157 .cpu_dai
= "fsib-dai",
158 .codec
= "ak4642-codec.0-0013",
159 .platform
= "sh_fsi2",
163 static struct platform_device_id fsi_id_table
[] = {
165 { "sh_fsi_a_ak4642", (kernel_ulong_t
)&fsi_a_ak4642
},
166 { "sh_fsi_b_ak4642", (kernel_ulong_t
)&fsi_b_ak4642
},
167 { "sh_fsi_a_ak4643", (kernel_ulong_t
)&fsi_a_ak4643
},
168 { "sh_fsi_b_ak4643", (kernel_ulong_t
)&fsi_b_ak4643
},
171 { "sh_fsi2_a_ak4642", (kernel_ulong_t
)&fsi2_a_ak4642
},
172 { "sh_fsi2_b_ak4642", (kernel_ulong_t
)&fsi2_b_ak4642
},
173 { "sh_fsi2_a_ak4643", (kernel_ulong_t
)&fsi2_a_ak4643
},
174 { "sh_fsi2_b_ak4643", (kernel_ulong_t
)&fsi2_b_ak4643
},
178 static struct platform_driver fsi_ak4642
= {
180 .name
= "fsi-ak4642-audio",
182 .probe
= fsi_ak4642_probe
,
183 .remove
= fsi_ak4642_remove
,
184 .id_table
= fsi_id_table
,
187 static int __init
fsi_ak4642_init(void)
189 return platform_driver_register(&fsi_ak4642
);
192 static void __exit
fsi_ak4642_exit(void)
194 platform_driver_unregister(&fsi_ak4642
);
197 module_init(fsi_ak4642_init
);
198 module_exit(fsi_ak4642_exit
);
200 MODULE_LICENSE("GPL");
201 MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
202 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");