]>
Commit | Line | Data |
---|---|---|
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> | |
a6b34312 | 23 | #include <linux/of.h> |
0f7f3d1f | 24 | #include <linux/of_device.h> |
5452030c RN |
25 | |
26 | #define DRV_NAME "hdmi-audio-codec" | |
27 | ||
c34e51b1 MB |
28 | static const struct snd_soc_dapm_widget hdmi_widgets[] = { |
29 | SND_SOC_DAPM_INPUT("RX"), | |
30 | SND_SOC_DAPM_OUTPUT("TX"), | |
31 | }; | |
32 | ||
33 | static const struct snd_soc_dapm_route hdmi_routes[] = { | |
34 | { "Capture", NULL, "RX" }, | |
35 | { "TX", NULL, "Playback" }, | |
36 | }; | |
5452030c | 37 | |
bf7c6e6c BS |
38 | static struct snd_soc_dai_driver hdmi_codec_dai = { |
39 | .name = "hdmi-hifi", | |
5452030c | 40 | .playback = { |
c34e51b1 | 41 | .stream_name = "Playback", |
5452030c RN |
42 | .channels_min = 2, |
43 | .channels_max = 8, | |
44 | .rates = SNDRV_PCM_RATE_32000 | | |
45 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | | |
46 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | | |
47 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, | |
48 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | |
c600e953 | 49 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE, |
74d813cf | 50 | .sig_bits = 24, |
5452030c | 51 | }, |
c6c0925e | 52 | .capture = { |
c34e51b1 | 53 | .stream_name = "Capture", |
c6c0925e RY |
54 | .channels_min = 2, |
55 | .channels_max = 2, | |
56 | .rates = SNDRV_PCM_RATE_32000 | | |
57 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | | |
58 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | | |
59 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, | |
60 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | |
61 | SNDRV_PCM_FMTBIT_S24_LE, | |
62 | }, | |
63 | ||
5452030c RN |
64 | }; |
65 | ||
0f7f3d1f JS |
66 | #ifdef CONFIG_OF |
67 | static const struct of_device_id hdmi_audio_codec_ids[] = { | |
68 | { .compatible = "linux,hdmi-audio", }, | |
69 | { } | |
70 | }; | |
71 | MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids); | |
72 | #endif | |
73 | ||
c34e51b1 MB |
74 | static struct snd_soc_codec_driver hdmi_codec = { |
75 | .dapm_widgets = hdmi_widgets, | |
76 | .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), | |
77 | .dapm_routes = hdmi_routes, | |
78 | .num_dapm_routes = ARRAY_SIZE(hdmi_routes), | |
69434097 | 79 | .ignore_pmdown_time = true, |
c34e51b1 MB |
80 | }; |
81 | ||
bf7c6e6c | 82 | static int hdmi_codec_probe(struct platform_device *pdev) |
5452030c | 83 | { |
bf7c6e6c BS |
84 | return snd_soc_register_codec(&pdev->dev, &hdmi_codec, |
85 | &hdmi_codec_dai, 1); | |
5452030c RN |
86 | } |
87 | ||
bf7c6e6c | 88 | static int hdmi_codec_remove(struct platform_device *pdev) |
5452030c RN |
89 | { |
90 | snd_soc_unregister_codec(&pdev->dev); | |
91 | return 0; | |
92 | } | |
93 | ||
bf7c6e6c | 94 | static struct platform_driver hdmi_codec_driver = { |
5452030c RN |
95 | .driver = { |
96 | .name = DRV_NAME, | |
0f7f3d1f | 97 | .of_match_table = of_match_ptr(hdmi_audio_codec_ids), |
5452030c RN |
98 | }, |
99 | ||
bf7c6e6c BS |
100 | .probe = hdmi_codec_probe, |
101 | .remove = hdmi_codec_remove, | |
5452030c RN |
102 | }; |
103 | ||
bf7c6e6c | 104 | module_platform_driver(hdmi_codec_driver); |
5452030c RN |
105 | |
106 | MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>"); | |
bf7c6e6c | 107 | MODULE_DESCRIPTION("ASoC generic HDMI codec driver"); |
5452030c RN |
108 | MODULE_LICENSE("GPL"); |
109 | MODULE_ALIAS("platform:" DRV_NAME); |