diff options
author | Alan Nisota <alannisota@gmail.com> | 2007-08-18 16:52:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:05:22 -0400 |
commit | 458b634cd86968032171a4d6db5c89a772ff0348 (patch) | |
tree | 420b1a0933457e5910f2bcee542cc77e4aef5ee3 /drivers/media/dvb/dvb-usb/gp8psk.c | |
parent | fa40b2237ab6ed239967f76432438080232b88fe (diff) |
V4L/DVB (6037): Updated GenPix USB driver
There are now 4 different versions of the GENPIX USB adapter. The
newest 'Skywalker' models are fully self-contained, and need no
additional hardware to be used. A very reliable DVB-S card even without
using any of the alternate modulatations (which this kernel module does
not currently support)
The following patch adds support for all 4 versions of the genpix
adapter (www.genpix-electronics.com).
Signed-off-by: Alan Nisota alannisota@gmail.com
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/gp8psk.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/gp8psk.c | 93 |
1 files changed, 71 insertions, 22 deletions
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c index 518d67fca5e8..92147ee3e14f 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/drivers/media/dvb/dvb-usb/gp8psk.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* DVB USB compliant Linux driver for the | 1 | /* DVB USB compliant Linux driver for the |
2 | * - GENPIX 8pks/qpsk USB2.0 DVB-S module | 2 | * - GENPIX 8pks/qpsk/DCII USB2.0 DVB-S module |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Alan Nisota (alannisota@gmail.com) | 4 | * Copyright (C) 2006,2007 Alan Nisota (alannisota@gmail.com) |
5 | * Copyright (C) 2006,2007 Genpix Electronics (genpix@genpix-electronics.com) | ||
5 | * | 6 | * |
6 | * Thanks to GENPIX for the sample code used to implement this module. | 7 | * Thanks to GENPIX for the sample code used to implement this module. |
7 | * | 8 | * |
@@ -40,7 +41,7 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 | |||
40 | } | 41 | } |
41 | 42 | ||
42 | if (ret < 0 || ret != blen) { | 43 | if (ret < 0 || ret != blen) { |
43 | warn("usb in operation failed."); | 44 | warn("usb in %d operation failed.", req); |
44 | ret = -EIO; | 45 | ret = -EIO; |
45 | } else | 46 | } else |
46 | ret = 0; | 47 | ret = 0; |
@@ -97,10 +98,10 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) | |||
97 | if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0)) | 98 | if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0)) |
98 | goto out_rel_fw; | 99 | goto out_rel_fw; |
99 | 100 | ||
100 | info("downloaidng bcm4500 firmware from file '%s'",bcm4500_firmware); | 101 | info("downloading bcm4500 firmware from file '%s'",bcm4500_firmware); |
101 | 102 | ||
102 | ptr = fw->data; | 103 | ptr = fw->data; |
103 | buf = kmalloc(512, GFP_KERNEL | GFP_DMA); | 104 | buf = kmalloc(64, GFP_KERNEL | GFP_DMA); |
104 | 105 | ||
105 | while (ptr[0] != 0xff) { | 106 | while (ptr[0] != 0xff) { |
106 | u16 buflen = ptr[0] + 4; | 107 | u16 buflen = ptr[0] + 4; |
@@ -129,25 +130,34 @@ out_rel_fw: | |||
129 | static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) | 130 | static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) |
130 | { | 131 | { |
131 | u8 status, buf; | 132 | u8 status, buf; |
133 | int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); | ||
134 | |||
132 | if (onoff) { | 135 | if (onoff) { |
133 | gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); | 136 | gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); |
134 | if (! (status & 0x01)) /* started */ | 137 | if (! (status & bm8pskStarted)) { /* started */ |
138 | if(gp_product_id == USB_PID_GENPIX_SKYWALKER_CW3K) | ||
139 | gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); | ||
135 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) | 140 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) |
136 | return -EINVAL; | 141 | return -EINVAL; |
142 | } | ||
137 | 143 | ||
138 | if (! (status & 0x02)) /* BCM4500 firmware loaded */ | 144 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) |
139 | if(gp8psk_load_bcm4500fw(d)) | 145 | if (! (status & bm8pskFW_Loaded)) /* BCM4500 firmware loaded */ |
140 | return EINVAL; | 146 | if(gp8psk_load_bcm4500fw(d)) |
147 | return EINVAL; | ||
141 | 148 | ||
142 | if (! (status & 0x04)) /* LNB Power */ | 149 | if (! (status & bmIntersilOn)) /* LNB Power */ |
143 | if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0, | 150 | if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0, |
144 | &buf, 1)) | 151 | &buf, 1)) |
145 | return EINVAL; | 152 | return EINVAL; |
146 | 153 | ||
147 | /* Set DVB mode */ | 154 | /* Set DVB mode to 1 */ |
148 | if(gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0)) | 155 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) |
149 | return -EINVAL; | 156 | if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0)) |
150 | gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); | 157 | return EINVAL; |
158 | /* Abort possible TS (if previous tune crashed) */ | ||
159 | if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0)) | ||
160 | return EINVAL; | ||
151 | } else { | 161 | } else { |
152 | /* Turn off LNB power */ | 162 | /* Turn off LNB power */ |
153 | if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)) | 163 | if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)) |
@@ -155,11 +165,28 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
155 | /* Turn off 8psk power */ | 165 | /* Turn off 8psk power */ |
156 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) | 166 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) |
157 | return -EINVAL; | 167 | return -EINVAL; |
158 | 168 | if(gp_product_id == USB_PID_GENPIX_SKYWALKER_CW3K) | |
169 | gp8psk_usb_out_op(d, CW3K_INIT, 0, 0, NULL, 0); | ||
159 | } | 170 | } |
160 | return 0; | 171 | return 0; |
161 | } | 172 | } |
162 | 173 | ||
174 | int gp8psk_bcm4500_reload(struct dvb_usb_device *d) | ||
175 | { | ||
176 | u8 buf; | ||
177 | int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); | ||
178 | /* Turn off 8psk power */ | ||
179 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) | ||
180 | return -EINVAL; | ||
181 | /* Turn On 8psk power */ | ||
182 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) | ||
183 | return -EINVAL; | ||
184 | /* load BCM4500 firmware */ | ||
185 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) | ||
186 | if (gp8psk_load_bcm4500fw(d)) | ||
187 | return EINVAL; | ||
188 | return 0; | ||
189 | } | ||
163 | 190 | ||
164 | static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 191 | static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
165 | { | 192 | { |
@@ -177,12 +204,22 @@ static struct dvb_usb_device_properties gp8psk_properties; | |||
177 | static int gp8psk_usb_probe(struct usb_interface *intf, | 204 | static int gp8psk_usb_probe(struct usb_interface *intf, |
178 | const struct usb_device_id *id) | 205 | const struct usb_device_id *id) |
179 | { | 206 | { |
180 | return dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL); | 207 | int ret; |
208 | struct usb_device *udev = interface_to_usbdev(intf); | ||
209 | ret = dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL); | ||
210 | if (ret == 0) { | ||
211 | info("found Genpix USB device pID = %x (hex)", | ||
212 | le16_to_cpu(udev->descriptor.idProduct)); | ||
213 | } | ||
214 | return ret; | ||
181 | } | 215 | } |
182 | 216 | ||
183 | static struct usb_device_id gp8psk_usb_table [] = { | 217 | static struct usb_device_id gp8psk_usb_table [] = { |
184 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_COLD) }, | 218 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_COLD) }, |
185 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_WARM) }, | 219 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_1_WARM) }, |
220 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_REV_2) }, | ||
221 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_1) }, | ||
222 | { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_SKYWALKER_CW3K) }, | ||
186 | { 0 }, | 223 | { 0 }, |
187 | }; | 224 | }; |
188 | MODULE_DEVICE_TABLE(usb, gp8psk_usb_table); | 225 | MODULE_DEVICE_TABLE(usb, gp8psk_usb_table); |
@@ -213,12 +250,24 @@ static struct dvb_usb_device_properties gp8psk_properties = { | |||
213 | 250 | ||
214 | .generic_bulk_ctrl_endpoint = 0x01, | 251 | .generic_bulk_ctrl_endpoint = 0x01, |
215 | 252 | ||
216 | .num_device_descs = 1, | 253 | .num_device_descs = 4, |
217 | .devices = { | 254 | .devices = { |
218 | { .name = "Genpix 8PSK-USB DVB-S USB2.0 receiver", | 255 | { .name = "Genpix 8PSK-to-USB2 Rev.1 DVB-S receiver", |
219 | .cold_ids = { &gp8psk_usb_table[0], NULL }, | 256 | .cold_ids = { &gp8psk_usb_table[0], NULL }, |
220 | .warm_ids = { &gp8psk_usb_table[1], NULL }, | 257 | .warm_ids = { &gp8psk_usb_table[1], NULL }, |
221 | }, | 258 | }, |
259 | { .name = "Genpix 8PSK-to-USB2 Rev.2 DVB-S receiver", | ||
260 | .cold_ids = { NULL }, | ||
261 | .warm_ids = { &gp8psk_usb_table[2], NULL }, | ||
262 | }, | ||
263 | { .name = "Genpix SkyWalker-1 DVB-S receiver", | ||
264 | .cold_ids = { NULL }, | ||
265 | .warm_ids = { &gp8psk_usb_table[3], NULL }, | ||
266 | }, | ||
267 | { .name = "Genpix SkyWalker-CW3K DVB-S receiver", | ||
268 | .cold_ids = { NULL }, | ||
269 | .warm_ids = { &gp8psk_usb_table[4], NULL }, | ||
270 | }, | ||
222 | { NULL }, | 271 | { NULL }, |
223 | } | 272 | } |
224 | }; | 273 | }; |
@@ -253,6 +302,6 @@ module_init(gp8psk_usb_module_init); | |||
253 | module_exit(gp8psk_usb_module_exit); | 302 | module_exit(gp8psk_usb_module_exit); |
254 | 303 | ||
255 | MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); | 304 | MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); |
256 | MODULE_DESCRIPTION("Driver for Genpix 8psk-USB DVB-S USB2.0"); | 305 | MODULE_DESCRIPTION("Driver for Genpix 8psk-to-USB2 DVB-S"); |
257 | MODULE_VERSION("1.0"); | 306 | MODULE_VERSION("1.1"); |
258 | MODULE_LICENSE("GPL"); | 307 | MODULE_LICENSE("GPL"); |