blob: 0306cb778df4b07683fb05bc42949616ee03a55d [file] [log] [blame]
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001/* 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 Krufkyd3911ea2007-03-22 19:03:37 -03006 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, version 2.
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03008 *
9 * see Documentation/dvb/README.dvb-usb for more information
10 */
Michael Krufkybaa2ed02006-09-23 20:01:29 -030011
Michael Krufky2aef7d02006-09-23 20:00:42 -030012#include "m920x.h"
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030013
14#include "mt352.h"
15#include "mt352_priv.h"
Michael Krufky017cf012006-09-23 20:40:20 -030016#include "qt1010.h"
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -030017#include "tda1004x.h"
18#include "tda827x.h"
Antonio Ospitede8ed822012-12-10 17:37:17 -030019#include "mt2060.h"
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -030020
21#include <media/tuner.h>
22#include "tuner-simple.h"
Al Virofa9c13a2008-05-21 00:32:41 -030023#include <asm/unaligned.h>
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030024
25/* debug */
Michael Krufky26f48ea2006-09-28 01:46:49 -030026static int dvb_usb_m920x_debug;
Michael Krufkybaa2ed02006-09-23 20:01:29 -030027module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030028MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
29
Janne Grunau78e92002008-04-09 19:13:13 -030030DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
31
Aapo Tahkola47f8df02007-05-08 12:03:55 -030032static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid);
33
Aapo Tahkola4fd74a72007-03-26 17:05:59 -030034static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
Michael Krufkyfa948052007-01-21 15:57:48 -030035 u16 index, void *data, int size)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030036{
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 Willenbrock59069e52007-03-15 13:24:29 -030042 if (ret < 0) {
43 printk(KERN_INFO "m920x_read = error: %d\n", ret);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030044 return ret;
Pierre Willenbrock59069e52007-03-15 13:24:29 -030045 }
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030046
Pierre Willenbrock59069e52007-03-15 13:24:29 -030047 if (ret != size) {
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -030048 deb("m920x_read = no data\n");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030049 return -EIO;
Pierre Willenbrock59069e52007-03-15 13:24:29 -030050 }
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030051
52 return 0;
53}
54
Aapo Tahkola4fd74a72007-03-26 17:05:59 -030055static inline int m920x_write(struct usb_device *udev, u8 request,
Michael Krufkyfa948052007-01-21 15:57:48 -030056 u16 value, u16 index)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030057{
58 int ret;
59
60 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
61 request, USB_TYPE_VENDOR | USB_DIR_OUT,
62 value, index, NULL, 0, 2000);
Pierre Willenbrock59069e52007-03-15 13:24:29 -030063
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030064 return ret;
65}
66
Antonio Ospite7543f342012-12-10 17:37:11 -030067static inline int m920x_write_seq(struct usb_device *udev, u8 request,
68 struct m920x_inits *seq)
69{
70 int ret;
Paul Bolleb78a1f32013-03-04 09:43:20 -030071 do {
Antonio Ospite7543f342012-12-10 17:37:11 -030072 ret = m920x_write(udev, request, seq->data, seq->address);
73 if (ret != 0)
74 return ret;
75
76 seq++;
Paul Bolleb78a1f32013-03-04 09:43:20 -030077 } while (seq->address);
Antonio Ospite7543f342012-12-10 17:37:11 -030078
Jean Delvareb0efc3e2013-03-31 07:16:37 -030079 return 0;
Antonio Ospite7543f342012-12-10 17:37:11 -030080}
81
Aapo Tahkola4fd74a72007-03-26 17:05:59 -030082static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030083{
Jean Delvareb0efc3e2013-03-31 07:16:37 -030084 int ret, i, epi, flags = 0;
Aapo Tahkola47f8df02007-05-08 12:03:55 -030085 int adap_enabled[M9206_MAX_ADAPTERS] = { 0 };
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030086
87 /* Remote controller init. */
Antonio Ospite68511a72012-12-10 17:37:15 -030088 if (d->props.rc.legacy.rc_query || d->props.rc.core.rc_query) {
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -030089 deb("Initialising remote control\n");
Antonio Ospite7543f342012-12-10 17:37:11 -030090 ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq);
91 if (ret != 0) {
92 deb("Initialising remote control failed\n");
93 return ret;
Nick Andrewaa50ec22007-03-22 17:09:35 -030094 }
95
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -030096 deb("Initialising remote control success\n");
Aapo Tahkola480ac762007-03-05 18:54:27 -030097 }
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030098
Aapo Tahkola3847b222007-05-08 18:21:47 -030099 for (i = 0; i < d->props.num_adapters; i++)
Michael Krufky77eed212011-09-06 09:31:57 -0300100 flags |= d->adapter[i].props.fe[0].caps;
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300101
Aapo Tahkola3847b222007-05-08 18:21:47 -0300102 /* Some devices(Dposh) might crash if we attempt touch at all. */
103 if (flags & DVB_USB_ADAP_HAS_PID_FILTER) {
104 for (i = 0; i < d->props.num_adapters; i++) {
Michael Krufky77eed212011-09-06 09:31:57 -0300105 epi = d->adapter[i].props.fe[0].stream.endpoint - 0x81;
Aapo Tahkola3847b222007-05-08 18:21:47 -0300106
107 if (epi < 0 || epi >= M9206_MAX_ADAPTERS) {
108 printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n");
109 return -EINVAL;
110 }
111
112 adap_enabled[epi] = 1;
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300113 }
114
Aapo Tahkola3847b222007-05-08 18:21:47 -0300115 for (i = 0; i < M9206_MAX_ADAPTERS; i++) {
116 if (adap_enabled[i])
117 continue;
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300118
Aapo Tahkola3847b222007-05-08 18:21:47 -0300119 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0)
120 return ret;
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300121
Aapo Tahkola3847b222007-05-08 18:21:47 -0300122 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0)
123 return ret;
124 }
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300125 }
126
Jean Delvareb0efc3e2013-03-31 07:16:37 -0300127 return 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300128}
129
Aapo Tahkola55bbe5e2007-05-08 12:56:54 -0300130static int m920x_init_ep(struct usb_interface *intf)
131{
132 struct usb_device *udev = interface_to_usbdev(intf);
133 struct usb_host_interface *alt;
134
135 if ((alt = usb_altnum_to_altsetting(intf, 1)) == NULL) {
136 deb("No alt found!\n");
137 return -ENODEV;
138 }
139
140 return usb_set_interface(udev, alt->desc.bInterfaceNumber,
141 alt->desc.bAlternateSetting);
142}
143
Antonio Ospitef526e9e2012-12-10 17:37:12 -0300144static inline void m920x_parse_rc_state(struct dvb_usb_device *d, u8 rc_state,
145 int *state)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300146{
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300147 struct m920x_state *m = d->priv;
Antonio Ospitef526e9e2012-12-10 17:37:12 -0300148
149 switch (rc_state) {
150 case 0x80:
151 *state = REMOTE_NO_KEY_PRESSED;
152 break;
153
154 case 0x88: /* framing error or "invalid code" */
155 case 0x99:
156 case 0xc0:
157 case 0xd8:
158 *state = REMOTE_NO_KEY_PRESSED;
159 m->rep_count = 0;
160 break;
161
162 case 0x93:
163 case 0x92:
164 case 0x83: /* pinnacle PCTV310e */
165 case 0x82:
166 m->rep_count = 0;
167 *state = REMOTE_KEY_PRESSED;
168 break;
169
170 case 0x91:
171 case 0x81: /* pinnacle PCTV310e */
172 /* prevent immediate auto-repeat */
173 if (++m->rep_count > 2)
174 *state = REMOTE_KEY_REPEAT;
175 else
176 *state = REMOTE_NO_KEY_PRESSED;
177 break;
178
179 default:
180 deb("Unexpected rc state %02x\n", rc_state);
181 *state = REMOTE_NO_KEY_PRESSED;
182 break;
183 }
184}
185
186static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
187{
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300188 int i, ret = 0;
Florian Mickler513ea352011-03-21 15:33:45 -0300189 u8 *rc_state;
190
191 rc_state = kmalloc(2, GFP_KERNEL);
192 if (!rc_state)
193 return -ENOMEM;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300194
Mauro Carvalho Chehab9d5394c2012-12-27 16:32:58 -0200195 ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE,
196 rc_state, 1);
197 if (ret != 0)
Florian Mickler513ea352011-03-21 15:33:45 -0300198 goto out;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300199
Mauro Carvalho Chehab9d5394c2012-12-27 16:32:58 -0200200 ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY,
201 rc_state + 1, 1);
202 if (ret != 0)
Florian Mickler513ea352011-03-21 15:33:45 -0300203 goto out;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300204
Antonio Ospite7a7ef462012-12-10 17:37:13 -0300205 m920x_parse_rc_state(d, rc_state[0], state);
206
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300207 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
208 if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) {
209 *event = d->props.rc.legacy.rc_map_table[i].keycode;
Antonio Ospitef526e9e2012-12-10 17:37:12 -0300210 goto out;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300211 }
212
213 if (rc_state[1] != 0)
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300214 deb("Unknown rc key %02x\n", rc_state[1]);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300215
216 *state = REMOTE_NO_KEY_PRESSED;
217
Florian Mickler513ea352011-03-21 15:33:45 -0300218 out:
219 kfree(rc_state);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300220 return ret;
221}
222
Antonio Ospiteb6777572012-12-10 17:37:14 -0300223static int m920x_rc_core_query(struct dvb_usb_device *d)
224{
225 int ret = 0;
226 u8 *rc_state;
227 int state;
228
229 rc_state = kmalloc(2, GFP_KERNEL);
230 if (!rc_state)
231 return -ENOMEM;
232
233 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, &rc_state[0], 1)) != 0)
234 goto out;
235
236 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, &rc_state[1], 1)) != 0)
237 goto out;
238
239 deb("state=0x%02x keycode=0x%02x\n", rc_state[0], rc_state[1]);
240
241 m920x_parse_rc_state(d, rc_state[0], &state);
242
243 if (state == REMOTE_NO_KEY_PRESSED)
244 rc_keyup(d->rc_dev);
245 else if (state == REMOTE_KEY_REPEAT)
246 rc_repeat(d->rc_dev);
247 else
248 rc_keydown(d->rc_dev, rc_state[1], 0);
249
250out:
251 kfree(rc_state);
252 return ret;
253}
254
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300255/* I2C */
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300256static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300257{
258 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Aapo Tahkola26247012007-03-05 18:23:19 -0300259 int i, j;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300260 int ret = 0;
261
Trent Piephod40860f2007-03-05 23:55:00 -0300262 if (!num)
263 return -EINVAL;
264
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300265 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
266 return -EAGAIN;
267
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300268 for (i = 0; i < num; i++) {
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300269 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300270 /* For a 0 byte message, I think sending the address
271 * to index 0x80|0x40 would be the correct thing to
272 * do. However, zero byte messages are only used for
273 * probing, and since we don't know how to get the
274 * slave's ack, we can't probe. */
Trent Piephod40860f2007-03-05 23:55:00 -0300275 ret = -ENOTSUPP;
276 goto unlock;
277 }
278 /* Send START & address/RW bit */
279 if (!(msg[i].flags & I2C_M_NOSTART)) {
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300280 if ((ret = m920x_write(d->udev, M9206_I2C,
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300281 (msg[i].addr << 1) |
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300282 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
Trent Piephod40860f2007-03-05 23:55:00 -0300283 goto unlock;
284 /* Should check for ack here, if we knew how. */
285 }
Aapo Tahkola26247012007-03-05 18:23:19 -0300286 if (msg[i].flags & I2C_M_RD) {
Trent Piephod40860f2007-03-05 23:55:00 -0300287 for (j = 0; j < msg[i].len; j++) {
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300288 /* Last byte of transaction?
289 * Send STOP, otherwise send ACK. */
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300290 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300291
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300292 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300293 0x20 | stop,
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300294 &msg[i].buf[j], 1)) != 0)
Trent Piephod40860f2007-03-05 23:55:00 -0300295 goto unlock;
Aapo Tahkola84ad7572007-01-21 15:57:20 -0300296 }
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300297 } else {
Trent Piephod40860f2007-03-05 23:55:00 -0300298 for (j = 0; j < msg[i].len; j++) {
299 /* Last byte of transaction? Then send STOP. */
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300300 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300301
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300302 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
Trent Piephod40860f2007-03-05 23:55:00 -0300303 goto unlock;
304 /* Should check for ack here too. */
Aapo Tahkola26247012007-03-05 18:23:19 -0300305 }
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300306 }
307 }
Aapo Tahkola26247012007-03-05 18:23:19 -0300308 ret = num;
Trent Piephod40860f2007-03-05 23:55:00 -0300309
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300310 unlock:
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300311 mutex_unlock(&d->i2c_mutex);
312
313 return ret;
314}
315
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300316static u32 m920x_i2c_func(struct i2c_adapter *adapter)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300317{
318 return I2C_FUNC_I2C;
319}
320
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300321static struct i2c_algorithm m920x_i2c_algo = {
322 .master_xfer = m920x_i2c_xfer,
323 .functionality = m920x_i2c_func,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300324};
325
Michael Krufky5afb7072007-03-26 16:35:29 -0300326/* pid filter */
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300327static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300328{
329 int ret = 0;
330
331 if (pid >= 0x8000)
332 return -EINVAL;
333
334 pid |= 0x8000;
335
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300336 if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300337 return ret;
338
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300339 if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300340 return ret;
341
342 return ret;
343}
344
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300345static int m920x_update_filters(struct dvb_usb_adapter *adap)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300346{
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300347 struct m920x_state *m = adap->dev->priv;
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300348 int enabled = m->filtering_enabled[adap->id];
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300349 int i, ret = 0, filter = 0;
Michael Krufky77eed212011-09-06 09:31:57 -0300350 int ep = adap->props.fe[0].stream.endpoint;
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300351
352 for (i = 0; i < M9206_MAX_FILTERS; i++)
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300353 if (m->filters[adap->id][i] == 8192)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300354 enabled = 0;
355
356 /* Disable all filters */
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300357 if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300358 return ret;
359
360 for (i = 0; i < M9206_MAX_FILTERS; i++)
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300361 if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300362 return ret;
363
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300364 /* Set */
365 if (enabled) {
366 for (i = 0; i < M9206_MAX_FILTERS; i++) {
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300367 if (m->filters[adap->id][i] == 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300368 continue;
369
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300370 if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300371 return ret;
372
373 filter++;
374 }
375 }
376
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300377 return ret;
378}
379
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300380static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300381{
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300382 struct m920x_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300383
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300384 m->filtering_enabled[adap->id] = onoff ? 1 : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300385
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300386 return m920x_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300387}
388
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300389static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300390{
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300391 struct m920x_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300392
Aapo Tahkola47f8df02007-05-08 12:03:55 -0300393 m->filters[adap->id][index] = onoff ? pid : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300394
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300395 return m920x_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300396}
397
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300398static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300399{
400 u16 value, index, size;
Florian Mickler513ea352011-03-21 15:33:45 -0300401 u8 *read, *buff;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300402 int i, pass, ret = 0;
403
404 buff = kmalloc(65536, GFP_KERNEL);
Roel Kluin1601fb12009-09-18 20:09:52 -0300405 if (buff == NULL)
406 return -ENOMEM;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300407
Florian Mickler513ea352011-03-21 15:33:45 -0300408 read = kmalloc(4, GFP_KERNEL);
409 if (!read) {
410 kfree(buff);
411 return -ENOMEM;
412 }
413
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300414 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300415 goto done;
Andy Shevchenko5bdb7872012-09-26 09:55:14 -0300416 deb("%*ph\n", 4, read);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300417
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300418 if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300419 goto done;
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300420 deb("%x\n", read[0]);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300421
422 for (pass = 0; pass < 2; pass++) {
423 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
Al Virofa9c13a2008-05-21 00:32:41 -0300424 value = get_unaligned_le16(fw->data + i);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300425 i += sizeof(u16);
426
Al Virofa9c13a2008-05-21 00:32:41 -0300427 index = get_unaligned_le16(fw->data + i);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300428 i += sizeof(u16);
429
Al Virofa9c13a2008-05-21 00:32:41 -0300430 size = get_unaligned_le16(fw->data + i);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300431 i += sizeof(u16);
432
433 if (pass == 1) {
434 /* Will stall if using fw->data ... */
435 memcpy(buff, fw->data + i, size);
436
437 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
Aapo Tahkola9ad4eef2007-04-20 13:34:25 -0300438 M9206_FW,
439 USB_TYPE_VENDOR | USB_DIR_OUT,
440 value, index, buff, size, 20);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300441 if (ret != size) {
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300442 deb("error while uploading fw!\n");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300443 ret = -EIO;
444 goto done;
445 }
446 msleep(3);
447 }
448 i += size;
449 }
450 if (i != fw->size) {
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300451 deb("bad firmware file!\n");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300452 ret = -EINVAL;
453 goto done;
454 }
455 }
456
457 msleep(36);
458
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300459 /* m920x will disconnect itself from the bus after this. */
460 (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300461 deb("firmware uploaded!\n");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300462
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300463 done:
Florian Mickler513ea352011-03-21 15:33:45 -0300464 kfree(read);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300465 kfree(buff);
466
467 return ret;
468}
469
Michael Krufkye16c1f52007-01-23 15:00:42 -0300470/* Callbacks for DVB USB */
Aapo Tahkola7d1d4e62007-03-15 13:01:46 -0300471static int m920x_identify_state(struct usb_device *udev,
472 struct dvb_usb_device_properties *props,
473 struct dvb_usb_device_description **desc,
474 int *cold)
Michael Krufkye16c1f52007-01-23 15:00:42 -0300475{
476 struct usb_host_interface *alt;
477
478 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
479 *cold = (alt == NULL) ? 1 : 0;
480
481 return 0;
482}
483
Michael Krufky5afb7072007-03-26 16:35:29 -0300484/* demod configurations */
Michael Krufkye7b419b2007-03-26 16:39:20 -0300485static int m920x_mt352_demod_init(struct dvb_frontend *fe)
Michael Krufkye16c1f52007-01-23 15:00:42 -0300486{
Aapo Tahkolad577ee02007-05-08 18:33:52 -0300487 int ret;
Michael Krufkye16c1f52007-01-23 15:00:42 -0300488 u8 config[] = { CONFIG, 0x3d };
489 u8 clock[] = { CLOCK_CTL, 0x30 };
490 u8 reset[] = { RESET, 0x80 };
491 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
492 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
493 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
494 u8 unk1[] = { 0x93, 0x1a };
495 u8 unk2[] = { 0xb5, 0x7a };
496
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300497 deb("Demod init!\n");
Michael Krufkye16c1f52007-01-23 15:00:42 -0300498
Aapo Tahkolad577ee02007-05-08 18:33:52 -0300499 if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0)
500 return ret;
501 if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0)
502 return ret;
503 if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0)
504 return ret;
505 if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0)
506 return ret;
507 if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0)
508 return ret;
509 if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0)
510 return ret;
511 if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0)
512 return ret;
513 if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0)
514 return ret;
515
Michael Krufkye16c1f52007-01-23 15:00:42 -0300516 return 0;
517}
518
Michael Krufkye7b419b2007-03-26 16:39:20 -0300519static struct mt352_config m920x_mt352_config = {
Aapo Tahkola26247012007-03-05 18:23:19 -0300520 .demod_address = 0x0f,
Michael Krufkye16c1f52007-01-23 15:00:42 -0300521 .no_tuner = 1,
Michael Krufkye7b419b2007-03-26 16:39:20 -0300522 .demod_init = m920x_mt352_demod_init,
Michael Krufkye16c1f52007-01-23 15:00:42 -0300523};
524
Michael Krufkye7b419b2007-03-26 16:39:20 -0300525static struct tda1004x_config m920x_tda10046_08_config = {
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300526 .demod_address = 0x08,
527 .invert = 0,
528 .invert_oclk = 0,
529 .ts_mode = TDA10046_TS_SERIAL,
530 .xtal_freq = TDA10046_XTAL_16M,
531 .if_freq = TDA10046_FREQ_045,
532 .agc_config = TDA10046_AGC_TDA827X,
533 .gpio_config = TDA10046_GPTRI,
534 .request_firmware = NULL,
535};
536
Michael Krufkye7b419b2007-03-26 16:39:20 -0300537static struct tda1004x_config m920x_tda10046_0b_config = {
Nick Andrewaa50ec22007-03-22 17:09:35 -0300538 .demod_address = 0x0b,
539 .invert = 0,
540 .invert_oclk = 0,
541 .ts_mode = TDA10046_TS_SERIAL,
542 .xtal_freq = TDA10046_XTAL_16M,
543 .if_freq = TDA10046_FREQ_045,
544 .agc_config = TDA10046_AGC_TDA827X,
545 .gpio_config = TDA10046_GPTRI,
546 .request_firmware = NULL, /* uses firmware EEPROM */
547};
548
Michael Krufky5afb7072007-03-26 16:35:29 -0300549/* tuner configurations */
Michael Krufkye7b419b2007-03-26 16:39:20 -0300550static struct qt1010_config m920x_qt1010_config = {
Michael Krufky5afb7072007-03-26 16:35:29 -0300551 .i2c_address = 0x62
552};
553
Antonio Ospitede8ed822012-12-10 17:37:17 -0300554static struct mt2060_config m920x_mt2060_config = {
555 .i2c_address = 0x60, /* 0xc0 */
556 .clock_out = 0,
557};
558
559
Michael Krufky5afb7072007-03-26 16:35:29 -0300560/* Callbacks for DVB USB */
Michael Krufkye7b419b2007-03-26 16:39:20 -0300561static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
Michael Krufky5afb7072007-03-26 16:35:29 -0300562{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300563 deb("%s\n",__func__);
Michael Krufky5afb7072007-03-26 16:35:29 -0300564
Michael Krufkyd12f51a2011-09-17 14:59:54 -0300565 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
566 &m920x_mt352_config,
567 &adap->dev->i2c_adap);
568 if ((adap->fe_adap[0].fe) == NULL)
Michael Krufky5afb7072007-03-26 16:35:29 -0300569 return -EIO;
570
571 return 0;
572}
573
Antonio Ospitede8ed822012-12-10 17:37:17 -0300574static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap)
575{
576 struct m920x_inits vp7049_fe_init_seq[] = {
577 /* XXX without these commands the frontend cannot be detected,
578 * they must be sent BEFORE the frontend is attached */
579 { 0xff28, 0x00 },
580 { 0xff23, 0x00 },
581 { 0xff28, 0x00 },
582 { 0xff23, 0x00 },
583 { 0xff21, 0x20 },
584 { 0xff21, 0x60 },
585 { 0xff28, 0x00 },
586 { 0xff22, 0x00 },
587 { 0xff20, 0x30 },
588 { 0xff20, 0x20 },
589 { 0xff20, 0x30 },
590 { } /* terminating entry */
591 };
592 int ret;
593
594 deb("%s\n", __func__);
595
596 ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq);
597 if (ret != 0) {
598 deb("Initialization of vp7049 frontend failed.");
599 return ret;
600 }
601
602 return m920x_mt352_frontend_attach(adap);
603}
604
Michael Krufkye7b419b2007-03-26 16:39:20 -0300605static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap)
Michael Krufky5afb7072007-03-26 16:35:29 -0300606{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300607 deb("%s\n",__func__);
Nick Andrewaa50ec22007-03-22 17:09:35 -0300608
Michael Krufkyd12f51a2011-09-17 14:59:54 -0300609 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
610 &m920x_tda10046_08_config,
611 &adap->dev->i2c_adap);
612 if ((adap->fe_adap[0].fe) == NULL)
Nick Andrewaa50ec22007-03-22 17:09:35 -0300613 return -EIO;
614
Nick Andrewaa50ec22007-03-22 17:09:35 -0300615 return 0;
616}
617
Michael Krufkye7b419b2007-03-26 16:39:20 -0300618static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap)
Nick Andrewaa50ec22007-03-22 17:09:35 -0300619{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300620 deb("%s\n",__func__);
Nick Andrewaa50ec22007-03-22 17:09:35 -0300621
Michael Krufkyd12f51a2011-09-17 14:59:54 -0300622 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
623 &m920x_tda10046_0b_config,
624 &adap->dev->i2c_adap);
625 if ((adap->fe_adap[0].fe) == NULL)
Nick Andrewaa50ec22007-03-22 17:09:35 -0300626 return -EIO;
627
Nick Andrewaa50ec22007-03-22 17:09:35 -0300628 return 0;
629}
630
Michael Krufkye7b419b2007-03-26 16:39:20 -0300631static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
Michael Krufky5afb7072007-03-26 16:35:29 -0300632{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300633 deb("%s\n",__func__);
Michael Krufkye7b419b2007-03-26 16:39:20 -0300634
Michael Krufky77eed212011-09-06 09:31:57 -0300635 if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
Michael Krufky5afb7072007-03-26 16:35:29 -0300636 return -ENODEV;
637
638 return 0;
639}
640
Michael Krufkye7b419b2007-03-26 16:39:20 -0300641static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
Michael Krufky5afb7072007-03-26 16:35:29 -0300642{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300643 deb("%s\n",__func__);
Michael Krufkye7b419b2007-03-26 16:39:20 -0300644
Michael Krufky77eed212011-09-06 09:31:57 -0300645 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
Michael Krufky5afb7072007-03-26 16:35:29 -0300646 return -ENODEV;
Nick Andrewaa50ec22007-03-22 17:09:35 -0300647
648 return 0;
649}
650
Michael Krufkye7b419b2007-03-26 16:39:20 -0300651static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
Nick Andrewaa50ec22007-03-22 17:09:35 -0300652{
Harvey Harrison708bebd2008-04-08 23:20:00 -0300653 deb("%s\n",__func__);
Nick Andrewaa50ec22007-03-22 17:09:35 -0300654
Michael Krufky77eed212011-09-06 09:31:57 -0300655 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
Nick Andrewaa50ec22007-03-22 17:09:35 -0300656 return -ENODEV;
657
Nick Andrewaa50ec22007-03-22 17:09:35 -0300658 return 0;
659}
660
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300661static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
662{
Michael Krufky77eed212011-09-06 09:31:57 -0300663 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300664 &adap->dev->i2c_adap, 0x61,
665 TUNER_PHILIPS_FMD1216ME_MK3);
666 return 0;
667}
668
Antonio Ospitede8ed822012-12-10 17:37:17 -0300669static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap)
670{
671 deb("%s\n", __func__);
672
673 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
674 &m920x_mt2060_config, 1220) == NULL)
675 return -ENODEV;
676
677 return 0;
678}
679
680
Michael Krufky5afb7072007-03-26 16:35:29 -0300681/* device-specific initialization */
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300682static struct m920x_inits megasky_rc_init [] = {
Michael Krufky5afb7072007-03-26 16:35:29 -0300683 { M9206_RC_INIT2, 0xa8 },
684 { M9206_RC_INIT1, 0x51 },
685 { } /* terminating entry */
686};
687
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300688static struct m920x_inits tvwalkertwin_rc_init [] = {
Nick Andrewaa50ec22007-03-22 17:09:35 -0300689 { M9206_RC_INIT2, 0x00 },
690 { M9206_RC_INIT1, 0xef },
691 { 0xff28, 0x00 },
692 { 0xff23, 0x00 },
693 { 0xff21, 0x30 },
694 { } /* terminating entry */
695};
696
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300697static struct m920x_inits pinnacle310e_init[] = {
Antonio Ospite90849832012-12-10 17:37:10 -0300698 /* without these the tuner doesn't work */
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300699 { 0xff20, 0x9b },
700 { 0xff22, 0x70 },
701
702 /* rc settings */
703 { 0xff50, 0x80 },
704 { M9206_RC_INIT1, 0x00 },
705 { M9206_RC_INIT2, 0xff },
706 { } /* terminating entry */
707};
708
Antonio Ospitede8ed822012-12-10 17:37:17 -0300709static struct m920x_inits vp7049_rc_init[] = {
710 { 0xff28, 0x00 },
711 { 0xff23, 0x00 },
712 { 0xff21, 0x70 },
713 { M9206_RC_INIT2, 0x00 },
714 { M9206_RC_INIT1, 0xff },
715 { } /* terminating entry */
716};
717
Michael Krufky5afb7072007-03-26 16:35:29 -0300718/* ir keymaps */
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300719static struct rc_map_table rc_map_megasky_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300720 { 0x0012, KEY_POWER },
721 { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */
722 { 0x0002, KEY_CHANNELUP },
723 { 0x0005, KEY_CHANNELDOWN },
724 { 0x0003, KEY_VOLUMEUP },
725 { 0x0006, KEY_VOLUMEDOWN },
726 { 0x0004, KEY_MUTE },
727 { 0x0007, KEY_OK }, /* TS */
728 { 0x0008, KEY_STOP },
729 { 0x0009, KEY_MENU }, /* swap */
730 { 0x000a, KEY_REWIND },
731 { 0x001b, KEY_PAUSE },
732 { 0x001f, KEY_FASTFORWARD },
733 { 0x000c, KEY_RECORD },
734 { 0x000d, KEY_CAMERA }, /* screenshot */
735 { 0x000e, KEY_COFFEE }, /* "MTS" */
Michael Krufky5afb7072007-03-26 16:35:29 -0300736};
737
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300738static struct rc_map_table rc_map_tvwalkertwin_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300739 { 0x0001, KEY_ZOOM }, /* Full Screen */
740 { 0x0002, KEY_CAMERA }, /* snapshot */
741 { 0x0003, KEY_MUTE },
742 { 0x0004, KEY_REWIND },
743 { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */
744 { 0x0006, KEY_FASTFORWARD },
745 { 0x0007, KEY_RECORD },
746 { 0x0008, KEY_STOP },
747 { 0x0009, KEY_TIME }, /* Timeshift */
748 { 0x000c, KEY_COFFEE }, /* Recall */
749 { 0x000e, KEY_CHANNELUP },
750 { 0x0012, KEY_POWER },
751 { 0x0015, KEY_MENU }, /* source */
752 { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */
753 { 0x001a, KEY_CHANNELDOWN },
754 { 0x001b, KEY_VOLUMEDOWN },
755 { 0x001e, KEY_VOLUMEUP },
Michael Krufky5afb7072007-03-26 16:35:29 -0300756};
757
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300758static struct rc_map_table rc_map_pinnacle310e_table[] = {
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300759 { 0x16, KEY_POWER },
760 { 0x17, KEY_FAVORITES },
761 { 0x0f, KEY_TEXT },
Jarod Wilson56c08932011-04-05 18:42:30 -0300762 { 0x48, KEY_PROGRAM }, /* preview */
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300763 { 0x1c, KEY_EPG },
Jarod Wilson56c08932011-04-05 18:42:30 -0300764 { 0x04, KEY_LIST }, /* record list */
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300765 { 0x03, KEY_1 },
766 { 0x01, KEY_2 },
767 { 0x06, KEY_3 },
768 { 0x09, KEY_4 },
769 { 0x1d, KEY_5 },
770 { 0x1f, KEY_6 },
771 { 0x0d, KEY_7 },
772 { 0x19, KEY_8 },
773 { 0x1b, KEY_9 },
774 { 0x15, KEY_0 },
775 { 0x0c, KEY_CANCEL },
776 { 0x4a, KEY_CLEAR },
777 { 0x13, KEY_BACK },
778 { 0x00, KEY_TAB },
779 { 0x4b, KEY_UP },
780 { 0x4e, KEY_LEFT },
781 { 0x52, KEY_RIGHT },
782 { 0x51, KEY_DOWN },
783 { 0x4f, KEY_ENTER }, /* could also be KEY_OK */
784 { 0x1e, KEY_VOLUMEUP },
785 { 0x0a, KEY_VOLUMEDOWN },
786 { 0x05, KEY_CHANNELUP },
787 { 0x02, KEY_CHANNELDOWN },
788 { 0x11, KEY_RECORD },
789 { 0x14, KEY_PLAY },
790 { 0x4c, KEY_PAUSE },
791 { 0x1a, KEY_STOP },
792 { 0x40, KEY_REWIND },
793 { 0x12, KEY_FASTFORWARD },
794 { 0x41, KEY_PREVIOUSSONG }, /* Replay */
795 { 0x42, KEY_NEXTSONG }, /* Skip */
796 { 0x54, KEY_CAMERA }, /* Capture */
797/* { 0x50, KEY_SAP }, */ /* Sap */
798 { 0x47, KEY_CYCLEWINDOWS }, /* Pip */
799 { 0x4d, KEY_SCREEN }, /* FullScreen */
800 { 0x08, KEY_SUBTITLE },
801 { 0x0e, KEY_MUTE },
802/* { 0x49, KEY_LR }, */ /* L/R */
803 { 0x07, KEY_SLEEP }, /* Hibernate */
Jarod Wilson56c08932011-04-05 18:42:30 -0300804 { 0x08, KEY_VIDEO }, /* A/V */
805 { 0x0e, KEY_MENU }, /* Recall */
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300806 { 0x45, KEY_ZOOMIN },
807 { 0x46, KEY_ZOOMOUT },
Jarod Wilson56c08932011-04-05 18:42:30 -0300808 { 0x18, KEY_RED }, /* Red */
809 { 0x53, KEY_GREEN }, /* Green */
810 { 0x5e, KEY_YELLOW }, /* Yellow */
811 { 0x5f, KEY_BLUE }, /* Blue */
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300812};
813
Michael Krufky26f48ea2006-09-28 01:46:49 -0300814/* DVB USB Driver stuff */
815static struct dvb_usb_device_properties megasky_properties;
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300816static struct dvb_usb_device_properties digivox_mini_ii_properties;
Nick Andrewaa50ec22007-03-22 17:09:35 -0300817static struct dvb_usb_device_properties tvwalkertwin_properties;
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -0300818static struct dvb_usb_device_properties dposh_properties;
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300819static struct dvb_usb_device_properties pinnacle_pctv310e_properties;
Antonio Ospitede8ed822012-12-10 17:37:17 -0300820static struct dvb_usb_device_properties vp7049_properties;
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300821
Michael Krufkyfa948052007-01-21 15:57:48 -0300822static int m920x_probe(struct usb_interface *intf,
823 const struct usb_device_id *id)
Michael Krufky26f48ea2006-09-28 01:46:49 -0300824{
Aapo Tahkola55bbe5e2007-05-08 12:56:54 -0300825 struct dvb_usb_device *d = NULL;
Michael Krufky26f48ea2006-09-28 01:46:49 -0300826 int ret;
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300827 struct m920x_inits *rc_init_seq = NULL;
Nick Andrewaa50ec22007-03-22 17:09:35 -0300828 int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
Michael Krufky26f48ea2006-09-28 01:46:49 -0300829
Aapo Tahkolabf2b4f62007-03-26 16:59:16 -0300830 deb("Probing for m920x device at interface %d\n", bInterfaceNumber);
Michael Krufky26f48ea2006-09-28 01:46:49 -0300831
Nick Andrewaa50ec22007-03-22 17:09:35 -0300832 if (bInterfaceNumber == 0) {
833 /* Single-tuner device, or first interface on
834 * multi-tuner device
835 */
Michael Krufky26f48ea2006-09-28 01:46:49 -0300836
Janne Grunau78e92002008-04-09 19:13:13 -0300837 ret = dvb_usb_device_init(intf, &megasky_properties,
838 THIS_MODULE, &d, adapter_nr);
839 if (ret == 0) {
Nick Andrewaa50ec22007-03-22 17:09:35 -0300840 rc_init_seq = megasky_rc_init;
841 goto found;
842 }
843
Janne Grunau78e92002008-04-09 19:13:13 -0300844 ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
845 THIS_MODULE, &d, adapter_nr);
846 if (ret == 0) {
Nick Andrewaa50ec22007-03-22 17:09:35 -0300847 /* No remote control, so no rc_init_seq */
848 goto found;
849 }
850
851 /* This configures both tuners on the TV Walker Twin */
Janne Grunau78e92002008-04-09 19:13:13 -0300852 ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
853 THIS_MODULE, &d, adapter_nr);
854 if (ret == 0) {
Nick Andrewaa50ec22007-03-22 17:09:35 -0300855 rc_init_seq = tvwalkertwin_rc_init;
856 goto found;
857 }
858
Janne Grunau78e92002008-04-09 19:13:13 -0300859 ret = dvb_usb_device_init(intf, &dposh_properties,
860 THIS_MODULE, &d, adapter_nr);
861 if (ret == 0) {
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -0300862 /* Remote controller not supported yet. */
863 goto found;
864 }
865
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300866 ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties,
867 THIS_MODULE, &d, adapter_nr);
868 if (ret == 0) {
869 rc_init_seq = pinnacle310e_init;
870 goto found;
871 }
872
Antonio Ospitede8ed822012-12-10 17:37:17 -0300873 ret = dvb_usb_device_init(intf, &vp7049_properties,
874 THIS_MODULE, &d, adapter_nr);
875 if (ret == 0) {
876 rc_init_seq = vp7049_rc_init;
877 goto found;
878 }
879
Nick Andrewaa50ec22007-03-22 17:09:35 -0300880 return ret;
881 } else {
882 /* Another interface on a multi-tuner device */
883
884 /* The LifeView TV Walker Twin gets here, but struct
885 * tvwalkertwin_properties already configured both
886 * tuners, so there is nothing for us to do here
887 */
Nick Andrewaa50ec22007-03-22 17:09:35 -0300888 }
Michael Krufky26f48ea2006-09-28 01:46:49 -0300889
Michael Krufkye7b419b2007-03-26 16:39:20 -0300890 found:
Aapo Tahkola55bbe5e2007-05-08 12:56:54 -0300891 if ((ret = m920x_init_ep(intf)) < 0)
Aapo Tahkola480ac762007-03-05 18:54:27 -0300892 return ret;
893
Aapo Tahkola55bbe5e2007-05-08 12:56:54 -0300894 if (d && (ret = m920x_init(d, rc_init_seq)) != 0)
Aapo Tahkola480ac762007-03-05 18:54:27 -0300895 return ret;
896
Michael Krufky26f48ea2006-09-28 01:46:49 -0300897 return ret;
898}
899
900static struct usb_device_id m920x_table [] = {
901 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300902 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
903 USB_PID_MSI_DIGI_VOX_MINI_II) },
Nick Andrewaa50ec22007-03-22 17:09:35 -0300904 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
905 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },
906 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
907 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -0300908 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
909 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -0300910 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) },
Antonio Ospitede8ed822012-12-10 17:37:17 -0300911 { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) },
Michael Krufky26f48ea2006-09-28 01:46:49 -0300912 { } /* Terminating entry */
913};
914MODULE_DEVICE_TABLE (usb, m920x_table);
915
Michael Krufky01cb34d2006-09-23 20:01:29 -0300916static struct dvb_usb_device_properties megasky_properties = {
Michael Krufky758117c2007-01-23 15:34:10 -0300917 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
Michael Krufky1f61f3b2006-10-07 15:03:04 -0300918
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300919 .usb_ctrl = DEVICE_SPECIFIC,
920 .firmware = "dvb-usb-megasky-02.fw",
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300921 .download_firmware = m920x_firmware_download,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300922
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300923 .rc.legacy = {
924 .rc_interval = 100,
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300925 .rc_map_table = rc_map_megasky_table,
926 .rc_map_size = ARRAY_SIZE(rc_map_megasky_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300927 .rc_query = m920x_rc_query,
928 },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300929
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300930 .size_of_priv = sizeof(struct m920x_state),
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300931
Aapo Tahkola7d1d4e62007-03-15 13:01:46 -0300932 .identify_state = m920x_identify_state,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300933 .num_adapters = 1,
934 .adapter = {{
Michael Krufky77eed212011-09-06 09:31:57 -0300935 .num_frontends = 1,
936 .fe = {{
937
Michael Krufky758117c2007-01-23 15:34:10 -0300938 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
939 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
940
Michael Krufky01cb34d2006-09-23 20:01:29 -0300941 .pid_filter_count = 8,
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300942 .pid_filter = m920x_pid_filter,
943 .pid_filter_ctrl = m920x_pid_filter_ctrl,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300944
Michael Krufkye7b419b2007-03-26 16:39:20 -0300945 .frontend_attach = m920x_mt352_frontend_attach,
946 .tuner_attach = m920x_qt1010_tuner_attach,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300947
948 .stream = {
949 .type = USB_BULK,
950 .count = 8,
951 .endpoint = 0x81,
952 .u = {
953 .bulk = {
954 .buffersize = 512,
955 }
956 }
957 },
Michael Krufky77eed212011-09-06 09:31:57 -0300958 }},
Michael Krufky01cb34d2006-09-23 20:01:29 -0300959 }},
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300960 .i2c_algo = &m920x_i2c_algo,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300961
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300962 .num_device_descs = 1,
963 .devices = {
964 { "MSI Mega Sky 580 DVB-T USB2.0",
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300965 { &m920x_table[0], NULL },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300966 { NULL },
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300967 }
968 }
969};
970
971static struct dvb_usb_device_properties digivox_mini_ii_properties = {
972 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
973
974 .usb_ctrl = DEVICE_SPECIFIC,
975 .firmware = "dvb-usb-digivox-02.fw",
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300976 .download_firmware = m920x_firmware_download,
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300977
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300978 .size_of_priv = sizeof(struct m920x_state),
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300979
980 .identify_state = m920x_identify_state,
981 .num_adapters = 1,
982 .adapter = {{
Michael Krufky77eed212011-09-06 09:31:57 -0300983 .num_frontends = 1,
984 .fe = {{
985
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300986 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
Michael Krufkyd3911ea2007-03-22 19:03:37 -0300987 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300988
989 .pid_filter_count = 8,
Aapo Tahkola4fd74a72007-03-26 17:05:59 -0300990 .pid_filter = m920x_pid_filter,
991 .pid_filter_ctrl = m920x_pid_filter_ctrl,
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300992
Michael Krufkye7b419b2007-03-26 16:39:20 -0300993 .frontend_attach = m920x_tda10046_08_frontend_attach,
994 .tuner_attach = m920x_tda8275_60_tuner_attach,
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -0300995
996 .stream = {
997 .type = USB_BULK,
998 .count = 8,
999 .endpoint = 0x81,
1000 .u = {
1001 .bulk = {
1002 .buffersize = 0x4000,
1003 }
1004 }
1005 },
Michael Krufky77eed212011-09-06 09:31:57 -03001006 }},
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -03001007 }},
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001008 .i2c_algo = &m920x_i2c_algo,
Pierre Willenbrockd4ca23b2007-03-18 19:54:07 -03001009
1010 .num_device_descs = 1,
1011 .devices = {
1012 { "MSI DIGI VOX mini II DVB-T USB2.0",
1013 { &m920x_table[1], NULL },
1014 { NULL },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001015 },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001016 }
1017};
1018
Michael Krufkye7b419b2007-03-26 16:39:20 -03001019/* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
1020 *
1021 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
1022 * TDA10046 #0 is located at i2c address 0x08
Aapo Tahkola3ab3b692007-05-08 18:23:38 -03001023 * TDA10046 #1 is located at i2c address 0x0b
Michael Krufkye7b419b2007-03-26 16:39:20 -03001024 * TDA8275A #0 is located at i2c address 0x60
Aapo Tahkola3ab3b692007-05-08 18:23:38 -03001025 * TDA8275A #1 is located at i2c address 0x61
Michael Krufkye7b419b2007-03-26 16:39:20 -03001026 */
Nick Andrewaa50ec22007-03-22 17:09:35 -03001027static struct dvb_usb_device_properties tvwalkertwin_properties = {
1028 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1029
1030 .usb_ctrl = DEVICE_SPECIFIC,
1031 .firmware = "dvb-usb-tvwalkert.fw",
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001032 .download_firmware = m920x_firmware_download,
Nick Andrewaa50ec22007-03-22 17:09:35 -03001033
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001034 .rc.legacy = {
1035 .rc_interval = 100,
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001036 .rc_map_table = rc_map_tvwalkertwin_table,
1037 .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001038 .rc_query = m920x_rc_query,
1039 },
Nick Andrewaa50ec22007-03-22 17:09:35 -03001040
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001041 .size_of_priv = sizeof(struct m920x_state),
Nick Andrewaa50ec22007-03-22 17:09:35 -03001042
1043 .identify_state = m920x_identify_state,
Aapo Tahkola3ab3b692007-05-08 18:23:38 -03001044 .num_adapters = 2,
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001045 .adapter = {{
Michael Krufky77eed212011-09-06 09:31:57 -03001046 .num_frontends = 1,
1047 .fe = {{
1048
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001049 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1050 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
Nick Andrewaa50ec22007-03-22 17:09:35 -03001051
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001052 .pid_filter_count = 8,
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001053 .pid_filter = m920x_pid_filter,
1054 .pid_filter_ctrl = m920x_pid_filter_ctrl,
Nick Andrewaa50ec22007-03-22 17:09:35 -03001055
Michael Krufkye7b419b2007-03-26 16:39:20 -03001056 .frontend_attach = m920x_tda10046_08_frontend_attach,
1057 .tuner_attach = m920x_tda8275_60_tuner_attach,
Nick Andrewaa50ec22007-03-22 17:09:35 -03001058
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001059 .stream = {
1060 .type = USB_BULK,
1061 .count = 8,
1062 .endpoint = 0x81,
1063 .u = {
1064 .bulk = {
1065 .buffersize = 512,
1066 }
1067 }
Michael Krufky77eed212011-09-06 09:31:57 -03001068 }},
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001069 }},{
Michael Krufky77eed212011-09-06 09:31:57 -03001070 .num_frontends = 1,
1071 .fe = {{
1072
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001073 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1074 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1075
1076 .pid_filter_count = 8,
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001077 .pid_filter = m920x_pid_filter,
1078 .pid_filter_ctrl = m920x_pid_filter_ctrl,
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001079
Michael Krufkye7b419b2007-03-26 16:39:20 -03001080 .frontend_attach = m920x_tda10046_0b_frontend_attach,
1081 .tuner_attach = m920x_tda8275_61_tuner_attach,
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001082
1083 .stream = {
1084 .type = USB_BULK,
1085 .count = 8,
1086 .endpoint = 0x82,
1087 .u = {
1088 .bulk = {
1089 .buffersize = 512,
1090 }
1091 }
Michael Krufky77eed212011-09-06 09:31:57 -03001092 }},
Nick Andrewaa50ec22007-03-22 17:09:35 -03001093 },
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001094 }},
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001095 .i2c_algo = &m920x_i2c_algo,
Nick Andrewaa50ec22007-03-22 17:09:35 -03001096
1097 .num_device_descs = 1,
1098 .devices = {
1099 { .name = "LifeView TV Walker Twin DVB-T USB2.0",
1100 .cold_ids = { &m920x_table[2], NULL },
1101 .warm_ids = { &m920x_table[3], NULL },
1102 },
1103 }
1104};
1105
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001106static struct dvb_usb_device_properties dposh_properties = {
1107 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1108
1109 .usb_ctrl = DEVICE_SPECIFIC,
1110 .firmware = "dvb-usb-dposh-01.fw",
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001111 .download_firmware = m920x_firmware_download,
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001112
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001113 .size_of_priv = sizeof(struct m920x_state),
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001114
1115 .identify_state = m920x_identify_state,
1116 .num_adapters = 1,
1117 .adapter = {{
Michael Krufky77eed212011-09-06 09:31:57 -03001118 .num_frontends = 1,
1119 .fe = {{
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001120 /* Hardware pid filters don't work with this device/firmware */
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001121
Michael Krufkye7b419b2007-03-26 16:39:20 -03001122 .frontend_attach = m920x_mt352_frontend_attach,
1123 .tuner_attach = m920x_qt1010_tuner_attach,
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001124
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001125 .stream = {
1126 .type = USB_BULK,
1127 .count = 8,
1128 .endpoint = 0x81,
1129 .u = {
1130 .bulk = {
1131 .buffersize = 512,
1132 }
1133 }
1134 },
Michael Krufky77eed212011-09-06 09:31:57 -03001135 }},
Michael Krufkyd3911ea2007-03-22 19:03:37 -03001136 }},
Aapo Tahkola4fd74a72007-03-26 17:05:59 -03001137 .i2c_algo = &m920x_i2c_algo,
Aapo Tahkolaf8e0bd52007-03-22 17:37:58 -03001138
1139 .num_device_descs = 1,
1140 .devices = {
1141 { .name = "Dposh DVB-T USB2.0",
1142 .cold_ids = { &m920x_table[4], NULL },
1143 .warm_ids = { &m920x_table[5], NULL },
1144 },
1145 }
1146};
1147
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -03001148static struct dvb_usb_device_properties pinnacle_pctv310e_properties = {
1149 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1150
1151 .usb_ctrl = DEVICE_SPECIFIC,
1152 .download_firmware = NULL,
1153
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001154 .rc.legacy = {
1155 .rc_interval = 100,
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001156 .rc_map_table = rc_map_pinnacle310e_table,
1157 .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001158 .rc_query = m920x_rc_query,
1159 },
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -03001160
1161 .size_of_priv = sizeof(struct m920x_state),
1162
1163 .identify_state = m920x_identify_state,
1164 .num_adapters = 1,
1165 .adapter = {{
Michael Krufky77eed212011-09-06 09:31:57 -03001166 .num_frontends = 1,
1167 .fe = {{
1168
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -03001169 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1170 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1171
1172 .pid_filter_count = 8,
1173 .pid_filter = m920x_pid_filter,
1174 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1175
1176 .frontend_attach = m920x_mt352_frontend_attach,
1177 .tuner_attach = m920x_fmd1216me_tuner_attach,
1178
1179 .stream = {
1180 .type = USB_ISOC,
1181 .count = 5,
1182 .endpoint = 0x84,
1183 .u = {
1184 .isoc = {
1185 .framesperurb = 128,
1186 .framesize = 564,
1187 .interval = 1,
1188 }
1189 }
1190 },
Michael Krufky77eed212011-09-06 09:31:57 -03001191 }},
Massimo Del Fedele3d36f5c2009-10-24 13:12:37 -03001192 } },
1193 .i2c_algo = &m920x_i2c_algo,
1194
1195 .num_device_descs = 1,
1196 .devices = {
1197 { "Pinnacle PCTV 310e",
1198 { &m920x_table[6], NULL },
1199 { NULL },
1200 }
1201 }
1202};
1203
Antonio Ospitede8ed822012-12-10 17:37:17 -03001204static struct dvb_usb_device_properties vp7049_properties = {
1205 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1206
1207 .usb_ctrl = DEVICE_SPECIFIC,
1208 .firmware = "dvb-usb-vp7049-0.95.fw",
1209 .download_firmware = m920x_firmware_download,
1210
1211 .rc.core = {
1212 .rc_interval = 150,
1213 .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS,
1214 .rc_query = m920x_rc_core_query,
Sean Young58a61f92013-07-08 17:33:10 -03001215 .allowed_protos = RC_BIT_UNKNOWN,
Antonio Ospitede8ed822012-12-10 17:37:17 -03001216 },
1217
1218 .size_of_priv = sizeof(struct m920x_state),
1219
1220 .identify_state = m920x_identify_state,
1221 .num_adapters = 1,
1222 .adapter = {{
1223 .num_frontends = 1,
1224 .fe = {{
1225
1226 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1227 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1228
1229 .pid_filter_count = 8,
1230 .pid_filter = m920x_pid_filter,
1231 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1232
1233 .frontend_attach = m920x_mt352_frontend_attach_vp7049,
1234 .tuner_attach = m920x_mt2060_tuner_attach,
1235
1236 .stream = {
1237 .type = USB_BULK,
1238 .count = 8,
1239 .endpoint = 0x81,
1240 .u = {
1241 .bulk = {
1242 .buffersize = 512,
1243 }
1244 }
1245 },
1246 } },
1247 } },
1248 .i2c_algo = &m920x_i2c_algo,
1249
1250 .num_device_descs = 1,
1251 .devices = {
1252 { "DTV-DVB UDTT7049",
1253 { &m920x_table[7], NULL },
1254 { NULL },
1255 }
1256 }
1257};
1258
Michael Krufkybaa2ed02006-09-23 20:01:29 -03001259static struct usb_driver m920x_driver = {
1260 .name = "dvb_usb_m920x",
Michael Krufky2a2bfa72006-09-23 20:13:12 -03001261 .probe = m920x_probe,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001262 .disconnect = dvb_usb_device_exit,
Michael Krufkybaa2ed02006-09-23 20:01:29 -03001263 .id_table = m920x_table,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001264};
1265
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -08001266module_usb_driver(m920x_driver);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001267
1268MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
Nick Andrewaa50ec22007-03-22 17:09:35 -03001269MODULE_DESCRIPTION("DVB Driver for ULI M920x");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001270MODULE_VERSION("0.1");
1271MODULE_LICENSE("GPL");
Michael Krufkyce9c2752007-03-22 17:18:26 -03001272
1273/*
1274 * Local variables:
1275 * c-basic-offset: 8
1276 */