hdmi.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #define DRV_NAME "hdmi-audio-codec"
  24. static struct snd_soc_codec_driver hdmi_codec;
  25. static struct snd_soc_dai_driver hdmi_codec_dai = {
  26. .name = "hdmi-hifi",
  27. .playback = {
  28. .channels_min = 2,
  29. .channels_max = 8,
  30. .rates = SNDRV_PCM_RATE_32000 |
  31. SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
  32. SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
  33. SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
  34. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  35. SNDRV_PCM_FMTBIT_S24_LE,
  36. },
  37. .capture = {
  38. .channels_min = 2,
  39. .channels_max = 2,
  40. .rates = SNDRV_PCM_RATE_32000 |
  41. SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
  42. SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
  43. SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
  44. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  45. SNDRV_PCM_FMTBIT_S24_LE,
  46. },
  47. };
  48. static int hdmi_codec_probe(struct platform_device *pdev)
  49. {
  50. return snd_soc_register_codec(&pdev->dev, &hdmi_codec,
  51. &hdmi_codec_dai, 1);
  52. }
  53. static int hdmi_codec_remove(struct platform_device *pdev)
  54. {
  55. snd_soc_unregister_codec(&pdev->dev);
  56. return 0;
  57. }
  58. static struct platform_driver hdmi_codec_driver = {
  59. .driver = {
  60. .name = DRV_NAME,
  61. .owner = THIS_MODULE,
  62. },
  63. .probe = hdmi_codec_probe,
  64. .remove = hdmi_codec_remove,
  65. };
  66. module_platform_driver(hdmi_codec_driver);
  67. MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
  68. MODULE_DESCRIPTION("ASoC generic HDMI codec driver");
  69. MODULE_LICENSE("GPL");
  70. MODULE_ALIAS("platform:" DRV_NAME);