Staging: Panel: panel: Fixed checkpatch line length warnings
[linux/fpc-iii.git] / arch / arm / mach-ux500 / board-mop500-audio.c
blobaba9e56929583932f0724ae7cdd0024ee70e53d7
1 /*
2 * Copyright (C) ST-Ericsson SA 2010
4 * License terms: GNU General Public License (GPL), version 2
5 */
7 #include <linux/platform_device.h>
8 #include <linux/init.h>
9 #include <linux/gpio.h>
10 #include <linux/platform_data/pinctrl-nomadik.h>
11 #include <linux/platform_data/dma-ste-dma40.h>
13 #include "devices.h"
14 #include "irqs.h"
15 #include <linux/platform_data/asoc-ux500-msp.h>
17 #include "ste-dma40-db8500.h"
18 #include "board-mop500.h"
19 #include "devices-db8500.h"
20 #include "pins-db8500.h"
22 static struct stedma40_chan_cfg msp0_dma_rx = {
23 .high_priority = true,
24 .dir = STEDMA40_PERIPH_TO_MEM,
26 .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX,
27 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
29 .src_info.psize = STEDMA40_PSIZE_LOG_4,
30 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
32 /* data_width is set during configuration */
35 static struct stedma40_chan_cfg msp0_dma_tx = {
36 .high_priority = true,
37 .dir = STEDMA40_MEM_TO_PERIPH,
39 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
40 .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX,
42 .src_info.psize = STEDMA40_PSIZE_LOG_4,
43 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
45 /* data_width is set during configuration */
48 struct msp_i2s_platform_data msp0_platform_data = {
49 .id = MSP_I2S_0,
50 .msp_i2s_dma_rx = &msp0_dma_rx,
51 .msp_i2s_dma_tx = &msp0_dma_tx,
54 static struct stedma40_chan_cfg msp1_dma_rx = {
55 .high_priority = true,
56 .dir = STEDMA40_PERIPH_TO_MEM,
58 .src_dev_type = DB8500_DMA_DEV30_MSP3_RX,
59 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
61 .src_info.psize = STEDMA40_PSIZE_LOG_4,
62 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
64 /* data_width is set during configuration */
67 static struct stedma40_chan_cfg msp1_dma_tx = {
68 .high_priority = true,
69 .dir = STEDMA40_MEM_TO_PERIPH,
71 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
72 .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX,
74 .src_info.psize = STEDMA40_PSIZE_LOG_4,
75 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
77 /* data_width is set during configuration */
80 struct msp_i2s_platform_data msp1_platform_data = {
81 .id = MSP_I2S_1,
82 .msp_i2s_dma_rx = NULL,
83 .msp_i2s_dma_tx = &msp1_dma_tx,
86 static struct stedma40_chan_cfg msp2_dma_rx = {
87 .high_priority = true,
88 .dir = STEDMA40_PERIPH_TO_MEM,
90 .src_dev_type = DB8500_DMA_DEV14_MSP2_RX,
91 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
93 /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */
94 .src_info.psize = STEDMA40_PSIZE_LOG_1,
95 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
97 /* data_width is set during configuration */
100 static struct stedma40_chan_cfg msp2_dma_tx = {
101 .high_priority = true,
102 .dir = STEDMA40_MEM_TO_PERIPH,
104 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
105 .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX,
107 .src_info.psize = STEDMA40_PSIZE_LOG_4,
108 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
110 .use_fixed_channel = true,
111 .phy_channel = 1,
113 /* data_width is set during configuration */
116 static struct platform_device *db8500_add_msp_i2s(struct device *parent,
117 int id,
118 resource_size_t base, int irq,
119 struct msp_i2s_platform_data *pdata)
121 struct platform_device *pdev;
122 struct resource res[] = {
123 DEFINE_RES_MEM(base, SZ_4K),
124 DEFINE_RES_IRQ(irq),
127 pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
128 id, irq);
129 pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id,
130 res, ARRAY_SIZE(res),
131 pdata, sizeof(*pdata));
132 if (!pdev) {
133 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
134 id);
135 return NULL;
138 return pdev;
141 /* Platform device for ASoC MOP500 machine */
142 static struct platform_device snd_soc_mop500 = {
143 .name = "snd-soc-mop500",
144 .id = 0,
145 .dev = {
146 .platform_data = NULL,
150 struct msp_i2s_platform_data msp2_platform_data = {
151 .id = MSP_I2S_2,
152 .msp_i2s_dma_rx = &msp2_dma_rx,
153 .msp_i2s_dma_tx = &msp2_dma_tx,
156 struct msp_i2s_platform_data msp3_platform_data = {
157 .id = MSP_I2S_3,
158 .msp_i2s_dma_rx = &msp1_dma_rx,
159 .msp_i2s_dma_tx = NULL,
162 void mop500_audio_init(struct device *parent)
164 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__);
165 platform_device_register(&snd_soc_mop500);
167 pr_info("Initialize MSP I2S-devices.\n");
168 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
169 &msp0_platform_data);
170 db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
171 &msp1_platform_data);
172 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
173 &msp2_platform_data);
174 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
175 &msp3_platform_data);