smdk_wm9713.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * smdk_wm9713.c -- SoC audio for SMDK
  3. *
  4. * Copyright 2010 Samsung Electronics Co. Ltd.
  5. * Author: Jaswinder Singh Brar <jassisinghbrar@gmail.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of the
  10. * License, or (at your option) any later version.
  11. *
  12. */
  13. #include <linux/module.h>
  14. #include <sound/soc.h>
  15. static struct snd_soc_card smdk;
  16. /*
  17. * Default CFG switch settings to use this driver:
  18. *
  19. * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off
  20. * SMDKC100: Set CFG6 1-3 On, CFG7 1 On
  21. * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On
  22. * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On
  23. * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On
  24. */
  25. /*
  26. Playback (HeadPhone):-
  27. $ amixer sset 'Headphone' unmute
  28. $ amixer sset 'Right Headphone Out Mux' 'Headphone'
  29. $ amixer sset 'Left Headphone Out Mux' 'Headphone'
  30. $ amixer sset 'Right HP Mixer PCM' unmute
  31. $ amixer sset 'Left HP Mixer PCM' unmute
  32. Capture (LineIn):-
  33. $ amixer sset 'Right Capture Source' 'Line'
  34. $ amixer sset 'Left Capture Source' 'Line'
  35. */
  36. static struct snd_soc_dai_link smdk_dai = {
  37. .name = "AC97",
  38. .stream_name = "AC97 PCM",
  39. .platform_name = "samsung-audio",
  40. .cpu_dai_name = "samsung-ac97",
  41. .codec_dai_name = "wm9713-hifi",
  42. .codec_name = "wm9713-codec",
  43. };
  44. static struct snd_soc_card smdk = {
  45. .name = "SMDK WM9713",
  46. .owner = THIS_MODULE,
  47. .dai_link = &smdk_dai,
  48. .num_links = 1,
  49. };
  50. static struct platform_device *smdk_snd_wm9713_device;
  51. static struct platform_device *smdk_snd_ac97_device;
  52. static int __init smdk_init(void)
  53. {
  54. int ret;
  55. smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
  56. if (!smdk_snd_wm9713_device)
  57. return -ENOMEM;
  58. ret = platform_device_add(smdk_snd_wm9713_device);
  59. if (ret)
  60. goto err1;
  61. smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
  62. if (!smdk_snd_ac97_device) {
  63. ret = -ENOMEM;
  64. goto err2;
  65. }
  66. platform_set_drvdata(smdk_snd_ac97_device, &smdk);
  67. ret = platform_device_add(smdk_snd_ac97_device);
  68. if (ret)
  69. goto err3;
  70. return 0;
  71. err3:
  72. platform_device_put(smdk_snd_ac97_device);
  73. err2:
  74. platform_device_del(smdk_snd_wm9713_device);
  75. err1:
  76. platform_device_put(smdk_snd_wm9713_device);
  77. return ret;
  78. }
  79. static void __exit smdk_exit(void)
  80. {
  81. platform_device_unregister(smdk_snd_ac97_device);
  82. platform_device_unregister(smdk_snd_wm9713_device);
  83. }
  84. module_init(smdk_init);
  85. module_exit(smdk_exit);
  86. /* Module information */
  87. MODULE_AUTHOR("Jaswinder Singh Brar, jassisinghbrar@gmail.com");
  88. MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713");
  89. MODULE_LICENSE("GPL");