s3c24xx_simtec_hermes.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* sound/soc/s3c24xx/s3c24xx_simtec_hermes.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/tlv320aic3x.h"
  21. static const struct snd_soc_dapm_widget dapm_widgets[] = {
  22. SND_SOC_DAPM_LINE("GSM Out", NULL),
  23. SND_SOC_DAPM_LINE("GSM In", NULL),
  24. SND_SOC_DAPM_LINE("Line In", NULL),
  25. SND_SOC_DAPM_LINE("Line Out", NULL),
  26. SND_SOC_DAPM_LINE("ZV", NULL),
  27. SND_SOC_DAPM_MIC("Mic Jack", NULL),
  28. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  29. };
  30. static const struct snd_soc_dapm_route base_map[] = {
  31. /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
  32. { "Headphone Jack", NULL, "HPLOUT" },
  33. { "Headphone Jack", NULL, "HPLCOM" },
  34. { "Headphone Jack", NULL, "HPROUT" },
  35. { "Headphone Jack", NULL, "HPRCOM" },
  36. /* ZV connected to Line1 */
  37. { "LINE1L", NULL, "ZV" },
  38. { "LINE1R", NULL, "ZV" },
  39. /* Line In connected to Line2 */
  40. { "LINE2L", NULL, "Line In" },
  41. { "LINE2R", NULL, "Line In" },
  42. /* Microphone connected to MIC3R and MIC_BIAS */
  43. { "MIC3L", NULL, "Mic Jack" },
  44. /* GSM connected to MONO_LOUT and MIC3L (in) */
  45. { "GSM Out", NULL, "MONO_LOUT" },
  46. { "MIC3L", NULL, "GSM In" },
  47. /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
  48. * not using the DAPM to power it up and down as there it makes
  49. * a click when powering up. */
  50. };
  51. /**
  52. * simtec_hermes_init - initialise and add controls
  53. * @codec; The codec instance to attach to.
  54. *
  55. * Attach our controls and configure the necessary codec
  56. * mappings for our sound card instance.
  57. */
  58. static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
  59. {
  60. struct snd_soc_codec *codec = rtd->codec;
  61. snd_soc_dapm_new_controls(codec, dapm_widgets,
  62. ARRAY_SIZE(dapm_widgets));
  63. snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map));
  64. snd_soc_dapm_enable_pin(codec, "Headphone Jack");
  65. snd_soc_dapm_enable_pin(codec, "Line In");
  66. snd_soc_dapm_enable_pin(codec, "Line Out");
  67. snd_soc_dapm_enable_pin(codec, "Mic Jack");
  68. simtec_audio_init(rtd);
  69. snd_soc_dapm_sync(codec);
  70. return 0;
  71. }
  72. static struct snd_soc_dai_link simtec_dai_aic33 = {
  73. .name = "tlv320aic33",
  74. .stream_name = "TLV320AIC33",
  75. .codec_name = "tlv320aic3x-codec.0-0x1a",
  76. .cpu_dai_name = "s3c24xx-i2s",
  77. .codec_dai_name = "tlv320aic3x-hifi",
  78. .platform_name = "s3c24xx-pcm-audio",
  79. .init = simtec_hermes_init,
  80. };
  81. /* simtec audio machine driver */
  82. static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
  83. .name = "Simtec-Hermes",
  84. .dai_link = &simtec_dai_aic33,
  85. .num_links = 1,
  86. };
  87. static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)
  88. {
  89. dev_info(&pd->dev, "probing....\n");
  90. return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
  91. }
  92. static struct platform_driver simtec_audio_hermes_platdrv = {
  93. .driver = {
  94. .owner = THIS_MODULE,
  95. .name = "s3c24xx-simtec-hermes-snd",
  96. .pm = simtec_audio_pm,
  97. },
  98. .probe = simtec_audio_hermes_probe,
  99. .remove = __devexit_p(simtec_audio_remove),
  100. };
  101. MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
  102. static int __init simtec_hermes_modinit(void)
  103. {
  104. return platform_driver_register(&simtec_audio_hermes_platdrv);
  105. }
  106. static void __exit simtec_hermes_modexit(void)
  107. {
  108. platform_driver_unregister(&simtec_audio_hermes_platdrv);
  109. }
  110. module_init(simtec_hermes_modinit);
  111. module_exit(simtec_hermes_modexit);
  112. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  113. MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
  114. MODULE_LICENSE("GPL");