1 /*
2  * STK1160 driver
3  *
4  * Copyright (C) 2012 Ezequiel Garcia
5  * <elezegarcia--a.t--gmail.com>
6  *
7  * Based on Easycap driver by R.M. Thomas
8  *	Copyright (C) 2010 R.M. Thomas
9  *	<rmthomas--a.t--sciolus.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  */
22 
23 /* GPIO Control */
24 #define STK1160_GCTRL			0x000
25 
26 /* Remote Wakup Control */
27 #define STK1160_RMCTL			0x00c
28 
29 /*
30  * Decoder Control Register:
31  * This byte controls capture start/stop
32  * with bit #7 (0x?? OR 0x80 to activate).
33  */
34 #define STK1160_DCTRL			0x100
35 
36 /*
37  * Decimation Control Register:
38  * Byte 104: Horizontal Decimation Line Unit Count
39  * Byte 105: Vertical Decimation Line Unit Count
40  * Byte 106: Decimation Control
41  * Bit 0 - Horizontal Decimation Control
42  *   0 Horizontal decimation is disabled.
43  *   1 Horizontal decimation is enabled.
44  * Bit 1 - Decimates Half or More Column
45  *   0 Decimates less than half from original column,
46  *     send count unit (0x105) before each unit skipped.
47  *   1 Decimates half or more from original column,
48  *     skip count unit (0x105) before each unit sent.
49  * Bit 2 - Vertical Decimation Control
50  *   0 Vertical decimation is disabled.
51  *   1 Vertical decimation is enabled.
52  * Bit 3 - Vertical Greater or Equal to Half
53  *   0 Decimates less than half from original row,
54  *     send count unit (0x105) before each unit skipped.
55  *   1 Decimates half or more from original row,
56  *     skip count unit (0x105) before each unit sent.
57  * Bit 4 - Decimation Unit
58  *  0 Decimation will work with 2 rows or columns per unit.
59  *  1 Decimation will work with 4 rows or columns per unit.
60  */
61 #define STK1160_DMCTRL_H_UNITS		0x104
62 #define STK1160_DMCTRL_V_UNITS		0x105
63 #define STK1160_DMCTRL			0x106
64 #define  STK1160_H_DEC_EN		BIT(0)
65 #define  STK1160_H_DEC_MODE		BIT(1)
66 #define  STK1160_V_DEC_EN		BIT(2)
67 #define  STK1160_V_DEC_MODE		BIT(3)
68 #define  STK1160_DEC_UNIT_SIZE		BIT(4)
69 
70 /* Capture Frame Start Position */
71 #define STK116_CFSPO			0x110
72 #define STK116_CFSPO_STX_L		0x110
73 #define STK116_CFSPO_STX_H		0x111
74 #define STK116_CFSPO_STY_L		0x112
75 #define STK116_CFSPO_STY_H		0x113
76 
77 /* Capture Frame End Position */
78 #define STK116_CFEPO			0x114
79 #define STK116_CFEPO_ENX_L		0x114
80 #define STK116_CFEPO_ENX_H		0x115
81 #define STK116_CFEPO_ENY_L		0x116
82 #define STK116_CFEPO_ENY_H		0x117
83 
84 /* Serial Interface Control  */
85 #define STK1160_SICTL			0x200
86 #define STK1160_SICTL_CD		0x202
87 #define STK1160_SICTL_SDA		0x203
88 
89 /* Serial Bus Write */
90 #define STK1160_SBUSW			0x204
91 #define STK1160_SBUSW_WA		0x204
92 #define STK1160_SBUSW_WD		0x205
93 
94 /* Serial Bus Read */
95 #define STK1160_SBUSR			0x208
96 #define STK1160_SBUSR_RA		0x208
97 #define STK1160_SBUSR_RD		0x209
98 
99 /* Alternate Serial Inteface Control */
100 #define STK1160_ASIC			0x2fc
101 
102 /* PLL Select Options */
103 #define STK1160_PLLSO			0x018
104 
105 /* PLL Frequency Divider */
106 #define STK1160_PLLFD			0x01c
107 
108 /* Timing Generator */
109 #define STK1160_TIGEN			0x300
110 
111 /* Timing Control Parameter */
112 #define STK1160_TICTL			0x350
113 
114 /* AC97 Audio Control */
115 #define STK1160_AC97CTL_0		0x500
116 #define STK1160_AC97CTL_1		0x504
117 
118 /* Use [0:6] bits of register 0x504 to set codec command address */
119 #define STK1160_AC97_ADDR		0x504
120 /* Use [16:31] bits of register 0x500 to set codec command data */
121 #define STK1160_AC97_CMD		0x502
122 
123 /* Audio I2S Interface */
124 #define STK1160_I2SCTL			0x50c
125 
126 /* EEPROM Interface */
127 #define STK1160_EEPROM_SZ		0x5f0
128