Commit | Line | Data |
---|---|---|
4c66c920 MK |
1 | /* |
2 | * Copyright (C) 2010 Michael Krufky (mkrufky@kernellabs.com) | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License as published by the Free | |
6 | * Software Foundation, version 2. | |
7 | * | |
8 | * see Documentation/dvb/README.dvb-usb for more information | |
9 | */ | |
10 | ||
11 | #include <linux/vmalloc.h> | |
12 | #include <linux/i2c.h> | |
13 | ||
14 | #include "mxl111sf.h" | |
15 | #include "mxl111sf-reg.h" | |
16 | #include "mxl111sf-phy.h" | |
17 | #include "mxl111sf-i2c.h" | |
18 | #include "mxl111sf-gpio.h" | |
19 | ||
4f98480f | 20 | #include "mxl111sf-demod.h" |
4c66c920 MK |
21 | #include "mxl111sf-tuner.h" |
22 | ||
23 | #include "lgdt3305.h" | |
31136214 | 24 | #include "lg2160.h" |
4c66c920 | 25 | |
c98300a0 MCC |
26 | /* Max transfer size done by I2C transfer functions */ |
27 | #define MAX_XFER_SIZE 64 | |
28 | ||
4c66c920 MK |
29 | int dvb_usb_mxl111sf_debug; |
30 | module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644); | |
31 | MODULE_PARM_DESC(debug, "set debugging level " | |
32 | "(1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able))."); | |
33 | ||
34 | int dvb_usb_mxl111sf_isoc; | |
35 | module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644); | |
36 | MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc)."); | |
37 | ||
31136214 MK |
38 | int dvb_usb_mxl111sf_spi; |
39 | module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644); | |
40 | MODULE_PARM_DESC(spi, "use spi rather than tp for data xfer (0=tp, 1=spi)."); | |
41 | ||
4c66c920 MK |
42 | #define ANT_PATH_AUTO 0 |
43 | #define ANT_PATH_EXTERNAL 1 | |
44 | #define ANT_PATH_INTERNAL 2 | |
45 | ||
46 | int dvb_usb_mxl111sf_rfswitch = | |
47 | #if 0 | |
48 | ANT_PATH_AUTO; | |
49 | #else | |
50 | ANT_PATH_EXTERNAL; | |
51 | #endif | |
52 | ||
53 | module_param_named(rfswitch, dvb_usb_mxl111sf_rfswitch, int, 0644); | |
54 | MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int)."); | |
55 | ||
56 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |
57 | ||
4c66c920 MK |
58 | int mxl111sf_ctrl_msg(struct dvb_usb_device *d, |
59 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | |
60 | { | |
61 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | |
62 | int ret; | |
c98300a0 MCC |
63 | u8 sndbuf[MAX_XFER_SIZE]; |
64 | ||
65 | if (1 + wlen > sizeof(sndbuf)) { | |
66 | pr_warn("%s: len=%d is too big!\n", __func__, wlen); | |
67 | return -EOPNOTSUPP; | |
68 | } | |
4c66c920 | 69 | |
c778edb5 | 70 | pr_debug("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen); |
4c66c920 MK |
71 | |
72 | memset(sndbuf, 0, 1+wlen); | |
73 | ||
74 | sndbuf[0] = cmd; | |
75 | memcpy(&sndbuf[1], wbuf, wlen); | |
76 | ||
85722118 AP |
77 | ret = (wo) ? dvb_usbv2_generic_write(d, sndbuf, 1+wlen) : |
78 | dvb_usbv2_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen); | |
4c66c920 MK |
79 | mxl_fail(ret); |
80 | ||
81 | return ret; | |
82 | } | |
83 | ||
84 | /* ------------------------------------------------------------------------ */ | |
85 | ||
86 | #define MXL_CMD_REG_READ 0xaa | |
87 | #define MXL_CMD_REG_WRITE 0x55 | |
88 | ||
89 | int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data) | |
90 | { | |
91 | u8 buf[2]; | |
92 | int ret; | |
93 | ||
94 | ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2); | |
95 | if (mxl_fail(ret)) { | |
96 | mxl_debug("error reading reg: 0x%02x", addr); | |
97 | goto fail; | |
98 | } | |
99 | ||
100 | if (buf[0] == addr) | |
101 | *data = buf[1]; | |
102 | else { | |
c778edb5 | 103 | pr_err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x", |
4c66c920 MK |
104 | addr, buf[0], buf[1]); |
105 | ret = -EINVAL; | |
106 | } | |
107 | ||
c778edb5 | 108 | pr_debug("R: (0x%02x, 0x%02x)\n", addr, *data); |
4c66c920 MK |
109 | fail: |
110 | return ret; | |
111 | } | |
112 | ||
113 | int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data) | |
114 | { | |
115 | u8 buf[] = { addr, data }; | |
116 | int ret; | |
117 | ||
c778edb5 | 118 | pr_debug("W: (0x%02x, 0x%02x)\n", addr, data); |
4c66c920 MK |
119 | |
120 | ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0); | |
121 | if (mxl_fail(ret)) | |
c778edb5 | 122 | pr_err("error writing reg: 0x%02x, val: 0x%02x", addr, data); |
4c66c920 MK |
123 | return ret; |
124 | } | |
125 | ||
126 | /* ------------------------------------------------------------------------ */ | |
127 | ||
128 | int mxl111sf_write_reg_mask(struct mxl111sf_state *state, | |
129 | u8 addr, u8 mask, u8 data) | |
130 | { | |
131 | int ret; | |
132 | u8 val; | |
133 | ||
134 | if (mask != 0xff) { | |
135 | ret = mxl111sf_read_reg(state, addr, &val); | |
136 | #if 1 | |
137 | /* dont know why this usually errors out on the first try */ | |
138 | if (mxl_fail(ret)) | |
c778edb5 | 139 | pr_err("error writing addr: 0x%02x, mask: 0x%02x, " |
4c66c920 MK |
140 | "data: 0x%02x, retrying...", addr, mask, data); |
141 | ||
142 | ret = mxl111sf_read_reg(state, addr, &val); | |
143 | #endif | |
144 | if (mxl_fail(ret)) | |
145 | goto fail; | |
146 | } | |
147 | val &= ~mask; | |
148 | val |= data; | |
149 | ||
150 | ret = mxl111sf_write_reg(state, addr, val); | |
151 | mxl_fail(ret); | |
152 | fail: | |
153 | return ret; | |
154 | } | |
155 | ||
156 | /* ------------------------------------------------------------------------ */ | |
157 | ||
158 | int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state, | |
159 | struct mxl111sf_reg_ctrl_info *ctrl_reg_info) | |
160 | { | |
161 | int i, ret = 0; | |
162 | ||
163 | for (i = 0; ctrl_reg_info[i].addr | | |
164 | ctrl_reg_info[i].mask | | |
165 | ctrl_reg_info[i].data; i++) { | |
166 | ||
167 | ret = mxl111sf_write_reg_mask(state, | |
168 | ctrl_reg_info[i].addr, | |
169 | ctrl_reg_info[i].mask, | |
170 | ctrl_reg_info[i].data); | |
171 | if (mxl_fail(ret)) { | |
c778edb5 | 172 | pr_err("failed on reg #%d (0x%02x)", i, |
4c66c920 MK |
173 | ctrl_reg_info[i].addr); |
174 | break; | |
175 | } | |
176 | } | |
177 | return ret; | |
178 | } | |
179 | ||
180 | /* ------------------------------------------------------------------------ */ | |
181 | ||
182 | static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state) | |
183 | { | |
184 | int ret; | |
185 | u8 id, ver; | |
186 | char *mxl_chip, *mxl_rev; | |
187 | ||
188 | if ((state->chip_id) && (state->chip_ver)) | |
189 | return 0; | |
190 | ||
191 | ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id); | |
192 | if (mxl_fail(ret)) | |
193 | goto fail; | |
194 | state->chip_id = id; | |
195 | ||
196 | ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver); | |
197 | if (mxl_fail(ret)) | |
198 | goto fail; | |
199 | state->chip_ver = ver; | |
200 | ||
201 | switch (id) { | |
202 | case 0x61: | |
203 | mxl_chip = "MxL101SF"; | |
204 | break; | |
205 | case 0x63: | |
206 | mxl_chip = "MxL111SF"; | |
207 | break; | |
208 | default: | |
209 | mxl_chip = "UNKNOWN MxL1X1"; | |
210 | break; | |
211 | } | |
212 | switch (ver) { | |
213 | case 0x36: | |
214 | state->chip_rev = MXL111SF_V6; | |
215 | mxl_rev = "v6"; | |
216 | break; | |
217 | case 0x08: | |
218 | state->chip_rev = MXL111SF_V8_100; | |
219 | mxl_rev = "v8_100"; | |
220 | break; | |
221 | case 0x18: | |
222 | state->chip_rev = MXL111SF_V8_200; | |
223 | mxl_rev = "v8_200"; | |
224 | break; | |
225 | default: | |
226 | state->chip_rev = 0; | |
227 | mxl_rev = "UNKNOWN REVISION"; | |
228 | break; | |
229 | } | |
c778edb5 | 230 | pr_info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver); |
4c66c920 MK |
231 | fail: |
232 | return ret; | |
233 | } | |
234 | ||
235 | #define get_chip_info(state) \ | |
236 | ({ \ | |
237 | int ___ret; \ | |
238 | ___ret = mxl1x1sf_get_chip_info(state); \ | |
239 | if (mxl_fail(___ret)) { \ | |
240 | mxl_debug("failed to get chip info" \ | |
241 | " on first probe attempt"); \ | |
242 | ___ret = mxl1x1sf_get_chip_info(state); \ | |
243 | if (mxl_fail(___ret)) \ | |
c778edb5 | 244 | pr_err("failed to get chip info during probe"); \ |
4c66c920 MK |
245 | else \ |
246 | mxl_debug("probe needed a retry " \ | |
247 | "in order to succeed."); \ | |
248 | } \ | |
249 | ___ret; \ | |
250 | }) | |
251 | ||
252 | /* ------------------------------------------------------------------------ */ | |
85722118 | 253 | #if 0 |
4c66c920 MK |
254 | static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff) |
255 | { | |
256 | /* power control depends on which adapter is being woken: | |
257 | * save this for init, instead, via mxl111sf_adap_fe_init */ | |
258 | return 0; | |
259 | } | |
85722118 | 260 | #endif |
4c66c920 MK |
261 | |
262 | static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) | |
263 | { | |
85722118 AP |
264 | struct dvb_usb_device *d = fe_to_d(fe); |
265 | struct mxl111sf_state *state = fe_to_priv(fe); | |
266 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; | |
4c66c920 MK |
267 | int err; |
268 | ||
269 | /* exit if we didnt initialize the driver yet */ | |
270 | if (!state->chip_id) { | |
271 | mxl_debug("driver not yet initialized, exit."); | |
272 | goto fail; | |
273 | } | |
274 | ||
c778edb5 | 275 | pr_debug("%s()\n", __func__); |
4c66c920 MK |
276 | |
277 | mutex_lock(&state->fe_lock); | |
278 | ||
279 | state->alt_mode = adap_state->alt_mode; | |
280 | ||
85722118 | 281 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 282 | pr_err("set interface failed"); |
4c66c920 MK |
283 | |
284 | err = mxl1x1sf_soft_reset(state); | |
285 | mxl_fail(err); | |
286 | err = mxl111sf_init_tuner_demod(state); | |
287 | mxl_fail(err); | |
288 | err = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
289 | ||
290 | mxl_fail(err); | |
291 | mxl111sf_enable_usb_output(state); | |
292 | mxl_fail(err); | |
293 | mxl1x1sf_top_master_ctrl(state, 1); | |
294 | mxl_fail(err); | |
295 | ||
296 | if ((MXL111SF_GPIO_MOD_DVBT != adap_state->gpio_mode) && | |
297 | (state->chip_rev > MXL111SF_V6)) { | |
298 | mxl111sf_config_pin_mux_modes(state, | |
299 | PIN_MUX_TS_SPI_IN_MODE_1); | |
300 | mxl_fail(err); | |
301 | } | |
302 | err = mxl111sf_init_port_expander(state); | |
303 | if (!mxl_fail(err)) { | |
304 | state->gpio_mode = adap_state->gpio_mode; | |
305 | err = mxl111sf_gpio_mode_switch(state, state->gpio_mode); | |
306 | mxl_fail(err); | |
307 | #if 0 | |
308 | err = fe->ops.init(fe); | |
309 | #endif | |
310 | msleep(100); /* add short delay after enabling | |
311 | * the demod before touching it */ | |
312 | } | |
313 | ||
314 | return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0; | |
315 | fail: | |
316 | return -ENODEV; | |
317 | } | |
318 | ||
319 | static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe) | |
320 | { | |
85722118 AP |
321 | struct mxl111sf_state *state = fe_to_priv(fe); |
322 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; | |
4c66c920 MK |
323 | int err; |
324 | ||
325 | /* exit if we didnt initialize the driver yet */ | |
326 | if (!state->chip_id) { | |
327 | mxl_debug("driver not yet initialized, exit."); | |
328 | goto fail; | |
329 | } | |
330 | ||
c778edb5 | 331 | pr_debug("%s()\n", __func__); |
4c66c920 MK |
332 | |
333 | err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0; | |
334 | ||
335 | mutex_unlock(&state->fe_lock); | |
336 | ||
337 | return err; | |
338 | fail: | |
339 | return -ENODEV; | |
340 | } | |
341 | ||
342 | ||
85722118 | 343 | static int mxl111sf_ep6_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
4c66c920 | 344 | { |
85722118 AP |
345 | struct mxl111sf_state *state = fe_to_priv(fe); |
346 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; | |
4c66c920 | 347 | int ret = 0; |
4c66c920 | 348 | |
c778edb5 | 349 | pr_debug("%s(%d)\n", __func__, onoff); |
4c66c920 MK |
350 | |
351 | if (onoff) { | |
352 | ret = mxl111sf_enable_usb_output(state); | |
353 | mxl_fail(ret); | |
354 | ret = mxl111sf_config_mpeg_in(state, 1, 1, | |
355 | adap_state->ep6_clockphase, | |
356 | 0, 0); | |
357 | mxl_fail(ret); | |
3be5bb71 | 358 | #if 0 |
4c66c920 MK |
359 | } else { |
360 | ret = mxl111sf_disable_656_port(state); | |
361 | mxl_fail(ret); | |
3be5bb71 | 362 | #endif |
4c66c920 MK |
363 | } |
364 | ||
4c66c920 MK |
365 | return ret; |
366 | } | |
367 | ||
85722118 | 368 | static int mxl111sf_ep5_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
31136214 | 369 | { |
85722118 | 370 | struct mxl111sf_state *state = fe_to_priv(fe); |
31136214 MK |
371 | int ret = 0; |
372 | ||
c778edb5 | 373 | pr_debug("%s(%d)\n", __func__, onoff); |
31136214 MK |
374 | |
375 | if (onoff) { | |
376 | ret = mxl111sf_enable_usb_output(state); | |
377 | mxl_fail(ret); | |
378 | ||
379 | ret = mxl111sf_init_i2s_port(state, 200); | |
380 | mxl_fail(ret); | |
381 | ret = mxl111sf_config_i2s(state, 0, 15); | |
382 | mxl_fail(ret); | |
383 | } else { | |
384 | ret = mxl111sf_disable_i2s_port(state); | |
385 | mxl_fail(ret); | |
386 | } | |
387 | if (state->chip_rev > MXL111SF_V6) | |
388 | ret = mxl111sf_config_spi(state, onoff); | |
389 | mxl_fail(ret); | |
390 | ||
391 | return ret; | |
392 | } | |
393 | ||
85722118 | 394 | static int mxl111sf_ep4_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
4f98480f | 395 | { |
85722118 | 396 | struct mxl111sf_state *state = fe_to_priv(fe); |
4f98480f MK |
397 | int ret = 0; |
398 | ||
c778edb5 | 399 | pr_debug("%s(%d)\n", __func__, onoff); |
4f98480f MK |
400 | |
401 | if (onoff) { | |
402 | ret = mxl111sf_enable_usb_output(state); | |
403 | mxl_fail(ret); | |
404 | } | |
405 | ||
406 | return ret; | |
407 | } | |
408 | ||
4c66c920 MK |
409 | /* ------------------------------------------------------------------------ */ |
410 | ||
411 | static struct lgdt3305_config hauppauge_lgdt3305_config = { | |
412 | .i2c_addr = 0xb2 >> 1, | |
413 | .mpeg_mode = LGDT3305_MPEG_SERIAL, | |
414 | .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE, | |
415 | .tpvalid_polarity = LGDT3305_TP_VALID_HIGH, | |
416 | .deny_i2c_rptr = 1, | |
417 | .spectral_inversion = 0, | |
418 | .qam_if_khz = 6000, | |
419 | .vsb_if_khz = 6000, | |
420 | }; | |
421 | ||
85722118 | 422 | static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
4c66c920 | 423 | { |
85722118 AP |
424 | struct dvb_usb_device *d = adap_to_d(adap); |
425 | struct mxl111sf_state *state = d_to_priv(d); | |
426 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; | |
4c66c920 MK |
427 | int ret; |
428 | ||
c778edb5 | 429 | pr_debug("%s()\n", __func__); |
4c66c920 MK |
430 | |
431 | /* save a pointer to the dvb_usb_device in device state */ | |
432 | state->d = d; | |
433 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | |
434 | state->alt_mode = adap_state->alt_mode; | |
435 | ||
85722118 | 436 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 437 | pr_err("set interface failed"); |
4c66c920 MK |
438 | |
439 | state->gpio_mode = MXL111SF_GPIO_MOD_ATSC; | |
440 | adap_state->gpio_mode = state->gpio_mode; | |
441 | adap_state->device_mode = MXL_TUNER_MODE; | |
442 | adap_state->ep6_clockphase = 1; | |
443 | ||
444 | ret = mxl1x1sf_soft_reset(state); | |
445 | if (mxl_fail(ret)) | |
446 | goto fail; | |
447 | ret = mxl111sf_init_tuner_demod(state); | |
448 | if (mxl_fail(ret)) | |
449 | goto fail; | |
450 | ||
451 | ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
452 | if (mxl_fail(ret)) | |
453 | goto fail; | |
454 | ||
455 | ret = mxl111sf_enable_usb_output(state); | |
456 | if (mxl_fail(ret)) | |
457 | goto fail; | |
458 | ret = mxl1x1sf_top_master_ctrl(state, 1); | |
459 | if (mxl_fail(ret)) | |
460 | goto fail; | |
461 | ||
462 | ret = mxl111sf_init_port_expander(state); | |
463 | if (mxl_fail(ret)) | |
464 | goto fail; | |
465 | ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); | |
466 | if (mxl_fail(ret)) | |
467 | goto fail; | |
468 | ||
85722118 | 469 | adap->fe[fe_id] = dvb_attach(lgdt3305_attach, |
4c66c920 | 470 | &hauppauge_lgdt3305_config, |
85722118 AP |
471 | &d->i2c_adap); |
472 | if (adap->fe[fe_id]) { | |
473 | state->num_frontends++; | |
474 | adap_state->fe_init = adap->fe[fe_id]->ops.init; | |
475 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; | |
476 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; | |
477 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | |
4c66c920 MK |
478 | return 0; |
479 | } | |
480 | ret = -EIO; | |
481 | fail: | |
482 | return ret; | |
483 | } | |
484 | ||
31136214 MK |
485 | static struct lg2160_config hauppauge_lg2160_config = { |
486 | .lg_chip = LG2160, | |
487 | .i2c_addr = 0x1c >> 1, | |
488 | .deny_i2c_rptr = 1, | |
489 | .spectral_inversion = 0, | |
490 | .if_khz = 6000, | |
491 | }; | |
492 | ||
85722118 | 493 | static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
31136214 | 494 | { |
85722118 AP |
495 | struct dvb_usb_device *d = adap_to_d(adap); |
496 | struct mxl111sf_state *state = d_to_priv(d); | |
497 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; | |
31136214 MK |
498 | int ret; |
499 | ||
c778edb5 | 500 | pr_debug("%s()\n", __func__); |
31136214 MK |
501 | |
502 | /* save a pointer to the dvb_usb_device in device state */ | |
503 | state->d = d; | |
504 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | |
505 | state->alt_mode = adap_state->alt_mode; | |
506 | ||
85722118 | 507 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 508 | pr_err("set interface failed"); |
31136214 MK |
509 | |
510 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | |
511 | adap_state->gpio_mode = state->gpio_mode; | |
512 | adap_state->device_mode = MXL_TUNER_MODE; | |
513 | adap_state->ep6_clockphase = 1; | |
514 | ||
515 | ret = mxl1x1sf_soft_reset(state); | |
516 | if (mxl_fail(ret)) | |
517 | goto fail; | |
518 | ret = mxl111sf_init_tuner_demod(state); | |
519 | if (mxl_fail(ret)) | |
520 | goto fail; | |
521 | ||
522 | ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
523 | if (mxl_fail(ret)) | |
524 | goto fail; | |
525 | ||
526 | ret = mxl111sf_enable_usb_output(state); | |
527 | if (mxl_fail(ret)) | |
528 | goto fail; | |
529 | ret = mxl1x1sf_top_master_ctrl(state, 1); | |
530 | if (mxl_fail(ret)) | |
531 | goto fail; | |
532 | ||
533 | ret = mxl111sf_init_port_expander(state); | |
534 | if (mxl_fail(ret)) | |
535 | goto fail; | |
536 | ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); | |
537 | if (mxl_fail(ret)) | |
538 | goto fail; | |
539 | ||
540 | ret = get_chip_info(state); | |
541 | if (mxl_fail(ret)) | |
542 | goto fail; | |
543 | ||
85722118 | 544 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
31136214 | 545 | &hauppauge_lg2160_config, |
85722118 AP |
546 | &d->i2c_adap); |
547 | if (adap->fe[fe_id]) { | |
548 | state->num_frontends++; | |
549 | adap_state->fe_init = adap->fe[fe_id]->ops.init; | |
550 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; | |
551 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; | |
552 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | |
31136214 MK |
553 | return 0; |
554 | } | |
555 | ret = -EIO; | |
556 | fail: | |
557 | return ret; | |
558 | } | |
559 | ||
560 | static struct lg2160_config hauppauge_lg2161_1019_config = { | |
561 | .lg_chip = LG2161_1019, | |
562 | .i2c_addr = 0x1c >> 1, | |
563 | .deny_i2c_rptr = 1, | |
564 | .spectral_inversion = 0, | |
565 | .if_khz = 6000, | |
566 | .output_if = 2, /* LG2161_OIF_SPI_MAS */ | |
567 | }; | |
568 | ||
569 | static struct lg2160_config hauppauge_lg2161_1040_config = { | |
570 | .lg_chip = LG2161_1040, | |
571 | .i2c_addr = 0x1c >> 1, | |
572 | .deny_i2c_rptr = 1, | |
573 | .spectral_inversion = 0, | |
574 | .if_khz = 6000, | |
575 | .output_if = 4, /* LG2161_OIF_SPI_MAS */ | |
576 | }; | |
577 | ||
85722118 | 578 | static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
31136214 | 579 | { |
85722118 AP |
580 | struct dvb_usb_device *d = adap_to_d(adap); |
581 | struct mxl111sf_state *state = d_to_priv(d); | |
582 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; | |
31136214 MK |
583 | int ret; |
584 | ||
c778edb5 | 585 | pr_debug("%s()\n", __func__); |
31136214 MK |
586 | |
587 | /* save a pointer to the dvb_usb_device in device state */ | |
588 | state->d = d; | |
589 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | |
590 | state->alt_mode = adap_state->alt_mode; | |
591 | ||
85722118 | 592 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 593 | pr_err("set interface failed"); |
31136214 MK |
594 | |
595 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | |
596 | adap_state->gpio_mode = state->gpio_mode; | |
597 | adap_state->device_mode = MXL_TUNER_MODE; | |
598 | adap_state->ep6_clockphase = 1; | |
599 | ||
600 | ret = mxl1x1sf_soft_reset(state); | |
601 | if (mxl_fail(ret)) | |
602 | goto fail; | |
603 | ret = mxl111sf_init_tuner_demod(state); | |
604 | if (mxl_fail(ret)) | |
605 | goto fail; | |
606 | ||
607 | ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
608 | if (mxl_fail(ret)) | |
609 | goto fail; | |
610 | ||
611 | ret = mxl111sf_enable_usb_output(state); | |
612 | if (mxl_fail(ret)) | |
613 | goto fail; | |
614 | ret = mxl1x1sf_top_master_ctrl(state, 1); | |
615 | if (mxl_fail(ret)) | |
616 | goto fail; | |
617 | ||
618 | ret = mxl111sf_init_port_expander(state); | |
619 | if (mxl_fail(ret)) | |
620 | goto fail; | |
621 | ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); | |
622 | if (mxl_fail(ret)) | |
623 | goto fail; | |
624 | ||
625 | ret = get_chip_info(state); | |
626 | if (mxl_fail(ret)) | |
627 | goto fail; | |
628 | ||
85722118 | 629 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
31136214 MK |
630 | (MXL111SF_V8_200 == state->chip_rev) ? |
631 | &hauppauge_lg2161_1040_config : | |
632 | &hauppauge_lg2161_1019_config, | |
85722118 AP |
633 | &d->i2c_adap); |
634 | if (adap->fe[fe_id]) { | |
635 | state->num_frontends++; | |
636 | adap_state->fe_init = adap->fe[fe_id]->ops.init; | |
637 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; | |
638 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; | |
639 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | |
31136214 MK |
640 | return 0; |
641 | } | |
642 | ret = -EIO; | |
643 | fail: | |
644 | return ret; | |
645 | } | |
646 | ||
647 | static struct lg2160_config hauppauge_lg2161_1019_ep6_config = { | |
648 | .lg_chip = LG2161_1019, | |
649 | .i2c_addr = 0x1c >> 1, | |
650 | .deny_i2c_rptr = 1, | |
651 | .spectral_inversion = 0, | |
652 | .if_khz = 6000, | |
653 | .output_if = 1, /* LG2161_OIF_SERIAL_TS */ | |
654 | }; | |
655 | ||
656 | static struct lg2160_config hauppauge_lg2161_1040_ep6_config = { | |
657 | .lg_chip = LG2161_1040, | |
658 | .i2c_addr = 0x1c >> 1, | |
659 | .deny_i2c_rptr = 1, | |
660 | .spectral_inversion = 0, | |
661 | .if_khz = 6000, | |
662 | .output_if = 7, /* LG2161_OIF_SERIAL_TS */ | |
663 | }; | |
664 | ||
85722118 | 665 | static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
31136214 | 666 | { |
85722118 AP |
667 | struct dvb_usb_device *d = adap_to_d(adap); |
668 | struct mxl111sf_state *state = d_to_priv(d); | |
669 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; | |
31136214 MK |
670 | int ret; |
671 | ||
c778edb5 | 672 | pr_debug("%s()\n", __func__); |
31136214 MK |
673 | |
674 | /* save a pointer to the dvb_usb_device in device state */ | |
675 | state->d = d; | |
676 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | |
677 | state->alt_mode = adap_state->alt_mode; | |
678 | ||
85722118 | 679 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 680 | pr_err("set interface failed"); |
31136214 MK |
681 | |
682 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | |
683 | adap_state->gpio_mode = state->gpio_mode; | |
684 | adap_state->device_mode = MXL_TUNER_MODE; | |
685 | adap_state->ep6_clockphase = 0; | |
686 | ||
687 | ret = mxl1x1sf_soft_reset(state); | |
688 | if (mxl_fail(ret)) | |
689 | goto fail; | |
690 | ret = mxl111sf_init_tuner_demod(state); | |
691 | if (mxl_fail(ret)) | |
692 | goto fail; | |
693 | ||
694 | ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
695 | if (mxl_fail(ret)) | |
696 | goto fail; | |
697 | ||
698 | ret = mxl111sf_enable_usb_output(state); | |
699 | if (mxl_fail(ret)) | |
700 | goto fail; | |
701 | ret = mxl1x1sf_top_master_ctrl(state, 1); | |
702 | if (mxl_fail(ret)) | |
703 | goto fail; | |
704 | ||
705 | ret = mxl111sf_init_port_expander(state); | |
706 | if (mxl_fail(ret)) | |
707 | goto fail; | |
708 | ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); | |
709 | if (mxl_fail(ret)) | |
710 | goto fail; | |
711 | ||
712 | ret = get_chip_info(state); | |
713 | if (mxl_fail(ret)) | |
714 | goto fail; | |
715 | ||
85722118 | 716 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
31136214 MK |
717 | (MXL111SF_V8_200 == state->chip_rev) ? |
718 | &hauppauge_lg2161_1040_ep6_config : | |
719 | &hauppauge_lg2161_1019_ep6_config, | |
85722118 AP |
720 | &d->i2c_adap); |
721 | if (adap->fe[fe_id]) { | |
722 | state->num_frontends++; | |
723 | adap_state->fe_init = adap->fe[fe_id]->ops.init; | |
724 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; | |
725 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; | |
726 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | |
31136214 MK |
727 | return 0; |
728 | } | |
729 | ret = -EIO; | |
730 | fail: | |
731 | return ret; | |
732 | } | |
733 | ||
4f98480f MK |
734 | static struct mxl111sf_demod_config mxl_demod_config = { |
735 | .read_reg = mxl111sf_read_reg, | |
736 | .write_reg = mxl111sf_write_reg, | |
737 | .program_regs = mxl111sf_ctrl_program_regs, | |
738 | }; | |
739 | ||
85722118 | 740 | static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap, u8 fe_id) |
4f98480f | 741 | { |
85722118 AP |
742 | struct dvb_usb_device *d = adap_to_d(adap); |
743 | struct mxl111sf_state *state = d_to_priv(d); | |
744 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; | |
4f98480f MK |
745 | int ret; |
746 | ||
c778edb5 | 747 | pr_debug("%s()\n", __func__); |
4f98480f MK |
748 | |
749 | /* save a pointer to the dvb_usb_device in device state */ | |
750 | state->d = d; | |
751 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2; | |
752 | state->alt_mode = adap_state->alt_mode; | |
753 | ||
85722118 | 754 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
c778edb5 | 755 | pr_err("set interface failed"); |
4f98480f MK |
756 | |
757 | state->gpio_mode = MXL111SF_GPIO_MOD_DVBT; | |
758 | adap_state->gpio_mode = state->gpio_mode; | |
759 | adap_state->device_mode = MXL_SOC_MODE; | |
760 | adap_state->ep6_clockphase = 1; | |
761 | ||
762 | ret = mxl1x1sf_soft_reset(state); | |
763 | if (mxl_fail(ret)) | |
764 | goto fail; | |
765 | ret = mxl111sf_init_tuner_demod(state); | |
766 | if (mxl_fail(ret)) | |
767 | goto fail; | |
768 | ||
769 | ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); | |
770 | if (mxl_fail(ret)) | |
771 | goto fail; | |
772 | ||
773 | ret = mxl111sf_enable_usb_output(state); | |
774 | if (mxl_fail(ret)) | |
775 | goto fail; | |
776 | ret = mxl1x1sf_top_master_ctrl(state, 1); | |
777 | if (mxl_fail(ret)) | |
778 | goto fail; | |
779 | ||
780 | /* dont care if this fails */ | |
781 | mxl111sf_init_port_expander(state); | |
782 | ||
85722118 | 783 | adap->fe[fe_id] = dvb_attach(mxl111sf_demod_attach, state, |
4f98480f | 784 | &mxl_demod_config); |
85722118 AP |
785 | if (adap->fe[fe_id]) { |
786 | state->num_frontends++; | |
787 | adap_state->fe_init = adap->fe[fe_id]->ops.init; | |
788 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; | |
789 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; | |
790 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | |
4f98480f MK |
791 | return 0; |
792 | } | |
793 | ret = -EIO; | |
794 | fail: | |
795 | return ret; | |
796 | } | |
797 | ||
4c66c920 MK |
798 | static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state, |
799 | int antpath) | |
800 | { | |
801 | return mxl111sf_idac_config(state, 1, 1, | |
802 | (antpath == ANT_PATH_INTERNAL) ? | |
803 | 0x3f : 0x00, 0); | |
804 | } | |
805 | ||
806 | #define DbgAntHunt(x, pwr0, pwr1, pwr2, pwr3) \ | |
c778edb5 | 807 | pr_err("%s(%d) FINAL input set to %s rxPwr:%d|%d|%d|%d\n", \ |
4c66c920 MK |
808 | __func__, __LINE__, \ |
809 | (ANT_PATH_EXTERNAL == x) ? "EXTERNAL" : "INTERNAL", \ | |
810 | pwr0, pwr1, pwr2, pwr3) | |
811 | ||
812 | #define ANT_HUNT_SLEEP 90 | |
813 | #define ANT_EXT_TWEAK 0 | |
814 | ||
815 | static int mxl111sf_ant_hunt(struct dvb_frontend *fe) | |
816 | { | |
85722118 | 817 | struct mxl111sf_state *state = fe_to_priv(fe); |
4c66c920 MK |
818 | int antctrl = dvb_usb_mxl111sf_rfswitch; |
819 | ||
820 | u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2; | |
821 | ||
822 | /* FIXME: must force EXTERNAL for QAM - done elsewhere */ | |
823 | mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ? | |
824 | ANT_PATH_EXTERNAL : antctrl); | |
825 | ||
826 | if (antctrl == ANT_PATH_AUTO) { | |
827 | #if 0 | |
828 | msleep(ANT_HUNT_SLEEP); | |
829 | #endif | |
830 | fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA); | |
831 | ||
832 | mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); | |
833 | msleep(ANT_HUNT_SLEEP); | |
834 | fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0); | |
835 | ||
836 | mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); | |
837 | msleep(ANT_HUNT_SLEEP); | |
838 | fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1); | |
839 | ||
840 | mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL); | |
841 | msleep(ANT_HUNT_SLEEP); | |
842 | fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2); | |
843 | ||
844 | if (rxPwr1+ANT_EXT_TWEAK >= rxPwr2) { | |
845 | /* return with EXTERNAL enabled */ | |
846 | mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); | |
847 | DbgAntHunt(ANT_PATH_EXTERNAL, rxPwrA, | |
848 | rxPwr0, rxPwr1, rxPwr2); | |
849 | } else { | |
850 | /* return with INTERNAL enabled */ | |
851 | DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA, | |
852 | rxPwr0, rxPwr1, rxPwr2); | |
853 | } | |
854 | } | |
855 | return 0; | |
856 | } | |
857 | ||
858 | static struct mxl111sf_tuner_config mxl_tuner_config = { | |
859 | .if_freq = MXL_IF_6_0, /* applies to external IF output, only */ | |
860 | .invert_spectrum = 0, | |
861 | .read_reg = mxl111sf_read_reg, | |
862 | .write_reg = mxl111sf_write_reg, | |
863 | .program_regs = mxl111sf_ctrl_program_regs, | |
864 | .top_master_ctrl = mxl1x1sf_top_master_ctrl, | |
865 | .ant_hunt = mxl111sf_ant_hunt, | |
866 | }; | |
867 | ||
868 | static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) | |
869 | { | |
85722118 AP |
870 | struct mxl111sf_state *state = adap_to_priv(adap); |
871 | int i; | |
4c66c920 | 872 | |
c778edb5 | 873 | pr_debug("%s()\n", __func__); |
4c66c920 | 874 | |
85722118 AP |
875 | for (i = 0; i < state->num_frontends; i++) { |
876 | if (dvb_attach(mxl111sf_tuner_attach, adap->fe[i], state, | |
877 | &mxl_tuner_config) == NULL) | |
878 | return -EIO; | |
9adf6132 | 879 | adap->fe[i]->ops.read_signal_strength = adap->fe[i]->ops.tuner_ops.get_rf_strength; |
85722118 | 880 | } |
4c66c920 | 881 | |
85722118 | 882 | return 0; |
4c66c920 MK |
883 | } |
884 | ||
4c66c920 MK |
885 | static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter) |
886 | { | |
887 | return I2C_FUNC_I2C; | |
888 | } | |
889 | ||
890 | struct i2c_algorithm mxl111sf_i2c_algo = { | |
891 | .master_xfer = mxl111sf_i2c_xfer, | |
892 | .functionality = mxl111sf_i2c_func, | |
893 | #ifdef NEED_ALGO_CONTROL | |
894 | .algo_control = dummy_algo_control, | |
895 | #endif | |
896 | }; | |
897 | ||
85722118 | 898 | static int mxl111sf_init(struct dvb_usb_device *d) |
4c66c920 | 899 | { |
85722118 AP |
900 | struct mxl111sf_state *state = d_to_priv(d); |
901 | int ret; | |
902 | static u8 eeprom[256]; | |
903 | struct i2c_client c; | |
4c66c920 | 904 | |
85722118 AP |
905 | ret = get_chip_info(state); |
906 | if (mxl_fail(ret)) | |
c778edb5 | 907 | pr_err("failed to get chip info during probe"); |
4c66c920 | 908 | |
85722118 | 909 | mutex_init(&state->fe_lock); |
4c66c920 | 910 | |
85722118 AP |
911 | if (state->chip_rev > MXL111SF_V6) |
912 | mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); | |
4c66c920 | 913 | |
85722118 AP |
914 | c.adapter = &d->i2c_adap; |
915 | c.addr = 0xa0 >> 1; | |
4c66c920 | 916 | |
85722118 AP |
917 | ret = tveeprom_read(&c, eeprom, sizeof(eeprom)); |
918 | if (mxl_fail(ret)) | |
4c66c920 | 919 | return 0; |
85722118 AP |
920 | tveeprom_hauppauge_analog(&c, &state->tv, (0x84 == eeprom[0xa0]) ? |
921 | eeprom + 0xa0 : eeprom + 0x80); | |
922 | #if 0 | |
923 | switch (state->tv.model) { | |
924 | case 117001: | |
925 | case 126001: | |
926 | case 138001: | |
927 | break; | |
928 | default: | |
929 | printk(KERN_WARNING "%s: warning: " | |
930 | "unknown hauppauge model #%d\n", | |
931 | __func__, state->tv.model); | |
4c66c920 | 932 | } |
85722118 AP |
933 | #endif |
934 | return 0; | |
4c66c920 MK |
935 | } |
936 | ||
85722118 AP |
937 | static int mxl111sf_frontend_attach_dvbt(struct dvb_usb_adapter *adap) |
938 | { | |
939 | return mxl111sf_attach_demod(adap, 0); | |
940 | } | |
4f98480f | 941 | |
85722118 AP |
942 | static int mxl111sf_frontend_attach_atsc(struct dvb_usb_adapter *adap) |
943 | { | |
944 | return mxl111sf_lgdt3305_frontend_attach(adap, 0); | |
945 | } | |
4f98480f | 946 | |
85722118 AP |
947 | static int mxl111sf_frontend_attach_mh(struct dvb_usb_adapter *adap) |
948 | { | |
949 | return mxl111sf_lg2160_frontend_attach(adap, 0); | |
950 | } | |
4c66c920 | 951 | |
85722118 AP |
952 | static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap) |
953 | { | |
954 | int ret; | |
c778edb5 | 955 | pr_debug("%s\n", __func__); |
4c66c920 | 956 | |
85722118 AP |
957 | ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); |
958 | if (ret < 0) | |
959 | return ret; | |
31136214 | 960 | |
85722118 AP |
961 | ret = mxl111sf_attach_demod(adap, 1); |
962 | if (ret < 0) | |
963 | return ret; | |
31136214 | 964 | |
85722118 AP |
965 | ret = mxl111sf_lg2160_frontend_attach(adap, 2); |
966 | if (ret < 0) | |
967 | return ret; | |
4c66c920 | 968 | |
85722118 AP |
969 | return ret; |
970 | } | |
4f98480f | 971 | |
85722118 AP |
972 | static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap) |
973 | { | |
974 | int ret; | |
c778edb5 | 975 | pr_debug("%s\n", __func__); |
4f98480f | 976 | |
85722118 AP |
977 | ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); |
978 | if (ret < 0) | |
979 | return ret; | |
4f98480f | 980 | |
85722118 AP |
981 | ret = mxl111sf_attach_demod(adap, 1); |
982 | if (ret < 0) | |
983 | return ret; | |
4f98480f | 984 | |
85722118 AP |
985 | ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2); |
986 | if (ret < 0) | |
987 | return ret; | |
31136214 | 988 | |
85722118 AP |
989 | return ret; |
990 | } | |
31136214 | 991 | |
85722118 AP |
992 | static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap) |
993 | { | |
994 | int ret; | |
c778edb5 | 995 | pr_debug("%s\n", __func__); |
31136214 | 996 | |
85722118 AP |
997 | ret = mxl111sf_attach_demod(adap, 0); |
998 | if (ret < 0) | |
999 | return ret; | |
31136214 | 1000 | |
85722118 AP |
1001 | if (dvb_usb_mxl111sf_spi) |
1002 | ret = mxl111sf_lg2161_frontend_attach(adap, 1); | |
1003 | else | |
1004 | ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 1); | |
31136214 | 1005 | |
85722118 AP |
1006 | return ret; |
1007 | } | |
31136214 | 1008 | |
85722118 AP |
1009 | static void mxl111sf_stream_config_bulk(struct usb_data_stream_properties *stream, u8 endpoint) |
1010 | { | |
c778edb5 | 1011 | pr_debug("%s: endpoint=%d size=8192\n", __func__, endpoint); |
85722118 AP |
1012 | stream->type = USB_BULK; |
1013 | stream->count = 5; | |
1014 | stream->endpoint = endpoint; | |
1015 | stream->u.bulk.buffersize = 8192; | |
1016 | } | |
31136214 | 1017 | |
85722118 AP |
1018 | static void mxl111sf_stream_config_isoc(struct usb_data_stream_properties *stream, |
1019 | u8 endpoint, int framesperurb, int framesize) | |
1020 | { | |
c778edb5 | 1021 | pr_debug("%s: endpoint=%d size=%d\n", __func__, endpoint, |
85722118 AP |
1022 | framesperurb * framesize); |
1023 | stream->type = USB_ISOC; | |
1024 | stream->count = 5; | |
1025 | stream->endpoint = endpoint; | |
1026 | stream->u.isoc.framesperurb = framesperurb; | |
1027 | stream->u.isoc.framesize = framesize; | |
1028 | stream->u.isoc.interval = 1; | |
1029 | } | |
31136214 | 1030 | |
85722118 | 1031 | /* DVB USB Driver stuff */ |
31136214 | 1032 | |
85722118 AP |
1033 | /* dvbt mxl111sf |
1034 | * bulk EP4/BULK/5/8192 | |
1035 | * isoc EP4/ISOC/5/96/564 | |
1036 | */ | |
1037 | static int mxl111sf_get_stream_config_dvbt(struct dvb_frontend *fe, | |
1038 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1039 | { | |
c778edb5 | 1040 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
31136214 | 1041 | |
85722118 AP |
1042 | *ts_type = DVB_USB_FE_TS_TYPE_188; |
1043 | if (dvb_usb_mxl111sf_isoc) | |
1044 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | |
1045 | else | |
1046 | mxl111sf_stream_config_bulk(stream, 4); | |
1047 | return 0; | |
1048 | } | |
31136214 | 1049 | |
85722118 AP |
1050 | static struct dvb_usb_device_properties mxl111sf_props_dvbt = { |
1051 | .driver_name = KBUILD_MODNAME, | |
1052 | .owner = THIS_MODULE, | |
1053 | .adapter_nr = adapter_nr, | |
1054 | .size_of_priv = sizeof(struct mxl111sf_state), | |
31136214 | 1055 | |
85722118 AP |
1056 | .generic_bulk_ctrl_endpoint = 0x02, |
1057 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
31136214 | 1058 | |
85722118 AP |
1059 | .i2c_algo = &mxl111sf_i2c_algo, |
1060 | .frontend_attach = mxl111sf_frontend_attach_dvbt, | |
1061 | .tuner_attach = mxl111sf_attach_tuner, | |
1062 | .init = mxl111sf_init, | |
1063 | .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, | |
1064 | .get_stream_config = mxl111sf_get_stream_config_dvbt, | |
31136214 MK |
1065 | |
1066 | .num_adapters = 1, | |
1067 | .adapter = { | |
1068 | { | |
85722118 AP |
1069 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1070 | } | |
4c66c920 MK |
1071 | } |
1072 | }; | |
1073 | ||
85722118 AP |
1074 | /* atsc lgdt3305 |
1075 | * bulk EP6/BULK/5/8192 | |
1076 | * isoc EP6/ISOC/5/24/3072 | |
1077 | */ | |
1078 | static int mxl111sf_get_stream_config_atsc(struct dvb_frontend *fe, | |
1079 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1080 | { | |
c778edb5 | 1081 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
4c66c920 | 1082 | |
85722118 AP |
1083 | *ts_type = DVB_USB_FE_TS_TYPE_188; |
1084 | if (dvb_usb_mxl111sf_isoc) | |
1085 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | |
1086 | else | |
1087 | mxl111sf_stream_config_bulk(stream, 6); | |
1088 | return 0; | |
1089 | } | |
4f98480f | 1090 | |
85722118 AP |
1091 | static struct dvb_usb_device_properties mxl111sf_props_atsc = { |
1092 | .driver_name = KBUILD_MODNAME, | |
1093 | .owner = THIS_MODULE, | |
1094 | .adapter_nr = adapter_nr, | |
1095 | .size_of_priv = sizeof(struct mxl111sf_state), | |
1096 | ||
1097 | .generic_bulk_ctrl_endpoint = 0x02, | |
1098 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
31136214 | 1099 | |
85722118 AP |
1100 | .i2c_algo = &mxl111sf_i2c_algo, |
1101 | .frontend_attach = mxl111sf_frontend_attach_atsc, | |
1102 | .tuner_attach = mxl111sf_attach_tuner, | |
1103 | .init = mxl111sf_init, | |
1104 | .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, | |
1105 | .get_stream_config = mxl111sf_get_stream_config_atsc, | |
31136214 MK |
1106 | |
1107 | .num_adapters = 1, | |
1108 | .adapter = { | |
1109 | { | |
85722118 AP |
1110 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1111 | } | |
31136214 MK |
1112 | } |
1113 | }; | |
1114 | ||
85722118 AP |
1115 | /* mh lg2160 |
1116 | * bulk EP5/BULK/5/8192/RAW | |
1117 | * isoc EP5/ISOC/5/96/200/RAW | |
1118 | */ | |
1119 | static int mxl111sf_get_stream_config_mh(struct dvb_frontend *fe, | |
1120 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1121 | { | |
c778edb5 | 1122 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
85722118 AP |
1123 | |
1124 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1125 | if (dvb_usb_mxl111sf_isoc) | |
1126 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | |
1127 | else | |
1128 | mxl111sf_stream_config_bulk(stream, 5); | |
1129 | return 0; | |
1130 | } | |
31136214 | 1131 | |
85722118 AP |
1132 | static struct dvb_usb_device_properties mxl111sf_props_mh = { |
1133 | .driver_name = KBUILD_MODNAME, | |
1134 | .owner = THIS_MODULE, | |
1135 | .adapter_nr = adapter_nr, | |
1136 | .size_of_priv = sizeof(struct mxl111sf_state), | |
31136214 | 1137 | |
85722118 AP |
1138 | .generic_bulk_ctrl_endpoint = 0x02, |
1139 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
4c66c920 | 1140 | |
85722118 AP |
1141 | .i2c_algo = &mxl111sf_i2c_algo, |
1142 | .frontend_attach = mxl111sf_frontend_attach_mh, | |
1143 | .tuner_attach = mxl111sf_attach_tuner, | |
1144 | .init = mxl111sf_init, | |
1145 | .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, | |
1146 | .get_stream_config = mxl111sf_get_stream_config_mh, | |
31136214 MK |
1147 | |
1148 | .num_adapters = 1, | |
1149 | .adapter = { | |
1150 | { | |
85722118 AP |
1151 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1152 | } | |
31136214 MK |
1153 | } |
1154 | }; | |
1155 | ||
85722118 AP |
1156 | /* atsc mh lgdt3305 mxl111sf lg2160 |
1157 | * bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW | |
1158 | * isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW | |
1159 | */ | |
1160 | static int mxl111sf_get_stream_config_atsc_mh(struct dvb_frontend *fe, | |
1161 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1162 | { | |
c778edb5 | 1163 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
85722118 AP |
1164 | |
1165 | if (fe->id == 0) { | |
1166 | *ts_type = DVB_USB_FE_TS_TYPE_188; | |
1167 | if (dvb_usb_mxl111sf_isoc) | |
1168 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | |
1169 | else | |
1170 | mxl111sf_stream_config_bulk(stream, 6); | |
1171 | } else if (fe->id == 1) { | |
1172 | *ts_type = DVB_USB_FE_TS_TYPE_188; | |
1173 | if (dvb_usb_mxl111sf_isoc) | |
1174 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | |
1175 | else | |
1176 | mxl111sf_stream_config_bulk(stream, 4); | |
1177 | } else if (fe->id == 2) { | |
1178 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1179 | if (dvb_usb_mxl111sf_isoc) | |
1180 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | |
1181 | else | |
1182 | mxl111sf_stream_config_bulk(stream, 5); | |
1183 | } | |
1184 | return 0; | |
1185 | } | |
1186 | ||
1187 | static int mxl111sf_streaming_ctrl_atsc_mh(struct dvb_frontend *fe, int onoff) | |
1188 | { | |
c778edb5 | 1189 | pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); |
85722118 AP |
1190 | |
1191 | if (fe->id == 0) | |
1192 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | |
1193 | else if (fe->id == 1) | |
1194 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | |
1195 | else if (fe->id == 2) | |
1196 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | |
1197 | return 0; | |
1198 | } | |
1199 | ||
1200 | static struct dvb_usb_device_properties mxl111sf_props_atsc_mh = { | |
1201 | .driver_name = KBUILD_MODNAME, | |
1202 | .owner = THIS_MODULE, | |
1203 | .adapter_nr = adapter_nr, | |
1204 | .size_of_priv = sizeof(struct mxl111sf_state), | |
1205 | ||
1206 | .generic_bulk_ctrl_endpoint = 0x02, | |
1207 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
1208 | ||
1209 | .i2c_algo = &mxl111sf_i2c_algo, | |
1210 | .frontend_attach = mxl111sf_frontend_attach_atsc_mh, | |
1211 | .tuner_attach = mxl111sf_attach_tuner, | |
1212 | .init = mxl111sf_init, | |
1213 | .streaming_ctrl = mxl111sf_streaming_ctrl_atsc_mh, | |
1214 | .get_stream_config = mxl111sf_get_stream_config_atsc_mh, | |
31136214 MK |
1215 | |
1216 | .num_adapters = 1, | |
1217 | .adapter = { | |
1218 | { | |
85722118 AP |
1219 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1220 | } | |
31136214 MK |
1221 | } |
1222 | }; | |
1223 | ||
85722118 AP |
1224 | /* mercury lgdt3305 mxl111sf lg2161 |
1225 | * tp bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP6/BULK/5/8192/RAW | |
1226 | * tp isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW | |
1227 | * spi bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW | |
1228 | * spi isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW | |
1229 | */ | |
1230 | static int mxl111sf_get_stream_config_mercury(struct dvb_frontend *fe, | |
1231 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1232 | { | |
c778edb5 | 1233 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
85722118 AP |
1234 | |
1235 | if (fe->id == 0) { | |
1236 | *ts_type = DVB_USB_FE_TS_TYPE_188; | |
1237 | if (dvb_usb_mxl111sf_isoc) | |
1238 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | |
1239 | else | |
1240 | mxl111sf_stream_config_bulk(stream, 6); | |
1241 | } else if (fe->id == 1) { | |
1242 | *ts_type = DVB_USB_FE_TS_TYPE_188; | |
1243 | if (dvb_usb_mxl111sf_isoc) | |
1244 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | |
1245 | else | |
1246 | mxl111sf_stream_config_bulk(stream, 4); | |
1247 | } else if (fe->id == 2 && dvb_usb_mxl111sf_spi) { | |
1248 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1249 | if (dvb_usb_mxl111sf_isoc) | |
1250 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | |
1251 | else | |
1252 | mxl111sf_stream_config_bulk(stream, 5); | |
1253 | } else if (fe->id == 2 && !dvb_usb_mxl111sf_spi) { | |
1254 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1255 | if (dvb_usb_mxl111sf_isoc) | |
1256 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | |
1257 | else | |
1258 | mxl111sf_stream_config_bulk(stream, 6); | |
1259 | } | |
1260 | return 0; | |
1261 | } | |
1262 | ||
1263 | static int mxl111sf_streaming_ctrl_mercury(struct dvb_frontend *fe, int onoff) | |
1264 | { | |
c778edb5 | 1265 | pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); |
85722118 AP |
1266 | |
1267 | if (fe->id == 0) | |
1268 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | |
1269 | else if (fe->id == 1) | |
1270 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | |
1271 | else if (fe->id == 2 && dvb_usb_mxl111sf_spi) | |
1272 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | |
1273 | else if (fe->id == 2 && !dvb_usb_mxl111sf_spi) | |
1274 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | |
1275 | return 0; | |
1276 | } | |
1277 | ||
1278 | static struct dvb_usb_device_properties mxl111sf_props_mercury = { | |
1279 | .driver_name = KBUILD_MODNAME, | |
1280 | .owner = THIS_MODULE, | |
1281 | .adapter_nr = adapter_nr, | |
1282 | .size_of_priv = sizeof(struct mxl111sf_state), | |
1283 | ||
1284 | .generic_bulk_ctrl_endpoint = 0x02, | |
1285 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
1286 | ||
1287 | .i2c_algo = &mxl111sf_i2c_algo, | |
1288 | .frontend_attach = mxl111sf_frontend_attach_mercury, | |
1289 | .tuner_attach = mxl111sf_attach_tuner, | |
1290 | .init = mxl111sf_init, | |
1291 | .streaming_ctrl = mxl111sf_streaming_ctrl_mercury, | |
1292 | .get_stream_config = mxl111sf_get_stream_config_mercury, | |
31136214 MK |
1293 | |
1294 | .num_adapters = 1, | |
1295 | .adapter = { | |
1296 | { | |
85722118 AP |
1297 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1298 | } | |
31136214 MK |
1299 | } |
1300 | }; | |
1301 | ||
85722118 AP |
1302 | /* mercury mh mxl111sf lg2161 |
1303 | * tp bulk EP4/BULK/5/8192 EP6/BULK/5/8192/RAW | |
1304 | * tp isoc EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW | |
1305 | * spi bulk EP4/BULK/5/8192 EP5/BULK/5/8192/RAW | |
1306 | * spi isoc EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW | |
1307 | */ | |
1308 | static int mxl111sf_get_stream_config_mercury_mh(struct dvb_frontend *fe, | |
1309 | u8 *ts_type, struct usb_data_stream_properties *stream) | |
1310 | { | |
c778edb5 | 1311 | pr_debug("%s: fe=%d\n", __func__, fe->id); |
85722118 AP |
1312 | |
1313 | if (fe->id == 0) { | |
1314 | *ts_type = DVB_USB_FE_TS_TYPE_188; | |
1315 | if (dvb_usb_mxl111sf_isoc) | |
1316 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | |
1317 | else | |
1318 | mxl111sf_stream_config_bulk(stream, 4); | |
1319 | } else if (fe->id == 1 && dvb_usb_mxl111sf_spi) { | |
1320 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1321 | if (dvb_usb_mxl111sf_isoc) | |
1322 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | |
1323 | else | |
1324 | mxl111sf_stream_config_bulk(stream, 5); | |
1325 | } else if (fe->id == 1 && !dvb_usb_mxl111sf_spi) { | |
1326 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | |
1327 | if (dvb_usb_mxl111sf_isoc) | |
1328 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | |
1329 | else | |
1330 | mxl111sf_stream_config_bulk(stream, 6); | |
1331 | } | |
1332 | return 0; | |
1333 | } | |
1334 | ||
1335 | static int mxl111sf_streaming_ctrl_mercury_mh(struct dvb_frontend *fe, int onoff) | |
1336 | { | |
c778edb5 | 1337 | pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); |
85722118 AP |
1338 | |
1339 | if (fe->id == 0) | |
1340 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | |
1341 | else if (fe->id == 1 && dvb_usb_mxl111sf_spi) | |
1342 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | |
1343 | else if (fe->id == 1 && !dvb_usb_mxl111sf_spi) | |
1344 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | |
1345 | return 0; | |
1346 | } | |
1347 | ||
1348 | static struct dvb_usb_device_properties mxl111sf_props_mercury_mh = { | |
1349 | .driver_name = KBUILD_MODNAME, | |
1350 | .owner = THIS_MODULE, | |
1351 | .adapter_nr = adapter_nr, | |
1352 | .size_of_priv = sizeof(struct mxl111sf_state), | |
1353 | ||
1354 | .generic_bulk_ctrl_endpoint = 0x02, | |
1355 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
1356 | ||
1357 | .i2c_algo = &mxl111sf_i2c_algo, | |
1358 | .frontend_attach = mxl111sf_frontend_attach_mercury_mh, | |
1359 | .tuner_attach = mxl111sf_attach_tuner, | |
1360 | .init = mxl111sf_init, | |
1361 | .streaming_ctrl = mxl111sf_streaming_ctrl_mercury_mh, | |
1362 | .get_stream_config = mxl111sf_get_stream_config_mercury_mh, | |
31136214 MK |
1363 | |
1364 | .num_adapters = 1, | |
1365 | .adapter = { | |
1366 | { | |
85722118 AP |
1367 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1368 | } | |
31136214 MK |
1369 | } |
1370 | }; | |
1371 | ||
85722118 AP |
1372 | static const struct usb_device_id mxl111sf_id_table[] = { |
1373 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, | |
1374 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) }, | |
1375 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602, &mxl111sf_props_mh, "HCW 126xxx", NULL) }, | |
1376 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc603, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, | |
1377 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc604, &mxl111sf_props_dvbt, "Hauppauge 126xxx DVBT", NULL) }, | |
1378 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc609, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) }, | |
1379 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60a, &mxl111sf_props_mh, "HCW 126xxx", NULL) }, | |
1380 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60b, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, | |
1381 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60c, &mxl111sf_props_dvbt, "Hauppauge 126xxx DVBT", NULL) }, | |
1382 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc653, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, | |
1383 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc65b, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, | |
1384 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb700, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1385 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb701, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) }, | |
1386 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb702, &mxl111sf_props_mh, "HCW 117xxx", NULL) }, | |
1387 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb703, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1388 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb704, &mxl111sf_props_dvbt, "Hauppauge 117xxx DVBT", NULL) }, | |
1389 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb753, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1390 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb763, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1391 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb764, &mxl111sf_props_dvbt, "Hauppauge 117xxx DVBT", NULL) }, | |
1392 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd853, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) }, | |
1393 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd854, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) }, | |
1394 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd863, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) }, | |
1395 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd864, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) }, | |
1396 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d3, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) }, | |
1397 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d4, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) }, | |
1398 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e3, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) }, | |
1399 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e4, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) }, | |
1400 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8ff, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) }, | |
1401 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc612, &mxl111sf_props_mercury_mh, "Hauppauge 126xxx", NULL) }, | |
1402 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc613, &mxl111sf_props_mercury, "Hauppauge WinTV-Aero-M", NULL) }, | |
1403 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61a, &mxl111sf_props_mercury_mh, "Hauppauge 126xxx", NULL) }, | |
1404 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61b, &mxl111sf_props_mercury, "Hauppauge WinTV-Aero-M", NULL) }, | |
1405 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb757, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1406 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb767, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) }, | |
1407 | { } | |
1408 | }; | |
1409 | MODULE_DEVICE_TABLE(usb, mxl111sf_id_table); | |
1410 | ||
1411 | static struct usb_driver mxl111sf_usb_driver = { | |
1412 | .name = KBUILD_MODNAME, | |
1413 | .id_table = mxl111sf_id_table, | |
1414 | .probe = dvb_usbv2_probe, | |
1415 | .disconnect = dvb_usbv2_disconnect, | |
1416 | .suspend = dvb_usbv2_suspend, | |
1417 | .resume = dvb_usbv2_resume, | |
1418 | .no_dynamic_id = 1, | |
1419 | .soft_unbind = 1, | |
4c66c920 MK |
1420 | }; |
1421 | ||
85722118 | 1422 | module_usb_driver(mxl111sf_usb_driver); |
4c66c920 MK |
1423 | |
1424 | MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>"); | |
1425 | MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); | |
1426 | MODULE_VERSION("1.0"); | |
1427 | MODULE_LICENSE("GPL"); | |
1428 | ||
1429 | /* | |
1430 | * Local variables: | |
1431 | * c-basic-offset: 8 | |
1432 | * End: | |
1433 | */ |