1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * tegra20_spdif.h - Definitions for Tegra20 SPDIF driver
5 * Author: Stephen Warren <swarren@nvidia.com>
6 * Copyright (C) 2011 - NVIDIA, Inc.
8 * Based on code copyright/by:
9 * Copyright (c) 2008-2009, NVIDIA Corporation
12 #ifndef __TEGRA20_SPDIF_H__
13 #define __TEGRA20_SPDIF_H__
15 #include "tegra_pcm.h"
17 /* Offsets from TEGRA20_SPDIF_BASE */
19 #define TEGRA20_SPDIF_CTRL 0x0
20 #define TEGRA20_SPDIF_STATUS 0x4
21 #define TEGRA20_SPDIF_STROBE_CTRL 0x8
22 #define TEGRA20_SPDIF_DATA_FIFO_CSR 0x0C
23 #define TEGRA20_SPDIF_DATA_OUT 0x40
24 #define TEGRA20_SPDIF_DATA_IN 0x80
25 #define TEGRA20_SPDIF_CH_STA_RX_A 0x100
26 #define TEGRA20_SPDIF_CH_STA_RX_B 0x104
27 #define TEGRA20_SPDIF_CH_STA_RX_C 0x108
28 #define TEGRA20_SPDIF_CH_STA_RX_D 0x10C
29 #define TEGRA20_SPDIF_CH_STA_RX_E 0x110
30 #define TEGRA20_SPDIF_CH_STA_RX_F 0x114
31 #define TEGRA20_SPDIF_CH_STA_TX_A 0x140
32 #define TEGRA20_SPDIF_CH_STA_TX_B 0x144
33 #define TEGRA20_SPDIF_CH_STA_TX_C 0x148
34 #define TEGRA20_SPDIF_CH_STA_TX_D 0x14C
35 #define TEGRA20_SPDIF_CH_STA_TX_E 0x150
36 #define TEGRA20_SPDIF_CH_STA_TX_F 0x154
37 #define TEGRA20_SPDIF_USR_STA_RX_A 0x180
38 #define TEGRA20_SPDIF_USR_DAT_TX_A 0x1C0
40 /* Fields in TEGRA20_SPDIF_CTRL */
42 /* Start capturing from 0=right, 1=left channel */
43 #define TEGRA20_SPDIF_CTRL_CAP_LC (1 << 30)
45 /* SPDIF receiver(RX) enable */
46 #define TEGRA20_SPDIF_CTRL_RX_EN (1 << 29)
48 /* SPDIF Transmitter(TX) enable */
49 #define TEGRA20_SPDIF_CTRL_TX_EN (1 << 28)
51 /* Transmit Channel status */
52 #define TEGRA20_SPDIF_CTRL_TC_EN (1 << 27)
54 /* Transmit user Data */
55 #define TEGRA20_SPDIF_CTRL_TU_EN (1 << 26)
57 /* Interrupt on transmit error */
58 #define TEGRA20_SPDIF_CTRL_IE_TXE (1 << 25)
60 /* Interrupt on receive error */
61 #define TEGRA20_SPDIF_CTRL_IE_RXE (1 << 24)
63 /* Interrupt on invalid preamble */
64 #define TEGRA20_SPDIF_CTRL_IE_P (1 << 23)
66 /* Interrupt on "B" preamble */
67 #define TEGRA20_SPDIF_CTRL_IE_B (1 << 22)
69 /* Interrupt when block of channel status received */
70 #define TEGRA20_SPDIF_CTRL_IE_C (1 << 21)
72 /* Interrupt when a valid information unit (IU) is received */
73 #define TEGRA20_SPDIF_CTRL_IE_U (1 << 20)
75 /* Interrupt when RX user FIFO attention level is reached */
76 #define TEGRA20_SPDIF_CTRL_QE_RU (1 << 19)
78 /* Interrupt when TX user FIFO attention level is reached */
79 #define TEGRA20_SPDIF_CTRL_QE_TU (1 << 18)
81 /* Interrupt when RX data FIFO attention level is reached */
82 #define TEGRA20_SPDIF_CTRL_QE_RX (1 << 17)
84 /* Interrupt when TX data FIFO attention level is reached */
85 #define TEGRA20_SPDIF_CTRL_QE_TX (1 << 16)
87 /* Loopback test mode enable */
88 #define TEGRA20_SPDIF_CTRL_LBK_EN (1 << 15)
92 * 0 = Single data (16 bit needs to be padded to match the
93 * interface data bit size).
94 * 1 = Packeted left/right channel data into a single word.
96 #define TEGRA20_SPDIF_CTRL_PACK (1 << 14)
104 #define TEGRA20_SPDIF_BIT_MODE_16BIT 0
105 #define TEGRA20_SPDIF_BIT_MODE_20BIT 1
106 #define TEGRA20_SPDIF_BIT_MODE_24BIT 2
107 #define TEGRA20_SPDIF_BIT_MODE_RAW 3
109 #define TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT 12
110 #define TEGRA20_SPDIF_CTRL_BIT_MODE_MASK (3 << TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT)
111 #define TEGRA20_SPDIF_CTRL_BIT_MODE_16BIT (TEGRA20_SPDIF_BIT_MODE_16BIT << TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT)
112 #define TEGRA20_SPDIF_CTRL_BIT_MODE_20BIT (TEGRA20_SPDIF_BIT_MODE_20BIT << TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT)
113 #define TEGRA20_SPDIF_CTRL_BIT_MODE_24BIT (TEGRA20_SPDIF_BIT_MODE_24BIT << TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT)
114 #define TEGRA20_SPDIF_CTRL_BIT_MODE_RAW (TEGRA20_SPDIF_BIT_MODE_RAW << TEGRA20_SPDIF_CTRL_BIT_MODE_SHIFT)
116 /* Fields in TEGRA20_SPDIF_STATUS */
119 * Note: IS_P, IS_B, IS_C, and IS_U are sticky bits. Software must
120 * write a 1 to the corresponding bit location to clear the status.
124 * Receiver(RX) shifter is busy receiving data.
125 * This bit is asserted when the receiver first locked onto the
126 * preamble of the data stream after RX_EN is asserted. This bit is
127 * deasserted when either,
128 * (a) the end of a frame is reached after RX_EN is deeasserted, or
129 * (b) the SPDIF data stream becomes inactive.
131 #define TEGRA20_SPDIF_STATUS_RX_BSY (1 << 29)
134 * Transmitter(TX) shifter is busy transmitting data.
135 * This bit is asserted when TX_EN is asserted.
136 * This bit is deasserted when the end of a frame is reached after
137 * TX_EN is deasserted.
139 #define TEGRA20_SPDIF_STATUS_TX_BSY (1 << 28)
142 * TX is busy shifting out channel status.
143 * This bit is asserted when both TX_EN and TC_EN are asserted and
144 * data from CH_STA_TX_A register is loaded into the internal shifter.
145 * This bit is deasserted when either,
146 * (a) the end of a frame is reached after TX_EN is deasserted, or
147 * (b) CH_STA_TX_F register is loaded into the internal shifter.
149 #define TEGRA20_SPDIF_STATUS_TC_BSY (1 << 27)
152 * TX User data FIFO busy.
153 * This bit is asserted when TX_EN and TXU_EN are asserted and
154 * there's data in the TX user FIFO. This bit is deassert when either,
155 * (a) the end of a frame is reached after TX_EN is deasserted, or
156 * (b) there's no data left in the TX user FIFO.
158 #define TEGRA20_SPDIF_STATUS_TU_BSY (1 << 26)
160 /* TX FIFO Underrun error status */
161 #define TEGRA20_SPDIF_STATUS_TX_ERR (1 << 25)
163 /* RX FIFO Overrun error status */
164 #define TEGRA20_SPDIF_STATUS_RX_ERR (1 << 24)
166 /* Preamble status: 0=Preamble OK, 1=bad/missing preamble */
167 #define TEGRA20_SPDIF_STATUS_IS_P (1 << 23)
169 /* B-preamble detection status: 0=not detected, 1=B-preamble detected */
170 #define TEGRA20_SPDIF_STATUS_IS_B (1 << 22)
173 * RX channel block data receive status:
174 * 0=entire block not recieved yet.
175 * 1=received entire block of channel status,
177 #define TEGRA20_SPDIF_STATUS_IS_C (1 << 21)
179 /* RX User Data Valid flag: 1=valid IU detected, 0 = no IU detected. */
180 #define TEGRA20_SPDIF_STATUS_IS_U (1 << 20)
183 * RX User FIFO Status:
184 * 1=attention level reached, 0=attention level not reached.
186 #define TEGRA20_SPDIF_STATUS_QS_RU (1 << 19)
189 * TX User FIFO Status:
190 * 1=attention level reached, 0=attention level not reached.
192 #define TEGRA20_SPDIF_STATUS_QS_TU (1 << 18)
195 * RX Data FIFO Status:
196 * 1=attention level reached, 0=attention level not reached.
198 #define TEGRA20_SPDIF_STATUS_QS_RX (1 << 17)
201 * TX Data FIFO Status:
202 * 1=attention level reached, 0=attention level not reached.
204 #define TEGRA20_SPDIF_STATUS_QS_TX (1 << 16)
206 /* Fields in TEGRA20_SPDIF_STROBE_CTRL */
209 * Indicates the approximate number of detected SPDIFIN clocks within a
212 #define TEGRA20_SPDIF_STROBE_CTRL_PERIOD_SHIFT 16
213 #define TEGRA20_SPDIF_STROBE_CTRL_PERIOD_MASK (0xff << TEGRA20_SPDIF_STROBE_CTRL_PERIOD_SHIFT)
215 /* Data strobe mode: 0=Auto-locked 1=Manual locked */
216 #define TEGRA20_SPDIF_STROBE_CTRL_STROBE (1 << 15)
219 * Manual data strobe time within the bi-phase clock period (in terms of
220 * the number of over-sampling clocks).
222 #define TEGRA20_SPDIF_STROBE_CTRL_DATA_STROBES_SHIFT 8
223 #define TEGRA20_SPDIF_STROBE_CTRL_DATA_STROBES_MASK (0x1f << TEGRA20_SPDIF_STROBE_CTRL_DATA_STROBES_SHIFT)
226 * Manual SPDIFIN bi-phase clock period (in terms of the number of
227 * over-sampling clocks).
229 #define TEGRA20_SPDIF_STROBE_CTRL_CLOCK_PERIOD_SHIFT 0
230 #define TEGRA20_SPDIF_STROBE_CTRL_CLOCK_PERIOD_MASK (0x3f << TEGRA20_SPDIF_STROBE_CTRL_CLOCK_PERIOD_SHIFT)
232 /* Fields in SPDIF_DATA_FIFO_CSR */
234 /* Clear Receiver User FIFO (RX USR.FIFO) */
235 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_CLR (1 << 31)
237 #define TEGRA20_SPDIF_FIFO_ATN_LVL_U_ONE_SLOT 0
238 #define TEGRA20_SPDIF_FIFO_ATN_LVL_U_TWO_SLOTS 1
239 #define TEGRA20_SPDIF_FIFO_ATN_LVL_U_THREE_SLOTS 2
240 #define TEGRA20_SPDIF_FIFO_ATN_LVL_U_FOUR_SLOTS 3
242 /* RU FIFO attention level */
243 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT 29
244 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_MASK \
245 (0x3 << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT)
246 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_RU1_WORD_FULL \
247 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_ONE_SLOT << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT)
248 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_RU2_WORD_FULL \
249 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_TWO_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT)
250 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_RU3_WORD_FULL \
251 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_THREE_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT)
252 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_RU4_WORD_FULL \
253 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_FOUR_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_ATN_LVL_SHIFT)
255 /* Number of RX USR.FIFO levels with valid data. */
256 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_FULL_COUNT_SHIFT 24
257 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RU_FULL_COUNT_MASK (0x1f << TEGRA20_SPDIF_DATA_FIFO_CSR_RU_FULL_COUNT_SHIFT)
259 /* Clear Transmitter User FIFO (TX USR.FIFO) */
260 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_CLR (1 << 23)
262 /* TU FIFO attention level */
263 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT 21
264 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_MASK \
265 (0x3 << TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT)
266 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_TU1_WORD_FULL \
267 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_ONE_SLOT << TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT)
268 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_TU2_WORD_FULL \
269 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_TWO_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT)
270 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_TU3_WORD_FULL \
271 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_THREE_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT)
272 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_TU4_WORD_FULL \
273 (TEGRA20_SPDIF_FIFO_ATN_LVL_U_FOUR_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TU_ATN_LVL_SHIFT)
275 /* Number of TX USR.FIFO levels that could be filled. */
276 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_EMPTY_COUNT_SHIFT 16
277 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TU_EMPTY_COUNT_MASK (0x1f << SPDIF_DATA_FIFO_CSR_TU_EMPTY_COUNT_SHIFT)
279 /* Clear Receiver Data FIFO (RX DATA.FIFO) */
280 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_CLR (1 << 15)
282 #define TEGRA20_SPDIF_FIFO_ATN_LVL_D_ONE_SLOT 0
283 #define TEGRA20_SPDIF_FIFO_ATN_LVL_D_FOUR_SLOTS 1
284 #define TEGRA20_SPDIF_FIFO_ATN_LVL_D_EIGHT_SLOTS 2
285 #define TEGRA20_SPDIF_FIFO_ATN_LVL_D_TWELVE_SLOTS 3
287 /* RU FIFO attention level */
288 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT 13
289 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_MASK \
290 (0x3 << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT)
291 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_RU1_WORD_FULL \
292 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_ONE_SLOT << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT)
293 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_RU4_WORD_FULL \
294 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_FOUR_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT)
295 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_RU8_WORD_FULL \
296 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_EIGHT_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT)
297 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_RU12_WORD_FULL \
298 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_TWELVE_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_ATN_LVL_SHIFT)
300 /* Number of RX DATA.FIFO levels with valid data. */
301 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_FULL_COUNT_SHIFT 8
302 #define TEGRA20_SPDIF_DATA_FIFO_CSR_RX_FULL_COUNT_MASK (0x1f << TEGRA20_SPDIF_DATA_FIFO_CSR_RX_FULL_COUNT_SHIFT)
304 /* Clear Transmitter Data FIFO (TX DATA.FIFO) */
305 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_CLR (1 << 7)
307 /* TU FIFO attention level */
308 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT 5
309 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_MASK \
310 (0x3 << TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT)
311 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_TU1_WORD_FULL \
312 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_ONE_SLOT << TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT)
313 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_TU4_WORD_FULL \
314 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_FOUR_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT)
315 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_TU8_WORD_FULL \
316 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_EIGHT_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT)
317 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_TU12_WORD_FULL \
318 (TEGRA20_SPDIF_FIFO_ATN_LVL_D_TWELVE_SLOTS << TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_SHIFT)
320 /* Number of TX DATA.FIFO levels that could be filled. */
321 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_EMPTY_COUNT_SHIFT 0
322 #define TEGRA20_SPDIF_DATA_FIFO_CSR_TX_EMPTY_COUNT_MASK (0x1f << SPDIF_DATA_FIFO_CSR_TX_EMPTY_COUNT_SHIFT)
324 /* Fields in TEGRA20_SPDIF_DATA_OUT */
327 * This register has 5 different formats:
328 * 16-bit (BIT_MODE=00, PACK=0)
329 * 20-bit (BIT_MODE=01, PACK=0)
330 * 24-bit (BIT_MODE=10, PACK=0)
331 * raw (BIT_MODE=11, PACK=0)
332 * 16-bit packed (BIT_MODE=00, PACK=1)
335 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_SHIFT 0
336 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_MASK (0xffff << TEGRA20_SPDIF_DATA_OUT_DATA_16_SHIFT)
338 #define TEGRA20_SPDIF_DATA_OUT_DATA_20_SHIFT 0
339 #define TEGRA20_SPDIF_DATA_OUT_DATA_20_MASK (0xfffff << TEGRA20_SPDIF_DATA_OUT_DATA_20_SHIFT)
341 #define TEGRA20_SPDIF_DATA_OUT_DATA_24_SHIFT 0
342 #define TEGRA20_SPDIF_DATA_OUT_DATA_24_MASK (0xffffff << TEGRA20_SPDIF_DATA_OUT_DATA_24_SHIFT)
344 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_P (1 << 31)
345 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_C (1 << 30)
346 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_U (1 << 29)
347 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_V (1 << 28)
349 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_DATA_SHIFT 8
350 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_DATA_MASK (0xfffff << TEGRA20_SPDIF_DATA_OUT_DATA_RAW_DATA_SHIFT)
352 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_AUX_SHIFT 4
353 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_AUX_MASK (0xf << TEGRA20_SPDIF_DATA_OUT_DATA_RAW_AUX_SHIFT)
355 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_PREAMBLE_SHIFT 0
356 #define TEGRA20_SPDIF_DATA_OUT_DATA_RAW_PREAMBLE_MASK (0xf << TEGRA20_SPDIF_DATA_OUT_DATA_RAW_PREAMBLE_SHIFT)
358 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_RIGHT_SHIFT 16
359 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_RIGHT_MASK (0xffff << TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_RIGHT_SHIFT)
361 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_LEFT_SHIFT 0
362 #define TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_LEFT_MASK (0xffff << TEGRA20_SPDIF_DATA_OUT_DATA_16_PACKED_LEFT_SHIFT)
364 /* Fields in TEGRA20_SPDIF_DATA_IN */
367 * This register has 5 different formats:
368 * 16-bit (BIT_MODE=00, PACK=0)
369 * 20-bit (BIT_MODE=01, PACK=0)
370 * 24-bit (BIT_MODE=10, PACK=0)
371 * raw (BIT_MODE=11, PACK=0)
372 * 16-bit packed (BIT_MODE=00, PACK=1)
374 * Bits 31:24 are common to all modes except 16-bit packed
377 #define TEGRA20_SPDIF_DATA_IN_DATA_P (1 << 31)
378 #define TEGRA20_SPDIF_DATA_IN_DATA_C (1 << 30)
379 #define TEGRA20_SPDIF_DATA_IN_DATA_U (1 << 29)
380 #define TEGRA20_SPDIF_DATA_IN_DATA_V (1 << 28)
382 #define TEGRA20_SPDIF_DATA_IN_DATA_PREAMBLE_SHIFT 24
383 #define TEGRA20_SPDIF_DATA_IN_DATA_PREAMBLE_MASK (0xf << TEGRA20_SPDIF_DATA_IN_DATA_PREAMBLE_SHIFT)
385 #define TEGRA20_SPDIF_DATA_IN_DATA_16_SHIFT 0
386 #define TEGRA20_SPDIF_DATA_IN_DATA_16_MASK (0xffff << TEGRA20_SPDIF_DATA_IN_DATA_16_SHIFT)
388 #define TEGRA20_SPDIF_DATA_IN_DATA_20_SHIFT 0
389 #define TEGRA20_SPDIF_DATA_IN_DATA_20_MASK (0xfffff << TEGRA20_SPDIF_DATA_IN_DATA_20_SHIFT)
391 #define TEGRA20_SPDIF_DATA_IN_DATA_24_SHIFT 0
392 #define TEGRA20_SPDIF_DATA_IN_DATA_24_MASK (0xffffff << TEGRA20_SPDIF_DATA_IN_DATA_24_SHIFT)
394 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_DATA_SHIFT 8
395 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_DATA_MASK (0xfffff << TEGRA20_SPDIF_DATA_IN_DATA_RAW_DATA_SHIFT)
397 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_AUX_SHIFT 4
398 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_AUX_MASK (0xf << TEGRA20_SPDIF_DATA_IN_DATA_RAW_AUX_SHIFT)
400 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_PREAMBLE_SHIFT 0
401 #define TEGRA20_SPDIF_DATA_IN_DATA_RAW_PREAMBLE_MASK (0xf << TEGRA20_SPDIF_DATA_IN_DATA_RAW_PREAMBLE_SHIFT)
403 #define TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_RIGHT_SHIFT 16
404 #define TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_RIGHT_MASK (0xffff << TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_RIGHT_SHIFT)
406 #define TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_LEFT_SHIFT 0
407 #define TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_LEFT_MASK (0xffff << TEGRA20_SPDIF_DATA_IN_DATA_16_PACKED_LEFT_SHIFT)
409 /* Fields in TEGRA20_SPDIF_CH_STA_RX_A */
410 /* Fields in TEGRA20_SPDIF_CH_STA_RX_B */
411 /* Fields in TEGRA20_SPDIF_CH_STA_RX_C */
412 /* Fields in TEGRA20_SPDIF_CH_STA_RX_D */
413 /* Fields in TEGRA20_SPDIF_CH_STA_RX_E */
414 /* Fields in TEGRA20_SPDIF_CH_STA_RX_F */
417 * The 6-word receive channel data page buffer holds a block (192 frames) of
418 * channel status information. The order of receive is from LSB to MSB
419 * bit, and from CH_STA_RX_A to CH_STA_RX_F then back to CH_STA_RX_A.
422 /* Fields in TEGRA20_SPDIF_CH_STA_TX_A */
423 /* Fields in TEGRA20_SPDIF_CH_STA_TX_B */
424 /* Fields in TEGRA20_SPDIF_CH_STA_TX_C */
425 /* Fields in TEGRA20_SPDIF_CH_STA_TX_D */
426 /* Fields in TEGRA20_SPDIF_CH_STA_TX_E */
427 /* Fields in TEGRA20_SPDIF_CH_STA_TX_F */
430 * The 6-word transmit channel data page buffer holds a block (192 frames) of
431 * channel status information. The order of transmission is from LSB to MSB
432 * bit, and from CH_STA_TX_A to CH_STA_TX_F then back to CH_STA_TX_A.
435 /* Fields in TEGRA20_SPDIF_USR_STA_RX_A */
438 * This 4-word deep FIFO receives user FIFO field information. The order of
439 * receive is from LSB to MSB bit.
442 /* Fields in TEGRA20_SPDIF_USR_DAT_TX_A */
445 * This 4-word deep FIFO transmits user FIFO field information. The order of
446 * transmission is from LSB to MSB bit.
449 struct tegra20_spdif
{
450 struct clk
*clk_spdif_out
;
451 struct snd_dmaengine_dai_dma_data capture_dma_data
;
452 struct snd_dmaengine_dai_dma_data playback_dma_data
;
453 struct regmap
*regmap
;
454 struct reset_control
*reset
;