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
*codec
= rtd
->codec_dai
;
27 struct snd_soc_dai
*cpu
= rtd
->cpu_dai
;
30 ret
= snd_soc_dai_set_fmt(codec
, SND_SOC_DAIFMT_LEFT_J
|
31 SND_SOC_DAIFMT_CBM_CFM
);
35 ret
= snd_soc_dai_set_sysclk(codec
, 0, 11289600, 0);
39 ret
= snd_soc_dai_set_fmt(cpu
, SND_SOC_DAIFMT_LEFT_J
|
40 SND_SOC_DAIFMT_CBS_CFS
);
45 static struct snd_soc_dai_link fsi_dai_link
= {
46 .codec_dai_name
= "ak4642-hifi",
47 .init
= fsi_ak4642_dai_init
,
50 static struct snd_soc_card fsi_soc_card
= {
51 .dai_link
= &fsi_dai_link
,
55 static struct platform_device
*fsi_snd_device
;
57 static int fsi_ak4642_probe(struct platform_device
*pdev
)
60 const struct platform_device_id
*id_entry
;
61 struct fsi_ak4642_data
*pdata
;
63 id_entry
= pdev
->id_entry
;
65 dev_err(&pdev
->dev
, "unknown fsi ak4642\n");
69 pdata
= (struct fsi_ak4642_data
*)id_entry
->driver_data
;
71 fsi_snd_device
= platform_device_alloc("soc-audio", pdata
->id
);
75 fsi_dai_link
.name
= pdata
->name
;
76 fsi_dai_link
.stream_name
= pdata
->name
;
77 fsi_dai_link
.cpu_dai_name
= pdata
->cpu_dai
;
78 fsi_dai_link
.platform_name
= pdata
->platform
;
79 fsi_dai_link
.codec_name
= pdata
->codec
;
80 fsi_soc_card
.name
= pdata
->card
;
82 platform_set_drvdata(fsi_snd_device
, &fsi_soc_card
);
83 ret
= platform_device_add(fsi_snd_device
);
86 platform_device_put(fsi_snd_device
);
92 static int fsi_ak4642_remove(struct platform_device
*pdev
)
94 platform_device_unregister(fsi_snd_device
);
98 static struct fsi_ak4642_data fsi_a_ak4642
= {
100 .card
= "FSIA-AK4642",
101 .cpu_dai
= "fsia-dai",
102 .codec
= "ak4642-codec.0-0012",
103 .platform
= "sh_fsi.0",
107 static struct fsi_ak4642_data fsi_b_ak4642
= {
109 .card
= "FSIB-AK4642",
110 .cpu_dai
= "fsib-dai",
111 .codec
= "ak4642-codec.0-0012",
112 .platform
= "sh_fsi.0",
116 static struct fsi_ak4642_data fsi_a_ak4643
= {
118 .card
= "FSIA-AK4643",
119 .cpu_dai
= "fsia-dai",
120 .codec
= "ak4642-codec.0-0013",
121 .platform
= "sh_fsi.0",
125 static struct fsi_ak4642_data fsi_b_ak4643
= {
127 .card
= "FSIB-AK4643",
128 .cpu_dai
= "fsib-dai",
129 .codec
= "ak4642-codec.0-0013",
130 .platform
= "sh_fsi.0",
134 static struct fsi_ak4642_data fsi2_a_ak4642
= {
136 .card
= "FSI2A-AK4642",
137 .cpu_dai
= "fsia-dai",
138 .codec
= "ak4642-codec.0-0012",
139 .platform
= "sh_fsi2",
143 static struct fsi_ak4642_data fsi2_b_ak4642
= {
145 .card
= "FSI2B-AK4642",
146 .cpu_dai
= "fsib-dai",
147 .codec
= "ak4642-codec.0-0012",
148 .platform
= "sh_fsi2",
152 static struct fsi_ak4642_data fsi2_a_ak4643
= {
154 .card
= "FSI2A-AK4643",
155 .cpu_dai
= "fsia-dai",
156 .codec
= "ak4642-codec.0-0013",
157 .platform
= "sh_fsi2",
161 static struct fsi_ak4642_data fsi2_b_ak4643
= {
163 .card
= "FSI2B-AK4643",
164 .cpu_dai
= "fsib-dai",
165 .codec
= "ak4642-codec.0-0013",
166 .platform
= "sh_fsi2",
170 static struct platform_device_id fsi_id_table
[] = {
172 { "sh_fsi_a_ak4642", (kernel_ulong_t
)&fsi_a_ak4642
},
173 { "sh_fsi_b_ak4642", (kernel_ulong_t
)&fsi_b_ak4642
},
174 { "sh_fsi_a_ak4643", (kernel_ulong_t
)&fsi_a_ak4643
},
175 { "sh_fsi_b_ak4643", (kernel_ulong_t
)&fsi_b_ak4643
},
178 { "sh_fsi2_a_ak4642", (kernel_ulong_t
)&fsi2_a_ak4642
},
179 { "sh_fsi2_b_ak4642", (kernel_ulong_t
)&fsi2_b_ak4642
},
180 { "sh_fsi2_a_ak4643", (kernel_ulong_t
)&fsi2_a_ak4643
},
181 { "sh_fsi2_b_ak4643", (kernel_ulong_t
)&fsi2_b_ak4643
},
185 static struct platform_driver fsi_ak4642
= {
187 .name
= "fsi-ak4642-audio",
189 .probe
= fsi_ak4642_probe
,
190 .remove
= fsi_ak4642_remove
,
191 .id_table
= fsi_id_table
,
194 static int __init
fsi_ak4642_init(void)
196 return platform_driver_register(&fsi_ak4642
);
199 static void __exit
fsi_ak4642_exit(void)
201 platform_driver_unregister(&fsi_ak4642
);
204 module_init(fsi_ak4642_init
);
205 module_exit(fsi_ak4642_exit
);
207 MODULE_LICENSE("GPL");
208 MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
209 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");