aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin/bf5xx-ac97.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/blackfin/bf5xx-ac97.c')
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c94
1 files changed, 34 insertions, 60 deletions
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index 3be2be60576d..8a935f2d1767 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, 43#endif
44#ifdef SPORT1_TCR1
45 SPORT_REQ(1),
61#endif 46#endif
62#ifdef PIN_REQ_SPORT_2 47#ifdef SPORT2_TCR1
63 PIN_REQ_SPORT_2, 48 SPORT_REQ(2),
64#endif 49#endif
65#ifdef PIN_REQ_SPORT_3 50#ifdef SPORT3_TCR1
66 PIN_REQ_SPORT_3, 51 SPORT_REQ(3),
67#endif 52#endif
68 }; 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 */
@@ -383,9 +357,9 @@ sport_config_err:
383sport_err: 357sport_err:
384#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET 358#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
385 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); 359 gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
386#endif
387gpio_err: 360gpio_err:
388 peripheral_free_list(&sport_req[sport_num][0]); 361#endif
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