aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/fsi-hdmi.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /sound/soc/sh/fsi-hdmi.c
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'sound/soc/sh/fsi-hdmi.c')
-rw-r--r--sound/soc/sh/fsi-hdmi.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c
new file mode 100644
index 00000000000..d3d9fd88068
--- /dev/null
+++ b/sound/soc/sh/fsi-hdmi.c
@@ -0,0 +1,127 @@
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
15struct fsi_hdmi_data {
16 const char *cpu_dai;
17 const char *card;
18 int id;
19};
20
21static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
22{
23 struct snd_soc_dai *cpu = rtd->cpu_dai;
24 int ret;
25
26 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM);
27
28 return ret;
29}
30
31static struct snd_soc_dai_link fsi_dai_link = {
32 .name = "HDMI",
33 .stream_name = "HDMI",
34 .codec_dai_name = "sh_mobile_hdmi-hifi",
35 .platform_name = "sh_fsi2",
36 .codec_name = "sh-mobile-hdmi",
37 .init = fsi_hdmi_dai_init,
38};
39
40static struct snd_soc_card fsi_soc_card = {
41 .dai_link = &fsi_dai_link,
42 .num_links = 1,
43};
44
45static struct platform_device *fsi_snd_device;
46
47static int fsi_hdmi_probe(struct platform_device *pdev)
48{
49 int ret = -ENOMEM;
50 const struct platform_device_id *id_entry;
51 struct fsi_hdmi_data *pdata;
52
53 id_entry = pdev->id_entry;
54 if (!id_entry) {
55 dev_err(&pdev->dev, "unknown fsi hdmi\n");
56 return -ENODEV;
57 }
58
59 pdata = (struct fsi_hdmi_data *)id_entry->driver_data;
60
61 fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
62 if (!fsi_snd_device)
63 goto out;
64
65 fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
66 fsi_soc_card.name = pdata->card;
67
68 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
69 ret = platform_device_add(fsi_snd_device);
70
71 if (ret)
72 platform_device_put(fsi_snd_device);
73
74out:
75 return ret;
76}
77
78static int fsi_hdmi_remove(struct platform_device *pdev)
79{
80 platform_device_unregister(fsi_snd_device);
81 return 0;
82}
83
84static struct fsi_hdmi_data fsi2_a_hdmi = {
85 .cpu_dai = "fsia-dai",
86 .card = "FSI2A-HDMI",
87 .id = FSI_PORT_A,
88};
89
90static struct fsi_hdmi_data fsi2_b_hdmi = {
91 .cpu_dai = "fsib-dai",
92 .card = "FSI2B-HDMI",
93 .id = FSI_PORT_B,
94};
95
96static struct platform_device_id fsi_id_table[] = {
97 /* FSI 2 */
98 { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi },
99 { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi },
100 {},
101};
102
103static struct platform_driver fsi_hdmi = {
104 .driver = {
105 .name = "fsi-hdmi-audio",
106 },
107 .probe = fsi_hdmi_probe,
108 .remove = fsi_hdmi_remove,
109 .id_table = fsi_id_table,
110};
111
112static int __init fsi_hdmi_init(void)
113{
114 return platform_driver_register(&fsi_hdmi);
115}
116
117static void __exit fsi_hdmi_exit(void)
118{
119 platform_driver_unregister(&fsi_hdmi);
120}
121
122module_init(fsi_hdmi_init);
123module_exit(fsi_hdmi_exit);
124
125MODULE_LICENSE("GPL");
126MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card");
127MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");