Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1 | /* DVB USB compliant linux driver for MSI Mega Sky 580 DVB-T USB2.0 receiver |
| 2 | * |
| 3 | * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 6 | * under the terms of the GNU General Public License as published by the |
| 7 | * Free Software Foundation, version 2. |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 8 | * |
Mauro Carvalho Chehab | 670d7adb | 2018-05-08 18:29:30 -0300 | [diff] [blame] | 9 | * see Documentation/media/dvb-drivers/dvb-usb.rst for more information |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 10 | */ |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 11 | |
Michael Krufky | 2aef7d0 | 2006-09-23 20:00:42 -0300 | [diff] [blame] | 12 | #include "m920x.h" |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 13 | |
| 14 | #include "mt352.h" |
| 15 | #include "mt352_priv.h" |
Michael Krufky | 017cf01 | 2006-09-23 20:40:20 -0300 | [diff] [blame] | 16 | #include "qt1010.h" |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 17 | #include "tda1004x.h" |
| 18 | #include "tda827x.h" |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 19 | #include "mt2060.h" |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 20 | |
| 21 | #include <media/tuner.h> |
| 22 | #include "tuner-simple.h" |
Al Viro | fa9c13a | 2008-05-21 00:32:41 -0300 | [diff] [blame] | 23 | #include <asm/unaligned.h> |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 24 | |
| 25 | /* debug */ |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 26 | static int dvb_usb_m920x_debug; |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 27 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 28 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
| 29 | |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 30 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 31 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 32 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); |
| 33 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 34 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 35 | u16 index, void *data, int size) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 36 | { |
| 37 | int ret; |
| 38 | |
| 39 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
| 40 | request, USB_TYPE_VENDOR | USB_DIR_IN, |
| 41 | value, index, data, size, 2000); |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 42 | if (ret < 0) { |
| 43 | printk(KERN_INFO "m920x_read = error: %d\n", ret); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 44 | return ret; |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 45 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 46 | |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 47 | if (ret != size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 48 | deb("m920x_read = no data\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 49 | return -EIO; |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 50 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 55 | static inline int m920x_write(struct usb_device *udev, u8 request, |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 56 | u16 value, u16 index) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 57 | { |
Masahiro Yamada | 29a8d97 | 2016-09-06 19:52:24 -0300 | [diff] [blame] | 58 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request, |
| 59 | USB_TYPE_VENDOR | USB_DIR_OUT, value, index, |
| 60 | NULL, 0, 2000); |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 61 | } |
| 62 | |
Antonio Ospite | 7543f34 | 2012-12-10 17:37:11 -0300 | [diff] [blame] | 63 | static inline int m920x_write_seq(struct usb_device *udev, u8 request, |
| 64 | struct m920x_inits *seq) |
| 65 | { |
| 66 | int ret; |
Paul Bolle | b78a1f3 | 2013-03-04 09:43:20 -0300 | [diff] [blame] | 67 | do { |
Antonio Ospite | 7543f34 | 2012-12-10 17:37:11 -0300 | [diff] [blame] | 68 | ret = m920x_write(udev, request, seq->data, seq->address); |
| 69 | if (ret != 0) |
| 70 | return ret; |
| 71 | |
| 72 | seq++; |
Paul Bolle | b78a1f3 | 2013-03-04 09:43:20 -0300 | [diff] [blame] | 73 | } while (seq->address); |
Antonio Ospite | 7543f34 | 2012-12-10 17:37:11 -0300 | [diff] [blame] | 74 | |
Jean Delvare | b0efc3e | 2013-03-31 07:16:37 -0300 | [diff] [blame] | 75 | return 0; |
Antonio Ospite | 7543f34 | 2012-12-10 17:37:11 -0300 | [diff] [blame] | 76 | } |
| 77 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 78 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 79 | { |
Jean Delvare | b0efc3e | 2013-03-31 07:16:37 -0300 | [diff] [blame] | 80 | int ret, i, epi, flags = 0; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 81 | int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 82 | |
| 83 | /* Remote controller init. */ |
Antonio Ospite | 68511a7 | 2012-12-10 17:37:15 -0300 | [diff] [blame] | 84 | if (d->props.rc.legacy.rc_query || d->props.rc.core.rc_query) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 85 | deb("Initialising remote control\n"); |
Antonio Ospite | 7543f34 | 2012-12-10 17:37:11 -0300 | [diff] [blame] | 86 | ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq); |
| 87 | if (ret != 0) { |
| 88 | deb("Initialising remote control failed\n"); |
| 89 | return ret; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 90 | } |
| 91 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 92 | deb("Initialising remote control success\n"); |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 93 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 94 | |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 95 | for (i = 0; i < d->props.num_adapters; i++) |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 96 | flags |= d->adapter[i].props.fe[0].caps; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 97 | |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 98 | /* Some devices(Dposh) might crash if we attempt touch at all. */ |
| 99 | if (flags & DVB_USB_ADAP_HAS_PID_FILTER) { |
| 100 | for (i = 0; i < d->props.num_adapters; i++) { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 101 | epi = d->adapter[i].props.fe[0].stream.endpoint - 0x81; |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 102 | |
| 103 | if (epi < 0 || epi >= M9206_MAX_ADAPTERS) { |
| 104 | printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n"); |
| 105 | return -EINVAL; |
| 106 | } |
| 107 | |
| 108 | adap_enabled[epi] = 1; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 109 | } |
| 110 | |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 111 | for (i = 0; i < M9206_MAX_ADAPTERS; i++) { |
| 112 | if (adap_enabled[i]) |
| 113 | continue; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 114 | |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 115 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0) |
| 116 | return ret; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 117 | |
Aapo Tahkola | 3847b22 | 2007-05-08 18:21:47 -0300 | [diff] [blame] | 118 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0) |
| 119 | return ret; |
| 120 | } |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 121 | } |
| 122 | |
Jean Delvare | b0efc3e | 2013-03-31 07:16:37 -0300 | [diff] [blame] | 123 | return 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 124 | } |
| 125 | |
Aapo Tahkola | 55bbe5e | 2007-05-08 12:56:54 -0300 | [diff] [blame] | 126 | static int m920x_init_ep(struct usb_interface *intf) |
| 127 | { |
| 128 | struct usb_device *udev = interface_to_usbdev(intf); |
| 129 | struct usb_host_interface *alt; |
| 130 | |
| 131 | if ((alt = usb_altnum_to_altsetting(intf, 1)) == NULL) { |
| 132 | deb("No alt found!\n"); |
| 133 | return -ENODEV; |
| 134 | } |
| 135 | |
| 136 | return usb_set_interface(udev, alt->desc.bInterfaceNumber, |
| 137 | alt->desc.bAlternateSetting); |
| 138 | } |
| 139 | |
Antonio Ospite | f526e9e | 2012-12-10 17:37:12 -0300 | [diff] [blame] | 140 | static inline void m920x_parse_rc_state(struct dvb_usb_device *d, u8 rc_state, |
| 141 | int *state) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 142 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 143 | struct m920x_state *m = d->priv; |
Antonio Ospite | f526e9e | 2012-12-10 17:37:12 -0300 | [diff] [blame] | 144 | |
| 145 | switch (rc_state) { |
| 146 | case 0x80: |
| 147 | *state = REMOTE_NO_KEY_PRESSED; |
| 148 | break; |
| 149 | |
| 150 | case 0x88: /* framing error or "invalid code" */ |
| 151 | case 0x99: |
| 152 | case 0xc0: |
| 153 | case 0xd8: |
| 154 | *state = REMOTE_NO_KEY_PRESSED; |
| 155 | m->rep_count = 0; |
| 156 | break; |
| 157 | |
| 158 | case 0x93: |
| 159 | case 0x92: |
| 160 | case 0x83: /* pinnacle PCTV310e */ |
| 161 | case 0x82: |
| 162 | m->rep_count = 0; |
| 163 | *state = REMOTE_KEY_PRESSED; |
| 164 | break; |
| 165 | |
| 166 | case 0x91: |
| 167 | case 0x81: /* pinnacle PCTV310e */ |
| 168 | /* prevent immediate auto-repeat */ |
| 169 | if (++m->rep_count > 2) |
| 170 | *state = REMOTE_KEY_REPEAT; |
| 171 | else |
| 172 | *state = REMOTE_NO_KEY_PRESSED; |
| 173 | break; |
| 174 | |
| 175 | default: |
| 176 | deb("Unexpected rc state %02x\n", rc_state); |
| 177 | *state = REMOTE_NO_KEY_PRESSED; |
| 178 | break; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 183 | { |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 184 | int i, ret = 0; |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 185 | u8 *rc_state; |
| 186 | |
| 187 | rc_state = kmalloc(2, GFP_KERNEL); |
| 188 | if (!rc_state) |
| 189 | return -ENOMEM; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 190 | |
Mauro Carvalho Chehab | 9d5394c | 2012-12-27 16:32:58 -0200 | [diff] [blame] | 191 | ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, |
| 192 | rc_state, 1); |
| 193 | if (ret != 0) |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 194 | goto out; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 195 | |
Mauro Carvalho Chehab | 9d5394c | 2012-12-27 16:32:58 -0200 | [diff] [blame] | 196 | ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, |
| 197 | rc_state + 1, 1); |
| 198 | if (ret != 0) |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 199 | goto out; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 200 | |
Antonio Ospite | 7a7ef46 | 2012-12-10 17:37:13 -0300 | [diff] [blame] | 201 | m920x_parse_rc_state(d, rc_state[0], state); |
| 202 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 203 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) |
| 204 | if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { |
| 205 | *event = d->props.rc.legacy.rc_map_table[i].keycode; |
Antonio Ospite | f526e9e | 2012-12-10 17:37:12 -0300 | [diff] [blame] | 206 | goto out; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | if (rc_state[1] != 0) |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 210 | deb("Unknown rc key %02x\n", rc_state[1]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 211 | |
| 212 | *state = REMOTE_NO_KEY_PRESSED; |
| 213 | |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 214 | out: |
| 215 | kfree(rc_state); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 216 | return ret; |
| 217 | } |
| 218 | |
Antonio Ospite | b677757 | 2012-12-10 17:37:14 -0300 | [diff] [blame] | 219 | static int m920x_rc_core_query(struct dvb_usb_device *d) |
| 220 | { |
| 221 | int ret = 0; |
| 222 | u8 *rc_state; |
| 223 | int state; |
| 224 | |
| 225 | rc_state = kmalloc(2, GFP_KERNEL); |
| 226 | if (!rc_state) |
| 227 | return -ENOMEM; |
| 228 | |
| 229 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, &rc_state[0], 1)) != 0) |
| 230 | goto out; |
| 231 | |
| 232 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, &rc_state[1], 1)) != 0) |
| 233 | goto out; |
| 234 | |
| 235 | deb("state=0x%02x keycode=0x%02x\n", rc_state[0], rc_state[1]); |
| 236 | |
| 237 | m920x_parse_rc_state(d, rc_state[0], &state); |
| 238 | |
| 239 | if (state == REMOTE_NO_KEY_PRESSED) |
| 240 | rc_keyup(d->rc_dev); |
| 241 | else if (state == REMOTE_KEY_REPEAT) |
| 242 | rc_repeat(d->rc_dev); |
| 243 | else |
Sean Young | 6d741bf | 2017-08-07 16:20:58 -0400 | [diff] [blame] | 244 | rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN, rc_state[1], 0); |
Antonio Ospite | b677757 | 2012-12-10 17:37:14 -0300 | [diff] [blame] | 245 | |
| 246 | out: |
| 247 | kfree(rc_state); |
| 248 | return ret; |
| 249 | } |
| 250 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 251 | /* I2C */ |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 252 | static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 253 | { |
| 254 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 255 | int i, j; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 256 | int ret = 0; |
| 257 | |
| 258 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 259 | return -EAGAIN; |
| 260 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 261 | for (i = 0; i < num; i++) { |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 262 | if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) { |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 263 | /* For a 0 byte message, I think sending the address |
| 264 | * to index 0x80|0x40 would be the correct thing to |
| 265 | * do. However, zero byte messages are only used for |
| 266 | * probing, and since we don't know how to get the |
| 267 | * slave's ack, we can't probe. */ |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 268 | ret = -ENOTSUPP; |
| 269 | goto unlock; |
| 270 | } |
| 271 | /* Send START & address/RW bit */ |
| 272 | if (!(msg[i].flags & I2C_M_NOSTART)) { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 273 | if ((ret = m920x_write(d->udev, M9206_I2C, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 274 | (msg[i].addr << 1) | |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 275 | (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 276 | goto unlock; |
| 277 | /* Should check for ack here, if we knew how. */ |
| 278 | } |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 279 | if (msg[i].flags & I2C_M_RD) { |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 280 | for (j = 0; j < msg[i].len; j++) { |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 281 | /* Last byte of transaction? |
| 282 | * Send STOP, otherwise send ACK. */ |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 283 | int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01; |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 284 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 285 | if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 286 | 0x20 | stop, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 287 | &msg[i].buf[j], 1)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 288 | goto unlock; |
Aapo Tahkola | 84ad757 | 2007-01-21 15:57:20 -0300 | [diff] [blame] | 289 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 290 | } else { |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 291 | for (j = 0; j < msg[i].len; j++) { |
| 292 | /* Last byte of transaction? Then send STOP. */ |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 293 | int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00; |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 294 | |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 295 | if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 296 | goto unlock; |
| 297 | /* Should check for ack here too. */ |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 298 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 299 | } |
| 300 | } |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 301 | ret = num; |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 302 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 303 | unlock: |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 304 | mutex_unlock(&d->i2c_mutex); |
| 305 | |
| 306 | return ret; |
| 307 | } |
| 308 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 309 | static u32 m920x_i2c_func(struct i2c_adapter *adapter) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 310 | { |
| 311 | return I2C_FUNC_I2C; |
| 312 | } |
| 313 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 314 | static struct i2c_algorithm m920x_i2c_algo = { |
| 315 | .master_xfer = m920x_i2c_xfer, |
| 316 | .functionality = m920x_i2c_func, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 317 | }; |
| 318 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 319 | /* pid filter */ |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 320 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 321 | { |
| 322 | int ret = 0; |
| 323 | |
| 324 | if (pid >= 0x8000) |
| 325 | return -EINVAL; |
| 326 | |
| 327 | pid |= 0x8000; |
| 328 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 329 | if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 330 | return ret; |
| 331 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 332 | if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 333 | return ret; |
| 334 | |
| 335 | return ret; |
| 336 | } |
| 337 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 338 | static int m920x_update_filters(struct dvb_usb_adapter *adap) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 339 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 340 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 341 | int enabled = m->filtering_enabled[adap->id]; |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 342 | int i, ret = 0, filter = 0; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 343 | int ep = adap->props.fe[0].stream.endpoint; |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 344 | |
| 345 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 346 | if (m->filters[adap->id][i] == 8192) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 347 | enabled = 0; |
| 348 | |
| 349 | /* Disable all filters */ |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 350 | if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 351 | return ret; |
| 352 | |
| 353 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 354 | if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 355 | return ret; |
| 356 | |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 357 | /* Set */ |
| 358 | if (enabled) { |
| 359 | for (i = 0; i < M9206_MAX_FILTERS; i++) { |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 360 | if (m->filters[adap->id][i] == 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 361 | continue; |
| 362 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 363 | if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 364 | return ret; |
| 365 | |
| 366 | filter++; |
| 367 | } |
| 368 | } |
| 369 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 370 | return ret; |
| 371 | } |
| 372 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 373 | static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 374 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 375 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 376 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 377 | m->filtering_enabled[adap->id] = onoff ? 1 : 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 378 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 379 | return m920x_update_filters(adap); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 380 | } |
| 381 | |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 382 | static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 383 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 384 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 385 | |
Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 386 | m->filters[adap->id][index] = onoff ? pid : 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 387 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 388 | return m920x_update_filters(adap); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 389 | } |
| 390 | |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 391 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 392 | { |
| 393 | u16 value, index, size; |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 394 | u8 *read, *buff; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 395 | int i, pass, ret = 0; |
| 396 | |
| 397 | buff = kmalloc(65536, GFP_KERNEL); |
Roel Kluin | 1601fb1 | 2009-09-18 20:09:52 -0300 | [diff] [blame] | 398 | if (buff == NULL) |
| 399 | return -ENOMEM; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 400 | |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 401 | read = kmalloc(4, GFP_KERNEL); |
| 402 | if (!read) { |
| 403 | kfree(buff); |
| 404 | return -ENOMEM; |
| 405 | } |
| 406 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 407 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 408 | goto done; |
Andy Shevchenko | 5bdb787 | 2012-09-26 09:55:14 -0300 | [diff] [blame] | 409 | deb("%*ph\n", 4, read); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 410 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 411 | if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 412 | goto done; |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 413 | deb("%x\n", read[0]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 414 | |
| 415 | for (pass = 0; pass < 2; pass++) { |
| 416 | for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { |
Al Viro | fa9c13a | 2008-05-21 00:32:41 -0300 | [diff] [blame] | 417 | value = get_unaligned_le16(fw->data + i); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 418 | i += sizeof(u16); |
| 419 | |
Al Viro | fa9c13a | 2008-05-21 00:32:41 -0300 | [diff] [blame] | 420 | index = get_unaligned_le16(fw->data + i); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 421 | i += sizeof(u16); |
| 422 | |
Al Viro | fa9c13a | 2008-05-21 00:32:41 -0300 | [diff] [blame] | 423 | size = get_unaligned_le16(fw->data + i); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 424 | i += sizeof(u16); |
| 425 | |
| 426 | if (pass == 1) { |
| 427 | /* Will stall if using fw->data ... */ |
| 428 | memcpy(buff, fw->data + i, size); |
| 429 | |
| 430 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), |
Aapo Tahkola | 9ad4eef | 2007-04-20 13:34:25 -0300 | [diff] [blame] | 431 | M9206_FW, |
| 432 | USB_TYPE_VENDOR | USB_DIR_OUT, |
| 433 | value, index, buff, size, 20); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 434 | if (ret != size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 435 | deb("error while uploading fw!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 436 | ret = -EIO; |
| 437 | goto done; |
| 438 | } |
| 439 | msleep(3); |
| 440 | } |
| 441 | i += size; |
| 442 | } |
| 443 | if (i != fw->size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 444 | deb("bad firmware file!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 445 | ret = -EINVAL; |
| 446 | goto done; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | msleep(36); |
| 451 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 452 | /* m920x will disconnect itself from the bus after this. */ |
| 453 | (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO); |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 454 | deb("firmware uploaded!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 455 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 456 | done: |
Florian Mickler | 513ea35 | 2011-03-21 15:33:45 -0300 | [diff] [blame] | 457 | kfree(read); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 458 | kfree(buff); |
| 459 | |
| 460 | return ret; |
| 461 | } |
| 462 | |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 463 | /* Callbacks for DVB USB */ |
Aapo Tahkola | 7d1d4e6 | 2007-03-15 13:01:46 -0300 | [diff] [blame] | 464 | static int m920x_identify_state(struct usb_device *udev, |
| 465 | struct dvb_usb_device_properties *props, |
| 466 | struct dvb_usb_device_description **desc, |
| 467 | int *cold) |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 468 | { |
| 469 | struct usb_host_interface *alt; |
| 470 | |
| 471 | alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1); |
| 472 | *cold = (alt == NULL) ? 1 : 0; |
| 473 | |
| 474 | return 0; |
| 475 | } |
| 476 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 477 | /* demod configurations */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 478 | static int m920x_mt352_demod_init(struct dvb_frontend *fe) |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 479 | { |
Aapo Tahkola | d577ee0 | 2007-05-08 18:33:52 -0300 | [diff] [blame] | 480 | int ret; |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 481 | u8 config[] = { CONFIG, 0x3d }; |
| 482 | u8 clock[] = { CLOCK_CTL, 0x30 }; |
| 483 | u8 reset[] = { RESET, 0x80 }; |
| 484 | u8 adc_ctl[] = { ADC_CTL_1, 0x40 }; |
| 485 | u8 agc[] = { AGC_TARGET, 0x1c, 0x20 }; |
| 486 | u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 }; |
| 487 | u8 unk1[] = { 0x93, 0x1a }; |
| 488 | u8 unk2[] = { 0xb5, 0x7a }; |
| 489 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 490 | deb("Demod init!\n"); |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 491 | |
Aapo Tahkola | d577ee0 | 2007-05-08 18:33:52 -0300 | [diff] [blame] | 492 | if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0) |
| 493 | return ret; |
| 494 | if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0) |
| 495 | return ret; |
| 496 | if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0) |
| 497 | return ret; |
| 498 | if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0) |
| 499 | return ret; |
| 500 | if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0) |
| 501 | return ret; |
| 502 | if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0) |
| 503 | return ret; |
| 504 | if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0) |
| 505 | return ret; |
| 506 | if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0) |
| 507 | return ret; |
| 508 | |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 509 | return 0; |
| 510 | } |
| 511 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 512 | static struct mt352_config m920x_mt352_config = { |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 513 | .demod_address = 0x0f, |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 514 | .no_tuner = 1, |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 515 | .demod_init = m920x_mt352_demod_init, |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 516 | }; |
| 517 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 518 | static struct tda1004x_config m920x_tda10046_08_config = { |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 519 | .demod_address = 0x08, |
| 520 | .invert = 0, |
| 521 | .invert_oclk = 0, |
| 522 | .ts_mode = TDA10046_TS_SERIAL, |
| 523 | .xtal_freq = TDA10046_XTAL_16M, |
| 524 | .if_freq = TDA10046_FREQ_045, |
| 525 | .agc_config = TDA10046_AGC_TDA827X, |
| 526 | .gpio_config = TDA10046_GPTRI, |
| 527 | .request_firmware = NULL, |
| 528 | }; |
| 529 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 530 | static struct tda1004x_config m920x_tda10046_0b_config = { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 531 | .demod_address = 0x0b, |
| 532 | .invert = 0, |
| 533 | .invert_oclk = 0, |
| 534 | .ts_mode = TDA10046_TS_SERIAL, |
| 535 | .xtal_freq = TDA10046_XTAL_16M, |
| 536 | .if_freq = TDA10046_FREQ_045, |
| 537 | .agc_config = TDA10046_AGC_TDA827X, |
| 538 | .gpio_config = TDA10046_GPTRI, |
| 539 | .request_firmware = NULL, /* uses firmware EEPROM */ |
| 540 | }; |
| 541 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 542 | /* tuner configurations */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 543 | static struct qt1010_config m920x_qt1010_config = { |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 544 | .i2c_address = 0x62 |
| 545 | }; |
| 546 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 547 | static struct mt2060_config m920x_mt2060_config = { |
| 548 | .i2c_address = 0x60, /* 0xc0 */ |
| 549 | .clock_out = 0, |
| 550 | }; |
| 551 | |
| 552 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 553 | /* Callbacks for DVB USB */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 554 | static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 555 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 556 | deb("%s\n",__func__); |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 557 | |
Michael Krufky | d12f51a | 2011-09-17 14:59:54 -0300 | [diff] [blame] | 558 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, |
| 559 | &m920x_mt352_config, |
| 560 | &adap->dev->i2c_adap); |
| 561 | if ((adap->fe_adap[0].fe) == NULL) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 562 | return -EIO; |
| 563 | |
| 564 | return 0; |
| 565 | } |
| 566 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 567 | static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap) |
| 568 | { |
| 569 | struct m920x_inits vp7049_fe_init_seq[] = { |
| 570 | /* XXX without these commands the frontend cannot be detected, |
| 571 | * they must be sent BEFORE the frontend is attached */ |
| 572 | { 0xff28, 0x00 }, |
| 573 | { 0xff23, 0x00 }, |
| 574 | { 0xff28, 0x00 }, |
| 575 | { 0xff23, 0x00 }, |
| 576 | { 0xff21, 0x20 }, |
| 577 | { 0xff21, 0x60 }, |
| 578 | { 0xff28, 0x00 }, |
| 579 | { 0xff22, 0x00 }, |
| 580 | { 0xff20, 0x30 }, |
| 581 | { 0xff20, 0x20 }, |
| 582 | { 0xff20, 0x30 }, |
| 583 | { } /* terminating entry */ |
| 584 | }; |
| 585 | int ret; |
| 586 | |
| 587 | deb("%s\n", __func__); |
| 588 | |
| 589 | ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq); |
| 590 | if (ret != 0) { |
| 591 | deb("Initialization of vp7049 frontend failed."); |
| 592 | return ret; |
| 593 | } |
| 594 | |
| 595 | return m920x_mt352_frontend_attach(adap); |
| 596 | } |
| 597 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 598 | static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 599 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 600 | deb("%s\n",__func__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 601 | |
Michael Krufky | d12f51a | 2011-09-17 14:59:54 -0300 | [diff] [blame] | 602 | adap->fe_adap[0].fe = dvb_attach(tda10046_attach, |
| 603 | &m920x_tda10046_08_config, |
| 604 | &adap->dev->i2c_adap); |
| 605 | if ((adap->fe_adap[0].fe) == NULL) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 606 | return -EIO; |
| 607 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 608 | return 0; |
| 609 | } |
| 610 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 611 | static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 612 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 613 | deb("%s\n",__func__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 614 | |
Michael Krufky | d12f51a | 2011-09-17 14:59:54 -0300 | [diff] [blame] | 615 | adap->fe_adap[0].fe = dvb_attach(tda10046_attach, |
| 616 | &m920x_tda10046_0b_config, |
| 617 | &adap->dev->i2c_adap); |
| 618 | if ((adap->fe_adap[0].fe) == NULL) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 619 | return -EIO; |
| 620 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 621 | return 0; |
| 622 | } |
| 623 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 624 | static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 625 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 626 | deb("%s\n",__func__); |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 627 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 628 | if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 629 | return -ENODEV; |
| 630 | |
| 631 | return 0; |
| 632 | } |
| 633 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 634 | static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 635 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 636 | deb("%s\n",__func__); |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 637 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 638 | if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 639 | return -ENODEV; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 640 | |
| 641 | return 0; |
| 642 | } |
| 643 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 644 | static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 645 | { |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 646 | deb("%s\n",__func__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 647 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 648 | if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 649 | return -ENODEV; |
| 650 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 651 | return 0; |
| 652 | } |
| 653 | |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 654 | static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
| 655 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 656 | dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 657 | &adap->dev->i2c_adap, 0x61, |
| 658 | TUNER_PHILIPS_FMD1216ME_MK3); |
| 659 | return 0; |
| 660 | } |
| 661 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 662 | static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap) |
| 663 | { |
| 664 | deb("%s\n", __func__); |
| 665 | |
| 666 | if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, |
| 667 | &m920x_mt2060_config, 1220) == NULL) |
| 668 | return -ENODEV; |
| 669 | |
| 670 | return 0; |
| 671 | } |
| 672 | |
| 673 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 674 | /* device-specific initialization */ |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 675 | static struct m920x_inits megasky_rc_init [] = { |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 676 | { M9206_RC_INIT2, 0xa8 }, |
| 677 | { M9206_RC_INIT1, 0x51 }, |
| 678 | { } /* terminating entry */ |
| 679 | }; |
| 680 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 681 | static struct m920x_inits tvwalkertwin_rc_init [] = { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 682 | { M9206_RC_INIT2, 0x00 }, |
| 683 | { M9206_RC_INIT1, 0xef }, |
| 684 | { 0xff28, 0x00 }, |
| 685 | { 0xff23, 0x00 }, |
| 686 | { 0xff21, 0x30 }, |
| 687 | { } /* terminating entry */ |
| 688 | }; |
| 689 | |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 690 | static struct m920x_inits pinnacle310e_init[] = { |
Antonio Ospite | 9084983 | 2012-12-10 17:37:10 -0300 | [diff] [blame] | 691 | /* without these the tuner doesn't work */ |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 692 | { 0xff20, 0x9b }, |
| 693 | { 0xff22, 0x70 }, |
| 694 | |
| 695 | /* rc settings */ |
| 696 | { 0xff50, 0x80 }, |
| 697 | { M9206_RC_INIT1, 0x00 }, |
| 698 | { M9206_RC_INIT2, 0xff }, |
| 699 | { } /* terminating entry */ |
| 700 | }; |
| 701 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 702 | static struct m920x_inits vp7049_rc_init[] = { |
| 703 | { 0xff28, 0x00 }, |
| 704 | { 0xff23, 0x00 }, |
| 705 | { 0xff21, 0x70 }, |
| 706 | { M9206_RC_INIT2, 0x00 }, |
| 707 | { M9206_RC_INIT1, 0xff }, |
| 708 | { } /* terminating entry */ |
| 709 | }; |
| 710 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 711 | /* ir keymaps */ |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 712 | static struct rc_map_table rc_map_megasky_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 713 | { 0x0012, KEY_POWER }, |
| 714 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ |
| 715 | { 0x0002, KEY_CHANNELUP }, |
| 716 | { 0x0005, KEY_CHANNELDOWN }, |
| 717 | { 0x0003, KEY_VOLUMEUP }, |
| 718 | { 0x0006, KEY_VOLUMEDOWN }, |
| 719 | { 0x0004, KEY_MUTE }, |
| 720 | { 0x0007, KEY_OK }, /* TS */ |
| 721 | { 0x0008, KEY_STOP }, |
| 722 | { 0x0009, KEY_MENU }, /* swap */ |
| 723 | { 0x000a, KEY_REWIND }, |
| 724 | { 0x001b, KEY_PAUSE }, |
| 725 | { 0x001f, KEY_FASTFORWARD }, |
| 726 | { 0x000c, KEY_RECORD }, |
| 727 | { 0x000d, KEY_CAMERA }, /* screenshot */ |
| 728 | { 0x000e, KEY_COFFEE }, /* "MTS" */ |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 729 | }; |
| 730 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 731 | static struct rc_map_table rc_map_tvwalkertwin_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 732 | { 0x0001, KEY_ZOOM }, /* Full Screen */ |
| 733 | { 0x0002, KEY_CAMERA }, /* snapshot */ |
| 734 | { 0x0003, KEY_MUTE }, |
| 735 | { 0x0004, KEY_REWIND }, |
| 736 | { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */ |
| 737 | { 0x0006, KEY_FASTFORWARD }, |
| 738 | { 0x0007, KEY_RECORD }, |
| 739 | { 0x0008, KEY_STOP }, |
| 740 | { 0x0009, KEY_TIME }, /* Timeshift */ |
| 741 | { 0x000c, KEY_COFFEE }, /* Recall */ |
| 742 | { 0x000e, KEY_CHANNELUP }, |
| 743 | { 0x0012, KEY_POWER }, |
| 744 | { 0x0015, KEY_MENU }, /* source */ |
| 745 | { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */ |
| 746 | { 0x001a, KEY_CHANNELDOWN }, |
| 747 | { 0x001b, KEY_VOLUMEDOWN }, |
| 748 | { 0x001e, KEY_VOLUMEUP }, |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 749 | }; |
| 750 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 751 | static struct rc_map_table rc_map_pinnacle310e_table[] = { |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 752 | { 0x16, KEY_POWER }, |
| 753 | { 0x17, KEY_FAVORITES }, |
| 754 | { 0x0f, KEY_TEXT }, |
Jarod Wilson | 56c0893 | 2011-04-05 18:42:30 -0300 | [diff] [blame] | 755 | { 0x48, KEY_PROGRAM }, /* preview */ |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 756 | { 0x1c, KEY_EPG }, |
Jarod Wilson | 56c0893 | 2011-04-05 18:42:30 -0300 | [diff] [blame] | 757 | { 0x04, KEY_LIST }, /* record list */ |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 758 | { 0x03, KEY_1 }, |
| 759 | { 0x01, KEY_2 }, |
| 760 | { 0x06, KEY_3 }, |
| 761 | { 0x09, KEY_4 }, |
| 762 | { 0x1d, KEY_5 }, |
| 763 | { 0x1f, KEY_6 }, |
| 764 | { 0x0d, KEY_7 }, |
| 765 | { 0x19, KEY_8 }, |
| 766 | { 0x1b, KEY_9 }, |
| 767 | { 0x15, KEY_0 }, |
| 768 | { 0x0c, KEY_CANCEL }, |
| 769 | { 0x4a, KEY_CLEAR }, |
| 770 | { 0x13, KEY_BACK }, |
| 771 | { 0x00, KEY_TAB }, |
| 772 | { 0x4b, KEY_UP }, |
| 773 | { 0x4e, KEY_LEFT }, |
| 774 | { 0x52, KEY_RIGHT }, |
| 775 | { 0x51, KEY_DOWN }, |
| 776 | { 0x4f, KEY_ENTER }, /* could also be KEY_OK */ |
| 777 | { 0x1e, KEY_VOLUMEUP }, |
| 778 | { 0x0a, KEY_VOLUMEDOWN }, |
| 779 | { 0x05, KEY_CHANNELUP }, |
| 780 | { 0x02, KEY_CHANNELDOWN }, |
| 781 | { 0x11, KEY_RECORD }, |
| 782 | { 0x14, KEY_PLAY }, |
| 783 | { 0x4c, KEY_PAUSE }, |
| 784 | { 0x1a, KEY_STOP }, |
| 785 | { 0x40, KEY_REWIND }, |
| 786 | { 0x12, KEY_FASTFORWARD }, |
| 787 | { 0x41, KEY_PREVIOUSSONG }, /* Replay */ |
| 788 | { 0x42, KEY_NEXTSONG }, /* Skip */ |
| 789 | { 0x54, KEY_CAMERA }, /* Capture */ |
| 790 | /* { 0x50, KEY_SAP }, */ /* Sap */ |
| 791 | { 0x47, KEY_CYCLEWINDOWS }, /* Pip */ |
| 792 | { 0x4d, KEY_SCREEN }, /* FullScreen */ |
| 793 | { 0x08, KEY_SUBTITLE }, |
| 794 | { 0x0e, KEY_MUTE }, |
| 795 | /* { 0x49, KEY_LR }, */ /* L/R */ |
| 796 | { 0x07, KEY_SLEEP }, /* Hibernate */ |
Jarod Wilson | 56c0893 | 2011-04-05 18:42:30 -0300 | [diff] [blame] | 797 | { 0x08, KEY_VIDEO }, /* A/V */ |
| 798 | { 0x0e, KEY_MENU }, /* Recall */ |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 799 | { 0x45, KEY_ZOOMIN }, |
| 800 | { 0x46, KEY_ZOOMOUT }, |
Jarod Wilson | 56c0893 | 2011-04-05 18:42:30 -0300 | [diff] [blame] | 801 | { 0x18, KEY_RED }, /* Red */ |
| 802 | { 0x53, KEY_GREEN }, /* Green */ |
| 803 | { 0x5e, KEY_YELLOW }, /* Yellow */ |
| 804 | { 0x5f, KEY_BLUE }, /* Blue */ |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 805 | }; |
| 806 | |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 807 | /* DVB USB Driver stuff */ |
| 808 | static struct dvb_usb_device_properties megasky_properties; |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 809 | static struct dvb_usb_device_properties digivox_mini_ii_properties; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 810 | static struct dvb_usb_device_properties tvwalkertwin_properties; |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 811 | static struct dvb_usb_device_properties dposh_properties; |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 812 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties; |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 813 | static struct dvb_usb_device_properties vp7049_properties; |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 814 | |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 815 | static int m920x_probe(struct usb_interface *intf, |
| 816 | const struct usb_device_id *id) |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 817 | { |
Aapo Tahkola | 55bbe5e | 2007-05-08 12:56:54 -0300 | [diff] [blame] | 818 | struct dvb_usb_device *d = NULL; |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 819 | int ret; |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 820 | struct m920x_inits *rc_init_seq = NULL; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 821 | int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber; |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 822 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 823 | deb("Probing for m920x device at interface %d\n", bInterfaceNumber); |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 824 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 825 | if (bInterfaceNumber == 0) { |
| 826 | /* Single-tuner device, or first interface on |
| 827 | * multi-tuner device |
| 828 | */ |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 829 | |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 830 | ret = dvb_usb_device_init(intf, &megasky_properties, |
| 831 | THIS_MODULE, &d, adapter_nr); |
| 832 | if (ret == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 833 | rc_init_seq = megasky_rc_init; |
| 834 | goto found; |
| 835 | } |
| 836 | |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 837 | ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, |
| 838 | THIS_MODULE, &d, adapter_nr); |
| 839 | if (ret == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 840 | /* No remote control, so no rc_init_seq */ |
| 841 | goto found; |
| 842 | } |
| 843 | |
| 844 | /* This configures both tuners on the TV Walker Twin */ |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 845 | ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, |
| 846 | THIS_MODULE, &d, adapter_nr); |
| 847 | if (ret == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 848 | rc_init_seq = tvwalkertwin_rc_init; |
| 849 | goto found; |
| 850 | } |
| 851 | |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 852 | ret = dvb_usb_device_init(intf, &dposh_properties, |
| 853 | THIS_MODULE, &d, adapter_nr); |
| 854 | if (ret == 0) { |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 855 | /* Remote controller not supported yet. */ |
| 856 | goto found; |
| 857 | } |
| 858 | |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 859 | ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties, |
| 860 | THIS_MODULE, &d, adapter_nr); |
| 861 | if (ret == 0) { |
| 862 | rc_init_seq = pinnacle310e_init; |
| 863 | goto found; |
| 864 | } |
| 865 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 866 | ret = dvb_usb_device_init(intf, &vp7049_properties, |
| 867 | THIS_MODULE, &d, adapter_nr); |
| 868 | if (ret == 0) { |
| 869 | rc_init_seq = vp7049_rc_init; |
| 870 | goto found; |
| 871 | } |
| 872 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 873 | return ret; |
| 874 | } else { |
| 875 | /* Another interface on a multi-tuner device */ |
| 876 | |
| 877 | /* The LifeView TV Walker Twin gets here, but struct |
| 878 | * tvwalkertwin_properties already configured both |
| 879 | * tuners, so there is nothing for us to do here |
| 880 | */ |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 881 | } |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 882 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 883 | found: |
Aapo Tahkola | 55bbe5e | 2007-05-08 12:56:54 -0300 | [diff] [blame] | 884 | if ((ret = m920x_init_ep(intf)) < 0) |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 885 | return ret; |
| 886 | |
Aapo Tahkola | 55bbe5e | 2007-05-08 12:56:54 -0300 | [diff] [blame] | 887 | if (d && (ret = m920x_init(d, rc_init_seq)) != 0) |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 888 | return ret; |
| 889 | |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 890 | return ret; |
| 891 | } |
| 892 | |
| 893 | static struct usb_device_id m920x_table [] = { |
| 894 | { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) }, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 895 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 896 | USB_PID_MSI_DIGI_VOX_MINI_II) }, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 897 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 898 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) }, |
| 899 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 900 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 901 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, |
| 902 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 903 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) }, |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 904 | { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) }, |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 905 | { } /* Terminating entry */ |
| 906 | }; |
| 907 | MODULE_DEVICE_TABLE (usb, m920x_table); |
| 908 | |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 909 | static struct dvb_usb_device_properties megasky_properties = { |
Michael Krufky | 758117c | 2007-01-23 15:34:10 -0300 | [diff] [blame] | 910 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
Michael Krufky | 1f61f3b | 2006-10-07 15:03:04 -0300 | [diff] [blame] | 911 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 912 | .usb_ctrl = DEVICE_SPECIFIC, |
| 913 | .firmware = "dvb-usb-megasky-02.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 914 | .download_firmware = m920x_firmware_download, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 915 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 916 | .rc.legacy = { |
| 917 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 918 | .rc_map_table = rc_map_megasky_table, |
| 919 | .rc_map_size = ARRAY_SIZE(rc_map_megasky_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 920 | .rc_query = m920x_rc_query, |
| 921 | }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 922 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 923 | .size_of_priv = sizeof(struct m920x_state), |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 924 | |
Aapo Tahkola | 7d1d4e6 | 2007-03-15 13:01:46 -0300 | [diff] [blame] | 925 | .identify_state = m920x_identify_state, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 926 | .num_adapters = 1, |
| 927 | .adapter = {{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 928 | .num_frontends = 1, |
| 929 | .fe = {{ |
| 930 | |
Michael Krufky | 758117c | 2007-01-23 15:34:10 -0300 | [diff] [blame] | 931 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 932 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 933 | |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 934 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 935 | .pid_filter = m920x_pid_filter, |
| 936 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 937 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 938 | .frontend_attach = m920x_mt352_frontend_attach, |
| 939 | .tuner_attach = m920x_qt1010_tuner_attach, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 940 | |
| 941 | .stream = { |
| 942 | .type = USB_BULK, |
| 943 | .count = 8, |
| 944 | .endpoint = 0x81, |
| 945 | .u = { |
| 946 | .bulk = { |
| 947 | .buffersize = 512, |
| 948 | } |
| 949 | } |
| 950 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 951 | }}, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 952 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 953 | .i2c_algo = &m920x_i2c_algo, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 954 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 955 | .num_device_descs = 1, |
| 956 | .devices = { |
| 957 | { "MSI Mega Sky 580 DVB-T USB2.0", |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 958 | { &m920x_table[0], NULL }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 959 | { NULL }, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 960 | } |
| 961 | } |
| 962 | }; |
| 963 | |
| 964 | static struct dvb_usb_device_properties digivox_mini_ii_properties = { |
| 965 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 966 | |
| 967 | .usb_ctrl = DEVICE_SPECIFIC, |
| 968 | .firmware = "dvb-usb-digivox-02.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 969 | .download_firmware = m920x_firmware_download, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 970 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 971 | .size_of_priv = sizeof(struct m920x_state), |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 972 | |
| 973 | .identify_state = m920x_identify_state, |
| 974 | .num_adapters = 1, |
| 975 | .adapter = {{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 976 | .num_frontends = 1, |
| 977 | .fe = {{ |
| 978 | |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 979 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 980 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 981 | |
| 982 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 983 | .pid_filter = m920x_pid_filter, |
| 984 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 985 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 986 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 987 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 988 | |
| 989 | .stream = { |
| 990 | .type = USB_BULK, |
| 991 | .count = 8, |
| 992 | .endpoint = 0x81, |
| 993 | .u = { |
| 994 | .bulk = { |
| 995 | .buffersize = 0x4000, |
| 996 | } |
| 997 | } |
| 998 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 999 | }}, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 1000 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1001 | .i2c_algo = &m920x_i2c_algo, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 1002 | |
| 1003 | .num_device_descs = 1, |
| 1004 | .devices = { |
| 1005 | { "MSI DIGI VOX mini II DVB-T USB2.0", |
| 1006 | { &m920x_table[1], NULL }, |
| 1007 | { NULL }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1008 | }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1009 | } |
| 1010 | }; |
| 1011 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1012 | /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> |
| 1013 | * |
| 1014 | * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A |
| 1015 | * TDA10046 #0 is located at i2c address 0x08 |
Aapo Tahkola | 3ab3b69 | 2007-05-08 18:23:38 -0300 | [diff] [blame] | 1016 | * TDA10046 #1 is located at i2c address 0x0b |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1017 | * TDA8275A #0 is located at i2c address 0x60 |
Aapo Tahkola | 3ab3b69 | 2007-05-08 18:23:38 -0300 | [diff] [blame] | 1018 | * TDA8275A #1 is located at i2c address 0x61 |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1019 | */ |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1020 | static struct dvb_usb_device_properties tvwalkertwin_properties = { |
| 1021 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1022 | |
| 1023 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1024 | .firmware = "dvb-usb-tvwalkert.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1025 | .download_firmware = m920x_firmware_download, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1026 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1027 | .rc.legacy = { |
| 1028 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1029 | .rc_map_table = rc_map_tvwalkertwin_table, |
| 1030 | .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1031 | .rc_query = m920x_rc_query, |
| 1032 | }, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1033 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1034 | .size_of_priv = sizeof(struct m920x_state), |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1035 | |
| 1036 | .identify_state = m920x_identify_state, |
Aapo Tahkola | 3ab3b69 | 2007-05-08 18:23:38 -0300 | [diff] [blame] | 1037 | .num_adapters = 2, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1038 | .adapter = {{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1039 | .num_frontends = 1, |
| 1040 | .fe = {{ |
| 1041 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1042 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1043 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1044 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1045 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1046 | .pid_filter = m920x_pid_filter, |
| 1047 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1048 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1049 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 1050 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1051 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1052 | .stream = { |
| 1053 | .type = USB_BULK, |
| 1054 | .count = 8, |
| 1055 | .endpoint = 0x81, |
| 1056 | .u = { |
| 1057 | .bulk = { |
| 1058 | .buffersize = 512, |
| 1059 | } |
| 1060 | } |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1061 | }}, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1062 | }},{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1063 | .num_frontends = 1, |
| 1064 | .fe = {{ |
| 1065 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1066 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1067 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1068 | |
| 1069 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1070 | .pid_filter = m920x_pid_filter, |
| 1071 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1072 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1073 | .frontend_attach = m920x_tda10046_0b_frontend_attach, |
| 1074 | .tuner_attach = m920x_tda8275_61_tuner_attach, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1075 | |
| 1076 | .stream = { |
| 1077 | .type = USB_BULK, |
| 1078 | .count = 8, |
| 1079 | .endpoint = 0x82, |
| 1080 | .u = { |
| 1081 | .bulk = { |
| 1082 | .buffersize = 512, |
| 1083 | } |
| 1084 | } |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1085 | }}, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1086 | }, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1087 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1088 | .i2c_algo = &m920x_i2c_algo, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1089 | |
| 1090 | .num_device_descs = 1, |
| 1091 | .devices = { |
| 1092 | { .name = "LifeView TV Walker Twin DVB-T USB2.0", |
| 1093 | .cold_ids = { &m920x_table[2], NULL }, |
| 1094 | .warm_ids = { &m920x_table[3], NULL }, |
| 1095 | }, |
| 1096 | } |
| 1097 | }; |
| 1098 | |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1099 | static struct dvb_usb_device_properties dposh_properties = { |
| 1100 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1101 | |
| 1102 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1103 | .firmware = "dvb-usb-dposh-01.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1104 | .download_firmware = m920x_firmware_download, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1105 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1106 | .size_of_priv = sizeof(struct m920x_state), |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1107 | |
| 1108 | .identify_state = m920x_identify_state, |
| 1109 | .num_adapters = 1, |
| 1110 | .adapter = {{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1111 | .num_frontends = 1, |
| 1112 | .fe = {{ |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1113 | /* Hardware pid filters don't work with this device/firmware */ |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1114 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 1115 | .frontend_attach = m920x_mt352_frontend_attach, |
| 1116 | .tuner_attach = m920x_qt1010_tuner_attach, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1117 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1118 | .stream = { |
| 1119 | .type = USB_BULK, |
| 1120 | .count = 8, |
| 1121 | .endpoint = 0x81, |
| 1122 | .u = { |
| 1123 | .bulk = { |
| 1124 | .buffersize = 512, |
| 1125 | } |
| 1126 | } |
| 1127 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1128 | }}, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 1129 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 1130 | .i2c_algo = &m920x_i2c_algo, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 1131 | |
| 1132 | .num_device_descs = 1, |
| 1133 | .devices = { |
| 1134 | { .name = "Dposh DVB-T USB2.0", |
| 1135 | .cold_ids = { &m920x_table[4], NULL }, |
| 1136 | .warm_ids = { &m920x_table[5], NULL }, |
| 1137 | }, |
| 1138 | } |
| 1139 | }; |
| 1140 | |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 1141 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { |
| 1142 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1143 | |
| 1144 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1145 | .download_firmware = NULL, |
| 1146 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1147 | .rc.legacy = { |
| 1148 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1149 | .rc_map_table = rc_map_pinnacle310e_table, |
| 1150 | .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1151 | .rc_query = m920x_rc_query, |
| 1152 | }, |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 1153 | |
| 1154 | .size_of_priv = sizeof(struct m920x_state), |
| 1155 | |
| 1156 | .identify_state = m920x_identify_state, |
| 1157 | .num_adapters = 1, |
| 1158 | .adapter = {{ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1159 | .num_frontends = 1, |
| 1160 | .fe = {{ |
| 1161 | |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 1162 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1163 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1164 | |
| 1165 | .pid_filter_count = 8, |
| 1166 | .pid_filter = m920x_pid_filter, |
| 1167 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1168 | |
| 1169 | .frontend_attach = m920x_mt352_frontend_attach, |
| 1170 | .tuner_attach = m920x_fmd1216me_tuner_attach, |
| 1171 | |
| 1172 | .stream = { |
| 1173 | .type = USB_ISOC, |
| 1174 | .count = 5, |
| 1175 | .endpoint = 0x84, |
| 1176 | .u = { |
| 1177 | .isoc = { |
| 1178 | .framesperurb = 128, |
| 1179 | .framesize = 564, |
| 1180 | .interval = 1, |
| 1181 | } |
| 1182 | } |
| 1183 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1184 | }}, |
Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 1185 | } }, |
| 1186 | .i2c_algo = &m920x_i2c_algo, |
| 1187 | |
| 1188 | .num_device_descs = 1, |
| 1189 | .devices = { |
| 1190 | { "Pinnacle PCTV 310e", |
| 1191 | { &m920x_table[6], NULL }, |
| 1192 | { NULL }, |
| 1193 | } |
| 1194 | } |
| 1195 | }; |
| 1196 | |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 1197 | static struct dvb_usb_device_properties vp7049_properties = { |
| 1198 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1199 | |
| 1200 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1201 | .firmware = "dvb-usb-vp7049-0.95.fw", |
| 1202 | .download_firmware = m920x_firmware_download, |
| 1203 | |
| 1204 | .rc.core = { |
| 1205 | .rc_interval = 150, |
| 1206 | .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS, |
| 1207 | .rc_query = m920x_rc_core_query, |
Sean Young | 6d741bf | 2017-08-07 16:20:58 -0400 | [diff] [blame] | 1208 | .allowed_protos = RC_PROTO_BIT_UNKNOWN, |
Antonio Ospite | de8ed82 | 2012-12-10 17:37:17 -0300 | [diff] [blame] | 1209 | }, |
| 1210 | |
| 1211 | .size_of_priv = sizeof(struct m920x_state), |
| 1212 | |
| 1213 | .identify_state = m920x_identify_state, |
| 1214 | .num_adapters = 1, |
| 1215 | .adapter = {{ |
| 1216 | .num_frontends = 1, |
| 1217 | .fe = {{ |
| 1218 | |
| 1219 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1220 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1221 | |
| 1222 | .pid_filter_count = 8, |
| 1223 | .pid_filter = m920x_pid_filter, |
| 1224 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1225 | |
| 1226 | .frontend_attach = m920x_mt352_frontend_attach_vp7049, |
| 1227 | .tuner_attach = m920x_mt2060_tuner_attach, |
| 1228 | |
| 1229 | .stream = { |
| 1230 | .type = USB_BULK, |
| 1231 | .count = 8, |
| 1232 | .endpoint = 0x81, |
| 1233 | .u = { |
| 1234 | .bulk = { |
| 1235 | .buffersize = 512, |
| 1236 | } |
| 1237 | } |
| 1238 | }, |
| 1239 | } }, |
| 1240 | } }, |
| 1241 | .i2c_algo = &m920x_i2c_algo, |
| 1242 | |
| 1243 | .num_device_descs = 1, |
| 1244 | .devices = { |
| 1245 | { "DTV-DVB UDTT7049", |
| 1246 | { &m920x_table[7], NULL }, |
| 1247 | { NULL }, |
| 1248 | } |
| 1249 | } |
| 1250 | }; |
| 1251 | |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 1252 | static struct usb_driver m920x_driver = { |
| 1253 | .name = "dvb_usb_m920x", |
Michael Krufky | 2a2bfa7 | 2006-09-23 20:13:12 -0300 | [diff] [blame] | 1254 | .probe = m920x_probe, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1255 | .disconnect = dvb_usb_device_exit, |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 1256 | .id_table = m920x_table, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1257 | }; |
| 1258 | |
Greg Kroah-Hartman | ecb3b2b | 2011-11-18 09:46:12 -0800 | [diff] [blame] | 1259 | module_usb_driver(m920x_driver); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1260 | |
| 1261 | MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 1262 | MODULE_DESCRIPTION("DVB Driver for ULI M920x"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 1263 | MODULE_VERSION("0.1"); |
| 1264 | MODULE_LICENSE("GPL"); |