s3c24xx_simtec_tlv320aic23.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 <sound/soc.h>
  10. #include "s3c24xx_simtec.h"
  11. /* supported machines:
  12. *
  13. * Machine Connections AMP
  14. * ------- ----------- ---
  15. * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)
  16. * VR1000 HPOUT, LIN None
  17. * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  18. * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
  19. * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)
  20. */
  21. static const struct snd_soc_dapm_widget dapm_widgets[] = {
  22. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  23. SND_SOC_DAPM_LINE("Line In", NULL),
  24. SND_SOC_DAPM_LINE("Line Out", NULL),
  25. SND_SOC_DAPM_MIC("Mic Jack", NULL),
  26. };
  27. static const struct snd_soc_dapm_route base_map[] = {
  28. { "Headphone Jack", NULL, "LHPOUT"},
  29. { "Headphone Jack", NULL, "RHPOUT"},
  30. { "Line Out", NULL, "LOUT" },
  31. { "Line Out", NULL, "ROUT" },
  32. { "LLINEIN", NULL, "Line In"},
  33. { "RLINEIN", NULL, "Line In"},
  34. { "MICIN", NULL, "Mic Jack"},
  35. };
  36. /**
  37. * simtec_tlv320aic23_init - initialise and add controls
  38. * @codec; The codec instance to attach to.
  39. *
  40. * Attach our controls and configure the necessary codec
  41. * mappings for our sound card instance.
  42. */
  43. static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
  44. {
  45. struct snd_soc_codec *codec = rtd->codec;
  46. struct snd_soc_dapm_context *dapm = &codec->dapm;
  47. snd_soc_dapm_new_controls(dapm, dapm_widgets,
  48. ARRAY_SIZE(dapm_widgets));
  49. snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
  50. snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
  51. snd_soc_dapm_enable_pin(dapm, "Line In");
  52. snd_soc_dapm_enable_pin(dapm, "Line Out");
  53. snd_soc_dapm_enable_pin(dapm, "Mic Jack");
  54. simtec_audio_init(rtd);
  55. snd_soc_dapm_sync(dapm);
  56. return 0;
  57. }
  58. static struct snd_soc_dai_link simtec_dai_aic23 = {
  59. .name = "tlv320aic23",
  60. .stream_name = "TLV320AIC23",
  61. .codec_name = "tlv320aic3x-codec.0-001a",
  62. .cpu_dai_name = "s3c24xx-iis",
  63. .codec_dai_name = "tlv320aic3x-hifi",
  64. .platform_name = "samsung-audio",
  65. .init = simtec_tlv320aic23_init,
  66. };
  67. /* simtec audio machine driver */
  68. static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
  69. .name = "Simtec",
  70. .dai_link = &simtec_dai_aic23,
  71. .num_links = 1,
  72. };
  73. static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
  74. {
  75. return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
  76. }
  77. static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
  78. .driver = {
  79. .owner = THIS_MODULE,
  80. .name = "s3c24xx-simtec-tlv320aic23",
  81. .pm = simtec_audio_pm,
  82. },
  83. .probe = simtec_audio_tlv320aic23_probe,
  84. .remove = __devexit_p(simtec_audio_remove),
  85. };
  86. MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
  87. static int __init simtec_tlv320aic23_modinit(void)
  88. {
  89. return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
  90. }
  91. static void __exit simtec_tlv320aic23_modexit(void)
  92. {
  93. platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
  94. }
  95. module_init(simtec_tlv320aic23_modinit);
  96. module_exit(simtec_tlv320aic23_modexit);
  97. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  98. MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
  99. MODULE_LICENSE("GPL");