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