Version:  2.0.40 2.2.26 2.4.37 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17

Linux/sound/soc/codecs/hdmi.c

  1 /*
  2  * ALSA SoC codec driver for HDMI audio codecs.
  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>
 23 #include <linux/of.h>
 24 #include <linux/of_device.h>
 25 
 26 #define DRV_NAME "hdmi-audio-codec"
 27 
 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 };
 37 
 38 static struct snd_soc_dai_driver hdmi_codec_dai = {
 39         .name = "hdmi-hifi",
 40         .playback = {
 41                 .stream_name = "Playback",
 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 |
 49                         SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
 50         },
 51         .capture = {
 52                 .stream_name = "Capture",
 53                 .channels_min = 2,
 54                 .channels_max = 2,
 55                 .rates = SNDRV_PCM_RATE_32000 |
 56                         SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
 57                         SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
 58                         SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
 59                 .formats = SNDRV_PCM_FMTBIT_S16_LE |
 60                         SNDRV_PCM_FMTBIT_S24_LE,
 61         },
 62 
 63 };
 64 
 65 #ifdef CONFIG_OF
 66 static const struct of_device_id hdmi_audio_codec_ids[] = {
 67         { .compatible = "linux,hdmi-audio", },
 68         { }
 69 };
 70 MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids);
 71 #endif
 72 
 73 static struct snd_soc_codec_driver hdmi_codec = {
 74         .dapm_widgets = hdmi_widgets,
 75         .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
 76         .dapm_routes = hdmi_routes,
 77         .num_dapm_routes = ARRAY_SIZE(hdmi_routes),
 78 };
 79 
 80 static int hdmi_codec_probe(struct platform_device *pdev)
 81 {
 82         return snd_soc_register_codec(&pdev->dev, &hdmi_codec,
 83                         &hdmi_codec_dai, 1);
 84 }
 85 
 86 static int hdmi_codec_remove(struct platform_device *pdev)
 87 {
 88         snd_soc_unregister_codec(&pdev->dev);
 89         return 0;
 90 }
 91 
 92 static struct platform_driver hdmi_codec_driver = {
 93         .driver         = {
 94                 .name   = DRV_NAME,
 95                 .owner  = THIS_MODULE,
 96                 .of_match_table = of_match_ptr(hdmi_audio_codec_ids),
 97         },
 98 
 99         .probe          = hdmi_codec_probe,
100         .remove         = hdmi_codec_remove,
101 };
102 
103 module_platform_driver(hdmi_codec_driver);
104 
105 MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
106 MODULE_DESCRIPTION("ASoC generic HDMI codec driver");
107 MODULE_LICENSE("GPL");
108 MODULE_ALIAS("platform:" DRV_NAME);
109 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us