s3c24xx_simtec_tlv320aic23.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* sound/soc/samsung/s3c24xx_simtec_tlv320aic23.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. /* supported machines:
  13. *
  14. * Machine Connections AMP
  15. * ------- ----------- ---
  16. * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)
  17. * VR1000 HPOUT, LIN None
  18. * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  19. * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  20. * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)
  21. */
  22. static const struct snd_soc_dapm_widget dapm_widgets[] = {
  23. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  24. SND_SOC_DAPM_LINE("Line In", NULL),
  25. SND_SOC_DAPM_LINE("Line Out", NULL),
  26. SND_SOC_DAPM_MIC("Mic Jack", NULL),
  27. };
  28. static const struct snd_soc_dapm_route base_map[] = {
  29. { "Headphone Jack", NULL, "LHPOUT"},
  30. { "Headphone Jack", NULL, "RHPOUT"},
  31. { "Line Out", NULL, "LOUT" },
  32. { "Line Out", NULL, "ROUT" },
  33. { "LLINEIN", NULL, "Line In"},
  34. { "RLINEIN", NULL, "Line In"},
  35. { "MICIN", NULL, "Mic Jack"},
  36. };
  37. /**
  38. * simtec_tlv320aic23_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_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
  45. {
  46. struct snd_soc_codec *codec = rtd->codec;
  47. struct snd_soc_dapm_context *dapm = &codec->dapm;
  48. snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
  49. snd_soc_dapm_enable_pin(dapm, "Line In");
  50. snd_soc_dapm_enable_pin(dapm, "Line Out");
  51. snd_soc_dapm_enable_pin(dapm, "Mic Jack");
  52. simtec_audio_init(rtd);
  53. return 0;
  54. }
  55. static struct snd_soc_dai_link simtec_dai_aic23 = {
  56. .name = "tlv320aic23",
  57. .stream_name = "TLV320AIC23",
  58. .codec_name = "tlv320aic3x-codec.0-001a",
  59. .cpu_dai_name = "s3c24xx-iis",
  60. .codec_dai_name = "tlv320aic3x-hifi",
  61. .platform_name = "samsung-audio",
  62. .init = simtec_tlv320aic23_init,
  63. };
  64. /* simtec audio machine driver */
  65. static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
  66. .name = "Simtec",
  67. .owner = THIS_MODULE,
  68. .dai_link = &simtec_dai_aic23,
  69. .num_links = 1,
  70. .dapm_widgets = dapm_widgets,
  71. .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
  72. .dapm_routes = base_map,
  73. .num_dapm_routes = ARRAY_SIZE(base_map),
  74. };
  75. static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
  76. {
  77. return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
  78. }
  79. static struct platform_driver simtec_audio_tlv320aic23_driver = {
  80. .driver = {
  81. .owner = THIS_MODULE,
  82. .name = "s3c24xx-simtec-tlv320aic23",
  83. .pm = simtec_audio_pm,
  84. },
  85. .probe = simtec_audio_tlv320aic23_probe,
  86. .remove = __devexit_p(simtec_audio_remove),
  87. };
  88. module_platform_driver(simtec_audio_tlv320aic23_driver);
  89. MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
  90. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  91. MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
  92. MODULE_LICENSE("GPL");