s3c24xx_simtec_hermes.c 3.5 KB

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