initial commit with v3.6.7
[linux-3.6.7-moxart.git] / drivers / media / dvb / dvb-usb / rtl28xxu.c
blob6bd0bd792437d38c2fd769470ddaa3a943f49016
1 /*
2 * Realtek RTL28xxU DVB USB driver
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
6 * Copyright (C) 2012 Thomas Mair <thomas.mair86@googlemail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "rtl28xxu.h"
25 #include "rtl2830.h"
26 #include "rtl2832.h"
28 #include "qt1010.h"
29 #include "mt2060.h"
30 #include "mxl5005s.h"
31 #include "fc0012.h"
32 #include "fc0013.h"
34 /* debug */
35 static int dvb_usb_rtl28xxu_debug;
36 module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644);
37 MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
38 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
40 static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
42 int ret;
43 unsigned int pipe;
44 u8 requesttype;
45 u8 *buf;
47 buf = kmalloc(req->size, GFP_KERNEL);
48 if (!buf) {
49 ret = -ENOMEM;
50 goto err;
53 if (req->index & CMD_WR_FLAG) {
54 /* write */
55 memcpy(buf, req->data, req->size);
56 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
57 pipe = usb_sndctrlpipe(d->udev, 0);
58 } else {
59 /* read */
60 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
61 pipe = usb_rcvctrlpipe(d->udev, 0);
64 ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value,
65 req->index, buf, req->size, 1000);
66 if (ret > 0)
67 ret = 0;
69 deb_dump(0, requesttype, req->value, req->index, buf, req->size,
70 deb_xfer);
72 /* read request, copy returned data to return buf */
73 if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
74 memcpy(req->data, buf, req->size);
76 kfree(buf);
78 if (ret)
79 goto err;
81 return ret;
82 err:
83 deb_info("%s: failed=%d\n", __func__, ret);
84 return ret;
87 static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
89 struct rtl28xxu_req req;
91 if (reg < 0x3000)
92 req.index = CMD_USB_WR;
93 else if (reg < 0x4000)
94 req.index = CMD_SYS_WR;
95 else
96 req.index = CMD_IR_WR;
98 req.value = reg;
99 req.size = len;
100 req.data = val;
102 return rtl28xxu_ctrl_msg(d, &req);
105 static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
107 struct rtl28xxu_req req;
109 if (reg < 0x3000)
110 req.index = CMD_USB_RD;
111 else if (reg < 0x4000)
112 req.index = CMD_SYS_RD;
113 else
114 req.index = CMD_IR_RD;
116 req.value = reg;
117 req.size = len;
118 req.data = val;
120 return rtl28xxu_ctrl_msg(d, &req);
123 static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
125 return rtl28xx_wr_regs(d, reg, &val, 1);
128 static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
130 return rtl2831_rd_regs(d, reg, val, 1);
133 /* I2C */
134 static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
135 int num)
137 int ret;
138 struct dvb_usb_device *d = i2c_get_adapdata(adap);
139 struct rtl28xxu_priv *priv = d->priv;
140 struct rtl28xxu_req req;
143 * It is not known which are real I2C bus xfer limits, but testing
144 * with RTL2831U + MT2060 gives max RD 24 and max WR 22 bytes.
145 * TODO: find out RTL2832U lens
149 * I2C adapter logic looks rather complicated due to fact it handles
150 * three different access methods. Those methods are;
151 * 1) integrated demod access
152 * 2) old I2C access
153 * 3) new I2C access
155 * Used method is selected in order 1, 2, 3. Method 3 can handle all
156 * requests but there is two reasons why not use it always;
157 * 1) It is most expensive, usually two USB messages are needed
158 * 2) At least RTL2831U does not support it
160 * Method 3 is needed in case of I2C write+read (typical register read)
161 * where write is more than one byte.
164 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
165 return -EAGAIN;
167 if (num == 2 && !(msg[0].flags & I2C_M_RD) &&
168 (msg[1].flags & I2C_M_RD)) {
169 if (msg[0].len > 24 || msg[1].len > 24) {
170 /* TODO: check msg[0].len max */
171 ret = -EOPNOTSUPP;
172 goto err_mutex_unlock;
173 } else if (msg[0].addr == 0x10) {
174 /* method 1 - integrated demod */
175 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
176 req.index = CMD_DEMOD_RD | priv->page;
177 req.size = msg[1].len;
178 req.data = &msg[1].buf[0];
179 ret = rtl28xxu_ctrl_msg(d, &req);
180 } else if (msg[0].len < 2) {
181 /* method 2 - old I2C */
182 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
183 req.index = CMD_I2C_RD;
184 req.size = msg[1].len;
185 req.data = &msg[1].buf[0];
186 ret = rtl28xxu_ctrl_msg(d, &req);
187 } else {
188 /* method 3 - new I2C */
189 req.value = (msg[0].addr << 1);
190 req.index = CMD_I2C_DA_WR;
191 req.size = msg[0].len;
192 req.data = msg[0].buf;
193 ret = rtl28xxu_ctrl_msg(d, &req);
194 if (ret)
195 goto err_mutex_unlock;
197 req.value = (msg[0].addr << 1);
198 req.index = CMD_I2C_DA_RD;
199 req.size = msg[1].len;
200 req.data = msg[1].buf;
201 ret = rtl28xxu_ctrl_msg(d, &req);
203 } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
204 if (msg[0].len > 22) {
205 /* TODO: check msg[0].len max */
206 ret = -EOPNOTSUPP;
207 goto err_mutex_unlock;
208 } else if (msg[0].addr == 0x10) {
209 /* method 1 - integrated demod */
210 if (msg[0].buf[0] == 0x00) {
211 /* save demod page for later demod access */
212 priv->page = msg[0].buf[1];
213 ret = 0;
214 } else {
215 req.value = (msg[0].buf[0] << 8) |
216 (msg[0].addr << 1);
217 req.index = CMD_DEMOD_WR | priv->page;
218 req.size = msg[0].len-1;
219 req.data = &msg[0].buf[1];
220 ret = rtl28xxu_ctrl_msg(d, &req);
222 } else if (msg[0].len < 23) {
223 /* method 2 - old I2C */
224 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
225 req.index = CMD_I2C_WR;
226 req.size = msg[0].len-1;
227 req.data = &msg[0].buf[1];
228 ret = rtl28xxu_ctrl_msg(d, &req);
229 } else {
230 /* method 3 - new I2C */
231 req.value = (msg[0].addr << 1);
232 req.index = CMD_I2C_DA_WR;
233 req.size = msg[0].len;
234 req.data = msg[0].buf;
235 ret = rtl28xxu_ctrl_msg(d, &req);
237 } else {
238 ret = -EINVAL;
241 err_mutex_unlock:
242 mutex_unlock(&d->i2c_mutex);
244 return ret ? ret : num;
247 static u32 rtl28xxu_i2c_func(struct i2c_adapter *adapter)
249 return I2C_FUNC_I2C;
252 static struct i2c_algorithm rtl28xxu_i2c_algo = {
253 .master_xfer = rtl28xxu_i2c_xfer,
254 .functionality = rtl28xxu_i2c_func,
257 static struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
258 .i2c_addr = 0x10, /* 0x20 */
259 .xtal = 28800000,
260 .ts_mode = 0,
261 .spec_inv = 1,
262 .if_dvbt = 36150000,
263 .vtop = 0x20,
264 .krf = 0x04,
265 .agc_targ_val = 0x2d,
269 static struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
270 .i2c_addr = 0x10, /* 0x20 */
271 .xtal = 28800000,
272 .ts_mode = 0,
273 .spec_inv = 1,
274 .if_dvbt = 36125000,
275 .vtop = 0x20,
276 .krf = 0x04,
277 .agc_targ_val = 0x2d,
280 static struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
281 .i2c_addr = 0x10, /* 0x20 */
282 .xtal = 28800000,
283 .ts_mode = 0,
284 .spec_inv = 0,
285 .if_dvbt = 4570000,
286 .vtop = 0x3f,
287 .krf = 0x04,
288 .agc_targ_val = 0x3e,
291 static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
293 int ret;
294 struct rtl28xxu_priv *priv = adap->dev->priv;
295 u8 buf[1];
296 struct rtl2830_config *rtl2830_config;
297 /* open RTL2831U/RTL2830 I2C gate */
298 struct rtl28xxu_req req_gate = { 0x0120, 0x0011, 0x0001, "\x08" };
299 /* for MT2060 tuner probe */
300 struct rtl28xxu_req req_mt2060 = { 0x00c0, CMD_I2C_RD, 1, buf };
301 /* for QT1010 tuner probe */
302 struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf };
304 deb_info("%s:\n", __func__);
307 * RTL2831U GPIOs
308 * =========================================================
309 * GPIO0 | tuner#0 | 0 off | 1 on | MXL5005S (?)
310 * GPIO2 | LED | 0 off | 1 on |
311 * GPIO4 | tuner#1 | 0 on | 1 off | MT2060
314 /* GPIO direction */
315 ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a);
316 if (ret)
317 goto err;
319 /* enable as output GPIO0, GPIO2, GPIO4 */
320 ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15);
321 if (ret)
322 goto err;
325 * Probe used tuner. We need to know used tuner before demod attach
326 * since there is some demod params needed to set according to tuner.
329 /* demod needs some time to wake up */
330 msleep(20);
332 /* open demod I2C gate */
333 ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate);
334 if (ret)
335 goto err;
337 /* check QT1010 ID(?) register; reg=0f val=2c */
338 ret = rtl28xxu_ctrl_msg(adap->dev, &req_qt1010);
339 if (ret == 0 && buf[0] == 0x2c) {
340 priv->tuner = TUNER_RTL2830_QT1010;
341 rtl2830_config = &rtl28xxu_rtl2830_qt1010_config;
342 deb_info("%s: QT1010\n", __func__);
343 goto found;
344 } else {
345 deb_info("%s: QT1010 probe failed=%d - %02x\n",
346 __func__, ret, buf[0]);
349 /* open demod I2C gate */
350 ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate);
351 if (ret)
352 goto err;
354 /* check MT2060 ID register; reg=00 val=63 */
355 ret = rtl28xxu_ctrl_msg(adap->dev, &req_mt2060);
356 if (ret == 0 && buf[0] == 0x63) {
357 priv->tuner = TUNER_RTL2830_MT2060;
358 rtl2830_config = &rtl28xxu_rtl2830_mt2060_config;
359 deb_info("%s: MT2060\n", __func__);
360 goto found;
361 } else {
362 deb_info("%s: MT2060 probe failed=%d - %02x\n",
363 __func__, ret, buf[0]);
366 /* assume MXL5005S */
367 ret = 0;
368 priv->tuner = TUNER_RTL2830_MXL5005S;
369 rtl2830_config = &rtl28xxu_rtl2830_mxl5005s_config;
370 deb_info("%s: MXL5005S\n", __func__);
371 goto found;
373 found:
374 /* attach demodulator */
375 adap->fe_adap[0].fe = dvb_attach(rtl2830_attach, rtl2830_config,
376 &adap->dev->i2c_adap);
377 if (adap->fe_adap[0].fe == NULL) {
378 ret = -ENODEV;
379 goto err;
382 return ret;
383 err:
384 deb_info("%s: failed=%d\n", __func__, ret);
385 return ret;
388 static struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
389 .i2c_addr = 0x10, /* 0x20 */
390 .xtal = 28800000,
391 .if_dvbt = 0,
392 .tuner = TUNER_RTL2832_FC0012
395 static struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
396 .i2c_addr = 0x10, /* 0x20 */
397 .xtal = 28800000,
398 .if_dvbt = 0,
399 .tuner = TUNER_RTL2832_FC0013
402 static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
403 int cmd, int arg)
405 int ret;
406 u8 val;
408 deb_info("%s cmd=%d arg=%d\n", __func__, cmd, arg);
409 switch (cmd) {
410 case FC_FE_CALLBACK_VHF_ENABLE:
411 /* set output values */
412 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
413 if (ret)
414 goto err;
416 if (arg)
417 val &= 0xbf; /* set GPIO6 low */
418 else
419 val |= 0x40; /* set GPIO6 high */
422 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
423 if (ret)
424 goto err;
425 break;
426 default:
427 ret = -EINVAL;
428 goto err;
430 return 0;
432 err:
433 err("%s: failed=%d\n", __func__, ret);
435 return ret;
439 static int rtl2832u_fc0013_tuner_callback(struct dvb_usb_device *d,
440 int cmd, int arg)
442 /* TODO implement*/
443 return 0;
446 static int rtl2832u_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
448 struct rtl28xxu_priv *priv = d->priv;
450 switch (priv->tuner) {
451 case TUNER_RTL2832_FC0012:
452 return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
454 case TUNER_RTL2832_FC0013:
455 return rtl2832u_fc0013_tuner_callback(d, cmd, arg);
456 default:
457 break;
460 return -ENODEV;
463 static int rtl2832u_frontend_callback(void *adapter_priv, int component,
464 int cmd, int arg)
466 struct i2c_adapter *adap = adapter_priv;
467 struct dvb_usb_device *d = i2c_get_adapdata(adap);
469 switch (component) {
470 case DVB_FRONTEND_COMPONENT_TUNER:
471 return rtl2832u_tuner_callback(d, cmd, arg);
472 default:
473 break;
476 return -EINVAL;
482 static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
484 int ret;
485 struct rtl28xxu_priv *priv = adap->dev->priv;
486 struct rtl2832_config *rtl2832_config;
488 u8 buf[2], val;
489 /* open RTL2832U/RTL2832 I2C gate */
490 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x18"};
491 /* close RTL2832U/RTL2832 I2C gate */
492 struct rtl28xxu_req req_gate_close = {0x0120, 0x0011, 0x0001, "\x10"};
493 /* for FC0012 tuner probe */
494 struct rtl28xxu_req req_fc0012 = {0x00c6, CMD_I2C_RD, 1, buf};
495 /* for FC0013 tuner probe */
496 struct rtl28xxu_req req_fc0013 = {0x00c6, CMD_I2C_RD, 1, buf};
497 /* for MT2266 tuner probe */
498 struct rtl28xxu_req req_mt2266 = {0x00c0, CMD_I2C_RD, 1, buf};
499 /* for FC2580 tuner probe */
500 struct rtl28xxu_req req_fc2580 = {0x01ac, CMD_I2C_RD, 1, buf};
501 /* for MT2063 tuner probe */
502 struct rtl28xxu_req req_mt2063 = {0x00c0, CMD_I2C_RD, 1, buf};
503 /* for MAX3543 tuner probe */
504 struct rtl28xxu_req req_max3543 = {0x00c0, CMD_I2C_RD, 1, buf};
505 /* for TUA9001 tuner probe */
506 struct rtl28xxu_req req_tua9001 = {0x7ec0, CMD_I2C_RD, 2, buf};
507 /* for MXL5007T tuner probe */
508 struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf};
509 /* for E4000 tuner probe */
510 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
511 /* for TDA18272 tuner probe */
512 struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
514 deb_info("%s:\n", __func__);
517 ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_DIR, &val);
518 if (ret)
519 goto err;
521 val &= 0xbf;
523 ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, val);
524 if (ret)
525 goto err;
528 /* enable as output GPIO3 and GPIO6*/
529 ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_EN, &val);
530 if (ret)
531 goto err;
533 val |= 0x48;
535 ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
536 if (ret)
537 goto err;
542 * Probe used tuner. We need to know used tuner before demod attach
543 * since there is some demod params needed to set according to tuner.
546 /* open demod I2C gate */
547 ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_open);
548 if (ret)
549 goto err;
551 priv->tuner = TUNER_NONE;
553 /* check FC0012 ID register; reg=00 val=a1 */
554 ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc0012);
555 if (ret == 0 && buf[0] == 0xa1) {
556 priv->tuner = TUNER_RTL2832_FC0012;
557 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
558 info("%s: FC0012 tuner found", __func__);
559 goto found;
562 /* check FC0013 ID register; reg=00 val=a3 */
563 ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc0013);
564 if (ret == 0 && buf[0] == 0xa3) {
565 priv->tuner = TUNER_RTL2832_FC0013;
566 rtl2832_config = &rtl28xxu_rtl2832_fc0013_config;
567 info("%s: FC0013 tuner found", __func__);
568 goto found;
571 /* check MT2266 ID register; reg=00 val=85 */
572 ret = rtl28xxu_ctrl_msg(adap->dev, &req_mt2266);
573 if (ret == 0 && buf[0] == 0x85) {
574 priv->tuner = TUNER_RTL2832_MT2266;
575 /* TODO implement tuner */
576 info("%s: MT2266 tuner found", __func__);
577 goto unsupported;
580 /* check FC2580 ID register; reg=01 val=56 */
581 ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc2580);
582 if (ret == 0 && buf[0] == 0x56) {
583 priv->tuner = TUNER_RTL2832_FC2580;
584 /* TODO implement tuner */
585 info("%s: FC2580 tuner found", __func__);
586 goto unsupported;
589 /* check MT2063 ID register; reg=00 val=9e || 9c */
590 ret = rtl28xxu_ctrl_msg(adap->dev, &req_mt2063);
591 if (ret == 0 && (buf[0] == 0x9e || buf[0] == 0x9c)) {
592 priv->tuner = TUNER_RTL2832_MT2063;
593 /* TODO implement tuner */
594 info("%s: MT2063 tuner found", __func__);
595 goto unsupported;
598 /* check MAX3543 ID register; reg=00 val=38 */
599 ret = rtl28xxu_ctrl_msg(adap->dev, &req_max3543);
600 if (ret == 0 && buf[0] == 0x38) {
601 priv->tuner = TUNER_RTL2832_MAX3543;
602 /* TODO implement tuner */
603 info("%s: MAX3534 tuner found", __func__);
604 goto unsupported;
607 /* check TUA9001 ID register; reg=7e val=2328 */
608 ret = rtl28xxu_ctrl_msg(adap->dev, &req_tua9001);
609 if (ret == 0 && buf[0] == 0x23 && buf[1] == 0x28) {
610 priv->tuner = TUNER_RTL2832_TUA9001;
611 /* TODO implement tuner */
612 info("%s: TUA9001 tuner found", __func__);
613 goto unsupported;
616 /* check MXL5007R ID register; reg=d9 val=14 */
617 ret = rtl28xxu_ctrl_msg(adap->dev, &req_mxl5007t);
618 if (ret == 0 && buf[0] == 0x14) {
619 priv->tuner = TUNER_RTL2832_MXL5007T;
620 /* TODO implement tuner */
621 info("%s: MXL5007T tuner found", __func__);
622 goto unsupported;
625 /* check E4000 ID register; reg=02 val=40 */
626 ret = rtl28xxu_ctrl_msg(adap->dev, &req_e4000);
627 if (ret == 0 && buf[0] == 0x40) {
628 priv->tuner = TUNER_RTL2832_E4000;
629 /* TODO implement tuner */
630 info("%s: E4000 tuner found", __func__);
631 goto unsupported;
634 /* check TDA18272 ID register; reg=00 val=c760 */
635 ret = rtl28xxu_ctrl_msg(adap->dev, &req_tda18272);
636 if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) {
637 priv->tuner = TUNER_RTL2832_TDA18272;
638 /* TODO implement tuner */
639 info("%s: TDA18272 tuner found", __func__);
640 goto unsupported;
643 unsupported:
644 /* close demod I2C gate */
645 ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_close);
646 if (ret)
647 goto err;
649 /* tuner not found */
650 deb_info("No compatible tuner found");
651 ret = -ENODEV;
652 return ret;
654 found:
655 /* close demod I2C gate */
656 ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_close);
657 if (ret)
658 goto err;
660 /* attach demodulator */
661 adap->fe_adap[0].fe = dvb_attach(rtl2832_attach, rtl2832_config,
662 &adap->dev->i2c_adap);
663 if (adap->fe_adap[0].fe == NULL) {
664 ret = -ENODEV;
665 goto err;
668 /* set fe callbacks */
669 adap->fe_adap[0].fe->callback = rtl2832u_frontend_callback;
671 return ret;
673 err:
674 deb_info("%s: failed=%d\n", __func__, ret);
675 return ret;
678 static struct qt1010_config rtl28xxu_qt1010_config = {
679 .i2c_address = 0x62, /* 0xc4 */
682 static struct mt2060_config rtl28xxu_mt2060_config = {
683 .i2c_address = 0x60, /* 0xc0 */
684 .clock_out = 0,
687 static struct mxl5005s_config rtl28xxu_mxl5005s_config = {
688 .i2c_address = 0x63, /* 0xc6 */
689 .if_freq = IF_FREQ_4570000HZ,
690 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
691 .agc_mode = MXL_SINGLE_AGC,
692 .tracking_filter = MXL_TF_C_H,
693 .rssi_enable = MXL_RSSI_ENABLE,
694 .cap_select = MXL_CAP_SEL_ENABLE,
695 .div_out = MXL_DIV_OUT_4,
696 .clock_out = MXL_CLOCK_OUT_DISABLE,
697 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
698 .top = MXL5005S_TOP_25P2,
699 .mod_mode = MXL_DIGITAL_MODE,
700 .if_mode = MXL_ZERO_IF,
701 .AgcMasterByte = 0x00,
704 static int rtl2831u_tuner_attach(struct dvb_usb_adapter *adap)
706 int ret;
707 struct rtl28xxu_priv *priv = adap->dev->priv;
708 struct i2c_adapter *rtl2830_tuner_i2c;
709 struct dvb_frontend *fe;
711 deb_info("%s:\n", __func__);
713 /* use rtl2830 driver I2C adapter, for more info see rtl2830 driver */
714 rtl2830_tuner_i2c = rtl2830_get_tuner_i2c_adapter(adap->fe_adap[0].fe);
716 switch (priv->tuner) {
717 case TUNER_RTL2830_QT1010:
718 fe = dvb_attach(qt1010_attach, adap->fe_adap[0].fe,
719 rtl2830_tuner_i2c, &rtl28xxu_qt1010_config);
720 break;
721 case TUNER_RTL2830_MT2060:
722 fe = dvb_attach(mt2060_attach, adap->fe_adap[0].fe,
723 rtl2830_tuner_i2c, &rtl28xxu_mt2060_config,
724 1220);
725 break;
726 case TUNER_RTL2830_MXL5005S:
727 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
728 rtl2830_tuner_i2c, &rtl28xxu_mxl5005s_config);
729 break;
730 default:
731 fe = NULL;
732 err("unknown tuner=%d", priv->tuner);
735 if (fe == NULL) {
736 ret = -ENODEV;
737 goto err;
740 return 0;
741 err:
742 deb_info("%s: failed=%d\n", __func__, ret);
743 return ret;
746 static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
748 int ret;
749 struct rtl28xxu_priv *priv = adap->dev->priv;
750 struct dvb_frontend *fe;
752 deb_info("%s:\n", __func__);
754 switch (priv->tuner) {
755 case TUNER_RTL2832_FC0012:
756 fe = dvb_attach(fc0012_attach, adap->fe_adap[0].fe,
757 &adap->dev->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
759 /* since fc0012 includs reading the signal strength delegate
760 * that to the tuner driver */
761 adap->fe_adap[0].fe->ops.read_signal_strength = adap->fe_adap[0].
762 fe->ops.tuner_ops.get_rf_strength;
763 return 0;
764 break;
765 case TUNER_RTL2832_FC0013:
766 fe = dvb_attach(fc0013_attach, adap->fe_adap[0].fe,
767 &adap->dev->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
769 /* fc0013 also supports signal strength reading */
770 adap->fe_adap[0].fe->ops.read_signal_strength = adap->fe_adap[0]
771 .fe->ops.tuner_ops.get_rf_strength;
772 return 0;
773 default:
774 fe = NULL;
775 err("unknown tuner=%d", priv->tuner);
778 if (fe == NULL) {
779 ret = -ENODEV;
780 goto err;
783 return 0;
784 err:
785 deb_info("%s: failed=%d\n", __func__, ret);
786 return ret;
789 static int rtl2831u_streaming_ctrl(struct dvb_usb_adapter *adap , int onoff)
791 int ret;
792 u8 buf[2], gpio;
794 deb_info("%s: onoff=%d\n", __func__, onoff);
796 ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_VAL, &gpio);
797 if (ret)
798 goto err;
800 if (onoff) {
801 buf[0] = 0x00;
802 buf[1] = 0x00;
803 gpio |= 0x04; /* LED on */
804 } else {
805 buf[0] = 0x10; /* stall EPA */
806 buf[1] = 0x02; /* reset EPA */
807 gpio &= (~0x04); /* LED off */
810 ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, gpio);
811 if (ret)
812 goto err;
814 ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
815 if (ret)
816 goto err;
818 return ret;
819 err:
820 deb_info("%s: failed=%d\n", __func__, ret);
821 return ret;
824 static int rtl2832u_streaming_ctrl(struct dvb_usb_adapter *adap , int onoff)
826 int ret;
827 u8 buf[2];
829 deb_info("%s: onoff=%d\n", __func__, onoff);
832 if (onoff) {
833 buf[0] = 0x00;
834 buf[1] = 0x00;
835 } else {
836 buf[0] = 0x10; /* stall EPA */
837 buf[1] = 0x02; /* reset EPA */
840 ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
841 if (ret)
842 goto err;
844 return ret;
845 err:
846 deb_info("%s: failed=%d\n", __func__, ret);
847 return ret;
850 static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
852 int ret;
853 u8 gpio, sys0;
855 deb_info("%s: onoff=%d\n", __func__, onoff);
857 /* demod adc */
858 ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
859 if (ret)
860 goto err;
862 /* tuner power, read GPIOs */
863 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
864 if (ret)
865 goto err;
867 deb_info("%s: RD SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__, sys0, gpio);
869 if (onoff) {
870 gpio |= 0x01; /* GPIO0 = 1 */
871 gpio &= (~0x10); /* GPIO4 = 0 */
872 sys0 = sys0 & 0x0f;
873 sys0 |= 0xe0;
874 } else {
875 gpio &= (~0x01); /* GPIO0 = 0 */
876 gpio |= 0x10; /* GPIO4 = 1 */
877 sys0 = sys0 & (~0xc0);
880 deb_info("%s: WR SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__, sys0, gpio);
882 /* demod adc */
883 ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
884 if (ret)
885 goto err;
887 /* tuner power, write GPIOs */
888 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
889 if (ret)
890 goto err;
892 return ret;
893 err:
894 deb_info("%s: failed=%d\n", __func__, ret);
895 return ret;
898 static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
900 int ret;
901 u8 val;
903 deb_info("%s: onoff=%d\n", __func__, onoff);
905 if (onoff) {
906 /* set output values */
907 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
908 if (ret)
909 goto err;
911 val |= 0x08;
912 val &= 0xef;
914 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
915 if (ret)
916 goto err;
918 /* demod_ctl_1 */
919 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
920 if (ret)
921 goto err;
923 val &= 0xef;
925 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
926 if (ret)
927 goto err;
929 /* demod control */
930 /* PLL enable */
931 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
932 if (ret)
933 goto err;
935 /* bit 7 to 1 */
936 val |= 0x80;
938 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
939 if (ret)
940 goto err;
942 /* demod HW reset */
943 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
944 if (ret)
945 goto err;
946 /* bit 5 to 0 */
947 val &= 0xdf;
949 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
950 if (ret)
951 goto err;
953 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
954 if (ret)
955 goto err;
957 val |= 0x20;
959 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
960 if (ret)
961 goto err;
963 mdelay(5);
965 /*enable ADC_Q and ADC_I */
966 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
967 if (ret)
968 goto err;
970 val |= 0x48;
972 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
973 if (ret)
974 goto err;
977 } else {
978 /* demod_ctl_1 */
979 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
980 if (ret)
981 goto err;
983 val |= 0x0c;
985 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
986 if (ret)
987 goto err;
989 /* set output values */
990 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
991 if (ret)
992 goto err;
994 val |= 0x10;
996 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
997 if (ret)
998 goto err;
1000 /* demod control */
1001 ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
1002 if (ret)
1003 goto err;
1005 val &= 0x37;
1007 ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
1008 if (ret)
1009 goto err;
1013 return ret;
1014 err:
1015 deb_info("%s: failed=%d\n", __func__, ret);
1016 return ret;
1020 static int rtl2831u_rc_query(struct dvb_usb_device *d)
1022 int ret, i;
1023 struct rtl28xxu_priv *priv = d->priv;
1024 u8 buf[5];
1025 u32 rc_code;
1026 struct rtl28xxu_reg_val rc_nec_tab[] = {
1027 { 0x3033, 0x80 },
1028 { 0x3020, 0x43 },
1029 { 0x3021, 0x16 },
1030 { 0x3022, 0x16 },
1031 { 0x3023, 0x5a },
1032 { 0x3024, 0x2d },
1033 { 0x3025, 0x16 },
1034 { 0x3026, 0x01 },
1035 { 0x3028, 0xb0 },
1036 { 0x3029, 0x04 },
1037 { 0x302c, 0x88 },
1038 { 0x302e, 0x13 },
1039 { 0x3030, 0xdf },
1040 { 0x3031, 0x05 },
1043 /* init remote controller */
1044 if (!priv->rc_active) {
1045 for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
1046 ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
1047 rc_nec_tab[i].val);
1048 if (ret)
1049 goto err;
1051 priv->rc_active = true;
1054 ret = rtl2831_rd_regs(d, SYS_IRRC_RP, buf, 5);
1055 if (ret)
1056 goto err;
1058 if (buf[4] & 0x01) {
1059 if (buf[2] == (u8) ~buf[3]) {
1060 if (buf[0] == (u8) ~buf[1]) {
1061 /* NEC standard (16 bit) */
1062 rc_code = buf[0] << 8 | buf[2];
1063 } else {
1064 /* NEC extended (24 bit) */
1065 rc_code = buf[0] << 16 |
1066 buf[1] << 8 | buf[2];
1068 } else {
1069 /* NEC full (32 bit) */
1070 rc_code = buf[0] << 24 | buf[1] << 16 |
1071 buf[2] << 8 | buf[3];
1074 rc_keydown(d->rc_dev, rc_code, 0);
1076 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1077 if (ret)
1078 goto err;
1080 /* repeated intentionally to avoid extra keypress */
1081 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1082 if (ret)
1083 goto err;
1086 return ret;
1087 err:
1088 deb_info("%s: failed=%d\n", __func__, ret);
1089 return ret;
1092 static int rtl2832u_rc_query(struct dvb_usb_device *d)
1094 int ret, i;
1095 struct rtl28xxu_priv *priv = d->priv;
1096 u8 buf[128];
1097 int len;
1098 struct rtl28xxu_reg_val rc_nec_tab[] = {
1099 { IR_RX_CTRL, 0x20 },
1100 { IR_RX_BUF_CTRL, 0x80 },
1101 { IR_RX_IF, 0xff },
1102 { IR_RX_IE, 0xff },
1103 { IR_MAX_DURATION0, 0xd0 },
1104 { IR_MAX_DURATION1, 0x07 },
1105 { IR_IDLE_LEN0, 0xc0 },
1106 { IR_IDLE_LEN1, 0x00 },
1107 { IR_GLITCH_LEN, 0x03 },
1108 { IR_RX_CLK, 0x09 },
1109 { IR_RX_CFG, 0x1c },
1110 { IR_MAX_H_TOL_LEN, 0x1e },
1111 { IR_MAX_L_TOL_LEN, 0x1e },
1112 { IR_RX_CTRL, 0x80 },
1115 /* init remote controller */
1116 if (!priv->rc_active) {
1117 for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
1118 ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
1119 rc_nec_tab[i].val);
1120 if (ret)
1121 goto err;
1123 priv->rc_active = true;
1126 ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
1127 if (ret)
1128 goto err;
1130 if (buf[0] != 0x83)
1131 goto exit;
1133 ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
1134 if (ret)
1135 goto err;
1137 len = buf[0];
1138 ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
1140 /* TODO: pass raw IR to Kernel IR decoder */
1142 ret = rtl28xx_wr_reg(d, IR_RX_IF, 0x03);
1143 ret = rtl28xx_wr_reg(d, IR_RX_BUF_CTRL, 0x80);
1144 ret = rtl28xx_wr_reg(d, IR_RX_CTRL, 0x80);
1146 exit:
1147 return ret;
1148 err:
1149 deb_info("%s: failed=%d\n", __func__, ret);
1150 return ret;
1153 enum rtl28xxu_usb_table_entry {
1154 RTL2831U_0BDA_2831,
1155 RTL2831U_14AA_0160,
1156 RTL2831U_14AA_0161,
1157 RTL2832U_0CCD_00A9,
1158 RTL2832U_1F4D_B803,
1159 RTL2832U_0CCD_00B3,
1162 static struct usb_device_id rtl28xxu_table[] = {
1163 /* RTL2831U */
1164 [RTL2831U_0BDA_2831] = {
1165 USB_DEVICE(USB_VID_REALTEK, USB_PID_REALTEK_RTL2831U)},
1166 [RTL2831U_14AA_0160] = {
1167 USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT)},
1168 [RTL2831U_14AA_0161] = {
1169 USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT_2)},
1171 /* RTL2832U */
1172 [RTL2832U_0CCD_00A9] = {
1173 USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1)},
1174 [RTL2832U_1F4D_B803] = {
1175 USB_DEVICE(USB_VID_GTEK, USB_PID_DELOCK_USB2_DVBT)},
1176 [RTL2832U_0CCD_00B3] = {
1177 USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK)},
1178 {} /* terminating entry */
1181 MODULE_DEVICE_TABLE(usb, rtl28xxu_table);
1183 static struct dvb_usb_device_properties rtl28xxu_properties[] = {
1185 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1187 .usb_ctrl = DEVICE_SPECIFIC,
1188 .no_reconnect = 1,
1190 .size_of_priv = sizeof(struct rtl28xxu_priv),
1192 .num_adapters = 1,
1193 .adapter = {
1195 .num_frontends = 1,
1196 .fe = {
1198 .frontend_attach = rtl2831u_frontend_attach,
1199 .tuner_attach = rtl2831u_tuner_attach,
1200 .streaming_ctrl = rtl2831u_streaming_ctrl,
1201 .stream = {
1202 .type = USB_BULK,
1203 .count = 6,
1204 .endpoint = 0x81,
1205 .u = {
1206 .bulk = {
1207 .buffersize = 8*512,
1216 .power_ctrl = rtl2831u_power_ctrl,
1218 .rc.core = {
1219 .protocol = RC_TYPE_NEC,
1220 .module_name = "rtl28xxu",
1221 .rc_query = rtl2831u_rc_query,
1222 .rc_interval = 400,
1223 .allowed_protos = RC_TYPE_NEC,
1224 .rc_codes = RC_MAP_EMPTY,
1227 .i2c_algo = &rtl28xxu_i2c_algo,
1229 .num_device_descs = 2,
1230 .devices = {
1232 .name = "Realtek RTL2831U reference design",
1233 .warm_ids = {
1234 &rtl28xxu_table[RTL2831U_0BDA_2831],
1238 .name = "Freecom USB2.0 DVB-T",
1239 .warm_ids = {
1240 &rtl28xxu_table[RTL2831U_14AA_0160],
1241 &rtl28xxu_table[RTL2831U_14AA_0161],
1247 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1249 .usb_ctrl = DEVICE_SPECIFIC,
1250 .no_reconnect = 1,
1252 .size_of_priv = sizeof(struct rtl28xxu_priv),
1254 .num_adapters = 1,
1255 .adapter = {
1257 .num_frontends = 1,
1258 .fe = {
1260 .frontend_attach = rtl2832u_frontend_attach,
1261 .tuner_attach = rtl2832u_tuner_attach,
1262 .streaming_ctrl = rtl2832u_streaming_ctrl,
1263 .stream = {
1264 .type = USB_BULK,
1265 .count = 6,
1266 .endpoint = 0x81,
1267 .u = {
1268 .bulk = {
1269 .buffersize = 8*512,
1278 .power_ctrl = rtl2832u_power_ctrl,
1280 .rc.core = {
1281 .protocol = RC_TYPE_NEC,
1282 .module_name = "rtl28xxu",
1283 .rc_query = rtl2832u_rc_query,
1284 .rc_interval = 400,
1285 .allowed_protos = RC_TYPE_NEC,
1286 .rc_codes = RC_MAP_EMPTY,
1289 .i2c_algo = &rtl28xxu_i2c_algo,
1291 .num_device_descs = 3,
1292 .devices = {
1294 .name = "Terratec Cinergy T Stick Black",
1295 .warm_ids = {
1296 &rtl28xxu_table[RTL2832U_0CCD_00A9],
1300 .name = "G-Tek Electronics Group Lifeview LV5TDLX DVB-T",
1301 .warm_ids = {
1302 &rtl28xxu_table[RTL2832U_1F4D_B803],
1306 .name = "NOXON DAB/DAB+ USB dongle",
1307 .warm_ids = {
1308 &rtl28xxu_table[RTL2832U_0CCD_00B3],
1316 static int rtl28xxu_probe(struct usb_interface *intf,
1317 const struct usb_device_id *id)
1319 int ret, i;
1320 u8 val;
1321 int properties_count = ARRAY_SIZE(rtl28xxu_properties);
1322 struct dvb_usb_device *d;
1323 struct usb_device *udev;
1324 bool found;
1326 deb_info("%s: interface=%d\n", __func__,
1327 intf->cur_altsetting->desc.bInterfaceNumber);
1329 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
1330 return 0;
1332 /* Dynamic USB ID support. Replaces first device ID with current one .*/
1333 udev = interface_to_usbdev(intf);
1335 for (i = 0, found = false; i < ARRAY_SIZE(rtl28xxu_table) - 1; i++) {
1336 if (rtl28xxu_table[i].idVendor ==
1337 le16_to_cpu(udev->descriptor.idVendor) &&
1338 rtl28xxu_table[i].idProduct ==
1339 le16_to_cpu(udev->descriptor.idProduct)) {
1340 found = true;
1341 break;
1345 if (!found) {
1346 deb_info("%s: using dynamic ID %04x:%04x\n", __func__,
1347 le16_to_cpu(udev->descriptor.idVendor),
1348 le16_to_cpu(udev->descriptor.idProduct));
1349 rtl28xxu_properties[0].devices[0].warm_ids[0]->idVendor =
1350 le16_to_cpu(udev->descriptor.idVendor);
1351 rtl28xxu_properties[0].devices[0].warm_ids[0]->idProduct =
1352 le16_to_cpu(udev->descriptor.idProduct);
1355 for (i = 0; i < properties_count; i++) {
1356 ret = dvb_usb_device_init(intf, &rtl28xxu_properties[i],
1357 THIS_MODULE, &d, adapter_nr);
1358 if (ret == 0 || ret != -ENODEV)
1359 break;
1362 if (ret)
1363 goto err;
1366 /* init USB endpoints */
1367 ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
1368 if (ret)
1369 goto err;
1371 /* enable DMA and Full Packet Mode*/
1372 val |= 0x09;
1373 ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
1374 if (ret)
1375 goto err;
1377 /* set EPA maximum packet size to 0x0200 */
1378 ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
1379 if (ret)
1380 goto err;
1382 /* change EPA FIFO length */
1383 ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
1384 if (ret)
1385 goto err;
1387 return ret;
1388 err:
1389 deb_info("%s: failed=%d\n", __func__, ret);
1390 return ret;
1393 static struct usb_driver rtl28xxu_driver = {
1394 .name = "dvb_usb_rtl28xxu",
1395 .probe = rtl28xxu_probe,
1396 .disconnect = dvb_usb_device_exit,
1397 .id_table = rtl28xxu_table,
1400 /* module stuff */
1401 static int __init rtl28xxu_module_init(void)
1403 int ret;
1405 deb_info("%s:\n", __func__);
1407 ret = usb_register(&rtl28xxu_driver);
1408 if (ret)
1409 err("usb_register failed=%d", ret);
1411 return ret;
1414 static void __exit rtl28xxu_module_exit(void)
1416 deb_info("%s:\n", __func__);
1418 /* deregister this driver from the USB subsystem */
1419 usb_deregister(&rtl28xxu_driver);
1422 module_init(rtl28xxu_module_init);
1423 module_exit(rtl28xxu_module_exit);
1425 MODULE_DESCRIPTION("Realtek RTL28xxU DVB USB driver");
1426 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1427 MODULE_AUTHOR("Thomas Mair <thomas.mair86@googlemail.com>");
1428 MODULE_LICENSE("GPL");