dev-audio.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /* linux/arch/arm/plat-s3c/dev-audio.c
  2. *
  3. * Copyright 2009 Wolfson Microelectronics
  4. * Mark Brown <broonie@opensource.wolfsonmicro.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/string.h>
  12. #include <linux/platform_device.h>
  13. #include <mach/irqs.h>
  14. #include <mach/map.h>
  15. #include <mach/dma.h>
  16. #include <mach/gpio.h>
  17. #include <plat/devs.h>
  18. #include <plat/audio.h>
  19. #include <plat/gpio-bank-d.h>
  20. #include <plat/gpio-bank-e.h>
  21. #include <plat/gpio-cfg.h>
  22. static struct resource s3c64xx_iis0_resource[] = {
  23. [0] = {
  24. .start = S3C64XX_PA_IIS0,
  25. .end = S3C64XX_PA_IIS0 + 0x100 - 1,
  26. .flags = IORESOURCE_MEM,
  27. },
  28. };
  29. struct platform_device s3c64xx_device_iis0 = {
  30. .name = "s3c64xx-iis",
  31. .id = 0,
  32. .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
  33. .resource = s3c64xx_iis0_resource,
  34. };
  35. EXPORT_SYMBOL(s3c64xx_device_iis0);
  36. static struct resource s3c64xx_iis1_resource[] = {
  37. [0] = {
  38. .start = S3C64XX_PA_IIS1,
  39. .end = S3C64XX_PA_IIS1 + 0x100 - 1,
  40. .flags = IORESOURCE_MEM,
  41. },
  42. };
  43. struct platform_device s3c64xx_device_iis1 = {
  44. .name = "s3c64xx-iis",
  45. .id = 1,
  46. .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
  47. .resource = s3c64xx_iis1_resource,
  48. };
  49. EXPORT_SYMBOL(s3c64xx_device_iis1);
  50. static struct resource s3c64xx_iisv4_resource[] = {
  51. [0] = {
  52. .start = S3C64XX_PA_IISV4,
  53. .end = S3C64XX_PA_IISV4 + 0x100 - 1,
  54. .flags = IORESOURCE_MEM,
  55. },
  56. };
  57. struct platform_device s3c64xx_device_iisv4 = {
  58. .name = "s3c64xx-iis-v4",
  59. .id = -1,
  60. .num_resources = ARRAY_SIZE(s3c64xx_iisv4_resource),
  61. .resource = s3c64xx_iisv4_resource,
  62. };
  63. EXPORT_SYMBOL(s3c64xx_device_iisv4);
  64. /* PCM Controller platform_devices */
  65. static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
  66. {
  67. switch (pdev->id) {
  68. case 0:
  69. s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_PCM0_SCLK);
  70. s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_PCM0_EXTCLK);
  71. s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_PCM0_FSYNC);
  72. s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_PCM0_SIN);
  73. s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_PCM0_SOUT);
  74. break;
  75. case 1:
  76. s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_PCM1_SCLK);
  77. s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_PCM1_EXTCLK);
  78. s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_PCM1_FSYNC);
  79. s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_PCM1_SIN);
  80. s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_PCM1_SOUT);
  81. break;
  82. default:
  83. printk(KERN_DEBUG "Invalid PCM Controller number!");
  84. return -EINVAL;
  85. }
  86. return 0;
  87. }
  88. static struct resource s3c64xx_pcm0_resource[] = {
  89. [0] = {
  90. .start = S3C64XX_PA_PCM0,
  91. .end = S3C64XX_PA_PCM0 + 0x100 - 1,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. [1] = {
  95. .start = DMACH_PCM0_TX,
  96. .end = DMACH_PCM0_TX,
  97. .flags = IORESOURCE_DMA,
  98. },
  99. [2] = {
  100. .start = DMACH_PCM0_RX,
  101. .end = DMACH_PCM0_RX,
  102. .flags = IORESOURCE_DMA,
  103. },
  104. };
  105. static struct s3c_audio_pdata s3c_pcm0_pdata = {
  106. .cfg_gpio = s3c64xx_pcm_cfg_gpio,
  107. };
  108. struct platform_device s3c64xx_device_pcm0 = {
  109. .name = "samsung-pcm",
  110. .id = 0,
  111. .num_resources = ARRAY_SIZE(s3c64xx_pcm0_resource),
  112. .resource = s3c64xx_pcm0_resource,
  113. .dev = {
  114. .platform_data = &s3c_pcm0_pdata,
  115. },
  116. };
  117. EXPORT_SYMBOL(s3c64xx_device_pcm0);
  118. static struct resource s3c64xx_pcm1_resource[] = {
  119. [0] = {
  120. .start = S3C64XX_PA_PCM1,
  121. .end = S3C64XX_PA_PCM1 + 0x100 - 1,
  122. .flags = IORESOURCE_MEM,
  123. },
  124. [1] = {
  125. .start = DMACH_PCM1_TX,
  126. .end = DMACH_PCM1_TX,
  127. .flags = IORESOURCE_DMA,
  128. },
  129. [2] = {
  130. .start = DMACH_PCM1_RX,
  131. .end = DMACH_PCM1_RX,
  132. .flags = IORESOURCE_DMA,
  133. },
  134. };
  135. static struct s3c_audio_pdata s3c_pcm1_pdata = {
  136. .cfg_gpio = s3c64xx_pcm_cfg_gpio,
  137. };
  138. struct platform_device s3c64xx_device_pcm1 = {
  139. .name = "samsung-pcm",
  140. .id = 1,
  141. .num_resources = ARRAY_SIZE(s3c64xx_pcm1_resource),
  142. .resource = s3c64xx_pcm1_resource,
  143. .dev = {
  144. .platform_data = &s3c_pcm1_pdata,
  145. },
  146. };
  147. EXPORT_SYMBOL(s3c64xx_device_pcm1);