omap-hdmi-card.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * omap-hdmi-card.c
  3. *
  4. * OMAP ALSA SoC machine driver for TI OMAP HDMI
  5. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  6. * Author: Ricardo Neri <ricardo.neri@ti.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #include <linux/module.h>
  24. #include <sound/pcm.h>
  25. #include <sound/soc.h>
  26. #include <asm/mach-types.h>
  27. #include <video/omapdss.h>
  28. #define DRV_NAME "omap-hdmi-audio"
  29. static struct snd_soc_dai_link omap_hdmi_dai = {
  30. .name = "HDMI",
  31. .stream_name = "HDMI",
  32. .cpu_dai_name = "omap-hdmi-audio-dai",
  33. .platform_name = "omap-pcm-audio",
  34. .codec_name = "hdmi-audio-codec",
  35. .codec_dai_name = "omap-hdmi-hifi",
  36. };
  37. static struct snd_soc_card snd_soc_omap_hdmi = {
  38. .name = "OMAPHDMI",
  39. .owner = THIS_MODULE,
  40. .dai_link = &omap_hdmi_dai,
  41. .num_links = 1,
  42. };
  43. static int omap_hdmi_probe(struct platform_device *pdev)
  44. {
  45. struct snd_soc_card *card = &snd_soc_omap_hdmi;
  46. int ret;
  47. card->dev = &pdev->dev;
  48. ret = snd_soc_register_card(card);
  49. if (ret) {
  50. dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
  51. card->dev = NULL;
  52. return ret;
  53. }
  54. return 0;
  55. }
  56. static int omap_hdmi_remove(struct platform_device *pdev)
  57. {
  58. struct snd_soc_card *card = platform_get_drvdata(pdev);
  59. snd_soc_unregister_card(card);
  60. card->dev = NULL;
  61. return 0;
  62. }
  63. static struct platform_driver omap_hdmi_driver = {
  64. .driver = {
  65. .name = DRV_NAME,
  66. .owner = THIS_MODULE,
  67. },
  68. .probe = omap_hdmi_probe,
  69. .remove = omap_hdmi_remove,
  70. };
  71. module_platform_driver(omap_hdmi_driver);
  72. MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
  73. MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver");
  74. MODULE_LICENSE("GPL");
  75. MODULE_ALIAS("platform:" DRV_NAME);