diff options
Diffstat (limited to 'drivers/media/video/w9966.c')
-rw-r--r-- | drivers/media/video/w9966.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index b7b0afffd214..80ef8a1b8f63 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -26,7 +26,7 @@ | |||
26 | Does any other model using the w9966 interface chip exist ? | 26 | Does any other model using the w9966 interface chip exist ? |
27 | 27 | ||
28 | Todo: | 28 | Todo: |
29 | 29 | ||
30 | *Add a working EPP mode, since DMA ECP read isn't implemented | 30 | *Add a working EPP mode, since DMA ECP read isn't implemented |
31 | in the parport drivers. (That's why it's so sloow) | 31 | in the parport drivers. (That's why it's so sloow) |
32 | 32 | ||
@@ -47,9 +47,9 @@ | |||
47 | *Probably some bugs that I don't know of | 47 | *Probably some bugs that I don't know of |
48 | 48 | ||
49 | Please support me by sending feedback! | 49 | Please support me by sending feedback! |
50 | 50 | ||
51 | Changes: | 51 | Changes: |
52 | 52 | ||
53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE | 53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE |
54 | and owner support for newer module locks | 54 | and owner support for newer module locks |
55 | */ | 55 | */ |
@@ -204,7 +204,7 @@ static struct video_device w9966_template = { | |||
204 | */ | 204 | */ |
205 | 205 | ||
206 | 206 | ||
207 | // Set camera phase flags, so we know what to uninit when terminating | 207 | // Set camera phase flags, so we know what to uninit when terminating |
208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) | 208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) |
209 | { | 209 | { |
210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; | 210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; |
@@ -233,7 +233,7 @@ static inline void w9966_pdev_release(struct w9966_dev* cam) | |||
233 | parport_release(cam->pdev); | 233 | parport_release(cam->pdev); |
234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); | 234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); |
235 | } | 235 | } |
236 | 236 | ||
237 | // Read register from W9966 interface-chip | 237 | // Read register from W9966 interface-chip |
238 | // Expects a claimed pdev | 238 | // Expects a claimed pdev |
239 | // -1 on error, else register data (byte) | 239 | // -1 on error, else register data (byte) |
@@ -242,7 +242,7 @@ static int w9966_rReg(struct w9966_dev* cam, int reg) | |||
242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG | 242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG |
243 | const unsigned char addr = 0x80 | (reg & 0x1f); | 243 | const unsigned char addr = 0x80 | (reg & 0x1f); |
244 | unsigned char val; | 244 | unsigned char val; |
245 | 245 | ||
246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
247 | return -1; | 247 | return -1; |
248 | if (parport_write(cam->pport, &addr, 1) != 1) | 248 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -263,7 +263,7 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data) | |||
263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG | 263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG |
264 | const unsigned char addr = 0xc0 | (reg & 0x1f); | 264 | const unsigned char addr = 0xc0 | (reg & 0x1f); |
265 | const unsigned char val = data; | 265 | const unsigned char val = data; |
266 | 266 | ||
267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
268 | return -1; | 268 | return -1; |
269 | if (parport_write(cam->pport, &addr, 1) != 1) | 269 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -284,7 +284,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
284 | { | 284 | { |
285 | if (cam->dev_state != 0) | 285 | if (cam->dev_state != 0) |
286 | return -1; | 286 | return -1; |
287 | 287 | ||
288 | cam->pport = port; | 288 | cam->pport = port; |
289 | cam->brightness = 128; | 289 | cam->brightness = 128; |
290 | cam->contrast = 64; | 290 | cam->contrast = 64; |
@@ -302,7 +302,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
302 | cam->ppmode = IEEE1284_MODE_EPP; | 302 | cam->ppmode = IEEE1284_MODE_EPP; |
303 | else | 303 | else |
304 | cam->ppmode = IEEE1284_MODE_ECP; | 304 | cam->ppmode = IEEE1284_MODE_ECP; |
305 | break; | 305 | break; |
306 | case 1: // hw- or sw-ecp | 306 | case 1: // hw- or sw-ecp |
307 | cam->ppmode = IEEE1284_MODE_ECP; | 307 | cam->ppmode = IEEE1284_MODE_ECP; |
308 | break; | 308 | break; |
@@ -310,7 +310,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
310 | cam->ppmode = IEEE1284_MODE_EPP; | 310 | cam->ppmode = IEEE1284_MODE_EPP; |
311 | break; | 311 | break; |
312 | } | 312 | } |
313 | 313 | ||
314 | // Tell the parport driver that we exists | 314 | // Tell the parport driver that we exists |
315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); | 315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); |
316 | if (cam->pdev == NULL) { | 316 | if (cam->pdev == NULL) { |
@@ -320,7 +320,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); | 320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); |
321 | 321 | ||
322 | w9966_pdev_claim(cam); | 322 | w9966_pdev_claim(cam); |
323 | 323 | ||
324 | // Setup a default capture mode | 324 | // Setup a default capture mode |
325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { | 325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { |
326 | DPRINTF("w9966_setup() failed.\n"); | 326 | DPRINTF("w9966_setup() failed.\n"); |
@@ -333,11 +333,11 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); | 333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); |
334 | cam->vdev.priv = cam; | 334 | cam->vdev.priv = cam; |
335 | 335 | ||
336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) | 336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) |
337 | return -1; | 337 | return -1; |
338 | 338 | ||
339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); | 339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); |
340 | 340 | ||
341 | // All ok | 341 | // All ok |
342 | printk( | 342 | printk( |
343 | "w9966cf: Found and initialized a webcam on %s.\n", | 343 | "w9966cf: Found and initialized a webcam on %s.\n", |
@@ -391,7 +391,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
391 | // Only continue as long as we keep getting better values | 391 | // Only continue as long as we keep getting better values |
392 | if (err > besterr) | 392 | if (err > besterr) |
393 | break; | 393 | break; |
394 | 394 | ||
395 | besterr = err; | 395 | besterr = err; |
396 | bestlen = len; | 396 | bestlen = len; |
397 | } | 397 | } |
@@ -399,7 +399,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
399 | return bestlen; | 399 | return bestlen; |
400 | } | 400 | } |
401 | 401 | ||
402 | // Modify capture window (if necessary) | 402 | // Modify capture window (if necessary) |
403 | // and calculate downscaling | 403 | // and calculate downscaling |
404 | // Return -1 on error | 404 | // Return -1 on error |
405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) | 405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) |
@@ -407,7 +407,7 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig | |||
407 | int maxlen = max - min; | 407 | int maxlen = max - min; |
408 | int len = *end - *beg + 1; | 408 | int len = *end - *beg + 1; |
409 | int newlen = w9966_findlen(len, size, maxlen); | 409 | int newlen = w9966_findlen(len, size, maxlen); |
410 | int err = newlen - len; | 410 | int err = newlen - len; |
411 | 411 | ||
412 | // Check for bad format | 412 | // Check for bad format |
413 | if (newlen > maxlen || newlen < size) | 413 | if (newlen > maxlen || newlen < size) |
@@ -452,8 +452,8 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 | 453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 |
454 | }; | 454 | }; |
455 | 455 | ||
456 | 456 | ||
457 | if (w*h*2 > W9966_SRAMSIZE) | 457 | if (w*h*2 > W9966_SRAMSIZE) |
458 | { | 458 | { |
459 | DPRINTF("capture window exceeds SRAM size!.\n"); | 459 | DPRINTF("capture window exceeds SRAM size!.\n"); |
@@ -469,9 +469,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
469 | cam->width = w; | 469 | cam->width = w; |
470 | cam->height = h; | 470 | cam->height = h; |
471 | 471 | ||
472 | enh_s = 0; | 472 | enh_s = 0; |
473 | enh_e = w*h*2; | 473 | enh_e = w*h*2; |
474 | 474 | ||
475 | // Modify capture window if necessary and calculate downscaling | 475 | // Modify capture window if necessary and calculate downscaling |
476 | if ( | 476 | if ( |
477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || | 477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || |
@@ -482,14 +482,14 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", | 482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", |
483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 | 483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 |
484 | ); | 484 | ); |
485 | 485 | ||
486 | // Setup registers | 486 | // Setup registers |
487 | regs[0x00] = 0x00; // Set normal operation | 487 | regs[0x00] = 0x00; // Set normal operation |
488 | regs[0x01] = 0x18; // Capture mode | 488 | regs[0x01] = 0x18; // Capture mode |
489 | regs[0x02] = scale_y; // V-scaling | 489 | regs[0x02] = scale_y; // V-scaling |
490 | regs[0x03] = scale_x; // H-scaling | 490 | regs[0x03] = scale_x; // H-scaling |
491 | 491 | ||
492 | // Capture window | 492 | // Capture window |
493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) | 493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) |
494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) | 494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) |
495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) | 495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) |
@@ -499,7 +499,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) | 499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) |
500 | 500 | ||
501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) | 501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) |
502 | 502 | ||
503 | // Enhancement layer | 503 | // Enhancement layer |
504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) | 504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) |
505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) | 505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) |
@@ -515,7 +515,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
515 | regs[0x19] = 0xff; // I/O port direction control | 515 | regs[0x19] = 0xff; // I/O port direction control |
516 | regs[0x1a] = 0xff; // I/O port data register | 516 | regs[0x1a] = 0xff; // I/O port data register |
517 | regs[0x1b] = 0x10; // ??? | 517 | regs[0x1b] = 0x10; // ??? |
518 | 518 | ||
519 | // SAA7111 chip settings | 519 | // SAA7111 chip settings |
520 | saa7111_regs[0x0a] = cam->brightness; | 520 | saa7111_regs[0x0a] = cam->brightness; |
521 | saa7111_regs[0x0b] = cam->contrast; | 521 | saa7111_regs[0x0b] = cam->contrast; |
@@ -551,7 +551,7 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) | |||
551 | cam->i2c_state |= W9966_I2C_W_DATA; | 551 | cam->i2c_state |= W9966_I2C_W_DATA; |
552 | else | 552 | else |
553 | cam->i2c_state &= ~W9966_I2C_W_DATA; | 553 | cam->i2c_state &= ~W9966_I2C_W_DATA; |
554 | 554 | ||
555 | w9966_wReg(cam, 0x18, cam->i2c_state); | 555 | w9966_wReg(cam, 0x18, cam->i2c_state); |
556 | udelay(5); | 556 | udelay(5); |
557 | } | 557 | } |
@@ -577,7 +577,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) | |||
577 | 577 | ||
578 | w9966_wReg(cam, 0x18, cam->i2c_state); | 578 | w9966_wReg(cam, 0x18, cam->i2c_state); |
579 | udelay(5); | 579 | udelay(5); |
580 | 580 | ||
581 | // we go to high, we also expect the peripheral to ack. | 581 | // we go to high, we also expect the peripheral to ack. |
582 | if (state) { | 582 | if (state) { |
583 | timeout = jiffies + 100; | 583 | timeout = jiffies + 100; |
@@ -607,16 +607,16 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); | 607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); |
608 | 608 | ||
609 | if (w9966_i2c_setscl(cam, 1) == -1) | 609 | if (w9966_i2c_setscl(cam, 1) == -1) |
610 | return -1; | 610 | return -1; |
611 | w9966_i2c_setscl(cam, 0); | 611 | w9966_i2c_setscl(cam, 0); |
612 | } | 612 | } |
613 | 613 | ||
614 | w9966_i2c_setsda(cam, 1); | 614 | w9966_i2c_setsda(cam, 1); |
615 | 615 | ||
616 | if (w9966_i2c_setscl(cam, 1) == -1) | 616 | if (w9966_i2c_setscl(cam, 1) == -1) |
617 | return -1; | 617 | return -1; |
618 | w9966_i2c_setscl(cam, 0); | 618 | w9966_i2c_setscl(cam, 0); |
619 | 619 | ||
620 | return 0; | 620 | return 0; |
621 | } | 621 | } |
622 | 622 | ||
@@ -626,8 +626,8 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) | 626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) |
627 | { | 627 | { |
628 | unsigned char data = 0x00; | 628 | unsigned char data = 0x00; |
629 | int i; | 629 | int i; |
630 | 630 | ||
631 | w9966_i2c_setsda(cam, 1); | 631 | w9966_i2c_setsda(cam, 1); |
632 | 632 | ||
633 | for (i = 0; i < 8; i++) | 633 | for (i = 0; i < 8; i++) |
@@ -637,7 +637,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam) | |||
637 | data = data << 1; | 637 | data = data << 1; |
638 | if (w9966_i2c_getsda(cam)) | 638 | if (w9966_i2c_getsda(cam)) |
639 | data |= 0x01; | 639 | data |= 0x01; |
640 | 640 | ||
641 | w9966_i2c_setscl(cam, 0); | 641 | w9966_i2c_setscl(cam, 0); |
642 | } | 642 | } |
643 | return data; | 643 | return data; |
@@ -673,11 +673,11 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) | |||
673 | return -1; | 673 | return -1; |
674 | 674 | ||
675 | w9966_i2c_setsda(cam, 0); | 675 | w9966_i2c_setsda(cam, 0); |
676 | 676 | ||
677 | if (w9966_i2c_setscl(cam, 1) == -1) | 677 | if (w9966_i2c_setscl(cam, 1) == -1) |
678 | return -1; | 678 | return -1; |
679 | w9966_i2c_setsda(cam, 1); | 679 | w9966_i2c_setsda(cam, 1); |
680 | 680 | ||
681 | return data; | 681 | return data; |
682 | } | 682 | } |
683 | #endif | 683 | #endif |
@@ -699,7 +699,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) | |||
699 | w9966_i2c_setsda(cam, 0); | 699 | w9966_i2c_setsda(cam, 0); |
700 | if (w9966_i2c_setscl(cam, 1) == -1) | 700 | if (w9966_i2c_setscl(cam, 1) == -1) |
701 | return -1; | 701 | return -1; |
702 | 702 | ||
703 | w9966_i2c_setsda(cam, 1); | 703 | w9966_i2c_setsda(cam, 1); |
704 | 704 | ||
705 | return 0; | 705 | return 0; |
@@ -714,7 +714,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
714 | { | 714 | { |
715 | struct video_device *vdev = video_devdata(file); | 715 | struct video_device *vdev = video_devdata(file); |
716 | struct w9966_dev *cam = vdev->priv; | 716 | struct w9966_dev *cam = vdev->priv; |
717 | 717 | ||
718 | switch(cmd) | 718 | switch(cmd) |
719 | { | 719 | { |
720 | case VIDIOCGCAP: | 720 | case VIDIOCGCAP: |
@@ -790,14 +790,14 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
790 | struct video_picture *vpic = arg; | 790 | struct video_picture *vpic = arg; |
791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) | 791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) |
792 | return -EINVAL; | 792 | return -EINVAL; |
793 | 793 | ||
794 | cam->brightness = vpic->brightness >> 8; | 794 | cam->brightness = vpic->brightness >> 8; |
795 | cam->hue = (vpic->hue >> 8) - 128; | 795 | cam->hue = (vpic->hue >> 8) - 128; |
796 | cam->color = vpic->colour >> 9; | 796 | cam->color = vpic->colour >> 9; |
797 | cam->contrast = vpic->contrast >> 9; | 797 | cam->contrast = vpic->contrast >> 9; |
798 | 798 | ||
799 | w9966_pdev_claim(cam); | 799 | w9966_pdev_claim(cam); |
800 | 800 | ||
801 | if ( | 801 | if ( |
802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || | 802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || |
803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || | 803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || |
@@ -807,7 +807,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
807 | w9966_pdev_release(cam); | 807 | w9966_pdev_release(cam); |
808 | return -EIO; | 808 | return -EIO; |
809 | } | 809 | } |
810 | 810 | ||
811 | w9966_pdev_release(cam); | 811 | w9966_pdev_release(cam); |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
@@ -815,13 +815,13 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
815 | { | 815 | { |
816 | int ret; | 816 | int ret; |
817 | struct video_window *vwin = arg; | 817 | struct video_window *vwin = arg; |
818 | 818 | ||
819 | if (vwin->flags != 0) | 819 | if (vwin->flags != 0) |
820 | return -EINVAL; | 820 | return -EINVAL; |
821 | if (vwin->clipcount != 0) | 821 | if (vwin->clipcount != 0) |
822 | return -EINVAL; | 822 | return -EINVAL; |
823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) | 823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) |
824 | return -EINVAL; | 824 | return -EINVAL; |
825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) | 825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) |
826 | return -EINVAL; | 826 | return -EINVAL; |
827 | 827 | ||
@@ -829,12 +829,12 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
829 | w9966_pdev_claim(cam); | 829 | w9966_pdev_claim(cam); |
830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); | 830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); |
831 | w9966_pdev_release(cam); | 831 | w9966_pdev_release(cam); |
832 | 832 | ||
833 | if (ret != 0) { | 833 | if (ret != 0) { |
834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); | 834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); |
835 | return -EIO; | 835 | return -EIO; |
836 | } | 836 | } |
837 | 837 | ||
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | case VIDIOCGWIN: | 840 | case VIDIOCGWIN: |
@@ -846,7 +846,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | // Unimplemented | 848 | // Unimplemented |
849 | case VIDIOCCAPTURE: | 849 | case VIDIOCCAPTURE: |
850 | case VIDIOCGFBUF: | 850 | case VIDIOCGFBUF: |
851 | case VIDIOCSFBUF: | 851 | case VIDIOCSFBUF: |
852 | case VIDIOCKEY: | 852 | case VIDIOCKEY: |
@@ -877,17 +877,17 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
877 | unsigned char __user *dest = (unsigned char __user *)buf; | 877 | unsigned char __user *dest = (unsigned char __user *)buf; |
878 | unsigned long dleft = count; | 878 | unsigned long dleft = count; |
879 | unsigned char *tbuf; | 879 | unsigned char *tbuf; |
880 | 880 | ||
881 | // Why would anyone want more than this?? | 881 | // Why would anyone want more than this?? |
882 | if (count > cam->width * cam->height * 2) | 882 | if (count > cam->width * cam->height * 2) |
883 | return -EINVAL; | 883 | return -EINVAL; |
884 | 884 | ||
885 | w9966_pdev_claim(cam); | 885 | w9966_pdev_claim(cam); |
886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer | 886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer |
887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation | 887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation |
888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture | 888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture |
889 | 889 | ||
890 | // write special capture-addr and negotiate into data transfer | 890 | // write special capture-addr and negotiate into data transfer |
891 | if ( | 891 | if ( |
892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| | 892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| |
893 | (parport_write(cam->pport, &addr, 1) != 1 )|| | 893 | (parport_write(cam->pport, &addr, 1) != 1 )|| |
@@ -906,7 +906,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
906 | while(dleft > 0) | 906 | while(dleft > 0) |
907 | { | 907 | { |
908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; | 908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; |
909 | 909 | ||
910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { | 910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { |
911 | count = -EFAULT; | 911 | count = -EFAULT; |
912 | goto out; | 912 | goto out; |
@@ -933,7 +933,7 @@ out: | |||
933 | static void w9966_attach(struct parport *port) | 933 | static void w9966_attach(struct parport *port) |
934 | { | 934 | { |
935 | int i; | 935 | int i; |
936 | 936 | ||
937 | for (i = 0; i < W9966_MAXCAMS; i++) | 937 | for (i = 0; i < W9966_MAXCAMS; i++) |
938 | { | 938 | { |
939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned | 939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned |