xref: /openbmc/linux/drivers/media/pci/zoran/zr36050.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*2a0c2806SHans Verkuil /* SPDX-License-Identifier: GPL-2.0-or-later */
2*2a0c2806SHans Verkuil /*
3*2a0c2806SHans Verkuil  * Zoran ZR36050 basic configuration functions - header file
4*2a0c2806SHans Verkuil  *
5*2a0c2806SHans Verkuil  * Copyright (C) 2001 Wolfgang Scherr <scherr@net4you.at>
6*2a0c2806SHans Verkuil  */
7*2a0c2806SHans Verkuil 
8*2a0c2806SHans Verkuil #ifndef ZR36050_H
9*2a0c2806SHans Verkuil #define ZR36050_H
10*2a0c2806SHans Verkuil 
11*2a0c2806SHans Verkuil #include "videocodec.h"
12*2a0c2806SHans Verkuil 
13*2a0c2806SHans Verkuil /* data stored for each zoran jpeg codec chip */
14*2a0c2806SHans Verkuil struct zr36050 {
15*2a0c2806SHans Verkuil 	char name[32];
16*2a0c2806SHans Verkuil 	int num;
17*2a0c2806SHans Verkuil 	/* io datastructure */
18*2a0c2806SHans Verkuil 	struct videocodec *codec;
19*2a0c2806SHans Verkuil 	// last coder status
20*2a0c2806SHans Verkuil 	__u8 status1;
21*2a0c2806SHans Verkuil 	// actual coder setup
22*2a0c2806SHans Verkuil 	int mode;
23*2a0c2806SHans Verkuil 
24*2a0c2806SHans Verkuil 	__u16 width;
25*2a0c2806SHans Verkuil 	__u16 height;
26*2a0c2806SHans Verkuil 
27*2a0c2806SHans Verkuil 	__u16 bitrate_ctrl;
28*2a0c2806SHans Verkuil 
29*2a0c2806SHans Verkuil 	__u32 total_code_vol;
30*2a0c2806SHans Verkuil 	__u32 real_code_vol;
31*2a0c2806SHans Verkuil 	__u16 max_block_vol;
32*2a0c2806SHans Verkuil 
33*2a0c2806SHans Verkuil 	__u8 h_samp_ratio[8];
34*2a0c2806SHans Verkuil 	__u8 v_samp_ratio[8];
35*2a0c2806SHans Verkuil 	__u16 scalefact;
36*2a0c2806SHans Verkuil 	__u16 dri;
37*2a0c2806SHans Verkuil 
38*2a0c2806SHans Verkuil 	/* com/app marker */
39*2a0c2806SHans Verkuil 	struct jpeg_com_marker com;
40*2a0c2806SHans Verkuil 	struct jpeg_app_marker app;
41*2a0c2806SHans Verkuil };
42*2a0c2806SHans Verkuil 
43*2a0c2806SHans Verkuil /* zr36050 register addresses */
44*2a0c2806SHans Verkuil #define ZR050_GO                  0x000
45*2a0c2806SHans Verkuil #define ZR050_HARDWARE            0x002
46*2a0c2806SHans Verkuil #define ZR050_MODE                0x003
47*2a0c2806SHans Verkuil #define ZR050_OPTIONS             0x004
48*2a0c2806SHans Verkuil #define ZR050_MBCV                0x005
49*2a0c2806SHans Verkuil #define ZR050_MARKERS_EN          0x006
50*2a0c2806SHans Verkuil #define ZR050_INT_REQ_0           0x007
51*2a0c2806SHans Verkuil #define ZR050_INT_REQ_1           0x008
52*2a0c2806SHans Verkuil #define ZR050_TCV_NET_HI          0x009
53*2a0c2806SHans Verkuil #define ZR050_TCV_NET_MH          0x00a
54*2a0c2806SHans Verkuil #define ZR050_TCV_NET_ML          0x00b
55*2a0c2806SHans Verkuil #define ZR050_TCV_NET_LO          0x00c
56*2a0c2806SHans Verkuil #define ZR050_TCV_DATA_HI         0x00d
57*2a0c2806SHans Verkuil #define ZR050_TCV_DATA_MH         0x00e
58*2a0c2806SHans Verkuil #define ZR050_TCV_DATA_ML         0x00f
59*2a0c2806SHans Verkuil #define ZR050_TCV_DATA_LO         0x010
60*2a0c2806SHans Verkuil #define ZR050_SF_HI               0x011
61*2a0c2806SHans Verkuil #define ZR050_SF_LO               0x012
62*2a0c2806SHans Verkuil #define ZR050_AF_HI               0x013
63*2a0c2806SHans Verkuil #define ZR050_AF_M                0x014
64*2a0c2806SHans Verkuil #define ZR050_AF_LO               0x015
65*2a0c2806SHans Verkuil #define ZR050_ACV_HI              0x016
66*2a0c2806SHans Verkuil #define ZR050_ACV_MH              0x017
67*2a0c2806SHans Verkuil #define ZR050_ACV_ML              0x018
68*2a0c2806SHans Verkuil #define ZR050_ACV_LO              0x019
69*2a0c2806SHans Verkuil #define ZR050_ACT_HI              0x01a
70*2a0c2806SHans Verkuil #define ZR050_ACT_MH              0x01b
71*2a0c2806SHans Verkuil #define ZR050_ACT_ML              0x01c
72*2a0c2806SHans Verkuil #define ZR050_ACT_LO              0x01d
73*2a0c2806SHans Verkuil #define ZR050_ACV_TURN_HI         0x01e
74*2a0c2806SHans Verkuil #define ZR050_ACV_TURN_MH         0x01f
75*2a0c2806SHans Verkuil #define ZR050_ACV_TURN_ML         0x020
76*2a0c2806SHans Verkuil #define ZR050_ACV_TURN_LO         0x021
77*2a0c2806SHans Verkuil #define ZR050_STATUS_0            0x02e
78*2a0c2806SHans Verkuil #define ZR050_STATUS_1            0x02f
79*2a0c2806SHans Verkuil 
80*2a0c2806SHans Verkuil #define ZR050_SOF_IDX             0x040
81*2a0c2806SHans Verkuil #define ZR050_SOS1_IDX            0x07a
82*2a0c2806SHans Verkuil #define ZR050_SOS2_IDX            0x08a
83*2a0c2806SHans Verkuil #define ZR050_SOS3_IDX            0x09a
84*2a0c2806SHans Verkuil #define ZR050_SOS4_IDX            0x0aa
85*2a0c2806SHans Verkuil #define ZR050_DRI_IDX             0x0c0
86*2a0c2806SHans Verkuil #define ZR050_DNL_IDX             0x0c6
87*2a0c2806SHans Verkuil #define ZR050_DQT_IDX             0x0cc
88*2a0c2806SHans Verkuil #define ZR050_DHT_IDX             0x1d4
89*2a0c2806SHans Verkuil #define ZR050_APP_IDX             0x380
90*2a0c2806SHans Verkuil #define ZR050_COM_IDX             0x3c0
91*2a0c2806SHans Verkuil 
92*2a0c2806SHans Verkuil /* zr36050 hardware register bits */
93*2a0c2806SHans Verkuil 
94*2a0c2806SHans Verkuil #define ZR050_HW_BSWD                0x80
95*2a0c2806SHans Verkuil #define ZR050_HW_MSTR                0x40
96*2a0c2806SHans Verkuil #define ZR050_HW_DMA                 0x20
97*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_1_CLK          0x00
98*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_2_CLK          0x04
99*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_3_CLK          0x08
100*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_4_CLK          0x0C
101*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_5_CLK          0x10
102*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_6_CLK          0x14
103*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_7_CLK          0x18
104*2a0c2806SHans Verkuil #define ZR050_HW_CFIS_8_CLK          0x1C
105*2a0c2806SHans Verkuil #define ZR050_HW_BELE                0x01
106*2a0c2806SHans Verkuil 
107*2a0c2806SHans Verkuil /* zr36050 mode register bits */
108*2a0c2806SHans Verkuil 
109*2a0c2806SHans Verkuil #define ZR050_MO_COMP                0x80
110*2a0c2806SHans Verkuil #define ZR050_MO_ATP                 0x40
111*2a0c2806SHans Verkuil #define ZR050_MO_PASS2               0x20
112*2a0c2806SHans Verkuil #define ZR050_MO_TLM                 0x10
113*2a0c2806SHans Verkuil #define ZR050_MO_DCONLY              0x08
114*2a0c2806SHans Verkuil #define ZR050_MO_BRC                 0x04
115*2a0c2806SHans Verkuil 
116*2a0c2806SHans Verkuil #define ZR050_MO_ATP                 0x40
117*2a0c2806SHans Verkuil #define ZR050_MO_PASS2               0x20
118*2a0c2806SHans Verkuil #define ZR050_MO_TLM                 0x10
119*2a0c2806SHans Verkuil #define ZR050_MO_DCONLY              0x08
120*2a0c2806SHans Verkuil 
121*2a0c2806SHans Verkuil /* zr36050 option register bits */
122*2a0c2806SHans Verkuil 
123*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_1              0x00
124*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_2              0x20
125*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_3              0x40
126*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_4              0x60
127*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_5              0x80
128*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_6              0xA0
129*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_7              0xC0
130*2a0c2806SHans Verkuil #define ZR050_OP_NSCN_8              0xE0
131*2a0c2806SHans Verkuil #define ZR050_OP_OVF                 0x10
132*2a0c2806SHans Verkuil 
133*2a0c2806SHans Verkuil /* zr36050 markers-enable register bits */
134*2a0c2806SHans Verkuil 
135*2a0c2806SHans Verkuil #define ZR050_ME_APP                 0x80
136*2a0c2806SHans Verkuil #define ZR050_ME_COM                 0x40
137*2a0c2806SHans Verkuil #define ZR050_ME_DRI                 0x20
138*2a0c2806SHans Verkuil #define ZR050_ME_DQT                 0x10
139*2a0c2806SHans Verkuil #define ZR050_ME_DHT                 0x08
140*2a0c2806SHans Verkuil #define ZR050_ME_DNL                 0x04
141*2a0c2806SHans Verkuil #define ZR050_ME_DQTI                0x02
142*2a0c2806SHans Verkuil #define ZR050_ME_DHTI                0x01
143*2a0c2806SHans Verkuil 
144*2a0c2806SHans Verkuil /* zr36050 status0/1 register bit masks */
145*2a0c2806SHans Verkuil 
146*2a0c2806SHans Verkuil #define ZR050_ST_RST_MASK            0x20
147*2a0c2806SHans Verkuil #define ZR050_ST_SOF_MASK            0x02
148*2a0c2806SHans Verkuil #define ZR050_ST_SOS_MASK            0x02
149*2a0c2806SHans Verkuil #define ZR050_ST_DATRDY_MASK         0x80
150*2a0c2806SHans Verkuil #define ZR050_ST_MRKDET_MASK         0x40
151*2a0c2806SHans Verkuil #define ZR050_ST_RFM_MASK            0x10
152*2a0c2806SHans Verkuil #define ZR050_ST_RFD_MASK            0x08
153*2a0c2806SHans Verkuil #define ZR050_ST_END_MASK            0x04
154*2a0c2806SHans Verkuil #define ZR050_ST_TCVOVF_MASK         0x02
155*2a0c2806SHans Verkuil #define ZR050_ST_DATOVF_MASK         0x01
156*2a0c2806SHans Verkuil 
157*2a0c2806SHans Verkuil /* pixel component idx */
158*2a0c2806SHans Verkuil 
159*2a0c2806SHans Verkuil #define ZR050_Y_COMPONENT         0
160*2a0c2806SHans Verkuil #define ZR050_U_COMPONENT         1
161*2a0c2806SHans Verkuil #define ZR050_V_COMPONENT         2
162*2a0c2806SHans Verkuil 
163*2a0c2806SHans Verkuil int zr36050_init_module(void);
164*2a0c2806SHans Verkuil void zr36050_cleanup_module(void);
165*2a0c2806SHans Verkuil #endif				/*fndef ZR36050_H */
166