diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2005-09-09 16:02:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:41 -0400 |
commit | e2efeab26b77061ba5418f4c98c3b3ed100fb608 (patch) | |
tree | 93fc9c9195b26265c6ba6a03b05525aaeb131d7f /drivers/media/dvb/dvb-usb | |
parent | 3beab78f8ad5a483fdbdcbb8599fb06da102b8b7 (diff) |
[PATCH] dvb: usb: cxusb: fixes for new firmware
This patch changes two things:
1) a firmware update made by the vendor, which has to be done in Windows
for now, changes the DVB-data-pipe from isochronous to bulk: it fixes the
data distortions (and thus the video-distortions) in DVB-T mode; there is
no backwards compatibility with the old firmware as it didn't work anyway
2) with the help of Steve Toth some reverse-engineered functionality is now
named correctly, thank you
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 64 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.h | 27 |
2 files changed, 37 insertions, 54 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index d2be03514012..3fe383f4bb4c 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -48,35 +48,26 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | /* I2C */ | 51 | /* GPIO */ |
52 | static void cxusb_set_i2c_path(struct dvb_usb_device *d, enum cxusb_i2c_pathes path) | 52 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) |
53 | { | 53 | { |
54 | struct cxusb_state *st = d->priv; | 54 | struct cxusb_state *st = d->priv; |
55 | u8 o[2],i; | 55 | u8 o[2],i; |
56 | 56 | ||
57 | if (path == st->cur_i2c_path) | 57 | if (st->gpio_write_state[GPIO_TUNER] == onoff) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | o[0] = IOCTL_SET_I2C_PATH; | 60 | o[0] = GPIO_TUNER; |
61 | switch (path) { | 61 | o[1] = onoff; |
62 | case PATH_CX22702: | 62 | cxusb_ctrl_msg(d,CMD_GPIO_WRITE,o,2,&i,1); |
63 | o[1] = 0; | ||
64 | break; | ||
65 | case PATH_TUNER_OTHER: | ||
66 | o[1] = 1; | ||
67 | break; | ||
68 | default: | ||
69 | err("unkown i2c path"); | ||
70 | return; | ||
71 | } | ||
72 | cxusb_ctrl_msg(d,CMD_IOCTL,o,2,&i,1); | ||
73 | 63 | ||
74 | if (i != 0x01) | 64 | if (i != 0x01) |
75 | deb_info("i2c_path setting failed.\n"); | 65 | deb_info("gpio_write failed.\n"); |
76 | 66 | ||
77 | st->cur_i2c_path = path; | 67 | st->gpio_write_state[GPIO_TUNER] = onoff; |
78 | } | 68 | } |
79 | 69 | ||
70 | /* I2C */ | ||
80 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | 71 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) |
81 | { | 72 | { |
82 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 73 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
@@ -92,10 +83,10 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
92 | 83 | ||
93 | switch (msg[i].addr) { | 84 | switch (msg[i].addr) { |
94 | case 0x63: | 85 | case 0x63: |
95 | cxusb_set_i2c_path(d,PATH_CX22702); | 86 | cxusb_gpio_tuner(d,0); |
96 | break; | 87 | break; |
97 | default: | 88 | default: |
98 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | 89 | cxusb_gpio_tuner(d,1); |
99 | break; | 90 | break; |
100 | } | 91 | } |
101 | 92 | ||
@@ -147,16 +138,20 @@ static struct i2c_algorithm cxusb_i2c_algo = { | |||
147 | 138 | ||
148 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) | 139 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
149 | { | 140 | { |
150 | return 0; | 141 | u8 b = 0; |
142 | if (onoff) | ||
143 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); | ||
144 | else | ||
145 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); | ||
151 | } | 146 | } |
152 | 147 | ||
153 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | 148 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) |
154 | { | 149 | { |
155 | u8 buf[2] = { 0x03, 0x00 }; | 150 | u8 buf[2] = { 0x03, 0x00 }; |
156 | if (onoff) | 151 | if (onoff) |
157 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | 152 | cxusb_ctrl_msg(d,CMD_STREAMING_ON, buf, 2, NULL, 0); |
158 | else | 153 | else |
159 | cxusb_ctrl_msg(d,0x37, NULL, 0, NULL, 0); | 154 | cxusb_ctrl_msg(d,CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
160 | 155 | ||
161 | return 0; | 156 | return 0; |
162 | } | 157 | } |
@@ -182,22 +177,11 @@ static int cxusb_tuner_attach(struct dvb_usb_device *d) | |||
182 | 177 | ||
183 | static int cxusb_frontend_attach(struct dvb_usb_device *d) | 178 | static int cxusb_frontend_attach(struct dvb_usb_device *d) |
184 | { | 179 | { |
185 | u8 buf[2] = { 0x03, 0x00 }; | 180 | u8 b; |
186 | u8 b = 0; | ||
187 | |||
188 | if (usb_set_interface(d->udev,0,0) < 0) | ||
189 | err("set interface to alts=0 failed"); | ||
190 | |||
191 | cxusb_ctrl_msg(d,0xde,&b,0,NULL,0); | ||
192 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | ||
193 | cxusb_ctrl_msg(d,CMD_POWER_OFF, NULL, 0, &b, 1); | ||
194 | |||
195 | if (usb_set_interface(d->udev,0,6) < 0) | 181 | if (usb_set_interface(d->udev,0,6) < 0) |
196 | err("set interface failed"); | 182 | err("set interface failed"); |
197 | 183 | ||
198 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | 184 | cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, &b, 1); |
199 | cxusb_set_i2c_path(d,PATH_CX22702); | ||
200 | cxusb_ctrl_msg(d,CMD_POWER_ON, NULL, 0, &b, 1); | ||
201 | 185 | ||
202 | if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) | 186 | if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) |
203 | return 0; | 187 | return 0; |
@@ -237,14 +221,12 @@ static struct dvb_usb_properties cxusb_properties = { | |||
237 | .generic_bulk_ctrl_endpoint = 0x01, | 221 | .generic_bulk_ctrl_endpoint = 0x01, |
238 | /* parameter for the MPEG2-data transfer */ | 222 | /* parameter for the MPEG2-data transfer */ |
239 | .urb = { | 223 | .urb = { |
240 | .type = DVB_USB_ISOC, | 224 | .type = DVB_USB_BULK, |
241 | .count = 5, | 225 | .count = 5, |
242 | .endpoint = 0x02, | 226 | .endpoint = 0x02, |
243 | .u = { | 227 | .u = { |
244 | .isoc = { | 228 | .bulk = { |
245 | .framesperurb = 32, | 229 | .buffersize = 8192, |
246 | .framesize = 940, | ||
247 | .interval = 5, | ||
248 | } | 230 | } |
249 | } | 231 | } |
250 | }, | 232 | }, |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h index 1d79016e3195..135c2a81f581 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.h +++ b/drivers/media/dvb/dvb-usb/cxusb.h | |||
@@ -1,30 +1,31 @@ | |||
1 | #ifndef _DVB_USB_CXUSB_H_ | 1 | #ifndef _DVB_USB_CXUSB_H_ |
2 | #define _DVB_USB_CXUSB_H_ | 2 | #define _DVB_USB_CXUSB_H_ |
3 | 3 | ||
4 | #define DVB_USB_LOG_PREFIX "digitv" | 4 | #define DVB_USB_LOG_PREFIX "cxusb" |
5 | #include "dvb-usb.h" | 5 | #include "dvb-usb.h" |
6 | 6 | ||
7 | extern int dvb_usb_cxusb_debug; | 7 | extern int dvb_usb_cxusb_debug; |
8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | 8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
9 | 9 | ||
10 | /* usb commands - some of it are guesses, don't have a reference yet */ | 10 | /* usb commands - some of it are guesses, don't have a reference yet */ |
11 | #define CMD_I2C_WRITE 0x08 | 11 | #define CMD_I2C_WRITE 0x08 |
12 | #define CMD_I2C_READ 0x09 | 12 | #define CMD_I2C_READ 0x09 |
13 | 13 | ||
14 | #define CMD_IOCTL 0x0e | 14 | #define CMD_GPIO_READ 0x0d |
15 | #define IOCTL_SET_I2C_PATH 0x02 | 15 | #define CMD_GPIO_WRITE 0x0e |
16 | #define GPIO_TUNER 0x02 | ||
16 | 17 | ||
17 | #define CMD_POWER_OFF 0x50 | 18 | #define CMD_POWER_OFF 0xdc |
18 | #define CMD_POWER_ON 0x51 | 19 | #define CMD_POWER_ON 0xde |
19 | 20 | ||
20 | enum cxusb_i2c_pathes { | 21 | #define CMD_STREAMING_ON 0x36 |
21 | PATH_UNDEF = 0x00, | 22 | #define CMD_STREAMING_OFF 0x37 |
22 | PATH_CX22702 = 0x01, | 23 | |
23 | PATH_TUNER_OTHER = 0x02, | 24 | #define CMD_ANALOG 0x50 |
24 | }; | 25 | #define CMD_DIGITAL 0x51 |
25 | 26 | ||
26 | struct cxusb_state { | 27 | struct cxusb_state { |
27 | enum cxusb_i2c_pathes cur_i2c_path; | 28 | u8 gpio_write_state[3]; |
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |