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 | * |
| 9 | * see Documentation/dvb/README.dvb-usb for more information |
| 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" |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 19 | |
| 20 | /* debug */ |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 21 | static int dvb_usb_m920x_debug; |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 22 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
| 24 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 25 | 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] | 26 | u16 index, void *data, int size) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 27 | { |
| 28 | int ret; |
| 29 | |
| 30 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
| 31 | request, USB_TYPE_VENDOR | USB_DIR_IN, |
| 32 | value, index, data, size, 2000); |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 33 | if (ret < 0) { |
| 34 | printk(KERN_INFO "m920x_read = error: %d\n", ret); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 35 | return ret; |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 36 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 37 | |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 38 | if (ret != size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 39 | deb("m920x_read = no data\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 40 | return -EIO; |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 41 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 42 | |
| 43 | return 0; |
| 44 | } |
| 45 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 46 | static inline int m920x_write(struct usb_device *udev, u8 request, |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 47 | u16 value, u16 index) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 48 | { |
| 49 | int ret; |
| 50 | |
| 51 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
| 52 | request, USB_TYPE_VENDOR | USB_DIR_OUT, |
| 53 | value, index, NULL, 0, 2000); |
Pierre Willenbrock | 59069e5 | 2007-03-15 13:24:29 -0300 | [diff] [blame] | 54 | |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 55 | return ret; |
| 56 | } |
| 57 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 58 | 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] | 59 | { |
| 60 | int ret = 0; |
| 61 | |
| 62 | /* Remote controller init. */ |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 63 | if (d->props.rc_query) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 64 | deb("Initialising remote control\n"); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 65 | while (rc_seq->address) { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 66 | if ((ret = m920x_write(d->udev, M9206_CORE, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 67 | rc_seq->data, |
| 68 | rc_seq->address)) != 0) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 69 | deb("Initialising remote control failed\n"); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 70 | return ret; |
| 71 | } |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 72 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 73 | rc_seq++; |
| 74 | } |
| 75 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 76 | deb("Initialising remote control success\n"); |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 77 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 78 | |
| 79 | return ret; |
| 80 | } |
| 81 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 82 | static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 83 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 84 | struct m920x_state *m = d->priv; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 85 | int i, ret = 0; |
| 86 | u8 rc_state[2]; |
| 87 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 88 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 89 | rc_state, 1)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 90 | goto unlock; |
| 91 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 92 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 93 | rc_state + 1, 1)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 94 | goto unlock; |
| 95 | |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 96 | for (i = 0; i < d->props.rc_key_map_size; i++) |
| 97 | if (d->props.rc_key_map[i].data == rc_state[1]) { |
| 98 | *event = d->props.rc_key_map[i].event; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 99 | |
| 100 | switch(rc_state[0]) { |
| 101 | case 0x80: |
| 102 | *state = REMOTE_NO_KEY_PRESSED; |
| 103 | goto unlock; |
| 104 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 105 | case 0x88: /* framing error or "invalid code" */ |
| 106 | case 0x99: |
| 107 | case 0xc0: |
| 108 | case 0xd8: |
| 109 | *state = REMOTE_NO_KEY_PRESSED; |
| 110 | m->rep_count = 0; |
| 111 | goto unlock; |
| 112 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 113 | case 0x93: |
| 114 | case 0x92: |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 115 | m->rep_count = 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 116 | *state = REMOTE_KEY_PRESSED; |
| 117 | goto unlock; |
| 118 | |
| 119 | case 0x91: |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 120 | /* prevent immediate auto-repeat */ |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 121 | if (++m->rep_count > 2) |
| 122 | *state = REMOTE_KEY_REPEAT; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 123 | else |
| 124 | *state = REMOTE_NO_KEY_PRESSED; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 125 | goto unlock; |
| 126 | |
| 127 | default: |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 128 | deb("Unexpected rc state %02x\n", rc_state[0]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 129 | *state = REMOTE_NO_KEY_PRESSED; |
| 130 | goto unlock; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (rc_state[1] != 0) |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 135 | deb("Unknown rc key %02x\n", rc_state[1]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 136 | |
| 137 | *state = REMOTE_NO_KEY_PRESSED; |
| 138 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 139 | unlock: |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 140 | |
| 141 | return ret; |
| 142 | } |
| 143 | |
| 144 | /* I2C */ |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 145 | static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 146 | int num) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 147 | { |
| 148 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 149 | int i, j; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 150 | int ret = 0; |
| 151 | |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 152 | if (!num) |
| 153 | return -EINVAL; |
| 154 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 155 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 156 | return -EAGAIN; |
| 157 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 158 | for (i = 0; i < num; i++) { |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 159 | if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | |
| 160 | I2C_M_TEN) || msg[i].len == 0) { |
| 161 | /* For a 0 byte message, I think sending the address |
| 162 | * to index 0x80|0x40 would be the correct thing to |
| 163 | * do. However, zero byte messages are only used for |
| 164 | * probing, and since we don't know how to get the |
| 165 | * slave's ack, we can't probe. */ |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 166 | ret = -ENOTSUPP; |
| 167 | goto unlock; |
| 168 | } |
| 169 | /* Send START & address/RW bit */ |
| 170 | if (!(msg[i].flags & I2C_M_NOSTART)) { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 171 | if ((ret = m920x_write(d->udev, M9206_I2C, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 172 | (msg[i].addr << 1) | |
| 173 | (msg[i].flags & I2C_M_RD ? 0x01 : 0), |
| 174 | 0x80)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 175 | goto unlock; |
| 176 | /* Should check for ack here, if we knew how. */ |
| 177 | } |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 178 | if (msg[i].flags & I2C_M_RD) { |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 179 | for (j = 0; j < msg[i].len; j++) { |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 180 | /* Last byte of transaction? |
| 181 | * Send STOP, otherwise send ACK. */ |
| 182 | int stop = (i+1 == num && j+1 == msg[i].len) |
| 183 | ? 0x40 : 0x01; |
| 184 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 185 | if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 186 | 0x20|stop, |
| 187 | &msg[i].buf[j], 1)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 188 | goto unlock; |
Aapo Tahkola | 84ad757 | 2007-01-21 15:57:20 -0300 | [diff] [blame] | 189 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 190 | } else { |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 191 | for (j = 0; j < msg[i].len; j++) { |
| 192 | /* Last byte of transaction? Then send STOP. */ |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 193 | int stop = (i+1 == num && j+1 == msg[i].len) |
| 194 | ? 0x40 : 0x00; |
| 195 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 196 | if ((ret = m920x_write(d->udev, M9206_I2C, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 197 | msg[i].buf[j], |
| 198 | stop)) != 0) |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 199 | goto unlock; |
| 200 | /* Should check for ack here too. */ |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 201 | } |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 202 | } |
| 203 | } |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 204 | ret = num; |
Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 205 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 206 | unlock: |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 207 | mutex_unlock(&d->i2c_mutex); |
| 208 | |
| 209 | return ret; |
| 210 | } |
| 211 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 212 | static u32 m920x_i2c_func(struct i2c_adapter *adapter) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 213 | { |
| 214 | return I2C_FUNC_I2C; |
| 215 | } |
| 216 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 217 | static struct i2c_algorithm m920x_i2c_algo = { |
| 218 | .master_xfer = m920x_i2c_xfer, |
| 219 | .functionality = m920x_i2c_func, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 220 | }; |
| 221 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 222 | /* pid filter */ |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 223 | static int m920x_set_filter(struct dvb_usb_adapter *adap, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 224 | int type, int idx, int pid) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 225 | { |
| 226 | int ret = 0; |
| 227 | |
| 228 | if (pid >= 0x8000) |
| 229 | return -EINVAL; |
| 230 | |
| 231 | pid |= 0x8000; |
| 232 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 233 | if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 234 | (type << 8) | (idx * 4) )) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 235 | return ret; |
| 236 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 237 | if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 238 | (type << 8) | (idx * 4) )) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 239 | return ret; |
| 240 | |
| 241 | return ret; |
| 242 | } |
| 243 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 244 | static int m920x_update_filters(struct dvb_usb_adapter *adap) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 245 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 246 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 247 | int enabled = m->filtering_enabled; |
| 248 | int i, ret = 0, filter = 0; |
| 249 | |
| 250 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
| 251 | if (m->filters[i] == 8192) |
| 252 | enabled = 0; |
| 253 | |
| 254 | /* Disable all filters */ |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 255 | if ((ret = m920x_set_filter(adap, 0x81, 1, enabled)) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 256 | return ret; |
| 257 | |
| 258 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 259 | if ((ret = m920x_set_filter(adap, 0x81, i + 2, 0)) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 260 | return ret; |
| 261 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 262 | if ((ret = m920x_set_filter(adap, 0x82, 0, 0x0)) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 263 | return ret; |
| 264 | |
| 265 | /* Set */ |
| 266 | if (enabled) { |
| 267 | for (i = 0; i < M9206_MAX_FILTERS; i++) { |
| 268 | if (m->filters[i] == 0) |
| 269 | continue; |
| 270 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 271 | if ((ret = m920x_set_filter(adap, 0x81, filter + 2, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 272 | m->filters[i])) != 0) |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 273 | return ret; |
| 274 | |
| 275 | filter++; |
| 276 | } |
| 277 | } |
| 278 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 279 | if ((ret = m920x_set_filter(adap, 0x82, 0, 0x02f5)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 280 | return ret; |
| 281 | |
| 282 | return ret; |
| 283 | } |
| 284 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 285 | 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] | 286 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 287 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 288 | |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 289 | m->filtering_enabled = onoff ? 1 : 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 290 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 291 | return m920x_update_filters(adap); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 292 | } |
| 293 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 294 | static int m920x_pid_filter(struct dvb_usb_adapter *adap, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 295 | int index, u16 pid, int onoff) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 296 | { |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 297 | struct m920x_state *m = adap->dev->priv; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 298 | |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 299 | m->filters[index] = onoff ? pid : 0; |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 300 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 301 | return m920x_update_filters(adap); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 302 | } |
| 303 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 304 | static int m920x_firmware_download(struct usb_device *udev, |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 305 | const struct firmware *fw) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 306 | { |
| 307 | u16 value, index, size; |
| 308 | u8 read[4], *buff; |
| 309 | int i, pass, ret = 0; |
| 310 | |
| 311 | buff = kmalloc(65536, GFP_KERNEL); |
| 312 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 313 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 314 | goto done; |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 315 | deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 316 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 317 | if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 318 | goto done; |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 319 | deb("%x\n", read[0]); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 320 | |
| 321 | for (pass = 0; pass < 2; pass++) { |
| 322 | for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { |
| 323 | value = le16_to_cpu(*(u16 *)(fw->data + i)); |
| 324 | i += sizeof(u16); |
| 325 | |
| 326 | index = le16_to_cpu(*(u16 *)(fw->data + i)); |
| 327 | i += sizeof(u16); |
| 328 | |
| 329 | size = le16_to_cpu(*(u16 *)(fw->data + i)); |
| 330 | i += sizeof(u16); |
| 331 | |
| 332 | if (pass == 1) { |
| 333 | /* Will stall if using fw->data ... */ |
| 334 | memcpy(buff, fw->data + i, size); |
| 335 | |
| 336 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 337 | M9206_FW, |
| 338 | USB_TYPE_VENDOR | USB_DIR_OUT, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 339 | value, index, buff, size, 20); |
| 340 | if (ret != size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 341 | deb("error while uploading fw!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 342 | ret = -EIO; |
| 343 | goto done; |
| 344 | } |
| 345 | msleep(3); |
| 346 | } |
| 347 | i += size; |
| 348 | } |
| 349 | if (i != fw->size) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 350 | deb("bad firmware file!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 351 | ret = -EINVAL; |
| 352 | goto done; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | msleep(36); |
| 357 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 358 | /* m920x will disconnect itself from the bus after this. */ |
| 359 | (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO); |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 360 | deb("firmware uploaded!\n"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 361 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 362 | done: |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 363 | kfree(buff); |
| 364 | |
| 365 | return ret; |
| 366 | } |
| 367 | |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 368 | /* Callbacks for DVB USB */ |
Aapo Tahkola | 7d1d4e6 | 2007-03-15 13:01:46 -0300 | [diff] [blame] | 369 | static int m920x_identify_state(struct usb_device *udev, |
| 370 | struct dvb_usb_device_properties *props, |
| 371 | struct dvb_usb_device_description **desc, |
| 372 | int *cold) |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 373 | { |
| 374 | struct usb_host_interface *alt; |
| 375 | |
| 376 | alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1); |
| 377 | *cold = (alt == NULL) ? 1 : 0; |
| 378 | |
| 379 | return 0; |
| 380 | } |
| 381 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 382 | /* demod configurations */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 383 | static int m920x_mt352_demod_init(struct dvb_frontend *fe) |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 384 | { |
| 385 | u8 config[] = { CONFIG, 0x3d }; |
| 386 | u8 clock[] = { CLOCK_CTL, 0x30 }; |
| 387 | u8 reset[] = { RESET, 0x80 }; |
| 388 | u8 adc_ctl[] = { ADC_CTL_1, 0x40 }; |
| 389 | u8 agc[] = { AGC_TARGET, 0x1c, 0x20 }; |
| 390 | u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 }; |
| 391 | u8 unk1[] = { 0x93, 0x1a }; |
| 392 | u8 unk2[] = { 0xb5, 0x7a }; |
| 393 | |
| 394 | mt352_write(fe, config, ARRAY_SIZE(config)); |
| 395 | mt352_write(fe, clock, ARRAY_SIZE(clock)); |
| 396 | mt352_write(fe, reset, ARRAY_SIZE(reset)); |
| 397 | mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl)); |
| 398 | mt352_write(fe, agc, ARRAY_SIZE(agc)); |
| 399 | mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc)); |
| 400 | mt352_write(fe, unk1, ARRAY_SIZE(unk1)); |
| 401 | mt352_write(fe, unk2, ARRAY_SIZE(unk2)); |
| 402 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 403 | deb("Demod init!\n"); |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 404 | |
| 405 | return 0; |
| 406 | } |
| 407 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 408 | static struct mt352_config m920x_mt352_config = { |
Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 409 | .demod_address = 0x0f, |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 410 | .no_tuner = 1, |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 411 | .demod_init = m920x_mt352_demod_init, |
Michael Krufky | e16c1f5 | 2007-01-23 15:00:42 -0300 | [diff] [blame] | 412 | }; |
| 413 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 414 | static struct tda1004x_config m920x_tda10046_08_config = { |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 415 | .demod_address = 0x08, |
| 416 | .invert = 0, |
| 417 | .invert_oclk = 0, |
| 418 | .ts_mode = TDA10046_TS_SERIAL, |
| 419 | .xtal_freq = TDA10046_XTAL_16M, |
| 420 | .if_freq = TDA10046_FREQ_045, |
| 421 | .agc_config = TDA10046_AGC_TDA827X, |
| 422 | .gpio_config = TDA10046_GPTRI, |
| 423 | .request_firmware = NULL, |
| 424 | }; |
| 425 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 426 | static struct tda1004x_config m920x_tda10046_0b_config = { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 427 | .demod_address = 0x0b, |
| 428 | .invert = 0, |
| 429 | .invert_oclk = 0, |
| 430 | .ts_mode = TDA10046_TS_SERIAL, |
| 431 | .xtal_freq = TDA10046_XTAL_16M, |
| 432 | .if_freq = TDA10046_FREQ_045, |
| 433 | .agc_config = TDA10046_AGC_TDA827X, |
| 434 | .gpio_config = TDA10046_GPTRI, |
| 435 | .request_firmware = NULL, /* uses firmware EEPROM */ |
| 436 | }; |
| 437 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 438 | /* tuner configurations */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 439 | static struct qt1010_config m920x_qt1010_config = { |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 440 | .i2c_address = 0x62 |
| 441 | }; |
| 442 | |
| 443 | /* Callbacks for DVB USB */ |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 444 | static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 445 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 446 | deb("%s\n",__FUNCTION__); |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 447 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 448 | if ((adap->fe = dvb_attach(mt352_attach, &m920x_mt352_config, |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 449 | &adap->dev->i2c_adap)) == NULL) |
| 450 | return -EIO; |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 455 | static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 456 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 457 | deb("%s\n",__FUNCTION__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 458 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 459 | if ((adap->fe = dvb_attach(tda10046_attach, |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 460 | &m920x_tda10046_08_config, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 461 | &adap->dev->i2c_adap)) == NULL) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 462 | return -EIO; |
| 463 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 464 | return 0; |
| 465 | } |
| 466 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 467 | static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 468 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 469 | deb("%s\n",__FUNCTION__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 470 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 471 | if ((adap->fe = dvb_attach(tda10046_attach, |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 472 | &m920x_tda10046_0b_config, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 473 | &adap->dev->i2c_adap)) == NULL) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 474 | return -EIO; |
| 475 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 476 | return 0; |
| 477 | } |
| 478 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 479 | static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 480 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 481 | deb("%s\n",__FUNCTION__); |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 482 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 483 | if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 484 | &m920x_qt1010_config) == NULL) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 485 | return -ENODEV; |
| 486 | |
| 487 | return 0; |
| 488 | } |
| 489 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 490 | static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 491 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 492 | deb("%s\n",__FUNCTION__); |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 493 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 494 | if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, |
| 495 | NULL) == NULL) |
| 496 | return -ENODEV; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 497 | |
| 498 | return 0; |
| 499 | } |
| 500 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 501 | static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 502 | { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 503 | deb("%s\n",__FUNCTION__); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 504 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 505 | if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 506 | NULL) == NULL) |
| 507 | return -ENODEV; |
| 508 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 509 | return 0; |
| 510 | } |
| 511 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 512 | /* device-specific initialization */ |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 513 | static struct m920x_inits megasky_rc_init [] = { |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 514 | { M9206_RC_INIT2, 0xa8 }, |
| 515 | { M9206_RC_INIT1, 0x51 }, |
| 516 | { } /* terminating entry */ |
| 517 | }; |
| 518 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 519 | static struct m920x_inits tvwalkertwin_rc_init [] = { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 520 | { M9206_RC_INIT2, 0x00 }, |
| 521 | { M9206_RC_INIT1, 0xef }, |
| 522 | { 0xff28, 0x00 }, |
| 523 | { 0xff23, 0x00 }, |
| 524 | { 0xff21, 0x30 }, |
| 525 | { } /* terminating entry */ |
| 526 | }; |
| 527 | |
Michael Krufky | 5afb707 | 2007-03-26 16:35:29 -0300 | [diff] [blame] | 528 | /* ir keymaps */ |
| 529 | static struct dvb_usb_rc_key megasky_rc_keys [] = { |
| 530 | { 0x0, 0x12, KEY_POWER }, |
| 531 | { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */ |
| 532 | { 0x0, 0x02, KEY_CHANNELUP }, |
| 533 | { 0x0, 0x05, KEY_CHANNELDOWN }, |
| 534 | { 0x0, 0x03, KEY_VOLUMEUP }, |
| 535 | { 0x0, 0x06, KEY_VOLUMEDOWN }, |
| 536 | { 0x0, 0x04, KEY_MUTE }, |
| 537 | { 0x0, 0x07, KEY_OK }, /* TS */ |
| 538 | { 0x0, 0x08, KEY_STOP }, |
| 539 | { 0x0, 0x09, KEY_MENU }, /* swap */ |
| 540 | { 0x0, 0x0a, KEY_REWIND }, |
| 541 | { 0x0, 0x1b, KEY_PAUSE }, |
| 542 | { 0x0, 0x1f, KEY_FASTFORWARD }, |
| 543 | { 0x0, 0x0c, KEY_RECORD }, |
| 544 | { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */ |
| 545 | { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */ |
| 546 | }; |
| 547 | |
| 548 | static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { |
| 549 | { 0x0, 0x01, KEY_ZOOM }, /* Full Screen */ |
| 550 | { 0x0, 0x02, KEY_CAMERA }, /* snapshot */ |
| 551 | { 0x0, 0x03, KEY_MUTE }, |
| 552 | { 0x0, 0x04, KEY_REWIND }, |
| 553 | { 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */ |
| 554 | { 0x0, 0x06, KEY_FASTFORWARD }, |
| 555 | { 0x0, 0x07, KEY_RECORD }, |
| 556 | { 0x0, 0x08, KEY_STOP }, |
| 557 | { 0x0, 0x09, KEY_TIME }, /* Timeshift */ |
| 558 | { 0x0, 0x0c, KEY_COFFEE }, /* Recall */ |
| 559 | { 0x0, 0x0e, KEY_CHANNELUP }, |
| 560 | { 0x0, 0x12, KEY_POWER }, |
| 561 | { 0x0, 0x15, KEY_MENU }, /* source */ |
| 562 | { 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */ |
| 563 | { 0x0, 0x1a, KEY_CHANNELDOWN }, |
| 564 | { 0x0, 0x1b, KEY_VOLUMEDOWN }, |
| 565 | { 0x0, 0x1e, KEY_VOLUMEUP }, |
| 566 | }; |
| 567 | |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 568 | /* DVB USB Driver stuff */ |
| 569 | static struct dvb_usb_device_properties megasky_properties; |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 570 | static struct dvb_usb_device_properties digivox_mini_ii_properties; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 571 | static struct dvb_usb_device_properties tvwalkertwin_properties; |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 572 | static struct dvb_usb_device_properties dposh_properties; |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 573 | |
Michael Krufky | fa94805 | 2007-01-21 15:57:48 -0300 | [diff] [blame] | 574 | static int m920x_probe(struct usb_interface *intf, |
| 575 | const struct usb_device_id *id) |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 576 | { |
| 577 | struct dvb_usb_device *d; |
| 578 | struct usb_host_interface *alt; |
| 579 | int ret; |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 580 | struct m920x_inits *rc_init_seq = NULL; |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 581 | int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber; |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 582 | |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 583 | deb("Probing for m920x device at interface %d\n", bInterfaceNumber); |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 584 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 585 | if (bInterfaceNumber == 0) { |
| 586 | /* Single-tuner device, or first interface on |
| 587 | * multi-tuner device |
| 588 | */ |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 589 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 590 | if ((ret = dvb_usb_device_init(intf, &megasky_properties, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 591 | THIS_MODULE, &d)) == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 592 | rc_init_seq = megasky_rc_init; |
| 593 | goto found; |
| 594 | } |
| 595 | |
| 596 | if ((ret = dvb_usb_device_init(intf, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 597 | &digivox_mini_ii_properties, |
| 598 | THIS_MODULE, &d)) == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 599 | /* No remote control, so no rc_init_seq */ |
| 600 | goto found; |
| 601 | } |
| 602 | |
| 603 | /* This configures both tuners on the TV Walker Twin */ |
| 604 | if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 605 | THIS_MODULE, &d)) == 0) { |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 606 | rc_init_seq = tvwalkertwin_rc_init; |
| 607 | goto found; |
| 608 | } |
| 609 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 610 | if ((ret = dvb_usb_device_init(intf, &dposh_properties, |
| 611 | THIS_MODULE, &d)) == 0) { |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 612 | /* Remote controller not supported yet. */ |
| 613 | goto found; |
| 614 | } |
| 615 | |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 616 | return ret; |
| 617 | } else { |
| 618 | /* Another interface on a multi-tuner device */ |
| 619 | |
| 620 | /* The LifeView TV Walker Twin gets here, but struct |
| 621 | * tvwalkertwin_properties already configured both |
| 622 | * tuners, so there is nothing for us to do here |
| 623 | */ |
| 624 | |
| 625 | return -ENODEV; |
| 626 | } |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 627 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 628 | found: |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 629 | alt = usb_altnum_to_altsetting(intf, 1); |
| 630 | if (alt == NULL) { |
Aapo Tahkola | bf2b4f67 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 631 | deb("No alt found!\n"); |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 632 | return -ENODEV; |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 633 | } |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 634 | |
| 635 | ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, |
| 636 | alt->desc.bAlternateSetting); |
| 637 | if (ret < 0) |
| 638 | return ret; |
| 639 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 640 | if ((ret = m920x_init(d, rc_init_seq)) != 0) |
Aapo Tahkola | 480ac76 | 2007-03-05 18:54:27 -0300 | [diff] [blame] | 641 | return ret; |
| 642 | |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 643 | return ret; |
| 644 | } |
| 645 | |
| 646 | static struct usb_device_id m920x_table [] = { |
| 647 | { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) }, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 648 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 649 | USB_PID_MSI_DIGI_VOX_MINI_II) }, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 650 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 651 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) }, |
| 652 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 653 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 654 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, |
| 655 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, |
Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 656 | { } /* Terminating entry */ |
| 657 | }; |
| 658 | MODULE_DEVICE_TABLE (usb, m920x_table); |
| 659 | |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 660 | static struct dvb_usb_device_properties megasky_properties = { |
Michael Krufky | 758117c | 2007-01-23 15:34:10 -0300 | [diff] [blame] | 661 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
Michael Krufky | 1f61f3b | 2006-10-07 15:03:04 -0300 | [diff] [blame] | 662 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 663 | .usb_ctrl = DEVICE_SPECIFIC, |
| 664 | .firmware = "dvb-usb-megasky-02.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 665 | .download_firmware = m920x_firmware_download, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 666 | |
Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 667 | .rc_interval = 100, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 668 | .rc_key_map = megasky_rc_keys, |
| 669 | .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 670 | .rc_query = m920x_rc_query, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 671 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 672 | .size_of_priv = sizeof(struct m920x_state), |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 673 | |
Aapo Tahkola | 7d1d4e6 | 2007-03-15 13:01:46 -0300 | [diff] [blame] | 674 | .identify_state = m920x_identify_state, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 675 | .num_adapters = 1, |
| 676 | .adapter = {{ |
Michael Krufky | 758117c | 2007-01-23 15:34:10 -0300 | [diff] [blame] | 677 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 678 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 679 | |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 680 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 681 | .pid_filter = m920x_pid_filter, |
| 682 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 683 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 684 | .frontend_attach = m920x_mt352_frontend_attach, |
| 685 | .tuner_attach = m920x_qt1010_tuner_attach, |
Michael Krufky | 01cb34d | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 686 | |
| 687 | .stream = { |
| 688 | .type = USB_BULK, |
| 689 | .count = 8, |
| 690 | .endpoint = 0x81, |
| 691 | .u = { |
| 692 | .bulk = { |
| 693 | .buffersize = 512, |
| 694 | } |
| 695 | } |
| 696 | }, |
| 697 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 698 | .i2c_algo = &m920x_i2c_algo, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 699 | |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 700 | .num_device_descs = 1, |
| 701 | .devices = { |
| 702 | { "MSI Mega Sky 580 DVB-T USB2.0", |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 703 | { &m920x_table[0], NULL }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 704 | { NULL }, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 705 | } |
| 706 | } |
| 707 | }; |
| 708 | |
| 709 | static struct dvb_usb_device_properties digivox_mini_ii_properties = { |
| 710 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 711 | |
| 712 | .usb_ctrl = DEVICE_SPECIFIC, |
| 713 | .firmware = "dvb-usb-digivox-02.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 714 | .download_firmware = m920x_firmware_download, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 715 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 716 | .size_of_priv = sizeof(struct m920x_state), |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 717 | |
| 718 | .identify_state = m920x_identify_state, |
| 719 | .num_adapters = 1, |
| 720 | .adapter = {{ |
| 721 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 722 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 723 | |
| 724 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 725 | .pid_filter = m920x_pid_filter, |
| 726 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 727 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 728 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 729 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 730 | |
| 731 | .stream = { |
| 732 | .type = USB_BULK, |
| 733 | .count = 8, |
| 734 | .endpoint = 0x81, |
| 735 | .u = { |
| 736 | .bulk = { |
| 737 | .buffersize = 0x4000, |
| 738 | } |
| 739 | } |
| 740 | }, |
| 741 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 742 | .i2c_algo = &m920x_i2c_algo, |
Pierre Willenbrock | d4ca23b | 2007-03-18 19:54:07 -0300 | [diff] [blame] | 743 | |
| 744 | .num_device_descs = 1, |
| 745 | .devices = { |
| 746 | { "MSI DIGI VOX mini II DVB-T USB2.0", |
| 747 | { &m920x_table[1], NULL }, |
| 748 | { NULL }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 749 | }, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 750 | } |
| 751 | }; |
| 752 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 753 | /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> |
| 754 | * |
| 755 | * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A |
| 756 | * TDA10046 #0 is located at i2c address 0x08 |
| 757 | * TDA10046 #1 is located at i2c address 0x0b |
| 758 | * TDA8275A #0 is located at i2c address 0x60 |
| 759 | * TDA8275A #1 is located at i2c address 0x61 |
| 760 | */ |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 761 | static struct dvb_usb_device_properties tvwalkertwin_properties = { |
| 762 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 763 | |
| 764 | .usb_ctrl = DEVICE_SPECIFIC, |
| 765 | .firmware = "dvb-usb-tvwalkert.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 766 | .download_firmware = m920x_firmware_download, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 767 | |
| 768 | .rc_interval = 100, |
| 769 | .rc_key_map = tvwalkertwin_rc_keys, |
| 770 | .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys), |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 771 | .rc_query = m920x_rc_query, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 772 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 773 | .size_of_priv = sizeof(struct m920x_state), |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 774 | |
| 775 | .identify_state = m920x_identify_state, |
| 776 | .num_adapters = 2, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 777 | .adapter = {{ |
| 778 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 779 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 780 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 781 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 782 | .pid_filter = m920x_pid_filter, |
| 783 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 784 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 785 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 786 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 787 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 788 | .stream = { |
| 789 | .type = USB_BULK, |
| 790 | .count = 8, |
| 791 | .endpoint = 0x81, |
| 792 | .u = { |
| 793 | .bulk = { |
| 794 | .buffersize = 512, |
| 795 | } |
| 796 | } |
| 797 | }},{ |
| 798 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 799 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 800 | |
| 801 | .pid_filter_count = 8, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 802 | .pid_filter = m920x_pid_filter, |
| 803 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 804 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 805 | .frontend_attach = m920x_tda10046_0b_frontend_attach, |
| 806 | .tuner_attach = m920x_tda8275_61_tuner_attach, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 807 | |
| 808 | .stream = { |
| 809 | .type = USB_BULK, |
| 810 | .count = 8, |
| 811 | .endpoint = 0x82, |
| 812 | .u = { |
| 813 | .bulk = { |
| 814 | .buffersize = 512, |
| 815 | } |
| 816 | } |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 817 | }, |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 818 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 819 | .i2c_algo = &m920x_i2c_algo, |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 820 | |
| 821 | .num_device_descs = 1, |
| 822 | .devices = { |
| 823 | { .name = "LifeView TV Walker Twin DVB-T USB2.0", |
| 824 | .cold_ids = { &m920x_table[2], NULL }, |
| 825 | .warm_ids = { &m920x_table[3], NULL }, |
| 826 | }, |
| 827 | } |
| 828 | }; |
| 829 | |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 830 | static struct dvb_usb_device_properties dposh_properties = { |
| 831 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 832 | |
| 833 | .usb_ctrl = DEVICE_SPECIFIC, |
| 834 | .firmware = "dvb-usb-dposh-01.fw", |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 835 | .download_firmware = m920x_firmware_download, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 836 | |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 837 | .size_of_priv = sizeof(struct m920x_state), |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 838 | |
| 839 | .identify_state = m920x_identify_state, |
| 840 | .num_adapters = 1, |
| 841 | .adapter = {{ |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 842 | /* Hardware pid filters don't work with this device/firmware */ |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 843 | |
Michael Krufky | e7b419b | 2007-03-26 16:39:20 -0300 | [diff] [blame] | 844 | .frontend_attach = m920x_mt352_frontend_attach, |
| 845 | .tuner_attach = m920x_qt1010_tuner_attach, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 846 | |
Michael Krufky | d3911ea | 2007-03-22 19:03:37 -0300 | [diff] [blame] | 847 | .stream = { |
| 848 | .type = USB_BULK, |
| 849 | .count = 8, |
| 850 | .endpoint = 0x81, |
| 851 | .u = { |
| 852 | .bulk = { |
| 853 | .buffersize = 512, |
| 854 | } |
| 855 | } |
| 856 | }, |
| 857 | }}, |
Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame^] | 858 | .i2c_algo = &m920x_i2c_algo, |
Aapo Tahkola | f8e0bd5 | 2007-03-22 17:37:58 -0300 | [diff] [blame] | 859 | |
| 860 | .num_device_descs = 1, |
| 861 | .devices = { |
| 862 | { .name = "Dposh DVB-T USB2.0", |
| 863 | .cold_ids = { &m920x_table[4], NULL }, |
| 864 | .warm_ids = { &m920x_table[5], NULL }, |
| 865 | }, |
| 866 | } |
| 867 | }; |
| 868 | |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 869 | static struct usb_driver m920x_driver = { |
| 870 | .name = "dvb_usb_m920x", |
Michael Krufky | 2a2bfa7 | 2006-09-23 20:13:12 -0300 | [diff] [blame] | 871 | .probe = m920x_probe, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 872 | .disconnect = dvb_usb_device_exit, |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 873 | .id_table = m920x_table, |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 874 | }; |
| 875 | |
| 876 | /* module stuff */ |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 877 | static int __init m920x_module_init(void) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 878 | { |
| 879 | int ret; |
| 880 | |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 881 | if ((ret = usb_register(&m920x_driver))) { |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 882 | err("usb_register failed. Error number %d", ret); |
| 883 | return ret; |
| 884 | } |
| 885 | |
| 886 | return 0; |
| 887 | } |
| 888 | |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 889 | static void __exit m920x_module_exit(void) |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 890 | { |
| 891 | /* deregister this driver from the USB subsystem */ |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 892 | usb_deregister(&m920x_driver); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 893 | } |
| 894 | |
Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 895 | module_init (m920x_module_init); |
| 896 | module_exit (m920x_module_exit); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 897 | |
| 898 | MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); |
Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 899 | MODULE_DESCRIPTION("DVB Driver for ULI M920x"); |
Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 900 | MODULE_VERSION("0.1"); |
| 901 | MODULE_LICENSE("GPL"); |
Michael Krufky | ce9c275 | 2007-03-22 17:18:26 -0300 | [diff] [blame] | 902 | |
| 903 | /* |
| 904 | * Local variables: |
| 905 | * c-basic-offset: 8 |
| 906 | */ |