aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin/bf5xx-ac97.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2009-02-06 05:12:34 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-02-06 07:07:29 -0500
commit92a950ff2b7091a735c32a6e57b8136650bc7812 (patch)
treed16b8611f0dd97478d7fa32b2e459e3b5ab2f9e2 /sound/soc/blackfin/bf5xx-ac97.c
parent0664678a84c653bde844c7d91646259a25c6188b (diff)
ASoC: Blackfin: cleanup sport handling in ASoC Blackfin AC97 code
- make sport number handling more dynamic as not all Blackfins have a linear sport map starting at 0 - indexes can be macroed away too Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/blackfin/bf5xx-ac97.c')
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c92
1 files changed, 33 insertions, 59 deletions
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index 3be2be60576d..5885702c78ff 100644
--- a/sound/soc/blackfin/bf5xx-ac97.c
+++ b/sound/soc/blackfin/bf5xx-ac97.c
@@ -31,72 +31,46 @@
31#include "bf5xx-sport.h" 31#include "bf5xx-sport.h"
32#include "bf5xx-ac97.h" 32#include "bf5xx-ac97.h"
33 33
34#if defined(CONFIG_BF54x)
35#define PIN_REQ_SPORT_0 {P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, \
36 P_SPORT0_RFS, P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}
37
38#define PIN_REQ_SPORT_1 {P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, \
39 P_SPORT1_RFS, P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}
40
41#define PIN_REQ_SPORT_2 {P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, \
42 P_SPORT2_RFS, P_SPORT2_DRPRI, P_SPORT2_RSCLK, 0}
43
44#define PIN_REQ_SPORT_3 {P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, \
45 P_SPORT3_RFS, P_SPORT3_DRPRI, P_SPORT3_RSCLK, 0}
46#else
47#define PIN_REQ_SPORT_0 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, \
48 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}
49
50#define PIN_REQ_SPORT_1 {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, \
51 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}
52#endif
53
54static int *cmd_count; 34static int *cmd_count;
55static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM; 35static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
56 36
37#define SPORT_REQ(x) \
38 [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
39 P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
57static u16 sport_req[][7] = { 40static u16 sport_req[][7] = {
58 PIN_REQ_SPORT_0, 41#ifdef SPORT0_TCR1
59#ifdef PIN_REQ_SPORT_1 42 SPORT_REQ(0),
60 PIN_REQ_SPORT_1,
61#endif 43#endif
62#ifdef PIN_REQ_SPORT_2 44#ifdef SPORT1_TCR1
63 PIN_REQ_SPORT_2, 45 SPORT_REQ(1),
64#endif 46#endif
65#ifdef PIN_REQ_SPORT_3 47#ifdef SPORT2_TCR1
66 PIN_REQ_SPORT_3, 48 SPORT_REQ(2),
67#endif 49#endif
68 }; 50#ifdef SPORT3_TCR1
51 SPORT_REQ(3),
52#endif
53};
69 54
55#define SPORT_PARAMS(x) \
56 [x] = { \
57 .dma_rx_chan = CH_SPORT##x##_RX, \
58 .dma_tx_chan = CH_SPORT##x##_TX, \
59 .err_irq = IRQ_SPORT##x##_ERROR, \
60 .regs = (struct sport_register *)SPORT##x##_TCR1, \
61 }
70static struct sport_param sport_params[4] = { 62static struct sport_param sport_params[4] = {
71 { 63#ifdef SPORT0_TCR1
72 .dma_rx_chan = CH_SPORT0_RX, 64 SPORT_PARAMS(0),
73 .dma_tx_chan = CH_SPORT0_TX,
74 .err_irq = IRQ_SPORT0_ERROR,
75 .regs = (struct sport_register *)SPORT0_TCR1,
76 },
77#ifdef PIN_REQ_SPORT_1
78 {
79 .dma_rx_chan = CH_SPORT1_RX,
80 .dma_tx_chan = CH_SPORT1_TX,
81 .err_irq = IRQ_SPORT1_ERROR,
82 .regs = (struct sport_register *)SPORT1_TCR1,
83 },
84#endif 65#endif
85#ifdef PIN_REQ_SPORT_2 66#ifdef SPORT1_TCR1
86 { 67 SPORT_PARAMS(1),
87 .dma_rx_chan = CH_SPORT2_RX,
88 .dma_tx_chan = CH_SPORT2_TX,
89 .err_irq = IRQ_SPORT2_ERROR,
90 .regs = (struct sport_register *)SPORT2_TCR1,
91 },
92#endif 68#endif
93#ifdef PIN_REQ_SPORT_3 69#ifdef SPORT2_TCR1
94 { 70 SPORT_PARAMS(2),
95 .dma_rx_chan = CH_SPORT3_RX, 71#endif
96 .dma_tx_chan = CH_SPORT3_TX, 72#ifdef SPORT3_TCR1
97 .err_irq = IRQ_SPORT3_ERROR, 73 SPORT_PARAMS(3),
98 .regs = (struct sport_register *)SPORT3_TCR1,
99 }
100#endif 74#endif
101}; 75};
102 76
@@ -332,11 +306,11 @@ static int bf5xx_ac97_probe(struct platform_device *pdev,
332 if (cmd_count == NULL) 306 if (cmd_count == NULL)
333 return -ENOMEM; 307 return -ENOMEM;
334 308
335 if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { 309 if (peripheral_request_list(sport_req[sport_num], "soc-audio")) {
336 pr_err("Requesting Peripherals failed\n"); 310 pr_err("Requesting Peripherals failed\n");
337 ret = -EFAULT; 311 ret = -EFAULT;
338 goto peripheral_err; 312 goto peripheral_err;
339 } 313 }
340 314
341#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET 315#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
342 /* Request PB3 as reset pin */ 316 /* Request PB3 as reset pin */
@@ -385,7 +359,7 @@ sport_err:
385 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); 359 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
386#endif 360#endif
387gpio_err: 361gpio_err:
388 peripheral_free_list(&sport_req[sport_num][0]); 362 peripheral_free_list(sport_req[sport_num]);
389peripheral_err: 363peripheral_err:
390 free_page((unsigned long)cmd_count); 364 free_page((unsigned long)cmd_count);
391 cmd_count = NULL; 365 cmd_count = NULL;
@@ -398,7 +372,7 @@ static void bf5xx_ac97_remove(struct platform_device *pdev,
398{ 372{
399 free_page((unsigned long)cmd_count); 373 free_page((unsigned long)cmd_count);
400 cmd_count = NULL; 374 cmd_count = NULL;
401 peripheral_free_list(&sport_req[sport_num][0]); 375 peripheral_free_list(sport_req[sport_num]);
402#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET 376#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
403 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); 377 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
404#endif 378#endif