Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[sfrench/cifs-2.6.git] / drivers / media / pci / cx25821 / cx25821-video-upstream.h
1 /*
2  *  Driver for the Conexant CX25821 PCIe bridge
3  *
4  *  Copyright (C) 2009 Conexant Systems Inc.
5  *  Authors  <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *
16  *  GNU General Public License for more details.
17  */
18
19 #include <linux/mutex.h>
20 #include <linux/workqueue.h>
21
22 #define OUTPUT_FRMT_656       0
23 #define OPEN_FILE_1           0
24 #define NUM_PROGS             8
25 #define NUM_FRAMES            2
26 #define ODD_FIELD             0
27 #define EVEN_FIELD            1
28 #define TOP_OFFSET            0
29 #define FIFO_DISABLE          0
30 #define FIFO_ENABLE           1
31 #define TEST_FRAMES           5
32 #define END_OF_FILE           0
33 #define IN_PROGRESS           1
34 #define RESET_STATUS          -1
35 #define NUM_NO_OPS            5
36
37 /* PAL and NTSC line sizes and number of lines. */
38 #define WIDTH_D1              720
39 #define NTSC_LINES_PER_FRAME  480
40 #define PAL_LINES_PER_FRAME   576
41 #define PAL_LINE_SZ           1440
42 #define Y422_LINE_SZ          1440
43 #define Y411_LINE_SZ          1080
44 #define NTSC_FIELD_HEIGHT     240
45 #define NTSC_ODD_FLD_LINES    241
46 #define PAL_FIELD_HEIGHT      288
47
48 #define FRAME_SIZE_NTSC_Y422    (NTSC_LINES_PER_FRAME * Y422_LINE_SZ)
49 #define FRAME_SIZE_NTSC_Y411    (NTSC_LINES_PER_FRAME * Y411_LINE_SZ)
50 #define FRAME_SIZE_PAL_Y422     (PAL_LINES_PER_FRAME * Y422_LINE_SZ)
51 #define FRAME_SIZE_PAL_Y411     (PAL_LINES_PER_FRAME * Y411_LINE_SZ)
52
53 #define NTSC_DATA_BUF_SZ        (Y422_LINE_SZ * NTSC_LINES_PER_FRAME)
54 #define PAL_DATA_BUF_SZ         (Y422_LINE_SZ * PAL_LINES_PER_FRAME)
55
56 #define RISC_WRITECR_INSTRUCTION_SIZE   16
57 #define RISC_SYNC_INSTRUCTION_SIZE      4
58 #define JUMP_INSTRUCTION_SIZE           12
59 #define MAXSIZE_NO_OPS                  36
60 #define DWORD_SIZE                      4
61
62 #define USE_RISC_NOOP_VIDEO   1
63
64 #ifdef USE_RISC_NOOP_VIDEO
65 #define PAL_US_VID_PROG_SIZE                                            \
66         (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE +                            \
67          RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE +   \
68          NUM_NO_OPS * DWORD_SIZE)
69
70 #define PAL_RISC_BUF_SIZE           (2 * PAL_US_VID_PROG_SIZE)
71
72 #define PAL_VID_PROG_SIZE                                               \
73         ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE +                      \
74          2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
75          JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
76
77 #define ODD_FLD_PAL_PROG_SIZE                                           \
78         (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE +                            \
79          RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE +   \
80          NUM_NO_OPS * DWORD_SIZE)
81
82 #define ODD_FLD_NTSC_PROG_SIZE                                          \
83         (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE +                          \
84          RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE +   \
85          NUM_NO_OPS * DWORD_SIZE)
86
87 #define NTSC_US_VID_PROG_SIZE                                           \
88         ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE +                    \
89          RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE +        \
90          NUM_NO_OPS * DWORD_SIZE)
91
92 #define NTSC_RISC_BUF_SIZE                                              \
93         (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
94
95 #define FRAME1_VID_PROG_SIZE                                            \
96         ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE +    \
97          2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
98          JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
99
100 #endif
101
102 #ifndef USE_RISC_NOOP_VIDEO
103 #define PAL_US_VID_PROG_SIZE                                            \
104         (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE +                            \
105          RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE +   \
106          JUMP_INSTRUCTION_SIZE)
107
108 #define PAL_RISC_BUF_SIZE               (2 * PAL_US_VID_PROG_SIZE)
109
110 #define PAL_VID_PROG_SIZE                                               \
111         ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE +                      \
112          2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
113          JUMP_INSTRUCTION_SIZE)
114
115 #define ODD_FLD_PAL_PROG_SIZE                                           \
116         (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE +                            \
117          RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
118
119 #define ODD_FLD_NTSC_PROG_SIZE                                          \
120         (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE +                          \
121          RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
122
123 #define NTSC_US_VID_PROG_SIZE                                           \
124         ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE +                    \
125          RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE)
126
127 #define NTSC_RISC_BUF_SIZE                                              \
128         (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
129
130 #define FRAME1_VID_PROG_SIZE                                            \
131         ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE +    \
132          2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
133          JUMP_INSTRUCTION_SIZE)
134
135 #endif