s3c24xx_simtec_hermes.c 2.9 KB

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