aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-03-22 04:15:14 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:51:31 -0400
commitc1f2b0f29e51cf44eb6addff1b90f99988055a92 (patch)
tree3193e6f9b980dd70785e207f92a6dbac07e4b068
parent271922c0cee0b086ca2fe9cec39d585a44a2358b (diff)
V4L/DVB: w9966: remove camelCase
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/w9966.c336
1 files changed, 168 insertions, 168 deletions
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 7d5be0700413..b0719976845e 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -133,9 +133,9 @@ static const char *pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"};
133#endif 133#endif
134module_param_array(pardev, charp, NULL, 0); 134module_param_array(pardev, charp, NULL, 0);
135MODULE_PARM_DESC(pardev, "pardev: where to search for\n" 135MODULE_PARM_DESC(pardev, "pardev: where to search for\n"
136 "\teach camera. 'aggressive' means brute-force search.\n" 136 "\teach camera. 'aggressive' means brute-force search.\n"
137 "\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n" 137 "\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n"
138 "\tcam 1 to parport3 and search every parport for cam 2 etc..."); 138 "\tcam 1 to parport3 and search every parport for cam 2 etc...");
139 139
140static int parmode; 140static int parmode;
141module_param(parmode, int, 0); 141module_param(parmode, int, 0);
@@ -152,13 +152,13 @@ static struct w9966_dev w9966_cams[W9966_MAXCAMS];
152 152
153 153
154/* Set camera phase flags, so we know what to uninit when terminating */ 154/* Set camera phase flags, so we know what to uninit when terminating */
155static inline void w9966_setState(struct w9966_dev *cam, int mask, int val) 155static inline void w9966_set_state(struct w9966_dev *cam, int mask, int val)
156{ 156{
157 cam->dev_state = (cam->dev_state & ~mask) ^ val; 157 cam->dev_state = (cam->dev_state & ~mask) ^ val;
158} 158}
159 159
160/* Get camera phase flags */ 160/* Get camera phase flags */
161static inline int w9966_getState(struct w9966_dev *cam, int mask, int val) 161static inline int w9966_get_state(struct w9966_dev *cam, int mask, int val)
162{ 162{
163 return ((cam->dev_state & mask) == val); 163 return ((cam->dev_state & mask) == val);
164} 164}
@@ -166,25 +166,25 @@ static inline int w9966_getState(struct w9966_dev *cam, int mask, int val)
166/* Claim parport for ourself */ 166/* Claim parport for ourself */
167static void w9966_pdev_claim(struct w9966_dev *cam) 167static void w9966_pdev_claim(struct w9966_dev *cam)
168{ 168{
169 if (w9966_getState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED)) 169 if (w9966_get_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED))
170 return; 170 return;
171 parport_claim_or_block(cam->pdev); 171 parport_claim_or_block(cam->pdev);
172 w9966_setState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED); 172 w9966_set_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED);
173} 173}
174 174
175/* Release parport for others to use */ 175/* Release parport for others to use */
176static void w9966_pdev_release(struct w9966_dev *cam) 176static void w9966_pdev_release(struct w9966_dev *cam)
177{ 177{
178 if (w9966_getState(cam, W9966_STATE_CLAIMED, 0)) 178 if (w9966_get_state(cam, W9966_STATE_CLAIMED, 0))
179 return; 179 return;
180 parport_release(cam->pdev); 180 parport_release(cam->pdev);
181 w9966_setState(cam, W9966_STATE_CLAIMED, 0); 181 w9966_set_state(cam, W9966_STATE_CLAIMED, 0);
182} 182}
183 183
184/* Read register from W9966 interface-chip 184/* Read register from W9966 interface-chip
185 Expects a claimed pdev 185 Expects a claimed pdev
186 -1 on error, else register data (byte) */ 186 -1 on error, else register data (byte) */
187static int w9966_rReg(struct w9966_dev *cam, int reg) 187static int w9966_read_reg(struct w9966_dev *cam, int reg)
188{ 188{
189 /* ECP, read, regtransfer, REG, REG, REG, REG, REG */ 189 /* ECP, read, regtransfer, REG, REG, REG, REG, REG */
190 const unsigned char addr = 0x80 | (reg & 0x1f); 190 const unsigned char addr = 0x80 | (reg & 0x1f);
@@ -205,7 +205,7 @@ static int w9966_rReg(struct w9966_dev *cam, int reg)
205/* Write register to W9966 interface-chip 205/* Write register to W9966 interface-chip
206 Expects a claimed pdev 206 Expects a claimed pdev
207 -1 on error */ 207 -1 on error */
208static int w9966_wReg(struct w9966_dev *cam, int reg, int data) 208static int w9966_write_reg(struct w9966_dev *cam, int reg, int data)
209{ 209{
210 /* ECP, write, regtransfer, REG, REG, REG, REG, REG */ 210 /* ECP, write, regtransfer, REG, REG, REG, REG, REG */
211 const unsigned char addr = 0xc0 | (reg & 0x1f); 211 const unsigned char addr = 0xc0 | (reg & 0x1f);
@@ -236,7 +236,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
236 else 236 else
237 cam->i2c_state &= ~W9966_I2C_W_DATA; 237 cam->i2c_state &= ~W9966_I2C_W_DATA;
238 238
239 w9966_wReg(cam, 0x18, cam->i2c_state); 239 w9966_write_reg(cam, 0x18, cam->i2c_state);
240 udelay(5); 240 udelay(5);
241} 241}
242 242
@@ -244,7 +244,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
244 Expects a claimed pdev. */ 244 Expects a claimed pdev. */
245static int w9966_i2c_getscl(struct w9966_dev *cam) 245static int w9966_i2c_getscl(struct w9966_dev *cam)
246{ 246{
247 const unsigned char state = w9966_rReg(cam, 0x18); 247 const unsigned char state = w9966_read_reg(cam, 0x18);
248 return ((state & W9966_I2C_R_CLOCK) > 0); 248 return ((state & W9966_I2C_R_CLOCK) > 0);
249} 249}
250 250
@@ -259,7 +259,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state)
259 else 259 else
260 cam->i2c_state &= ~W9966_I2C_W_CLOCK; 260 cam->i2c_state &= ~W9966_I2C_W_CLOCK;
261 261
262 w9966_wReg(cam, 0x18, cam->i2c_state); 262 w9966_write_reg(cam, 0x18, cam->i2c_state);
263 udelay(5); 263 udelay(5);
264 264
265 /* we go to high, we also expect the peripheral to ack. */ 265 /* we go to high, we also expect the peripheral to ack. */
@@ -278,7 +278,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state)
278 Expects a claimed pdev. */ 278 Expects a claimed pdev. */
279static int w9966_i2c_getsda(struct w9966_dev *cam) 279static int w9966_i2c_getsda(struct w9966_dev *cam)
280{ 280{
281 const unsigned char state = w9966_rReg(cam, 0x18); 281 const unsigned char state = w9966_read_reg(cam, 0x18);
282 return ((state & W9966_I2C_R_DATA) > 0); 282 return ((state & W9966_I2C_R_DATA) > 0);
283} 283}
284#endif 284#endif
@@ -332,7 +332,7 @@ static int w9966_i2c_rbyte(struct w9966_dev *cam)
332/* Read a register from the i2c device. 332/* Read a register from the i2c device.
333 Expects claimed pdev. -1 on error */ 333 Expects claimed pdev. -1 on error */
334#if 0 334#if 0
335static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) 335static int w9966_read_reg_i2c(struct w9966_dev *cam, int reg)
336{ 336{
337 int data; 337 int data;
338 338
@@ -367,14 +367,14 @@ static int w9966_rReg_i2c(struct w9966_dev *cam, int reg)
367 367
368/* Write a register to the i2c device. 368/* Write a register to the i2c device.
369 Expects claimed pdev. -1 on error */ 369 Expects claimed pdev. -1 on error */
370static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data) 370static int w9966_write_reg_i2c(struct w9966_dev *cam, int reg, int data)
371{ 371{
372 w9966_i2c_setsda(cam, 0); 372 w9966_i2c_setsda(cam, 0);
373 w9966_i2c_setscl(cam, 0); 373 w9966_i2c_setscl(cam, 0);
374 374
375 if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || 375 if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 ||
376 w9966_i2c_wbyte(cam, reg) == -1 || 376 w9966_i2c_wbyte(cam, reg) == -1 ||
377 w9966_i2c_wbyte(cam, data) == -1) 377 w9966_i2c_wbyte(cam, data) == -1)
378 return -1; 378 return -1;
379 379
380 w9966_i2c_setsda(cam, 0); 380 w9966_i2c_setsda(cam, 0);
@@ -489,15 +489,15 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
489 enh_s = 0; 489 enh_s = 0;
490 enh_e = w * h * 2; 490 enh_e = w * h * 2;
491 491
492/* Modify capture window if necessary and calculate downscaling */ 492 /* Modify capture window if necessary and calculate downscaling */
493 if (w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || 493 if (w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 ||
494 w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0) 494 w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0)
495 return -1; 495 return -1;
496 496
497 DPRINTF("%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", 497 DPRINTF("%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n",
498 w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80); 498 w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80);
499 499
500/* Setup registers */ 500 /* Setup registers */
501 regs[0x00] = 0x00; /* Set normal operation */ 501 regs[0x00] = 0x00; /* Set normal operation */
502 regs[0x01] = 0x18; /* Capture mode */ 502 regs[0x01] = 0x18; /* Capture mode */
503 regs[0x02] = scale_y; /* V-scaling */ 503 regs[0x02] = scale_y; /* V-scaling */
@@ -536,18 +536,18 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
536 saa7111_regs[0x0c] = cam->color; 536 saa7111_regs[0x0c] = cam->color;
537 saa7111_regs[0x0d] = cam->hue; 537 saa7111_regs[0x0d] = cam->hue;
538 538
539/* Reset (ECP-fifo & serial-bus) */ 539 /* Reset (ECP-fifo & serial-bus) */
540 if (w9966_wReg(cam, 0x00, 0x03) == -1) 540 if (w9966_write_reg(cam, 0x00, 0x03) == -1)
541 return -1; 541 return -1;
542 542
543/* Write regs to w9966cf chip */ 543 /* Write regs to w9966cf chip */
544 for (i = 0; i < 0x1c; i++) 544 for (i = 0; i < 0x1c; i++)
545 if (w9966_wReg(cam, i, regs[i]) == -1) 545 if (w9966_write_reg(cam, i, regs[i]) == -1)
546 return -1; 546 return -1;
547 547
548/* Write regs to saa7111 chip */ 548 /* Write regs to saa7111 chip */
549 for (i = 0; i < 0x20; i++) 549 for (i = 0; i < 0x20; i++)
550 if (w9966_wReg_i2c(cam, i, saa7111_regs[i]) == -1) 550 if (w9966_write_reg_i2c(cam, i, saa7111_regs[i]) == -1)
551 return -1; 551 return -1;
552 552
553 return 0; 553 return 0;
@@ -563,134 +563,134 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
563 563
564 switch (cmd) { 564 switch (cmd) {
565 case VIDIOCGCAP: 565 case VIDIOCGCAP:
566 { 566 {
567 static struct video_capability vcap = { 567 static struct video_capability vcap = {
568 .name = W9966_DRIVERNAME, 568 .name = W9966_DRIVERNAME,
569 .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES, 569 .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES,
570 .channels = 1, 570 .channels = 1,
571 .maxwidth = W9966_WND_MAX_W, 571 .maxwidth = W9966_WND_MAX_W,
572 .maxheight = W9966_WND_MAX_H, 572 .maxheight = W9966_WND_MAX_H,
573 .minwidth = 2, 573 .minwidth = 2,
574 .minheight = 1, 574 .minheight = 1,
575 }; 575 };
576 struct video_capability *cap = arg; 576 struct video_capability *cap = arg;
577 *cap = vcap; 577 *cap = vcap;
578 return 0; 578 return 0;
579 } 579 }
580 case VIDIOCGCHAN: 580 case VIDIOCGCHAN:
581 { 581 {
582 struct video_channel *vch = arg; 582 struct video_channel *vch = arg;
583 if (vch->channel != 0) /* We only support one channel (#0) */ 583 if (vch->channel != 0) /* We only support one channel (#0) */
584 return -EINVAL; 584 return -EINVAL;
585 memset(vch, 0, sizeof(*vch)); 585 memset(vch, 0, sizeof(*vch));
586 strcpy(vch->name, "CCD-input"); 586 strcpy(vch->name, "CCD-input");
587 vch->type = VIDEO_TYPE_CAMERA; 587 vch->type = VIDEO_TYPE_CAMERA;
588 return 0; 588 return 0;
589 } 589 }
590 case VIDIOCSCHAN: 590 case VIDIOCSCHAN:
591 { 591 {
592 struct video_channel *vch = arg; 592 struct video_channel *vch = arg;
593 if (vch->channel != 0) 593 if (vch->channel != 0)
594 return -EINVAL; 594 return -EINVAL;
595 return 0; 595 return 0;
596 } 596 }
597 case VIDIOCGTUNER: 597 case VIDIOCGTUNER:
598 { 598 {
599 struct video_tuner *vtune = arg; 599 struct video_tuner *vtune = arg;
600 if (vtune->tuner != 0) 600 if (vtune->tuner != 0)
601 return -EINVAL; 601 return -EINVAL;
602 strcpy(vtune->name, "no tuner"); 602 strcpy(vtune->name, "no tuner");
603 vtune->rangelow = 0; 603 vtune->rangelow = 0;
604 vtune->rangehigh = 0; 604 vtune->rangehigh = 0;
605 vtune->flags = VIDEO_TUNER_NORM; 605 vtune->flags = VIDEO_TUNER_NORM;
606 vtune->mode = VIDEO_MODE_AUTO; 606 vtune->mode = VIDEO_MODE_AUTO;
607 vtune->signal = 0xffff; 607 vtune->signal = 0xffff;
608 return 0; 608 return 0;
609 } 609 }
610 case VIDIOCSTUNER: 610 case VIDIOCSTUNER:
611 { 611 {
612 struct video_tuner *vtune = arg; 612 struct video_tuner *vtune = arg;
613 if (vtune->tuner != 0) 613 if (vtune->tuner != 0)
614 return -EINVAL; 614 return -EINVAL;
615 if (vtune->mode != VIDEO_MODE_AUTO) 615 if (vtune->mode != VIDEO_MODE_AUTO)
616 return -EINVAL; 616 return -EINVAL;
617 return 0; 617 return 0;
618 } 618 }
619 case VIDIOCGPICT: 619 case VIDIOCGPICT:
620 { 620 {
621 struct video_picture vpic = { 621 struct video_picture vpic = {
622 cam->brightness << 8, /* brightness */ 622 cam->brightness << 8, /* brightness */
623 (cam->hue + 128) << 8, /* hue */ 623 (cam->hue + 128) << 8, /* hue */
624 cam->color << 9, /* color */ 624 cam->color << 9, /* color */
625 cam->contrast << 9, /* contrast */ 625 cam->contrast << 9, /* contrast */
626 0x8000, /* whiteness */ 626 0x8000, /* whiteness */
627 16, VIDEO_PALETTE_YUV422/* bpp, palette format */ 627 16, VIDEO_PALETTE_YUV422/* bpp, palette format */
628 }; 628 };
629 struct video_picture *pic = arg; 629 struct video_picture *pic = arg;
630 *pic = vpic; 630 *pic = vpic;
631 return 0; 631 return 0;
632 } 632 }
633 case VIDIOCSPICT: 633 case VIDIOCSPICT:
634 { 634 {
635 struct video_picture *vpic = arg; 635 struct video_picture *vpic = arg;
636 if (vpic->depth != 16 || (vpic->palette != VIDEO_PALETTE_YUV422 && vpic->palette != VIDEO_PALETTE_YUYV)) 636 if (vpic->depth != 16 || (vpic->palette != VIDEO_PALETTE_YUV422 && vpic->palette != VIDEO_PALETTE_YUYV))
637 return -EINVAL; 637 return -EINVAL;
638 638
639 cam->brightness = vpic->brightness >> 8; 639 cam->brightness = vpic->brightness >> 8;
640 cam->hue = (vpic->hue >> 8) - 128; 640 cam->hue = (vpic->hue >> 8) - 128;
641 cam->color = vpic->colour >> 9; 641 cam->color = vpic->colour >> 9;
642 cam->contrast = vpic->contrast >> 9; 642 cam->contrast = vpic->contrast >> 9;
643
644 w9966_pdev_claim(cam);
645
646 if (
647 w9966_write_reg_i2c(cam, 0x0a, cam->brightness) == -1 ||
648 w9966_write_reg_i2c(cam, 0x0b, cam->contrast) == -1 ||
649 w9966_write_reg_i2c(cam, 0x0c, cam->color) == -1 ||
650 w9966_write_reg_i2c(cam, 0x0d, cam->hue) == -1
651 ) {
652 w9966_pdev_release(cam);
653 return -EIO;
654 }
643 655
644 w9966_pdev_claim(cam);
645
646 if (
647 w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||
648 w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||
649 w9966_wReg_i2c(cam, 0x0c, cam->color) == -1 ||
650 w9966_wReg_i2c(cam, 0x0d, cam->hue) == -1
651 ) {
652 w9966_pdev_release(cam); 656 w9966_pdev_release(cam);
653 return -EIO; 657 return 0;
654 } 658 }
655
656 w9966_pdev_release(cam);
657 return 0;
658 }
659 case VIDIOCSWIN: 659 case VIDIOCSWIN:
660 { 660 {
661 int ret; 661 int ret;
662 struct video_window *vwin = arg; 662 struct video_window *vwin = arg;
663 663
664 if (vwin->flags != 0) 664 if (vwin->flags != 0)
665 return -EINVAL; 665 return -EINVAL;
666 if (vwin->clipcount != 0) 666 if (vwin->clipcount != 0)
667 return -EINVAL; 667 return -EINVAL;
668 if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) 668 if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W)
669 return -EINVAL; 669 return -EINVAL;
670 if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) 670 if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H)
671 return -EINVAL; 671 return -EINVAL;
672 672
673 /* Update camera regs */ 673 /* Update camera regs */
674 w9966_pdev_claim(cam); 674 w9966_pdev_claim(cam);
675 ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); 675 ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height);
676 w9966_pdev_release(cam); 676 w9966_pdev_release(cam);
677 677
678 if (ret != 0) { 678 if (ret != 0) {
679 DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); 679 DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n");
680 return -EIO; 680 return -EIO;
681 } 681 }
682 682
683 return 0; 683 return 0;
684 } 684 }
685 case VIDIOCGWIN: 685 case VIDIOCGWIN:
686 { 686 {
687 struct video_window *vwin = arg; 687 struct video_window *vwin = arg;
688 memset(vwin, 0, sizeof(*vwin)); 688 memset(vwin, 0, sizeof(*vwin));
689 vwin->width = cam->width; 689 vwin->width = cam->width;
690 vwin->height = cam->height; 690 vwin->height = cam->height;
691 return 0; 691 return 0;
692 } 692 }
693 /* Unimplemented */ 693 /* Unimplemented */
694 case VIDIOCCAPTURE: 694 case VIDIOCCAPTURE:
695 case VIDIOCGFBUF: 695 case VIDIOCGFBUF:
696 case VIDIOCSFBUF: 696 case VIDIOCSFBUF:
@@ -707,14 +707,14 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
707} 707}
708 708
709static long w9966_v4l_ioctl(struct file *file, 709static long w9966_v4l_ioctl(struct file *file,
710 unsigned int cmd, unsigned long arg) 710 unsigned int cmd, unsigned long arg)
711{ 711{
712 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl); 712 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl);
713} 713}
714 714
715/* Capture data */ 715/* Capture data */
716static ssize_t w9966_v4l_read(struct file *file, char __user *buf, 716static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
717 size_t count, loff_t *ppos) 717 size_t count, loff_t *ppos)
718{ 718{
719 struct w9966_dev *cam = video_drvdata(file); 719 struct w9966_dev *cam = video_drvdata(file);
720 unsigned char addr = 0xa0; /* ECP, read, CCD-transfer, 00000 */ 720 unsigned char addr = 0xa0; /* ECP, read, CCD-transfer, 00000 */
@@ -727,14 +727,14 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
727 return -EINVAL; 727 return -EINVAL;
728 728
729 w9966_pdev_claim(cam); 729 w9966_pdev_claim(cam);
730 w9966_wReg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */ 730 w9966_write_reg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */
731 w9966_wReg(cam, 0x00, 0x00); /* Return to normal operation */ 731 w9966_write_reg(cam, 0x00, 0x00); /* Return to normal operation */
732 w9966_wReg(cam, 0x01, 0x98); /* Enable capture */ 732 w9966_write_reg(cam, 0x01, 0x98); /* Enable capture */
733 733
734 /* write special capture-addr and negotiate into data transfer */ 734 /* write special capture-addr and negotiate into data transfer */
735 if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) || 735 if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) ||
736 (parport_write(cam->pport, &addr, 1) != 1) || 736 (parport_write(cam->pport, &addr, 1) != 1) ||
737 (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0)) { 737 (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0)) {
738 w9966_pdev_release(cam); 738 w9966_pdev_release(cam);
739 return -EFAULT; 739 return -EFAULT;
740 } 740 }
@@ -760,7 +760,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
760 dleft -= tsize; 760 dleft -= tsize;
761 } 761 }
762 762
763 w9966_wReg(cam, 0x01, 0x18); /* Disable capture */ 763 w9966_write_reg(cam, 0x01, 0x18); /* Disable capture */
764 764
765out: 765out:
766 kfree(tbuf); 766 kfree(tbuf);
@@ -814,7 +814,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
814 cam->color = 64; 814 cam->color = 64;
815 cam->hue = 0; 815 cam->hue = 0;
816 816
817/* Select requested transfer mode */ 817 /* Select requested transfer mode */
818 switch (parmode) { 818 switch (parmode) {
819 default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */ 819 default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */
820 case 0: 820 case 0:
@@ -830,20 +830,20 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
830 break; 830 break;
831 case 2: /* hw- or sw-epp */ 831 case 2: /* hw- or sw-epp */
832 cam->ppmode = IEEE1284_MODE_EPP; 832 cam->ppmode = IEEE1284_MODE_EPP;
833 break; 833 break;
834 } 834 }
835 835
836/* Tell the parport driver that we exists */ 836 /* Tell the parport driver that we exists */
837 cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); 837 cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL);
838 if (cam->pdev == NULL) { 838 if (cam->pdev == NULL) {
839 DPRINTF("parport_register_device() failed\n"); 839 DPRINTF("parport_register_device() failed\n");
840 return -1; 840 return -1;
841 } 841 }
842 w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); 842 w9966_set_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);
843 843
844 w9966_pdev_claim(cam); 844 w9966_pdev_claim(cam);
845 845
846/* Setup a default capture mode */ 846 /* Setup a default capture mode */
847 if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { 847 if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) {
848 DPRINTF("w9966_setup() failed.\n"); 848 DPRINTF("w9966_setup() failed.\n");
849 return -1; 849 return -1;
@@ -851,18 +851,18 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
851 851
852 w9966_pdev_release(cam); 852 w9966_pdev_release(cam);
853 853
854/* Fill in the video_device struct and register us to v4l */ 854 /* Fill in the video_device struct and register us to v4l */
855 memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); 855 memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
856 video_set_drvdata(&cam->vdev, cam); 856 video_set_drvdata(&cam->vdev, cam);
857 857
858 if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) 858 if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
859 return -1; 859 return -1;
860 860
861 w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); 861 w9966_set_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
862 862
863 /* All ok */ 863 /* All ok */
864 printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n", 864 printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n",
865 cam->pport->name); 865 cam->pport->name);
866 return 0; 866 return 0;
867} 867}
868 868
@@ -870,23 +870,23 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
870/* Terminate everything gracefully */ 870/* Terminate everything gracefully */
871static void w9966_term(struct w9966_dev *cam) 871static void w9966_term(struct w9966_dev *cam)
872{ 872{
873/* Unregister from v4l */ 873 /* Unregister from v4l */
874 if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { 874 if (w9966_get_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
875 video_unregister_device(&cam->vdev); 875 video_unregister_device(&cam->vdev);
876 w9966_setState(cam, W9966_STATE_VDEV, 0); 876 w9966_set_state(cam, W9966_STATE_VDEV, 0);
877 } 877 }
878 878
879/* Terminate from IEEE1284 mode and release pdev block */ 879 /* Terminate from IEEE1284 mode and release pdev block */
880 if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { 880 if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
881 w9966_pdev_claim(cam); 881 w9966_pdev_claim(cam);
882 parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT); 882 parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT);
883 w9966_pdev_release(cam); 883 w9966_pdev_release(cam);
884 } 884 }
885 885
886/* Unregister from parport */ 886 /* Unregister from parport */
887 if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { 887 if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
888 parport_unregister_device(cam->pdev); 888 parport_unregister_device(cam->pdev);
889 w9966_setState(cam, W9966_STATE_PDEV, 0); 889 w9966_set_state(cam, W9966_STATE_PDEV, 0);
890 } 890 }
891} 891}
892 892