s3c24xx_simtec_hermes.c 3.3 KB

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