Full support for Ginger Console
[linux-ginger.git] / drivers / media / dvb / dvb-usb / anysee.h
blob7ca01ff6e13ccadd3944d0199f22758fe946dd95
1 /*
2 * DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * TODO:
21 * - add smart card reader support for Conditional Access (CA)
23 * Card reader in Anysee is nothing more than ISO 7816 card reader.
24 * There is no hardware CAM in any Anysee device sold.
25 * In my understanding it should be implemented by making own module
26 * for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This
27 * module registers serial interface that can be used to communicate
28 * with any ISO 7816 smart card.
30 * Any help according to implement serial smart card reader support
31 * is highly welcome!
34 #ifndef _DVB_USB_ANYSEE_H_
35 #define _DVB_USB_ANYSEE_H_
37 #define DVB_USB_LOG_PREFIX "anysee"
38 #include "dvb-usb.h"
40 #define deb_info(args...) dprintk(dvb_usb_anysee_debug, 0x01, args)
41 #define deb_xfer(args...) dprintk(dvb_usb_anysee_debug, 0x02, args)
42 #define deb_rc(args...) dprintk(dvb_usb_anysee_debug, 0x04, args)
43 #define deb_reg(args...) dprintk(dvb_usb_anysee_debug, 0x08, args)
44 #define deb_i2c(args...) dprintk(dvb_usb_anysee_debug, 0x10, args)
45 #define deb_fw(args...) dprintk(dvb_usb_anysee_debug, 0x20, args)
47 enum cmd {
48 CMD_I2C_READ = 0x33,
49 CMD_I2C_WRITE = 0x31,
50 CMD_REG_READ = 0xb0,
51 CMD_REG_WRITE = 0xb1,
52 CMD_STREAMING_CTRL = 0x12,
53 CMD_LED_AND_IR_CTRL = 0x16,
54 CMD_GET_IR_CODE = 0x41,
55 CMD_GET_HW_INFO = 0x19,
56 CMD_SMARTCARD = 0x34,
59 struct anysee_state {
60 u8 tuner;
61 u8 seq;
64 #endif
66 /***************************************************************************
67 * USB API description (reverse engineered)
68 ***************************************************************************
70 Transaction flow:
71 =================
72 BULK[00001] >>> REQUEST PACKET 64 bytes
73 BULK[00081] <<< REPLY PACKET #1 64 bytes (PREVIOUS TRANSACTION REPLY)
74 BULK[00081] <<< REPLY PACKET #2 64 bytes (CURRENT TRANSACTION REPLY)
76 General reply packet(s) are always used if not own reply defined.
78 ============================================================================
79 | 00-63 | GENERAL REPLY PACKET #1 (PREVIOUS REPLY)
80 ============================================================================
81 | 00 | reply data (if any) from previous transaction
82 | | Just same reply packet as returned during previous transaction.
83 | | Needed only if reply is missed in previous transaction.
84 | | Just skip normally.
85 ----------------------------------------------------------------------------
86 | 01-59 | don't care
87 ----------------------------------------------------------------------------
88 | 60 | packet sequence number
89 ----------------------------------------------------------------------------
90 | 61-63 | don't care
91 ----------------------------------------------------------------------------
93 ============================================================================
94 | 00-63 | GENERAL REPLY PACKET #2 (CURRENT REPLY)
95 ============================================================================
96 | 00 | reply data (if any)
97 ----------------------------------------------------------------------------
98 | 01-59 | don't care
99 ----------------------------------------------------------------------------
100 | 60 | packet sequence number
101 ----------------------------------------------------------------------------
102 | 61-63 | don't care
103 ----------------------------------------------------------------------------
105 ============================================================================
106 | 00-63 | I2C WRITE REQUEST PACKET
107 ============================================================================
108 | 00 | 0x31 I2C write command
109 ----------------------------------------------------------------------------
110 | 01 | i2c address
111 ----------------------------------------------------------------------------
112 | 02 | data length
113 | | 0x02 (for typical I2C reg / val pair)
114 ----------------------------------------------------------------------------
115 | 03 | 0x01
116 ----------------------------------------------------------------------------
117 | 04- | data
118 ----------------------------------------------------------------------------
119 | -59 | don't care
120 ----------------------------------------------------------------------------
121 | 60 | packet sequence number
122 ----------------------------------------------------------------------------
123 | 61-63 | don't care
124 ----------------------------------------------------------------------------
126 ============================================================================
127 | 00-63 | I2C READ REQUEST PACKET
128 ============================================================================
129 | 00 | 0x33 I2C read command
130 ----------------------------------------------------------------------------
131 | 01 | i2c address + 1
132 ----------------------------------------------------------------------------
133 | 02 | register
134 ----------------------------------------------------------------------------
135 | 03 | 0x00
136 ----------------------------------------------------------------------------
137 | 04 | 0x00
138 ----------------------------------------------------------------------------
139 | 05 | 0x01
140 ----------------------------------------------------------------------------
141 | 06-59 | don't care
142 ----------------------------------------------------------------------------
143 | 60 | packet sequence number
144 ----------------------------------------------------------------------------
145 | 61-63 | don't care
146 ----------------------------------------------------------------------------
148 ============================================================================
149 | 00-63 | USB CONTROLLER REGISTER WRITE REQUEST PACKET
150 ============================================================================
151 | 00 | 0xb1 register write command
152 ----------------------------------------------------------------------------
153 | 01-02 | register
154 ----------------------------------------------------------------------------
155 | 03 | 0x01
156 ----------------------------------------------------------------------------
157 | 04 | value
158 ----------------------------------------------------------------------------
159 | 05-59 | don't care
160 ----------------------------------------------------------------------------
161 | 60 | packet sequence number
162 ----------------------------------------------------------------------------
163 | 61-63 | don't care
164 ----------------------------------------------------------------------------
166 ============================================================================
167 | 00-63 | USB CONTROLLER REGISTER READ REQUEST PACKET
168 ============================================================================
169 | 00 | 0xb0 register read command
170 ----------------------------------------------------------------------------
171 | 01-02 | register
172 ----------------------------------------------------------------------------
173 | 03 | 0x01
174 ----------------------------------------------------------------------------
175 | 04-59 | don't care
176 ----------------------------------------------------------------------------
177 | 60 | packet sequence number
178 ----------------------------------------------------------------------------
179 | 61-63 | don't care
180 ----------------------------------------------------------------------------
182 ============================================================================
183 | 00-63 | LED CONTROL REQUEST PACKET
184 ============================================================================
185 | 00 | 0x16 LED and IR control command
186 ----------------------------------------------------------------------------
187 | 01 | 0x01 (LED)
188 ----------------------------------------------------------------------------
189 | 03 | 0x00 blink
190 | | 0x01 lights continuously
191 ----------------------------------------------------------------------------
192 | 04 | blink interval
193 | | 0x00 fastest (looks like LED lights continuously)
194 | | 0xff slowest
195 ----------------------------------------------------------------------------
196 | 05-59 | don't care
197 ----------------------------------------------------------------------------
198 | 60 | packet sequence number
199 ----------------------------------------------------------------------------
200 | 61-63 | don't care
201 ----------------------------------------------------------------------------
203 ============================================================================
204 | 00-63 | IR CONTROL REQUEST PACKET
205 ============================================================================
206 | 00 | 0x16 LED and IR control command
207 ----------------------------------------------------------------------------
208 | 01 | 0x02 (IR)
209 ----------------------------------------------------------------------------
210 | 03 | 0x00 IR disabled
211 | | 0x01 IR enabled
212 ----------------------------------------------------------------------------
213 | 04-59 | don't care
214 ----------------------------------------------------------------------------
215 | 60 | packet sequence number
216 ----------------------------------------------------------------------------
217 | 61-63 | don't care
218 ----------------------------------------------------------------------------
220 ============================================================================
221 | 00-63 | STREAMING CONTROL REQUEST PACKET
222 ============================================================================
223 | 00 | 0x12 streaming control command
224 ----------------------------------------------------------------------------
225 | 01 | 0x00 streaming disabled
226 | | 0x01 streaming enabled
227 ----------------------------------------------------------------------------
228 | 02 | 0x00
229 ----------------------------------------------------------------------------
230 | 03-59 | don't care
231 ----------------------------------------------------------------------------
232 | 60 | packet sequence number
233 ----------------------------------------------------------------------------
234 | 61-63 | don't care
235 ----------------------------------------------------------------------------
237 ============================================================================
238 | 00-63 | REMOTE CONTROL REQUEST PACKET
239 ============================================================================
240 | 00 | 0x41 remote control command
241 ----------------------------------------------------------------------------
242 | 01-59 | don't care
243 ----------------------------------------------------------------------------
244 | 60 | packet sequence number
245 ----------------------------------------------------------------------------
246 | 61-63 | don't care
247 ----------------------------------------------------------------------------
249 ============================================================================
250 | 00-63 | REMOTE CONTROL REPLY PACKET
251 ============================================================================
252 | 00 | 0x00 code not received
253 | | 0x01 code received
254 ----------------------------------------------------------------------------
255 | 01 | remote control code
256 ----------------------------------------------------------------------------
257 | 02-59 | don't care
258 ----------------------------------------------------------------------------
259 | 60 | packet sequence number
260 ----------------------------------------------------------------------------
261 | 61-63 | don't care
262 ----------------------------------------------------------------------------
264 ============================================================================
265 | 00-63 | GET HARDWARE INFO REQUEST PACKET
266 ============================================================================
267 | 00 | 0x19 get hardware info command
268 ----------------------------------------------------------------------------
269 | 01-59 | don't care
270 ----------------------------------------------------------------------------
271 | 60 | packet sequence number
272 ----------------------------------------------------------------------------
273 | 61-63 | don't care
274 ----------------------------------------------------------------------------
276 ============================================================================
277 | 00-63 | GET HARDWARE INFO REPLY PACKET
278 ============================================================================
279 | 00 | hardware id
280 ----------------------------------------------------------------------------
281 | 01-02 | firmware version
282 ----------------------------------------------------------------------------
283 | 03-59 | don't care
284 ----------------------------------------------------------------------------
285 | 60 | packet sequence number
286 ----------------------------------------------------------------------------
287 | 61-63 | don't care
288 ----------------------------------------------------------------------------
290 ============================================================================
291 | 00-63 | SMART CARD READER PACKET
292 ============================================================================
293 | 00 | 0x34 smart card reader command
294 ----------------------------------------------------------------------------
295 | xx |
296 ----------------------------------------------------------------------------
297 | xx-59 | don't care
298 ----------------------------------------------------------------------------
299 | 60 | packet sequence number
300 ----------------------------------------------------------------------------
301 | 61-63 | don't care
302 ----------------------------------------------------------------------------