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
{
23 static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime
*rtd
)
25 struct snd_soc_dai
*dai
= rtd
->codec_dai
;
28 ret
= snd_soc_dai_set_fmt(dai
, SND_SOC_DAIFMT_CBM_CFM
);
32 ret
= snd_soc_dai_set_sysclk(dai
, 0, 11289600, 0);
37 static struct snd_soc_dai_link fsi_dai_link
= {
38 .codec_dai_name
= "ak4642-hifi",
39 .init
= fsi_ak4642_dai_init
,
42 static struct snd_soc_card fsi_soc_card
= {
43 .dai_link
= &fsi_dai_link
,
47 static struct platform_device
*fsi_snd_device
;
49 static int fsi_ak4642_probe(struct platform_device
*pdev
)
52 const struct platform_device_id
*id_entry
;
53 struct fsi_ak4642_data
*pdata
;
55 id_entry
= pdev
->id_entry
;
57 dev_err(&pdev
->dev
, "unknown fsi ak4642\n");
61 pdata
= (struct fsi_ak4642_data
*)id_entry
->driver_data
;
63 fsi_snd_device
= platform_device_alloc("soc-audio", FSI_PORT_A
);
67 fsi_dai_link
.name
= pdata
->name
;
68 fsi_dai_link
.stream_name
= pdata
->name
;
69 fsi_dai_link
.cpu_dai_name
= pdata
->cpu_dai
;
70 fsi_dai_link
.platform_name
= pdata
->platform
;
71 fsi_dai_link
.codec_name
= pdata
->codec
;
72 fsi_soc_card
.name
= pdata
->card
;
74 platform_set_drvdata(fsi_snd_device
, &fsi_soc_card
);
75 ret
= platform_device_add(fsi_snd_device
);
78 platform_device_put(fsi_snd_device
);
84 static int fsi_ak4642_remove(struct platform_device
*pdev
)
86 platform_device_unregister(fsi_snd_device
);
90 static struct fsi_ak4642_data fsi_a_ak4642
= {
92 .card
= "FSIA (AK4642)",
93 .cpu_dai
= "fsia-dai",
94 .codec
= "ak4642-codec.0-0012",
95 .platform
= "sh_fsi.0",
98 static struct fsi_ak4642_data fsi_b_ak4642
= {
100 .card
= "FSIB (AK4642)",
101 .cpu_dai
= "fsib-dai",
102 .codec
= "ak4642-codec.0-0012",
103 .platform
= "sh_fsi.0",
106 static struct fsi_ak4642_data fsi_a_ak4643
= {
108 .card
= "FSIA (AK4643)",
109 .cpu_dai
= "fsia-dai",
110 .codec
= "ak4642-codec.0-0013",
111 .platform
= "sh_fsi.0",
114 static struct fsi_ak4642_data fsi_b_ak4643
= {
116 .card
= "FSIB (AK4643)",
117 .cpu_dai
= "fsib-dai",
118 .codec
= "ak4642-codec.0-0013",
119 .platform
= "sh_fsi.0",
122 static struct fsi_ak4642_data fsi2_a_ak4642
= {
124 .card
= "FSI2A (AK4642)",
125 .cpu_dai
= "fsia-dai",
126 .codec
= "ak4642-codec.0-0012",
127 .platform
= "sh_fsi2",
130 static struct fsi_ak4642_data fsi2_b_ak4642
= {
132 .card
= "FSI2B (AK4642)",
133 .cpu_dai
= "fsib-dai",
134 .codec
= "ak4642-codec.0-0012",
135 .platform
= "sh_fsi2",
138 static struct fsi_ak4642_data fsi2_a_ak4643
= {
140 .card
= "FSI2A (AK4643)",
141 .cpu_dai
= "fsia-dai",
142 .codec
= "ak4642-codec.0-0013",
143 .platform
= "sh_fsi2",
146 static struct fsi_ak4642_data fsi2_b_ak4643
= {
148 .card
= "FSI2B (AK4643)",
149 .cpu_dai
= "fsib-dai",
150 .codec
= "ak4642-codec.0-0013",
151 .platform
= "sh_fsi2",
154 static struct platform_device_id fsi_id_table
[] = {
156 { "sh_fsi_a_ak4642", (kernel_ulong_t
)&fsi_a_ak4642
},
157 { "sh_fsi_b_ak4642", (kernel_ulong_t
)&fsi_b_ak4642
},
158 { "sh_fsi_a_ak4643", (kernel_ulong_t
)&fsi_a_ak4643
},
159 { "sh_fsi_b_ak4643", (kernel_ulong_t
)&fsi_b_ak4643
},
162 { "sh_fsi2_a_ak4642", (kernel_ulong_t
)&fsi2_a_ak4642
},
163 { "sh_fsi2_b_ak4642", (kernel_ulong_t
)&fsi2_b_ak4642
},
164 { "sh_fsi2_a_ak4643", (kernel_ulong_t
)&fsi2_a_ak4643
},
165 { "sh_fsi2_b_ak4643", (kernel_ulong_t
)&fsi2_b_ak4643
},
169 static struct platform_driver fsi_ak4642
= {
171 .name
= "fsi-ak4642-audio",
173 .probe
= fsi_ak4642_probe
,
174 .remove
= fsi_ak4642_remove
,
175 .id_table
= fsi_id_table
,
178 static int __init
fsi_ak4642_init(void)
180 return platform_driver_register(&fsi_ak4642
);
183 static void __exit
fsi_ak4642_exit(void)
185 platform_driver_unregister(&fsi_ak4642
);
188 module_init(fsi_ak4642_init
);
189 module_exit(fsi_ak4642_exit
);
191 MODULE_LICENSE("GPL");
192 MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
193 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");