s3c24xx_simtec_hermes.c 3.7 KB

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