board-mop500-audio.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * License terms: GNU General Public License (GPL), version 2
  5. */
  6. #include <linux/platform_device.h>
  7. #include <linux/init.h>
  8. #include <linux/gpio.h>
  9. #include <linux/platform_data/pinctrl-nomadik.h>
  10. #include <linux/platform_data/dma-ste-dma40.h>
  11. #include "devices.h"
  12. #include "irqs.h"
  13. #include <linux/platform_data/asoc-ux500-msp.h>
  14. #include "ste-dma40-db8500.h"
  15. #include "board-mop500.h"
  16. #include "devices-db8500.h"
  17. #include "pins-db8500.h"
  18. static struct stedma40_chan_cfg msp0_dma_rx = {
  19. .high_priority = true,
  20. .dir = DMA_DEV_TO_MEM,
  21. .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0,
  22. };
  23. static struct stedma40_chan_cfg msp0_dma_tx = {
  24. .high_priority = true,
  25. .dir = DMA_MEM_TO_DEV,
  26. .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0,
  27. };
  28. struct msp_i2s_platform_data msp0_platform_data = {
  29. .id = MSP_I2S_0,
  30. .msp_i2s_dma_rx = &msp0_dma_rx,
  31. .msp_i2s_dma_tx = &msp0_dma_tx,
  32. };
  33. static struct stedma40_chan_cfg msp1_dma_rx = {
  34. .high_priority = true,
  35. .dir = DMA_DEV_TO_MEM,
  36. .dev_type = DB8500_DMA_DEV30_MSP3,
  37. };
  38. static struct stedma40_chan_cfg msp1_dma_tx = {
  39. .high_priority = true,
  40. .dir = DMA_MEM_TO_DEV,
  41. .dev_type = DB8500_DMA_DEV30_MSP1,
  42. };
  43. struct msp_i2s_platform_data msp1_platform_data = {
  44. .id = MSP_I2S_1,
  45. .msp_i2s_dma_rx = NULL,
  46. .msp_i2s_dma_tx = &msp1_dma_tx,
  47. };
  48. static struct stedma40_chan_cfg msp2_dma_rx = {
  49. .high_priority = true,
  50. .dir = DMA_DEV_TO_MEM,
  51. .dev_type = DB8500_DMA_DEV14_MSP2,
  52. };
  53. static struct stedma40_chan_cfg msp2_dma_tx = {
  54. .high_priority = true,
  55. .dir = DMA_MEM_TO_DEV,
  56. .dev_type = DB8500_DMA_DEV14_MSP2,
  57. .use_fixed_channel = true,
  58. .phy_channel = 1,
  59. };
  60. static struct platform_device *db8500_add_msp_i2s(struct device *parent,
  61. int id,
  62. resource_size_t base, int irq,
  63. struct msp_i2s_platform_data *pdata)
  64. {
  65. struct platform_device *pdev;
  66. struct resource res[] = {
  67. DEFINE_RES_MEM(base, SZ_4K),
  68. DEFINE_RES_IRQ(irq),
  69. };
  70. pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
  71. id, irq);
  72. pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id,
  73. res, ARRAY_SIZE(res),
  74. pdata, sizeof(*pdata));
  75. if (!pdev) {
  76. pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
  77. id);
  78. return NULL;
  79. }
  80. return pdev;
  81. }
  82. /* Platform device for ASoC MOP500 machine */
  83. static struct platform_device snd_soc_mop500 = {
  84. .name = "snd-soc-mop500",
  85. .id = 0,
  86. .dev = {
  87. .platform_data = NULL,
  88. },
  89. };
  90. struct msp_i2s_platform_data msp2_platform_data = {
  91. .id = MSP_I2S_2,
  92. .msp_i2s_dma_rx = &msp2_dma_rx,
  93. .msp_i2s_dma_tx = &msp2_dma_tx,
  94. };
  95. struct msp_i2s_platform_data msp3_platform_data = {
  96. .id = MSP_I2S_3,
  97. .msp_i2s_dma_rx = &msp1_dma_rx,
  98. .msp_i2s_dma_tx = NULL,
  99. };
  100. void mop500_audio_init(struct device *parent)
  101. {
  102. pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__);
  103. platform_device_register(&snd_soc_mop500);
  104. pr_info("Initialize MSP I2S-devices.\n");
  105. db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
  106. &msp0_platform_data);
  107. db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
  108. &msp1_platform_data);
  109. db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
  110. &msp2_platform_data);
  111. db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
  112. &msp3_platform_data);
  113. }