aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-22 18:47:58 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-22 18:47:58 -0400
commit2ef39e606bb43d6041b6d820e2a9156110a82d21 (patch)
tree7c4cb8bd147d962344d357569172dfbe35f098a6 /arch
parenta89be93c28cd656d1c3c49fe627666b3bbecd45a (diff)
parentb4cad7af6665743647f28119b689e1552326d4da (diff)
Merge remote-tracking branch 'asoc/topic/ux500' into for-3.7
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/board-mop500-msp.c79
-rw-r--r--arch/arm/mach-ux500/include/mach/msp.h2
2 files changed, 1 insertions, 80 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-msp.c b/arch/arm/mach-ux500/board-mop500-msp.c
index df15646036aa..ace6c051bc1a 100644
--- a/arch/arm/mach-ux500/board-mop500-msp.c
+++ b/arch/arm/mach-ux500/board-mop500-msp.c
@@ -7,7 +7,6 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <linux/pinctrl/consumer.h>
11 10
12#include <plat/gpio-nomadik.h> 11#include <plat/gpio-nomadik.h>
13#include <plat/pincfg.h> 12#include <plat/pincfg.h>
@@ -23,53 +22,6 @@
23#include "devices-db8500.h" 22#include "devices-db8500.h"
24#include "pins-db8500.h" 23#include "pins-db8500.h"
25 24
26/* MSP1/3 Tx/Rx usage protection */
27static DEFINE_SPINLOCK(msp_rxtx_lock);
28
29/* Reference Count */
30static int msp_rxtx_ref;
31
32/* Pin modes */
33struct pinctrl *msp1_p;
34struct pinctrl_state *msp1_def;
35struct pinctrl_state *msp1_sleep;
36
37int msp13_i2s_init(void)
38{
39 int retval = 0;
40 unsigned long flags;
41
42 spin_lock_irqsave(&msp_rxtx_lock, flags);
43 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) {
44 retval = pinctrl_select_state(msp1_p, msp1_def);
45 if (retval)
46 pr_err("could not set MSP1 defstate\n");
47 }
48 if (!retval)
49 msp_rxtx_ref++;
50 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
51
52 return retval;
53}
54
55int msp13_i2s_exit(void)
56{
57 int retval = 0;
58 unsigned long flags;
59
60 spin_lock_irqsave(&msp_rxtx_lock, flags);
61 WARN_ON(!msp_rxtx_ref);
62 msp_rxtx_ref--;
63 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) {
64 retval = pinctrl_select_state(msp1_p, msp1_sleep);
65 if (retval)
66 pr_err("could not set MSP1 sleepstate\n");
67 }
68 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
69
70 return retval;
71}
72
73static struct stedma40_chan_cfg msp0_dma_rx = { 25static struct stedma40_chan_cfg msp0_dma_rx = {
74 .high_priority = true, 26 .high_priority = true,
75 .dir = STEDMA40_PERIPH_TO_MEM, 27 .dir = STEDMA40_PERIPH_TO_MEM,
@@ -132,8 +84,6 @@ static struct msp_i2s_platform_data msp1_platform_data = {
132 .id = MSP_I2S_1, 84 .id = MSP_I2S_1,
133 .msp_i2s_dma_rx = NULL, 85 .msp_i2s_dma_rx = NULL,
134 .msp_i2s_dma_tx = &msp1_dma_tx, 86 .msp_i2s_dma_tx = &msp1_dma_tx,
135 .msp_i2s_init = msp13_i2s_init,
136 .msp_i2s_exit = msp13_i2s_exit,
137}; 87};
138 88
139static struct stedma40_chan_cfg msp2_dma_rx = { 89static struct stedma40_chan_cfg msp2_dma_rx = {
@@ -219,49 +169,22 @@ static struct msp_i2s_platform_data msp3_platform_data = {
219 .id = MSP_I2S_3, 169 .id = MSP_I2S_3,
220 .msp_i2s_dma_rx = &msp1_dma_rx, 170 .msp_i2s_dma_rx = &msp1_dma_rx,
221 .msp_i2s_dma_tx = NULL, 171 .msp_i2s_dma_tx = NULL,
222 .msp_i2s_init = msp13_i2s_init,
223 .msp_i2s_exit = msp13_i2s_exit,
224}; 172};
225 173
226int mop500_msp_init(struct device *parent) 174int mop500_msp_init(struct device *parent)
227{ 175{
228 struct platform_device *msp1;
229
230 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__); 176 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__);
231 platform_device_register(&snd_soc_mop500); 177 platform_device_register(&snd_soc_mop500);
232 178
233 pr_info("Initialize MSP I2S-devices.\n"); 179 pr_info("Initialize MSP I2S-devices.\n");
234 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, 180 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
235 &msp0_platform_data); 181 &msp0_platform_data);
236 msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, 182 db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
237 &msp1_platform_data); 183 &msp1_platform_data);
238 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, 184 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
239 &msp2_platform_data); 185 &msp2_platform_data);
240 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, 186 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
241 &msp3_platform_data); 187 &msp3_platform_data);
242 188
243 /* Get the pinctrl handle for MSP1 */
244 if (msp1) {
245 msp1_p = pinctrl_get(&msp1->dev);
246 if (IS_ERR(msp1_p))
247 dev_err(&msp1->dev, "could not get MSP1 pinctrl\n");
248 else {
249 msp1_def = pinctrl_lookup_state(msp1_p,
250 PINCTRL_STATE_DEFAULT);
251 if (IS_ERR(msp1_def)) {
252 dev_err(&msp1->dev,
253 "could not get MSP1 defstate\n");
254 }
255 msp1_sleep = pinctrl_lookup_state(msp1_p,
256 PINCTRL_STATE_SLEEP);
257 if (IS_ERR(msp1_sleep))
258 dev_err(&msp1->dev,
259 "could not get MSP1 idlestate\n");
260 }
261 }
262
263 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
264 platform_device_register(&ux500_pcm);
265
266 return 0; 189 return 0;
267} 190}
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h
index 798be19129ef..3cc7142eee02 100644
--- a/arch/arm/mach-ux500/include/mach/msp.h
+++ b/arch/arm/mach-ux500/include/mach/msp.h
@@ -22,8 +22,6 @@ struct msp_i2s_platform_data {
22 enum msp_i2s_id id; 22 enum msp_i2s_id id;
23 struct stedma40_chan_cfg *msp_i2s_dma_rx; 23 struct stedma40_chan_cfg *msp_i2s_dma_rx;
24 struct stedma40_chan_cfg *msp_i2s_dma_tx; 24 struct stedma40_chan_cfg *msp_i2s_dma_tx;
25 int (*msp_i2s_init) (void);
26 int (*msp_i2s_exit) (void);
27}; 25};
28 26
29#endif 27#endif