Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
[deliverable/linux.git] / sound / soc / codecs / hdmi.c
CommitLineData
5452030c 1/*
bf7c6e6c 2 * ALSA SoC codec driver for HDMI audio codecs.
5452030c
RN
3 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
4 * Author: Ricardo Neri <ricardo.neri@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21#include <linux/module.h>
22#include <sound/soc.h>
0f7f3d1f 23#include <linux/of_device.h>
5452030c
RN
24
25#define DRV_NAME "hdmi-audio-codec"
26
c34e51b1
MB
27static const struct snd_soc_dapm_widget hdmi_widgets[] = {
28 SND_SOC_DAPM_INPUT("RX"),
29 SND_SOC_DAPM_OUTPUT("TX"),
30};
31
32static const struct snd_soc_dapm_route hdmi_routes[] = {
33 { "Capture", NULL, "RX" },
34 { "TX", NULL, "Playback" },
35};
5452030c 36
bf7c6e6c
BS
37static struct snd_soc_dai_driver hdmi_codec_dai = {
38 .name = "hdmi-hifi",
5452030c 39 .playback = {
c34e51b1 40 .stream_name = "Playback",
5452030c
RN
41 .channels_min = 2,
42 .channels_max = 8,
43 .rates = SNDRV_PCM_RATE_32000 |
44 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
45 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
46 SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
47 .formats = SNDRV_PCM_FMTBIT_S16_LE |
c600e953 48 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
5452030c 49 },
c6c0925e 50 .capture = {
c34e51b1 51 .stream_name = "Capture",
c6c0925e
RY
52 .channels_min = 2,
53 .channels_max = 2,
54 .rates = SNDRV_PCM_RATE_32000 |
55 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
56 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
57 SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
58 .formats = SNDRV_PCM_FMTBIT_S16_LE |
59 SNDRV_PCM_FMTBIT_S24_LE,
60 },
61
5452030c
RN
62};
63
0f7f3d1f
JS
64#ifdef CONFIG_OF
65static const struct of_device_id hdmi_audio_codec_ids[] = {
66 { .compatible = "linux,hdmi-audio", },
67 { }
68};
69MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids);
70#endif
71
c34e51b1
MB
72static struct snd_soc_codec_driver hdmi_codec = {
73 .dapm_widgets = hdmi_widgets,
74 .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
75 .dapm_routes = hdmi_routes,
76 .num_dapm_routes = ARRAY_SIZE(hdmi_routes),
77};
78
bf7c6e6c 79static int hdmi_codec_probe(struct platform_device *pdev)
5452030c 80{
bf7c6e6c
BS
81 return snd_soc_register_codec(&pdev->dev, &hdmi_codec,
82 &hdmi_codec_dai, 1);
5452030c
RN
83}
84
bf7c6e6c 85static int hdmi_codec_remove(struct platform_device *pdev)
5452030c
RN
86{
87 snd_soc_unregister_codec(&pdev->dev);
88 return 0;
89}
90
bf7c6e6c 91static struct platform_driver hdmi_codec_driver = {
5452030c
RN
92 .driver = {
93 .name = DRV_NAME,
94 .owner = THIS_MODULE,
0f7f3d1f 95 .of_match_table = of_match_ptr(hdmi_audio_codec_ids),
5452030c
RN
96 },
97
bf7c6e6c
BS
98 .probe = hdmi_codec_probe,
99 .remove = hdmi_codec_remove,
5452030c
RN
100};
101
bf7c6e6c 102module_platform_driver(hdmi_codec_driver);
5452030c
RN
103
104MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
bf7c6e6c 105MODULE_DESCRIPTION("ASoC generic HDMI codec driver");
5452030c
RN
106MODULE_LICENSE("GPL");
107MODULE_ALIAS("platform:" DRV_NAME);
This page took 0.097402 seconds and 5 git commands to generate.