96d8ce3f3211ec01e49c9e628fb7218123575c3a
[pandora-kernel.git] / sound / soc / sh / fsi-hdmi.c
1 /*
2  * FSI - HDMI sound support
3  *
4  * Copyright (C) 2010 Renesas Solutions Corp.
5  * Kuninori Morimoto <kuninori.morimoto.gx@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_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
16 {
17         struct snd_soc_dai *cpu = rtd->cpu_dai;
18         int ret;
19
20         ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM);
21
22         return ret;
23 }
24
25 static struct snd_soc_dai_link fsi_dai_link = {
26         .name           = "HDMI",
27         .stream_name    = "HDMI",
28         .cpu_dai_name   = "fsib-dai", /* fsi B */
29         .codec_dai_name = "sh_mobile_hdmi-hifi",
30         .platform_name  = "sh_fsi2",
31         .codec_name     = "sh-mobile-hdmi",
32         .init           = fsi_hdmi_dai_init,
33 };
34
35 static struct snd_soc_card fsi_soc_card  = {
36         .name           = "FSI (SH MOBILE HDMI)",
37         .dai_link       = &fsi_dai_link,
38         .num_links      = 1,
39 };
40
41 static struct platform_device *fsi_snd_device;
42
43 static int __init fsi_hdmi_init(void)
44 {
45         int ret = -ENOMEM;
46
47         fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
48         if (!fsi_snd_device)
49                 goto out;
50
51         platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
52         ret = platform_device_add(fsi_snd_device);
53
54         if (ret)
55                 platform_device_put(fsi_snd_device);
56
57 out:
58         return ret;
59 }
60
61 static void __exit fsi_hdmi_exit(void)
62 {
63         platform_device_unregister(fsi_snd_device);
64 }
65
66 module_init(fsi_hdmi_init);
67 module_exit(fsi_hdmi_exit);
68
69 MODULE_LICENSE("GPL");
70 MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card");
71 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");