Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1 | /* DVB USB framework compliant Linux driver for the |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 2 | * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 3 | * TeVii S600, S630, S650 Cards |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 4 | * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation, version 2. |
| 9 | * |
| 10 | * see Documentation/dvb/README.dvb-usb for more information |
| 11 | */ |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 12 | #include "dw2102.h" |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 13 | #include "si21xx.h" |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 14 | #include "stv0299.h" |
| 15 | #include "z0194a.h" |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 16 | #include "stv0288.h" |
| 17 | #include "stb6000.h" |
| 18 | #include "eds1547.h" |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 19 | #include "cx24116.h" |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 20 | #include "tda1002x.h" |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 21 | #include "mt312.h" |
| 22 | #include "zl10039.h" |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 23 | #include "ds3000.h" |
| 24 | #include "stv0900.h" |
| 25 | #include "stv6110.h" |
| 26 | #include "stb6100.h" |
| 27 | #include "stb6100_proc.h" |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 28 | |
| 29 | #ifndef USB_PID_DW2102 |
| 30 | #define USB_PID_DW2102 0x2102 |
| 31 | #endif |
| 32 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 33 | #ifndef USB_PID_DW2104 |
| 34 | #define USB_PID_DW2104 0x2104 |
| 35 | #endif |
| 36 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 37 | #ifndef USB_PID_DW3101 |
| 38 | #define USB_PID_DW3101 0x3101 |
| 39 | #endif |
| 40 | |
Igor M. Liplianin | 4cc0edf | 2008-11-05 22:12:56 -0300 | [diff] [blame] | 41 | #ifndef USB_PID_CINERGY_S |
| 42 | #define USB_PID_CINERGY_S 0x0064 |
| 43 | #endif |
| 44 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 45 | #ifndef USB_PID_TEVII_S630 |
| 46 | #define USB_PID_TEVII_S630 0xd630 |
| 47 | #endif |
| 48 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 49 | #ifndef USB_PID_TEVII_S650 |
| 50 | #define USB_PID_TEVII_S650 0xd650 |
| 51 | #endif |
| 52 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 53 | #ifndef USB_PID_TEVII_S660 |
| 54 | #define USB_PID_TEVII_S660 0xd660 |
| 55 | #endif |
| 56 | |
| 57 | #ifndef USB_PID_PROF_1100 |
| 58 | #define USB_PID_PROF_1100 0xb012 |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 59 | #endif |
| 60 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 61 | #define DW210X_READ_MSG 0 |
| 62 | #define DW210X_WRITE_MSG 1 |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 63 | |
| 64 | #define REG_1F_SYMBOLRATE_BYTE0 0x1f |
| 65 | #define REG_20_SYMBOLRATE_BYTE1 0x20 |
| 66 | #define REG_21_SYMBOLRATE_BYTE2 0x21 |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 67 | /* on my own*/ |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 68 | #define DW2102_VOLTAGE_CTRL (0x1800) |
| 69 | #define DW2102_RC_QUERY (0x1a00) |
| 70 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 71 | #define err_str "did not find the firmware file. (%s) " \ |
| 72 | "Please see linux/Documentation/dvb/ for more details " \ |
| 73 | "on firmware-problems." |
| 74 | |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 75 | struct dvb_usb_rc_keys_table { |
| 76 | struct dvb_usb_rc_key *rc_keys; |
| 77 | int rc_keys_size; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 78 | }; |
| 79 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 80 | /* debug */ |
| 81 | static int dvb_usb_dw2102_debug; |
| 82 | module_param_named(debug, dvb_usb_dw2102_debug, int, 0644); |
Igor M. Liplianin | 8a8dad7 | 2009-06-13 08:10:24 -0300 | [diff] [blame] | 83 | MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))." |
| 84 | DVB_USB_DEBUG_STATUS); |
| 85 | |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 86 | /* keymaps */ |
| 87 | static int ir_keymap; |
| 88 | module_param_named(keymap, ir_keymap, int, 0644); |
| 89 | MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs ..."); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 90 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 91 | /* demod probe */ |
| 92 | static int demod_probe = 1; |
| 93 | module_param_named(demod, demod_probe, int, 0644); |
| 94 | MODULE_PARM_DESC(demod, "demod to probe (1=cx24116 2=stv0903+stv6110 " |
| 95 | "4=stv0903+stb6100(or-able))."); |
| 96 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 97 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 98 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 99 | static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value, |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 100 | u16 index, u8 * data, u16 len, int flags) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 101 | { |
| 102 | int ret; |
| 103 | u8 u8buf[len]; |
| 104 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 105 | unsigned int pipe = (flags == DW210X_READ_MSG) ? |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 106 | usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 107 | u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 108 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 109 | if (flags == DW210X_WRITE_MSG) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 110 | memcpy(u8buf, data, len); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 111 | ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, |
| 112 | value, index , u8buf, len, 2000); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 113 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 114 | if (flags == DW210X_READ_MSG) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 115 | memcpy(data, u8buf, len); |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | /* I2C */ |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 120 | static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
| 121 | int num) |
| 122 | { |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 123 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 124 | int i = 0, ret = 0; |
| 125 | u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0}; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 126 | u16 value; |
| 127 | |
| 128 | if (!d) |
| 129 | return -ENODEV; |
| 130 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 131 | return -EAGAIN; |
| 132 | |
| 133 | switch (num) { |
| 134 | case 2: |
| 135 | /* read stv0299 register */ |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 136 | value = msg[0].buf[0];/* register */ |
| 137 | for (i = 0; i < msg[1].len; i++) { |
| 138 | value = value + i; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 139 | ret = dw210x_op_rw(d->udev, 0xb5, value, 0, |
| 140 | buf6, 2, DW210X_READ_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 141 | msg[1].buf[i] = buf6[0]; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 142 | } |
| 143 | break; |
| 144 | case 1: |
| 145 | switch (msg[0].addr) { |
| 146 | case 0x68: |
| 147 | /* write to stv0299 register */ |
| 148 | buf6[0] = 0x2a; |
| 149 | buf6[1] = msg[0].buf[0]; |
| 150 | buf6[2] = msg[0].buf[1]; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 151 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 152 | buf6, 3, DW210X_WRITE_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 153 | break; |
| 154 | case 0x60: |
| 155 | if (msg[0].flags == 0) { |
| 156 | /* write to tuner pll */ |
| 157 | buf6[0] = 0x2c; |
| 158 | buf6[1] = 5; |
| 159 | buf6[2] = 0xc0; |
| 160 | buf6[3] = msg[0].buf[0]; |
| 161 | buf6[4] = msg[0].buf[1]; |
| 162 | buf6[5] = msg[0].buf[2]; |
| 163 | buf6[6] = msg[0].buf[3]; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 164 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 165 | buf6, 7, DW210X_WRITE_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 166 | } else { |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 167 | /* read from tuner */ |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 168 | ret = dw210x_op_rw(d->udev, 0xb5, 0, 0, |
| 169 | buf6, 1, DW210X_READ_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 170 | msg[0].buf[0] = buf6[0]; |
| 171 | } |
| 172 | break; |
| 173 | case (DW2102_RC_QUERY): |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 174 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 175 | buf6, 2, DW210X_READ_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 176 | msg[0].buf[0] = buf6[0]; |
| 177 | msg[0].buf[1] = buf6[1]; |
| 178 | break; |
| 179 | case (DW2102_VOLTAGE_CTRL): |
| 180 | buf6[0] = 0x30; |
| 181 | buf6[1] = msg[0].buf[0]; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 182 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 183 | buf6, 2, DW210X_WRITE_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 184 | break; |
| 185 | } |
| 186 | |
| 187 | break; |
| 188 | } |
| 189 | |
| 190 | mutex_unlock(&d->i2c_mutex); |
| 191 | return num; |
| 192 | } |
| 193 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 194 | static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap, |
| 195 | struct i2c_msg msg[], int num) |
| 196 | { |
| 197 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 198 | int ret = 0; |
| 199 | u8 buf6[] = {0, 0, 0, 0, 0, 0, 0}; |
| 200 | |
| 201 | if (!d) |
| 202 | return -ENODEV; |
| 203 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 204 | return -EAGAIN; |
| 205 | |
| 206 | switch (num) { |
| 207 | case 2: |
| 208 | /* read si2109 register by number */ |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 209 | buf6[0] = msg[0].addr << 1; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 210 | buf6[1] = msg[0].len; |
| 211 | buf6[2] = msg[0].buf[0]; |
| 212 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 213 | buf6, msg[0].len + 2, DW210X_WRITE_MSG); |
| 214 | /* read si2109 register */ |
| 215 | ret = dw210x_op_rw(d->udev, 0xc3, 0xd0, 0, |
| 216 | buf6, msg[1].len + 2, DW210X_READ_MSG); |
| 217 | memcpy(msg[1].buf, buf6 + 2, msg[1].len); |
| 218 | |
| 219 | break; |
| 220 | case 1: |
| 221 | switch (msg[0].addr) { |
| 222 | case 0x68: |
| 223 | /* write to si2109 register */ |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 224 | buf6[0] = msg[0].addr << 1; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 225 | buf6[1] = msg[0].len; |
| 226 | memcpy(buf6 + 2, msg[0].buf, msg[0].len); |
| 227 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, buf6, |
| 228 | msg[0].len + 2, DW210X_WRITE_MSG); |
| 229 | break; |
| 230 | case(DW2102_RC_QUERY): |
| 231 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 232 | buf6, 2, DW210X_READ_MSG); |
| 233 | msg[0].buf[0] = buf6[0]; |
| 234 | msg[0].buf[1] = buf6[1]; |
| 235 | break; |
| 236 | case(DW2102_VOLTAGE_CTRL): |
| 237 | buf6[0] = 0x30; |
| 238 | buf6[1] = msg[0].buf[0]; |
| 239 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 240 | buf6, 2, DW210X_WRITE_MSG); |
| 241 | break; |
| 242 | } |
| 243 | break; |
| 244 | } |
| 245 | |
| 246 | mutex_unlock(&d->i2c_mutex); |
| 247 | return num; |
| 248 | } |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 249 | |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 250 | static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) |
| 251 | { |
| 252 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 253 | int ret = 0; |
| 254 | |
| 255 | if (!d) |
| 256 | return -ENODEV; |
| 257 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 258 | return -EAGAIN; |
| 259 | |
| 260 | switch (num) { |
| 261 | case 2: { |
| 262 | /* read */ |
| 263 | /* first write first register number */ |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 264 | u8 ibuf[msg[1].len + 2], obuf[3]; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 265 | obuf[0] = msg[0].addr << 1; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 266 | obuf[1] = msg[0].len; |
| 267 | obuf[2] = msg[0].buf[0]; |
| 268 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 269 | obuf, msg[0].len + 2, DW210X_WRITE_MSG); |
| 270 | /* second read registers */ |
| 271 | ret = dw210x_op_rw(d->udev, 0xc3, 0xd1 , 0, |
| 272 | ibuf, msg[1].len + 2, DW210X_READ_MSG); |
| 273 | memcpy(msg[1].buf, ibuf + 2, msg[1].len); |
| 274 | |
| 275 | break; |
| 276 | } |
| 277 | case 1: |
| 278 | switch (msg[0].addr) { |
| 279 | case 0x68: { |
| 280 | /* write to register */ |
| 281 | u8 obuf[msg[0].len + 2]; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 282 | obuf[0] = msg[0].addr << 1; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 283 | obuf[1] = msg[0].len; |
| 284 | memcpy(obuf + 2, msg[0].buf, msg[0].len); |
| 285 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 286 | obuf, msg[0].len + 2, DW210X_WRITE_MSG); |
| 287 | break; |
| 288 | } |
| 289 | case 0x61: { |
| 290 | /* write to tuner */ |
| 291 | u8 obuf[msg[0].len + 2]; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 292 | obuf[0] = msg[0].addr << 1; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 293 | obuf[1] = msg[0].len; |
| 294 | memcpy(obuf + 2, msg[0].buf, msg[0].len); |
| 295 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 296 | obuf, msg[0].len + 2, DW210X_WRITE_MSG); |
| 297 | break; |
| 298 | } |
| 299 | case(DW2102_RC_QUERY): { |
| 300 | u8 ibuf[2]; |
| 301 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 302 | ibuf, 2, DW210X_READ_MSG); |
| 303 | memcpy(msg[0].buf, ibuf , 2); |
| 304 | break; |
| 305 | } |
| 306 | case(DW2102_VOLTAGE_CTRL): { |
| 307 | u8 obuf[2]; |
| 308 | obuf[0] = 0x30; |
| 309 | obuf[1] = msg[0].buf[0]; |
| 310 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 311 | obuf, 2, DW210X_WRITE_MSG); |
| 312 | break; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | break; |
| 317 | } |
| 318 | |
| 319 | mutex_unlock(&d->i2c_mutex); |
| 320 | return num; |
| 321 | } |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 322 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 323 | static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) |
| 324 | { |
| 325 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 326 | int ret = 0; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 327 | int len, i, j; |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 328 | |
| 329 | if (!d) |
| 330 | return -ENODEV; |
| 331 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 332 | return -EAGAIN; |
| 333 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 334 | for (j = 0; j < num; j++) { |
| 335 | switch (msg[j].addr) { |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 336 | case(DW2102_RC_QUERY): { |
| 337 | u8 ibuf[2]; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 338 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 339 | ibuf, 2, DW210X_READ_MSG); |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 340 | memcpy(msg[j].buf, ibuf , 2); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 341 | break; |
| 342 | } |
| 343 | case(DW2102_VOLTAGE_CTRL): { |
| 344 | u8 obuf[2]; |
| 345 | obuf[0] = 0x30; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 346 | obuf[1] = msg[j].buf[0]; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 347 | ret = dw210x_op_rw(d->udev, 0xb2, 0, 0, |
| 348 | obuf, 2, DW210X_WRITE_MSG); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 349 | break; |
| 350 | } |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 351 | /*case 0x55: cx24116 |
| 352 | case 0x6a: stv0903 |
| 353 | case 0x68: ds3000, stv0903 |
| 354 | case 0x60: ts2020, stv6110, stb6100 */ |
| 355 | default: { |
| 356 | if (msg[j].flags == I2C_M_RD) { |
| 357 | /* read registers */ |
| 358 | u8 ibuf[msg[j].len + 2]; |
| 359 | ret = dw210x_op_rw(d->udev, 0xc3, |
| 360 | (msg[j].addr << 1) + 1, 0, |
| 361 | ibuf, msg[j].len + 2, |
| 362 | DW210X_READ_MSG); |
| 363 | memcpy(msg[j].buf, ibuf + 2, msg[j].len); |
| 364 | mdelay(10); |
| 365 | } else if (((msg[j].buf[0] == 0xb0) && |
| 366 | (msg[j].addr == 0x68)) || |
| 367 | ((msg[j].buf[0] == 0xf7) && |
| 368 | (msg[j].addr == 0x55))) { |
| 369 | /* write firmware */ |
| 370 | u8 obuf[19]; |
| 371 | obuf[0] = msg[j].addr << 1; |
| 372 | obuf[1] = (msg[j].len > 15 ? 17 : msg[j].len); |
| 373 | obuf[2] = msg[j].buf[0]; |
| 374 | len = msg[j].len - 1; |
| 375 | i = 1; |
| 376 | do { |
| 377 | memcpy(obuf + 3, msg[j].buf + i, |
| 378 | (len > 16 ? 16 : len)); |
| 379 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 380 | obuf, (len > 16 ? 16 : len) + 3, |
| 381 | DW210X_WRITE_MSG); |
| 382 | i += 16; |
| 383 | len -= 16; |
| 384 | } while (len > 0); |
| 385 | } else { |
| 386 | /* write registers */ |
| 387 | u8 obuf[msg[j].len + 2]; |
| 388 | obuf[0] = msg[j].addr << 1; |
| 389 | obuf[1] = msg[j].len; |
| 390 | memcpy(obuf + 2, msg[j].buf, msg[j].len); |
| 391 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 392 | obuf, msg[j].len + 2, |
| 393 | DW210X_WRITE_MSG); |
| 394 | } |
| 395 | break; |
| 396 | } |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 397 | } |
| 398 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | mutex_unlock(&d->i2c_mutex); |
| 402 | return num; |
| 403 | } |
| 404 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 405 | static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
| 406 | int num) |
| 407 | { |
| 408 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 409 | int ret = 0, i; |
| 410 | |
| 411 | if (!d) |
| 412 | return -ENODEV; |
| 413 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 414 | return -EAGAIN; |
| 415 | |
| 416 | switch (num) { |
| 417 | case 2: { |
| 418 | /* read */ |
| 419 | /* first write first register number */ |
| 420 | u8 ibuf[msg[1].len + 2], obuf[3]; |
| 421 | obuf[0] = msg[0].addr << 1; |
| 422 | obuf[1] = msg[0].len; |
| 423 | obuf[2] = msg[0].buf[0]; |
| 424 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 425 | obuf, msg[0].len + 2, DW210X_WRITE_MSG); |
| 426 | /* second read registers */ |
| 427 | ret = dw210x_op_rw(d->udev, 0xc3, 0x19 , 0, |
| 428 | ibuf, msg[1].len + 2, DW210X_READ_MSG); |
| 429 | memcpy(msg[1].buf, ibuf + 2, msg[1].len); |
| 430 | |
| 431 | break; |
| 432 | } |
| 433 | case 1: |
| 434 | switch (msg[0].addr) { |
| 435 | case 0x60: |
| 436 | case 0x0c: { |
| 437 | /* write to register */ |
| 438 | u8 obuf[msg[0].len + 2]; |
| 439 | obuf[0] = msg[0].addr << 1; |
| 440 | obuf[1] = msg[0].len; |
| 441 | memcpy(obuf + 2, msg[0].buf, msg[0].len); |
| 442 | ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, |
| 443 | obuf, msg[0].len + 2, DW210X_WRITE_MSG); |
| 444 | break; |
| 445 | } |
| 446 | case(DW2102_RC_QUERY): { |
| 447 | u8 ibuf[2]; |
| 448 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 449 | ibuf, 2, DW210X_READ_MSG); |
| 450 | memcpy(msg[0].buf, ibuf , 2); |
| 451 | break; |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | break; |
| 456 | } |
| 457 | |
| 458 | for (i = 0; i < num; i++) { |
| 459 | deb_xfer("%02x:%02x: %s ", i, msg[i].addr, |
| 460 | msg[i].flags == 0 ? ">>>" : "<<<"); |
| 461 | debug_dump(msg[i].buf, msg[i].len, deb_xfer); |
| 462 | } |
| 463 | |
| 464 | mutex_unlock(&d->i2c_mutex); |
| 465 | return num; |
| 466 | } |
| 467 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 468 | static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 469 | int num) |
| 470 | { |
| 471 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 472 | int ret = 0; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 473 | int len, i, j; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 474 | |
| 475 | if (!d) |
| 476 | return -ENODEV; |
| 477 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 478 | return -EAGAIN; |
| 479 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 480 | for (j = 0; j < num; j++) { |
| 481 | switch (msg[j].addr) { |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 482 | case (DW2102_RC_QUERY): { |
| 483 | u8 ibuf[4]; |
| 484 | ret = dw210x_op_rw(d->udev, 0xb8, 0, 0, |
| 485 | ibuf, 4, DW210X_READ_MSG); |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 486 | memcpy(msg[j].buf, ibuf + 1, 2); |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 487 | break; |
| 488 | } |
| 489 | case (DW2102_VOLTAGE_CTRL): { |
| 490 | u8 obuf[2]; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 491 | obuf[0] = 3; |
| 492 | obuf[1] = msg[j].buf[0]; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 493 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, |
| 494 | obuf, 2, DW210X_WRITE_MSG); |
| 495 | break; |
| 496 | } |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 497 | /*case 0x55: cx24116 |
| 498 | case 0x6a: stv0903 |
| 499 | case 0x68: ds3000, stv0903 |
| 500 | case 0x60: ts2020, stv6110, stb6100 |
| 501 | case 0xa0: eeprom */ |
| 502 | default: { |
| 503 | if (msg[j].flags == I2C_M_RD) { |
| 504 | /* read registers */ |
| 505 | u8 ibuf[msg[j].len]; |
| 506 | ret = dw210x_op_rw(d->udev, 0x91, 0, 0, |
| 507 | ibuf, msg[j].len, |
| 508 | DW210X_READ_MSG); |
| 509 | memcpy(msg[j].buf, ibuf, msg[j].len); |
| 510 | break; |
| 511 | } else if ((msg[j].buf[0] == 0xb0) && |
| 512 | (msg[j].addr == 0x68)) { |
| 513 | /* write firmware */ |
| 514 | u8 obuf[19]; |
| 515 | obuf[0] = (msg[j].len > 16 ? |
| 516 | 18 : msg[j].len + 1); |
| 517 | obuf[1] = msg[j].addr << 1; |
| 518 | obuf[2] = msg[j].buf[0]; |
| 519 | len = msg[j].len - 1; |
| 520 | i = 1; |
| 521 | do { |
| 522 | memcpy(obuf + 3, msg[j].buf + i, |
| 523 | (len > 16 ? 16 : len)); |
| 524 | ret = dw210x_op_rw(d->udev, 0x80, 0, 0, |
| 525 | obuf, (len > 16 ? 16 : len) + 3, |
| 526 | DW210X_WRITE_MSG); |
| 527 | i += 16; |
| 528 | len -= 16; |
| 529 | } while (len > 0); |
| 530 | } else { |
| 531 | /* write registers */ |
| 532 | u8 obuf[msg[j].len + 2]; |
| 533 | obuf[0] = msg[j].len + 1; |
| 534 | obuf[1] = (msg[j].addr << 1); |
| 535 | memcpy(obuf + 2, msg[j].buf, msg[j].len); |
| 536 | ret = dw210x_op_rw(d->udev, |
| 537 | (num > 1 ? 0x90 : 0x80), 0, 0, |
| 538 | obuf, msg[j].len + 2, |
| 539 | DW210X_WRITE_MSG); |
| 540 | break; |
| 541 | } |
| 542 | break; |
| 543 | } |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 544 | } |
| 545 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 546 | msleep(3); |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | mutex_unlock(&d->i2c_mutex); |
| 550 | return num; |
| 551 | } |
| 552 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 553 | static u32 dw210x_i2c_func(struct i2c_adapter *adapter) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 554 | { |
| 555 | return I2C_FUNC_I2C; |
| 556 | } |
| 557 | |
| 558 | static struct i2c_algorithm dw2102_i2c_algo = { |
| 559 | .master_xfer = dw2102_i2c_transfer, |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 560 | .functionality = dw210x_i2c_func, |
| 561 | }; |
| 562 | |
| 563 | static struct i2c_algorithm dw2102_serit_i2c_algo = { |
| 564 | .master_xfer = dw2102_serit_i2c_transfer, |
| 565 | .functionality = dw210x_i2c_func, |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 566 | }; |
| 567 | |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 568 | static struct i2c_algorithm dw2102_earda_i2c_algo = { |
| 569 | .master_xfer = dw2102_earda_i2c_transfer, |
| 570 | .functionality = dw210x_i2c_func, |
| 571 | }; |
| 572 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 573 | static struct i2c_algorithm dw2104_i2c_algo = { |
| 574 | .master_xfer = dw2104_i2c_transfer, |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 575 | .functionality = dw210x_i2c_func, |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 576 | }; |
| 577 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 578 | static struct i2c_algorithm dw3101_i2c_algo = { |
| 579 | .master_xfer = dw3101_i2c_transfer, |
| 580 | .functionality = dw210x_i2c_func, |
| 581 | }; |
| 582 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 583 | static struct i2c_algorithm s6x0_i2c_algo = { |
| 584 | .master_xfer = s6x0_i2c_transfer, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 585 | .functionality = dw210x_i2c_func, |
| 586 | }; |
| 587 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 588 | static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 589 | { |
| 590 | int i; |
| 591 | u8 ibuf[] = {0, 0}; |
| 592 | u8 eeprom[256], eepromline[16]; |
| 593 | |
| 594 | for (i = 0; i < 256; i++) { |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 595 | if (dw210x_op_rw(d->udev, 0xb6, 0xa0 , i, ibuf, 2, DW210X_READ_MSG) < 0) { |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 596 | err("read eeprom failed."); |
| 597 | return -1; |
| 598 | } else { |
| 599 | eepromline[i%16] = ibuf[0]; |
| 600 | eeprom[i] = ibuf[0]; |
| 601 | } |
| 602 | if ((i % 16) == 15) { |
| 603 | deb_xfer("%02x: ", i - 15); |
| 604 | debug_dump(eepromline, 16, deb_xfer); |
| 605 | } |
| 606 | } |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 607 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 608 | memcpy(mac, eeprom + 8, 6); |
| 609 | return 0; |
| 610 | }; |
| 611 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 612 | static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 613 | { |
| 614 | int i, ret; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 615 | u8 ibuf[] = { 0 }, obuf[] = { 0 }; |
| 616 | u8 eeprom[256], eepromline[16]; |
| 617 | struct i2c_msg msg[] = { |
| 618 | { |
| 619 | .addr = 0xa0 >> 1, |
| 620 | .flags = 0, |
| 621 | .buf = obuf, |
| 622 | .len = 1, |
| 623 | }, { |
| 624 | .addr = 0xa0 >> 1, |
| 625 | .flags = I2C_M_RD, |
| 626 | .buf = ibuf, |
| 627 | .len = 1, |
| 628 | } |
| 629 | }; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 630 | |
| 631 | for (i = 0; i < 256; i++) { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 632 | obuf[0] = i; |
| 633 | ret = s6x0_i2c_transfer(&d->i2c_adap, msg, 2); |
| 634 | if (ret != 2) { |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 635 | err("read eeprom failed."); |
| 636 | return -1; |
| 637 | } else { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 638 | eepromline[i % 16] = ibuf[0]; |
| 639 | eeprom[i] = ibuf[0]; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | if ((i % 16) == 15) { |
| 643 | deb_xfer("%02x: ", i - 15); |
| 644 | debug_dump(eepromline, 16, deb_xfer); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | memcpy(mac, eeprom + 16, 6); |
| 649 | return 0; |
| 650 | }; |
| 651 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 652 | static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 653 | { |
| 654 | static u8 command_13v[1] = {0x00}; |
| 655 | static u8 command_18v[1] = {0x01}; |
| 656 | struct i2c_msg msg[] = { |
| 657 | {.addr = DW2102_VOLTAGE_CTRL, .flags = 0, |
| 658 | .buf = command_13v, .len = 1}, |
| 659 | }; |
| 660 | |
| 661 | struct dvb_usb_adapter *udev_adap = |
| 662 | (struct dvb_usb_adapter *)(fe->dvb->priv); |
| 663 | if (voltage == SEC_VOLTAGE_18) |
| 664 | msg[0].buf = command_18v; |
| 665 | i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1); |
| 666 | return 0; |
| 667 | } |
| 668 | |
Igor M. Liplianin | d4305c6 | 2008-10-17 13:45:55 -0300 | [diff] [blame] | 669 | static struct stv0299_config sharp_z0194a_config = { |
| 670 | .demod_address = 0x68, |
| 671 | .inittab = sharp_z0194a_inittab, |
| 672 | .mclk = 88000000UL, |
| 673 | .invert = 1, |
| 674 | .skip_reinit = 0, |
| 675 | .lock_output = STV0299_LOCKOUTPUT_1, |
| 676 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
| 677 | .min_delay_ms = 100, |
| 678 | .set_symbol_rate = sharp_z0194a_set_symbol_rate, |
| 679 | }; |
| 680 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 681 | static struct cx24116_config dw2104_config = { |
| 682 | .demod_address = 0x55, |
Igor M. Liplianin | cc8c4f3 | 2008-09-09 13:57:47 -0300 | [diff] [blame] | 683 | .mpg_clk_pos_pol = 0x01, |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 684 | }; |
| 685 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 686 | static struct si21xx_config serit_sp1511lhb_config = { |
| 687 | .demod_address = 0x68, |
| 688 | .min_delay_ms = 100, |
| 689 | |
| 690 | }; |
| 691 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 692 | static struct tda10023_config dw3101_tda10023_config = { |
| 693 | .demod_address = 0x0c, |
| 694 | .invert = 1, |
| 695 | }; |
| 696 | |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 697 | static struct mt312_config zl313_config = { |
| 698 | .demod_address = 0x0e, |
| 699 | }; |
| 700 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 701 | static struct ds3000_config dw2104_ds3000_config = { |
| 702 | .demod_address = 0x68, |
| 703 | }; |
| 704 | |
| 705 | static struct stv0900_config dw2104a_stv0900_config = { |
| 706 | .demod_address = 0x6a, |
| 707 | .demod_mode = 0, |
| 708 | .xtal = 27000000, |
| 709 | .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */ |
| 710 | .diseqc_mode = 2,/* 2/3 PWM */ |
| 711 | .tun1_maddress = 0,/* 0x60 */ |
| 712 | .tun1_adc = 0,/* 2 Vpp */ |
| 713 | .path1_mode = 3, |
| 714 | }; |
| 715 | |
| 716 | static struct stb6100_config dw2104a_stb6100_config = { |
| 717 | .tuner_address = 0x60, |
| 718 | .refclock = 27000000, |
| 719 | }; |
| 720 | |
| 721 | static struct stv0900_config dw2104_stv0900_config = { |
| 722 | .demod_address = 0x68, |
| 723 | .demod_mode = 0, |
| 724 | .xtal = 8000000, |
| 725 | .clkmode = 3, |
| 726 | .diseqc_mode = 2, |
| 727 | .tun1_maddress = 0, |
| 728 | .tun1_adc = 1,/* 1 Vpp */ |
| 729 | .path1_mode = 3, |
| 730 | }; |
| 731 | |
| 732 | static struct stv6110_config dw2104_stv6110_config = { |
| 733 | .i2c_address = 0x60, |
| 734 | .mclk = 16000000, |
| 735 | .clk_div = 1, |
| 736 | }; |
| 737 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 738 | static int dw2104_frontend_attach(struct dvb_usb_adapter *d) |
| 739 | { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 740 | struct dvb_tuner_ops *tuner_ops = NULL; |
| 741 | |
| 742 | if (demod_probe & 4) { |
| 743 | d->fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config, |
| 744 | &d->dev->i2c_adap, 0); |
| 745 | if (d->fe != NULL) { |
| 746 | if (dvb_attach(stb6100_attach, d->fe, |
| 747 | &dw2104a_stb6100_config, |
| 748 | &d->dev->i2c_adap)) { |
| 749 | tuner_ops = &d->fe->ops.tuner_ops; |
| 750 | tuner_ops->set_frequency = stb6100_set_freq; |
| 751 | tuner_ops->get_frequency = stb6100_get_freq; |
| 752 | tuner_ops->set_bandwidth = stb6100_set_bandw; |
| 753 | tuner_ops->get_bandwidth = stb6100_get_bandw; |
| 754 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 755 | info("Attached STV0900+STB6100!\n"); |
| 756 | return 0; |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | if (demod_probe & 2) { |
| 762 | d->fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config, |
| 763 | &d->dev->i2c_adap, 0); |
| 764 | if (d->fe != NULL) { |
| 765 | if (dvb_attach(stv6110_attach, d->fe, |
| 766 | &dw2104_stv6110_config, |
| 767 | &d->dev->i2c_adap)) { |
| 768 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 769 | info("Attached STV0900+STV6110A!\n"); |
| 770 | return 0; |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | if (demod_probe & 1) { |
| 776 | d->fe = dvb_attach(cx24116_attach, &dw2104_config, |
| 777 | &d->dev->i2c_adap); |
| 778 | if (d->fe != NULL) { |
| 779 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 780 | info("Attached cx24116!\n"); |
| 781 | return 0; |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config, |
| 786 | &d->dev->i2c_adap); |
| 787 | if (d->fe != NULL) { |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 788 | d->fe->ops.set_voltage = dw210x_set_voltage; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 789 | info("Attached DS3000!\n"); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 790 | return 0; |
| 791 | } |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 792 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 793 | return -EIO; |
| 794 | } |
| 795 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 796 | static struct dvb_usb_device_properties dw2102_properties; |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 797 | static struct dvb_usb_device_properties dw2104_properties; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 798 | static struct dvb_usb_device_properties s6x0_properties; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 799 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 800 | static int dw2102_frontend_attach(struct dvb_usb_adapter *d) |
| 801 | { |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 802 | if (dw2102_properties.i2c_algo == &dw2102_serit_i2c_algo) { |
| 803 | /*dw2102_properties.adapter->tuner_attach = NULL;*/ |
| 804 | d->fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config, |
| 805 | &d->dev->i2c_adap); |
| 806 | if (d->fe != NULL) { |
| 807 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 808 | info("Attached si21xx!\n"); |
| 809 | return 0; |
| 810 | } |
| 811 | } |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 812 | |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 813 | if (dw2102_properties.i2c_algo == &dw2102_earda_i2c_algo) { |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 814 | d->fe = dvb_attach(stv0288_attach, &earda_config, |
| 815 | &d->dev->i2c_adap); |
| 816 | if (d->fe != NULL) { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 817 | if (dvb_attach(stb6000_attach, d->fe, 0x61, |
| 818 | &d->dev->i2c_adap)) { |
| 819 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 820 | info("Attached stv0288!\n"); |
| 821 | return 0; |
| 822 | } |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 823 | } |
| 824 | } |
| 825 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 826 | if (dw2102_properties.i2c_algo == &dw2102_i2c_algo) { |
| 827 | /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/ |
| 828 | d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config, |
| 829 | &d->dev->i2c_adap); |
| 830 | if (d->fe != NULL) { |
| 831 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 832 | info("Attached stv0299!\n"); |
| 833 | return 0; |
| 834 | } |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 835 | } |
| 836 | return -EIO; |
| 837 | } |
| 838 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 839 | static int dw3101_frontend_attach(struct dvb_usb_adapter *d) |
| 840 | { |
| 841 | d->fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config, |
| 842 | &d->dev->i2c_adap, 0x48); |
| 843 | if (d->fe != NULL) { |
| 844 | info("Attached tda10023!\n"); |
| 845 | return 0; |
| 846 | } |
| 847 | return -EIO; |
| 848 | } |
| 849 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 850 | static int s6x0_frontend_attach(struct dvb_usb_adapter *d) |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 851 | { |
| 852 | d->fe = dvb_attach(mt312_attach, &zl313_config, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 853 | &d->dev->i2c_adap); |
| 854 | if (d->fe != NULL) { |
| 855 | if (dvb_attach(zl10039_attach, d->fe, 0x60, |
| 856 | &d->dev->i2c_adap)) { |
| 857 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 858 | info("Attached zl100313+zl10039!\n"); |
| 859 | return 0; |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | d->fe = dvb_attach(stv0288_attach, &earda_config, |
| 864 | &d->dev->i2c_adap); |
| 865 | if (d->fe != NULL) { |
| 866 | if (dvb_attach(stb6000_attach, d->fe, 0x61, |
| 867 | &d->dev->i2c_adap)) { |
| 868 | d->fe->ops.set_voltage = dw210x_set_voltage; |
| 869 | info("Attached stv0288+stb6000!\n"); |
| 870 | return 0; |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config, |
| 875 | &d->dev->i2c_adap); |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 876 | if (d->fe != NULL) { |
| 877 | d->fe->ops.set_voltage = dw210x_set_voltage; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 878 | info("Attached ds3000+ds2020!\n"); |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 879 | return 0; |
| 880 | } |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 881 | |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 882 | return -EIO; |
| 883 | } |
| 884 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 885 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) |
| 886 | { |
| 887 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, |
| 888 | &adap->dev->i2c_adap, DVB_PLL_OPERA1); |
| 889 | return 0; |
| 890 | } |
| 891 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 892 | static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) |
| 893 | { |
| 894 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, |
| 895 | &adap->dev->i2c_adap, DVB_PLL_TUA6034); |
| 896 | |
| 897 | return 0; |
| 898 | } |
| 899 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 900 | static struct dvb_usb_rc_key dw210x_rc_keys[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 901 | { 0xf80a, KEY_Q }, /*power*/ |
| 902 | { 0xf80c, KEY_M }, /*mute*/ |
| 903 | { 0xf811, KEY_1 }, |
| 904 | { 0xf812, KEY_2 }, |
| 905 | { 0xf813, KEY_3 }, |
| 906 | { 0xf814, KEY_4 }, |
| 907 | { 0xf815, KEY_5 }, |
| 908 | { 0xf816, KEY_6 }, |
| 909 | { 0xf817, KEY_7 }, |
| 910 | { 0xf818, KEY_8 }, |
| 911 | { 0xf819, KEY_9 }, |
| 912 | { 0xf810, KEY_0 }, |
| 913 | { 0xf81c, KEY_PAGEUP }, /*ch+*/ |
| 914 | { 0xf80f, KEY_PAGEDOWN }, /*ch-*/ |
| 915 | { 0xf81a, KEY_O }, /*vol+*/ |
| 916 | { 0xf80e, KEY_Z }, /*vol-*/ |
| 917 | { 0xf804, KEY_R }, /*rec*/ |
| 918 | { 0xf809, KEY_D }, /*fav*/ |
| 919 | { 0xf808, KEY_BACKSPACE }, /*rewind*/ |
| 920 | { 0xf807, KEY_A }, /*fast*/ |
| 921 | { 0xf80b, KEY_P }, /*pause*/ |
| 922 | { 0xf802, KEY_ESC }, /*cancel*/ |
| 923 | { 0xf803, KEY_G }, /*tab*/ |
| 924 | { 0xf800, KEY_UP }, /*up*/ |
| 925 | { 0xf81f, KEY_ENTER }, /*ok*/ |
| 926 | { 0xf801, KEY_DOWN }, /*down*/ |
| 927 | { 0xf805, KEY_C }, /*cap*/ |
| 928 | { 0xf806, KEY_S }, /*stop*/ |
| 929 | { 0xf840, KEY_F }, /*full*/ |
| 930 | { 0xf81e, KEY_W }, /*tvmode*/ |
| 931 | { 0xf81b, KEY_B }, /*recall*/ |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 932 | }; |
| 933 | |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 934 | static struct dvb_usb_rc_key tevii_rc_keys[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 935 | { 0xf80a, KEY_POWER }, |
| 936 | { 0xf80c, KEY_MUTE }, |
| 937 | { 0xf811, KEY_1 }, |
| 938 | { 0xf812, KEY_2 }, |
| 939 | { 0xf813, KEY_3 }, |
| 940 | { 0xf814, KEY_4 }, |
| 941 | { 0xf815, KEY_5 }, |
| 942 | { 0xf816, KEY_6 }, |
| 943 | { 0xf817, KEY_7 }, |
| 944 | { 0xf818, KEY_8 }, |
| 945 | { 0xf819, KEY_9 }, |
| 946 | { 0xf810, KEY_0 }, |
| 947 | { 0xf81c, KEY_MENU }, |
| 948 | { 0xf80f, KEY_VOLUMEDOWN }, |
| 949 | { 0xf81a, KEY_LAST }, |
| 950 | { 0xf80e, KEY_OPEN }, |
| 951 | { 0xf804, KEY_RECORD }, |
| 952 | { 0xf809, KEY_VOLUMEUP }, |
| 953 | { 0xf808, KEY_CHANNELUP }, |
| 954 | { 0xf807, KEY_PVR }, |
| 955 | { 0xf80b, KEY_TIME }, |
| 956 | { 0xf802, KEY_RIGHT }, |
| 957 | { 0xf803, KEY_LEFT }, |
| 958 | { 0xf800, KEY_UP }, |
| 959 | { 0xf81f, KEY_OK }, |
| 960 | { 0xf801, KEY_DOWN }, |
| 961 | { 0xf805, KEY_TUNER }, |
| 962 | { 0xf806, KEY_CHANNELDOWN }, |
| 963 | { 0xf840, KEY_PLAYPAUSE }, |
| 964 | { 0xf81e, KEY_REWIND }, |
| 965 | { 0xf81b, KEY_FAVORITES }, |
| 966 | { 0xf81d, KEY_BACK }, |
| 967 | { 0xf84d, KEY_FASTFORWARD }, |
| 968 | { 0xf844, KEY_EPG }, |
| 969 | { 0xf84c, KEY_INFO }, |
| 970 | { 0xf841, KEY_AB }, |
| 971 | { 0xf843, KEY_AUDIO }, |
| 972 | { 0xf845, KEY_SUBTITLE }, |
| 973 | { 0xf84a, KEY_LIST }, |
| 974 | { 0xf846, KEY_F1 }, |
| 975 | { 0xf847, KEY_F2 }, |
| 976 | { 0xf85e, KEY_F3 }, |
| 977 | { 0xf85c, KEY_F4 }, |
| 978 | { 0xf852, KEY_F5 }, |
| 979 | { 0xf85a, KEY_F6 }, |
| 980 | { 0xf856, KEY_MODE }, |
| 981 | { 0xf858, KEY_SWITCHVIDEOMODE }, |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 982 | }; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 983 | |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 984 | static struct dvb_usb_rc_key tbs_rc_keys[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 985 | { 0xf884, KEY_POWER }, |
| 986 | { 0xf894, KEY_MUTE }, |
| 987 | { 0xf887, KEY_1 }, |
| 988 | { 0xf886, KEY_2 }, |
| 989 | { 0xf885, KEY_3 }, |
| 990 | { 0xf88b, KEY_4 }, |
| 991 | { 0xf88a, KEY_5 }, |
| 992 | { 0xf889, KEY_6 }, |
| 993 | { 0xf88f, KEY_7 }, |
| 994 | { 0xf88e, KEY_8 }, |
| 995 | { 0xf88d, KEY_9 }, |
| 996 | { 0xf892, KEY_0 }, |
| 997 | { 0xf896, KEY_CHANNELUP }, |
| 998 | { 0xf891, KEY_CHANNELDOWN }, |
| 999 | { 0xf893, KEY_VOLUMEUP }, |
| 1000 | { 0xf88c, KEY_VOLUMEDOWN }, |
| 1001 | { 0xf883, KEY_RECORD }, |
| 1002 | { 0xf898, KEY_PAUSE }, |
| 1003 | { 0xf899, KEY_OK }, |
| 1004 | { 0xf89a, KEY_SHUFFLE }, |
| 1005 | { 0xf881, KEY_UP }, |
| 1006 | { 0xf890, KEY_LEFT }, |
| 1007 | { 0xf882, KEY_RIGHT }, |
| 1008 | { 0xf888, KEY_DOWN }, |
| 1009 | { 0xf895, KEY_FAVORITES }, |
| 1010 | { 0xf897, KEY_SUBTITLE }, |
| 1011 | { 0xf89d, KEY_ZOOM }, |
| 1012 | { 0xf89f, KEY_EXIT }, |
| 1013 | { 0xf89e, KEY_MENU }, |
| 1014 | { 0xf89c, KEY_EPG }, |
| 1015 | { 0xf880, KEY_PREVIOUS }, |
| 1016 | { 0xf89b, KEY_MODE } |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1017 | }; |
| 1018 | |
| 1019 | static struct dvb_usb_rc_keys_table keys_tables[] = { |
| 1020 | { dw210x_rc_keys, ARRAY_SIZE(dw210x_rc_keys) }, |
| 1021 | { tevii_rc_keys, ARRAY_SIZE(tevii_rc_keys) }, |
| 1022 | { tbs_rc_keys, ARRAY_SIZE(tbs_rc_keys) }, |
| 1023 | }; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1024 | |
| 1025 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 1026 | { |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1027 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
| 1028 | int keymap_size = d->props.rc_key_map_size; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1029 | u8 key[2]; |
Igor M. Liplianin | 8a8dad7 | 2009-06-13 08:10:24 -0300 | [diff] [blame] | 1030 | struct i2c_msg msg = { |
| 1031 | .addr = DW2102_RC_QUERY, |
| 1032 | .flags = I2C_M_RD, |
| 1033 | .buf = key, |
| 1034 | .len = 2 |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1035 | }; |
| 1036 | int i; |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1037 | /* override keymap */ |
| 1038 | if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) { |
| 1039 | keymap = keys_tables[ir_keymap - 1].rc_keys ; |
| 1040 | keymap_size = keys_tables[ir_keymap - 1].rc_keys_size; |
| 1041 | } |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1042 | |
| 1043 | *state = REMOTE_NO_KEY_PRESSED; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1044 | if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) { |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1045 | for (i = 0; i < keymap_size ; i++) { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 1046 | if (rc5_data(&keymap[i]) == msg.buf[0]) { |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1047 | *state = REMOTE_KEY_PRESSED; |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1048 | *event = keymap[i].event; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1049 | break; |
| 1050 | } |
Igor M. Liplianin | 8a8dad7 | 2009-06-13 08:10:24 -0300 | [diff] [blame] | 1051 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1052 | } |
Igor M. Liplianin | 8a8dad7 | 2009-06-13 08:10:24 -0300 | [diff] [blame] | 1053 | |
| 1054 | if ((*state) == REMOTE_KEY_PRESSED) |
| 1055 | deb_rc("%s: found rc key: %x, %x, event: %x\n", |
| 1056 | __func__, key[0], key[1], (*event)); |
| 1057 | else if (key[0] != 0xff) |
| 1058 | deb_rc("%s: unknown rc key: %x, %x\n", |
| 1059 | __func__, key[0], key[1]); |
| 1060 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1061 | } |
Igor M. Liplianin | 8a8dad7 | 2009-06-13 08:10:24 -0300 | [diff] [blame] | 1062 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1063 | return 0; |
| 1064 | } |
| 1065 | |
| 1066 | static struct usb_device_id dw2102_table[] = { |
| 1067 | {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)}, |
| 1068 | {USB_DEVICE(USB_VID_CYPRESS, 0x2101)}, |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1069 | {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)}, |
| 1070 | {USB_DEVICE(0x9022, USB_PID_TEVII_S650)}, |
Igor M. Liplianin | 4cc0edf | 2008-11-05 22:12:56 -0300 | [diff] [blame] | 1071 | {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)}, |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1072 | {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)}, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1073 | {USB_DEVICE(0x9022, USB_PID_TEVII_S630)}, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1074 | {USB_DEVICE(0x3011, USB_PID_PROF_1100)}, |
| 1075 | {USB_DEVICE(0x9022, USB_PID_TEVII_S660)}, |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1076 | { } |
| 1077 | }; |
| 1078 | |
| 1079 | MODULE_DEVICE_TABLE(usb, dw2102_table); |
| 1080 | |
| 1081 | static int dw2102_load_firmware(struct usb_device *dev, |
| 1082 | const struct firmware *frmwr) |
| 1083 | { |
| 1084 | u8 *b, *p; |
| 1085 | int ret = 0, i; |
| 1086 | u8 reset; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 1087 | u8 reset16[] = {0, 0, 0, 0, 0, 0, 0}; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1088 | const struct firmware *fw; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1089 | const char *fw_2101 = "dvb-usb-dw2101.fw"; |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1090 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1091 | switch (dev->descriptor.idProduct) { |
| 1092 | case 0x2101: |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1093 | ret = request_firmware(&fw, fw_2101, &dev->dev); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1094 | if (ret != 0) { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1095 | err(err_str, fw_2101); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1096 | return ret; |
| 1097 | } |
| 1098 | break; |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1099 | default: |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1100 | fw = frmwr; |
| 1101 | break; |
| 1102 | } |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1103 | info("start downloading DW210X firmware"); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1104 | p = kmalloc(fw->size, GFP_KERNEL); |
| 1105 | reset = 1; |
| 1106 | /*stop the CPU*/ |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1107 | dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW210X_WRITE_MSG); |
| 1108 | dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, DW210X_WRITE_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1109 | |
| 1110 | if (p != NULL) { |
| 1111 | memcpy(p, fw->data, fw->size); |
| 1112 | for (i = 0; i < fw->size; i += 0x40) { |
| 1113 | b = (u8 *) p + i; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1114 | if (dw210x_op_rw(dev, 0xa0, i, 0, b , 0x40, |
| 1115 | DW210X_WRITE_MSG) != 0x40) { |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1116 | err("error while transferring firmware"); |
| 1117 | ret = -EINVAL; |
| 1118 | break; |
| 1119 | } |
| 1120 | } |
| 1121 | /* restart the CPU */ |
| 1122 | reset = 0; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1123 | if (ret || dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, |
| 1124 | DW210X_WRITE_MSG) != 1) { |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1125 | err("could not restart the USB controller CPU."); |
| 1126 | ret = -EINVAL; |
| 1127 | } |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1128 | if (ret || dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, |
| 1129 | DW210X_WRITE_MSG) != 1) { |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1130 | err("could not restart the USB controller CPU."); |
| 1131 | ret = -EINVAL; |
| 1132 | } |
| 1133 | /* init registers */ |
| 1134 | switch (dev->descriptor.idProduct) { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1135 | case USB_PID_PROF_1100: |
| 1136 | s6x0_properties.rc_key_map = tbs_rc_keys; |
| 1137 | s6x0_properties.rc_key_map_size = |
| 1138 | ARRAY_SIZE(tbs_rc_keys); |
| 1139 | break; |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1140 | case USB_PID_TEVII_S650: |
Igor M. Liplianin | b42e1d7 | 2009-06-14 19:41:22 -0300 | [diff] [blame] | 1141 | dw2104_properties.rc_key_map = tevii_rc_keys; |
| 1142 | dw2104_properties.rc_key_map_size = |
| 1143 | ARRAY_SIZE(tevii_rc_keys); |
| 1144 | case USB_PID_DW2104: |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1145 | reset = 1; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1146 | dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, |
| 1147 | DW210X_WRITE_MSG); |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1148 | /* break omitted intentionally */ |
| 1149 | case USB_PID_DW3101: |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1150 | reset = 0; |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1151 | dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0, |
| 1152 | DW210X_WRITE_MSG); |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1153 | break; |
Igor M. Liplianin | 4cc0edf | 2008-11-05 22:12:56 -0300 | [diff] [blame] | 1154 | case USB_PID_CINERGY_S: |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1155 | case USB_PID_DW2102: |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1156 | dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0, |
| 1157 | DW210X_WRITE_MSG); |
| 1158 | dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2, |
| 1159 | DW210X_READ_MSG); |
| 1160 | /* check STV0299 frontend */ |
| 1161 | dw210x_op_rw(dev, 0xb5, 0, 0, &reset16[0], 2, |
| 1162 | DW210X_READ_MSG); |
Igor M. Liplianin | ea023df | 2008-12-04 12:49:23 -0300 | [diff] [blame] | 1163 | if ((reset16[0] == 0xa1) || (reset16[0] == 0x80)) { |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1164 | dw2102_properties.i2c_algo = &dw2102_i2c_algo; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 1165 | dw2102_properties.adapter->tuner_attach = &dw2102_tuner_attach; |
| 1166 | break; |
| 1167 | } else { |
| 1168 | /* check STV0288 frontend */ |
| 1169 | reset16[0] = 0xd0; |
| 1170 | reset16[1] = 1; |
| 1171 | reset16[2] = 0; |
| 1172 | dw210x_op_rw(dev, 0xc2, 0, 0, &reset16[0], 3, |
| 1173 | DW210X_WRITE_MSG); |
| 1174 | dw210x_op_rw(dev, 0xc3, 0xd1, 0, &reset16[0], 3, |
| 1175 | DW210X_READ_MSG); |
| 1176 | if (reset16[2] == 0x11) { |
| 1177 | dw2102_properties.i2c_algo = &dw2102_earda_i2c_algo; |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 1178 | break; |
| 1179 | } |
| 1180 | } |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1181 | case 0x2101: |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1182 | dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2, |
| 1183 | DW210X_READ_MSG); |
| 1184 | dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7, |
| 1185 | DW210X_READ_MSG); |
| 1186 | dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7, |
| 1187 | DW210X_READ_MSG); |
| 1188 | dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2, |
| 1189 | DW210X_READ_MSG); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1190 | break; |
| 1191 | } |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1192 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1193 | msleep(100); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1194 | kfree(p); |
| 1195 | } |
| 1196 | return ret; |
| 1197 | } |
| 1198 | |
| 1199 | static struct dvb_usb_device_properties dw2102_properties = { |
| 1200 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1201 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1202 | .firmware = "dvb-usb-dw2102.fw", |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1203 | .no_reconnect = 1, |
| 1204 | |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1205 | .i2c_algo = &dw2102_serit_i2c_algo, |
| 1206 | .rc_key_map = dw210x_rc_keys, |
| 1207 | .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1208 | .rc_interval = 150, |
| 1209 | .rc_query = dw2102_rc_query, |
| 1210 | |
| 1211 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1212 | /* parameter for the MPEG2-data transfer */ |
| 1213 | .num_adapters = 1, |
| 1214 | .download_firmware = dw2102_load_firmware, |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1215 | .read_mac_address = dw210x_read_mac_address, |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1216 | .adapter = { |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1217 | { |
| 1218 | .frontend_attach = dw2102_frontend_attach, |
| 1219 | .streaming_ctrl = NULL, |
Igor M. Liplianin | 8a4949b | 2008-10-05 09:11:21 -0300 | [diff] [blame] | 1220 | .tuner_attach = NULL, |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1221 | .stream = { |
| 1222 | .type = USB_BULK, |
| 1223 | .count = 8, |
| 1224 | .endpoint = 0x82, |
| 1225 | .u = { |
| 1226 | .bulk = { |
| 1227 | .buffersize = 4096, |
| 1228 | } |
| 1229 | } |
| 1230 | }, |
| 1231 | } |
| 1232 | }, |
Igor M. Liplianin | 4cc0edf | 2008-11-05 22:12:56 -0300 | [diff] [blame] | 1233 | .num_device_descs = 3, |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1234 | .devices = { |
| 1235 | {"DVBWorld DVB-S 2102 USB2.0", |
| 1236 | {&dw2102_table[0], NULL}, |
| 1237 | {NULL}, |
| 1238 | }, |
| 1239 | {"DVBWorld DVB-S 2101 USB2.0", |
| 1240 | {&dw2102_table[1], NULL}, |
| 1241 | {NULL}, |
| 1242 | }, |
Igor M. Liplianin | 4cc0edf | 2008-11-05 22:12:56 -0300 | [diff] [blame] | 1243 | {"TerraTec Cinergy S USB", |
| 1244 | {&dw2102_table[4], NULL}, |
| 1245 | {NULL}, |
| 1246 | }, |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1247 | } |
| 1248 | }; |
| 1249 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1250 | static struct dvb_usb_device_properties dw2104_properties = { |
| 1251 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1252 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1253 | .firmware = "dvb-usb-dw2104.fw", |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1254 | .no_reconnect = 1, |
| 1255 | |
| 1256 | .i2c_algo = &dw2104_i2c_algo, |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1257 | .rc_key_map = dw210x_rc_keys, |
| 1258 | .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1259 | .rc_interval = 150, |
| 1260 | .rc_query = dw2102_rc_query, |
| 1261 | |
| 1262 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1263 | /* parameter for the MPEG2-data transfer */ |
| 1264 | .num_adapters = 1, |
| 1265 | .download_firmware = dw2102_load_firmware, |
Igor M. Liplianin | 21b007b | 2008-09-17 19:19:19 -0300 | [diff] [blame] | 1266 | .read_mac_address = dw210x_read_mac_address, |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1267 | .adapter = { |
| 1268 | { |
| 1269 | .frontend_attach = dw2104_frontend_attach, |
| 1270 | .streaming_ctrl = NULL, |
| 1271 | /*.tuner_attach = dw2104_tuner_attach,*/ |
| 1272 | .stream = { |
| 1273 | .type = USB_BULK, |
| 1274 | .count = 8, |
| 1275 | .endpoint = 0x82, |
| 1276 | .u = { |
| 1277 | .bulk = { |
| 1278 | .buffersize = 4096, |
| 1279 | } |
| 1280 | } |
| 1281 | }, |
| 1282 | } |
| 1283 | }, |
| 1284 | .num_device_descs = 2, |
| 1285 | .devices = { |
| 1286 | { "DVBWorld DW2104 USB2.0", |
| 1287 | {&dw2102_table[2], NULL}, |
| 1288 | {NULL}, |
| 1289 | }, |
| 1290 | { "TeVii S650 USB2.0", |
| 1291 | {&dw2102_table[3], NULL}, |
| 1292 | {NULL}, |
| 1293 | }, |
| 1294 | } |
| 1295 | }; |
| 1296 | |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1297 | static struct dvb_usb_device_properties dw3101_properties = { |
| 1298 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1299 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1300 | .firmware = "dvb-usb-dw3101.fw", |
| 1301 | .no_reconnect = 1, |
| 1302 | |
| 1303 | .i2c_algo = &dw3101_i2c_algo, |
| 1304 | .rc_key_map = dw210x_rc_keys, |
| 1305 | .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), |
| 1306 | .rc_interval = 150, |
| 1307 | .rc_query = dw2102_rc_query, |
| 1308 | |
| 1309 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1310 | /* parameter for the MPEG2-data transfer */ |
| 1311 | .num_adapters = 1, |
| 1312 | .download_firmware = dw2102_load_firmware, |
| 1313 | .read_mac_address = dw210x_read_mac_address, |
| 1314 | .adapter = { |
| 1315 | { |
| 1316 | .frontend_attach = dw3101_frontend_attach, |
| 1317 | .streaming_ctrl = NULL, |
| 1318 | .tuner_attach = dw3101_tuner_attach, |
| 1319 | .stream = { |
| 1320 | .type = USB_BULK, |
| 1321 | .count = 8, |
| 1322 | .endpoint = 0x82, |
| 1323 | .u = { |
| 1324 | .bulk = { |
| 1325 | .buffersize = 4096, |
| 1326 | } |
| 1327 | } |
| 1328 | }, |
| 1329 | } |
| 1330 | }, |
| 1331 | .num_device_descs = 1, |
| 1332 | .devices = { |
| 1333 | { "DVBWorld DVB-C 3101 USB2.0", |
| 1334 | {&dw2102_table[5], NULL}, |
| 1335 | {NULL}, |
| 1336 | }, |
| 1337 | } |
| 1338 | }; |
| 1339 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1340 | static struct dvb_usb_device_properties s6x0_properties = { |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1341 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1342 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1343 | .firmware = "dvb-usb-s630.fw", |
| 1344 | .no_reconnect = 1, |
| 1345 | |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1346 | .i2c_algo = &s6x0_i2c_algo, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1347 | .rc_key_map = tevii_rc_keys, |
| 1348 | .rc_key_map_size = ARRAY_SIZE(tevii_rc_keys), |
| 1349 | .rc_interval = 150, |
| 1350 | .rc_query = dw2102_rc_query, |
| 1351 | |
| 1352 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1353 | .num_adapters = 1, |
| 1354 | .download_firmware = dw2102_load_firmware, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1355 | .read_mac_address = s6x0_read_mac_address, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1356 | .adapter = { |
| 1357 | { |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1358 | .frontend_attach = s6x0_frontend_attach, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1359 | .streaming_ctrl = NULL, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1360 | .tuner_attach = NULL, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1361 | .stream = { |
| 1362 | .type = USB_BULK, |
| 1363 | .count = 8, |
| 1364 | .endpoint = 0x82, |
| 1365 | .u = { |
| 1366 | .bulk = { |
| 1367 | .buffersize = 4096, |
| 1368 | } |
| 1369 | } |
| 1370 | }, |
| 1371 | } |
| 1372 | }, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1373 | .num_device_descs = 3, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1374 | .devices = { |
| 1375 | {"TeVii S630 USB", |
| 1376 | {&dw2102_table[6], NULL}, |
| 1377 | {NULL}, |
| 1378 | }, |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1379 | {"Prof 1100 USB ", |
| 1380 | {&dw2102_table[7], NULL}, |
| 1381 | {NULL}, |
| 1382 | }, |
| 1383 | {"TeVii S660 USB", |
| 1384 | {&dw2102_table[8], NULL}, |
| 1385 | {NULL}, |
| 1386 | }, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1387 | } |
| 1388 | }; |
| 1389 | |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1390 | static int dw2102_probe(struct usb_interface *intf, |
| 1391 | const struct usb_device_id *id) |
| 1392 | { |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1393 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
| 1394 | THIS_MODULE, NULL, adapter_nr) || |
| 1395 | 0 == dvb_usb_device_init(intf, &dw2104_properties, |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1396 | THIS_MODULE, NULL, adapter_nr) || |
| 1397 | 0 == dvb_usb_device_init(intf, &dw3101_properties, |
Igor M. Liplianin | d0a1dda | 2009-06-20 09:54:18 -0300 | [diff] [blame] | 1398 | THIS_MODULE, NULL, adapter_nr) || |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1399 | 0 == dvb_usb_device_init(intf, &s6x0_properties, |
| 1400 | THIS_MODULE, NULL, adapter_nr)) |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1401 | return 0; |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1402 | |
Igor M. Liplianin | fe03d5e | 2008-09-08 17:16:40 -0300 | [diff] [blame] | 1403 | return -ENODEV; |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1404 | } |
| 1405 | |
| 1406 | static struct usb_driver dw2102_driver = { |
| 1407 | .name = "dw2102", |
| 1408 | .probe = dw2102_probe, |
| 1409 | .disconnect = dvb_usb_device_exit, |
| 1410 | .id_table = dw2102_table, |
| 1411 | }; |
| 1412 | |
| 1413 | static int __init dw2102_module_init(void) |
| 1414 | { |
| 1415 | int ret = usb_register(&dw2102_driver); |
| 1416 | if (ret) |
| 1417 | err("usb_register failed. Error number %d", ret); |
| 1418 | |
| 1419 | return ret; |
| 1420 | } |
| 1421 | |
| 1422 | static void __exit dw2102_module_exit(void) |
| 1423 | { |
| 1424 | usb_deregister(&dw2102_driver); |
| 1425 | } |
| 1426 | |
| 1427 | module_init(dw2102_module_init); |
| 1428 | module_exit(dw2102_module_exit); |
| 1429 | |
| 1430 | MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); |
Igor M. Liplianin | 1dac77c | 2009-06-14 20:51:45 -0300 | [diff] [blame] | 1431 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," |
| 1432 | " DVB-C 3101 USB2.0," |
Igor M. Liplianin | 141cc35 | 2009-11-27 14:37:35 -0300 | [diff] [blame^] | 1433 | " TeVii S600, S630, S650, S660 USB2.0," |
| 1434 | " Prof 1100 USB2.0 devices"); |
Igor M Liplianin | 7fd4828 | 2008-07-20 08:05:50 -0300 | [diff] [blame] | 1435 | MODULE_VERSION("0.1"); |
| 1436 | MODULE_LICENSE("GPL"); |