]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - drivers/media/usb/dvb-usb/az6027.c
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-jammy-kernel.git] / drivers / media / usb / dvb-usb / az6027.c
CommitLineData
a10e763b 1// SPDX-License-Identifier: GPL-2.0-only
76f9a820
AX
2/* DVB USB compliant Linux driver for the AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)
3 * receiver.
4 *
5 * Copyright (C) 2009 Adams.Xu <adams.xu@azwave.com.cn>
6 *
670d7adb 7 * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
76f9a820
AX
8 */
9#include "az6027.h"
5f0e1cff 10
76f9a820
AX
11#include "stb0899_drv.h"
12#include "stb0899_reg.h"
13#include "stb0899_cfg.h"
5f0e1cff 14
76f9a820
AX
15#include "stb6100.h"
16#include "stb6100_cfg.h"
fada1935 17#include <media/dvb_ca_en50221.h>
76f9a820 18
76f9a820 19int dvb_usb_az6027_debug;
5f0e1cff 20module_param_named(debug, dvb_usb_az6027_debug, int, 0644);
76f9a820
AX
21MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
22
23DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
24
25struct az6027_device_state {
26 struct dvb_ca_en50221 ca;
27 struct mutex ca_mutex;
28 u8 power_state;
29};
30
31static const struct stb0899_s1_reg az6027_stb0899_s1_init_1[] = {
32
5f0e1cff 33 /* 0x0000000b, SYSREG */
76f9a820
AX
34 { STB0899_DEV_ID , 0x30 },
35 { STB0899_DISCNTRL1 , 0x32 },
6e6a8b5a
MCC
36 { STB0899_DISCNTRL2 , 0x80 },
37 { STB0899_DISRX_ST0 , 0x04 },
38 { STB0899_DISRX_ST1 , 0x00 },
39 { STB0899_DISPARITY , 0x00 },
76f9a820 40 { STB0899_DISSTATUS , 0x20 },
6e6a8b5a
MCC
41 { STB0899_DISF22 , 0x99 },
42 { STB0899_DISF22RX , 0xa8 },
5f0e1cff 43 /* SYSREG ? */
6e6a8b5a
MCC
44 { STB0899_ACRPRESC , 0x11 },
45 { STB0899_ACRDIV1 , 0x0a },
46 { STB0899_ACRDIV2 , 0x05 },
47 { STB0899_DACR1 , 0x00 },
48 { STB0899_DACR2 , 0x00 },
49 { STB0899_OUTCFG , 0x00 },
50 { STB0899_MODECFG , 0x00 },
76f9a820
AX
51 { STB0899_IRQSTATUS_3 , 0xfe },
52 { STB0899_IRQSTATUS_2 , 0x03 },
53 { STB0899_IRQSTATUS_1 , 0x7c },
54 { STB0899_IRQSTATUS_0 , 0xf4 },
6e6a8b5a
MCC
55 { STB0899_IRQMSK_3 , 0xf3 },
56 { STB0899_IRQMSK_2 , 0xfc },
57 { STB0899_IRQMSK_1 , 0xff },
76f9a820
AX
58 { STB0899_IRQMSK_0 , 0xff },
59 { STB0899_IRQCFG , 0x00 },
6e6a8b5a
MCC
60 { STB0899_I2CCFG , 0x88 },
61 { STB0899_I2CRPT , 0x58 },
76f9a820
AX
62 { STB0899_IOPVALUE5 , 0x00 },
63 { STB0899_IOPVALUE4 , 0x33 },
64 { STB0899_IOPVALUE3 , 0x6d },
65 { STB0899_IOPVALUE2 , 0x90 },
66 { STB0899_IOPVALUE1 , 0x60 },
67 { STB0899_IOPVALUE0 , 0x00 },
6e6a8b5a
MCC
68 { STB0899_GPIO00CFG , 0x82 },
69 { STB0899_GPIO01CFG , 0x82 },
70 { STB0899_GPIO02CFG , 0x82 },
71 { STB0899_GPIO03CFG , 0x82 },
72 { STB0899_GPIO04CFG , 0x82 },
73 { STB0899_GPIO05CFG , 0x82 },
74 { STB0899_GPIO06CFG , 0x82 },
75 { STB0899_GPIO07CFG , 0x82 },
76 { STB0899_GPIO08CFG , 0x82 },
77 { STB0899_GPIO09CFG , 0x82 },
78 { STB0899_GPIO10CFG , 0x82 },
79 { STB0899_GPIO11CFG , 0x82 },
80 { STB0899_GPIO12CFG , 0x82 },
81 { STB0899_GPIO13CFG , 0x82 },
82 { STB0899_GPIO14CFG , 0x82 },
83 { STB0899_GPIO15CFG , 0x82 },
84 { STB0899_GPIO16CFG , 0x82 },
85 { STB0899_GPIO17CFG , 0x82 },
86 { STB0899_GPIO18CFG , 0x82 },
87 { STB0899_GPIO19CFG , 0x82 },
88 { STB0899_GPIO20CFG , 0x82 },
89 { STB0899_SDATCFG , 0xb8 },
90 { STB0899_SCLTCFG , 0xba },
91 { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */
92 { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */
93 { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */
94 { STB0899_DIRCLKCFG , 0x82 },
95 { STB0899_CLKOUT27CFG , 0x7e },
96 { STB0899_STDBYCFG , 0x82 },
97 { STB0899_CS0CFG , 0x82 },
98 { STB0899_CS1CFG , 0x82 },
99 { STB0899_DISEQCOCFG , 0x20 },
76f9a820
AX
100 { STB0899_GPIO32CFG , 0x82 },
101 { STB0899_GPIO33CFG , 0x82 },
102 { STB0899_GPIO34CFG , 0x82 },
103 { STB0899_GPIO35CFG , 0x82 },
104 { STB0899_GPIO36CFG , 0x82 },
105 { STB0899_GPIO37CFG , 0x82 },
106 { STB0899_GPIO38CFG , 0x82 },
107 { STB0899_GPIO39CFG , 0x82 },
6e6a8b5a
MCC
108 { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */
109 { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */
110 { STB0899_FILTCTRL , 0x00 },
111 { STB0899_SYSCTRL , 0x01 },
112 { STB0899_STOPCLK1 , 0x20 },
113 { STB0899_STOPCLK2 , 0x00 },
76f9a820 114 { STB0899_INTBUFSTATUS , 0x00 },
6e6a8b5a 115 { STB0899_INTBUFCTRL , 0x0a },
76f9a820
AX
116 { 0xffff , 0xff },
117};
118
119static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = {
6e6a8b5a
MCC
120 { STB0899_DEMOD , 0x00 },
121 { STB0899_RCOMPC , 0xc9 },
122 { STB0899_AGC1CN , 0x01 },
123 { STB0899_AGC1REF , 0x10 },
000f64ef 124 { STB0899_RTC , 0x23 },
6e6a8b5a
MCC
125 { STB0899_TMGCFG , 0x4e },
126 { STB0899_AGC2REF , 0x34 },
127 { STB0899_TLSR , 0x84 },
128 { STB0899_CFD , 0xf7 },
000f64ef 129 { STB0899_ACLC , 0x87 },
6e6a8b5a
MCC
130 { STB0899_BCLC , 0x94 },
131 { STB0899_EQON , 0x41 },
132 { STB0899_LDT , 0xf1 },
133 { STB0899_LDT2 , 0xe3 },
134 { STB0899_EQUALREF , 0xb4 },
135 { STB0899_TMGRAMP , 0x10 },
136 { STB0899_TMGTHD , 0x30 },
76f9a820
AX
137 { STB0899_IDCCOMP , 0xfd },
138 { STB0899_QDCCOMP , 0xff },
139 { STB0899_POWERI , 0x0c },
140 { STB0899_POWERQ , 0x0f },
141 { STB0899_RCOMP , 0x6c },
142 { STB0899_AGCIQIN , 0x80 },
143 { STB0899_AGC2I1 , 0x06 },
144 { STB0899_AGC2I2 , 0x00 },
145 { STB0899_TLIR , 0x30 },
146 { STB0899_RTF , 0x7f },
147 { STB0899_DSTATUS , 0x00 },
148 { STB0899_LDI , 0xbc },
149 { STB0899_CFRM , 0xea },
150 { STB0899_CFRL , 0x31 },
151 { STB0899_NIRM , 0x2b },
152 { STB0899_NIRL , 0x80 },
153 { STB0899_ISYMB , 0x1d },
154 { STB0899_QSYMB , 0xa6 },
6e6a8b5a
MCC
155 { STB0899_SFRH , 0x2f },
156 { STB0899_SFRM , 0x68 },
157 { STB0899_SFRL , 0x40 },
158 { STB0899_SFRUPH , 0x2f },
159 { STB0899_SFRUPM , 0x68 },
160 { STB0899_SFRUPL , 0x40 },
76f9a820
AX
161 { STB0899_EQUAI1 , 0x02 },
162 { STB0899_EQUAQ1 , 0xff },
163 { STB0899_EQUAI2 , 0x04 },
164 { STB0899_EQUAQ2 , 0x05 },
165 { STB0899_EQUAI3 , 0x02 },
166 { STB0899_EQUAQ3 , 0xfd },
167 { STB0899_EQUAI4 , 0x03 },
168 { STB0899_EQUAQ4 , 0x07 },
169 { STB0899_EQUAI5 , 0x08 },
170 { STB0899_EQUAQ5 , 0xf5 },
171 { STB0899_DSTATUS2 , 0x00 },
6e6a8b5a 172 { STB0899_VSTATUS , 0x00 },
76f9a820
AX
173 { STB0899_VERROR , 0x86 },
174 { STB0899_IQSWAP , 0x2a },
175 { STB0899_ECNT1M , 0x00 },
176 { STB0899_ECNT1L , 0x00 },
177 { STB0899_ECNT2M , 0x00 },
178 { STB0899_ECNT2L , 0x00 },
179 { STB0899_ECNT3M , 0x0a },
180 { STB0899_ECNT3L , 0xad },
6e6a8b5a 181 { STB0899_FECAUTO1 , 0x06 },
000f64ef 182 { STB0899_FECM , 0x01 },
6e6a8b5a
MCC
183 { STB0899_VTH12 , 0xb0 },
184 { STB0899_VTH23 , 0x7a },
000f64ef 185 { STB0899_VTH34 , 0x58 },
6e6a8b5a
MCC
186 { STB0899_VTH56 , 0x38 },
187 { STB0899_VTH67 , 0x34 },
188 { STB0899_VTH78 , 0x24 },
189 { STB0899_PRVIT , 0xff },
190 { STB0899_VITSYNC , 0x19 },
191 { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
192 { STB0899_TSULC , 0x42 },
193 { STB0899_RSLLC , 0x41 },
000f64ef 194 { STB0899_TSLPL , 0x12 },
6e6a8b5a
MCC
195 { STB0899_TSCFGH , 0x0c },
196 { STB0899_TSCFGM , 0x00 },
197 { STB0899_TSCFGL , 0x00 },
76f9a820 198 { STB0899_TSOUT , 0x69 }, /* 0x0d for CAM */
6e6a8b5a
MCC
199 { STB0899_RSSYNCDEL , 0x00 },
200 { STB0899_TSINHDELH , 0x02 },
76f9a820
AX
201 { STB0899_TSINHDELM , 0x00 },
202 { STB0899_TSINHDELL , 0x00 },
203 { STB0899_TSLLSTKM , 0x1b },
204 { STB0899_TSLLSTKL , 0xb3 },
205 { STB0899_TSULSTKM , 0x00 },
206 { STB0899_TSULSTKL , 0x00 },
207 { STB0899_PCKLENUL , 0xbc },
208 { STB0899_PCKLENLL , 0xcc },
209 { STB0899_RSPCKLEN , 0xbd },
210 { STB0899_TSSTATUS , 0x90 },
6e6a8b5a
MCC
211 { STB0899_ERRCTRL1 , 0xb6 },
212 { STB0899_ERRCTRL2 , 0x95 },
213 { STB0899_ERRCTRL3 , 0x8d },
76f9a820
AX
214 { STB0899_DMONMSK1 , 0x27 },
215 { STB0899_DMONMSK0 , 0x03 },
6e6a8b5a 216 { STB0899_DEMAPVIT , 0x5c },
76f9a820 217 { STB0899_PLPARM , 0x19 },
6e6a8b5a
MCC
218 { STB0899_PDELCTRL , 0x48 },
219 { STB0899_PDELCTRL2 , 0x00 },
220 { STB0899_BBHCTRL1 , 0x00 },
221 { STB0899_BBHCTRL2 , 0x00 },
222 { STB0899_HYSTTHRESH , 0x77 },
76f9a820
AX
223 { STB0899_MATCSTM , 0x00 },
224 { STB0899_MATCSTL , 0x00 },
225 { STB0899_UPLCSTM , 0x00 },
226 { STB0899_UPLCSTL , 0x00 },
227 { STB0899_DFLCSTM , 0x00 },
228 { STB0899_DFLCSTL , 0x00 },
229 { STB0899_SYNCCST , 0x00 },
230 { STB0899_SYNCDCSTM , 0x00 },
231 { STB0899_SYNCDCSTL , 0x00 },
232 { STB0899_ISI_ENTRY , 0x00 },
233 { STB0899_ISI_BIT_EN , 0x00 },
234 { STB0899_MATSTRM , 0xf0 },
235 { STB0899_MATSTRL , 0x02 },
236 { STB0899_UPLSTRM , 0x45 },
237 { STB0899_UPLSTRL , 0x60 },
238 { STB0899_DFLSTRM , 0xe3 },
239 { STB0899_DFLSTRL , 0x00 },
240 { STB0899_SYNCSTR , 0x47 },
241 { STB0899_SYNCDSTRM , 0x05 },
242 { STB0899_SYNCDSTRL , 0x18 },
243 { STB0899_CFGPDELSTATUS1 , 0x19 },
244 { STB0899_CFGPDELSTATUS2 , 0x2b },
245 { STB0899_BBFERRORM , 0x00 },
246 { STB0899_BBFERRORL , 0x01 },
247 { STB0899_UPKTERRORM , 0x00 },
248 { STB0899_UPKTERRORL , 0x00 },
249 { 0xffff , 0xff },
250};
251
252
253
d364016d 254static struct stb0899_config az6027_stb0899_config = {
76f9a820
AX
255 .init_dev = az6027_stb0899_s1_init_1,
256 .init_s2_demod = stb0899_s2_init_2,
257 .init_s1_demod = az6027_stb0899_s1_init_3,
258 .init_s2_fec = stb0899_s2_init_4,
259 .init_tst = stb0899_s1_init_5,
260
6e6a8b5a 261 .demod_address = 0xd0, /* 0x68, 0xd0 >> 1 */
76f9a820
AX
262
263 .xtal_freq = 27000000,
0735647c 264 .inversion = IQ_SWAP_ON,
76f9a820
AX
265
266 .lo_clk = 76500000,
267 .hi_clk = 99000000,
268
269 .esno_ave = STB0899_DVBS2_ESNO_AVE,
270 .esno_quant = STB0899_DVBS2_ESNO_QUANT,
271 .avframes_coarse = STB0899_DVBS2_AVFRAMES_COARSE,
272 .avframes_fine = STB0899_DVBS2_AVFRAMES_FINE,
273 .miss_threshold = STB0899_DVBS2_MISS_THRESHOLD,
274 .uwp_threshold_acq = STB0899_DVBS2_UWP_THRESHOLD_ACQ,
275 .uwp_threshold_track = STB0899_DVBS2_UWP_THRESHOLD_TRACK,
276 .uwp_threshold_sof = STB0899_DVBS2_UWP_THRESHOLD_SOF,
277 .sof_search_timeout = STB0899_DVBS2_SOF_SEARCH_TIMEOUT,
278
279 .btr_nco_bits = STB0899_DVBS2_BTR_NCO_BITS,
280 .btr_gain_shift_offset = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET,
281 .crl_nco_bits = STB0899_DVBS2_CRL_NCO_BITS,
282 .ldpc_max_iter = STB0899_DVBS2_LDPC_MAX_ITER,
283
284 .tuner_get_frequency = stb6100_get_frequency,
285 .tuner_set_frequency = stb6100_set_frequency,
286 .tuner_set_bandwidth = stb6100_set_bandwidth,
287 .tuner_get_bandwidth = stb6100_get_bandwidth,
288 .tuner_set_rfsiggain = NULL,
289};
290
d364016d 291static struct stb6100_config az6027_stb6100_config = {
76f9a820
AX
292 .tuner_address = 0xc0,
293 .refclock = 27000000,
294};
295
296
297/* check for mutex FIXME */
64592d0c
MCC
298static int az6027_usb_in_op(struct dvb_usb_device *d, u8 req,
299 u16 value, u16 index, u8 *b, int blen)
76f9a820
AX
300{
301 int ret = -1;
5f0e1cff 302 if (mutex_lock_interruptible(&d->usb_mutex))
76f9a820 303 return -EAGAIN;
5f0e1cff 304
76f9a820 305 ret = usb_control_msg(d->udev,
5f0e1cff
MA
306 usb_rcvctrlpipe(d->udev, 0),
307 req,
308 USB_TYPE_VENDOR | USB_DIR_IN,
309 value,
310 index,
311 b,
312 blen,
313 2000);
76f9a820
AX
314
315 if (ret < 0) {
316 warn("usb in operation failed. (%d)", ret);
317 ret = -EIO;
318 } else
319 ret = 0;
320
5f0e1cff
MA
321 deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index);
322 debug_dump(b, blen, deb_xfer);
76f9a820 323
76f9a820
AX
324 mutex_unlock(&d->usb_mutex);
325 return ret;
326}
327
5f0e1cff
MA
328static int az6027_usb_out_op(struct dvb_usb_device *d,
329 u8 req,
330 u16 value,
331 u16 index,
332 u8 *b,
333 int blen)
76f9a820
AX
334{
335 int ret;
5f0e1cff
MA
336
337 deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index);
338 debug_dump(b, blen, deb_xfer);
339
340 if (mutex_lock_interruptible(&d->usb_mutex))
76f9a820 341 return -EAGAIN;
76f9a820 342
5f0e1cff
MA
343 ret = usb_control_msg(d->udev,
344 usb_sndctrlpipe(d->udev, 0),
345 req,
346 USB_TYPE_VENDOR | USB_DIR_OUT,
347 value,
348 index,
349 b,
350 blen,
351 2000);
352
353 if (ret != blen) {
354 warn("usb out operation failed. (%d)", ret);
76f9a820
AX
355 mutex_unlock(&d->usb_mutex);
356 return -EIO;
357 } else{
358 mutex_unlock(&d->usb_mutex);
359 return 0;
360 }
361}
362
363static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
364{
365 int ret;
366 u8 req;
367 u16 value;
368 u16 index;
369 int blen;
5f0e1cff
MA
370
371 deb_info("%s %d", __func__, onoff);
372
76f9a820
AX
373 req = 0xBC;
374 value = onoff;
375 index = 0;
5f0e1cff
MA
376 blen = 0;
377
378 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
379 if (ret != 0)
380 warn("usb out operation failed. (%d)", ret);
381
76f9a820
AX
382 return ret;
383}
384
385/* keys for the enclosed remote control */
2f4f58d6 386static struct rc_map_table rc_map_az6027_table[] = {
4105ed5d
MA
387 { 0x01, KEY_1 },
388 { 0x02, KEY_2 },
76f9a820
AX
389};
390
391/* remote control stuff (does not work with my box) */
392static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
393{
394 return 0;
395}
396
397/*
398int az6027_power_ctrl(struct dvb_usb_device *d, int onoff)
399{
400 u8 v = onoff;
401 return az6027_usb_out_op(d,0xBC,v,3,NULL,1);
402}
403*/
404
405static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
5f0e1cff
MA
406 int slot,
407 int address)
76f9a820
AX
408{
409 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
410 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
411
412 int ret;
413 u8 req;
414 u16 value;
415 u16 index;
416 int blen;
32ec4576 417 u8 *b;
5f0e1cff
MA
418
419 if (slot != 0)
76f9a820 420 return -EINVAL;
5f0e1cff 421
32ec4576
DC
422 b = kmalloc(12, GFP_KERNEL);
423 if (!b)
424 return -ENOMEM;
425
5f0e1cff 426 mutex_lock(&state->ca_mutex);
76f9a820
AX
427
428 req = 0xC1;
429 value = address;
430 index = 0;
431 blen = 1;
5f0e1cff
MA
432
433 ret = az6027_usb_in_op(d, req, value, index, b, blen);
76f9a820
AX
434 if (ret < 0) {
435 warn("usb in operation failed. (%d)", ret);
436 ret = -EINVAL;
5f0e1cff 437 } else {
76f9a820 438 ret = b[0];
76f9a820 439 }
5f0e1cff
MA
440
441 mutex_unlock(&state->ca_mutex);
32ec4576 442 kfree(b);
76f9a820
AX
443 return ret;
444}
445
446static int az6027_ci_write_attribute_mem(struct dvb_ca_en50221 *ca,
5f0e1cff
MA
447 int slot,
448 int address,
449 u8 value)
76f9a820
AX
450{
451 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
452 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
5f0e1cff 453
76f9a820
AX
454 int ret;
455 u8 req;
456 u16 value1;
457 u16 index;
458 int blen;
459
5f0e1cff
MA
460 deb_info("%s %d", __func__, slot);
461 if (slot != 0)
76f9a820 462 return -EINVAL;
5f0e1cff
MA
463
464 mutex_lock(&state->ca_mutex);
76f9a820
AX
465 req = 0xC2;
466 value1 = address;
467 index = value;
5f0e1cff 468 blen = 0;
76f9a820 469
5f0e1cff
MA
470 ret = az6027_usb_out_op(d, req, value1, index, NULL, blen);
471 if (ret != 0)
472 warn("usb out operation failed. (%d)", ret);
473
474 mutex_unlock(&state->ca_mutex);
76f9a820
AX
475 return ret;
476}
477
478static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca,
5f0e1cff
MA
479 int slot,
480 u8 address)
76f9a820
AX
481{
482 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
483 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
484
485 int ret;
486 u8 req;
487 u16 value;
488 u16 index;
489 int blen;
32ec4576 490 u8 *b;
5f0e1cff
MA
491
492 if (slot != 0)
76f9a820 493 return -EINVAL;
5f0e1cff 494
32ec4576
DC
495 b = kmalloc(12, GFP_KERNEL);
496 if (!b)
497 return -ENOMEM;
498
5f0e1cff 499 mutex_lock(&state->ca_mutex);
76f9a820
AX
500
501 req = 0xC3;
502 value = address;
503 index = 0;
504 blen = 2;
5f0e1cff
MA
505
506 ret = az6027_usb_in_op(d, req, value, index, b, blen);
76f9a820
AX
507 if (ret < 0) {
508 warn("usb in operation failed. (%d)", ret);
509 ret = -EINVAL;
5f0e1cff
MA
510 } else {
511 if (b[0] == 0)
76f9a820 512 warn("Read CI IO error");
5f0e1cff 513
76f9a820 514 ret = b[1];
5f0e1cff 515 deb_info("read cam data = %x from 0x%x", b[1], value);
76f9a820 516 }
5f0e1cff
MA
517
518 mutex_unlock(&state->ca_mutex);
32ec4576 519 kfree(b);
76f9a820
AX
520 return ret;
521}
522
523static int az6027_ci_write_cam_control(struct dvb_ca_en50221 *ca,
5f0e1cff
MA
524 int slot,
525 u8 address,
526 u8 value)
76f9a820
AX
527{
528 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
529 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
5f0e1cff 530
76f9a820
AX
531 int ret;
532 u8 req;
533 u16 value1;
534 u16 index;
535 int blen;
536
5f0e1cff 537 if (slot != 0)
76f9a820 538 return -EINVAL;
5f0e1cff
MA
539
540 mutex_lock(&state->ca_mutex);
76f9a820
AX
541 req = 0xC4;
542 value1 = address;
543 index = value;
5f0e1cff
MA
544 blen = 0;
545
546 ret = az6027_usb_out_op(d, req, value1, index, NULL, blen);
547 if (ret != 0) {
548 warn("usb out operation failed. (%d)", ret);
76f9a820
AX
549 goto failed;
550 }
5f0e1cff
MA
551
552failed:
553 mutex_unlock(&state->ca_mutex);
76f9a820
AX
554 return ret;
555}
556
5f0e1cff 557static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot)
76f9a820
AX
558{
559 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
5f0e1cff 560
76f9a820
AX
561 int ret;
562 u8 req;
563 u16 value;
564 u16 index;
565 int blen;
32ec4576
DC
566 u8 *b;
567
568 b = kmalloc(12, GFP_KERNEL);
569 if (!b)
570 return -ENOMEM;
76f9a820
AX
571
572 req = 0xC8;
573 value = 0;
574 index = 0;
575 blen = 1;
5f0e1cff
MA
576
577 ret = az6027_usb_in_op(d, req, value, index, b, blen);
76f9a820
AX
578 if (ret < 0) {
579 warn("usb in operation failed. (%d)", ret);
580 ret = -EIO;
581 } else{
582 ret = b[0];
583 }
32ec4576 584 kfree(b);
76f9a820
AX
585 return ret;
586}
587
5f0e1cff 588static int az6027_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot)
76f9a820
AX
589{
590 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
591 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
5f0e1cff
MA
592
593 int ret, i;
76f9a820
AX
594 u8 req;
595 u16 value;
596 u16 index;
597 int blen;
598
5f0e1cff
MA
599 mutex_lock(&state->ca_mutex);
600
76f9a820
AX
601 req = 0xC6;
602 value = 1;
603 index = 0;
5f0e1cff
MA
604 blen = 0;
605
606 ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
607 if (ret != 0) {
608 warn("usb out operation failed. (%d)", ret);
76f9a820
AX
609 goto failed;
610 }
5f0e1cff
MA
611
612 msleep(500);
76f9a820
AX
613 req = 0xC6;
614 value = 0;
615 index = 0;
5f0e1cff
MA
616 blen = 0;
617
618 ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
619 if (ret != 0) {
620 warn("usb out operation failed. (%d)", ret);
76f9a820
AX
621 goto failed;
622 }
623
5f0e1cff 624 for (i = 0; i < 15; i++) {
76f9a820 625 msleep(100);
5f0e1cff
MA
626
627 if (CI_CamReady(ca, slot)) {
76f9a820
AX
628 deb_info("CAM Ready");
629 break;
630 }
631 }
632 msleep(5000);
633
5f0e1cff
MA
634failed:
635 mutex_unlock(&state->ca_mutex);
76f9a820
AX
636 return ret;
637}
638
5f0e1cff 639static int az6027_ci_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
76f9a820 640{
76f9a820
AX
641 return 0;
642}
643
5f0e1cff 644static int az6027_ci_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
76f9a820
AX
645{
646 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
647 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
5f0e1cff 648
76f9a820
AX
649 int ret;
650 u8 req;
651 u16 value;
652 u16 index;
653 int blen;
5f0e1cff 654
76f9a820 655 deb_info("%s", __func__);
5f0e1cff 656 mutex_lock(&state->ca_mutex);
76f9a820
AX
657 req = 0xC7;
658 value = 1;
659 index = 0;
5f0e1cff
MA
660 blen = 0;
661
662 ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
663 if (ret != 0) {
664 warn("usb out operation failed. (%d)", ret);
76f9a820
AX
665 goto failed;
666 }
76f9a820 667
5f0e1cff
MA
668failed:
669 mutex_unlock(&state->ca_mutex);
76f9a820
AX
670 return ret;
671}
672
5f0e1cff 673static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
76f9a820
AX
674{
675 struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
676 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
677 int ret;
678 u8 req;
679 u16 value;
680 u16 index;
681 int blen;
32ec4576 682 u8 *b;
5f0e1cff 683
32ec4576
DC
684 b = kmalloc(12, GFP_KERNEL);
685 if (!b)
686 return -ENOMEM;
5f0e1cff 687 mutex_lock(&state->ca_mutex);
76f9a820
AX
688
689 req = 0xC5;
690 value = 0;
691 index = 0;
692 blen = 1;
5f0e1cff
MA
693
694 ret = az6027_usb_in_op(d, req, value, index, b, blen);
76f9a820
AX
695 if (ret < 0) {
696 warn("usb in operation failed. (%d)", ret);
697 ret = -EIO;
698 } else
699 ret = 0;
5f0e1cff 700
a18e6591 701 if (!ret && b[0] == 1) {
5f0e1cff
MA
702 ret = DVB_CA_EN50221_POLL_CAM_PRESENT |
703 DVB_CA_EN50221_POLL_CAM_READY;
76f9a820
AX
704 }
705
5f0e1cff 706 mutex_unlock(&state->ca_mutex);
32ec4576 707 kfree(b);
76f9a820
AX
708 return ret;
709}
710
711
712static void az6027_ci_uninit(struct dvb_usb_device *d)
713{
714 struct az6027_device_state *state;
715
716 deb_info("%s", __func__);
717
718 if (NULL == d)
719 return;
720
721 state = (struct az6027_device_state *)d->priv;
722 if (NULL == state)
723 return;
724
725 if (NULL == state->ca.data)
726 return;
727
728 dvb_ca_en50221_release(&state->ca);
729
730 memset(&state->ca, 0, sizeof(state->ca));
731}
732
733
734static int az6027_ci_init(struct dvb_usb_adapter *a)
735{
736 struct dvb_usb_device *d = a->dev;
737 struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
738 int ret;
739
5f0e1cff 740 deb_info("%s", __func__);
76f9a820
AX
741
742 mutex_init(&state->ca_mutex);
743
5f0e1cff
MA
744 state->ca.owner = THIS_MODULE;
745 state->ca.read_attribute_mem = az6027_ci_read_attribute_mem;
746 state->ca.write_attribute_mem = az6027_ci_write_attribute_mem;
747 state->ca.read_cam_control = az6027_ci_read_cam_control;
748 state->ca.write_cam_control = az6027_ci_write_cam_control;
749 state->ca.slot_reset = az6027_ci_slot_reset;
750 state->ca.slot_shutdown = az6027_ci_slot_shutdown;
751 state->ca.slot_ts_enable = az6027_ci_slot_ts_enable;
752 state->ca.poll_slot_status = az6027_ci_poll_slot_status;
753 state->ca.data = d;
754
755 ret = dvb_ca_en50221_init(&a->dvb_adap,
756 &state->ca,
757 0, /* flags */
758 1);/* n_slots */
759 if (ret != 0) {
760 err("Cannot initialize CI: Error %d.", ret);
761 memset(&state->ca, 0, sizeof(state->ca));
76f9a820
AX
762 return ret;
763 }
764
5f0e1cff 765 deb_info("CI initialized.");
76f9a820
AX
766
767 return 0;
768}
769
4105ed5d 770/*
5f0e1cff 771static int az6027_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
76f9a820
AX
772{
773 az6027_usb_in_op(d, 0xb7, 6, 0, &mac[0], 6);
774 return 0;
775}
4105ed5d 776*/
76f9a820 777
0df289a2
MCC
778static int az6027_set_voltage(struct dvb_frontend *fe,
779 enum fe_sec_voltage voltage)
76f9a820 780{
5f0e1cff 781
76f9a820 782 u8 buf;
5f0e1cff
MA
783 struct dvb_usb_adapter *adap = fe->dvb->priv;
784
76f9a820
AX
785 struct i2c_msg i2c_msg = {
786 .addr = 0x99,
787 .flags = 0,
788 .buf = &buf,
789 .len = 1
790 };
5f0e1cff
MA
791
792 /*
793 * 2 --18v
794 * 1 --13v
795 * 0 --off
796 */
76f9a820
AX
797 switch (voltage) {
798 case SEC_VOLTAGE_13:
5f0e1cff 799 buf = 1;
db3ca1d5 800 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
76f9a820 801 break;
5f0e1cff 802
76f9a820 803 case SEC_VOLTAGE_18:
5f0e1cff 804 buf = 2;
db3ca1d5 805 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
76f9a820 806 break;
5f0e1cff 807
76f9a820 808 case SEC_VOLTAGE_OFF:
5f0e1cff 809 buf = 0;
db3ca1d5 810 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
76f9a820 811 break;
5f0e1cff 812
76f9a820
AX
813 default:
814 return -EINVAL;
815 }
816 return 0;
817}
818
819
820static int az6027_frontend_poweron(struct dvb_usb_adapter *adap)
821{
822 int ret;
823 u8 req;
824 u16 value;
825 u16 index;
826 int blen;
827
828 req = 0xBC;
5f0e1cff 829 value = 1; /* power on */
76f9a820 830 index = 3;
5f0e1cff
MA
831 blen = 0;
832
833 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
834 if (ret != 0)
835 return -EIO;
76f9a820 836
76f9a820
AX
837 return 0;
838}
839static int az6027_frontend_reset(struct dvb_usb_adapter *adap)
840{
841 int ret;
842 u8 req;
843 u16 value;
844 u16 index;
845 int blen;
846
5f0e1cff 847 /* reset demodulator */
76f9a820 848 req = 0xC0;
5f0e1cff 849 value = 1; /* high */
76f9a820 850 index = 3;
5f0e1cff
MA
851 blen = 0;
852
853 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
854 if (ret != 0)
855 return -EIO;
76f9a820 856
76f9a820 857 req = 0xC0;
5f0e1cff 858 value = 0; /* low */
76f9a820 859 index = 3;
5f0e1cff 860 blen = 0;
76f9a820 861 msleep_interruptible(200);
5f0e1cff
MA
862
863 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
864 if (ret != 0)
865 return -EIO;
866
76f9a820 867 msleep_interruptible(200);
5f0e1cff 868
76f9a820 869 req = 0xC0;
5f0e1cff 870 value = 1; /*high */
76f9a820 871 index = 3;
5f0e1cff
MA
872 blen = 0;
873
874 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
875 if (ret != 0)
876 return -EIO;
76f9a820 877
76f9a820
AX
878 msleep_interruptible(200);
879 return 0;
880}
881
5f0e1cff 882static int az6027_frontend_tsbypass(struct dvb_usb_adapter *adap, int onoff)
76f9a820
AX
883{
884 int ret;
885 u8 req;
886 u16 value;
887 u16 index;
888 int blen;
5f0e1cff
MA
889
890 /* TS passthrough */
76f9a820
AX
891 req = 0xC7;
892 value = onoff;
893 index = 0;
5f0e1cff
MA
894 blen = 0;
895
896 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
897 if (ret != 0)
898 return -EIO;
76f9a820 899
76f9a820
AX
900 return 0;
901}
902
903static int az6027_frontend_attach(struct dvb_usb_adapter *adap)
904{
905
906 az6027_frontend_poweron(adap);
907 az6027_frontend_reset(adap);
5f0e1cff
MA
908
909 deb_info("adap = %p, dev = %p\n", adap, adap->dev);
77eed219 910 adap->fe_adap[0].fe = stb0899_attach(&az6027_stb0899_config, &adap->dev->i2c_adap);
5f0e1cff 911
77eed219 912 if (adap->fe_adap[0].fe) {
5f0e1cff 913 deb_info("found STB0899 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb0899_config.demod_address);
77eed219 914 if (stb6100_attach(adap->fe_adap[0].fe, &az6027_stb6100_config, &adap->dev->i2c_adap)) {
5f0e1cff 915 deb_info("found STB6100 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb6100_config.tuner_address);
77eed219 916 adap->fe_adap[0].fe->ops.set_voltage = az6027_set_voltage;
76f9a820
AX
917 az6027_ci_init(adap);
918 } else {
77eed219 919 adap->fe_adap[0].fe = NULL;
76f9a820 920 }
5f0e1cff 921 } else
76f9a820
AX
922 warn("no front-end attached\n");
923
5f0e1cff 924 az6027_frontend_tsbypass(adap, 0);
76f9a820
AX
925
926 return 0;
927}
928
929static struct dvb_usb_device_properties az6027_properties;
930
5f0e1cff 931static void az6027_usb_disconnect(struct usb_interface *intf)
76f9a820 932{
5f0e1cff
MA
933 struct dvb_usb_device *d = usb_get_intfdata(intf);
934 az6027_ci_uninit(d);
935 dvb_usb_device_exit(intf);
76f9a820
AX
936}
937
938
939static int az6027_usb_probe(struct usb_interface *intf,
5f0e1cff 940 const struct usb_device_id *id)
76f9a820 941{
5f0e1cff
MA
942 return dvb_usb_device_init(intf,
943 &az6027_properties,
944 THIS_MODULE,
945 NULL,
946 adapter_nr);
76f9a820
AX
947}
948
949/* I2C */
5f0e1cff 950static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
76f9a820
AX
951{
952 struct dvb_usb_device *d = i2c_get_adapdata(adap);
5f0e1cff 953 int i = 0, j = 0, len = 0;
76f9a820
AX
954 u16 index;
955 u16 value;
956 int length;
957 u8 req;
32ec4576
DC
958 u8 *data;
959
960 data = kmalloc(256, GFP_KERNEL);
961 if (!data)
962 return -ENOMEM;
5f0e1cff 963
32ec4576
DC
964 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) {
965 kfree(data);
76f9a820 966 return -EAGAIN;
32ec4576 967 }
5f0e1cff 968
76f9a820
AX
969 if (num > 2)
970 warn("more than 2 i2c messages at a time is not handled yet. TODO.");
971
972 for (i = 0; i < num; i++) {
5f0e1cff
MA
973
974 if (msg[i].addr == 0x99) {
76f9a820
AX
975 req = 0xBE;
976 index = 0;
977 value = msg[i].buf[0] & 0x00ff;
978 length = 1;
5f0e1cff 979 az6027_usb_out_op(d, req, value, index, data, length);
76f9a820 980 }
5f0e1cff
MA
981
982 if (msg[i].addr == 0xd0) {
76f9a820 983 /* write/read request */
5f0e1cff 984 if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) {
76f9a820
AX
985 req = 0xB9;
986 index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
987 value = msg[i].addr + (msg[i].len << 8);
5f0e1cff 988 length = msg[i + 1].len + 6;
db3ca1d5 989 az6027_usb_in_op(d, req, value, index, data, length);
5f0e1cff
MA
990 len = msg[i + 1].len;
991 for (j = 0; j < len; j++)
992 msg[i + 1].buf[j] = data[j + 5];
993
76f9a820 994 i++;
5f0e1cff
MA
995 } else {
996
6120792b
MN
997 /* demod 16bit addr */
998 req = 0xBD;
999 index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
1000 value = msg[i].addr + (2 << 8);
1001 length = msg[i].len - 2;
1002 len = msg[i].len - 2;
1003 for (j = 0; j < len; j++)
1004 data[j] = msg[i].buf[j + 2];
5f0e1cff 1005 az6027_usb_out_op(d, req, value, index, data, length);
76f9a820
AX
1006 }
1007 }
5f0e1cff
MA
1008
1009 if (msg[i].addr == 0xc0) {
76f9a820 1010 if (msg[i].flags & I2C_M_RD) {
5f0e1cff 1011
76f9a820
AX
1012 req = 0xB9;
1013 index = 0x0;
5f0e1cff 1014 value = msg[i].addr;
76f9a820 1015 length = msg[i].len + 6;
db3ca1d5 1016 az6027_usb_in_op(d, req, value, index, data, length);
76f9a820 1017 len = msg[i].len;
5f0e1cff
MA
1018 for (j = 0; j < len; j++)
1019 msg[i].buf[j] = data[j + 5];
1020
1021 } else {
1022
76f9a820
AX
1023 req = 0xBD;
1024 index = msg[i].buf[0] & 0x00FF;
1025 value = msg[i].addr + (1 << 8);
1026 length = msg[i].len - 1;
1027 len = msg[i].len - 1;
5f0e1cff
MA
1028
1029 for (j = 0; j < len; j++)
1030 data[j] = msg[i].buf[j + 1];
1031
1032 az6027_usb_out_op(d, req, value, index, data, length);
76f9a820
AX
1033 }
1034 }
5f0e1cff 1035 }
76f9a820 1036 mutex_unlock(&d->i2c_mutex);
32ec4576 1037 kfree(data);
5f0e1cff 1038
76f9a820
AX
1039 return i;
1040}
1041
1042
1043static u32 az6027_i2c_func(struct i2c_adapter *adapter)
1044{
1045 return I2C_FUNC_I2C;
1046}
1047
1048static struct i2c_algorithm az6027_i2c_algo = {
1049 .master_xfer = az6027_i2c_xfer,
1050 .functionality = az6027_i2c_func,
1051};
1052
64592d0c
MCC
1053static int az6027_identify_state(struct usb_device *udev,
1054 struct dvb_usb_device_properties *props,
1055 struct dvb_usb_device_description **desc,
1056 int *cold)
76f9a820 1057{
32ec4576
DC
1058 u8 *b;
1059 s16 ret;
1060
1061 b = kmalloc(16, GFP_KERNEL);
1062 if (!b)
1063 return -ENOMEM;
1064
1065 ret = usb_control_msg(udev,
5f0e1cff
MA
1066 usb_rcvctrlpipe(udev, 0),
1067 0xb7,
1068 USB_TYPE_VENDOR | USB_DIR_IN,
1069 6,
1070 0,
1071 b,
1072 6,
1073 USB_CTRL_GET_TIMEOUT);
76f9a820
AX
1074
1075 *cold = ret <= 0;
32ec4576 1076 kfree(b);
76f9a820
AX
1077 deb_info("cold: %d\n", *cold);
1078 return 0;
1079}
1080
1081
5f0e1cff 1082static struct usb_device_id az6027_usb_table[] = {
3c3233ec 1083 { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) },
20d2c56d
OR
1084 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V1) },
1085 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) },
823b63b4
OR
1086 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) },
1087 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
10304ca6 1088 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
44f83144 1089 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V2) },
7977a15e 1090 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V3) },
3c3233ec 1091 { },
76f9a820
AX
1092};
1093
1094MODULE_DEVICE_TABLE(usb, az6027_usb_table);
1095
1096static struct dvb_usb_device_properties az6027_properties = {
1097 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1098 .usb_ctrl = CYPRESS_FX2,
76f9a820
AX
1099 .firmware = "dvb-usb-az6027-03.fw",
1100 .no_reconnect = 1,
1101
1102 .size_of_priv = sizeof(struct az6027_device_state),
1103 .identify_state = az6027_identify_state,
1104 .num_adapters = 1,
1105 .adapter = {
1106 {
77eed219
MK
1107 .num_frontends = 1,
1108 .fe = {{
76f9a820
AX
1109 .streaming_ctrl = az6027_streaming_ctrl,
1110 .frontend_attach = az6027_frontend_attach,
1111
1112 /* parameter for the MPEG2-data transfer */
1113 .stream = {
1114 .type = USB_BULK,
1115 .count = 10,
1116 .endpoint = 0x02,
1117 .u = {
1118 .bulk = {
1119 .buffersize = 4096,
1120 }
1121 }
1122 },
77eed219 1123 }},
76f9a820
AX
1124 }
1125 },
5f0e1cff
MA
1126/*
1127 .power_ctrl = az6027_power_ctrl,
1128 .read_mac_address = az6027_read_mac_addr,
1129 */
f72a27b8 1130 .rc.legacy = {
2f4f58d6
MCC
1131 .rc_map_table = rc_map_az6027_table,
1132 .rc_map_size = ARRAY_SIZE(rc_map_az6027_table),
f72a27b8
MCC
1133 .rc_interval = 400,
1134 .rc_query = az6027_rc_query,
1135 },
1136
76f9a820
AX
1137 .i2c_algo = &az6027_i2c_algo,
1138
7977a15e 1139 .num_device_descs = 8,
76f9a820 1140 .devices = {
5f0e1cff
MA
1141 {
1142 .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
1143 .cold_ids = { &az6027_usb_table[0], NULL },
1144 .warm_ids = { NULL },
20d2c56d
OR
1145 }, {
1146 .name = "TERRATEC S7",
1147 .cold_ids = { &az6027_usb_table[1], NULL },
1148 .warm_ids = { NULL },
1149 }, {
1150 .name = "TERRATEC S7 MKII",
1151 .cold_ids = { &az6027_usb_table[2], NULL },
1152 .warm_ids = { NULL },
1153 }, {
1154 .name = "Technisat SkyStar USB 2 HD CI",
1155 .cold_ids = { &az6027_usb_table[3], NULL },
1156 .warm_ids = { NULL },
1157 }, {
1158 .name = "Technisat SkyStar USB 2 HD CI",
1159 .cold_ids = { &az6027_usb_table[4], NULL },
1160 .warm_ids = { NULL },
10304ca6
SD
1161 }, {
1162 .name = "Elgato EyeTV Sat",
1163 .cold_ids = { &az6027_usb_table[5], NULL },
1164 .warm_ids = { NULL },
44f83144
MS
1165 }, {
1166 .name = "Elgato EyeTV Sat",
1167 .cold_ids = { &az6027_usb_table[6], NULL },
1168 .warm_ids = { NULL },
7977a15e
OS
1169 }, {
1170 .name = "Elgato EyeTV Sat",
1171 .cold_ids = { &az6027_usb_table[7], NULL },
1172 .warm_ids = { NULL },
76f9a820 1173 },
5f0e1cff 1174 { NULL },
76f9a820
AX
1175 }
1176};
1177
1178/* usb specific object needed to register this driver with the usb subsystem */
1179static struct usb_driver az6027_usb_driver = {
1180 .name = "dvb_usb_az6027",
6e6a8b5a
MCC
1181 .probe = az6027_usb_probe,
1182 .disconnect = az6027_usb_disconnect,
1183 .id_table = az6027_usb_table,
76f9a820
AX
1184};
1185
ecb3b2b3 1186module_usb_driver(az6027_usb_driver);
76f9a820
AX
1187
1188MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>");
1189MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)");
1190MODULE_VERSION("1.0");
1191MODULE_LICENSE("GPL");