Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 1 | /* DVB USB compliant Linux driver for the TwinhanDTV StarBox USB2.0 DVB-S |
| 2 | * receiver. |
| 3 | * |
| 4 | * Copyright (C) 2005 Ralph Metzler <rjkm@metzlerbros.de> |
| 5 | * Metzler Brothers Systementwicklung GbR |
| 6 | * |
| 7 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> |
| 8 | * |
| 9 | * Thanks to Twinhan who kindly provided hardware and information. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License as published by the Free |
| 13 | * Software Foundation, version 2. |
| 14 | * |
| 15 | * see Documentation/dvb/README.dvb-usb for more information |
| 16 | */ |
| 17 | #include "vp702x.h" |
Florian Mickler | 1c6410f | 2011-03-21 07:19:08 -0300 | [diff] [blame^] | 18 | #include <linux/mutex.h> |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 19 | |
| 20 | /* debug */ |
| 21 | int dvb_usb_vp702x_debug; |
| 22 | module_param_named(debug,dvb_usb_vp702x_debug, int, 0644); |
| 23 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); |
| 24 | |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 26 | |
Florian Mickler | 36f773e | 2011-03-21 07:19:07 -0300 | [diff] [blame] | 27 | struct vp702x_adapter_state { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 28 | int pid_filter_count; |
| 29 | int pid_filter_can_bypass; |
| 30 | u8 pid_filter_state; |
| 31 | }; |
| 32 | |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 33 | /* check for mutex FIXME */ |
| 34 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) |
| 35 | { |
Florian Mickler | d30615d | 2011-03-21 07:19:06 -0300 | [diff] [blame] | 36 | int ret; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 37 | |
Florian Mickler | d30615d | 2011-03-21 07:19:06 -0300 | [diff] [blame] | 38 | ret = usb_control_msg(d->udev, |
| 39 | usb_rcvctrlpipe(d->udev, 0), |
| 40 | req, |
| 41 | USB_TYPE_VENDOR | USB_DIR_IN, |
| 42 | value, index, b, blen, |
| 43 | 2000); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 44 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 45 | if (ret < 0) { |
| 46 | warn("usb in operation failed. (%d)", ret); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 47 | ret = -EIO; |
| 48 | } else |
| 49 | ret = 0; |
| 50 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 51 | |
| 52 | deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 53 | debug_dump(b,blen,deb_xfer); |
| 54 | |
| 55 | return ret; |
| 56 | } |
| 57 | |
Adrian Bunk | 5e7361a | 2007-11-05 14:06:47 -0300 | [diff] [blame] | 58 | static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 59 | u16 index, u8 *b, int blen) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 60 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 61 | int ret; |
| 62 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 63 | debug_dump(b,blen,deb_xfer); |
| 64 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 65 | if ((ret = usb_control_msg(d->udev, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 66 | usb_sndctrlpipe(d->udev,0), |
| 67 | req, |
| 68 | USB_TYPE_VENDOR | USB_DIR_OUT, |
| 69 | value,index,b,blen, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 70 | 2000)) != blen) { |
| 71 | warn("usb out operation failed. (%d)",ret); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 72 | return -EIO; |
| 73 | } else |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec) |
| 78 | { |
| 79 | int ret; |
| 80 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 81 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 82 | return ret; |
| 83 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 84 | ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 85 | msleep(msec); |
| 86 | ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen); |
| 87 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 88 | mutex_unlock(&d->usb_mutex); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 89 | |
| 90 | return ret; |
| 91 | } |
| 92 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 93 | static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, |
| 94 | int olen, u8 *i, int ilen, int msec) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 95 | { |
| 96 | u8 bout[olen+2]; |
| 97 | u8 bin[ilen+1]; |
| 98 | int ret = 0; |
| 99 | |
| 100 | bout[0] = 0x00; |
| 101 | bout[1] = cmd; |
| 102 | memcpy(&bout[2],o,olen); |
| 103 | |
| 104 | ret = vp702x_usb_inout_op(d, bout, olen+2, bin, ilen+1,msec); |
| 105 | |
| 106 | if (ret == 0) |
| 107 | memcpy(i,&bin[1],ilen); |
| 108 | |
| 109 | return ret; |
| 110 | } |
| 111 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 112 | static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 113 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 114 | u8 buf[16] = { 0 }; |
| 115 | return vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e, 0, buf, 16); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 118 | static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 119 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 120 | u8 buf[16] = { 0 }; |
| 121 | return vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f, 0, buf, 16); |
| 122 | } |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 123 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 124 | static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff) |
| 125 | { |
Florian Mickler | 36f773e | 2011-03-21 07:19:07 -0300 | [diff] [blame] | 126 | struct vp702x_adapter_state *st = adap->priv; |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 127 | u8 buf[16] = { 0 }; |
| 128 | |
| 129 | if (onoff) |
| 130 | st->pid_filter_state |= (1 << id); |
| 131 | else { |
| 132 | st->pid_filter_state &= ~(1 << id); |
| 133 | pid = 0xffff; |
| 134 | } |
| 135 | |
| 136 | id = 0x10 + id*2; |
| 137 | |
| 138 | vp702x_set_pld_state(adap, st->pid_filter_state); |
| 139 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16); |
| 140 | vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16); |
| 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | |
| 145 | static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap) |
| 146 | { |
Florian Mickler | 36f773e | 2011-03-21 07:19:07 -0300 | [diff] [blame] | 147 | struct vp702x_adapter_state *st = adap->priv; |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 148 | int i; |
| 149 | u8 b[10] = { 0 }; |
| 150 | |
| 151 | st->pid_filter_count = 8; |
| 152 | st->pid_filter_can_bypass = 1; |
| 153 | st->pid_filter_state = 0x00; |
| 154 | |
| 155 | vp702x_set_pld_mode(adap, 1); // bypass |
| 156 | |
| 157 | for (i = 0; i < st->pid_filter_count; i++) |
| 158 | vp702x_set_pid(adap, 0xffff, i, 1); |
| 159 | |
| 160 | vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10); |
| 161 | vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10); |
| 162 | vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10); |
| 163 | |
| 164 | //vp702x_set_pld_mode(d, 0); // filter |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
| 169 | { |
| 170 | return 0; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /* keys for the enclosed remote control */ |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 174 | static struct rc_map_table rc_map_vp702x_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 175 | { 0x0001, KEY_1 }, |
| 176 | { 0x0002, KEY_2 }, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | /* remote control stuff (does not work with my box) */ |
| 180 | static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 181 | { |
| 182 | u8 key[10]; |
| 183 | int i; |
| 184 | |
| 185 | /* remove the following return to enabled remote querying */ |
| 186 | return 0; |
| 187 | |
| 188 | vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10); |
| 189 | |
| 190 | deb_rc("remote query key: %x %d\n",key[1],key[1]); |
| 191 | |
| 192 | if (key[1] == 0x44) { |
| 193 | *state = REMOTE_NO_KEY_PRESSED; |
| 194 | return 0; |
| 195 | } |
| 196 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 197 | for (i = 0; i < ARRAY_SIZE(rc_map_vp702x_table); i++) |
| 198 | if (rc5_custom(&rc_map_vp702x_table[i]) == key[1]) { |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 199 | *state = REMOTE_KEY_PRESSED; |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 200 | *event = rc_map_vp702x_table[i].keycode; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 201 | break; |
| 202 | } |
| 203 | return 0; |
| 204 | } |
| 205 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 206 | |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 207 | static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) |
| 208 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 209 | u8 i; |
| 210 | for (i = 6; i < 12; i++) |
| 211 | vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &mac[i - 6], 1); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 212 | return 0; |
| 213 | } |
| 214 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 215 | static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 216 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 217 | u8 buf[10] = { 0 }; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 218 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 219 | vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); |
| 220 | |
Florian Mickler | d30615d | 2011-03-21 07:19:06 -0300 | [diff] [blame] | 221 | if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, |
| 222 | buf, 10, 10)) |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 223 | return -EIO; |
| 224 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 225 | buf[9] = '\0'; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 226 | info("system string: %s",&buf[1]); |
| 227 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 228 | vp702x_init_pid_filter(adap); |
| 229 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 230 | adap->fe = vp702x_fe_attach(adap->dev); |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 231 | vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 1, 7, NULL, 0); |
| 232 | |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 233 | return 0; |
| 234 | } |
| 235 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 236 | static struct dvb_usb_device_properties vp702x_properties; |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 237 | |
| 238 | static int vp702x_usb_probe(struct usb_interface *intf, |
| 239 | const struct usb_device_id *id) |
| 240 | { |
Florian Mickler | 1c6410f | 2011-03-21 07:19:08 -0300 | [diff] [blame^] | 241 | struct dvb_usb_device *d; |
| 242 | struct vp702x_device_state *st; |
| 243 | int ret; |
| 244 | |
| 245 | ret = dvb_usb_device_init(intf, &vp702x_properties, |
| 246 | THIS_MODULE, &d, adapter_nr); |
| 247 | if (ret) |
| 248 | goto out; |
| 249 | |
| 250 | st = d->priv; |
| 251 | st->buf_len = 16; |
| 252 | st->buf = kmalloc(st->buf_len, GFP_KERNEL); |
| 253 | if (!st->buf) { |
| 254 | ret = -ENOMEM; |
| 255 | dvb_usb_device_exit(intf); |
| 256 | goto out; |
| 257 | } |
| 258 | mutex_init(&st->buf_mutex); |
| 259 | |
| 260 | out: |
| 261 | return ret; |
| 262 | |
| 263 | } |
| 264 | |
| 265 | static void vp702x_usb_disconnect(struct usb_interface *intf) |
| 266 | { |
| 267 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
| 268 | struct vp702x_device_state *st = d->priv; |
| 269 | mutex_lock(&st->buf_mutex); |
| 270 | kfree(st->buf); |
| 271 | mutex_unlock(&st->buf_mutex); |
| 272 | dvb_usb_device_exit(intf); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | static struct usb_device_id vp702x_usb_table [] = { |
| 276 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_COLD) }, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 277 | // { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_COLD) }, |
| 278 | // { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_WARM) }, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 279 | { 0 }, |
| 280 | }; |
| 281 | MODULE_DEVICE_TABLE(usb, vp702x_usb_table); |
| 282 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 283 | static struct dvb_usb_device_properties vp702x_properties = { |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 284 | .usb_ctrl = CYPRESS_FX2, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 285 | .firmware = "dvb-usb-vp702x-02.fw", |
| 286 | .no_reconnect = 1, |
| 287 | |
| 288 | .size_of_priv = sizeof(struct vp702x_device_state), |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 289 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 290 | .num_adapters = 1, |
| 291 | .adapter = { |
| 292 | { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 293 | .caps = DVB_USB_ADAP_RECEIVES_204_BYTE_TS, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 294 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 295 | .streaming_ctrl = vp702x_streaming_ctrl, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 296 | .frontend_attach = vp702x_frontend_attach, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 297 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 298 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 299 | .stream = { |
| 300 | .type = USB_BULK, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 301 | .count = 10, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 302 | .endpoint = 0x02, |
| 303 | .u = { |
| 304 | .bulk = { |
| 305 | .buffersize = 4096, |
| 306 | } |
| 307 | } |
| 308 | }, |
Florian Mickler | 36f773e | 2011-03-21 07:19:07 -0300 | [diff] [blame] | 309 | .size_of_priv = sizeof(struct vp702x_adapter_state), |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 310 | } |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 311 | }, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 312 | .read_mac_address = vp702x_read_mac_addr, |
| 313 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 314 | .rc.legacy = { |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 315 | .rc_map_table = rc_map_vp702x_table, |
| 316 | .rc_map_size = ARRAY_SIZE(rc_map_vp702x_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 317 | .rc_interval = 400, |
| 318 | .rc_query = vp702x_rc_query, |
| 319 | }, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 320 | |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 321 | .num_device_descs = 1, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 322 | .devices = { |
| 323 | { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7021)", |
| 324 | .cold_ids = { &vp702x_usb_table[0], NULL }, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 325 | .warm_ids = { NULL }, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 326 | }, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 327 | /* { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7020)", |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 328 | .cold_ids = { &vp702x_usb_table[2], NULL }, |
| 329 | .warm_ids = { &vp702x_usb_table[3], NULL }, |
| 330 | }, |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 331 | */ { NULL }, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 332 | } |
| 333 | }; |
| 334 | |
| 335 | /* usb specific object needed to register this driver with the usb subsystem */ |
| 336 | static struct usb_driver vp702x_usb_driver = { |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 337 | .name = "dvb_usb_vp702x", |
Florian Mickler | d30615d | 2011-03-21 07:19:06 -0300 | [diff] [blame] | 338 | .probe = vp702x_usb_probe, |
Florian Mickler | 1c6410f | 2011-03-21 07:19:08 -0300 | [diff] [blame^] | 339 | .disconnect = vp702x_usb_disconnect, |
Florian Mickler | d30615d | 2011-03-21 07:19:06 -0300 | [diff] [blame] | 340 | .id_table = vp702x_usb_table, |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 341 | }; |
| 342 | |
| 343 | /* module stuff */ |
| 344 | static int __init vp702x_usb_module_init(void) |
| 345 | { |
| 346 | int result; |
| 347 | if ((result = usb_register(&vp702x_usb_driver))) { |
| 348 | err("usb_register failed. (%d)",result); |
| 349 | return result; |
| 350 | } |
| 351 | |
| 352 | return 0; |
| 353 | } |
| 354 | |
| 355 | static void __exit vp702x_usb_module_exit(void) |
| 356 | { |
| 357 | /* deregister this driver from the USB subsystem */ |
| 358 | usb_deregister(&vp702x_usb_driver); |
| 359 | } |
| 360 | |
| 361 | module_init(vp702x_usb_module_init); |
| 362 | module_exit(vp702x_usb_module_exit); |
| 363 | |
| 364 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); |
| 365 | MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones"); |
Patrick Boettcher | 0540c49 | 2006-09-19 12:51:43 -0300 | [diff] [blame] | 366 | MODULE_VERSION("1.0"); |
Patrick Boettcher | 3706a4d | 2005-09-09 13:02:41 -0700 | [diff] [blame] | 367 | MODULE_LICENSE("GPL"); |