]> git.karo-electronics.de Git - mv-sheeva.git/blob - sound/soc/sh/fsi-ak4642.c
ASoC: multi-component - ASoC Multi-Component Support
[mv-sheeva.git] / sound / soc / sh / fsi-ak4642.c
1 /*
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
12 #include <linux/platform_device.h>
13 #include <sound/sh_fsi.h>
14
15 static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
16 {
17         struct snd_soc_dai *dai = rtd->codec_dai;
18         int ret;
19
20         ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM);
21         if (ret < 0)
22                 return ret;
23
24         ret = snd_soc_dai_set_sysclk(dai, 0, 11289600, 0);
25
26         return ret;
27 }
28
29 static struct snd_soc_dai_link fsi_dai_link = {
30         .name           = "AK4642",
31         .stream_name    = "AK4642",
32         .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",
36         .init           = fsi_ak4642_dai_init,
37         .ops            = NULL,
38 };
39
40 static struct snd_soc_card fsi_soc_card  = {
41         .name           = "FSI",
42         .dai_link       = &fsi_dai_link,
43         .num_links      = 1,
44 };
45
46 static struct platform_device *fsi_snd_device;
47
48 static int __init fsi_ak4642_init(void)
49 {
50         int ret = -ENOMEM;
51
52         fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
53         if (!fsi_snd_device)
54                 goto out;
55
56         platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
57         ret = platform_device_add(fsi_snd_device);
58
59         if (ret)
60                 platform_device_put(fsi_snd_device);
61
62 out:
63         return ret;
64 }
65
66 static void __exit fsi_ak4642_exit(void)
67 {
68         platform_device_unregister(fsi_snd_device);
69 }
70
71 module_init(fsi_ak4642_init);
72 module_exit(fsi_ak4642_exit);
73
74 MODULE_LICENSE("GPL");
75 MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
76 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");