2 * Driver for the Conexant CX25821 PCIe bridge
4 * Copyright (C) 2009 Conexant Systems Inc.
5 * Authors <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
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.
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
16 * GNU General Public License for more details.
19 #include <linux/mutex.h>
20 #include <linux/workqueue.h>
22 #define OUTPUT_FRMT_656 0
29 #define FIFO_DISABLE 0
34 #define RESET_STATUS -1
37 /* PAL and NTSC line sizes and number of lines. */
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
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)
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)
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
62 #define USE_RISC_NOOP_VIDEO 1
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)
70 #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
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)
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)
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)
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)
92 #define NTSC_RISC_BUF_SIZE \
93 (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
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)
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)
108 #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
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)
115 #define ODD_FLD_PAL_PROG_SIZE \
116 (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
117 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
119 #define ODD_FLD_NTSC_PROG_SIZE \
120 (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE + \
121 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
123 #define NTSC_US_VID_PROG_SIZE \
124 ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE + \
125 RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE)
127 #define NTSC_RISC_BUF_SIZE \
128 (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
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)