6b13f685e
김민수
BSP 최초 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/*
* ASoC HDMI Transmitter driver for IMX development boards
*
* Copyright (C) 2011-2014 Freescale Semiconductor, Inc.
*
* based on stmp3780_devb_hdmi.c
*
* Vladimir Barinov <vbarinov@embeddedalley.com>
*
* Copyright 2008 SigmaTel, Inc
* Copyright 2008 Embedded Alley Solutions, Inc
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/mfd/mxc-hdmi-core.h>
#include <sound/soc.h>
#include "imx-hdmi.h"
/* imx digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link imx_hdmi_dai_link = {
.name = "i.MX HDMI Audio Tx",
.stream_name = "i.MX HDMI Audio Tx",
.codec_dai_name = "hdmi-hifi",
.codec_name = "hdmi-audio-codec",
.platform_name = "imx-hdmi-audio",
};
static struct snd_soc_card snd_soc_card_imx_hdmi = {
.name = "imx-hdmi-soc",
.dai_link = &imx_hdmi_dai_link,
.num_links = 1,
};
static int imx_hdmi_audio_probe(struct platform_device *pdev)
{
struct device_node *hdmi_np, *np = pdev->dev.of_node;
struct snd_soc_card *card = &snd_soc_card_imx_hdmi;
struct platform_device *hdmi_pdev;
int ret = 0;
if (!hdmi_get_registered()) {
dev_err(&pdev->dev, "initialize HDMI-audio failed. load HDMI-video first!
");
return -ENODEV;
}
hdmi_np = of_parse_phandle(np, "hdmi-controller", 0);
if (!hdmi_np) {
dev_err(&pdev->dev, "failed to find hdmi-audio cpudai
");
ret = -EINVAL;
goto end;
}
hdmi_pdev = of_find_device_by_node(hdmi_np);
if (!hdmi_pdev) {
dev_err(&pdev->dev, "failed to find SSI platform device
");
ret = -EINVAL;
goto end;
}
card->dev = &pdev->dev;
card->dai_link->cpu_dai_name = dev_name(&hdmi_pdev->dev);
platform_set_drvdata(pdev, card);
ret = snd_soc_register_card(card);
if (ret)
dev_err(&pdev->dev, "failed to register card: %d
", ret);
end:
if (hdmi_np)
of_node_put(hdmi_np);
return ret;
}
static int imx_hdmi_audio_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
return 0;
}
static const struct of_device_id imx_hdmi_dt_ids[] = {
{ .compatible = "fsl,imx-audio-hdmi", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids);
static struct platform_driver imx_hdmi_audio_driver = {
.probe = imx_hdmi_audio_probe,
.remove = imx_hdmi_audio_remove,
.driver = {
.of_match_table = imx_hdmi_dt_ids,
.name = "imx-audio-hdmi",
.owner = THIS_MODULE,
.pm = &snd_soc_pm_ops,
},
};
module_platform_driver(imx_hdmi_audio_driver);
MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_DESCRIPTION("IMX HDMI TX ASoC driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:imx-audio-hdmi");
|