1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
5 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
8 * - add smart card reader support for Conditional Access (CA)
10 * Card reader in Anysee is nothing more than ISO 7816 card reader.
11 * There is no hardware CAM in any Anysee device sold.
12 * In my understanding it should be implemented by making own module
13 * for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This
14 * module registers serial interface that can be used to communicate
15 * with any ISO 7816 smart card.
17 * Any help according to implement serial smart card reader support
21 #ifndef _DVB_USB_ANYSEE_H_
22 #define _DVB_USB_ANYSEE_H_
24 #define DVB_USB_LOG_PREFIX "anysee"
26 #include <media/dvb_ca_en50221.h>
33 CMD_STREAMING_CTRL
= 0x12,
34 CMD_LED_AND_IR_CTRL
= 0x16,
35 CMD_GET_IR_CODE
= 0x41,
36 CMD_GET_HW_INFO
= 0x19,
45 #define ANYSEE_I2C_CLIENT_MAX 1
46 struct i2c_client
*i2c_client
[ANYSEE_I2C_CLIENT_MAX
];
47 u8 fe_id
:1; /* frondend ID */
51 struct dvb_ca_en50221 ci
;
52 unsigned long ci_cam_ready
; /* jiffies */
55 #define ANYSEE_HW_507T 2 /* E30 */
56 #define ANYSEE_HW_507CD 6 /* E30 Plus */
57 #define ANYSEE_HW_507DC 10 /* E30 C Plus */
58 #define ANYSEE_HW_507SI 11 /* E30 S2 Plus */
59 #define ANYSEE_HW_507FA 15 /* E30 Combo Plus / E30 C Plus */
60 #define ANYSEE_HW_508TC 18 /* E7 TC */
61 #define ANYSEE_HW_508S2 19 /* E7 S2 */
62 #define ANYSEE_HW_508T2C 20 /* E7 T2C */
63 #define ANYSEE_HW_508PTC 21 /* E7 PTC Plus */
64 #define ANYSEE_HW_508PS2 22 /* E7 PS2 Plus */
66 #define REG_IOA 0x80 /* Port A (bit addressable) */
67 #define REG_IOB 0x90 /* Port B (bit addressable) */
68 #define REG_IOC 0xa0 /* Port C (bit addressable) */
69 #define REG_IOD 0xb0 /* Port D (bit addressable) */
70 #define REG_IOE 0xb1 /* Port E (NOT bit addressable) */
71 #define REG_OEA 0xb2 /* Port A Output Enable */
72 #define REG_OEB 0xb3 /* Port B Output Enable */
73 #define REG_OEC 0xb4 /* Port C Output Enable */
74 #define REG_OED 0xb5 /* Port D Output Enable */
75 #define REG_OEE 0xb6 /* Port E Output Enable */
79 /***************************************************************************
80 * USB API description (reverse engineered)
81 ***************************************************************************
85 BULK[00001] >>> REQUEST PACKET 64 bytes
86 BULK[00081] <<< REPLY PACKET #1 64 bytes (PREVIOUS TRANSACTION REPLY)
87 BULK[00081] <<< REPLY PACKET #2 64 bytes (CURRENT TRANSACTION REPLY)
89 General reply packet(s) are always used if not own reply defined.
91 ============================================================================
92 | 00-63 | GENERAL REPLY PACKET #1 (PREVIOUS REPLY)
93 ============================================================================
94 | 00 | reply data (if any) from previous transaction
95 | | Just same reply packet as returned during previous transaction.
96 | | Needed only if reply is missed in previous transaction.
97 | | Just skip normally.
98 ----------------------------------------------------------------------------
100 ----------------------------------------------------------------------------
101 | 60 | packet sequence number
102 ----------------------------------------------------------------------------
104 ----------------------------------------------------------------------------
106 ============================================================================
107 | 00-63 | GENERAL REPLY PACKET #2 (CURRENT REPLY)
108 ============================================================================
109 | 00 | reply data (if any)
110 ----------------------------------------------------------------------------
112 ----------------------------------------------------------------------------
113 | 60 | packet sequence number
114 ----------------------------------------------------------------------------
116 ----------------------------------------------------------------------------
118 ============================================================================
119 | 00-63 | I2C WRITE REQUEST PACKET
120 ============================================================================
121 | 00 | 0x31 I2C write command
122 ----------------------------------------------------------------------------
124 ----------------------------------------------------------------------------
126 | | 0x02 (for typical I2C reg / val pair)
127 ----------------------------------------------------------------------------
129 ----------------------------------------------------------------------------
131 ----------------------------------------------------------------------------
133 ----------------------------------------------------------------------------
134 | 60 | packet sequence number
135 ----------------------------------------------------------------------------
137 ----------------------------------------------------------------------------
139 ============================================================================
140 | 00-63 | I2C READ REQUEST PACKET
141 ============================================================================
142 | 00 | 0x33 I2C read command
143 ----------------------------------------------------------------------------
144 | 01 | i2c address + 1
145 ----------------------------------------------------------------------------
147 ----------------------------------------------------------------------------
149 ----------------------------------------------------------------------------
151 ----------------------------------------------------------------------------
153 ----------------------------------------------------------------------------
155 ----------------------------------------------------------------------------
156 | 60 | packet sequence number
157 ----------------------------------------------------------------------------
159 ----------------------------------------------------------------------------
161 ============================================================================
162 | 00-63 | USB CONTROLLER REGISTER WRITE REQUEST PACKET
163 ============================================================================
164 | 00 | 0xb1 register write command
165 ----------------------------------------------------------------------------
167 ----------------------------------------------------------------------------
169 ----------------------------------------------------------------------------
171 ----------------------------------------------------------------------------
173 ----------------------------------------------------------------------------
174 | 60 | packet sequence number
175 ----------------------------------------------------------------------------
177 ----------------------------------------------------------------------------
179 ============================================================================
180 | 00-63 | USB CONTROLLER REGISTER READ REQUEST PACKET
181 ============================================================================
182 | 00 | 0xb0 register read command
183 ----------------------------------------------------------------------------
185 ----------------------------------------------------------------------------
187 ----------------------------------------------------------------------------
189 ----------------------------------------------------------------------------
190 | 60 | packet sequence number
191 ----------------------------------------------------------------------------
193 ----------------------------------------------------------------------------
195 ============================================================================
196 | 00-63 | LED CONTROL REQUEST PACKET
197 ============================================================================
198 | 00 | 0x16 LED and IR control command
199 ----------------------------------------------------------------------------
201 ----------------------------------------------------------------------------
203 | | 0x01 lights continuously
204 ----------------------------------------------------------------------------
205 | 04 | blink interval
206 | | 0x00 fastest (looks like LED lights continuously)
208 ----------------------------------------------------------------------------
210 ----------------------------------------------------------------------------
211 | 60 | packet sequence number
212 ----------------------------------------------------------------------------
214 ----------------------------------------------------------------------------
216 ============================================================================
217 | 00-63 | IR CONTROL REQUEST PACKET
218 ============================================================================
219 | 00 | 0x16 LED and IR control command
220 ----------------------------------------------------------------------------
222 ----------------------------------------------------------------------------
223 | 03 | 0x00 IR disabled
225 ----------------------------------------------------------------------------
227 ----------------------------------------------------------------------------
228 | 60 | packet sequence number
229 ----------------------------------------------------------------------------
231 ----------------------------------------------------------------------------
233 ============================================================================
234 | 00-63 | STREAMING CONTROL REQUEST PACKET
235 ============================================================================
236 | 00 | 0x12 streaming control command
237 ----------------------------------------------------------------------------
238 | 01 | 0x00 streaming disabled
239 | | 0x01 streaming enabled
240 ----------------------------------------------------------------------------
242 ----------------------------------------------------------------------------
244 ----------------------------------------------------------------------------
245 | 60 | packet sequence number
246 ----------------------------------------------------------------------------
248 ----------------------------------------------------------------------------
250 ============================================================================
251 | 00-63 | REMOTE CONTROL REQUEST PACKET
252 ============================================================================
253 | 00 | 0x41 remote control command
254 ----------------------------------------------------------------------------
256 ----------------------------------------------------------------------------
257 | 60 | packet sequence number
258 ----------------------------------------------------------------------------
260 ----------------------------------------------------------------------------
262 ============================================================================
263 | 00-63 | REMOTE CONTROL REPLY PACKET
264 ============================================================================
265 | 00 | 0x00 code not received
266 | | 0x01 code received
267 ----------------------------------------------------------------------------
268 | 01 | remote control code
269 ----------------------------------------------------------------------------
271 ----------------------------------------------------------------------------
272 | 60 | packet sequence number
273 ----------------------------------------------------------------------------
275 ----------------------------------------------------------------------------
277 ============================================================================
278 | 00-63 | GET HARDWARE INFO REQUEST PACKET
279 ============================================================================
280 | 00 | 0x19 get hardware info command
281 ----------------------------------------------------------------------------
283 ----------------------------------------------------------------------------
284 | 60 | packet sequence number
285 ----------------------------------------------------------------------------
287 ----------------------------------------------------------------------------
289 ============================================================================
290 | 00-63 | GET HARDWARE INFO REPLY PACKET
291 ============================================================================
293 ----------------------------------------------------------------------------
294 | 01-02 | firmware version
295 ----------------------------------------------------------------------------
297 ----------------------------------------------------------------------------
298 | 60 | packet sequence number
299 ----------------------------------------------------------------------------
301 ----------------------------------------------------------------------------
303 ============================================================================
304 | 00-63 | SMART CARD READER PACKET
305 ============================================================================
306 | 00 | 0x34 smart card reader command
307 ----------------------------------------------------------------------------
309 ----------------------------------------------------------------------------
311 ----------------------------------------------------------------------------
312 | 60 | packet sequence number
313 ----------------------------------------------------------------------------
315 ----------------------------------------------------------------------------