blob: 68342b121c966aa7c90ace1384bbfbefe4737ab7 [file] [log] [blame]
Ricardo Neri54520302012-05-18 01:42:33 -05001/*
Barry Songbf7c6e62013-05-16 14:08:07 +08002 * ALSA SoC codec driver for HDMI audio codecs.
Ricardo Neri54520302012-05-18 01:42:33 -05003 * 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>
23
24#define DRV_NAME "hdmi-audio-codec"
25
Mark Brownc34e51b2013-08-19 12:17:36 +010026static const struct snd_soc_dapm_widget hdmi_widgets[] = {
27 SND_SOC_DAPM_INPUT("RX"),
28 SND_SOC_DAPM_OUTPUT("TX"),
29};
30
31static const struct snd_soc_dapm_route hdmi_routes[] = {
32 { "Capture", NULL, "RX" },
33 { "TX", NULL, "Playback" },
34};
Ricardo Neri54520302012-05-18 01:42:33 -050035
Barry Songbf7c6e62013-05-16 14:08:07 +080036static struct snd_soc_dai_driver hdmi_codec_dai = {
37 .name = "hdmi-hifi",
Ricardo Neri54520302012-05-18 01:42:33 -050038 .playback = {
Mark Brownc34e51b2013-08-19 12:17:36 +010039 .stream_name = "Playback",
Ricardo Neri54520302012-05-18 01:42:33 -050040 .channels_min = 2,
41 .channels_max = 8,
42 .rates = SNDRV_PCM_RATE_32000 |
43 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
44 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
45 SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
46 .formats = SNDRV_PCM_FMTBIT_S16_LE |
47 SNDRV_PCM_FMTBIT_S24_LE,
48 },
Rongjun Yingc6c09252013-07-17 14:12:16 +080049 .capture = {
Mark Brownc34e51b2013-08-19 12:17:36 +010050 .stream_name = "Capture",
Rongjun Yingc6c09252013-07-17 14:12:16 +080051 .channels_min = 2,
52 .channels_max = 2,
53 .rates = SNDRV_PCM_RATE_32000 |
54 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
55 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
56 SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
57 .formats = SNDRV_PCM_FMTBIT_S16_LE |
58 SNDRV_PCM_FMTBIT_S24_LE,
59 },
60
Ricardo Neri54520302012-05-18 01:42:33 -050061};
62
Mark Brownc34e51b2013-08-19 12:17:36 +010063static struct snd_soc_codec_driver hdmi_codec = {
64 .dapm_widgets = hdmi_widgets,
65 .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
66 .dapm_routes = hdmi_routes,
67 .num_dapm_routes = ARRAY_SIZE(hdmi_routes),
68};
69
Barry Songbf7c6e62013-05-16 14:08:07 +080070static int hdmi_codec_probe(struct platform_device *pdev)
Ricardo Neri54520302012-05-18 01:42:33 -050071{
Barry Songbf7c6e62013-05-16 14:08:07 +080072 return snd_soc_register_codec(&pdev->dev, &hdmi_codec,
73 &hdmi_codec_dai, 1);
Ricardo Neri54520302012-05-18 01:42:33 -050074}
75
Barry Songbf7c6e62013-05-16 14:08:07 +080076static int hdmi_codec_remove(struct platform_device *pdev)
Ricardo Neri54520302012-05-18 01:42:33 -050077{
78 snd_soc_unregister_codec(&pdev->dev);
79 return 0;
80}
81
Barry Songbf7c6e62013-05-16 14:08:07 +080082static struct platform_driver hdmi_codec_driver = {
Ricardo Neri54520302012-05-18 01:42:33 -050083 .driver = {
84 .name = DRV_NAME,
85 .owner = THIS_MODULE,
86 },
87
Barry Songbf7c6e62013-05-16 14:08:07 +080088 .probe = hdmi_codec_probe,
89 .remove = hdmi_codec_remove,
Ricardo Neri54520302012-05-18 01:42:33 -050090};
91
Barry Songbf7c6e62013-05-16 14:08:07 +080092module_platform_driver(hdmi_codec_driver);
Ricardo Neri54520302012-05-18 01:42:33 -050093
94MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
Barry Songbf7c6e62013-05-16 14:08:07 +080095MODULE_DESCRIPTION("ASoC generic HDMI codec driver");
Ricardo Neri54520302012-05-18 01:42:33 -050096MODULE_LICENSE("GPL");
97MODULE_ALIAS("platform:" DRV_NAME);