Advertisement
Guest User

Untitled

a guest
Sep 7th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. @@ -21,10 +21,15 @@
  2.  
  3. #include <linux/clk.h>
  4. #include <linux/platform_device.h>
  5. +#include <linux/module.h>
  6. +#include <linux/moduleparam.h>
  7. +#include <linux/timer.h>
  8. +#include <linux/interrupt.h>
  9. #include <sound/core.h>
  10. #include <sound/pcm.h>
  11. #include <sound/soc.h>
  12. #include <sound/soc-dapm.h>
  13. +#include <linux/i2c.h>
  14.  
  15. #include <asm/mach-types.h>
  16. #include <mach/hardware.h>
  17. @@ -34,6 +39,7 @@
  18. #include "omap-mcbsp.h"
  19. #include "omap-pcm.h"
  20. #include "../codecs/twl4030.h"
  21. +#include "../codecs/tlv320aic3x.h"
  22.  
  23. static int omap3beagle_hw_params(struct snd_pcm_substream *substream,
  24. struct snd_pcm_hw_params *params)
  25. @@ -73,27 +79,72 @@
  26. return ret;
  27. }
  28.  
  29. + /* Vi har en extern MCLK, behövs denna? */
  30. +
  31. /* Set the codec system clock for DAC and ADC */
  32. - ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
  33. + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 19200000,
  34. SND_SOC_CLOCK_IN);
  35. if (ret < 0) {
  36. printk(KERN_ERR "can't set codec system clock\n");
  37. - return ret;
  38. - }
  39. + return ret;
  40. + }
  41.  
  42. - return 0;
  43. + return 0;
  44. }
  45.  
  46. static struct snd_soc_ops omap3beagle_ops = {
  47. .hw_params = omap3beagle_hw_params,
  48. };
  49.  
  50. +static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
  51. + SND_SOC_DAPM_HP("Headphone Jack", NULL),
  52. + SND_SOC_DAPM_LINE("Line In", NULL),
  53. +};
  54. +
  55. +static const struct snd_soc_dapm_route audio_map[] = {
  56. + /* Headphone connected to LLOUT, LROUT */
  57. + {"Headphone Jack", NULL, "LLOUT"},
  58. + {"Headphone Jack", NULL, "LROUT"},
  59. +
  60. + /* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */
  61. + {"LINE1L", NULL, "Line In"},
  62. + {"LINE2L", NULL, "Line In"},
  63. + {"LINE1R", NULL, "Line In"},
  64. + {"LINE2R", NULL, "Line In"},
  65. +};
  66. +
  67. +static int omap3beagle_aic3x_init(struct snd_soc_codec *codec)
  68. +{
  69. + /* Add beagle specific widgets */
  70. + snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets,
  71. + ARRAY_SIZE(aic3x_dapm_widgets));
  72. +
  73. + /* Set up beagle specific audio path audio_map */
  74. + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
  75. +
  76. + /* not connected */
  77. + snd_soc_dapm_disable_pin(codec, "MONO_LOUT");
  78. + snd_soc_dapm_disable_pin(codec, "HPLCOM");
  79. + snd_soc_dapm_disable_pin(codec, "HPRCOM");
  80. + snd_soc_dapm_disable_pin(codec, "HPLOUT");
  81. + snd_soc_dapm_disable_pin(codec, "HPROUT");
  82. +
  83. + /* always connected */
  84. + snd_soc_dapm_enable_pin(codec, "Headphone Jack");
  85. + snd_soc_dapm_enable_pin(codec, "Line In");
  86. +
  87. + snd_soc_dapm_sync(codec);
  88. +
  89. + return 0;
  90. +}
  91. +
  92. /* Digital audio interface glue - connects codec <--> CPU */
  93. static struct snd_soc_dai_link omap3beagle_dai = {
  94. - .name = "TWL4030",
  95. - .stream_name = "TWL4030",
  96. + .name = "TLV320AIC3X",
  97. + .stream_name = "AIC3X",
  98. .cpu_dai = &omap_mcbsp_dai[0],
  99. - .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
  100. + .codec_dai = &aic3x_dai,
  101. + .init = omap3beagle_aic3x_init,
  102. .ops = &omap3beagle_ops,
  103. };
  104.  
  105. @@ -105,10 +156,13 @@
  106. .num_links = 1,
  107. };
  108.  
  109. +static struct aic3x_setup_data aic3x_setup;
  110. +
  111. /* Audio subsystem */
  112. static struct snd_soc_device omap3beagle_snd_devdata = {
  113. .card = &snd_soc_omap3beagle,
  114. - .codec_dev = &soc_codec_dev_twl4030,
  115. + .codec_dev = &soc_codec_dev_aic3x,
  116. + .codec_data = &aic3x_setup,
  117. };
  118.  
  119. static struct platform_device *omap3beagle_snd_device;
  120. @@ -131,7 +185,7 @@
  121.  
  122. platform_set_drvdata(omap3beagle_snd_device, &omap3beagle_snd_devdata);
  123. omap3beagle_snd_devdata.dev = &omap3beagle_snd_device->dev;
  124. - *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */
  125. + *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 2; /* McBSP3 */
  126.  
  127. ret = platform_device_add(omap3beagle_snd_device);
  128. if (ret)
  129. [1] Done emacs board-omap3beagle.c (wd: /media/Extra/rowboat-android/TI_Android_GingerBread_2_3_Sources/kernel/arch/arm/mach-omap2)
  130. (wd now: /media/Extra/rowboat-android/TI_Android_GingerBread_2_3_Sources/kernel/arch/arm/configs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement