blob: 9e107a9c40105f9e37dffdfe8a5c7aff1c6d10ec [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",
34 .platform_name = "fsi-pcm-audio",
35 .codec_name = "ak4642-codec.0-0012",
Kuninori Morimoto4b6316b2010-03-23 16:27:28 +090036 .init = fsi_ak4642_dai_init,
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090037 .ops = NULL,
38};
39
40static struct snd_soc_card fsi_soc_card = {
41 .name = "FSI",
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090042 .dai_link = &fsi_dai_link,
43 .num_links = 1,
44};
45
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090046static struct platform_device *fsi_snd_device;
47
48static int __init fsi_ak4642_init(void)
49{
50 int ret = -ENOMEM;
51
Kuninori Morimoto3c2ef842010-07-16 19:51:06 +090052 fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090053 if (!fsi_snd_device)
54 goto out;
55
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000056 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
Kuninori Morimotob8e583f2009-08-21 09:42:59 +090057 ret = platform_device_add(fsi_snd_device);
58
59 if (ret)
60 platform_device_put(fsi_snd_device);
61
62out:
63 return ret;
64}
65
66static void __exit fsi_ak4642_exit(void)
67{
68 platform_device_unregister(fsi_snd_device);
69}
70
71module_init(fsi_ak4642_init);
72module_exit(fsi_ak4642_exit);
73
74MODULE_LICENSE("GPL");
75MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
76MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");