s3c24xx_simtec_tlv320aic23.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 "s3c24xx-pcm.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_codec *codec)
  54. {
  55. snd_soc_dapm_new_controls(codec, dapm_widgets,
  56. ARRAY_SIZE(dapm_widgets));
  57. snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map));
  58. snd_soc_dapm_enable_pin(codec, "Headphone Jack");
  59. snd_soc_dapm_enable_pin(codec, "Line In");
  60. snd_soc_dapm_enable_pin(codec, "Line Out");
  61. snd_soc_dapm_enable_pin(codec, "Mic Jack");
  62. simtec_audio_init(codec);
  63. snd_soc_dapm_sync(codec);
  64. return 0;
  65. }
  66. static struct snd_soc_dai_link simtec_dai_aic23 = {
  67. .name = "tlv320aic23",
  68. .stream_name = "TLV320AIC23",
  69. .cpu_dai = &s3c24xx_i2s_dai,
  70. .codec_dai = &tlv320aic23_dai,
  71. .init = simtec_tlv320aic23_init,
  72. };
  73. /* simtec audio machine driver */
  74. static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
  75. .name = "Simtec",
  76. .platform = &s3c24xx_soc_platform,
  77. .dai_link = &simtec_dai_aic23,
  78. .num_links = 1,
  79. };
  80. /* simtec audio subsystem */
  81. static struct snd_soc_device simtec_snd_devdata_aic23 = {
  82. .card = &snd_soc_machine_simtec_aic23,
  83. .codec_dev = &soc_codec_dev_tlv320aic23,
  84. };
  85. static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
  86. {
  87. return simtec_audio_core_probe(pd, &simtec_snd_devdata_aic23);
  88. }
  89. static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
  90. .driver = {
  91. .owner = THIS_MODULE,
  92. .name = "s3c24xx-simtec-tlv320aic23",
  93. .pm = simtec_audio_pm,
  94. },
  95. .probe = simtec_audio_tlv320aic23_probe,
  96. .remove = __devexit_p(simtec_audio_remove),
  97. };
  98. MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
  99. static int __init simtec_tlv320aic23_modinit(void)
  100. {
  101. return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
  102. }
  103. static void __exit simtec_tlv320aic23_modexit(void)
  104. {
  105. platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
  106. }
  107. module_init(simtec_tlv320aic23_modinit);
  108. module_exit(simtec_tlv320aic23_modexit);
  109. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  110. MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
  111. MODULE_LICENSE("GPL");