em-x270.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * SoC audio driver for EM-X270, eXeda and CM-X300
  4. *
  5. * Copyright 2007, 2009 CompuLab, Ltd.
  6. *
  7. * Author: Mike Rapoport <[email protected]>
  8. *
  9. * Copied from tosa.c:
  10. * Copyright 2005 Wolfson Microelectronics PLC.
  11. * Copyright 2005 Openedhand Ltd.
  12. *
  13. * Authors: Liam Girdwood <[email protected]>
  14. * Richard Purdie <[email protected]>
  15. */
  16. #include <linux/module.h>
  17. #include <linux/moduleparam.h>
  18. #include <linux/device.h>
  19. #include <sound/core.h>
  20. #include <sound/pcm.h>
  21. #include <sound/soc.h>
  22. #include <asm/mach-types.h>
  23. #include <linux/platform_data/asoc-pxa.h>
  24. SND_SOC_DAILINK_DEFS(ac97,
  25. DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")),
  26. DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-hifi")),
  27. DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
  28. SND_SOC_DAILINK_DEFS(ac97_aux,
  29. DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")),
  30. DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-aux")),
  31. DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
  32. static struct snd_soc_dai_link em_x270_dai[] = {
  33. {
  34. .name = "AC97",
  35. .stream_name = "AC97 HiFi",
  36. SND_SOC_DAILINK_REG(ac97),
  37. },
  38. {
  39. .name = "AC97 Aux",
  40. .stream_name = "AC97 Aux",
  41. SND_SOC_DAILINK_REG(ac97_aux),
  42. },
  43. };
  44. static struct snd_soc_card em_x270 = {
  45. .name = "EM-X270",
  46. .owner = THIS_MODULE,
  47. .dai_link = em_x270_dai,
  48. .num_links = ARRAY_SIZE(em_x270_dai),
  49. };
  50. static struct platform_device *em_x270_snd_device;
  51. static int __init em_x270_init(void)
  52. {
  53. int ret;
  54. if (!(machine_is_em_x270() || machine_is_exeda()
  55. || machine_is_cm_x300()))
  56. return -ENODEV;
  57. em_x270_snd_device = platform_device_alloc("soc-audio", -1);
  58. if (!em_x270_snd_device)
  59. return -ENOMEM;
  60. platform_set_drvdata(em_x270_snd_device, &em_x270);
  61. ret = platform_device_add(em_x270_snd_device);
  62. if (ret)
  63. platform_device_put(em_x270_snd_device);
  64. return ret;
  65. }
  66. static void __exit em_x270_exit(void)
  67. {
  68. platform_device_unregister(em_x270_snd_device);
  69. }
  70. module_init(em_x270_init);
  71. module_exit(em_x270_exit);
  72. /* Module information */
  73. MODULE_AUTHOR("Mike Rapoport");
  74. MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300");
  75. MODULE_LICENSE("GPL");