|
47 | 47 | #include <string.h> |
48 | 48 | #include <config.h> |
49 | 49 |
|
50 | | -static struct dai ssp[] = { |
51 | | -{ |
52 | | - .type = SOF_DAI_INTEL_SSP, |
53 | | - .index = 0, |
54 | | - .plat_data = { |
55 | | - .base = SSP_BASE(0), |
56 | | - .irq = IRQ_EXT_SSP0_LVL5(0), |
57 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
58 | | - .offset = SSP_BASE(0) + SSDR, |
59 | | - .handshake = DMA_HANDSHAKE_SSP0_TX, |
60 | | - }, |
61 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
62 | | - .offset = SSP_BASE(0) + SSDR, |
63 | | - .handshake = DMA_HANDSHAKE_SSP0_RX, |
64 | | - } |
65 | | - }, |
66 | | - .ops = &ssp_ops, |
67 | | -}, |
68 | | -{ |
69 | | - .type = SOF_DAI_INTEL_SSP, |
70 | | - .index = 1, |
71 | | - .plat_data = { |
72 | | - .base = SSP_BASE(1), |
73 | | - .irq = IRQ_EXT_SSP1_LVL5(0), |
74 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
75 | | - .offset = SSP_BASE(1) + SSDR, |
76 | | - .handshake = DMA_HANDSHAKE_SSP1_TX, |
77 | | - }, |
78 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
79 | | - .offset = SSP_BASE(1) + SSDR, |
80 | | - .handshake = DMA_HANDSHAKE_SSP1_RX, |
81 | | - } |
82 | | - }, |
83 | | - .ops = &ssp_ops, |
84 | | -}, |
85 | | -{ |
86 | | - .type = SOF_DAI_INTEL_SSP, |
87 | | - .index = 2, |
88 | | - .plat_data = { |
89 | | - .base = SSP_BASE(2), |
90 | | - .irq = IRQ_EXT_SSP2_LVL5(0), |
91 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
92 | | - .offset = SSP_BASE(2) + SSDR, |
93 | | - .handshake = DMA_HANDSHAKE_SSP2_TX, |
94 | | - }, |
95 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
96 | | - .offset = SSP_BASE(2) + SSDR, |
97 | | - .handshake = DMA_HANDSHAKE_SSP2_RX, |
98 | | - } |
99 | | - }, |
100 | | - .ops = &ssp_ops, |
101 | | -}, |
102 | | -#if defined(CONFIG_APOLLOLAKE) |
103 | | -{ |
104 | | - .type = SOF_DAI_INTEL_SSP, |
105 | | - .index = 3, |
106 | | - .plat_data = { |
107 | | - .base = SSP_BASE(3), |
108 | | - .irq = IRQ_EXT_SSP3_LVL5(0), |
109 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
110 | | - .offset = SSP_BASE(3) + SSDR, |
111 | | - .handshake = DMA_HANDSHAKE_SSP3_TX, |
112 | | - }, |
113 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
114 | | - .offset = SSP_BASE(3) + SSDR, |
115 | | - .handshake = DMA_HANDSHAKE_SSP3_RX, |
116 | | - } |
117 | | - }, |
118 | | - .ops = &ssp_ops, |
119 | | -}, |
120 | | -{ |
121 | | - .type = SOF_DAI_INTEL_SSP, |
122 | | - .index = 4, |
123 | | - .plat_data = { |
124 | | - .base = SSP_BASE(4), |
125 | | - .irq = IRQ_EXT_SSP4_LVL5(0), |
126 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
127 | | - .offset = SSP_BASE(4) + SSDR, |
128 | | - .handshake = DMA_HANDSHAKE_SSP4_TX, |
129 | | - }, |
130 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
131 | | - .offset = SSP_BASE(4) + SSDR, |
132 | | - .handshake = DMA_HANDSHAKE_SSP4_RX, |
133 | | - } |
134 | | - }, |
135 | | - .ops = &ssp_ops, |
136 | | -}, |
137 | | -{ |
138 | | - .type = SOF_DAI_INTEL_SSP, |
139 | | - .index = 5, |
140 | | - .plat_data = { |
141 | | - .base = SSP_BASE(5), |
142 | | - .irq = IRQ_EXT_SSP5_LVL5(0), |
143 | | - .fifo[SOF_IPC_STREAM_PLAYBACK] = { |
144 | | - .offset = SSP_BASE(5) + SSDR, |
145 | | - .handshake = DMA_HANDSHAKE_SSP5_TX, |
146 | | - }, |
147 | | - .fifo[SOF_IPC_STREAM_CAPTURE] = { |
148 | | - .offset = SSP_BASE(5) + SSDR, |
149 | | - .handshake = DMA_HANDSHAKE_SSP5_RX, |
150 | | - } |
151 | | - }, |
152 | | - .ops = &ssp_ops, |
153 | | -}, |
154 | | -#endif |
155 | | -}; |
| 50 | +static struct dai ssp[(DAI_NUM_SSP_BASE + DAI_NUM_SSP_EXT)]; |
156 | 51 |
|
157 | 52 | #if defined CONFIG_DMIC |
158 | 53 |
|
@@ -230,8 +125,20 @@ int dai_init(void) |
230 | 125 | int i; |
231 | 126 |
|
232 | 127 | /* init ssp */ |
233 | | - /* TODO: move all the properties initialization here */ |
234 | 128 | for (i = 0; i < ARRAY_SIZE(ssp); i++) { |
| 129 | + ssp[i].type = SOF_DAI_INTEL_SSP; |
| 130 | + ssp[i].index = i; |
| 131 | + ssp[i].ops = &ssp_ops; |
| 132 | + ssp[i].plat_data.base = SSP_BASE(i); |
| 133 | + ssp[i].plat_data.irq = IRQ_EXT_SSPx_LVL5(i, 0); |
| 134 | + ssp[i].plat_data.fifo[SOF_IPC_STREAM_PLAYBACK].offset = |
| 135 | + SSP_BASE(i) + SSDR; |
| 136 | + ssp[i].plat_data.fifo[SOF_IPC_STREAM_PLAYBACK].handshake = |
| 137 | + DMA_HANDSHAKE_SSP0_TX + 2 * i; |
| 138 | + ssp[i].plat_data.fifo[SOF_IPC_STREAM_CAPTURE].offset = |
| 139 | + SSP_BASE(i) + SSDR; |
| 140 | + ssp[i].plat_data.fifo[SOF_IPC_STREAM_CAPTURE].handshake = |
| 141 | + DMA_HANDSHAKE_SSP0_RX + 2 * i; |
235 | 142 | /* initialize spin locks early to enable ref counting */ |
236 | 143 | spinlock_init(&ssp[i].lock); |
237 | 144 | } |
|
0 commit comments