blob: d96602de71de3fd351eb4c1a2b1ccbb0d21c819a [file] [log] [blame]
Kuninori Morimotob8e583f2009-08-21 09:42:59 +09001/*
2 * FSI-AK464x sound support for ms7724se
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 *
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
9 * for more details.
10 */
11
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090012#include <linux/platform_device.h>
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090013#include <sound/sh_fsi.h>
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090014
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000015static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
Kuninori Morimoto4b6316b2010-03-23 16:27:28 +090016{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000017 struct snd_soc_dai *dai = rtd->codec_dai;
Kuninori Morimoto4b6316b2010-03-23 16:27:28 +090018 int ret;
19
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000020 ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM);
Kuninori Morimoto0643ce82010-03-15 18:10:50 +090021 if (ret < 0)
22 return ret;
23
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000024 ret = snd_soc_dai_set_sysclk(dai, 0, 11289600, 0);
Kuninori Morimoto4b6316b2010-03-23 16:27:28 +090025
26 return ret;
27}
28
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090029static struct snd_soc_dai_link fsi_dai_link = {
30 .name = "AK4642",
31 .stream_name = "AK4642",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000032 .cpu_dai_name = "fsia-dai", /* fsi A */
33 .codec_dai_name = "ak4642-hifi",
Kuninori Morimoto2c280322010-08-30 20:47:19 +090034#ifdef CONFIG_MACH_AP4EVB
Kuninori Morimotoc570d522010-09-07 15:46:48 +090035 .platform_name = "sh_fsi2",
Kuninori Morimoto2c280322010-08-30 20:47:19 +090036 .codec_name = "ak4642-codec.0-0013",
37#else
38 .platform_name = "sh_fsi.0",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000039 .codec_name = "ak4642-codec.0-0012",
Kuninori Morimoto2c280322010-08-30 20:47:19 +090040#endif
Kuninori Morimoto4b6316b2010-03-23 16:27:28 +090041 .init = fsi_ak4642_dai_init,
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090042 .ops = NULL,
43};
44
45static struct snd_soc_card fsi_soc_card = {
Kuninori Morimoto1c7fc7e2010-09-13 19:40:13 +090046 .name = "FSI (AK4642)",
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090047 .dai_link = &fsi_dai_link,
48 .num_links = 1,
49};
50
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090051static struct platform_device *fsi_snd_device;
52
53static int __init fsi_ak4642_init(void)
54{
55 int ret = -ENOMEM;
56
Kuninori Morimoto3c2ef842010-07-16 19:51:06 +090057 fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090058 if (!fsi_snd_device)
59 goto out;
60
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000061 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090062 ret = platform_device_add(fsi_snd_device);
63
64 if (ret)
65 platform_device_put(fsi_snd_device);
66
67out:
68 return ret;
69}
70
71static void __exit fsi_ak4642_exit(void)
72{
73 platform_device_unregister(fsi_snd_device);
74}
75
76module_init(fsi_ak4642_init);
77module_exit(fsi_ak4642_exit);
78
79MODULE_LICENSE("GPL");
80MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
81MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");