diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb/cxusb.c')
| -rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 9e96a188f1e9..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; |
| @@ -211,7 +195,7 @@ static struct dvb_usb_properties cxusb_properties; | |||
| 211 | static int cxusb_probe(struct usb_interface *intf, | 195 | static int cxusb_probe(struct usb_interface *intf, |
| 212 | const struct usb_device_id *id) | 196 | const struct usb_device_id *id) |
| 213 | { | 197 | { |
| 214 | return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE); | 198 | return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE,NULL); |
| 215 | } | 199 | } |
| 216 | 200 | ||
| 217 | static struct usb_device_id cxusb_table [] = { | 201 | static struct usb_device_id cxusb_table [] = { |
| @@ -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 | }, |
