aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-09-01 23:09:54 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:01:37 -0400
commita9cc72c8e55167f397e0e645347ef253a6be711a (patch)
tree998875c8695bb07951e21a2a57a91ae49b970816
parent3052d5c42cfa85cd40d66fe1f11c80ac9b7a44ae (diff)
ENGR00277299-5 ASoC: fsl: Add hdmi audio machine driver
Add hdmi audio machine dirver Signed-off-by: Nicolin Chen <b42378@freescale.com>
-rw-r--r--sound/soc/fsl/Kconfig11
-rw-r--r--sound/soc/fsl/Makefile2
-rw-r--r--sound/soc/fsl/imx-hdmi.c126
3 files changed, 139 insertions, 0 deletions
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index cea06709e92e..8d1822df94c6 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -240,6 +240,17 @@ config SND_SOC_IMX_MC13783
240 select SND_SOC_MC13783 240 select SND_SOC_MC13783
241 select SND_SOC_IMX_PCM_DMA 241 select SND_SOC_IMX_PCM_DMA
242 242
243config SND_SOC_IMX_HDMI
244 tristate "SoC Audio support for i.MX boards with HDMI port"
245 depends on MFD_MXC_HDMI
246 select SND_SOC_IMX_HDMI_DMA
247 select SND_SOC_FSL_HDMI
248 select SND_SOC_OMAP_HDMI_CODEC
249 help
250 SoC Audio support for i.MX boards with HDMI audio
251 Say Y if you want to add support for SoC audio on an i.MX board with
252 IMX HDMI.
253
243config SND_SOC_IMX_SI476X 254config SND_SOC_IMX_SI476X
244 tristate "SoC Audio support for i.MX boards with si476x" 255 tristate "SoC Audio support for i.MX boards with si476x"
245 select SND_SOC_IMX_PCM_DMA 256 select SND_SOC_IMX_PCM_DMA
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 21a51cfbf332..f651c9e081d9 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -57,6 +57,7 @@ snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o
57snd-soc-imx-wm8962-objs := imx-wm8962.o 57snd-soc-imx-wm8962-objs := imx-wm8962.o
58snd-soc-imx-spdif-objs :=imx-spdif.o 58snd-soc-imx-spdif-objs :=imx-spdif.o
59snd-soc-imx-mc13783-objs := imx-mc13783.o 59snd-soc-imx-mc13783-objs := imx-mc13783.o
60snd-soc-imx-hdmi-objs := imx-hdmi.o
60snd-soc-imx-si476x-objs := imx-si476x.o 61snd-soc-imx-si476x-objs := imx-si476x.o
61 62
62obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o 63obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
@@ -68,4 +69,5 @@ obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
68obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o 69obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o
69obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o 70obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
70obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o 71obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o
72obj-$(CONFIG_SND_SOC_IMX_HDMI) += snd-soc-imx-hdmi.o
71obj-$(CONFIG_SND_SOC_IMX_SI476X) += snd-soc-imx-si476x.o 73obj-$(CONFIG_SND_SOC_IMX_SI476X) += snd-soc-imx-si476x.o
diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
new file mode 100644
index 000000000000..04fcff8cca6e
--- /dev/null
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -0,0 +1,126 @@
1/*
2 * ASoC HDMI Transmitter driver for IMX development boards
3 *
4 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
5 *
6 * based on stmp3780_devb_hdmi.c
7 *
8 * Vladimir Barinov <vbarinov@embeddedalley.com>
9 *
10 * Copyright 2008 SigmaTel, Inc
11 * Copyright 2008 Embedded Alley Solutions, Inc
12 *
13 * This file is licensed under the terms of the GNU General Public License
14 * version 2. This program is licensed "as is" without any warranty of any
15 * kind, whether express or implied.
16 */
17
18#include <linux/module.h>
19#include <linux/of_platform.h>
20#include <linux/mfd/mxc-hdmi-core.h>
21#include <sound/soc.h>
22
23#include "imx-hdmi.h"
24
25/* imx digital audio interface glue - connects codec <--> CPU */
26static struct snd_soc_dai_link imx_hdmi_dai_link = {
27 .name = "i.MX HDMI Audio Tx",
28 .stream_name = "i.MX HDMI Audio Tx",
29 .codec_dai_name = "hdmi-hifi",
30 .codec_name = "hdmi-audio-codec",
31 .platform_name = "imx-hdmi-audio",
32};
33
34static struct snd_soc_card snd_soc_card_imx_hdmi = {
35 .name = "imx-hdmi-soc",
36 .dai_link = &imx_hdmi_dai_link,
37 .num_links = 1,
38};
39
40static struct platform_device *codec_dev;
41
42static int imx_hdmi_audio_probe(struct platform_device *pdev)
43{
44 struct device_node *hdmi_np, *np = pdev->dev.of_node;
45 struct snd_soc_card *card = &snd_soc_card_imx_hdmi;
46 struct platform_device *hdmi_pdev;
47 int ret = 0;
48
49 if (!hdmi_get_registered()) {
50 dev_err(&pdev->dev, "initialize HDMI-audio failed. load HDMI-video first!\n");
51 return -ENODEV;
52 }
53
54 hdmi_np = of_parse_phandle(np, "hdmi-controller", 0);
55 if (!hdmi_np) {
56 dev_err(&pdev->dev, "failed to find hdmi-audio cpudai\n");
57 ret = -EINVAL;
58 goto end;
59 }
60
61 hdmi_pdev = of_find_device_by_node(hdmi_np);
62 if (!hdmi_pdev) {
63 dev_err(&pdev->dev, "failed to find SSI platform device\n");
64 ret = -EINVAL;
65 goto end;
66 }
67
68 codec_dev = platform_device_register_simple("hdmi-audio-codec", -1, NULL, 0);
69 if (IS_ERR(codec_dev)) {
70 dev_err(&pdev->dev, "failed to register HDMI audio codec\n");
71 ret = PTR_ERR(codec_dev);
72 goto end;
73 }
74
75 card->dev = &pdev->dev;
76 card->dai_link->cpu_dai_name = dev_name(&hdmi_pdev->dev);
77
78 ret = snd_soc_register_card(card);
79 if (ret) {
80 dev_err(&pdev->dev, "failed to register card: %d\n", ret);
81 goto err_card;
82 }
83
84 goto end;
85
86err_card:
87 platform_device_unregister(codec_dev);
88end:
89 if (hdmi_np)
90 of_node_put(hdmi_np);
91
92 return ret;
93}
94
95static int imx_hdmi_audio_remove(struct platform_device *pdev)
96{
97 struct snd_soc_card *card = &snd_soc_card_imx_hdmi;
98
99 platform_device_unregister(codec_dev);
100 snd_soc_unregister_card(card);
101
102 return 0;
103}
104
105static const struct of_device_id imx_hdmi_dt_ids[] = {
106 { .compatible = "fsl,imx-audio-hdmi", },
107 { /* sentinel */ }
108};
109MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids);
110
111static struct platform_driver imx_hdmi_audio_driver = {
112 .probe = imx_hdmi_audio_probe,
113 .remove = imx_hdmi_audio_remove,
114 .driver = {
115 .of_match_table = imx_hdmi_dt_ids,
116 .name = "imx-audio-hdmi",
117 .owner = THIS_MODULE,
118 },
119};
120
121module_platform_driver(imx_hdmi_audio_driver);
122
123MODULE_AUTHOR("Freescale Semiconductor, Inc.");
124MODULE_DESCRIPTION("IMX HDMI TX ASoC driver");
125MODULE_LICENSE("GPL");
126MODULE_ALIAS("platform:imx-audio-hdmi");