GNU Linux-libre 6.7.9-gnu
[releases.git] / drivers / media / pci / cx25821 / cx25821-audio.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Driver for the Conexant CX25821 PCIe bridge
4  *
5  *  Copyright (C) 2009 Conexant Systems Inc.
6  *  Authors  <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
7  */
8
9 #ifndef __CX25821_AUDIO_H__
10 #define __CX25821_AUDIO_H__
11
12 #define USE_RISC_NOOP           1
13 #define LINES_PER_BUFFER        15
14 #define AUDIO_LINE_SIZE         128
15
16 /* Number of buffer programs to use at once. */
17 #define NUMBER_OF_PROGRAMS      8
18
19 /*
20  * Max size of the RISC program for a buffer. - worst case is 2 writes per line
21  * Space is also added for the 4 no-op instructions added on the end.
22  */
23 #ifndef USE_RISC_NOOP
24 #define MAX_BUFFER_PROGRAM_SIZE                                         \
25         (2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +           \
26          RISC_WRITECR_INSTRUCTION_SIZE * 4)
27 #endif
28
29 /* MAE 12 July 2005 Try to use NOOP RISC instruction instead */
30 #ifdef USE_RISC_NOOP
31 #define MAX_BUFFER_PROGRAM_SIZE                                         \
32         (2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +           \
33          RISC_NOOP_INSTRUCTION_SIZE * 4)
34 #endif
35
36 /* Sizes of various instructions in bytes.  Used when adding instructions. */
37 #define RISC_WRITE_INSTRUCTION_SIZE     12
38 #define RISC_JUMP_INSTRUCTION_SIZE      12
39 #define RISC_SKIP_INSTRUCTION_SIZE      4
40 #define RISC_SYNC_INSTRUCTION_SIZE      4
41 #define RISC_WRITECR_INSTRUCTION_SIZE   16
42 #define RISC_NOOP_INSTRUCTION_SIZE      4
43
44 #define MAX_AUDIO_DMA_BUFFER_SIZE                                       \
45         (MAX_BUFFER_PROGRAM_SIZE * NUMBER_OF_PROGRAMS +                 \
46          RISC_SYNC_INSTRUCTION_SIZE)
47
48 #endif