txx9aclc-generic.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Generic TXx9 ACLC machine driver
  3. *
  4. * Copyright (C) 2009 Atsushi Nemoto
  5. *
  6. * Based on RBTX49xx patch from CELF patch archive.
  7. * (C) Copyright TOSHIBA CORPORATION 2004-2006
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This is a very generic AC97 sound machine driver for boards which
  14. * have (AC97) audio at ACLC (e.g. RBTX49XX boards).
  15. */
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <sound/core.h>
  19. #include <sound/pcm.h>
  20. #include <sound/soc.h>
  21. #include "../codecs/ac97.h"
  22. #include "txx9aclc.h"
  23. static struct snd_soc_dai_link txx9aclc_generic_dai = {
  24. .name = "AC97",
  25. .stream_name = "AC97 HiFi",
  26. .cpu_dai = &txx9aclc_ac97_dai,
  27. .codec_dai = &ac97_dai,
  28. };
  29. static struct snd_soc_card txx9aclc_generic_card = {
  30. .name = "Generic TXx9 ACLC Audio",
  31. .platform = &txx9aclc_soc_platform,
  32. .dai_link = &txx9aclc_generic_dai,
  33. .num_links = 1,
  34. };
  35. static struct txx9aclc_soc_device txx9aclc_generic_soc_device = {
  36. .soc_dev = {
  37. .card = &txx9aclc_generic_card,
  38. .codec_dev = &soc_codec_dev_ac97,
  39. },
  40. };
  41. static int __init txx9aclc_generic_probe(struct platform_device *pdev)
  42. {
  43. struct txx9aclc_soc_device *dev = &txx9aclc_generic_soc_device;
  44. struct platform_device *soc_pdev;
  45. int ret;
  46. soc_pdev = platform_device_alloc("soc-audio", -1);
  47. if (!soc_pdev)
  48. return -ENOMEM;
  49. platform_set_drvdata(soc_pdev, &dev->soc_dev);
  50. dev->soc_dev.dev = &soc_pdev->dev;
  51. ret = platform_device_add(soc_pdev);
  52. if (ret) {
  53. platform_device_put(soc_pdev);
  54. return ret;
  55. }
  56. platform_set_drvdata(pdev, soc_pdev);
  57. return 0;
  58. }
  59. static int __exit txx9aclc_generic_remove(struct platform_device *pdev)
  60. {
  61. struct platform_device *soc_pdev = platform_get_drvdata(pdev);
  62. platform_device_unregister(soc_pdev);
  63. return 0;
  64. }
  65. static struct platform_driver txx9aclc_generic_driver = {
  66. .remove = txx9aclc_generic_remove,
  67. .driver = {
  68. .name = "txx9aclc-generic",
  69. .owner = THIS_MODULE,
  70. },
  71. };
  72. static int __init txx9aclc_generic_init(void)
  73. {
  74. return platform_driver_probe(&txx9aclc_generic_driver,
  75. txx9aclc_generic_probe);
  76. }
  77. static void __exit txx9aclc_generic_exit(void)
  78. {
  79. platform_driver_unregister(&txx9aclc_generic_driver);
  80. }
  81. module_init(txx9aclc_generic_init);
  82. module_exit(txx9aclc_generic_exit);
  83. MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
  84. MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver");
  85. MODULE_LICENSE("GPL");