s3c24xx_simtec_tlv320aic23.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /* sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
  2. *
  3. * Copyright 2009 Simtec Electronics
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/module.h>
  10. #include <linux/clk.h>
  11. #include <linux/platform_device.h>
  12. #include <sound/core.h>
  13. #include <sound/pcm.h>
  14. #include <sound/soc.h>
  15. #include <sound/soc-dapm.h>
  16. #include <plat/audio-simtec.h>
  17. #include "s3c-dma.h"
  18. #include "s3c24xx-i2s.h"
  19. #include "s3c24xx_simtec.h"
  20. #include "../codecs/tlv320aic23.h"
  21. /* supported machines:
  22. *
  23. * Machine Connections AMP
  24. * ------- ----------- ---
  25. * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)
  26. * VR1000 HPOUT, LIN None
  27. * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  28. * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  29. * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)
  30. */
  31. static const struct snd_soc_dapm_widget dapm_widgets[] = {
  32. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  33. SND_SOC_DAPM_LINE("Line In", NULL),
  34. SND_SOC_DAPM_LINE("Line Out", NULL),
  35. SND_SOC_DAPM_MIC("Mic Jack", NULL),
  36. };
  37. static const struct snd_soc_dapm_route base_map[] = {
  38. { "Headphone Jack", NULL, "LHPOUT"},
  39. { "Headphone Jack", NULL, "RHPOUT"},
  40. { "Line Out", NULL, "LOUT" },
  41. { "Line Out", NULL, "ROUT" },
  42. { "LLINEIN", NULL, "Line In"},
  43. { "RLINEIN", NULL, "Line In"},
  44. { "MICIN", NULL, "Mic Jack"},
  45. };
  46. /**
  47. * simtec_tlv320aic23_init - initialise and add controls
  48. * @codec; The codec instance to attach to.
  49. *
  50. * Attach our controls and configure the necessary codec
  51. * mappings for our sound card instance.
  52. */
  53. static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
  54. {
  55. struct snd_soc_codec *codec = rtd->codec;
  56. snd_soc_dapm_new_controls(codec, dapm_widgets,
  57. ARRAY_SIZE(dapm_widgets));
  58. snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map));
  59. snd_soc_dapm_enable_pin(codec, "Headphone Jack");
  60. snd_soc_dapm_enable_pin(codec, "Line In");
  61. snd_soc_dapm_enable_pin(codec, "Line Out");
  62. snd_soc_dapm_enable_pin(codec, "Mic Jack");
  63. simtec_audio_init(rtd);
  64. snd_soc_dapm_sync(codec);
  65. return 0;
  66. }
  67. static struct snd_soc_dai_link simtec_dai_aic23 = {
  68. .name = "tlv320aic23",
  69. .stream_name = "TLV320AIC23",
  70. .codec_name = "tlv320aic3x-codec.0-0x1a",
  71. .cpu_dai_name = "s3c24xx-i2s",
  72. .codec_dai_name = "tlv320aic3x-hifi",
  73. .platform_name = "s3c24xx-pcm-audio",
  74. .init = simtec_tlv320aic23_init,
  75. };
  76. /* simtec audio machine driver */
  77. static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
  78. .name = "Simtec",
  79. .dai_link = &simtec_dai_aic23,
  80. .num_links = 1,
  81. };
  82. static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
  83. {
  84. return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
  85. }
  86. static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
  87. .driver = {
  88. .owner = THIS_MODULE,
  89. .name = "s3c24xx-simtec-tlv320aic23",
  90. .pm = simtec_audio_pm,
  91. },
  92. .probe = simtec_audio_tlv320aic23_probe,
  93. .remove = __devexit_p(simtec_audio_remove),
  94. };
  95. MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
  96. static int __init simtec_tlv320aic23_modinit(void)
  97. {
  98. return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
  99. }
  100. static void __exit simtec_tlv320aic23_modexit(void)
  101. {
  102. platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
  103. }
  104. module_init(simtec_tlv320aic23_modinit);
  105. module_exit(simtec_tlv320aic23_modexit);
  106. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  107. MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
  108. MODULE_LICENSE("GPL");