board-mop500-audio.c 3.2 KB

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