···370370#371371372372menu "V4L USB devices"373373- depends on USB && VIDEO_DEV373373+ depends on USB && VIDEO_DEV374374375375source "drivers/media/video/em28xx/Kconfig"376376···528528 ---help---529529 Say Y here if you want support for cameras based on OV681 or530530 Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips.531531-531531+532532 This driver has an optional plugin, which is distributed as a533533- separate module only (released under GPL). It allows to use higher 534534- resolutions and framerates, but cannot be included in the official 533533+ separate module only (released under GPL). It allows to use higher534534+ resolutions and framerates, but cannot be included in the official535535 Linux kernel for performance purposes.536536537537 See <file:Documentation/usb/w9968cf.txt> for more informations.538538539539 This driver uses the Video For Linux and the I2C APIs. It needs the540540 OmniVision Camera Chip support as well. You must say Y or M to541541- "Video For Linux", "I2C Support" and "OmniVision Camera Chip 541541+ "Video For Linux", "I2C Support" and "OmniVision Camera Chip542542 support" to use this driver.543543544544 To compile this driver as a module, choose M here: the···564564 depends on USB && VIDEO_DEV565565 ---help---566566 Say Y or M here if you want to use one of these Philips & OEM567567- webcams:568568- * Philips PCA645, PCA646569569- * Philips PCVC675, PCVC680, PCVC690570570- * Philips PCVC720/40, PCVC730, PCVC740, PCVC750567567+ webcams:568568+ * Philips PCA645, PCA646569569+ * Philips PCVC675, PCVC680, PCVC690570570+ * Philips PCVC720/40, PCVC730, PCVC740, PCVC750571571 * Askey VC010572572- * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' 573573- and 'Orbit'/'Sphere'574574- * Samsung MPC-C10, MPC-C30572572+ * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro'573573+ and 'Orbit'/'Sphere'574574+ * Samsung MPC-C10, MPC-C30575575 * Creative Webcam 5, Pro Ex576576 * SOTEC Afina Eye577577 * Visionite VCS-UC300, VCS-UM100578578-578578+579579 The PCA635, PCVC665 and PCVC720/20 are not supported by this driver580580- and never will be, but the 665 and 720/20 are supported by other 580580+ and never will be, but the 665 and 720/20 are supported by other581581 drivers.582582583583 See <file:Documentation/usb/philips.txt> for more information and
···11-/* 11+/*22 * adv7175 - adv7175a video encoder driver version 0.0.333 *44 * Copyright (C) 1998 Dave Perks <dperks@ibm.net>···233233 sizeof(init_common));234234 adv7175_write(client, 0x07, TR0MODE | TR0RST);235235 adv7175_write(client, 0x07, TR0MODE);236236- break;236236+ break;237237238238 case ENCODER_GET_CAPABILITIES:239239 {···399399};400400401401static unsigned short ignore = I2C_CLIENT_END;402402-402402+403403static struct i2c_client_address_data addr_data = {404404 .normal_i2c = normal_i2c,405405 .probe = &ignore,
+27-27
drivers/media/video/arv.c
···161161{162162 int i;163163164164- /* Slave Address */165165- ar_outl(addr, PLDI2CDATA);164164+ /* Slave Address */165165+ ar_outl(addr, PLDI2CDATA);166166 wait_for_vsync();167167168168- /* Start */169169- ar_outl(1, PLDI2CCND);168168+ /* Start */169169+ ar_outl(1, PLDI2CCND);170170 wait_acknowledge();171171172172 /* Transfer data 1 */173173- ar_outl(data1, PLDI2CDATA);173173+ ar_outl(data1, PLDI2CDATA);174174 wait_for_vsync();175175- ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);175175+ ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);176176 wait_acknowledge();177177178178 /* Transfer data 2 */179179- ar_outl(data2, PLDI2CDATA);179179+ ar_outl(data2, PLDI2CDATA);180180 wait_for_vsync();181181- ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);181181+ ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);182182 wait_acknowledge();183183184184 if (n == 3) {185185 /* Transfer data 3 */186186- ar_outl(data3, PLDI2CDATA);186186+ ar_outl(data3, PLDI2CDATA);187187 wait_for_vsync();188188- ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);188188+ ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);189189 wait_acknowledge();190190- }190190+ }191191192192- /* Stop */192192+ /* Stop */193193 for (i = 0; i < 100; i++)194194 cpu_relax();195195- ar_outl(2, PLDI2CCND);196196- ar_outl(2, PLDI2CCND);195195+ ar_outl(2, PLDI2CCND);196196+ ar_outl(2, PLDI2CCND);197197198198 while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB)199199 cpu_relax();···204204{205205 DEBUG(1, "init_iic:\n");206206207207- /*207207+ /*208208 * ICU Setting (iic)209209 */210210- /* I2C Setting */211211- ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */212212- ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */213213- ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */210210+ /* I2C Setting */211211+ ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */212212+ ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */213213+ ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */214214215215 /* I2C CLK */216216- /* 50MH-100k */216216+ /* 50MH-100k */217217 if (freq == 75) {218218- ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */218218+ ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */219219 } else if (freq == 50) {220220 ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */221221 } else {222222 ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */223223 }224224- ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */224224+ ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */225225}226226227227/**************************************************************************···253253254254 /*255255 * check HCOUNT because we cannot check vertical sync.256256- */256256+ */257257 for (; tmout >= 0; tmout--) {258258 l = ar_inl(ARVHCOUNT);259259 if (l == exp_line)···562562 /* operations for interlace mode */563563 if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */564564 line_number = (line_count << 1);565565- else /* odd line */566566- line_number =565565+ else /* odd line */566566+ line_number =567567 (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1);568568 } else {569569 line_number = line_count;···651651 cr |= ARVCR1_NORMAL;652652 ar_outl(cr, ARVCR1);653653654654- /*654654+ /*655655 * Initialize IIC so that CPU can communicate with AR LSI,656656 * and send boot commands to AR LSI.657657 */···846846 * so register video device as a frame grabber type.847847 * device is named "video[0-64]".848848 * video_register_device() initializes h/w using ar_initialize().849849- */849849+ */850850 if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) {851851 /* return -1, -ENFILE(full) or others */852852 printk("arv: register video (Colour AR) failed.\n");
+5-5
drivers/media/video/bt819.c
···11-/* 11+/*22 * bt819 - BT819A VideoStream Decoder (Rockwell Part)33 *44 * Copyright (C) 1999 Mike Bernson <mike@mlb.org>···66 *77 * Modifications for LML33/DC10plus unified driver88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99- * 99+ *1010 * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>1111 * - moved over to linux>=2.4.x i2c protocol (9/9/2002)1212 *···206206 Bug in the bt819 stepping on my board?207207 */208208 0x14, 0x00, /* 0x14 Vertial Scaling lsb */209209- 0x16, 0x07, /* 0x16 Video Timing Polarity 209209+ 0x16, 0x07, /* 0x16 Video Timing Polarity210210 ACTIVE=active low211211- FIELD: high=odd, 211211+ FIELD: high=odd,212212 vreset=active high,213213 hreset=active high */214214 0x18, 0x68, /* 0x18 AGC Delay */···497497};498498499499static unsigned short ignore = I2C_CLIENT_END;500500-500500+501501static struct i2c_client_address_data addr_data = {502502 .normal_i2c = normal_i2c,503503 .probe = &ignore,
+2-2
drivers/media/video/bt856.c
···11-/* 11+/*22 * bt856 - BT856A Digital Video Encoder (Rockwell Part)33 *44 * Copyright (C) 1999 Mike Bernson <mike@mlb.org>···285285static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END };286286287287static unsigned short ignore = I2C_CLIENT_END;288288-288288+289289static struct i2c_client_address_data addr_data = {290290 .normal_i2c = normal_i2c,291291 .probe = &ignore,
+53-53
drivers/media/video/bw-qcam.c
···150150static struct qcam_device *qcam_init(struct parport *port)151151{152152 struct qcam_device *q;153153-153153+154154 q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);155155 if(q==NULL)156156 return NULL;···158158 q->pport = port;159159 q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL,160160 NULL, 0, NULL);161161- if (q->pdev == NULL) 161161+ if (q->pdev == NULL)162162 {163163 printk(KERN_ERR "bw-qcam: couldn't register for %s.\n",164164 port->name);165165 kfree(q);166166 return NULL;167167 }168168-168168+169169 memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));170170-170170+171171 mutex_init(&q->lock);172172173173 q->port_mode = (QC_ANY | QC_NOTSET);···236236 while (!((status = read_lpstatus(q)) & 8))237237 {238238 /* 1000 is enough spins on the I/O for all normal239239- cases, at that point we start to poll slowly 239239+ cases, at that point we start to poll slowly240240 until the camera wakes up. However, we are241241 busy blocked until the camera responds, so242242 setting it lower is much better for interactive243243 response. */244244-244244+245245 if(runs++>maxpoll)246246 {247247 msleep_interruptible(5);···255255 while (((status = read_lpstatus(q)) & 8))256256 {257257 /* 1000 is enough spins on the I/O for all normal258258- cases, at that point we start to poll slowly 258258+ cases, at that point we start to poll slowly259259 until the camera wakes up. However, we are260260 busy blocked until the camera responds, so261261 setting it lower is much better for interactive262262 response. */263263-263263+264264 if(runs++>maxpoll)265265 {266266 msleep_interruptible(5);···282282{283283 unsigned int status;284284 int runs=0;285285-286286- do 285285+286286+ do287287 {288288 status = read_lpdata(q);289289 /* 1000 is enough spins on the I/O for all normal290290- cases, at that point we start to poll slowly 290290+ cases, at that point we start to poll slowly291291 until the camera wakes up. However, we are292292 busy blocked until the camera responds, so293293 setting it lower is much better for interactive294294 response. */295295-295295+296296 if(runs++>maxpoll)297297 {298298 msleep_interruptible(5);···321321322322 lastreg = reg = read_lpstatus(q) & 0xf0;323323324324- for (i = 0; i < 500; i++) 324324+ for (i = 0; i < 500; i++)325325 {326326 reg = read_lpstatus(q) & 0xf0;327327 if (reg != lastreg)···357357358358static void qc_reset(struct qcam_device *q)359359{360360- switch (q->port_mode & QC_FORCE_MASK) 360360+ switch (q->port_mode & QC_FORCE_MASK)361361 {362362 case QC_FORCE_UNIDIR:363363 q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;···370370 case QC_ANY:371371 write_lpcontrol(q, 0x20);372372 write_lpdata(q, 0x75);373373-373373+374374 if (read_lpdata(q) != 0x75) {375375 q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;376376 } else {···398398static int qc_setscanmode(struct qcam_device *q)399399{400400 int old_mode = q->mode;401401-402402- switch (q->transfer_scale) 401401+402402+ switch (q->transfer_scale)403403 {404404 case 1:405405 q->mode = 0;···412412 break;413413 }414414415415- switch (q->bpp) 415415+ switch (q->bpp)416416 {417417 case 4:418418 break;···421421 break;422422 }423423424424- switch (q->port_mode & QC_MODE_MASK) 424424+ switch (q->port_mode & QC_MODE_MASK)425425 {426426 case QC_BIDIR:427427 q->mode += 1;···430430 case QC_UNIDIR:431431 break;432432 }433433-433433+434434 if (q->mode != old_mode)435435 q->status |= QC_PARAM_CHANGE;436436-436436+437437 return 0;438438}439439···451451 /* Set the brightness. Yes, this is repetitive, but it works.452452 * Shorter versions seem to fail subtly. Feel free to try :-). */453453 /* I think the problem was in qc_command, not here -- bls */454454-454454+455455 qc_command(q, 0xb);456456 qc_command(q, q->brightness);457457···502502 unsigned int hi2, lo2;503503 static int state = 0;504504505505- if (buffer == NULL) 505505+ if (buffer == NULL)506506 {507507 state = 0;508508 return 0;509509 }510510-511511- switch (q->port_mode & QC_MODE_MASK) 510510+511511+ switch (q->port_mode & QC_MODE_MASK)512512 {513513 case QC_BIDIR: /* Bi-directional Port */514514 write_lpcontrol(q, 0x26);···517517 write_lpcontrol(q, 0x2e);518518 lo2 = (qc_waithand2(q, 0) >> 1);519519 hi2 = (read_lpstatus(q) >> 3) & 0x1f;520520- switch (q->bpp) 520520+ switch (q->bpp)521521 {522522 case 4:523523 buffer[0] = lo & 0xf;···544544 write_lpcontrol(q, 0xe);545545 hi = (qc_waithand(q, 0) & 0xf0) >> 4;546546547547- switch (q->bpp) 547547+ switch (q->bpp)548548 {549549 case 4:550550 buffer[0] = lo;···552552 ret = 2;553553 break;554554 case 6:555555- switch (state) 555555+ switch (state)556556 {557557 case 0:558558 buffer[0] = (lo << 2) | ((hi & 0xc) >> 2);···604604 int shift=8-q->bpp;605605 char invert;606606607607- if (q->mode == -1) 607607+ if (q->mode == -1)608608 return -ENXIO;609609610610 qc_command(q, 0x7);611611 qc_command(q, q->mode);612612613613- if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) 613613+ if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)614614 {615615 write_lpcontrol(q, 0x2e); /* turn port around */616616 write_lpcontrol(q, 0x26);···618618 write_lpcontrol(q, 0x2e);619619 (void) qc_waithand(q, 0);620620 }621621-621621+622622 /* strange -- should be 15:63 below, but 4bpp is odd */623623 invert = (q->bpp == 4) ? 16 : 63;624624···629629 q->transfer_scale;630630 transperline = (transperline + divisor - 1) / divisor;631631632632- for (i = 0, yield = yieldlines; i < linestotrans; i++) 632632+ for (i = 0, yield = yieldlines; i < linestotrans; i++)633633 {634634- for (pixels_read = j = 0; j < transperline; j++) 634634+ for (pixels_read = j = 0; j < transperline; j++)635635 {636636 bytes = qc_readbytes(q, buffer);637637- for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) 637637+ for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++)638638 {639639 int o;640640- if (buffer[k] == 0 && invert == 16) 640640+ if (buffer[k] == 0 && invert == 16)641641 {642642 /* 4bpp is odd (again) -- inverter is 16, not 15, but output643643 must be 0-15 -- bls */···653653 pixels_read += bytes;654654 }655655 (void) qc_readbytes(q, NULL); /* reset state machine */656656-656656+657657 /* Grabbing an entire frame from the quickcam is a lengthy658658 process. We don't (usually) want to busy-block the659659 processor for the entire frame. yieldlines is a module···666666 }667667 }668668669669- if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) 669669+ if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)670670 {671671 write_lpcontrol(q, 2);672672 write_lpcontrol(q, 6);···687687{688688 struct video_device *dev = video_devdata(file);689689 struct qcam_device *qcam=(struct qcam_device *)dev;690690-690690+691691 switch(cmd)692692 {693693 case VIDIOCGCAP:···762762 return -EINVAL;763763 if(p->depth!=4 && p->depth!=6)764764 return -EINVAL;765765-765765+766766 /*767767 * Now load the camera.768768 */···790790 return -EINVAL;791791 if(vw->width<80||vw->width>320)792792 return -EINVAL;793793-793793+794794 qcam->width = 320;795795 qcam->height = 240;796796 qcam->transfer_scale = 4;797797-797797+798798 if(vw->width>=160 && vw->height>=120)799799 {800800 qcam->transfer_scale = 2;···808808 mutex_lock(&qcam->lock);809809 qc_setscanmode(qcam);810810 mutex_unlock(&qcam->lock);811811-811811+812812 /* We must update the camera before we grab. We could813813 just have changed the grab size */814814 qcam->status |= QC_PARAM_CHANGE;815815-815815+816816 /* Ok we figured out what to use from our wide choice */817817 return 0;818818 }···853853 struct qcam_device *qcam=(struct qcam_device *)v;854854 int len;855855 parport_claim_or_block(qcam->pdev);856856-856856+857857 mutex_lock(&qcam->lock);858858-858858+859859 qc_reset(qcam);860860861861 /* Update the camera parameters if we need to */···863863 qc_set(qcam);864864865865 len=qc_capture(qcam, buf,count);866866-866866+867867 mutex_unlock(&qcam->lock);868868-868868+869869 parport_release(qcam->pdev);870870 return len;871871}872872-872872+873873static struct file_operations qcam_fops = {874874 .owner = THIS_MODULE,875875 .open = video_exclusive_open,···905905 qcam=qcam_init(port);906906 if(qcam==NULL)907907 return -ENODEV;908908-908908+909909 parport_claim_or_block(qcam->pdev);910910911911 qc_reset(qcam);912912-912912+913913 if(qc_detect(qcam)==0)914914 {915915 parport_release(qcam->pdev);···920920 qc_calibrate(qcam);921921922922 parport_release(qcam->pdev);923923-923923+924924 printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name);925925-925925+926926 if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)927927 {928928 parport_unregister_device(qcam->pdev);···10131013 printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n");10141014 maxpoll = 5000;10151015 }10161016-10161016+10171017 if (yieldlines < 1) {10181018 printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n");10191019 yieldlines = 1;
+33-33
drivers/media/video/c-qcam.c
···1616 *1717 * The parport parameter controls which parports will be scanned.1818 * Scanning all parports causes some printers to print a garbage page.1919- * -- March 14, 1999 Billy Donahue <billy@escape.com> 1919+ * -- March 14, 1999 Billy Donahue <billy@escape.com>2020 *2121 * Fixed data format to BGR, added force_rgb parameter. Added missing2222 * parport_unregister_driver() on module removal.···8888 return (parport_read_data(qcam->pport) & 0x1)?1:0;8989}90909191-static unsigned int qcam_await_ready1(struct qcam_device *qcam, 9191+static unsigned int qcam_await_ready1(struct qcam_device *qcam,9292 int value)9393{9494 unsigned long oldjiffies = jiffies;···9898 if (qcam_ready1(qcam) == value)9999 return 0;100100101101- /* If the camera didn't respond within 1/25 second, poll slowly 101101+ /* If the camera didn't respond within 1/25 second, poll slowly102102 for a while. */103103 for (i = 0; i < 50; i++)104104 {···123123 if (qcam_ready2(qcam) == value)124124 return 0;125125126126- /* If the camera didn't respond within 1/25 second, poll slowly 126126+ /* If the camera didn't respond within 1/25 second, poll slowly127127 for a while. */128128 for (i = 0; i < 50; i++)129129 {···157157 unsigned int idata;158158 parport_write_data(qcam->pport, data);159159 idata = qcam_read_data(qcam);160160- if (data != idata) 160160+ if (data != idata)161161 {162162- printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, 162162+ printk(KERN_WARNING "cqcam: sent %x but received %x\n", data,163163 idata);164164 return 1;165165- } 165165+ }166166 return 0;167167}168168···193193 no device was found". Fix this one day. */194194 if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA195195 && qcam->pport->probe_info[0].model196196- && !strcmp(qcam->pdev->port->probe_info[0].model, 196196+ && !strcmp(qcam->pdev->port->probe_info[0].model,197197 "Color QuickCam 2.0")) {198198 printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n");199199 return 1;200200 }201201-201201+202202 if (probe < 2)203203 return 0;204204···206206207207 /* look for a heartbeat */208208 ostat = stat = parport_read_status(qcam->pport);209209- for (i=0; i<250; i++) 209209+ for (i=0; i<250; i++)210210 {211211 mdelay(1);212212 stat = parport_read_status(qcam->pport);213213- if (ostat != stat) 213213+ if (ostat != stat)214214 {215215 if (++count >= 3) return 1;216216 ostat = stat;···226226 count = 0;227227228228 ostat = stat = parport_read_status(qcam->pport);229229- for (i=0; i<250; i++) 229229+ for (i=0; i<250; i++)230230 {231231 mdelay(1);232232 stat = parport_read_status(qcam->pport);233233- if (ostat != stat) 233233+ if (ostat != stat)234234 {235235 if (++count >= 3) return 1;236236 ostat = stat;···247247 parport_write_control(qcam->pport, 0x8);248248 mdelay(1);249249 parport_write_control(qcam->pport, 0xc);250250- mdelay(1); 250250+ mdelay(1);251251}252252253253/* Reset the QuickCam and program for brightness, contrast,···258258 qc_reset(q);259259260260 /* Set the brightness. */261261- qcam_set(q, 11, q->brightness);261261+ qcam_set(q, 11, q->brightness);262262263263 /* Set the height and width. These refer to the actual264264 CCD area *before* applying the selected decimation. */···272272 /* Set contrast and white balance. */273273 qcam_set(q, 0x19, q->contrast);274274 qcam_set(q, 0x1f, q->whitebal);275275-275275+276276 /* Set the speed. */277277 qcam_set(q, 45, 2);278278}279279280280-/* Read some bytes from the camera and put them in the buffer. 280280+/* Read some bytes from the camera and put them in the buffer.281281 nbytes should be a multiple of 3, because bidirectional mode gives282282 us three bytes at a time. */283283···383383384384 if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1))385385 return -EIO;386386-386386+387387 lines = q->height;388388 pixelsperline = q->width;389389 bitsperxfer = (is_bi_dir) ? 24 : 8;···499499{500500 struct video_device *dev = video_devdata(file);501501 struct qcam_device *qcam=(struct qcam_device *)dev;502502-502502+503503 switch(cmd)504504 {505505 case VIDIOCGCAP:···574574 */575575 if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24)576576 return -EINVAL;577577-577577+578578 /*579579 * Now load the camera.580580 */···584584585585 mutex_lock(&qcam->lock);586586 parport_claim_or_block(qcam->pdev);587587- qc_setup(qcam); 587587+ qc_setup(qcam);588588 parport_release(qcam->pdev);589589 mutex_unlock(&qcam->lock);590590 return 0;···601601 return -EINVAL;602602 if(vw->width<80||vw->width>320)603603 return -EINVAL;604604-604604+605605 qcam->width = 80;606606 qcam->height = 60;607607 qcam->mode = QC_DECIMATION_4;608608-608608+609609 if(vw->width>=160 && vw->height>=120)610610 {611611 qcam->width = 160;···627627 qcam->mode = QC_BILLIONS | QC_DECIMATION_1;628628 }629629#endif630630- /* Ok we figured out what to use from our 630630+ /* Ok we figured out what to use from our631631 wide choice */632632 mutex_lock(&qcam->lock);633633 parport_claim_or_block(qcam->pdev);···676676 mutex_lock(&qcam->lock);677677 parport_claim_or_block(qcam->pdev);678678 /* Probably should have a semaphore against multiple users */679679- len = qc_capture(qcam, buf,count); 679679+ len = qc_capture(qcam, buf,count);680680 parport_release(qcam->pdev);681681 mutex_unlock(&qcam->lock);682682 return len;···707707static struct qcam_device *qcam_init(struct parport *port)708708{709709 struct qcam_device *q;710710-710710+711711 q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);712712 if(q==NULL)713713 return NULL;···718718719719 q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0;720720721721- if (q->pdev == NULL) 721721+ if (q->pdev == NULL)722722 {723723 printk(KERN_ERR "c-qcam: couldn't register for %s.\n",724724 port->name);725725 kfree(q);726726 return NULL;727727 }728728-728728+729729 memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));730730731731 mutex_init(&q->lock);···766766 qcam = qcam_init(port);767767 if (qcam==NULL)768768 return -ENODEV;769769-769769+770770 parport_claim_or_block(qcam->pdev);771771772772 qc_reset(qcam);773773-773773+774774 if (probe && qc_detect(qcam)==0)775775 {776776 parport_release(qcam->pdev);···782782 qc_setup(qcam);783783784784 parport_release(qcam->pdev);785785-785785+786786 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)787787 {788788 printk(KERN_ERR "Unable to register Colour QuickCam on %s\n",···792792 return -ENODEV;793793 }794794795795- printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", 795795+ printk(KERN_INFO "video%d: Colour QuickCam found on %s\n",796796 qcam->vdev.minor, qcam->pport->name);797797-797797+798798 qcams[num_cams++] = qcam;799799800800 return 0;
+328-328
drivers/media/video/cpia.c
···2424 */25252626/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */2727-/* #define _CPIA_DEBUG_ 1 */ 2727+/* #define _CPIA_DEBUG_ 1 */28282929#include <linux/config.h>3030···6767static unsigned short colorspace_conv = 0;6868module_param(colorspace_conv, ushort, 0444);6969MODULE_PARM_DESC(colorspace_conv,7070- "\n<n> Colorspace conversion:"7171- "\n0 = disable"7272- "\n1 = enable"7373- "\nDefault value is 0"7474- "\n");7070+ "\n<n> Colorspace conversion:"7171+ "\n0 = disable"7272+ "\n1 = enable"7373+ "\nDefault value is 0"7474+ "\n");75757676#define ABOUT "V4L-Driver for Vision CPiA based cameras"7777···189189#define TC 94190190#define EXP_ACC_DARK 50191191#define EXP_ACC_LIGHT 90192192-#define HIGH_COMP_102 160 193193-#define MAX_COMP 239 192192+#define HIGH_COMP_102 160193193+#define MAX_COMP 239194194#define DARK_TIME 3195195#define LIGHT_TIME 3196196···208208static void reset_camera_struct(struct cam_data *cam);209209static int find_over_exposure(int brightness);210210static void set_flicker(struct cam_params *params, volatile u32 *command_flags,211211- int on);211211+ int on);212212213213214214/**********************************************************************···262262static struct proc_dir_entry *cpia_proc_root=NULL;263263264264static int cpia_read_proc(char *page, char **start, off_t off,265265- int count, int *eof, void *data)265265+ int count, int *eof, void *data)266266{267267 char *out = page;268268 int len, tmp;···276276 out += sprintf(out, "V4L Driver version: %d.%d.%d\n",277277 CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER);278278 out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n",279279- cam->params.version.firmwareVersion,280280- cam->params.version.firmwareRevision,281281- cam->params.version.vcVersion,282282- cam->params.version.vcRevision);279279+ cam->params.version.firmwareVersion,280280+ cam->params.version.firmwareRevision,281281+ cam->params.version.vcVersion,282282+ cam->params.version.vcRevision);283283 out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n",284284- cam->params.pnpID.vendor, cam->params.pnpID.product,285285- cam->params.pnpID.deviceRevision);284284+ cam->params.pnpID.vendor, cam->params.pnpID.product,285285+ cam->params.pnpID.deviceRevision);286286 out += sprintf(out, "VP-Version: %d.%d %04x\n",287287- cam->params.vpVersion.vpVersion,288288- cam->params.vpVersion.vpRevision,289289- cam->params.vpVersion.cameraHeadID);290290-287287+ cam->params.vpVersion.vpVersion,288288+ cam->params.vpVersion.vpRevision,289289+ cam->params.vpVersion.cameraHeadID);290290+291291 out += sprintf(out, "system_state: %#04x\n",292292- cam->params.status.systemState);292292+ cam->params.status.systemState);293293 out += sprintf(out, "grab_state: %#04x\n",294294- cam->params.status.grabState);294294+ cam->params.status.grabState);295295 out += sprintf(out, "stream_state: %#04x\n",296296- cam->params.status.streamState);296296+ cam->params.status.streamState);297297 out += sprintf(out, "fatal_error: %#04x\n",298298- cam->params.status.fatalError);298298+ cam->params.status.fatalError);299299 out += sprintf(out, "cmd_error: %#04x\n",300300- cam->params.status.cmdError);300300+ cam->params.status.cmdError);301301 out += sprintf(out, "debug_flags: %#04x\n",302302- cam->params.status.debugFlags);302302+ cam->params.status.debugFlags);303303 out += sprintf(out, "vp_status: %#04x\n",304304- cam->params.status.vpStatus);304304+ cam->params.status.vpStatus);305305 out += sprintf(out, "error_code: %#04x\n",306306- cam->params.status.errorCode);306306+ cam->params.status.errorCode);307307 /* QX3 specific entries */308308 if (cam->params.qx3.qx3_detected) {309309 out += sprintf(out, "button: %4d\n",310310- cam->params.qx3.button);310310+ cam->params.qx3.button);311311 out += sprintf(out, "cradled: %4d\n",312312- cam->params.qx3.cradled);312312+ cam->params.qx3.cradled);313313 }314314 out += sprintf(out, "video_size: %s\n",315315- cam->params.format.videoSize == VIDEOSIZE_CIF ?315315+ cam->params.format.videoSize == VIDEOSIZE_CIF ?316316 "CIF " : "QCIF");317317 out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n",318318- cam->params.roi.colStart*8,319319- cam->params.roi.rowStart*4,320320- cam->params.roi.colEnd*8,321321- cam->params.roi.rowEnd*4);318318+ cam->params.roi.colStart*8,319319+ cam->params.roi.rowStart*4,320320+ cam->params.roi.colEnd*8,321321+ cam->params.roi.rowEnd*4);322322 out += sprintf(out, "actual_fps: %3d\n", cam->fps);323323 out += sprintf(out, "transfer_rate: %4dkB/s\n",324324- cam->transfer_rate);325325-324324+ cam->transfer_rate);325325+326326 out += sprintf(out, "\nread-write\n");327327 out += sprintf(out, "----------------------- current min"328328- " max default comment\n");328328+ " max default comment\n");329329 out += sprintf(out, "brightness: %8d %8d %8d %8d\n",330330- cam->params.colourParams.brightness, 0, 100, 50);330330+ cam->params.colourParams.brightness, 0, 100, 50);331331 if (cam->params.version.firmwareVersion == 1 &&332332 cam->params.version.firmwareRevision == 2)333333 /* 1-02 firmware limits contrast to 80 */···336336 tmp = 96;337337338338 out += sprintf(out, "contrast: %8d %8d %8d %8d"339339- " steps of 8\n",340340- cam->params.colourParams.contrast, 0, tmp, 48);339339+ " steps of 8\n",340340+ cam->params.colourParams.contrast, 0, tmp, 48);341341 out += sprintf(out, "saturation: %8d %8d %8d %8d\n",342342- cam->params.colourParams.saturation, 0, 100, 50);342342+ cam->params.colourParams.saturation, 0, 100, 50);343343 tmp = (25000+5000*cam->params.sensorFps.baserate)/344344 (1<<cam->params.sensorFps.divisor);345345 out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n",346346- tmp/1000, tmp%1000, 3, 30, 15);346346+ tmp/1000, tmp%1000, 3, 30, 15);347347 out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n",348348- 2*cam->params.streamStartLine, 0,348348+ 2*cam->params.streamStartLine, 0,349349 cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144,350350 cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120);351351 out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n",352352- cam->params.format.subSample == SUBSAMPLE_420 ?352352+ cam->params.format.subSample == SUBSAMPLE_420 ?353353 "420" : "422", "420", "422", "422");354354 out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n",355355- cam->params.format.yuvOrder == YUVORDER_YUYV ?355355+ cam->params.format.yuvOrder == YUVORDER_YUYV ?356356 "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV");357357 out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n",358358- cam->params.ecpTiming ? "slow" : "normal", "slow",358358+ cam->params.ecpTiming ? "slow" : "normal", "slow",359359 "normal", "normal");360360361361 if (cam->params.colourBalance.balanceMode == 2) {···366366 out += sprintf(out, "color_balance_mode: %8s %8s %8s"367367 " %8s\n", tmpstr, "manual", "auto", "auto");368368 out += sprintf(out, "red_gain: %8d %8d %8d %8d\n",369369- cam->params.colourBalance.redGain, 0, 212, 32);369369+ cam->params.colourBalance.redGain, 0, 212, 32);370370 out += sprintf(out, "green_gain: %8d %8d %8d %8d\n",371371- cam->params.colourBalance.greenGain, 0, 212, 6);371371+ cam->params.colourBalance.greenGain, 0, 212, 6);372372 out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n",373373- cam->params.colourBalance.blueGain, 0, 212, 92);373373+ cam->params.colourBalance.blueGain, 0, 212, 92);374374375375 if (cam->params.version.firmwareVersion == 1 &&376376 cam->params.version.firmwareRevision == 2)···381381382382 if (cam->params.exposure.gainMode == 0)383383 out += sprintf(out, "max_gain: unknown %28s"384384- " powers of 2\n", tmpstr); 384384+ " powers of 2\n", tmpstr);385385 else386386 out += sprintf(out, "max_gain: %8d %28s"387387 " 1,2,4 or 8 \n",388388- 1<<(cam->params.exposure.gainMode-1), tmpstr);388388+ 1<<(cam->params.exposure.gainMode-1), tmpstr);389389390390 switch(cam->params.exposure.expMode) {391391 case 1:···402402 out += sprintf(out, "exposure_mode: %8s %8s %8s"403403 " %8s\n", tmpstr, "manual", "auto", "auto");404404 out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n",405405- (2-cam->params.exposure.centreWeight) ? "on" : "off",406406- "off", "on", "on");405405+ (2-cam->params.exposure.centreWeight) ? "on" : "off",406406+ "off", "on", "on");407407 out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n",408408- 1<<cam->params.exposure.gain, 1, 1);408408+ 1<<cam->params.exposure.gain, 1, 1);409409 if (cam->params.version.firmwareVersion == 1 &&410410 cam->params.version.firmwareRevision == 2)411411 /* 1-02 firmware limits fineExp/2 to 127 */···414414 tmp = 510;415415416416 out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n",417417- cam->params.exposure.fineExp*2, 0, tmp, 0);417417+ cam->params.exposure.fineExp*2, 0, tmp, 0);418418 if (cam->params.version.firmwareVersion == 1 &&419419 cam->params.version.firmwareRevision == 2)420420 /* 1-02 firmware limits coarseExpHi to 0 */···426426 " %8d\n", cam->params.exposure.coarseExpLo+427427 256*cam->params.exposure.coarseExpHi, 0, tmp, 185);428428 out += sprintf(out, "red_comp: %8d %8d %8d %8d\n",429429- cam->params.exposure.redComp, COMP_RED, 255, COMP_RED);429429+ cam->params.exposure.redComp, COMP_RED, 255, COMP_RED);430430 out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n",431431- cam->params.exposure.green1Comp, COMP_GREEN1, 255,431431+ cam->params.exposure.green1Comp, COMP_GREEN1, 255,432432 COMP_GREEN1);433433 out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n",434434- cam->params.exposure.green2Comp, COMP_GREEN2, 255,434434+ cam->params.exposure.green2Comp, COMP_GREEN2, 255,435435 COMP_GREEN2);436436 out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n",437437- cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE);438438-437437+ cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE);438438+439439 out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n",440440- cam->params.apcor.gain1, 0, 0xff, 0x1c);440440+ cam->params.apcor.gain1, 0, 0xff, 0x1c);441441 out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n",442442- cam->params.apcor.gain2, 0, 0xff, 0x1a);442442+ cam->params.apcor.gain2, 0, 0xff, 0x1a);443443 out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n",444444- cam->params.apcor.gain4, 0, 0xff, 0x2d);444444+ cam->params.apcor.gain4, 0, 0xff, 0x2d);445445 out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n",446446- cam->params.apcor.gain8, 0, 0xff, 0x2a);446446+ cam->params.apcor.gain8, 0, 0xff, 0x2a);447447 out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n",448448- cam->params.vlOffset.gain1, 0, 255, 24);448448+ cam->params.vlOffset.gain1, 0, 255, 24);449449 out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n",450450- cam->params.vlOffset.gain2, 0, 255, 28);450450+ cam->params.vlOffset.gain2, 0, 255, 28);451451 out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n",452452- cam->params.vlOffset.gain4, 0, 255, 30);452452+ cam->params.vlOffset.gain4, 0, 255, 30);453453 out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n",454454- cam->params.vlOffset.gain8, 0, 255, 30);454454+ cam->params.vlOffset.gain8, 0, 255, 30);455455 out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n",456456- cam->params.flickerControl.flickerMode ? "on" : "off",456456+ cam->params.flickerControl.flickerMode ? "on" : "off",457457 "off", "on", "off");458458 out += sprintf(out, "mains_frequency: %8d %8d %8d %8d"459459- " only 50/60\n",460460- cam->mainsFreq ? 60 : 50, 50, 60, 50);459459+ " only 50/60\n",460460+ cam->mainsFreq ? 60 : 50, 50, 60, 50);461461 if(cam->params.flickerControl.allowableOverExposure < 0)462462 out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n",463463- -cam->params.flickerControl.allowableOverExposure,464464- 255);463463+ -cam->params.flickerControl.allowableOverExposure,464464+ 255);465465 else466466 out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n",467467- cam->params.flickerControl.allowableOverExposure,468468- 255);467467+ cam->params.flickerControl.allowableOverExposure,468468+ 255);469469 out += sprintf(out, "compression_mode: ");470470 switch(cam->params.compression.mode) {471471 case CPIA_COMPRESSION_NONE:···483483 }484484 out += sprintf(out, " none,auto,manual auto\n");485485 out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n",486486- cam->params.compression.decimation ==487487- DECIMATION_ENAB ? "on":"off", "off", "on", 486486+ cam->params.compression.decimation ==487487+ DECIMATION_ENAB ? "on":"off", "off", "on",488488 "off");489489 out += sprintf(out, "compression_target: %9s %9s %9s %9s\n",490490- cam->params.compressionTarget.frTargeting == 490490+ cam->params.compressionTarget.frTargeting ==491491 CPIA_COMPRESSION_TARGET_FRAMERATE ?492492 "framerate":"quality",493493 "framerate", "quality", "quality");494494 out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n",495495- cam->params.compressionTarget.targetFR, 1, 30, 15);495495+ cam->params.compressionTarget.targetFR, 1, 30, 15);496496 out += sprintf(out, "target_quality: %8d %8d %8d %8d\n",497497- cam->params.compressionTarget.targetQ, 1, 64, 5);497497+ cam->params.compressionTarget.targetQ, 1, 64, 5);498498 out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n",499499- cam->params.yuvThreshold.yThreshold, 0, 31, 6);499499+ cam->params.yuvThreshold.yThreshold, 0, 31, 6);500500 out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n",501501- cam->params.yuvThreshold.uvThreshold, 0, 31, 6);501501+ cam->params.yuvThreshold.uvThreshold, 0, 31, 6);502502 out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n",503503- cam->params.compressionParams.hysteresis, 0, 255, 3);503503+ cam->params.compressionParams.hysteresis, 0, 255, 3);504504 out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n",505505- cam->params.compressionParams.threshMax, 0, 255, 11);505505+ cam->params.compressionParams.threshMax, 0, 255, 11);506506 out += sprintf(out, "small_step: %8d %8d %8d %8d\n",507507- cam->params.compressionParams.smallStep, 0, 255, 1);507507+ cam->params.compressionParams.smallStep, 0, 255, 1);508508 out += sprintf(out, "large_step: %8d %8d %8d %8d\n",509509- cam->params.compressionParams.largeStep, 0, 255, 3);509509+ cam->params.compressionParams.largeStep, 0, 255, 3);510510 out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n",511511- cam->params.compressionParams.decimationHysteresis,511511+ cam->params.compressionParams.decimationHysteresis,512512 0, 255, 2);513513 out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n",514514- cam->params.compressionParams.frDiffStepThresh,514514+ cam->params.compressionParams.frDiffStepThresh,515515 0, 255, 5);516516 out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n",517517- cam->params.compressionParams.qDiffStepThresh,517517+ cam->params.compressionParams.qDiffStepThresh,518518 0, 255, 3);519519 out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n",520520- cam->params.compressionParams.decimationThreshMod,520520+ cam->params.compressionParams.decimationThreshMod,521521 0, 255, 2);522522 /* QX3 specific entries */523523 if (cam->params.qx3.qx3_detected) {524524- out += sprintf(out, "toplight: %8s %8s %8s %8s\n", 525525- cam->params.qx3.toplight ? "on" : "off",524524+ out += sprintf(out, "toplight: %8s %8s %8s %8s\n",525525+ cam->params.qx3.toplight ? "on" : "off",526526 "off", "on", "off");527527- out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", 528528- cam->params.qx3.bottomlight ? "on" : "off",527527+ out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n",528528+ cam->params.qx3.bottomlight ? "on" : "off",529529 "off", "on", "off");530530 }531531-531531+532532 len = out - page;533533 len -= off;534534 if (len < count) {···543543544544545545static int match(char *checkstr, char **buffer, unsigned long *count,546546- int *find_colon, int *err)546546+ int *find_colon, int *err)547547{548548 int ret, colon_found = 1;549549 int len = strlen(checkstr);···583583}584584585585static int cpia_write_proc(struct file *file, const char __user *buf,586586- unsigned long count, void *data)586586+ unsigned long count, void *data)587587{588588 struct cam_data *cam = data;589589 struct cam_params new_params;···619619 retval = -EINVAL;620620 goto out;621621 }622622-622622+623623 buffer = page;624624-624624+625625 if (mutex_lock_interruptible(&cam->param_lock))626626 return -ERESTARTSYS;627627-627627+628628 /*629629 * Skip over leading whitespace630630 */···632632 --count;633633 ++buffer;634634 }635635-635635+636636 memcpy(&new_params, &cam->params, sizeof(struct cam_params));637637 new_mains = cam->mainsFreq;638638-638638+639639#define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval))640640#define VALUE (value(&buffer,&count, &retval))641641#define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \642642- new_params.version.firmwareRevision == (y))643643-642642+ new_params.version.firmwareRevision == (y))643643+644644 retval = 0;645645 while (count && !retval) {646646 find_colon = 1;···656656 }657657 command_flags |= COMMAND_SETCOLOURPARAMS;658658 if(new_params.flickerControl.allowableOverExposure < 0)659659- new_params.flickerControl.allowableOverExposure = 659659+ new_params.flickerControl.allowableOverExposure =660660 -find_over_exposure(new_params.colourParams.brightness);661661 if(new_params.flickerControl.flickerMode != 0)662662 command_flags |= COMMAND_SETFLICKERCTRL;···721721 /* Either base rate would work here */722722 new_params.sensorFps.baserate = 1;723723 }724724- new_params.flickerControl.coarseJump = 724724+ new_params.flickerControl.coarseJump =725725 flicker_jumps[new_mains]726726 [new_params.sensorFps.baserate]727727 [new_params.sensorFps.divisor];···10851085 } else if (MATCH("mains_frequency")) {10861086 if (!retval && MATCH("50")) {10871087 new_mains = 0;10881088- new_params.flickerControl.coarseJump = 10881088+ new_params.flickerControl.coarseJump =10891089 flicker_jumps[new_mains]10901090 [new_params.sensorFps.baserate]10911091 [new_params.sensorFps.divisor];···10931093 command_flags |= COMMAND_SETFLICKERCTRL;10941094 } else if (!retval && MATCH("60")) {10951095 new_mains = 1;10961096- new_params.flickerControl.coarseJump = 10961096+ new_params.flickerControl.coarseJump =10971097 flicker_jumps[new_mains]10981098 [new_params.sensorFps.baserate]10991099 [new_params.sensorFps.divisor];···11031103 retval = -EINVAL;11041104 } else if (MATCH("allowable_overexposure")) {11051105 if (!retval && MATCH("auto")) {11061106- new_params.flickerControl.allowableOverExposure = 11061106+ new_params.flickerControl.allowableOverExposure =11071107 -find_over_exposure(new_params.colourParams.brightness);11081108 if(new_params.flickerControl.flickerMode != 0)11091109 command_flags |= COMMAND_SETFLICKERCTRL;···11461146 command_flags |= COMMAND_SETCOMPRESSION;11471147 } else if (MATCH("compression_target")) {11481148 if (!retval && MATCH("quality"))11491149- new_params.compressionTarget.frTargeting = 11491149+ new_params.compressionTarget.frTargeting =11501150 CPIA_COMPRESSION_TARGET_QUALITY;11511151 else if (!retval && MATCH("framerate"))11521152- new_params.compressionTarget.frTargeting = 11521152+ new_params.compressionTarget.frTargeting =11531153 CPIA_COMPRESSION_TARGET_FRAMERATE;11541154 else11551155 retval = -EINVAL;···11731173 if (!retval) {11741174 if(val > 0 && val <= 64)11751175 new_params.compressionTarget.targetQ = val;11761176- else 11761176+ else11771177 retval = -EINVAL;11781178 }11791179 command_flags |= COMMAND_SETCOMPRESSIONTARGET;···12881288 }12891289 command_flags |= COMMAND_SETCOMPRESSIONPARAMS;12901290 } else if (MATCH("toplight")) {12911291- if (!retval && MATCH("on"))12911291+ if (!retval && MATCH("on"))12921292 new_params.qx3.toplight = 1;12931293 else if (!retval && MATCH("off"))12941294 new_params.qx3.toplight = 0;12951295- else 12951295+ else12961296 retval = -EINVAL;12971297 command_flags |= COMMAND_SETLIGHTS;12981298 } else if (MATCH("bottomlight")) {12991299- if (!retval && MATCH("on"))12991299+ if (!retval && MATCH("on"))13001300 new_params.qx3.bottomlight = 1;13011301- else if (!retval && MATCH("off")) 13011301+ else if (!retval && MATCH("off"))13021302 new_params.qx3.bottomlight = 0;13031303- else 13031303+ else13041304 retval = -EINVAL;13051305 command_flags |= COMMAND_SETLIGHTS;13061306 } else {···13261326 }13271327 }13281328 }13291329-#undef MATCH 13291329+#undef MATCH13301330#undef VALUE13311331#undef FIRMWARE_VERSION13321332 if (!retval) {···13491349 retval = size;13501350 } else13511351 DBG("error: %d\n", retval);13521352-13521352+13531353 mutex_unlock(&cam->param_lock);13541354-13541354+13551355out:13561356 free_page((unsigned long)page);13571357- return retval;13571357+ return retval;13581358}1359135913601360static void create_proc_cpia_cam(struct cam_data *cam)13611361{13621362 char name[7];13631363 struct proc_dir_entry *ent;13641364-13641364+13651365 if (!cpia_proc_root || !cam)13661366 return;1367136713681368 sprintf(name, "video%d", cam->vdev.minor);13691369-13691369+13701370 ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root);13711371 if (!ent)13721372 return;···13741374 ent->data = cam;13751375 ent->read_proc = cpia_read_proc;13761376 ent->write_proc = cpia_write_proc;13771377- /* 13771377+ /*13781378 size of the proc entry is 3736 bytes for the standard webcam;13791379- the extra features of the QX3 microscope add 189 bytes.13791379+ the extra features of the QX3 microscope add 189 bytes.13801380 (we have not yet probed the camera to see which type it is).13811381 */13821382 ent->size = 3736 + 189;···13861386static void destroy_proc_cpia_cam(struct cam_data *cam)13871387{13881388 char name[7];13891389-13891389+13901390 if (!cam || !cam->proc_entry)13911391 return;13921392-13921392+13931393 sprintf(name, "video%d", cam->vdev.minor);13941394 remove_proc_entry(name, cpia_proc_root);13951395 cam->proc_entry = NULL;···15961596 cam->vc.width = cam->vw.width;15971597 if(cam->vc.height == 0)15981598 cam->vc.height = cam->vw.height;15991599-15991599+16001600 cam->params.roi.colStart += cam->vc.x >> 3;16011601 cam->params.roi.colEnd = cam->params.roi.colStart +16021602- (cam->vc.width >> 3);16021602+ (cam->vc.width >> 3);16031603 cam->params.roi.rowStart += cam->vc.y >> 2;16041604 cam->params.roi.rowEnd = cam->params.roi.rowStart +16051605- (cam->vc.height >> 2);16051605+ (cam->vc.height >> 2);1606160616071607 return;16081608}···16241624static int free_frame_buf(struct cam_data *cam)16251625{16261626 int i;16271627-16271627+16281628 rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE);16291629 cam->frame_buf = NULL;16301630 for (i=0; i < FRAME_NUM; i++)···16671667 mutex_lock(&cam->param_lock);16681668 datasize=8;16691669 break;16701670- case CPIA_COMMAND_ReadMCPorts: 16701670+ case CPIA_COMMAND_ReadMCPorts:16711671 case CPIA_COMMAND_ReadVCRegs:16721672 datasize = 4;16731673 break;···17461746 mutex_unlock(&cam->param_lock);17471747 break;1748174817491749- case CPIA_COMMAND_ReadMCPorts: 17501750- if (!cam->params.qx3.qx3_detected) 17491749+ case CPIA_COMMAND_ReadMCPorts:17501750+ if (!cam->params.qx3.qx3_detected)17511751 break;17521752- /* test button press */ 17521752+ /* test button press */17531753 cam->params.qx3.button = ((data[1] & 0x02) == 0);17541754 if (cam->params.qx3.button) {17551755 /* button pressed - unlock the latch */···1770177017711771/* send a command to the camera with an additional data transaction */17721772static int do_command_extended(struct cam_data *cam, u16 command,17731773- u8 a, u8 b, u8 c, u8 d,17741774- u8 e, u8 f, u8 g, u8 h,17751775- u8 i, u8 j, u8 k, u8 l)17731773+ u8 a, u8 b, u8 c, u8 d,17741774+ u8 e, u8 f, u8 g, u8 h,17751775+ u8 i, u8 j, u8 k, u8 l)17761776{17771777 int retval;17781778 u8 cmd[8], data[8];···18091809#define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16)1810181018111811static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt,18121812- int linesize, int mmap_kludge)18121812+ int linesize, int mmap_kludge)18131813{18141814 int y, u, v, r, g, b, y1;18151815-18151815+18161816 /* Odd lines use the same u and v as the previous line.18171817 * Because of compression, it is necessary to get this18181818 * information from the decoded image. */···192519251926192619271927static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt,19281928- int in_uyvy, int mmap_kludge)19281928+ int in_uyvy, int mmap_kludge)19291929{19301930 int y, u, v, r, g, b, y1;19311931···20782078 mutex_unlock(&cam->param_lock);20792079 return -1;20802080 }20812081-20812081+20822082 if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) {20832083 LOG("illegal subtype %d\n",ibuf[17]);20842084 mutex_unlock(&cam->param_lock);20852085 return -1;20862086 }20872087 subsample_422 = ibuf[17] == SUBSAMPLE_422;20882088-20882088+20892089 if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) {20902090 LOG("illegal yuvorder %d\n",ibuf[18]);20912091 mutex_unlock(&cam->param_lock);20922092 return -1;20932093 }20942094 in_uyvy = ibuf[18] == YUVORDER_UYVY;20952095-20952095+20962096 if ((ibuf[24] != cam->params.roi.colStart) ||20972097 (ibuf[25] != cam->params.roi.colEnd) ||20982098 (ibuf[26] != cam->params.roi.rowStart) ||···21042104 cols = 8*(ibuf[25] - ibuf[24]);21052105 rows = 4*(ibuf[27] - ibuf[26]);2106210621072107-21072107+21082108 if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) {21092109 LOG("illegal compression %d\n",ibuf[28]);21102110 mutex_unlock(&cam->param_lock);21112111 return -1;21122112 }21132113 compressed = (ibuf[28] == COMPRESSED);21142114-21142114+21152115 if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) {21162116 LOG("illegal decimation %d\n",ibuf[29]);21172117 mutex_unlock(&cam->param_lock);21182118 return -1;21192119 }21202120- decimation = (ibuf[29] == DECIMATION_ENAB); 21202120+ decimation = (ibuf[29] == DECIMATION_ENAB);2121212121222122 cam->params.yuvThreshold.yThreshold = ibuf[30];21232123 cam->params.yuvThreshold.uvThreshold = ibuf[31];···21312131 cam->params.status.errorCode = ibuf[39];21322132 cam->fps = ibuf[41];21332133 mutex_unlock(&cam->param_lock);21342134-21342134+21352135 linesize = skipcount(cols, out_fmt);21362136 ibuf += FRAME_HEADER_SIZE;21372137 size -= FRAME_HEADER_SIZE;···21502150 if (!compressed || (compressed && !(*ibuf & 1))) {21512151 if(subsample_422 || even_line) {21522152 obuf += yuvconvert(ibuf, obuf, out_fmt,21532153- in_uyvy, cam->mmap_kludge);21532153+ in_uyvy, cam->mmap_kludge);21542154 ibuf += 4;21552155 ll -= 4;21562156 } else {21572157 /* SUBSAMPLE_420 on an odd line */21582158 obuf += convert420(ibuf, obuf,21592159- out_fmt, linesize,21602160- cam->mmap_kludge);21592159+ out_fmt, linesize,21602160+ cam->mmap_kludge);21612161 ibuf += 2;21622162 ll -= 2;21632163 }···2183218321842184 if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) &&21852185 (ibuf[2] == EOI) && (ibuf[3] == EOI)) {21862186- size -= 4;21862186+ size -= 4;21872187 break;21882188 }21892189···22042204 return -1;22052205 }22062206 }22072207-22072207+22082208 if(decimation) {22092209 /* interpolate odd rows */22102210 int i, j;···22332233static inline int init_stream_cap(struct cam_data *cam)22342234{22352235 return do_command(cam, CPIA_COMMAND_InitStreamCap,22362236- 0, cam->params.streamStartLine, 0, 0);22362236+ 0, cam->params.streamStartLine, 0, 0);22372237}2238223822392239···22542254 int MaxAllowableOverExposure, OverExposure;2255225522562256 MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness -22572257- FLICKER_BRIGHTNESS_CONSTANT;22572257+ FLICKER_BRIGHTNESS_CONSTANT;2258225822592259 if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) {22602260 OverExposure = MaxAllowableOverExposure;···22802280 DEB_BYTE(cam->cmd_queue>>8);22812281 if (cam->cmd_queue & COMMAND_SETFORMAT) {22822282 do_command(cam, CPIA_COMMAND_SetFormat,22832283- cam->params.format.videoSize,22842284- cam->params.format.subSample,22852285- cam->params.format.yuvOrder, 0);22832283+ cam->params.format.videoSize,22842284+ cam->params.format.subSample,22852285+ cam->params.format.yuvOrder, 0);22862286 do_command(cam, CPIA_COMMAND_SetROI,22872287- cam->params.roi.colStart, cam->params.roi.colEnd,22882288- cam->params.roi.rowStart, cam->params.roi.rowEnd);22872287+ cam->params.roi.colStart, cam->params.roi.colEnd,22882288+ cam->params.roi.rowStart, cam->params.roi.rowEnd);22892289 cam->first_frame = 1;22902290 }2291229122922292 if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS)22932293 do_command(cam, CPIA_COMMAND_SetColourParams,22942294- cam->params.colourParams.brightness,22952295- cam->params.colourParams.contrast,22962296- cam->params.colourParams.saturation, 0);22942294+ cam->params.colourParams.brightness,22952295+ cam->params.colourParams.contrast,22962296+ cam->params.colourParams.saturation, 0);2297229722982298 if (cam->cmd_queue & COMMAND_SETAPCOR)22992299 do_command(cam, CPIA_COMMAND_SetApcor,23002300- cam->params.apcor.gain1,23012301- cam->params.apcor.gain2,23022302- cam->params.apcor.gain4,23032303- cam->params.apcor.gain8);23002300+ cam->params.apcor.gain1,23012301+ cam->params.apcor.gain2,23022302+ cam->params.apcor.gain4,23032303+ cam->params.apcor.gain8);2304230423052305 if (cam->cmd_queue & COMMAND_SETVLOFFSET)23062306 do_command(cam, CPIA_COMMAND_SetVLOffset,23072307- cam->params.vlOffset.gain1,23082308- cam->params.vlOffset.gain2,23092309- cam->params.vlOffset.gain4,23102310- cam->params.vlOffset.gain8);23072307+ cam->params.vlOffset.gain1,23082308+ cam->params.vlOffset.gain2,23092309+ cam->params.vlOffset.gain4,23102310+ cam->params.vlOffset.gain8);2311231123122312 if (cam->cmd_queue & COMMAND_SETEXPOSURE) {23132313 do_command_extended(cam, CPIA_COMMAND_SetExposure,23142314- cam->params.exposure.gainMode,23152315- 1,23162316- cam->params.exposure.compMode,23172317- cam->params.exposure.centreWeight,23182318- cam->params.exposure.gain,23192319- cam->params.exposure.fineExp,23202320- cam->params.exposure.coarseExpLo,23212321- cam->params.exposure.coarseExpHi,23222322- cam->params.exposure.redComp,23232323- cam->params.exposure.green1Comp,23242324- cam->params.exposure.green2Comp,23252325- cam->params.exposure.blueComp);23142314+ cam->params.exposure.gainMode,23152315+ 1,23162316+ cam->params.exposure.compMode,23172317+ cam->params.exposure.centreWeight,23182318+ cam->params.exposure.gain,23192319+ cam->params.exposure.fineExp,23202320+ cam->params.exposure.coarseExpLo,23212321+ cam->params.exposure.coarseExpHi,23222322+ cam->params.exposure.redComp,23232323+ cam->params.exposure.green1Comp,23242324+ cam->params.exposure.green2Comp,23252325+ cam->params.exposure.blueComp);23262326 if(cam->params.exposure.expMode != 1) {23272327 do_command_extended(cam, CPIA_COMMAND_SetExposure,23282328- 0,23292329- cam->params.exposure.expMode,23302330- 0, 0,23312331- cam->params.exposure.gain,23322332- cam->params.exposure.fineExp,23332333- cam->params.exposure.coarseExpLo,23342334- cam->params.exposure.coarseExpHi,23352335- 0, 0, 0, 0);23282328+ 0,23292329+ cam->params.exposure.expMode,23302330+ 0, 0,23312331+ cam->params.exposure.gain,23322332+ cam->params.exposure.fineExp,23332333+ cam->params.exposure.coarseExpLo,23342334+ cam->params.exposure.coarseExpHi,23352335+ 0, 0, 0, 0);23362336 }23372337 }23382338-23382338+23392339 if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) {23402340 if (cam->params.colourBalance.balanceMode == 1) {23412341 do_command(cam, CPIA_COMMAND_SetColourBalance,···2358235823592359 if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET)23602360 do_command(cam, CPIA_COMMAND_SetCompressionTarget,23612361- cam->params.compressionTarget.frTargeting,23622362- cam->params.compressionTarget.targetFR,23632363- cam->params.compressionTarget.targetQ, 0);23612361+ cam->params.compressionTarget.frTargeting,23622362+ cam->params.compressionTarget.targetFR,23632363+ cam->params.compressionTarget.targetQ, 0);2364236423652365 if (cam->cmd_queue & COMMAND_SETYUVTHRESH)23662366 do_command(cam, CPIA_COMMAND_SetYUVThresh,23672367- cam->params.yuvThreshold.yThreshold,23682368- cam->params.yuvThreshold.uvThreshold, 0, 0);23672367+ cam->params.yuvThreshold.yThreshold,23682368+ cam->params.yuvThreshold.uvThreshold, 0, 0);2369236923702370 if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS)23712371 do_command_extended(cam, CPIA_COMMAND_SetCompressionParams,23722372- 0, 0, 0, 0,23732373- cam->params.compressionParams.hysteresis,23742374- cam->params.compressionParams.threshMax,23752375- cam->params.compressionParams.smallStep,23762376- cam->params.compressionParams.largeStep,23772377- cam->params.compressionParams.decimationHysteresis,23782378- cam->params.compressionParams.frDiffStepThresh,23792379- cam->params.compressionParams.qDiffStepThresh,23802380- cam->params.compressionParams.decimationThreshMod);23722372+ 0, 0, 0, 0,23732373+ cam->params.compressionParams.hysteresis,23742374+ cam->params.compressionParams.threshMax,23752375+ cam->params.compressionParams.smallStep,23762376+ cam->params.compressionParams.largeStep,23772377+ cam->params.compressionParams.decimationHysteresis,23782378+ cam->params.compressionParams.frDiffStepThresh,23792379+ cam->params.compressionParams.qDiffStepThresh,23802380+ cam->params.compressionParams.decimationThreshMod);2381238123822382 if (cam->cmd_queue & COMMAND_SETCOMPRESSION)23832383 do_command(cam, CPIA_COMMAND_SetCompression,23842384- cam->params.compression.mode,23842384+ cam->params.compression.mode,23852385 cam->params.compression.decimation, 0, 0);2386238623872387 if (cam->cmd_queue & COMMAND_SETSENSORFPS)23882388 do_command(cam, CPIA_COMMAND_SetSensorFPS,23892389- cam->params.sensorFps.divisor,23902390- cam->params.sensorFps.baserate, 0, 0);23892389+ cam->params.sensorFps.divisor,23902390+ cam->params.sensorFps.baserate, 0, 0);2391239123922392 if (cam->cmd_queue & COMMAND_SETFLICKERCTRL)23932393 do_command(cam, CPIA_COMMAND_SetFlickerCtrl,23942394- cam->params.flickerControl.flickerMode,23952395- cam->params.flickerControl.coarseJump,23962396- abs(cam->params.flickerControl.allowableOverExposure),23972397- 0);23942394+ cam->params.flickerControl.flickerMode,23952395+ cam->params.flickerControl.coarseJump,23962396+ abs(cam->params.flickerControl.allowableOverExposure),23972397+ 0);2398239823992399 if (cam->cmd_queue & COMMAND_SETECPTIMING)24002400 do_command(cam, CPIA_COMMAND_SetECPTiming,24012401- cam->params.ecpTiming, 0, 0, 0);24012401+ cam->params.ecpTiming, 0, 0, 0);2402240224032403 if (cam->cmd_queue & COMMAND_PAUSE)24042404 do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0);···24092409 if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected)24102410 {24112411 int p1 = (cam->params.qx3.bottomlight == 0) << 1;24122412- int p2 = (cam->params.qx3.toplight == 0) << 3;24132413- do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0);24142414- do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0);24122412+ int p2 = (cam->params.qx3.toplight == 0) << 3;24132413+ do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0);24142414+ do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0);24152415 }2416241624172417 cam->cmd_queue = COMMAND_NONE;···242224222423242324242424static void set_flicker(struct cam_params *params, volatile u32 *command_flags,24252425- int on)24252425+ int on)24262426{24272427 /* Everything in here is from the Windows driver */24282428#define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \24292429- params->version.firmwareRevision == (y))24292429+ params->version.firmwareRevision == (y))24302430/* define for compgain calculation */24312431#if 024322432#define COMPGAIN(base, curexp, newexp) \···24412441 (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128)))24422442#endif2443244324442444-24442444+24452445 int currentexp = params->exposure.coarseExpLo +24462446 params->exposure.coarseExpHi*256;24472447 int startexp;···24822482 }24832483 if(FIRMWARE_VERSION(1,2))24842484 params->exposure.compMode = 0;24852485- else 24852485+ else24862486 params->exposure.compMode = 1;2487248724882488 params->apcor.gain1 = 0x18;···25332533}2534253425352535#define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \25362536- cam->params.version.firmwareRevision == (y))25362536+ cam->params.version.firmwareRevision == (y))25372537/* monitor the exposure and adjust the sensor frame rate if needed */25382538static void monitor_exposure(struct cam_data *cam)25392539{25402540 u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8];25412541 int retval, light_exp, dark_exp, very_dark_exp;25422542 int old_exposure, new_exposure, framerate;25432543-25432543+25442544 /* get necessary stats and register settings from camera */25452545 /* do_command can't handle this, so do it ourselves */25462546 cmd[0] = CPIA_COMMAND_ReadVPRegs>>8;···2564256425652565 mutex_lock(&cam->param_lock);25662566 light_exp = cam->params.colourParams.brightness +25672567- TC - 50 + EXP_ACC_LIGHT;25672567+ TC - 50 + EXP_ACC_LIGHT;25682568 if(light_exp > 255)25692569 light_exp = 255;25702570 dark_exp = cam->params.colourParams.brightness +25712571- TC - 50 - EXP_ACC_DARK;25712571+ TC - 50 - EXP_ACC_DARK;25722572 if(dark_exp < 0)25732573 dark_exp = 0;25742574 very_dark_exp = dark_exp/2;25752575-25752575+25762576 old_exposure = cam->params.exposure.coarseExpHi * 256 +25772577- cam->params.exposure.coarseExpLo;25772577+ cam->params.exposure.coarseExpLo;2578257825792579 if(!cam->params.flickerControl.disabled) {25802580 /* Flicker control on */···26672667 cam->exposure_status = EXPOSURE_NORMAL;26682668 }26692669 }26702670-26702670+26712671 framerate = cam->fps;26722672 if(framerate > 30 || framerate < 1)26732673 framerate = 1;26742674-26742674+26752675 if(!cam->params.flickerControl.disabled) {26762676 /* Flicker control on */26772677 if((cam->exposure_status == EXPOSURE_VERY_DARK ||···26832683 ++cam->params.sensorFps.divisor;26842684 cam->cmd_queue |= COMMAND_SETSENSORFPS;2685268526862686- cam->params.flickerControl.coarseJump = 26862686+ cam->params.flickerControl.coarseJump =26872687 flicker_jumps[cam->mainsFreq]26882688- [cam->params.sensorFps.baserate]26892689- [cam->params.sensorFps.divisor];26882688+ [cam->params.sensorFps.baserate]26892689+ [cam->params.sensorFps.divisor];26902690 cam->cmd_queue |= COMMAND_SETFLICKERCTRL;2691269126922692 new_exposure = cam->params.flickerControl.coarseJump-1;···27042704 cam->params.sensorFps.divisor > 0) {2705270527062706 /* light for too long */27072707- int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; 27072707+ int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ;2708270827092709 --cam->params.sensorFps.divisor;27102710 cam->cmd_queue |= COMMAND_SETSENSORFPS;2711271127122712- cam->params.flickerControl.coarseJump = 27122712+ cam->params.flickerControl.coarseJump =27132713 flicker_jumps[cam->mainsFreq]27142714- [cam->params.sensorFps.baserate]27152715- [cam->params.sensorFps.divisor];27142714+ [cam->params.sensorFps.baserate]27152715+ [cam->params.sensorFps.divisor];27162716 cam->cmd_queue |= COMMAND_SETFLICKERCTRL;2717271727182718 new_exposure = cam->params.flickerControl.coarseJump-1;···2772277227732773 It also adjust the colour balance when an exposure step is detected - as27742774 long as flicker is running27752775-*/ 27752775+*/27762776static void restart_flicker(struct cam_data *cam)27772777{27782778 int cam_exposure, old_exp;···27862786 }27872787 cam_exposure = cam->raw_image[39]*2;27882788 old_exp = cam->params.exposure.coarseExpLo +27892789- cam->params.exposure.coarseExpHi*256;27902790- /* 27912791- see how far away camera exposure is from a valid 27922792- flicker exposure value27932793- */27942794- cam_exposure %= cam->params.flickerControl.coarseJump;27892789+ cam->params.exposure.coarseExpHi*256;27902790+ /*27912791+ see how far away camera exposure is from a valid27922792+ flicker exposure value27932793+ */27942794+ cam_exposure %= cam->params.flickerControl.coarseJump;27952795 if(!cam->params.flickerControl.disabled &&27962796- cam_exposure <= cam->params.flickerControl.coarseJump - 3) {27962796+ cam_exposure <= cam->params.flickerControl.coarseJump - 3) {27972797 /* Flicker control auto-disabled */27982798 cam->params.flickerControl.disabled = 1;27992799 }28002800-28002800+28012801 if(cam->params.flickerControl.disabled &&28022802 cam->params.flickerControl.flickerMode &&28032803 old_exp > cam->params.flickerControl.coarseJump +28042804- ROUND_UP_EXP_FOR_FLICKER) {28042804+ ROUND_UP_EXP_FOR_FLICKER) {28052805 /* exposure is now high enough to switch28062806 flicker control back on */28072807 set_flicker(&cam->params, &cam->cmd_queue, 1);···28182818{28192819 /* FIXME: Does this actually work? */28202820 LOG("Clearing stall\n");28212821-28212821+28222822 cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0);28232823 do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0);28242824 return cam->params.status.streamState != STREAM_PAUSED;···28782878 return -EINTR;2879287928802880 do_command(cam, CPIA_COMMAND_GetCameraStatus,28812881- 0, 0, 0, 0);28812881+ 0, 0, 0, 0);28822882 }28832883 if(cam->params.status.streamState != STREAM_READY) {28842884 continue;···2903290329042904 /* Switch flicker control back on if it got turned off */29052905 restart_flicker(cam);29062906-29062906+29072907 /* If AEC is enabled, monitor the exposure and29082908 adjust the sensor frame rate if needed */29092909 if(cam->params.exposure.expMode == 2)29102910 monitor_exposure(cam);29112911-29112911+29122912 /* camera idle now so dispatch queued commands */29132913 dispatch_commands(cam);2914291429152915 /* Update our knowledge of the camera state */29162916- do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0);29172917- do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0);29162916+ do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0);29172917+ do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0);29182918 do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0);2919291929202920 /* decompress and convert image to by copying it from···29332933 uncompressed. */29342934 cam->first_frame = 1;29352935 do_command(cam, CPIA_COMMAND_SetGrabMode,29362936- CPIA_GRAB_SINGLE, 0, 0, 0);29362936+ CPIA_GRAB_SINGLE, 0, 0, 0);29372937 /* FIXME: Trial & error - need up to 70ms for29382938 the grab mode change to complete ? */29392939 msleep_interruptible(70);···29572957 if (cam->first_frame) {29582958 cam->first_frame = 0;29592959 do_command(cam, CPIA_COMMAND_SetCompression,29602960- cam->params.compression.mode,29602960+ cam->params.compression.mode,29612961 cam->params.compression.decimation, 0, 0);2962296229632963 /* Switch from single-grab to continuous grab */29642964 do_command(cam, CPIA_COMMAND_SetGrabMode,29652965- CPIA_GRAB_CONTINUOUS, 0, 0, 0);29652965+ CPIA_GRAB_CONTINUOUS, 0, 0, 0);29662966 }29672967 return 0;29682968 }···29772977 if ((err = allocate_frame_buf(cam)))29782978 return err;29792979 }29802980-29802980+29812981 cam->curframe = vm->frame;29822982 cam->frame[cam->curframe].state = FRAME_READY;29832983 return fetch_frame(cam);29842984}29852985-29852985+29862986static int goto_high_power(struct cam_data *cam)29872987{29882988 if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0))···30393039static int set_camera_state(struct cam_data *cam)30403040{30413041 cam->cmd_queue = COMMAND_SETCOMPRESSION |30423042- COMMAND_SETCOMPRESSIONTARGET |30433043- COMMAND_SETCOLOURPARAMS |30443044- COMMAND_SETFORMAT |30453045- COMMAND_SETYUVTHRESH |30463046- COMMAND_SETECPTIMING |30473047- COMMAND_SETCOMPRESSIONPARAMS |30483048- COMMAND_SETEXPOSURE |30493049- COMMAND_SETCOLOURBALANCE |30503050- COMMAND_SETSENSORFPS |30513051- COMMAND_SETAPCOR |30523052- COMMAND_SETFLICKERCTRL |30533053- COMMAND_SETVLOFFSET;30423042+ COMMAND_SETCOMPRESSIONTARGET |30433043+ COMMAND_SETCOLOURPARAMS |30443044+ COMMAND_SETFORMAT |30453045+ COMMAND_SETYUVTHRESH |30463046+ COMMAND_SETECPTIMING |30473047+ COMMAND_SETCOMPRESSIONPARAMS |30483048+ COMMAND_SETEXPOSURE |30493049+ COMMAND_SETCOLOURBALANCE |30503050+ COMMAND_SETSENSORFPS |30513051+ COMMAND_SETAPCOR |30523052+ COMMAND_SETFLICKERCTRL |30533053+ COMMAND_SETVLOFFSET;3054305430553055 do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0);30563056 dispatch_commands(cam);30573057-30573057+30583058 /* Wait 6 frames for the sensor to get all settings and30593059 AEC/ACB to settle */30603060 msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) *···3062306230633063 if(signal_pending(current))30643064 return -EINTR;30653065-30653065+30663066 save_camera_state(cam);3067306730683068 return 0;···30943094 if (goto_low_power(cam))30953095 return -ENODEV;30963096 }30973097-30973097+30983098 /* procedure described in developer's guide p3-28 */30993099-30993099+31003100 /* Check the firmware version. */31013101 cam->params.version.firmwareVersion = 0;31023102 get_version_information(cam);···31133113 cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 &&31143114 cam->params.pnpID.product == 0x0001);3115311531163116- /* The fatal error checking should be done after31163116+ /* The fatal error checking should be done after31173117 * the camera powers up (developer's guide p 3-38) */3118311831193119 /* Set streamState before transition to high power to avoid bug31203120 * in firmware 1-02 */31213121 do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0,31223122- STREAM_NOT_READY, 0);31233123-31223122+ STREAM_NOT_READY, 0);31233123+31243124 /* GotoHiPower */31253125 err = goto_high_power(cam);31263126 if (err)···31423142 /* Firmware 1-02 may do this for parallel port cameras,31433143 * just clear the flags (developer's guide p 3-38) */31443144 do_command(cam, CPIA_COMMAND_ModifyCameraStatus,31453145- FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0);31453145+ FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0);31463146 }31473147 }31483148-31483148+31493149 /* Check the camera status again */31503150 if (cam->params.status.fatalError) {31513151 if (cam->params.status.fatalError)31523152 return -EIO;31533153 }31543154-31543154+31553155 /* VPVersion can't be retrieved before the camera is in HiPower,31563156 * so get it here instead of in get_version_information. */31573157 do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0);···31933193 if (!cam->raw_image)31943194 goto oops;31953195 }31963196-31963196+31973197 if (!cam->decompressed_frame.data) {31983198 cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE);31993199 if (!cam->decompressed_frame.data)32003200 goto oops;32013201 }32023202-32023202+32033203 /* open cpia */32043204 err = -ENODEV;32053205 if (cam->ops->open(cam->lowlevel_data))32063206 goto oops;32073207-32073207+32083208 /* reset the camera */32093209 if ((err = reset_camera(cam)) != 0) {32103210 cam->ops->close(cam->lowlevel_data);32113211 goto oops;32123212 }32133213-32133213+32143214 err = -EINTR;32153215 if(signal_pending(current))32163216 goto oops;···3224322432253225 /* init it to something */32263226 cam->mmap_kludge = 0;32273227-32273227+32283228 ++cam->open_count;32293229 file->private_data = dev;32303230 mutex_unlock(&cam->busy_lock);···32503250 struct cam_data *cam = dev->priv;3251325132523252 if (cam->ops) {32533253- /* Return ownership of /proc/cpia/videoX to root */32533253+ /* Return ownership of /proc/cpia/videoX to root */32543254 if(cam->proc_entry)32553255 cam->proc_entry->uid = 0;32563256-32563256+32573257 /* save camera state for later open (developers guide ch 3.5.3) */32583258 save_camera_state(cam);32593259···33423342 return -EFAULT;33433343 }33443344 if (copy_to_user(buf, cam->decompressed_frame.data,33453345- cam->decompressed_frame.count)) {33453345+ cam->decompressed_frame.count)) {33463346 DBG("copy_to_user failed\n");33473347 mutex_unlock(&cam->busy_lock);33483348 return -EFAULT;···3361336133623362 if (!cam || !cam->ops)33633363 return -ENODEV;33643364-33643364+33653365 /* make this _really_ smp-safe */33663366 if (mutex_lock_interruptible(&cam->busy_lock))33673367 return -EINTR;···34053405 v->norm = 0;34063406 break;34073407 }34083408-34083408+34093409 case VIDIOCSCHAN:34103410 {34113411 struct video_channel *v = arg;···34243424 *pic = cam->vp;34253425 break;34263426 }34273427-34273427+34283428 case VIDIOCSPICT:34293429 {34303430 struct video_picture *vp = arg;···3458345834593459 /* Adjust flicker control if necessary */34603460 if(cam->params.flickerControl.allowableOverExposure < 0)34613461- cam->params.flickerControl.allowableOverExposure = 34613461+ cam->params.flickerControl.allowableOverExposure =34623462 -find_over_exposure(cam->params.colourParams.brightness);34633463 if(cam->params.flickerControl.flickerMode != 0)34643464 cam->cmd_queue |= COMMAND_SETFLICKERCTRL;34653465-34653465+3466346634673467 /* queue command to update camera */34683468 cam->cmd_queue |= COMMAND_SETCOLOURPARAMS;···34823482 *vw = cam->vw;34833483 break;34843484 }34853485-34853485+34863486 case VIDIOCSWIN:34873487 {34883488 /* copy_from_user, check validity, copy to internal structure */···3514351435153515 /* video size is changing, reset the subcapture area */35163516 memset(&cam->vc, 0, sizeof(cam->vc));35173517-35173517+35183518 set_vw_size(cam);35193519 DBG("%d / %d\n", cam->vw.width, cam->vw.height);35203520 cam->cmd_queue |= COMMAND_SETFORMAT;···35473547 vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i;35483548 break;35493549 }35503550-35503550+35513551 case VIDIOCMCAPTURE:35523552 {35533553 struct video_mmap *vm = arg;···3597359735983598 /* video size is changing, reset the subcapture area */35993599 memset(&cam->vc, 0, sizeof(cam->vc));36003600-36003600+36013601 set_vw_size(cam);36023602 cam->cmd_queue |= COMMAND_SETFORMAT;36033603 dispatch_commands(cam);···3608360836093609 break;36103610 }36113611-36113611+36123612 case VIDIOCSYNC:36133613 {36143614 int *frame = arg;···36493649 *vc = cam->vc;3650365036513651 break;36523652- } 36523652+ }3653365336543654 case VIDIOCSCAPTURE:36553655 {···36653665 retval = -EINVAL;36663666 break;36673667 }36683668-36683668+36693669 /* Clip to the resolution we can set for the ROI36703670 (every 8 columns and 4 rows) */36713671 vc->x = vc->x & ~(__u32)7;···36813681 }3682368236833683 DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height);36843684-36843684+36853685 mutex_lock(&cam->param_lock);36863686-36863686+36873687 cam->vc.x = vc->x;36883688 cam->vc.y = vc->y;36893689 cam->vc.width = vc->width;36903690 cam->vc.height = vc->height;36913691-36913691+36923692 set_vw_size(cam);36933693 cam->cmd_queue |= COMMAND_SETFORMAT;36943694···36993699 dispatch_commands(cam);37003700 break;37013701 }37023702-37023702+37033703 case VIDIOCGUNIT:37043704 {37053705 struct video_unit *vu = arg;···37153715 break;37163716 }3717371737183718-37183718+37193719 /* pointless to implement overlay with this camera */37203720 case VIDIOCCAPTURE:37213721 case VIDIOCGFBUF:···3738373837393739 mutex_unlock(&cam->busy_lock);37403740 return retval;37413741-} 37413741+}3742374237433743static int cpia_ioctl(struct inode *inode, struct file *file,37443744 unsigned int cmd, unsigned long arg)···3759375937603760 if (!cam || !cam->ops)37613761 return -ENODEV;37623762-37623762+37633763 DBG("cpia_mmap: %ld\n", size);3764376437653765 if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE)···3767376737683768 if (!cam || !cam->ops)37693769 return -ENODEV;37703770-37703770+37713771 /* make this _really_ smp-safe */37723772 if (mutex_lock_interruptible(&cam->busy_lock))37733773 return -EINTR;···38513851 cam->params.flickerControl.flickerMode = 0;38523852 cam->params.flickerControl.disabled = 1;3853385338543854- cam->params.flickerControl.coarseJump = 38543854+ cam->params.flickerControl.coarseJump =38553855 flicker_jumps[cam->mainsFreq]38563856- [cam->params.sensorFps.baserate]38573857- [cam->params.sensorFps.divisor];38583858- cam->params.flickerControl.allowableOverExposure = 38563856+ [cam->params.sensorFps.baserate]38573857+ [cam->params.sensorFps.divisor];38583858+ cam->params.flickerControl.allowableOverExposure =38593859 -find_over_exposure(cam->params.colourParams.brightness);38603860 cam->params.vlOffset.gain1 = 20;38613861 cam->params.vlOffset.gain2 = 24;···38703870 cam->params.compressionParams.qDiffStepThresh = 3;38713871 cam->params.compressionParams.decimationThreshMod = 2;38723872 /* End of default values from Software Developer's Guide */38733873-38733873+38743874 cam->transfer_rate = 0;38753875 cam->exposure_status = EXPOSURE_NORMAL;38763876-38763876+38773877 /* Set Sensor FPS to 15fps. This seems better than 30fps38783878 * for indoor lighting. */38793879 cam->params.sensorFps.divisor = 1;38803880 cam->params.sensorFps.baserate = 1;38813881-38813881+38823882 cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */38833883 cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */38843884-38843884+38853885 cam->params.format.subSample = SUBSAMPLE_422;38863886 cam->params.format.yuvOrder = YUVORDER_YUYV;38873887-38873887+38883888 cam->params.compression.mode = CPIA_COMPRESSION_AUTO;38893889 cam->params.compressionTarget.frTargeting =38903890 CPIA_COMPRESSION_TARGET_QUALITY;···38983898 cam->params.qx3.cradled = 0;3899389939003900 cam->video_size = VIDEOSIZE_CIF;39013901-39013901+39023902 cam->vp.colour = 32768; /* 50% */39033903 cam->vp.hue = 32768; /* 50% */39043904 cam->vp.brightness = 32768; /* 50% */···39113911 cam->vc.y = 0;39123912 cam->vc.width = 0;39133913 cam->vc.height = 0;39143914-39143914+39153915 cam->vw.x = 0;39163916 cam->vw.y = 0;39173917 set_vw_size(cam);···3928392839293929/* initialize cam_data structure */39303930static void init_camera_struct(struct cam_data *cam,39313931- struct cpia_camera_ops *ops )39313931+ struct cpia_camera_ops *ops )39323932{39333933 int i;39343934···3945394539463946 memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template));39473947 cam->vdev.priv = cam;39483948-39483948+39493949 cam->curframe = 0;39503950 for (i = 0; i < FRAME_NUM; i++) {39513951 cam->frame[i].width = 0;···3961396139623962struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel)39633963{39643964- struct cam_data *camera;39653965-39643964+ struct cam_data *camera;39653965+39663966 if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL)39673967 return NULL;3968396839693969-39693969+39703970 init_camera_struct( camera, ops );39713971 camera->lowlevel_data = lowlevel;39723972-39723972+39733973 /* register v4l device */39743974 if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {39753975 kfree(camera);···39823982 /* open cpia */39833983 if (camera->ops->open(camera->lowlevel_data))39843984 return camera;39853985-39853985+39863986 /* reset the camera */39873987 if (reset_camera(camera) != 0) {39883988 camera->ops->close(camera->lowlevel_data);···40224022 DBG("camera open -- setting ops to NULL\n");40234023 cam->ops = NULL;40244024 }40254025-40254025+40264026#ifdef CONFIG_PROC_FS40274027 DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor);40284028 destroy_proc_cpia_cam(cam);40294029-#endif 40294029+#endif40304030 if (!cam->open_count) {40314031 DBG("freeing camera\n");40324032 kfree(cam);
+26-26
drivers/media/video/cpia.h
···5252struct cpia_camera_ops5353{5454 /* open sets privdata to point to structure for this camera.5555- * Returns negative value on error, otherwise 0.5555+ * Returns negative value on error, otherwise 0.5656 */5757 int (*open)(void *privdata);5858-5858+5959 /* Registers callback function cb to be called with cbdata6060 * when an image is ready. If cb is NULL, only single image grabs6161 * should be used. cb should immediately call streamRead to read···6363 * otherwise 0.6464 */6565 int (*registerCallback)(void *privdata, void (*cb)(void *cbdata),6666- void *cbdata);6767-6666+ void *cbdata);6767+6868 /* transferCmd sends commands to the camera. command MUST point to6969 * an 8 byte buffer in kernel space. data can be NULL if no extra7070 * data is needed. The size of the data is given by the last 2···7777 * Returns negative value on error, otherwise 0.7878 */7979 int (*streamStart)(void *privdata);8080-8080+8181 /* streamStop terminates stream capture mode.8282 * Returns negative value on error, otherwise 0.8383 */8484 int (*streamStop)(void *privdata);8585-8585+8686 /* streamRead reads a frame from the camera. buffer points to a8787- * buffer large enough to hold a complete frame in kernel space.8888- * noblock indicates if this should be a non blocking read.8787+ * buffer large enough to hold a complete frame in kernel space.8888+ * noblock indicates if this should be a non blocking read.8989 * Returns the number of bytes read, or negative value on error.9090- */9090+ */9191 int (*streamRead)(void *privdata, u8 *buffer, int noblock);9292-9292+9393 /* close disables the device until open() is called again.9494 * Returns negative value on error, otherwise 0.9595 */9696 int (*close)(void *privdata);9797-9797+9898 /* If wait_for_stream_ready is non-zero, wait until the streamState9999 * is STREAM_READY before calling streamRead.100100 */101101 int wait_for_stream_ready;102102103103- /* 103103+ /*104104 * Used to maintain lowlevel module usage counts105105 */106106 struct module *owner;···215215 u8 videoSize; /* CIF/QCIF */216216 u8 subSample;217217 u8 yuvOrder;218218- } format;219219- struct { /* Intel QX3 specific data */220220- u8 qx3_detected; /* a QX3 is present */221221- u8 toplight; /* top light lit , R/W */222222- u8 bottomlight; /* bottom light lit, R/W */223223- u8 button; /* snapshot button pressed (R/O) */224224- u8 cradled; /* microscope is in cradle (R/O) */225225- } qx3;218218+ } format;219219+ struct { /* Intel QX3 specific data */220220+ u8 qx3_detected; /* a QX3 is present */221221+ u8 toplight; /* top light lit , R/W */222222+ u8 bottomlight; /* bottom light lit, R/W */223223+ u8 button; /* snapshot button pressed (R/O) */224224+ u8 cradled; /* microscope is in cradle (R/O) */225225+ } qx3;226226 struct {227227 u8 colStart; /* skip first 8*colStart pixels */228228 u8 colEnd; /* finish at 8*colEnd pixels */···247247struct cam_data {248248 struct list_head cam_data_list;249249250250- struct mutex busy_lock; /* guard against SMP multithreading */250250+ struct mutex busy_lock; /* guard against SMP multithreading */251251 struct cpia_camera_ops *ops; /* lowlevel driver operations */252252 void *lowlevel_data; /* private data for lowlevel driver */253253 u8 *raw_image; /* buffer for raw image data */254254 struct cpia_frame decompressed_frame;255255- /* buffer to hold decompressed frame */256256- int image_size; /* sizeof last decompressed image */255255+ /* buffer to hold decompressed frame */256256+ int image_size; /* sizeof last decompressed image */257257 int open_count; /* # of process that have camera open */258258259259 /* camera status */···265265 struct mutex param_lock; /* params lock for this camera */266266 struct cam_params params; /* camera settings */267267 struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */268268-268268+269269 /* v4l */270270 int video_size; /* VIDEO_SIZE_ */271271 volatile enum v4l_camstates camstate; /* v4l layer status */···277277 /* mmap interface */278278 int curframe; /* the current frame to grab into */279279 u8 *frame_buf; /* frame buffer data */280280- struct cpia_frame frame[FRAME_NUM];280280+ struct cpia_frame frame[FRAME_NUM];281281 /* FRAME_NUM-buffering, so we need a array */282282283283 int first_frame;···424424#define DEB_BYTE(p)\425425 DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\426426 (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\427427- (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0);427427+ (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0);428428429429#endif /* __KERNEL__ */430430
+53-53
drivers/media/video/cpia_pp.c
···2323 */24242525/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */2626-/* #define _CPIA_DEBUG_ 1 */ 2626+/* #define _CPIA_DEBUG_ 1 */27272828#include <linux/config.h>2929···45454646static int cpia_pp_open(void *privdata);4747static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata),4848- void *cbdata);4848+ void *cbdata);4949static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data);5050static int cpia_pp_streamStart(void *privdata);5151static int cpia_pp_streamStop(void *privdata);···9393 int stream_irq;9494};95959696-static struct cpia_camera_ops cpia_pp_ops = 9696+static struct cpia_camera_ops cpia_pp_ops =9797{9898 cpia_pp_open,9999 cpia_pp_registerCallback,···123123}124124125125/* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility126126- * Link Flag during negotiation */ 126126+ * Link Flag during negotiation */127127#define UPLOAD_FLAG 0x08128128#define NIBBLE_TRANSFER 0x01129129#define ECP_TRANSFER 0x03···139139/* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */140140/* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */141141142142-static size_t cpia_read_nibble (struct parport *port, 143143- void *buffer, size_t len, 142142+static size_t cpia_read_nibble (struct parport *port,143143+ void *buffer, size_t len,144144 int flags)145145{146146- /* adapted verbatim, with one change, from 146146+ /* adapted verbatim, with one change, from147147 parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */148148149149 unsigned char *buf = buffer;150150 int i;151151 unsigned char byte = 0;152152-152152+153153 len *= 2; /* in nibbles */154154 for (i=0; i < len; i++) {155155 unsigned char nibble;···158158 * after every second nibble to signal that more159159 * data is available. (the total number of Bytes that160160 * should be sent is known; if too few are received, an error161161- * will be recorded after a timeout). 161161+ * will be recorded after a timeout).162162 * This is incompatible with parport_ieee1284_read_nibble(),163163 * which expects to find nFault LO after every second nibble.164164 */165165166166- /* Solution: modify cpia_read_nibble to only check for 166166+ /* Solution: modify cpia_read_nibble to only check for167167 * nDataAvail before the first nibble is sent.168168 */169169···216216 /* Second nibble */217217 byte |= nibble << 4;218218 *buf++ = byte;219219- } else 219219+ } else220220 byte = nibble;221221 }222222···238238}239239240240/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)241241- * (See CPiA Data sheet p. 31) 242242- * 243243- * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a 244244- * nonstandard variant of nibble mode which allows the same (mediocre) 245245- * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable 241241+ * (See CPiA Data sheet p. 31)242242+ *243243+ * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a244244+ * nonstandard variant of nibble mode which allows the same (mediocre)245245+ * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable246246 * parallel ports, but works also for non-TRISTATE-capable ports.247247 * (Standard nibble mode only send 4 bits per cycle)248248 *249249 */250250251251-static size_t cpia_read_nibble_stream(struct parport *port, 252252- void *buffer, size_t len, 251251+static size_t cpia_read_nibble_stream(struct parport *port,252252+ void *buffer, size_t len,253253 int flags)254254{255255 int i;···260260 unsigned char nibble[2], byte = 0;261261 int j;262262263263- /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ 263263+ /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */264264 if (endseen > 3 )265265 break;266266···268268 parport_frob_control (port,269269 PARPORT_CONTROL_AUTOFD,270270 PARPORT_CONTROL_AUTOFD);271271-271271+272272 /* Event 9: nAck goes low. */273273 port->ieee1284.phase = IEEE1284_PH_REV_DATA;274274 if (parport_wait_peripheral (port,···282282283283 /* Read lower nibble */284284 nibble[0] = parport_read_status (port) >>3;285285-285285+286286 /* Event 10: Set nAutoFd high. */287287 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);288288···295295 port->name);296296 break;297297 }298298-298298+299299 /* Read upper nibble */300300 nibble[1] = parport_read_status (port) >>3;301301-301301+302302 /* reassemble the byte */303303 for (j = 0; j < 2 ; j++ ) {304304 nibble[j] &= ~8;···335335static int ForwardSetup(struct pp_cam_entry *cam)336336{337337 int retry;338338-339339- /* The CPiA uses ECP protocol for Downloads from the Host to the camera. 338338+339339+ /* The CPiA uses ECP protocol for Downloads from the Host to the camera.340340 * This will be software-emulated if ECP hardware is not present341341 */342342···375375 upload_mode = mode;376376 if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK;377377378378- /* the usual camera maximum response time is 10ms, but after 378378+ /* the usual camera maximum response time is 10ms, but after379379 * receiving some commands, it needs up to 40ms. */380380-380380+381381 for(retry = 0; retry < 4; ++retry) {382382 if(!parport_negotiate(cam->port, mode)) {383383 break;···439439440440 /* support for CPiA variant nibble reads */441441 if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) {442442- if(cpia_read_nibble(cam->port, packet, size, 0) != size) 443443- retval = -EIO; 442442+ if(cpia_read_nibble(cam->port, packet, size, 0) != size)443443+ retval = -EIO;444444 } else {445445- if(parport_read(cam->port, packet, size) != size) 445445+ if(parport_read(cam->port, packet, size) != size)446446 retval = -EIO;447447 }448448 EndTransferMode(cam);···542542 block_size = PARPORT_CHUNK_SIZE;543543 while( !cam->image_complete ) {544544 cond_resched();545545-545545+546546 new_bytes = cpia_pp_read(cam->port, buffer, block_size );547547 if( new_bytes <= 0 ) {548548 break;549549 }550550 i=-1;551551 while(++i<new_bytes && endseen<4) {552552- if(*buffer==EOI) {553553- endseen++;554554- } else {555555- endseen=0;556556- }552552+ if(*buffer==EOI) {553553+ endseen++;554554+ } else {555555+ endseen=0;556556+ }557557 buffer++;558558 }559559 read_bytes += i;···601601 }602602 if((err = ReadPacket(cam, buffer, 8)) < 0) {603603 DBG("Error reading command result\n");604604- return err;604604+ return err;605605 }606606 memcpy(data, buffer, databytes);607607 } else if(command[0] == DATA_OUT) {···631631static int cpia_pp_open(void *privdata)632632{633633 struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata;634634-634634+635635 if (cam == NULL)636636 return -EINVAL;637637-637637+638638 if(cam->open_count == 0) {639639 if (parport_claim(cam->pdev)) {640640 DBG("failed to claim the port\n");···645645 parport_write_control(cam->port, PARPORT_CONTROL_SELECT);646646 udelay(50);647647 parport_write_control(cam->port,648648- PARPORT_CONTROL_SELECT649649- | PARPORT_CONTROL_INIT);648648+ PARPORT_CONTROL_SELECT649649+ | PARPORT_CONTROL_INIT);650650 }651651-651651+652652 ++cam->open_count;653653-653653+654654 return 0;655655}656656···663663{664664 struct pp_cam_entry *cam = privdata;665665 int retval = 0;666666-666666+667667 if(cam->port->irq != PARPORT_IRQ_NONE) {668668 INIT_WORK(&cam->cb_task, cb, cbdata);669669 } else {···707707 LOG("failed to allocate camera structure\n");708708 return -ENOMEM;709709 }710710-710710+711711 pdev = parport_register_device(port, "cpia_pp", NULL, NULL,712712- NULL, 0, cam);712712+ NULL, 0, cam);713713714714 if (!pdev) {715715 LOG("failed to parport_register_device\n");···753753 }754754 cpia = NULL;755755 }756756- spin_unlock( &cam_list_lock_pp ); 756756+ spin_unlock( &cam_list_lock_pp );757757758758 if (!cpia) {759759 DBG("cpia_pp_detach failed to find cam_data in cam_list\n");760760 return;761761 }762762-763763- cam = (struct pp_cam_entry *) cpia->lowlevel_data; 762762+763763+ cam = (struct pp_cam_entry *) cpia->lowlevel_data;764764 cpia_unregister_camera(cpia);765765- if(cam->open_count > 0) 765765+ if(cam->open_count > 0)766766 cpia_pp_close(cam);767767 parport_unregister_device(cam->pdev);768768- cpia->lowlevel_data = NULL; 768768+ cpia->lowlevel_data = NULL;769769 kfree(cam);770770}771771···805805806806int cpia_pp_init(void)807807{808808- printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, 808808+ printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT,809809 CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER);810810811811 if(parport_nr[0] == PPCPIA_PARPORT_OFF) {812812 printk(" disabled\n");813813 return 0;814814 }815815-815815+816816 spin_lock_init( &cam_list_lock_pp );817817818818 if (parport_register_driver (&cpia_pp_driver)) {
···1515 *1616 * Based on the Linux CPiA driver written by Peter Pregler,1717 * Scott J. Bertin and Johannes Erdfelt.1818- * 1818+ *1919 * Please see the file: Documentation/usb/ov511.txt2020 * and the website at: http://alpha.dyndns.org/ov5112121 * for more info.···433433 return (reg_w(ov, reg, newval));434434}435435436436-/* 436436+/*437437 * Writes multiple (n) byte value to a single register. Only valid with certain438438 * registers (0x30 and 0xc4 - 0xce).439439 */···629629 /* Retry until idle */630630 do631631 rc = reg_r(ov, R511_I2C_CTL);632632- while (rc > 0 && ((rc&1) == 0)); 632632+ while (rc > 0 && ((rc&1) == 0));633633 if (rc < 0)634634 break;635635···17521752 ov->whiteness = p->whiteness;1753175317541754 /* Don't return error if a setting is unsupported, or rest of settings17551755- * will not be performed */17551755+ * will not be performed */1756175617571757 rc = sensor_set_contrast(ov, p->contrast);17581758 if (FATAL_ERROR(rc))···17811781 PDEBUG(4, "sensor_get_picture");1782178217831783 /* Don't return error if a setting is unsupported, or rest of settings17841784- * will not be performed */17841784+ * will not be performed */1785178517861786 rc = sensor_get_contrast(ov, &(p->contrast));17871787 if (FATAL_ERROR(rc))···2251225122522252 /******** Clock programming ********/2253225322542254- /* The OV6620 needs special handling. This prevents the 22542254+ /* The OV6620 needs special handling. This prevents the22552255 * severe banding that normally occurs */22562256 if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630)22572257 {···23262326 int sub_flag)23272327{23282328 int ret;23292329- int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; 23292329+ int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize;23302330 int hoffset, voffset, hwscale = 0, vwscale = 0;2331233123322332 /* The different sensor ICs handle setting up of window differently.···25752575 /* OV518 needs U and V swapped */25762576 i2c_w_mask(ov, 0x15, 0x00, 0x01);2577257725782578- if (mode == VIDEO_PALETTE_GREY) {25782578+ if (mode == VIDEO_PALETTE_GREY) {25792579 /* Set 16-bit input format (UV data are ignored) */25802580 reg_w_mask(ov, 0x20, 0x00, 0x08);25812581···28942894 * ... ... ...28952895 * 56 57 ... 63 120 121 ... 127 248 249 ... 25528962896 *28972897- */ 28972897+ */28982898static void28992899yuv400raw_to_yuv400p(struct ov511_frame *frame,29002900 unsigned char *pIn0, unsigned char *pOut0)···29232923 *29242924 * 0 1 ... 729252925 * 8 9 ... 1529262926- * ... 29262926+ * ...29272927 * 56 57 ... 6329282928 *29292929 * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block).···30343034 */30353035static void30363036deinterlace(struct ov511_frame *frame, int rawformat,30373037- unsigned char *pIn0, unsigned char *pOut0)30373037+ unsigned char *pIn0, unsigned char *pOut0)30383038{30393039 const int fieldheight = frame->rawheight / 2;30403040 const int fieldpix = fieldheight * frame->rawwidth;···31123112 frame->tempdata);3113311331143114 deinterlace(frame, RAWFMT_YUV400, frame->tempdata,31153115- frame->data);31153115+ frame->data);31163116 } else {31173117 if (frame->compressed)31183118 decompress(ov, frame, frame->rawdata,···31363136 frame->tempdata);3137313731383138 deinterlace(frame, RAWFMT_YUV420, frame->tempdata,31393139- frame->data);31393139+ frame->data);31403140 } else {31413141 if (frame->compressed)31423142 decompress(ov, frame, frame->rawdata, frame->data);···32263226 frame->rawwidth = ((int)(in[9]) + 1) * 8;32273227 frame->rawheight = ((int)(in[10]) + 1) * 8;3228322832293229- PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d",32293229+ PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d",32303230 ov->curframe, pnum, frame->rawwidth, frame->rawheight,32313231 frame->bytes_recvd);32323232···35273527 return;35283528 }3529352935303530- if (urb->status == -ENOENT || urb->status == -ECONNRESET) {35313531- PDEBUG(4, "URB unlinked");35323532- return;35333533- }35303530+ if (urb->status == -ENOENT || urb->status == -ECONNRESET) {35313531+ PDEBUG(4, "URB unlinked");35323532+ return;35333533+ }3534353435353535 if (urb->status != -EINPROGRESS && urb->status != 0) {35363536 err("ERROR: urb->status=%d: %s", urb->status,···46274627 PDEBUG(4, "mmap: %ld (%lX) bytes", size, size);4628462846294629 if (size > (((OV511_NUMFRAMES46304630- * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight)46314631- + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))))46304630+ * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight)46314631+ + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))))46324632 return -EINVAL;4633463346344634 if (mutex_lock_interruptible(&ov->lock))···50625062}5063506350645064/* This initializes the KS0127 and KS0127B video decoders. */50655065-static int 50655065+static int50665066ks0127_configure(struct usb_ov511 *ov)50675067{50685068 int rc;···51935193 return -1;5194519451955195 /* Detect version of decoder. This must be done after writing the51965196- * initial regs or the decoder will lock up. */51965196+ * initial regs or the decoder will lock up. */51975197 rc = i2c_r(ov, 0x00);5198519851995199 if (rc < 0) {···52165216}5217521752185218/* This initializes the OV511/OV511+ and the sensor */52195219-static int 52195219+static int52205220ov511_configure(struct usb_ov511 *ov)52215221{52225222 static struct ov511_regvals aRegvalsInit511[] = {52235223 { OV511_REG_BUS, R51x_SYS_RESET, 0x7f },52245224- { OV511_REG_BUS, R51x_SYS_INIT, 0x01 },52255225- { OV511_REG_BUS, R51x_SYS_RESET, 0x7f },52245224+ { OV511_REG_BUS, R51x_SYS_INIT, 0x01 },52255225+ { OV511_REG_BUS, R51x_SYS_RESET, 0x7f },52265226 { OV511_REG_BUS, R51x_SYS_INIT, 0x01 },52275227 { OV511_REG_BUS, R51x_SYS_RESET, 0x3f },52285228 { OV511_REG_BUS, R51x_SYS_INIT, 0x01 },···52695269 err("Please notify " EMAIL " of the name,");52705270 err("manufacturer, model, and this number of your camera.");52715271 err("Also include the output of the detection process.");52725272- } 52725272+ }5273527352745274 if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */52755275 ov->pal = 1;···5336533653375337 if (i2c_w(ov, 0x10, 0x00) < 0) {53385338 err("Can't determine sensor slave IDs");53395339- goto error;53395339+ goto error;53405340 } else {53415341 if (ks0127_configure(ov) < 0) {53425342 err("Failed to configure KS0127");53435343- goto error;53435343+ goto error;53445344 }53455345 }53465346 } else {53475347 if (saa7111a_configure(ov) < 0) {53485348 err("Failed to configure SAA7111A");53495349- goto error;53495349+ goto error;53505350 }53515351 }53525352 } else {···53565356 } else {53575357 if (ov6xx0_configure(ov) < 0) {53585358 err("Failed to configure OV6xx0");53595359- goto error;53595359+ goto error;53605360 }53615361 }53625362 } else {53635363 if (ov7xx0_configure(ov) < 0) {53645364 err("Failed to configure OV7xx0");53655365- goto error;53655365+ goto error;53665366 }53675367 }53685368···53815381 /* For 518 and 518+ */53825382 static struct ov511_regvals aRegvalsInit518[] = {53835383 { OV511_REG_BUS, R51x_SYS_RESET, 0x40 },53845384- { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },53855385- { OV511_REG_BUS, R51x_SYS_RESET, 0x3e },53845384+ { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },53855385+ { OV511_REG_BUS, R51x_SYS_RESET, 0x3e },53865386 { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },53875387 { OV511_REG_BUS, R51x_SYS_RESET, 0x00 },53885388 { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },53895389- { OV511_REG_BUS, 0x46, 0x00 }, 53895389+ { OV511_REG_BUS, 0x46, 0x00 },53905390 { OV511_REG_BUS, 0x5d, 0x03 },53915391 { OV511_DONE_BUS, 0x0, 0x00},53925392 };···5517551755185518 if (init_ov_sensor(ov) < 0) {55195519 err("Can't determine sensor slave IDs");55205520- goto error;55205520+ goto error;55215521 } else {55225522 err("Detected unsupported OV8xx0 sensor");55235523 goto error;···55255525 } else {55265526 if (ov6xx0_configure(ov) < 0) {55275527 err("Failed to configure OV6xx0");55285528- goto error;55285528+ goto error;55295529 }55305530 }55315531 } else {55325532 if (ov7xx0_configure(ov) < 0) {55335533 err("Failed to configure OV7xx0");55345534- goto error;55345534+ goto error;55355535 }55365536 }55375537···55645564{55655565 struct usb_ov511 *ov = cd_to_ov(cd);55665566 return sprintf(buf, "%d\n", ov->customid);55675567-} 55675567+}55685568static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL);5569556955705570static ssize_t show_model(struct class_device *cd, char *buf)55715571{55725572 struct usb_ov511 *ov = cd_to_ov(cd);55735573 return sprintf(buf, "%s\n", ov->desc);55745574-} 55745574+}55755575static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL);5576557655775577static ssize_t show_bridge(struct class_device *cd, char *buf)55785578{55795579 struct usb_ov511 *ov = cd_to_ov(cd);55805580 return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge));55815581-} 55815581+}55825582static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL);5583558355845584static ssize_t show_sensor(struct class_device *cd, char *buf)55855585{55865586 struct usb_ov511 *ov = cd_to_ov(cd);55875587 return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor));55885588-} 55885588+}55895589static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL);5590559055915591static ssize_t show_brightness(struct class_device *cd, char *buf)···55975597 return -ENODEV;55985598 sensor_get_brightness(ov, &x);55995599 return sprintf(buf, "%d\n", x >> 8);56005600-} 56005600+}56015601static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);5602560256035603static ssize_t show_saturation(struct class_device *cd, char *buf)···56095609 return -ENODEV;56105610 sensor_get_saturation(ov, &x);56115611 return sprintf(buf, "%d\n", x >> 8);56125612-} 56125612+}56135613static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);5614561456155615static ssize_t show_contrast(struct class_device *cd, char *buf)···56215621 return -ENODEV;56225622 sensor_get_contrast(ov, &x);56235623 return sprintf(buf, "%d\n", x >> 8);56245624-} 56245624+}56255625static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);5626562656275627static ssize_t show_hue(struct class_device *cd, char *buf)···56335633 return -ENODEV;56345634 sensor_get_hue(ov, &x);56355635 return sprintf(buf, "%d\n", x >> 8);56365636-} 56365636+}56375637static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);5638563856395639static ssize_t show_exposure(struct class_device *cd, char *buf)···56455645 return -ENODEV;56465646 sensor_get_exposure(ov, &exp);56475647 return sprintf(buf, "%d\n", exp >> 8);56485648-} 56485648+}56495649static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);5650565056515651static void ov_create_sysfs(struct video_device *vdev)
+4-4
drivers/media/video/ov511.h
···130130#define R511_COMP_QVY 0x76131131#define R511_COMP_QVUV 0x77132132#define R511_COMP_EN 0x78133133-#define R511_COMP_LUT_EN 0x79 133133+#define R511_COMP_LUT_EN 0x79134134#define R511_COMP_LUT_BEGIN 0x80135135136136/* --------------------------------- */···459459 int subh; /* Pix Array subcapture height */460460461461 int curframe; /* Current receiving sbuf */462462- struct ov511_frame frame[OV511_NUMFRAMES]; 462462+ struct ov511_frame frame[OV511_NUMFRAMES];463463464464 struct ov511_sbuf sbuf[OV511_NUMSBUF];465465466466 wait_queue_head_t wq; /* Processes waiting */467467468468 int snap_enabled; /* Snapshot mode enabled */469469-469469+470470 int bridge; /* Type of bridge (BRG_*) */471471 int bclass; /* Class of bridge (BCL_*) */472472 int sensor; /* Type of image sensor chip (SEN_*) */···512512/* Returns the name of the matching element in the symbolic_list array. The513513 * end of the list must be marked with an element that has a NULL name.514514 */515515-static inline char * 515515+static inline char *516516symbolic(struct symbolic_list list[], int num)517517{518518 int i;
···11-/* 11+/*22 planb - PlanB frame grabber driver3344 PlanB is used in the 7x00/8x00 series of PowerMacintosh···584584 wake_up_interruptible(&pb->suspendq);585585}586586587587-static void add_clip(struct planb *pb, struct video_clip *clip) 587587+static void add_clip(struct planb *pb, struct video_clip *clip)588588{589589 volatile unsigned char *base;590590 int xc = clip->x, yc = clip->y;···758758 PLANB_SET(CH_SYNC));759759 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),760760 PLANB_SET(DMA_ABORT));761761-761761+762762 /* odd field data: */763763 jump = virt_to_bus(c1 + nlines / 2);764764 for (i=1; i < nlines; i += stepsize, c1++)···12471247 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;12481248 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),12491249 PLANB_SET(DMA_ABORT));12501250-12501250+12511251 /* odd field data: */12521252 jump_addr = c1 + TAB_FACTOR * nlines / 2;12531253 jump = virt_to_bus(jump_addr);···13831383 pb->user++;1384138413851385 DEBUG("PlanB: device opened\n");13861386- return 0; 13861386+ return 0;13871387}1388138813891389static void planb_close(struct video_device *dev)···14241424static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)14251425{14261426 struct planb *pb=(struct planb *)dev;14271427-14271427+14281428 switch (cmd)14291429- { 14291429+ {14301430 case VIDIOCGCAP:14311431 {14321432 struct video_capability b;···14401440 b.channels = 2; /* composite & svhs */14411441 b.audios = 0;14421442 b.maxwidth = PLANB_MAXPIXELS;14431443- b.maxheight = PLANB_MAXLINES;14441444- b.minwidth = 32; /* wild guess */14451445- b.minheight = 32;14461446- if (copy_to_user(arg,&b,sizeof(b)))14471447- return -EFAULT;14431443+ b.maxheight = PLANB_MAXLINES;14441444+ b.minwidth = 32; /* wild guess */14451445+ b.minheight = 32;14461446+ if (copy_to_user(arg,&b,sizeof(b)))14471447+ return -EFAULT;14481448 return 0;14491449 }14501450 case VIDIOCSFBUF:14511451 {14521452- struct video_buffer v;14521452+ struct video_buffer v;14531453 unsigned short bpp;14541454 unsigned int fmt;1455145514561456 DEBUG("PlanB: IOCTL VIDIOCSFBUF\n");1457145714581458- if (!capable(CAP_SYS_ADMIN)14581458+ if (!capable(CAP_SYS_ADMIN)14591459 || !capable(CAP_SYS_RAWIO))14601460- return -EPERM;14611461- if (copy_from_user(&v, arg,sizeof(v)))14621462- return -EFAULT;14601460+ return -EPERM;14611461+ if (copy_from_user(&v, arg,sizeof(v)))14621462+ return -EFAULT;14631463 planb_lock(pb);14641464 switch(v.depth) {14651465 case 8:···14781478 break;14791479 default:14801480 planb_unlock(pb);14811481- return -EINVAL;14811481+ return -EINVAL;14821482 }14831483 if (bpp * v.width > v.bytesperline) {14841484 planb_unlock(pb);···14931493 pb->win.bpl = pb->win.bpp * pb->win.swidth;14941494 pb->win.pad = v.bytesperline - pb->win.bpl;1495149514961496- DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"14961496+ DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"14971497 " bpl %d (+ %d)\n", v.base, v.width,v.height,14981498 pb->win.bpp, pb->win.bpl, pb->win.pad);14991499···15041504 resume_overlay(pb);15051505 }15061506 planb_unlock(pb);15071507- return 0; 15071507+ return 0;15081508 }15091509 case VIDIOCGFBUF:15101510 {15111511- struct video_buffer v;15111511+ struct video_buffer v;1512151215131513 DEBUG("PlanB: IOCTL VIDIOCGFBUF\n");15141514···15181518 v.depth = pb->win.depth;15191519 v.bytesperline = pb->win.bpl + pb->win.pad;15201520 if (copy_to_user(arg, &v, sizeof(v)))15211521- return -EFAULT;15211521+ return -EFAULT;15221522 return 0;15231523 }15241524 case VIDIOCCAPTURE:15251525 {15261526 int i;1527152715281528- if(copy_from_user(&i, arg, sizeof(i)))15291529- return -EFAULT;15281528+ if(copy_from_user(&i, arg, sizeof(i)))15291529+ return -EFAULT;15301530 if(i==0) {15311531 DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n");15321532···16951695 struct video_window vw;16961696 struct video_clip clip;16971697 int i;16981698-16981698+16991699 DEBUG("PlanB: IOCTL VIDIOCSWIN\n");1700170017011701 if(copy_from_user(&vw,arg,sizeof(vw)))···17491749 return -EFAULT;17501750 return 0;17511751 }17521752- case VIDIOCSYNC: {17521752+ case VIDIOCSYNC: {17531753 int i;1754175417551755 IDEBUG("PlanB: IOCTL VIDIOCSYNC\n");···1759175917601760 IDEBUG("PlanB: sync to frame %d\n", i);1761176117621762- if(i > (MAX_GBUFFERS - 1) || i < 0)17631763- return -EINVAL;17621762+ if(i > (MAX_GBUFFERS - 1) || i < 0)17631763+ return -EINVAL;17641764chk_grab:17651765- switch (pb->frame_stat[i]) {17661766- case GBUFFER_UNUSED:17671767- return -EINVAL;17651765+ switch (pb->frame_stat[i]) {17661766+ case GBUFFER_UNUSED:17671767+ return -EINVAL;17681768 case GBUFFER_GRABBING:17691769 IDEBUG("PlanB: waiting for grab"17701770 " done (%d)\n", i);17711771- interruptible_sleep_on(&pb->capq);17711771+ interruptible_sleep_on(&pb->capq);17721772 if(signal_pending(current))17731773 return -EINTR;17741774 goto chk_grab;17751775- case GBUFFER_DONE:17761776- pb->frame_stat[i] = GBUFFER_UNUSED;17771777- break;17781778- }17791779- return 0;17751775+ case GBUFFER_DONE:17761776+ pb->frame_stat[i] = GBUFFER_UNUSED;17771777+ break;17781778+ }17791779+ return 0;17801780 }1781178117821782- case VIDIOCMCAPTURE:17821782+ case VIDIOCMCAPTURE:17831783 {17841784- struct video_mmap vm;17841784+ struct video_mmap vm;17851785 volatile unsigned int status;1786178617871787 IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n");1788178817891789 if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm)))17901790 return -EFAULT;17911791- status = pb->frame_stat[vm.frame];17921792- if (status != GBUFFER_UNUSED)17931793- return -EBUSY;17911791+ status = pb->frame_stat[vm.frame];17921792+ if (status != GBUFFER_UNUSED)17931793+ return -EBUSY;1794179417951795- return vgrab(pb, &vm);17951795+ return vgrab(pb, &vm);17961796 }17971797-17971797+17981798 case VIDIOCGMBUF:17991799 {18001800 int i;···18111811 return -EFAULT;18121812 return 0;18131813 }18141814-18141814+18151815 case PLANBIOCGSAAREGS:18161816 {18171817 struct planb_saa_regs preg;···18281828 return -EFAULT;18291829 return 0;18301830 }18311831-18311831+18321832 case PLANBIOCSSAAREGS:18331833 {18341834 struct planb_saa_regs preg;···18421842 saa_set (preg.addr, preg.val, pb);18431843 return 0;18441844 }18451845-18451845+18461846 case PLANBIOCGSTAT:18471847 {18481848 struct planb_stat_regs pstat;···18591859 return -EFAULT;18601860 return 0;18611861 }18621862-18621862+18631863 case PLANBIOCSMODE: {18641864 int v;18651865···19851985{19861986 int i;19871987 struct planb *pb = (struct planb *)dev;19881988- unsigned long start = (unsigned long)adr;19881988+ unsigned long start = (unsigned long)adr;1989198919901990 if (size > MAX_GBUFFERS * PLANB_MAX_FBUF)19911991- return -EINVAL;19911991+ return -EINVAL;19921992 if (!pb->rawbuf) {19931993 int err;19941994 if((err=grabbuf_alloc(pb)))···20912091 /* clear interrupt mask */20922092 pb->intr_mask = PLANB_CLR_IRQ;2093209320942094- result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb);20952095- if (result < 0) {20962096- if (result==-EINVAL)20972097- printk(KERN_ERR "PlanB: Bad irq number (%d) "20942094+ result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb);20952095+ if (result < 0) {20962096+ if (result==-EINVAL)20972097+ printk(KERN_ERR "PlanB: Bad irq number (%d) "20982098 "or handler\n", (int)pb->irq);20992099 else if (result==-EBUSY)21002100 printk(KERN_ERR "PlanB: I don't know why, "···21022102 return result;21032103 }21042104 disable_irq(pb->irq);21052105-21052105+21062106 /* Now add the template and register the device unit. */21072107 memcpy(&pb->video_dev,&planb_template,sizeof(planb_template));21082108···21432143}2144214421452145/*21462146- * Scan for a PlanB controller, request the irq and map the io memory 21462146+ * Scan for a PlanB controller, request the irq and map the io memory21472147 */2148214821492149static int find_planb(void)···21712171 pb = &planbs[0];21722172 planb_num = 1;2173217321742174- if (planb_devices->n_addrs != 1) {21752175- printk (KERN_WARNING "PlanB: expecting 1 address for planb "21762176- "(got %d)", planb_devices->n_addrs);21742174+ if (planb_devices->n_addrs != 1) {21752175+ printk (KERN_WARNING "PlanB: expecting 1 address for planb "21762176+ "(got %d)", planb_devices->n_addrs);21772177 return 0;21782178 }21792179···22362236 pb->planb_base = planb_regs;22372237 pb->planb_base_phys = (struct planb_registers *)new_base;22382238 pb->irq = irq;22392239-22392239+22402240 return planb_num;2241224122422242err_out_disable:···22512251 int i;22522252 struct planb *pb;2253225322542254- for (i=0;i<planb_num; i++) 22542254+ for (i=0;i<planb_num; i++)22552255 {22562256 pb=&planbs[i];22572257···22782278static int __init init_planbs(void)22792279{22802280 int i;22812281-22812281+22822282 if (find_planb()<=0)22832283 return -EIO;22842284···22882288 " with v4l\n", i);22892289 release_planb();22902290 return -EIO;22912291- } 22912291+ }22922292 printk(KERN_INFO "PlanB: registered device %d with v4l\n", i);22932293- } 22932293+ }22942294 return 0;22952295}22962296
+3-3
drivers/media/video/planb.h
···11-/* 11+/*22 planb - PlanB frame grabber driver3344 PlanB is used in the 7x00/8x00 series of PowerMacintosh···167167 struct video_device video_dev;168168 struct video_picture picture; /* Current picture params */169169 struct video_audio audio_dev; /* Current audio params */170170-170170+171171 volatile struct planb_registers *planb_base; /* virt base of planb */172172 struct planb_registers *planb_base_phys; /* phys base of planb */173173 void *priv_space; /* Org. alloc. mem for kfree */···209209 int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS];210210 unsigned int gfmt[MAX_GBUFFERS];211211 int gnorm_switch[MAX_GBUFFERS];212212- volatile unsigned int *frame_stat;212212+ volatile unsigned int *frame_stat;213213#define GBUFFER_UNUSED 0x00U214214#define GBUFFER_GRABBING 0x01U215215#define GBUFFER_DONE 0x02U
+68-68
drivers/media/video/pms.c
···1212 * Most of this code is directly derived from his userspace driver.1313 * His driver works so send any reports to alan@redhat.com unless the1414 * userspace driver also doesn't work for you...1515- * 1515+ *1616 * Changes:1717 * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it>1818- * - pms_capture: report back -EFAULT 1818+ * - pms_capture: report back -EFAULT1919 */20202121#include <linux/module.h>···6666/*6767 * I/O ports and Shared Memory6868 */6969-6969+7070static int io_port = 0x250;7171static int data_port = 0x251;7272static int mem_base = 0xC8000;7373static void __iomem *mem;7474static int video_nr = -1;75757676-7676+77777878static inline void mvv_write(u8 index, u8 value)7979{···9090{9191 int counter;9292 int i;9393-9393+9494 outb(0x28, io_port);9595-9595+9696 counter=0;9797 while((inb(data_port)&0x01)==0)9898 if(counter++==256)···101101 while((inb(data_port)&0x01)!=0)102102 if(counter++==256)103103 break;104104-104104+105105 outb(slave, io_port);106106-106106+107107 counter=0;108108 while((inb(data_port)&0x01)==0)109109 if(counter++==256)···112112 while((inb(data_port)&0x01)!=0)113113 if(counter++==256)114114 break;115115-115115+116116 for(i=0;i<12;i++)117117 {118118 char st=inb(data_port);···122122 break;123123 }124124 outb(0x29, io_port);125125- return inb(data_port); 125125+ return inb(data_port);126126}127127128128static int pms_i2c_write(u16 slave, u16 sub, u16 data)···130130 int skip=0;131131 int count;132132 int i;133133-133133+134134 for(i=0;i<i2c_count;i++)135135 {136136 if((i2cinfo[i].slave==slave) &&137137 (i2cinfo[i].sub == sub))138138 {139139- if(i2cinfo[i].data==data)140140- skip=1;141141- i2cinfo[i].data=data;142142- i=i2c_count+1;139139+ if(i2cinfo[i].data==data)140140+ skip=1;141141+ i2cinfo[i].data=data;142142+ i=i2c_count+1;143143 }144144 }145145-145145+146146 if(i==i2c_count && i2c_count<64)147147 {148148 i2cinfo[i2c_count].slave=slave;···150150 i2cinfo[i2c_count].data=data;151151 i2c_count++;152152 }153153-153153+154154 if(skip)155155 return 0;156156-156156+157157 mvv_write(0x29, sub);158158 mvv_write(0x2A, data);159159 mvv_write(0x28, slave);160160-160160+161161 outb(0x28, io_port);162162-162162+163163 count=0;164164 while((inb(data_port)&1)==0)165165 if(count>255)···167167 while((inb(data_port)&1)!=0)168168 if(count>255)169169 break;170170-170170+171171 count=inb(data_port);172172-172172+173173 if(count&2)174174 return -1;175175 return count;···189189190190static void pms_i2c_andor(int slave, int sub, int and, int or)191191{192192- u8 tmp; 193193-192192+ u8 tmp;193193+194194 tmp=pms_i2c_read(slave, sub);195195 tmp = (tmp&and)|or;196196 pms_i2c_write(slave, sub, tmp);···199199/*200200 * Control functions201201 */202202-202202+203203204204static void pms_videosource(short source)205205{···234234 break;235235 }236236}237237-238238-237237+238238+239239static void pms_contrast(short contrast)240240{241241 switch(decoder)···269269{270270 int target;271271 standard = format;272272-272272+273273 if(decoder==PHILIPS1)274274 target=0x42;275275 else if(decoder==PHILIPS2)276276 target=0x8A;277277 else278278 return;279279-279279+280280 switch(format)281281 {282282 case 0: /* Auto */···302302303303/*304304 * These features of the PMS card are not currently exposes. They305305- * could become a private v4l ioctl for PMSCONFIG or somesuch if 305305+ * could become a private v4l ioctl for PMSCONFIG or somesuch if306306 * people need it. We also don't yet use the PMS interrupt.307307 */308308···324324/*325325 * Bandpass filters326326 */327327-327327+328328static void pms_bandpass(short pass)329329{330330 if(decoder==PHILIPS2)···493493/*494494 * Turn 16bit ratios into best small ratio the chipset can grok495495 */496496-496496+497497static void pms_vertdeci(unsigned short decinum, unsigned short deciden)498498{499499 /* Knock it down by /5 once */···546546 decinum=512;547547 deciden=640; /* 768 would be ideal */548548 }549549-549549+550550 while(((decinum|deciden)&1)==0)551551 {552552 decinum>>=1;···559559 }560560 if(deciden==32)561561 deciden--;562562-562562+563563 mvv_write(0x24, 0x80|deciden);564564 mvv_write(0x25, decinum);565565}···567567static void pms_resolution(short width, short height)568568{569569 int fg_height;570570-570570+571571 fg_height=height;572572 if(fg_height>280)573573 fg_height=280;574574-574574+575575 mvv_write(0x18, fg_height);576576 mvv_write(0x19, fg_height>>8);577577-577577+578578 if(standard==1)579579 {580580 mvv_write(0x1A, 0xFC);···598598 mvv_write(0x42, 0x00);599599 mvv_write(0x43, 0x00);600600 mvv_write(0x44, MVVMEMORYWIDTH);601601-601601+602602 mvv_write(0x22, width+8);603603 mvv_write(0x23, (width+8)>> 8);604604···618618/*619619 * Set Input620620 */621621-621621+622622static void pms_vcrinput(short input)623623{624624 if(decoder==PHILIPS2)···643643 mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */644644645645/* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */646646-647647- for (y = 0; y < dev->height; y++ ) 646646+647647+ for (y = 0; y < dev->height; y++ )648648 {649649 writeb(0, mem); /* synchronisiert neue Zeile */650650-650650+651651 /*652652 * This is in truth a fifo, be very careful as if you653653 * forgot this odd things will occur 8)654654 */655655-655655+656656 memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */657657 cnt -= dev->height;658658- while (cnt <= 0) 659659- { 658658+ while (cnt <= 0)659659+ {660660 /*661661 * Don't copy too far662662 */···666666 cnt += dev->height;667667 if (copy_to_user(buf, tmp+32, dt))668668 return len ? len : -EFAULT;669669- buf += dt; 669669+ buf += dt;670670 len += dt;671671 }672672 }···683683{684684 struct video_device *dev = video_devdata(file);685685 struct pms_device *pd=(struct pms_device *)dev;686686-686686+687687 switch(cmd)688688 {689689 case VIDIOCGCAP:···806806 ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15)))807807 return -EINVAL;808808 pd->picture= *p;809809-809809+810810 /*811811 * Now load the card.812812 */···815815 pms_brightness(p->brightness>>8);816816 pms_hue(p->hue>>8);817817 pms_colour(p->colour>>8);818818- pms_contrast(p->contrast>>8); 818818+ pms_contrast(p->contrast>>8);819819 mutex_unlock(&pd->lock);820820 return 0;821821 }···873873 struct video_device *v = video_devdata(file);874874 struct pms_device *pd=(struct pms_device *)v;875875 int len;876876-876876+877877 mutex_lock(&pd->lock);878878 len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count);879879 mutex_unlock(&pd->lock);···905905/*906906 * Probe for and initialise the Mediavision PMS907907 */908908-908908+909909static int init_mediavision(void)910910{911911 int id;912912 int idec, decst;913913 int i;914914-914914+915915 unsigned char i2c_defs[]={916916 0x4C,0x30,0x00,0xE8,917917 0xB6,0xE2,0x00,0x00,···925925 mem = ioremap(mem_base, 0x800);926926 if (!mem)927927 return -ENOMEM;928928-928928+929929 if (!request_region(0x9A01, 1, "Mediavision PMS config"))930930 {931931 printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n");···941941 }942942 outb(0xB8, 0x9A01); /* Unlock */943943 outb(io_port>>4, 0x9A01); /* Set IO port */944944-945945-944944+945945+946946 id=mvv_read(3);947947 decst=pms_i2c_stat(0x43);948948-948948+949949 if(decst!=-1)950950 idec=2;951951 else if(pms_i2c_stat(0xb9)!=-1)952952 idec=3;953953 else if(pms_i2c_stat(0x8b)!=-1)954954 idec=1;955955- else 955955+ else956956 idec=0;957957958958 printk(KERN_INFO "PMS type is %d\n", idec);···966966 /*967967 * Ok we have a PMS of some sort968968 */969969-969969+970970 mvv_write(0x04, mem_base>>12); /* Set the memory area */971971-971971+972972 /* Ok now load the defaults */973973-973973+974974 for(i=0;i<0x19;i++)975975 {976976 if(i2c_defs[i]==0xFF)···978978 else979979 pms_i2c_write(0x8A, i, i2c_defs[i]);980980 }981981-981981+982982 pms_i2c_write(0xB8,0x00,0x12);983983 pms_i2c_write(0xB8,0x04,0x00);984984 pms_i2c_write(0xB8,0x07,0x00);···987987 pms_i2c_write(0xB8,0x0A,0x00);988988 pms_i2c_write(0xB8,0x0B,0x10);989989 pms_i2c_write(0xB8,0x10,0x03);990990-990990+991991 mvv_write(0x01, 0x00);992992 mvv_write(0x05, 0xA0);993993 mvv_write(0x08, 0x25);994994 mvv_write(0x09, 0x00);995995- mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); 996996-995995+ mvv_write(0x0A, 0x20|MVVMEMORYWIDTH);996996+997997 mvv_write(0x10, 0x02);998998 mvv_write(0x1E, 0x0C);999999 mvv_write(0x1F, 0x03);10001000 mvv_write(0x26, 0x06);10011001-10011001+10021002 mvv_write(0x2B, 0x00);10031003 mvv_write(0x2C, 0x20);10041004 mvv_write(0x2D, 0x00);···10181018/*10191019 * Initialization and module stuff10201020 */10211021-10211021+10221022static int __init init_pms_cards(void)10231023{10241024 printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n");10251025-10251025+10261026 data_port = io_port +1;10271027-10271027+10281028 if(init_mediavision())10291029 {10301030 printk(KERN_INFO "Board not found.\n");
···4747size4848 Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or4949 'vga', for an image size of resp. 128x96, 160x120, 176x144,5050- 320x240, 352x288 and 640x480 (of course, only for those cameras that 5050+ 320x240, 352x288 and 640x480 (of course, only for those cameras that5151 support these resolutions).52525353fps5454 Specifies the desired framerate. Is an integer in the range of 4-30.55555656fbufs5757- This paramter specifies the number of internal buffers to use for storing 5858- frames from the cam. This will help if the process that reads images from 5959- the cam is a bit slow or momentarely busy. However, on slow machines it 6060- only introduces lag, so choose carefully. The default is 3, which is 5757+ This paramter specifies the number of internal buffers to use for storing5858+ frames from the cam. This will help if the process that reads images from5959+ the cam is a bit slow or momentarely busy. However, on slow machines it6060+ only introduces lag, so choose carefully. The default is 3, which is6161 reasonable. You can set it between 2 and 5.62626363mbufs···6565 buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends.6666 The default is 2, which is adequate for most applications (double6767 buffering).6868-6868+6969 Should you experience a lot of 'Dumping frame...' messages during7070- grabbing with a tool that uses mmap(), you might want to increase if. 7070+ grabbing with a tool that uses mmap(), you might want to increase if.7171 However, it doesn't really buffer images, it just gives you a bit more7272 slack when your program is behind. But you need a multi-threaded or7373 forked program to really take advantage of these buffers.···88888989compression (only useful with the plugin)9090 With this option you can control the compression factor that the camera9191- uses to squeeze the image through the USB bus. You can set the 9191+ uses to squeeze the image through the USB bus. You can set the9292 parameter between 0 and 3:9393 0 = prefer uncompressed images; if the requested mode is not available9494- in an uncompressed format, the driver will silently switch to low9595- compression.9494+ in an uncompressed format, the driver will silently switch to low9595+ compression.9696 1 = low compression.9797 2 = medium compression.9898 3 = high compression.9999-9999+100100 High compression takes less bandwidth of course, but it could also101101 introduce some unwanted artefacts. The default is 2, medium compression.102102 See the FAQ on the website for an overview of which modes require···112112 this is let the LED blink while the camera is in use. This:113113114114 leds=500,500115115-115115+116116 will blink the LED once every second. But with:117117118118 leds=0,0···123123 when the camera is not used anymore.124124125125 This parameter works only with the ToUCam range of cameras (720, 730, 740,126126- 750) and OEMs. For other cameras this command is silently ignored, and 126126+ 750) and OEMs. For other cameras this command is silently ignored, and127127 the LED cannot be controlled.128128129129 Finally: this parameters does not take effect UNTIL the first time you···144144 format:145145146146 [type[.serialnumber]:]node147147-147147+148148 The square brackets mean that both the type and the serialnumber are149149 optional, but a serialnumber cannot be specified without a type (which150150 would be rather pointless). The serialnumber is separated from the type151151 by a '.'; the node number by a ':'.152152-152152+153153 This somewhat cryptic syntax is best explained by a few examples:154154155155 dev_hint=3,5 The first detected cam gets assigned156156- /dev/video3, the second /dev/video5. Any157157- other cameras will get the first free 158158- available slot (see below).156156+ /dev/video3, the second /dev/video5. Any157157+ other cameras will get the first free158158+ available slot (see below).159159160160 dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1,161161- and a PCVC680 /dev/video2.162162-163163- dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber 164164- 0123 goes to /dev/video3, the same165165- camera model with the 4567 serial166166- gets /dev/video0.161161+ and a PCVC680 /dev/video2.167162168168- dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the 169169- next 3 Philips cams will use /dev/video4 170170- through /dev/video6.163163+ dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber164164+ 0123 goes to /dev/video3, the same165165+ camera model with the 4567 serial166166+ gets /dev/video0.167167+168168+ dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the169169+ next 3 Philips cams will use /dev/video4170170+ through /dev/video6.171171172172 Some points worth knowing:173173- - Serialnumbers are case sensitive and must be written full, including 173173+ - Serialnumbers are case sensitive and must be written full, including174174 leading zeroes (it's treated as a string).175175- - If a device node is already occupied, registration will fail and 175175+ - If a device node is already occupied, registration will fail and176176 the webcam is not available.177177 - You can have up to 64 video devices; be sure to make enough device178178 nodes in /dev if you want to spread the numbers (this does not apply···186186 kernel log at debug level.187187188188 The trace variable is a bitmask; each bit represents a certain feature.189189- If you want to trace something, look up the bit value(s) in the table 189189+ If you want to trace something, look up the bit value(s) in the table190190 below, add the values together and supply that to the trace variable.191191192192 Value Value Description Default193193 (dec) (hex)194194 1 0x1 Module initialization; this will log messages On195195- while loading and unloading the module195195+ while loading and unloading the module196196197197 2 0x2 probe() and disconnect() traces On198198···203203 16 0x10 Memory allocation of buffers, etc. Off204204205205 32 0x20 Showing underflow, overflow and Dumping frame On206206- messages206206+ messages207207208208 64 0x40 Show viewport and image sizes Off209209···217217218218219219Example:220220-220220+221221 # modprobe pwc size=cif fps=15 power_save=1222222223223The fbufs, mbufs and trace parameters are global and apply to all connected
+185-185
drivers/media/video/pwc/pwc-ctrl.c
···31313232/*3333 Changes3434- 2001/08/03 Alvarado Added methods for changing white balance and 3535- red/green gains3434+ 2001/08/03 Alvarado Added methods for changing white balance and3535+ red/green gains3636 */37373838/* Control functions for the cam; brightness, contrast, video mode, etc. */39394040#ifdef __KERNEL__4141-#include <asm/uaccess.h> 4141+#include <asm/uaccess.h>4242#endif4343#include <asm/errno.h>4444-4444+4545#include "pwc.h"4646#include "pwc-ioctl.h"4747#include "pwc-uncompress.h"···116116 "SIF",117117 "CIF",118118 "VGA",119119-}; 119119+};120120121121/********/122122123123-/* Entries for the Nala (645/646) camera; the Nala doesn't have compression 123123+/* Entries for the Nala (645/646) camera; the Nala doesn't have compression124124 preferences, so you either get compressed or non-compressed streams.125125-125125+126126 An alternate value of 0 means this mode is not available at all.127127 */128128···205205 { /* closest match of framerate */206206 0, 0, 0, 0, 4, /* 0-4 */207207 5, 5, 7, 7, 10, /* 5-9 */208208- 10, 10, 12, 12, 15, /* 10-14 */209209- 15, 15, 15, 20, 20, /* 15-19 */210210- 20, 20, 20, 24, 24, /* 20-24 */211211- 24, 24, 24, 24, 24, /* 25-29 */212212- 24 /* 30 */208208+ 10, 10, 12, 12, 15, /* 10-14 */209209+ 15, 15, 15, 20, 20, /* 15-19 */210210+ 20, 20, 20, 24, 24, /* 20-24 */211211+ 24, 24, 24, 24, 24, /* 25-29 */212212+ 24 /* 30 */213213 };214214- int frames2table[31] = 214214+ int frames2table[31] =215215 { 0, 0, 0, 0, 0, /* 0-4 */216216 1, 1, 1, 2, 2, /* 5-9 */217217 3, 3, 4, 4, 4, /* 10-14 */···220220 7, 7, 7, 7, 7, /* 25-29 */221221 7 /* 30 */222222 };223223-223223+224224 if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25)225225 return -EINVAL;226226 frames = frames2frames[frames];···232232 if (pEntry->compressed)233233 return -ENOENT; /* Not supported. */234234235235- memcpy(buf, pEntry->mode, 3); 235235+ memcpy(buf, pEntry->mode, 3);236236 ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3);237237 if (ret < 0) {238238 Debug("Failed to send video command... %d\n", ret);···257257 break;258258 }259259 }260260-260260+261261 pdev->cmd_len = 3;262262 memcpy(pdev->cmd_buf, buf, 3);263263···352352 /* special case: VGA @ 5 fps and snapshot is raw bayer mode */353353 if (size == PSZ_VGA && frames == 5 && snapshot)354354 {355355- /* Only available in case the raw palette is selected or 356356- we have the decompressor available. This mode is 357357- only available in compressed form 355355+ /* Only available in case the raw palette is selected or356356+ we have the decompressor available. This mode is357357+ only available in compressed form358358 */359359 if (pdev->vpalette == VIDEO_PALETTE_RAW)360360 {361361- Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);361361+ Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);362362 pChoose = &RawEntry;363363 }364364 else···368368 }369369 else370370 {371371- /* Find a supported framerate with progressively higher compression ratios371371+ /* Find a supported framerate with progressively higher compression ratios372372 if the preferred ratio is not available.373373- Skip this step when using RAW modes.373373+ Skip this step when using RAW modes.374374 */375375 while (compression <= 3) {376376 pChoose = &Kiara_table[size][fps][compression];···383383 return -ENOENT; /* Not supported. */384384385385 Debug("Using alternate setting %d.\n", pChoose->alternate);386386-386386+387387 /* usb_control_msg won't take staticly allocated arrays as argument?? */388388 memcpy(buf, pChoose->mode, 12);389389 if (snapshot)···463463 */464464int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot)465465{466466- int ret, size;466466+ int ret, size;467467468468- Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);468468+ Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);469469 size = pwc_decode_size(pdev, width, height);470470 if (size < 0) {471471 Debug("Could not find suitable size.\n");···473473 }474474 Debug("decode_size = %d.\n", size);475475476476- ret = -EINVAL;476476+ ret = -EINVAL;477477 switch(pdev->type) {478478 case 645:479479 case 646:···485485 case 690:486486 ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot);487487 break;488488-488488+489489 case 720:490490 case 730:491491 case 740:···517517 char buf;518518 int ret;519519520520- ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); 520520+ ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1);521521 if (ret < 0)522522 return ret;523523 return buf << 9;···566566{567567 char buf;568568 int ret;569569-569569+570570 ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1);571571 if (ret < 0)572572 return ret;···622622{623623 char buf;624624 int ret;625625-625625+626626 if (mode)627627 buf = 0x0; /* auto */628628 else629629 buf = 0xff; /* fixed */630630631631 ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1);632632-632632+633633 if (!mode && ret >= 0) {634634 if (value < 0)635635 value = 0;···647647{648648 unsigned char buf;649649 int ret;650650-650650+651651 ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1);652652 if (ret < 0)653653 return ret;···658658 return ret;659659 if (buf > 0x3F)660660 buf = 0x3F;661661- *value = (buf << 10); 661661+ *value = (buf << 10);662662 }663663 else { /* auto */664664 ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1);···683683 buf[0] = 0x0; /* auto */684684 else685685 buf[0] = 0xff; /* fixed */686686-686686+687687 ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1);688688689689 if (!mode && ret >= 0) {···713713 ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2);714714 }715715 return ret;716716-} 716716+}717717718718719719/* POWER */···765765 * 02: fluorescent lighting766766 * 03: manual767767 * 04: auto768768- */ 768768+ */769769static inline int pwc_set_awb(struct pwc_device *pdev, int mode)770770{771771 char buf;772772 int ret;773773-773773+774774 if (mode < 0)775775 mode = 0;776776-776776+777777 if (mode > 4)778778 mode = 4;779779-779779+780780 buf = mode & 0x07; /* just the lowest three bits */781781-781781+782782 ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1);783783-783783+784784 if (ret < 0)785785 return ret;786786 return 0;···790790{791791 unsigned char buf;792792 int ret;793793-793793+794794 ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1);795795796796- if (ret < 0) 796796+ if (ret < 0)797797 return ret;798798 return buf;799799}800800801801static inline int pwc_set_red_gain(struct pwc_device *pdev, int value)802802{803803- unsigned char buf;803803+ unsigned char buf;804804805805 if (value < 0)806806 value = 0;···815815{816816 unsigned char buf;817817 int ret;818818-818818+819819 ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1);820820 if (ret < 0)821821 return ret;···841841{842842 unsigned char buf;843843 int ret;844844-844844+845845 ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1);846846 if (ret < 0)847847 return ret;···851851852852853853/* The following two functions are different, since they only read the854854- internal red/blue gains, which may be different from the manual 854854+ internal red/blue gains, which may be different from the manual855855 gains set or read above.856856- */ 856856+ */857857static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value)858858{859859 unsigned char buf;860860 int ret;861861-861861+862862 ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1);863863 if (ret < 0)864864 return ret;···870870{871871 unsigned char buf;872872 int ret;873873-873873+874874 ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1);875875 if (ret < 0)876876 return ret;···882882static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed)883883{884884 unsigned char buf;885885-885885+886886 /* useful range is 0x01..0x20 */887887 buf = speed / 0x7f0;888888 return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);···892892{893893 unsigned char buf;894894 int ret;895895-895895+896896 ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);897897 if (ret < 0)898898 return ret;···904904static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay)905905{906906 unsigned char buf;907907-907907+908908 /* useful range is 0x01..0x3F */909909 buf = (delay >> 10);910910 return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);···914914{915915 unsigned char buf;916916 int ret;917917-917917+918918 ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);919919 if (ret < 0)920920 return ret;···950950{951951 unsigned char buf[2];952952 int ret;953953-953953+954954 if (pdev->type < 730) {955955 *on_value = -1;956956 *off_value = -1;···969969{970970 unsigned char buf;971971 int ret;972972-972972+973973 if (contour < 0)974974 buf = 0xff; /* auto contour on */975975 else···977977 ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);978978 if (ret < 0)979979 return ret;980980-980980+981981 if (contour < 0)982982 return 0;983983 if (contour > 0xffff)984984 contour = 0xffff;985985-985985+986986 buf = (contour >> 10); /* contour preset is [0..3f] */987987 ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);988988- if (ret < 0) 989989- return ret; 988988+ if (ret < 0)989989+ return ret;990990 return 0;991991}992992···994994{995995 unsigned char buf;996996 int ret;997997-997997+998998 ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);999999 if (ret < 0)10001000 return ret;···10021002 if (buf == 0) {10031003 /* auto mode off, query current preset value */10041004 ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);10051005- if (ret < 0) 10051005+ if (ret < 0)10061006 return ret;10071007 *contour = buf << 10;10081008 }···10151015static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight)10161016{10171017 unsigned char buf;10181018-10181018+10191019 if (backlight)10201020 buf = 0xff;10211021 else···10271027{10281028 int ret;10291029 unsigned char buf;10301030-10301030+10311031 ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1);10321032 if (ret < 0)10331033 return ret;···10391039static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker)10401040{10411041 unsigned char buf;10421042-10421042+10431043 if (flicker)10441044 buf = 0xff;10451045 else···10511051{10521052 int ret;10531053 unsigned char buf;10541054-10541054+10551055 ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1);10561056 if (ret < 0)10571057 return ret;···10761076{10771077 int ret;10781078 unsigned char buf;10791079-10791079+10801080 ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1);10811081 if (ret < 0)10821082 return ret;···10871087static int pwc_mpt_reset(struct pwc_device *pdev, int flags)10881088{10891089 unsigned char buf;10901090-10901090+10911091 buf = flags & 0x03; // only lower two bits are currently used10921092 return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1);10931093}···10951095static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)10961096{10971097 unsigned char buf[4];10981098-10981098+10991099 /* set new relative angle; angles are expressed in degrees * 100,11001100 but cam as .5 degree resolution, hence divide by 200. Also11011101 the angle must be multiplied by 64 before it's send to···11141114{11151115 int ret;11161116 unsigned char buf[5];11171117-11171117+11181118 ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5);11191119 if (ret < 0)11201120 return ret;···11291129{11301130 unsigned char buf;11311131 int ret = -1, request;11321132-11321132+11331133 if (pdev->type < 675)11341134 request = SENSOR_TYPE_FORMATTER1;11351135 else if (pdev->type < 730)11361136 return -1; /* The Vesta series doesn't have this call */11371137 else11381138 request = SENSOR_TYPE_FORMATTER2;11391139-11391139+11401140 ret = RecvControlMsg(GET_STATUS_CTL, request, 1);11411141 if (ret < 0)11421142 return ret;···11631163 ret = -EINVAL;11641164 break;11651165 }11661166-11661166+11671167 case VIDIOCPWCSUSER:11681168 {11691169 if (pwc_save_user(pdev))11701170 ret = -EINVAL;11711171 break;11721172 }11731173-11731173+11741174 case VIDIOCPWCFACTORY:11751175 {11761176 if (pwc_restore_factory(pdev))11771177 ret = -EINVAL;11781178 break;11791179 }11801180-11801180+11811181 case VIDIOCPWCSCQUAL:11821182- { 11821182+ {11831183 int *qual = arg;1184118411851185 if (*qual < 0 || *qual > 3)···11901190 pdev->vcompression = *qual;11911191 break;11921192 }11931193-11931193+11941194 case VIDIOCPWCGCQUAL:11951195 {11961196 int *qual = arg;11971197 *qual = pdev->vcompression;11981198 break;11991199 }12001200-12001200+12011201 case VIDIOCPWCPROBE:12021202 {12031203 struct pwc_probe *probe = arg;···12201220 ret = -EINVAL;12211221 break;12221222 }12231223-12231223+12241224 case VIDIOCPWCGAGC:12251225 {12261226 int *agc = arg;12271227-12271227+12281228 if (pwc_get_agc(pdev, agc))12291229 ret = -EINVAL;12301230 break;12311231 }12321232-12321232+12331233 case VIDIOCPWCSSHUTTER:12341234 {12351235 int *shutter_speed = arg;12361236 ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed);12371237 break;12381238 }12391239-12401240- case VIDIOCPWCSAWB:12391239+12401240+ case VIDIOCPWCSAWB:12411241 {12421242 struct pwc_whitebalance *wb = arg;12431243-12431243+12441244 ret = pwc_set_awb(pdev, wb->mode);12451245 if (ret >= 0 && wb->mode == PWC_WB_MANUAL) {12461246 pwc_set_red_gain(pdev, wb->manual_red);···12701270 ret = pwc_read_red_gain(pdev, &wb->read_red);12711271 if (ret < 0)12721272 break;12731273- ret = pwc_read_blue_gain(pdev, &wb->read_blue);12741274- if (ret < 0)12751275- break;12731273+ ret = pwc_read_blue_gain(pdev, &wb->read_blue);12741274+ if (ret < 0)12751275+ break;12761276 }12771277 }12781278 break;12791279 }12801280-12801280+12811281 case VIDIOCPWCSAWBSPEED:12821282 {12831283 struct pwc_wb_speed *wbs = arg;12841284-12841284+12851285 if (wbs->control_speed > 0) {12861286 ret = pwc_set_wb_speed(pdev, wbs->control_speed);12871287 }···12901290 }12911291 break;12921292 }12931293-12931293+12941294 case VIDIOCPWCGAWBSPEED:12951295 {12961296 struct pwc_wb_speed *wbs = arg;12971297-12971297+12981298 ret = pwc_get_wb_speed(pdev, &wbs->control_speed);12991299 if (ret < 0)13001300 break;···13041304 break;13051305 }1306130613071307- case VIDIOCPWCSLED:13071307+ case VIDIOCPWCSLED:13081308 {13091309 struct pwc_leds *leds = arg;13101310 ret = pwc_set_leds(pdev, leds->led_on, leds->led_off);···13251325 ret = pwc_set_contour(pdev, *contour);13261326 break;13271327 }13281328-13281328+13291329 case VIDIOCPWCGCONTOUR:13301330 {13311331 int *contour = arg;13321332 ret = pwc_get_contour(pdev, contour);13331333 break;13341334 }13351335-13351335+13361336 case VIDIOCPWCSBACKLIGHT:13371337 {13381338 int *backlight = arg;···13461346 ret = pwc_get_backlight(pdev, backlight);13471347 break;13481348 }13491349-13491349+13501350 case VIDIOCPWCSFLICKER:13511351 {13521352 int *flicker = arg;···13601360 ret = pwc_get_flicker(pdev, flicker);13611361 break;13621362 }13631363-13631363+13641364 case VIDIOCPWCSDYNNOISE:13651365 {13661366 int *dynnoise = arg;13671367 ret = pwc_set_dynamic_noise(pdev, *dynnoise);13681368 break;13691369 }13701370-13701370+13711371 case VIDIOCPWCGDYNNOISE:13721372 {13731373 int *dynnoise = arg;···13811381 size->width = pdev->image.x;13821382 size->height = pdev->image.y;13831383 break;13841384- }13851385-13861386- case VIDIOCPWCMPTRESET:13871387- {13881388- if (pdev->features & FEATURE_MOTOR_PANTILT)13891389- {13901390- int *flags = arg;13841384+ }13851385+13861386+ case VIDIOCPWCMPTRESET:13871387+ {13881388+ if (pdev->features & FEATURE_MOTOR_PANTILT)13891389+ {13901390+ int *flags = arg;1391139113921392 ret = pwc_mpt_reset(pdev, *flags);13931393- if (ret >= 0)13941394- {13951395- pdev->pan_angle = 0;13961396- pdev->tilt_angle = 0;13971397- }13981398- }13991399- else14001400- {14011401- ret = -ENXIO;14021402- }14031403- break; 14041404- }14051405-14061406- case VIDIOCPWCMPTGRANGE:14071407- {14081408- if (pdev->features & FEATURE_MOTOR_PANTILT)14091409- {14101410- struct pwc_mpt_range *range = arg;14111411- *range = pdev->angle_range;14121412- }14131413- else14141414- { 14151415- ret = -ENXIO;14161416- }14171417- break;14181418- }14191419-14201420- case VIDIOCPWCMPTSANGLE:14211421- {14221422- int new_pan, new_tilt;14231423-14241424- if (pdev->features & FEATURE_MOTOR_PANTILT)14251425- {14261426- struct pwc_mpt_angles *angles = arg;13931393+ if (ret >= 0)13941394+ {13951395+ pdev->pan_angle = 0;13961396+ pdev->tilt_angle = 0;13971397+ }13981398+ }13991399+ else14001400+ {14011401+ ret = -ENXIO;14021402+ }14031403+ break;14041404+ }14051405+14061406+ case VIDIOCPWCMPTGRANGE:14071407+ {14081408+ if (pdev->features & FEATURE_MOTOR_PANTILT)14091409+ {14101410+ struct pwc_mpt_range *range = arg;14111411+ *range = pdev->angle_range;14121412+ }14131413+ else14141414+ {14151415+ ret = -ENXIO;14161416+ }14171417+ break;14181418+ }14191419+14201420+ case VIDIOCPWCMPTSANGLE:14211421+ {14221422+ int new_pan, new_tilt;14231423+14241424+ if (pdev->features & FEATURE_MOTOR_PANTILT)14251425+ {14261426+ struct pwc_mpt_angles *angles = arg;14271427 /* The camera can only set relative angles, so14281428 do some calculations when getting an absolute angle .14291429 */14301430 if (angles->absolute)14311431 {14321432- new_pan = angles->pan;14331433- new_tilt = angles->tilt;14341434- }14351435- else14361436- {14371437- new_pan = pdev->pan_angle + angles->pan;14381438- new_tilt = pdev->tilt_angle + angles->tilt;14321432+ new_pan = angles->pan;14331433+ new_tilt = angles->tilt;14341434+ }14351435+ else14361436+ {14371437+ new_pan = pdev->pan_angle + angles->pan;14381438+ new_tilt = pdev->tilt_angle + angles->tilt;14391439 }14401440 /* check absolute ranges */14411441 if (new_pan < pdev->angle_range.pan_min ||···14631463 pdev->tilt_angle += new_tilt;14641464 }14651465 if (ret == -EPIPE) /* stall -> out of range */14661466- ret = -ERANGE; 14661466+ ret = -ERANGE;14671467 }14681468- }14691469- else14701470- {14711471- ret = -ENXIO;14721472- }14731473- break;14741474- }14681468+ }14691469+ else14701470+ {14711471+ ret = -ENXIO;14721472+ }14731473+ break;14741474+ }1475147514761476- case VIDIOCPWCMPTGANGLE:14771477- {14781478-14791479- if (pdev->features & FEATURE_MOTOR_PANTILT)14801480- {14811481- struct pwc_mpt_angles *angles = arg;14761476+ case VIDIOCPWCMPTGANGLE:14771477+ {1482147814831483- angles->absolute = 1;14841484- angles->pan = pdev->pan_angle;14851485- angles->tilt = pdev->tilt_angle;14861486- }14871487- else14881488- {14891489- ret = -ENXIO;14901490- }14911491- break;14921492- }14931493-14941494- case VIDIOCPWCMPTSTATUS:14951495- {14961496- if (pdev->features & FEATURE_MOTOR_PANTILT)14971497- {14981498- struct pwc_mpt_status *status = arg;14991499- ret = pwc_mpt_get_status(pdev, status);15001500- }15011501- else15021502- {15031503- ret = -ENXIO;15041504- }15051505- break;14791479+ if (pdev->features & FEATURE_MOTOR_PANTILT)14801480+ {14811481+ struct pwc_mpt_angles *angles = arg;14821482+14831483+ angles->absolute = 1;14841484+ angles->pan = pdev->pan_angle;14851485+ angles->tilt = pdev->tilt_angle;14861486+ }14871487+ else14881488+ {14891489+ ret = -ENXIO;14901490+ }14911491+ break;14921492+ }14931493+14941494+ case VIDIOCPWCMPTSTATUS:14951495+ {14961496+ if (pdev->features & FEATURE_MOTOR_PANTILT)14971497+ {14981498+ struct pwc_mpt_status *status = arg;14991499+ ret = pwc_mpt_get_status(pdev, status);15001500+ }15011501+ else15021502+ {15031503+ ret = -ENXIO;15041504+ }15051505+ break;15061506 }1507150715081508 case VIDIOCPWCGVIDCMD:15091509 {15101510 struct pwc_video_command *cmd = arg;15111511-15121512- cmd->type = pdev->type;15111511+15121512+ cmd->type = pdev->type;15131513 cmd->release = pdev->release;15141514 cmd->command_len = pdev->cmd_len;15151515 memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len);···15311531 ret = -ENOIOCTLCMD;15321532 break;15331533 }15341534-15341534+15351535 if (ret > 0)15361536 return 0;15371537 return ret;
+151-151
drivers/media/video/pwc/pwc-if.c
···25252626*/27272828-/* 2828+/*2929 This code forms the interface between the USB layers and the Philips3030 specific stuff. Some adanved stuff of the driver falls under an3131 NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and3232- is thus not distributed in source form. The binary pwcx.o module 3232+ is thus not distributed in source form. The binary pwcx.o module3333 contains the code that falls under the NDA.3434-3535- In case you're wondering: 'pwc' stands for "Philips WebCam", but 3434+3535+ In case you're wondering: 'pwc' stands for "Philips WebCam", but3636 I really didn't want to type 'philips_web_cam' every time (I'm lazy as3737 any Linux kernel hacker, but I don't like uncomprehensible abbreviations3838 without explanation).3939-3939+4040 Oh yes, convention: to disctinguish between all the various pointers to4141 device-structures, I use these names for the pointer variables:4242 udev: struct usb_device *···170170171171/* Okay, this is some magic that I worked out and the reasoning behind it...172172173173- The biggest problem with any USB device is of course: "what to do 173173+ The biggest problem with any USB device is of course: "what to do174174 when the user unplugs the device while it is in use by an application?"175175 We have several options:176176 1) Curse them with the 7 plagues when they do (requires divine intervention)177177 2) Tell them not to (won't work: they'll do it anyway)178178 3) Oops the kernel (this will have a negative effect on a user's uptime)179179 4) Do something sensible.180180-180180+181181 Of course, we go for option 4.182182183183 It happens that this device will be linked to two times, once from···185185 pointers. This is done when the device is probed() and all initialization186186 succeeded. The pwc_device struct links back to both structures.187187188188- When a device is unplugged while in use it will be removed from the 189189- list of known USB devices; I also de-register it as a V4L device, but 188188+ When a device is unplugged while in use it will be removed from the189189+ list of known USB devices; I also de-register it as a V4L device, but190190 unfortunately I can't free the memory since the struct is still in use191191 by the file descriptor. This free-ing is then deferend until the first192192 opportunity. Crude, but it works.193193-193193+194194 A small 'advantage' is that if a user unplugs the cam and plugs it back195195 in, it should get assigned the same video device minor, but unfortunately196196- it's non-trivial to re-link the cam back to the video device... (that 196196+ it's non-trivial to re-link the cam back to the video device... (that197197 would surely be magic! :))198198*/199199···203203/* Here we want the physical address of the memory.204204 * This is used when initializing the contents of the area.205205 */206206-static inline unsigned long kvirt_to_pa(unsigned long adr) 206206+static inline unsigned long kvirt_to_pa(unsigned long adr)207207{208208- unsigned long kva, ret;208208+ unsigned long kva, ret;209209210210 kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));211211 kva |= adr & (PAGE_SIZE-1); /* restore the offset */212212 ret = __pa(kva);213213- return ret;213213+ return ret;214214}215215216216static void * rvmalloc(unsigned long size)···219219 unsigned long adr;220220221221 size=PAGE_ALIGN(size);222222- mem=vmalloc_32(size);223223- if (mem) 222222+ mem=vmalloc_32(size);223223+ if (mem)224224 {225225 memset(mem, 0, size); /* Clear the ram out, no junk to the user */226226- adr=(unsigned long) mem;227227- while (size > 0) 228228- {226226+ adr=(unsigned long) mem;227227+ while (size > 0)228228+ {229229 SetPageReserved(vmalloc_to_page((void *)adr));230230 adr+=PAGE_SIZE;231231 size-=PAGE_SIZE;···236236237237static void rvfree(void * mem, unsigned long size)238238{239239- unsigned long adr;239239+ unsigned long adr;240240241241- if (mem) 241241+ if (mem)242242 {243243- adr=(unsigned long) mem;244244- while ((long) size > 0) 245245- {243243+ adr=(unsigned long) mem;244244+ while ((long) size > 0)245245+ {246246 ClearPageReserved(vmalloc_to_page((void *)adr));247247 adr+=PAGE_SIZE;248248 size-=PAGE_SIZE;···263263264264 if (pdev == NULL)265265 return -ENXIO;266266-266266+267267#ifdef PWC_MAGIC268268 if (pdev->magic != PWC_MAGIC) {269269 Err("allocate_buffers(): magic failed.\n");270270 return -ENXIO;271271 }272272-#endif 272272+#endif273273 /* Allocate Isochronous pipe buffers */274274 for (i = 0; i < MAX_ISO_BUFS; i++) {275275 if (pdev->sbuf[i].data == NULL) {···308308 memset(kbuf, 128, PWC_FRAME_SIZE);309309 }310310 }311311-311311+312312 /* Allocate decompressor table space */313313 kbuf = NULL;314314 switch (pdev->type)···320320 case 730:321321 case 740:322322 case 750:323323-#if 0 323323+#if 0324324 Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private));325325 kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */326326 break;···329329 /* TODO & FIXME */330330 kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);331331 break;332332-#endif 332332+#endif333333 ;334334 }335335 pdev->decompress_data = kbuf;336336-336336+337337 /* Allocate image buffer; double buffer for mmap() */338338 kbuf = rvmalloc(default_mbufs * pdev->len_per_image);339339 if (kbuf == NULL) {···348348 pdev->image_ptr[i] = NULL;349349350350 kbuf = NULL;351351-351351+352352 Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n");353353 return 0;354354}···366366 Err("free_buffers(): magic failed.\n");367367 return;368368 }369369-#endif 369369+#endif370370371371 /* Release Iso-pipe buffers */372372 for (i = 0; i < MAX_ISO_BUFS; i++)···403403 rvfree(pdev->image_data, default_mbufs * pdev->len_per_image);404404 }405405 pdev->image_data = NULL;406406-406406+407407 Trace(TRACE_MEMORY, "Leaving free_buffers().\n");408408}409409410410-/* The frame & image buffer mess. 410410+/* The frame & image buffer mess.411411412412 Yes, this is a mess. Well, it used to be simple, but alas... In this413413 module, 3 buffers schemes are used to get the data from the USB bus to414414 the user program. The first scheme involves the ISO buffers (called thus415415 since they transport ISO data from the USB controller), and not really416416- interesting. Suffices to say the data from this buffer is quickly 416416+ interesting. Suffices to say the data from this buffer is quickly417417 gathered in an interrupt handler (pwc_isoc_handler) and placed into the418418 frame buffer.419419···443443 and a 'full' frame list:444444 * Initially, all frame buffers but one are on the 'empty' list; the one445445 remaining buffer is our initial fill frame.446446- * If a frame is needed for filling, we try to take it from the 'empty' 447447- list, unless that list is empty, in which case we take the buffer at 446446+ * If a frame is needed for filling, we try to take it from the 'empty'447447+ list, unless that list is empty, in which case we take the buffer at448448 the head of the 'full' list.449449 * When our fill buffer has been filled, it is appended to the 'full'450450 list.···646646 case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break;647647 }648648 Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg);649649- /* Give up after a number of contiguous errors on the USB bus. 649649+ /* Give up after a number of contiguous errors on the USB bus.650650 Appearantly something is wrong so we simulate an unplug event.651651 */652652 if (++pdev->visoc_errors > MAX_ISOC_ERRORS)···673673 pdev->visoc_errors = 0;674674675675 /* vsync: 0 = don't copy data676676- 1 = sync-hunt677677- 2 = synched676676+ 1 = sync-hunt677677+ 2 = synched678678 */679679 /* Compact data */680680 for (i = 0; i < urb->number_of_packets; i++) {···701701 } /* ..flen > 0 */702702703703 if (flen < pdev->vlast_packet_size) {704704- /* Shorter packet... We probably have the end of an image-frame; 704704+ /* Shorter packet... We probably have the end of an image-frame;705705 wake up read() process and let select()/poll() do something.706706 Decompression is done in user time over there.707707 */708708 if (pdev->vsync == 2) {709709- /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus 710710- frames on the USB wire after an exposure change. This conditition is 709709+ /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus710710+ frames on the USB wire after an exposure change. This conditition is711711 however detected in the cam and a bit is set in the header.712712 */713713 if (pdev->type == 730) {714714 unsigned char *ptr = (unsigned char *)fbuf->data;715715-715715+716716 if (ptr[1] == 1 && ptr[0] & 0x10) {717717#if PWC_DEBUG718718 Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence);···733733 Info("Image is normal.\n");734734 }735735 pdev->vmirror = ptr[0] & 0x03;736736- /* Sometimes the trailer of the 730 is still sent as a 4 byte packet 736736+ /* Sometimes the trailer of the 730 is still sent as a 4 byte packet737737 after a short frame; this condition is filtered out specifically. A 4 byte738738 frame doesn't make sense anyway.739739- So we get either this sequence: 740740- drop_bit set -> 4 byte frame -> short frame -> good frame739739+ So we get either this sequence:740740+ drop_bit set -> 4 byte frame -> short frame -> good frame741741 Or this one:742742- drop_bit set -> short frame -> good frame742742+ drop_bit set -> short frame -> good frame743743 So we drop either 3 or 2 frames in all!744744 */745745 if (fbuf->filled == 4)···830830 intf = usb_ifnum_to_if(udev, 0);831831 if (intf)832832 idesc = usb_altnum_to_altsetting(intf, pdev->valternate);833833-833833+834834 if (!idesc)835835 return -EFAULT;836836···841841 pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);842842 break;843843 }844844-844844+845845 if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {846846 Err("Failed to find packet size for video endpoint in current alternate setting.\n");847847 return -ENFILE; /* Odd error, that should be noticeable */···875875 return ret;876876 }877877878878- /* init URB structure */ 878878+ /* init URB structure */879879 for (i = 0; i < MAX_ISO_BUFS; i++) {880880 urb = pdev->sbuf[i].urb;881881882882 urb->interval = 1; // devik883883 urb->dev = udev;884884- urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);884884+ urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);885885 urb->transfer_flags = URB_ISO_ASAP;886886- urb->transfer_buffer = pdev->sbuf[i].data;887887- urb->transfer_buffer_length = ISO_BUFFER_SIZE;888888- urb->complete = pwc_isoc_handler;889889- urb->context = pdev;886886+ urb->transfer_buffer = pdev->sbuf[i].data;887887+ urb->transfer_buffer_length = ISO_BUFFER_SIZE;888888+ urb->complete = pwc_isoc_handler;889889+ urb->context = pdev;890890 urb->start_frame = 0;891891 urb->number_of_packets = ISO_FRAMES_PER_DESC;892892 for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {···935935 }936936937937 /* Stop camera, but only if we are sure the camera is still there (unplug938938- is signalled by EPIPE) 938938+ is signalled by EPIPE)939939 */940940 if (pdev->error_status && pdev->error_status != EPIPE) {941941 Trace(TRACE_OPEN, "Setting alternate interface 0.\n");···956956 pwc_reset_buffers(pdev);957957 /* Try to set video mode... */958958 start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot);959959- if (ret) { 960960- Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n");959959+ if (ret) {960960+ Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n");961961 /* That failed... restore old mode (we know that worked) */962962 start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);963963 if (start) {964964- Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n");964964+ Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n");965965 }966966 }967967 if (start == 0)···987987 struct pwc_device *pdev;988988989989 Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev);990990-990990+991991 pdev = (struct pwc_device *)vdev->priv;992992 if (pdev == NULL)993993 BUG();994994 if (pdev->vopen)995995 return -EBUSY;996996-996996+997997 down(&pdev->modlock);998998 if (!pdev->usb_init) {999999 Trace(TRACE_OPEN, "Doing first time initialization.\n");10001000 pdev->usb_init = 1;10011001-10011001+10021002 if (pwc_trace & TRACE_OPEN)10031003 {10041004 /* Query sensor type */···10361036 /* Set LED on/off time */10371037 if (pwc_set_leds(pdev, led_on, led_off) < 0)10381038 Info("Failed to set LED on/off time.\n");10391039-10391039+10401040 pwc_construct(pdev); /* set min/max sizes correct */1041104110421042 /* So far, so good. Allocate memory. */···10461046 up(&pdev->modlock);10471047 return i;10481048 }10491049-10491049+10501050 /* Reset buffers & parameters */10511051 pwc_reset_buffers(pdev);10521052 for (i = 0; i < default_mbufs; i++)···10811081 up(&pdev->modlock);10821082 return i;10831083 }10841084-10841084+10851085 i = pwc_isoc_init(pdev);10861086 if (i) {10871087 Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);···11551155/*11561156 * FIXME: what about two parallel reads ????11571157 * ANSWER: Not supported. You can't open the device more than once,11581158- despite what the V4L1 interface says. First, I don't see11591159- the need, second there's no mechanism of alerting the11601160- 2nd/3rd/... process of events like changing image size.11611161- And I don't see the point of blocking that for the11621162- 2nd/3rd/... process.11631163- In multi-threaded environments reading parallel from any11641164- device is tricky anyhow.11581158+ despite what the V4L1 interface says. First, I don't see11591159+ the need, second there's no mechanism of alerting the11601160+ 2nd/3rd/... process of events like changing image size.11611161+ And I don't see the point of blocking that for the11621162+ 2nd/3rd/... process.11631163+ In multi-threaded environments reading parallel from any11641164+ device is tricky anyhow.11651165 */1166116611671167static ssize_t pwc_video_read(struct file *file, char __user * buf,···11711171 struct pwc_device *pdev;11721172 int noblock = file->f_flags & O_NONBLOCK;11731173 DECLARE_WAITQUEUE(wait, current);11741174- int bytes_to_read;11741174+ int bytes_to_read;1175117511761176 Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count);11771177 if (vdev == NULL)···11931193 set_current_state(TASK_RUNNING);11941194 return -pdev->error_status ;11951195 }11961196- if (noblock) {11971197- remove_wait_queue(&pdev->frameq, &wait);11981198- set_current_state(TASK_RUNNING);11991199- return -EWOULDBLOCK;12001200- }12011201- if (signal_pending(current)) {12021202- remove_wait_queue(&pdev->frameq, &wait);12031203- set_current_state(TASK_RUNNING);12041204- return -ERESTARTSYS;12051205- }12061206- schedule();12071207- set_current_state(TASK_INTERRUPTIBLE);11961196+ if (noblock) {11971197+ remove_wait_queue(&pdev->frameq, &wait);11981198+ set_current_state(TASK_RUNNING);11991199+ return -EWOULDBLOCK;12001200+ }12011201+ if (signal_pending(current)) {12021202+ remove_wait_queue(&pdev->frameq, &wait);12031203+ set_current_state(TASK_RUNNING);12041204+ return -ERESTARTSYS;12051205+ }12061206+ schedule();12071207+ set_current_state(TASK_INTERRUPTIBLE);12081208 }12091209 remove_wait_queue(&pdev->frameq, &wait);12101210 set_current_state(TASK_RUNNING);12111211-12111211+12121212 /* Decompress and release frame */12131213 if (pwc_handle_frame(pdev))12141214 return -EFAULT;···12181218 if (pdev->vpalette == VIDEO_PALETTE_RAW)12191219 bytes_to_read = pdev->frame_size;12201220 else12211221- bytes_to_read = pdev->view.size;12211221+ bytes_to_read = pdev->view.size;1222122212231223 /* copy bytes to user space; we allow for partial reads */12241224 if (count + pdev->image_read_pos > bytes_to_read)···13481348 struct video_picture *p = arg;13491349 /*13501350 * FIXME: Suppose we are mid read13511351- ANSWER: No problem: the firmware of the camera13521352- can handle brightness/contrast/etc13531353- changes at _any_ time, and the palette13541354- is used exactly once in the uncompress13551355- routine.13511351+ ANSWER: No problem: the firmware of the camera13521352+ can handle brightness/contrast/etc13531353+ changes at _any_ time, and the palette13541354+ is used exactly once in the uncompress13551355+ routine.13561356 */13571357 pwc_set_brightness(pdev, p->brightness);13581358 pwc_set_contrast(pdev, p->contrast);···13731373 break;13741374 }1375137513761376- /* Window/size parameters */ 13761376+ /* Window/size parameters */13771377 case VIDIOCGWIN:13781378 {13791379 struct video_window *vw = arg;13801380-13801380+13811381 vw->x = 0;13821382 vw->y = 0;13831383 vw->width = pdev->view.x;13841384 vw->height = pdev->view.y;13851385 vw->chromakey = 0;13861386- vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | 13871387- (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0);13861386+ vw->flags = (pdev->vframes << PWC_FPS_SHIFT) |13871387+ (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0);13881388 break;13891389 }13901390-13901390+13911391 case VIDIOCSWIN:13921392 {13931393 struct video_window *vw = arg;···14021402 ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot);14031403 if (ret)14041404 return ret;14051405- break; 14051405+ break;14061406 }14071407-14071407+14081408 /* We don't have overlay support (yet) */14091409 case VIDIOCGFBUF:14101410 {···14711471 return -EBUSY; /* buffer wasn't available. Bummer */14721472 pdev->image_used[vm->frame] = 1;1473147314741474- /* Okay, we're done here. In the SYNC call we wait until a 14751475- frame comes available, then expand image into the given 14741474+ /* Okay, we're done here. In the SYNC call we wait until a14751475+ frame comes available, then expand image into the given14761476 buffer.14771477 In contrast to the CPiA cam the Philips cams deliver a14781478 constant stream, almost like a grabber card. Also,···14871487 {14881488 /* The doc says: "Whenever a buffer is used it should14891489 call VIDIOCSYNC to free this frame up and continue."14901490-14911491- The only odd thing about this whole procedure is 14901490+14911491+ The only odd thing about this whole procedure is14921492 that MCAPTURE flags the buffer as "in use", and14931493- SYNC immediately unmarks it, while it isn't 14931493+ SYNC immediately unmarks it, while it isn't14941494 after SYNC that you know that the buffer actually14951495 got filled! So you better not start a CAPTURE in14961496- the same frame immediately (use double buffering). 14971497- This is not a problem for this cam, since it has 14981498- extra intermediate buffers, but a hardware 14991499- grabber card will then overwrite the buffer 14961496+ the same frame immediately (use double buffering).14971497+ This is not a problem for this cam, since it has14981498+ extra intermediate buffers, but a hardware14991499+ grabber card will then overwrite the buffer15001500 you're working on.15011501 */15021502 int *mbuf = arg;···15121512 return -EINVAL;1513151315141514 /* Add ourselves to the frame wait-queue.15151515-15151515+15161516 FIXME: needs auditing for safety.15171517 QUESTION: In what respect? I think that using the15181518- frameq is safe now.15181518+ frameq is safe now.15191519 */15201520 add_wait_queue(&pdev->frameq, &wait);15211521 while (pdev->full_frames == NULL) {···15241524 set_current_state(TASK_RUNNING);15251525 return -pdev->error_status;15261526 }15271527-15281528- if (signal_pending(current)) {15291529- remove_wait_queue(&pdev->frameq, &wait);15301530- set_current_state(TASK_RUNNING);15311531- return -ERESTARTSYS;15321532- }15331533- schedule();15341534- set_current_state(TASK_INTERRUPTIBLE);15271527+15281528+ if (signal_pending(current)) {15291529+ remove_wait_queue(&pdev->frameq, &wait);15301530+ set_current_state(TASK_RUNNING);15311531+ return -ERESTARTSYS;15321532+ }15331533+ schedule();15341534+ set_current_state(TASK_INTERRUPTIBLE);15351535 }15361536 remove_wait_queue(&pdev->frameq, &wait);15371537 set_current_state(TASK_RUNNING);15381538-15391539- /* The frame is ready. Expand in the image buffer 15401540- requested by the user. I don't care if you 15411541- mmap() 5 buffers and request data in this order: 15381538+15391539+ /* The frame is ready. Expand in the image buffer15401540+ requested by the user. I don't care if you15411541+ mmap() 5 buffers and request data in this order:15421542 buffer 4 2 3 0 1 2 3 0 4 3 1 . . .15431543 Grabber hardware may not be so forgiving.15441544 */···15511551 return -EFAULT;15521552 break;15531553 }15541554-15541554+15551555 case VIDIOCGAUDIO:15561556 {15571557 struct video_audio *v = arg;15581558-15581558+15591559 strcpy(v->name, "Microphone");15601560 v->audio = -1; /* unknown audio minor */15611561 v->flags = 0;···15651565 v->treble = 0;15661566 v->balance = 0x8000;15671567 v->step = 1;15681568- break; 15681568+ break;15691569 }15701570-15701570+15711571 case VIDIOCSAUDIO:15721572 {15731573 /* Dummy: nothing can be set */15741574 break;15751575 }15761576-15761576+15771577 case VIDIOCGUNIT:15781578 {15791579 struct video_unit *vu = arg;15801580-15801580+15811581 vu->video = pdev->vdev->minor & 0x3F;15821582 vu->audio = -1; /* not known yet */15831583 vu->vbi = -1;···15891589 return pwc_ioctl(pdev, cmd, arg);15901590 } /* ..switch */15911591 return 0;15921592-} 15921592+}1593159315941594static int pwc_video_ioctl(struct inode *inode, struct file *file,15951595 unsigned int cmd, unsigned long arg)···16051605 unsigned long start = vma->vm_start;16061606 unsigned long size = vma->vm_end-vma->vm_start;16071607 unsigned long page, pos;16081608-16081608+16091609 Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size);16101610 pdev = vdev->priv;16111611-16111611+16121612 vma->vm_flags |= VM_IO;1613161316141614 pos = (unsigned long)pdev->image_data;···16461646 char serial_number[30], *name;1647164716481648 /* Check if we can handle this device */16491649- Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", 16491649+ Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n",16501650 le16_to_cpu(udev->descriptor.idVendor),16511651 le16_to_cpu(udev->descriptor.idProduct),16521652 intf->altsetting->desc.bInterfaceNumber);···17701770 name = "Logitech QuickCam (res.)";17711771 type_id = 730; /* Assuming CMOS */17721772 break;17731773- default:17731773+ default:17741774 return -ENODEV;17751775- break;17761776- }17771777- }17751775+ break;17761776+ }17771777+ }17781778 else if (vendor_id == 0x055d) {17791779 /* I don't know the difference between the C10 and the C30;17801780 I suppose the difference is the sensor, but both cameras···18371837 return -ENODEV;18381838 break;18391839 }18401840-18401840+18411841 }18421842 else if (vendor_id == 0x0d81) {18431843 switch(product_id) {···18561856 break;18571857 }18581858 }18591859- else 18591859+ else18601860 return -ENODEV; /* Not any of the know types; but the list keeps growing. */1861186118621862 memset(serial_number, 0, 30);···18801880 if (vendor_id == 0x046D && product_id == 0x08B5)18811881 {18821882 /* Logitech QuickCam Orbit18831883- The ranges have been determined experimentally; they may differ from cam to cam.18841884- Also, the exact ranges left-right and up-down are different for my cam18851885- */18831883+ The ranges have been determined experimentally; they may differ from cam to cam.18841884+ Also, the exact ranges left-right and up-down are different for my cam18851885+ */18861886 pdev->angle_range.pan_min = -7000;18871887 pdev->angle_range.pan_max = 7000;18881888 pdev->angle_range.tilt_min = -3000;···19391939 }1940194019411941 /* occupy slot */19421942- if (hint < MAX_DEV_HINTS) 19421942+ if (hint < MAX_DEV_HINTS)19431943 device_hint[hint].pdev = pdev;1944194419451945 Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev);···19681968 Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");19691969 goto disconnect_out;19701970 }19711971-#ifdef PWC_MAGIC 19711971+#ifdef PWC_MAGIC19721972 if (pdev->magic != PWC_MAGIC) {19731973 Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");19741974 goto disconnect_out;19751975 }19761976#endif19771977-19771977+19781978 /* We got unplugged; this is signalled by an EPIPE error code */19791979 if (pdev->vopen) {19801980 Info("Disconnected while webcam is in use!\n");···20172017}201820182019201920202020-/* 20212021- * Initialization code & module stuff 20202020+/*20212021+ * Initialization code & module stuff20222022 */2023202320242024static char size[10];···21682168 if (*dot != '\0') {21692169 /* There's a serial number as well */21702170 int k;21712171-21712171+21722172 dot++;21732173 k = 0;21742174 while (*dot != ':' && k < 29) {···21782178 device_hint[i].serial_number[k] = '\0';21792179 }21802180 }21812181-#if PWC_DEBUG 21812181+#if PWC_DEBUG21822182 Debug("device_hint[%d]:\n", i);21832183 Debug(" type : %d\n", device_hint[i].type);21842184 Debug(" serial# : %s\n", device_hint[i].serial_number);21852185 Debug(" node : %d\n", device_hint[i].device_node);21862186-#endif 21862186+#endif21872187 }21882188 else21892189 device_hint[i].type = 0; /* not filled */21902190 } /* ..for MAX_DEV_HINTS */2191219121922192- Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver);21922192+ Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver);21932193 return usb_register(&pwc_driver);21942194}21952195
+20-20
drivers/media/video/pwc/pwc-ioctl.h
···3333/*3434 Changes3535 2001/08/03 Alvarado Added ioctl constants to access methods for3636- changing white balance and red/blue gains3636+ changing white balance and red/blue gains3737 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE3838 2003/12/13 Nemosft Unv. Some modifications to make interfacing to3939- PWCX easier3939+ PWCX easier4040 */41414242/* These are private ioctl() commands, specific for the Philips webcams.···45454646 The #define names are built up like follows:4747 VIDIOC VIDeo IOCtl prefix4848- PWC Philps WebCam4949- G optional: Get5050- S optional: Set5151- ... the function4848+ PWC Philps WebCam4949+ G optional: Get5050+ S optional: Set5151+ ... the function5252 */53535454···9494{9595 char serial[30]; /* String with serial number. Contains terminating 0 */9696};9797-9797+9898/* pwc_whitebalance.mode values */9999#define PWC_WB_INDOOR 0100100#define PWC_WB_OUTDOOR 1···102102#define PWC_WB_MANUAL 3103103#define PWC_WB_AUTO 4104104105105-/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 105105+/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).106106 Set mode to one of the PWC_WB_* values above.107107- *red and *blue are the respective gains of these colour components inside 107107+ *red and *blue are the respective gains of these colour components inside108108 the camera; range 0..65535109109- When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 109109+ When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;110110 otherwise undefined.111111 'read_red' and 'read_blue' are read-only.112112-*/ 112112+*/113113struct pwc_whitebalance114114{115115 int mode;···117117 int read_red, read_blue; /* R/O */118118};119119120120-/* 120120+/*121121 'control_speed' and 'control_delay' are used in automatic whitebalance mode,122122- and tell the camera how fast it should react to changes in lighting, and 122122+ and tell the camera how fast it should react to changes in lighting, and123123 with how much delay. Valid values are 0..65535.124124*/125125struct pwc_wb_speed···148148#define PWC_MPT_TILT 0x02149149#define PWC_MPT_TIMEOUT 0x04 /* for status */150150151151-/* Set angles; when absolute != 0, the angle is absolute and the 151151+/* Set angles; when absolute != 0, the angle is absolute and the152152 driver calculates the relative offset for you. This can only153153 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns154154 absolute angles.155155- */ 155155+ */156156struct pwc_mpt_angles157157{158158 int absolute; /* write-only */···179179/* This is used for out-of-kernel decompression. With it, you can get180180 all the necessary information to initialize and use the decompressor181181 routines in standalone applications.182182- */ 182182+ */183183struct pwc_video_command184184{185185 int type; /* camera type (645, 675, 730, etc.) */186186 int release; /* release number */187187188188- int size; /* one of PSZ_* */189189- int alternate;188188+ int size; /* one of PSZ_* */189189+ int alternate;190190 int command_len; /* length of USB video command */191191 unsigned char command_buf[13]; /* Actual USB video command */192192 int bandlength; /* >0 = compressed */···264264265265 /* Flickerless mode; = 0 off, otherwise on */266266#define VIDIOCPWCSFLICKER _IOW('v', 208, int)267267-#define VIDIOCPWCGFLICKER _IOR('v', 208, int) 267267+#define VIDIOCPWCGFLICKER _IOR('v', 208, int)268268269269 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */270270#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)···273273 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */274274#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)275275276276- /* Motorized pan & tilt functions */ 276276+ /* Motorized pan & tilt functions */277277#define VIDIOCPWCMPTRESET _IOW('v', 211, int)278278#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)279279#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
···109109 in planar format immediately.110110 */111111 int flags;112112-113113- flags = PWCX_FLAG_PLANAR;114114- if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)112112+113113+ flags = PWCX_FLAG_PLANAR;114114+ if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)115115 {116116 printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n");117117 flags |= PWCX_FLAG_BAYER;
+1-1
drivers/media/video/pwc/pwc-uncompress.h
···24242525/* This file is the bridge between the kernel module and the plugin; it2626 describes the structures and datatypes used in both modules. Any2727- significant change should be reflected by increasing the 2727+ significant change should be reflected by increasing the2828 pwc_decompressor_version major number.2929 */3030#ifndef PWC_UNCOMPRESS_H
+2-2
drivers/media/video/pwc/pwc.h
···123123#endif124124 /* Pointer to our usb_device */125125 struct usb_device *udev;126126-126126+127127 int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */128128 int release; /* release number */129129 int features; /* feature bits */···149149 char vsnapshot; /* snapshot mode */150150 char vsync; /* used by isoc handler */151151 char vmirror; /* for ToUCaM series */152152-152152+153153 int cmd_len;154154 unsigned char cmd_buf[13];155155
+56-56
drivers/media/video/saa5249.c
···7171#define NUM_BUFS 87272#define IF_NAME "SAA5249"73737474-static const int disp_modes[8][3] = 7474+static const int disp_modes[8][3] =7575{7676 { 0x46, 0x03, 0x03 }, /* DISPOFF */7777 { 0x46, 0xcc, 0xcc }, /* DISPNORM */···150150 client=kmalloc(sizeof(*client), GFP_KERNEL);151151 if(client==NULL)152152 return -ENOMEM;153153- client_template.adapter = adap;154154- client_template.addr = addr;153153+ client_template.adapter = adap;154154+ client_template.addr = addr;155155 memcpy(client, &client_template, sizeof(*client));156156 t = kzalloc(sizeof(*t), GFP_KERNEL);157157 if(t==NULL)···161161 }162162 strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);163163 mutex_init(&t->lock);164164-164164+165165 /*166166 * Now create a video4linux device167167 */168168-168168+169169 vd = kmalloc(sizeof(struct video_device), GFP_KERNEL);170170 if(vd==NULL)171171 {···175175 }176176 i2c_set_clientdata(client, vd);177177 memcpy(vd, &saa_template, sizeof(*vd));178178-179179- for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) 178178+179179+ for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)180180 {181181 memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));182182 memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));···186186 t->vdau[pgbuf].stopped = TRUE;187187 t->is_searching[pgbuf] = FALSE;188188 }189189- vd->priv=t; 190190-191191-189189+ vd->priv=t;190190+191191+192192 /*193193 * Register it194194 */···208208/*209209 * We do most of the hard work when we become a device on the i2c.210210 */211211-211211+212212static int saa5249_probe(struct i2c_adapter *adap)213213{214214 if (adap->class & I2C_CLASS_TV_ANALOG)···229229230230/* new I2C driver support */231231232232-static struct i2c_driver i2c_driver_videotext = 232232+static struct i2c_driver i2c_driver_videotext =233233{234234 .driver = {235235 .name = IF_NAME, /* name */···249249 * delay may be longer.250250 */251251252252-static void jdelay(unsigned long delay) 252252+static void jdelay(unsigned long delay)253253{254254 sigset_t oldblocked = current->blocked;255255···269269/*270270 * I2C interfaces271271 */272272-273273-static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) 272272+273273+static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data)274274{275275 char buf[64];276276-276276+277277 buf[0] = reg;278278 memcpy(buf+1, data, count);279279-279279+280280 if(i2c_master_send(t->client, buf, count+1)==count+1)281281 return 0;282282 return -1;···289289 int ct=0;290290 va_list argp;291291 va_start(argp,t);292292-292292+293293 while((v=va_arg(argp,int))!=-1)294294 buf[ct++]=v;295295 return i2c_sendbuf(t, buf[0], ct-1, buf+1);···301301 * Returns -1 if I�C-device didn't send acknowledge, 0 otherwise302302 */303303304304-static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) 304304+static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)305305{306306 if(i2c_master_recv(t->client, buf, count)!=count)307307 return -1;···320320 struct video_device *vd = video_devdata(file);321321 struct saa5249_device *t=vd->priv;322322323323- switch(cmd) 323323+ switch(cmd)324324 {325325- case VTXIOCGETINFO: 325325+ case VTXIOCGETINFO:326326 {327327 vtx_info_t *info = arg;328328 info->version_major = VTX_VER_MAJ;···332332 return 0;333333 }334334335335- case VTXIOCCLRPAGE: 335335+ case VTXIOCCLRPAGE:336336 {337337 vtx_pagereq_t *req = arg;338338-338338+339339 if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)340340 return -EINVAL;341341 memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));···343343 return 0;344344 }345345346346- case VTXIOCCLRFOUND: 346346+ case VTXIOCCLRFOUND:347347 {348348 vtx_pagereq_t *req = arg;349349-349349+350350 if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)351351 return -EINVAL;352352 t->vdau[req->pgbuf].clrfound = TRUE;353353 return 0;354354 }355355356356- case VTXIOCPAGEREQ: 356356+ case VTXIOCPAGEREQ:357357 {358358 vtx_pagereq_t *req = arg;359359 if (!(req->pagemask & PGMASK_PAGE))···381381 return 0;382382 }383383384384- case VTXIOCGETSTAT: 384384+ case VTXIOCGETSTAT:385385 {386386 vtx_pagereq_t *req = arg;387387 u8 infobits[10];···390390391391 if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)392392 return -EINVAL;393393- if (!t->vdau[req->pgbuf].stopped) 393393+ if (!t->vdau[req->pgbuf].stopped)394394 {395395 if (i2c_senddata(t, 2, 0, -1) ||396396 i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) ||···403403 return -EIO;404404405405 if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */406406- (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || 406406+ (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) ||407407 time_after_eq(jiffies, t->vdau[req->pgbuf].expire)))408408 { /* check if new page arrived */409409 if (i2c_senddata(t, 8, 0, 0, 0, -1) ||···411411 return -EIO;412412 t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE;413413 memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE);414414- if (t->virtual_mode) 414414+ if (t->virtual_mode)415415 {416416 /* Packet X/24 */417417 if (i2c_senddata(t, 8, 0, 0x20, 0, -1) ||···459459 info.notfound = !!(infobits[8] & 0x10);460460 info.pblf = !!(infobits[9] & 0x20);461461 info.hamming = 0;462462- for (a = 0; a <= 7; a++) 462462+ for (a = 0; a <= 7; a++)463463 {464464- if (infobits[a] & 0xf0) 464464+ if (infobits[a] & 0xf0)465465 {466466 info.hamming = 1;467467 break;···471471 info.notfound = 1;472472 if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t)))473473 return -EFAULT;474474- if (!info.hamming && !info.notfound) 474474+ if (!info.hamming && !info.notfound)475475 {476476 t->is_searching[req->pgbuf] = FALSE;477477 }478478 return 0;479479 }480480481481- case VTXIOCGETPAGE: 481481+ case VTXIOCGETPAGE:482482 {483483 vtx_pagereq_t *req = arg;484484 int start, end;···488488 return -EINVAL;489489 if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1))490490 return -EFAULT;491491-492492- /* 491491+492492+ /*493493 * Always read the time directly from SAA5249494494 */495495-496496- if (req->start <= 39 && req->end >= 32) 495495+496496+ if (req->start <= 39 && req->end >= 32)497497 {498498 int len;499499- char buf[16]; 499499+ char buf[16];500500 start = max(req->start, 32);501501 end = min(req->end, 39);502502 len=end-start+1;···507507 return -EFAULT;508508 }509509 /* Insert the current header if DAU is still searching for a page */510510- if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) 510510+ if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf])511511 {512512 char buf[32];513513 int len;···523523 return 0;524524 }525525526526- case VTXIOCSTOPDAU: 526526+ case VTXIOCSTOPDAU:527527 {528528 vtx_pagereq_t *req = arg;529529···534534 return 0;535535 }536536537537- case VTXIOCPUTPAGE: 538538- case VTXIOCSETDISP: 539539- case VTXIOCPUTSTAT: 537537+ case VTXIOCPUTPAGE:538538+ case VTXIOCSETDISP:539539+ case VTXIOCPUTSTAT:540540 return 0;541541-542542- case VTXIOCCLRCACHE: 541541+542542+ case VTXIOCCLRCACHE:543543 {544544 if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11,545545 ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',···551551 return 0;552552 }553553554554- case VTXIOCSETVIRT: 554554+ case VTXIOCSETVIRT:555555 {556556 /* The SAA5249 has virtual-row reception turned on always */557557 t->virtual_mode = (int)(long)arg;···612612/*613613 * Handle the locking614614 */615615-615615+616616static int saa5249_ioctl(struct inode *inode, struct file *file,617617- unsigned int cmd, unsigned long arg) 617617+ unsigned int cmd, unsigned long arg)618618{619619 struct video_device *vd = video_devdata(file);620620 struct saa5249_device *t=vd->priv;621621 int err;622622-622622+623623 cmd = vtx_fix_command(cmd);624624 mutex_lock(&t->lock);625625 err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl);···627627 return err;628628}629629630630-static int saa5249_open(struct inode *inode, struct file *file) 630630+static int saa5249_open(struct inode *inode, struct file *file)631631{632632 struct video_device *vd = video_devdata(file);633633 struct saa5249_device *t=vd->priv;···636636 err = video_exclusive_open(inode,file);637637 if (err < 0)638638 return err;639639-639639+640640 if (t->client==NULL) {641641 err = -ENODEV;642642 goto fail;···647647 i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) ||648648 /* Display TV-picture, no virtual rows */649649 i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */650650-650650+651651 {652652 err = -EIO;653653 goto fail;654654 }655655656656- for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) 656656+ for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)657657 {658658 memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));659659 memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));···673673674674675675676676-static int saa5249_release(struct inode *inode, struct file *file) 676676+static int saa5249_release(struct inode *inode, struct file *file)677677{678678 struct video_device *vd = video_devdata(file);679679 struct saa5249_device *t=vd->priv;···690690 return i2c_add_driver(&i2c_driver_videotext);691691}692692693693-static void __exit cleanup_saa_5249 (void) 693693+static void __exit cleanup_saa_5249 (void)694694{695695 i2c_del_driver(&i2c_driver_videotext);696696}
···11-/* 11+/*22 saa7146.h - definitions philips saa7146 based cards33 Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)44-44+55 This program is free software; you can redistribute it and/or modify66 it under the terms of the GNU General Public License as published by77 the Free Software Foundation; either version 2 of the License, or···27272828#include <linux/videodev.h>29293030-#ifndef O_NONCAP 3030+#ifndef O_NONCAP3131#define O_NONCAP O_TRUNC3232#endif3333···36363737#ifdef __KERNEL__38383939-struct saa7146_window 3939+struct saa7146_window4040{4141 int x, y;4242 ushort width, height;···7070 int irqstate; /* irq routine is state driven */7171 int writemode;7272 int playmode;7373- unsigned int nr;7373+ unsigned int nr;7474 unsigned long irq; /* IRQ used by SAA7146 card */7575 unsigned short id;7676 unsigned char revision;
+2-2
drivers/media/video/saa7146reg.h
···11-/* 11+/*22 saa7146.h - definitions philips saa7146 based cards33 Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)44-44+55 This program is free software; you can redistribute it and/or modify66 it under the terms of the GNU General Public License as published by77 the Free Software Foundation; either version 2 of the License, or
+2-2
drivers/media/video/saa7185.c
···11-/* 11+/*22 * saa7185 - Philips SAA7185B video encoder driver version 0.0.333 *44 * Copyright (C) 1998 Dave Perks <dperks@ibm.net>···377377static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END };378378379379static unsigned short ignore = I2C_CLIENT_END;380380-380380+381381static struct i2c_client_address_data addr_data = {382382 .normal_i2c = normal_i2c,383383 .probe = &ignore,
+2-2
drivers/media/video/saa7196.h
···22 Definitions for the Philips SAA7196 digital video decoder,33 scaler, and clock generator circuit (DESCpro), as used in44 the PlanB video input of the Powermac 7x00/8x00 series.55-55+66 Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)7788 The register defines are shamelessly copied from the meteor99 driver out of NetBSD (with permission),1010 and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe1111 (Thanks !)1212-1212+1313 Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu)14141515 The default values used for PlanB are my mistakes.
+108-108
drivers/media/video/se401.c
···44 * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)55 *66 * Still somewhat based on the Linux ov511 driver.77- * 77+ *88 * This program is free software; you can redistribute it and/or modify it99 * under the terms of the GNU General Public License as published by the1010 * Free Software Foundation; either version 2 of the License, or (at your···114114 unsigned short value, unsigned char *cp, int size)115115{116116 return usb_control_msg (117117- se401->dev,118118- set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0),119119- req,120120- (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE,121121- value,122122- 0,123123- cp,124124- size,125125- 1000126126- );117117+ se401->dev,118118+ set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0),119119+ req,120120+ (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE,121121+ value,122122+ 0,123123+ cp,124124+ size,125125+ 1000126126+ );127127}128128129129static int se401_set_feature(struct usb_se401 *se401, unsigned short selector,···140140 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,141141 param,142142 selector,143143- NULL,144144- 0,145145- 1000146146- );143143+ NULL,144144+ 0,145145+ 1000146146+ );147147}148148149149-static unsigned short se401_get_feature(struct usb_se401 *se401, 150150- unsigned short selector)149149+static unsigned short se401_get_feature(struct usb_se401 *se401,150150+ unsigned short selector)151151{152152 /* For 'set' the selecetor should be in index, not sure if the spec is153153 wrong here to....154154 */155155 unsigned char cp[2];156156- usb_control_msg (157157- se401->dev,158158- usb_rcvctrlpipe(se401->dev, 0),159159- SE401_REQ_GET_EXT_FEATURE,160160- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,161161- 0,162162- selector,163163- cp,164164- 2,165165- 1000166166- );156156+ usb_control_msg (157157+ se401->dev,158158+ usb_rcvctrlpipe(se401->dev, 0),159159+ SE401_REQ_GET_EXT_FEATURE,160160+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,161161+ 0,162162+ selector,163163+ cp,164164+ 2,165165+ 1000166166+ );167167 return cp[0]+cp[1]*256;168168}169169···183183 se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */184184 se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */185185 se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */186186-186186+187187 return 0;188188}189189190190static void se401_set_exposure(struct usb_se401 *se401, int brightness)191191{192192 int integration=brightness<<5;193193-193193+194194 if (flickerless==50) {195195 integration=integration-integration%106667;196196 }···255255 /* For some reason this normally read-only register doesn't get reset256256 to zero after reading them just once...257257 */258258- se401_get_feature(se401, HV7131_REG_HIREFNOH); 258258+ se401_get_feature(se401, HV7131_REG_HIREFNOH);259259 se401_get_feature(se401, HV7131_REG_HIREFNOL);260260 se401_get_feature(se401, HV7131_REG_LOREFNOH);261261 se401_get_feature(se401, HV7131_REG_LOREFNOL);262262- ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + 262262+ ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) +263263 se401_get_feature(se401, HV7131_REG_HIREFNOL);264264 alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) +265265 se401_get_feature(se401, HV7131_REG_LOREFNOL);···287287{288288 struct usb_se401 *se401 = urb->context;289289 int status;290290-290290+291291 if (!se401->dev) {292292 info("ohoh: device vapourished");293293 return;294294 }295295-295295+296296 switch (urb->status) {297297 case 0:298298 /* success */···368368 if (se401->nullpackets > SE401_MAX_NULLPACKETS) {369369 if (waitqueue_active(&se401->wq)) {370370 wake_up_interruptible(&se401->wq);371371- } 371371+ }372372 }373373 }374374···433433 int err=0, i;434434 se401->streaming=1;435435436436- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);437437- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);436436+ se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);437437+ se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);438438439439 /* Set picture settings */440440 se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */···571571 }572572573573 /* First three are absolute, all others relative.574574- * Format is rgb from right to left (mirrorred image), 574574+ * Format is rgb from right to left (mirrorred image),575575 * we flip it to get bgr from left to right. */576576 if (frame->curlinepix < 3) {577577 *(frame->curline-frame->curlinepix)=1+data*4;···703703 int width=se401->cwidth;704704 int blineoffset=0, bline;705705 int linelength=width*3, i;706706-706706+707707708708 if (frame->curpix==0) {709709 if (frame->grabstate==FRAME_READY) {···831831 se401->nullpackets=0;832832 info("to many null length packets, restarting capture");833833 se401_stop_stream(se401);834834- se401_start_stream(se401); 834834+ se401_start_stream(se401);835835 } else {836836 if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) {837837 se401->frame[framenr].grabstate=FRAME_ERROR;···866866{867867 int i;868868869869- se401->dev = NULL;869869+ se401->dev = NULL;870870871871 for (i=0; i<SE401_NUMSBUF; i++)872872 if (se401->urb[i]) {···882882 usb_kill_urb(se401->inturb);883883 usb_free_urb(se401->inturb);884884 }885885- info("%s disconnected", se401->camera_name);885885+ info("%s disconnected", se401->camera_name);886886887887- /* Free the memory */887887+ /* Free the memory */888888 kfree(se401->width);889889 kfree(se401->height);890890 kfree(se401);···910910 se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES);911911 if (se401->fbuf)912912 file->private_data = dev;913913- else 913913+ else914914 err = -ENOMEM;915915 se401->user = !err;916916···920920static int se401_close(struct inode *inode, struct file *file)921921{922922 struct video_device *dev = file->private_data;923923- struct usb_se401 *se401 = (struct usb_se401 *)dev;923923+ struct usb_se401 *se401 = (struct usb_se401 *)dev;924924 int i;925925926926 rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES);927927- if (se401->removed) {927927+ if (se401->removed) {928928 usb_se401_remove_disconnected(se401);929929 info("device unregistered");930930 } else {···942942 unsigned int cmd, void *arg)943943{944944 struct video_device *vdev = file->private_data;945945- struct usb_se401 *se401 = (struct usb_se401 *)vdev;945945+ struct usb_se401 *se401 = (struct usb_se401 *)vdev;946946947947- if (!se401->dev)948948- return -EIO;947947+ if (!se401->dev)948948+ return -EIO;949949950950- switch (cmd) {950950+ switch (cmd) {951951 case VIDIOCGCAP:952952 {953953 struct video_capability *b = arg;···981981 return -EINVAL;982982 return 0;983983 }984984- case VIDIOCGPICT:985985- {984984+ case VIDIOCGPICT:985985+ {986986 struct video_picture *p = arg;987987988988 se401_get_pict(se401, p);···10071007 if (se401_set_size(se401, vw->width, vw->height))10081008 return -EINVAL;10091009 return 0;10101010- }10101010+ }10111011 case VIDIOCGWIN:10121012 {10131013 struct video_window *vw = arg;···10951095 case VIDIOCGAUDIO:10961096 case VIDIOCSAUDIO:10971097 return -EINVAL;10981098- default:10991099- return -ENOIOCTLCMD;11001100- } /* end switch */10981098+ default:10991099+ return -ENOIOCTLCMD;11001100+ } /* end switch */1101110111021102- return 0;11021102+ return 0;11031103}1104110411051105static int se401_ioctl(struct inode *inode, struct file *file,···1142114211431143 se401->frame[0].grabstate=FRAME_UNUSED;11441144 if (ret)11451145- return ret; 11451145+ return ret;11461146 if (copy_to_user(buf, se401->frame[0].data, realcount))11471147 return -EFAULT;11481148···11831183 }11841184 mutex_unlock(&se401->lock);1185118511861186- return 0;11861186+ return 0;11871187}1188118811891189static struct file_operations se401_fops = {11901190 .owner = THIS_MODULE,11911191- .open = se401_open,11921192- .release = se401_close,11931193- .read = se401_read,11941194- .mmap = se401_mmap,11911191+ .open = se401_open,11921192+ .release = se401_close,11931193+ .read = se401_read,11941194+ .mmap = se401_mmap,11951195 .ioctl = se401_ioctl,11961196 .compat_ioctl = v4l_compat_ioctl32,11971197 .llseek = no_llseek,11981198};11991199static struct video_device se401_template = {12001200 .owner = THIS_MODULE,12011201- .name = "se401 USB camera",12021202- .type = VID_TYPE_CAPTURE,12031203- .hardware = VID_HARDWARE_SE401,12011201+ .name = "se401 USB camera",12021202+ .type = VID_TYPE_CAPTURE,12031203+ .hardware = VID_HARDWARE_SE401,12041204 .fops = &se401_fops,12051205};12061206···12091209/***************************/12101210static int se401_init(struct usb_se401 *se401, int button)12111211{12121212- int i=0, rc;12131213- unsigned char cp[0x40];12121212+ int i=0, rc;12131213+ unsigned char cp[0x40];12141214 char temp[200];1215121512161216 /* led on */12171217- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);12171217+ se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);1218121812191219 /* get camera descriptor */12201220 rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp));···12541254 return 1;12551255 }12561256 /* set output mode (BAYER) */12571257- se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0);12571257+ se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0);1258125812591259 rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp));12601260 se401->brightness=cp[0]+cp[1]*256;···12921292 } else12931293 se401->inturb=NULL;1294129412951295- /* Flash the led */12961296- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);12971297- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);12981298- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);12951295+ /* Flash the led */12961296+ se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);12971297+ se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);12981298+ se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);12991299 se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0);1300130013011301- return 0;13011301+ return 0;13021302}1303130313041304static int se401_probe(struct usb_interface *intf,13051305 const struct usb_device_id *id)13061306{13071307 struct usb_device *dev = interface_to_usbdev(intf);13081308- struct usb_interface_descriptor *interface;13091309- struct usb_se401 *se401;13101310- char *camera_name=NULL;13081308+ struct usb_interface_descriptor *interface;13091309+ struct usb_se401 *se401;13101310+ char *camera_name=NULL;13111311 int button=1;1312131213131313- /* We don't handle multi-config cameras */13141314- if (dev->descriptor.bNumConfigurations != 1)13151315- return -ENODEV;13131313+ /* We don't handle multi-config cameras */13141314+ if (dev->descriptor.bNumConfigurations != 1)13151315+ return -ENODEV;1316131613171317- interface = &intf->cur_altsetting->desc;13171317+ interface = &intf->cur_altsetting->desc;1318131813191319- /* Is it an se401? */13201320- if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 &&13211321- le16_to_cpu(dev->descriptor.idProduct) == 0x0004) {13221322- camera_name="Endpoints/Aox SE401";13231323- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 &&13241324- le16_to_cpu(dev->descriptor.idProduct) == 0x030b) {13251325- camera_name="Philips PCVC665K";13261326- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13191319+ /* Is it an se401? */13201320+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 &&13211321+ le16_to_cpu(dev->descriptor.idProduct) == 0x0004) {13221322+ camera_name="Endpoints/Aox SE401";13231323+ } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 &&13241324+ le16_to_cpu(dev->descriptor.idProduct) == 0x030b) {13251325+ camera_name="Philips PCVC665K";13261326+ } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13271327 le16_to_cpu(dev->descriptor.idProduct) == 0x5001) {13281328 camera_name="Kensington VideoCAM 67014";13291329- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13291329+ } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13301330 le16_to_cpu(dev->descriptor.idProduct) == 0x5002) {13311331 camera_name="Kensington VideoCAM 6701(5/7)";13321332- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13321332+ } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&13331333 le16_to_cpu(dev->descriptor.idProduct) == 0x5003) {13341334 camera_name="Kensington VideoCAM 67016";13351335 button=0;13361336 } else13371337 return -ENODEV;1338133813391339- /* Checking vendor/product should be enough, but what the hell */13401340- if (interface->bInterfaceClass != 0x00)13391339+ /* Checking vendor/product should be enough, but what the hell */13401340+ if (interface->bInterfaceClass != 0x00)13411341 return -ENODEV;13421342- if (interface->bInterfaceSubClass != 0x00)13421342+ if (interface->bInterfaceSubClass != 0x00)13431343 return -ENODEV;1344134413451345- /* We found one */13461346- info("SE401 camera found: %s", camera_name);13451345+ /* We found one */13461346+ info("SE401 camera found: %s", camera_name);1347134713481348- if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) {13491349- err("couldn't kmalloc se401 struct");13481348+ if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) {13491349+ err("couldn't kmalloc se401 struct");13501350 return -ENOMEM;13511351- }13511351+ }1352135213531353- se401->dev = dev;13541354- se401->iface = interface->bInterfaceNumber;13551355- se401->camera_name = camera_name;13531353+ se401->dev = dev;13541354+ se401->iface = interface->bInterfaceNumber;13551355+ se401->camera_name = camera_name;1356135613571357 info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255);1358135813591359- if (se401_init(se401, button)) {13591359+ if (se401_init(se401, button)) {13601360 kfree(se401);13611361 return -EIO;13621362 }···13751375 info("registered new video device: video%d", se401->vdev.minor);1376137613771377 usb_set_intfdata (intf, se401);13781378- return 0;13781378+ return 0;13791379}1380138013811381static void se401_disconnect(struct usb_interface *intf)···14001400}1401140114021402static struct usb_driver se401_driver = {14031403- .name = "se401",14041404- .id_table = device_table,14031403+ .name = "se401",14041404+ .id_table = device_table,14051405 .probe = se401_probe,14061406- .disconnect = se401_disconnect,14061406+ .disconnect = se401_disconnect,14071407};1408140814091409
+3-3
drivers/media/video/se401.h
···177177 int expose_m;178178 int expose_l;179179 int resetlevel;180180-180180+181181 int enhance;182182183183 int format;···200200201201 struct urb *urb[SE401_NUMSBUF];202202 struct urb *inturb;203203-203203+204204 int button;205205 int buttonpressed;206206207207 int curframe; /* Current receiving frame */208208- struct se401_frame frame[SE401_NUMFRAMES]; 208208+ struct se401_frame frame[SE401_NUMFRAMES];209209 int readcount;210210 int framecount;211211 int error;
···5353}545455555656-static int pas106b_get_ctrl(struct sn9c102_device* cam, 5757- struct v4l2_control* ctrl)5656+static int pas106b_get_ctrl(struct sn9c102_device* cam,5757+ struct v4l2_control* ctrl)5858{5959 switch (ctrl->id) {6060 case V4L2_CID_EXPOSURE:···102102}103103104104105105-static int pas106b_set_ctrl(struct sn9c102_device* cam, 106106- const struct v4l2_control* ctrl)105105+static int pas106b_set_ctrl(struct sn9c102_device* cam,106106+ const struct v4l2_control* ctrl)107107{108108 int err = 0;109109···140140}141141142142143143-static int pas106b_set_crop(struct sn9c102_device* cam, 144144- const struct v4l2_rect* rect)143143+static int pas106b_set_crop(struct sn9c102_device* cam,144144+ const struct v4l2_rect* rect)145145{146146 struct sn9c102_sensor* s = &pas106b;147147 int err = 0;···155155}156156157157158158-static int pas106b_set_pix_format(struct sn9c102_device* cam, 159159- const struct v4l2_pix_format* pix)158158+static int pas106b_set_pix_format(struct sn9c102_device* cam,159159+ const struct v4l2_pix_format* pix)160160{161161 int err = 0;162162
+3-3
drivers/media/video/sn9c102/sn9c102_pas202bca.c
···545455555656static int pas202bca_set_pix_format(struct sn9c102_device* cam,5757- const struct v4l2_pix_format* pix)5757+ const struct v4l2_pix_format* pix)5858{5959 int err = 0;6060···686869697070static int pas202bca_set_ctrl(struct sn9c102_device* cam,7171- const struct v4l2_control* ctrl)7171+ const struct v4l2_control* ctrl)7272{7373 int err = 0;7474···102102103103104104static int pas202bca_set_crop(struct sn9c102_device* cam,105105- const struct v4l2_rect* rect)105105+ const struct v4l2_rect* rect)106106{107107 struct sn9c102_sensor* s = &pas202bca;108108 int err = 0;
+9-9
drivers/media/video/sn9c102/sn9c102_pas202bcb.c
···5858}595960606161-static int pas202bcb_get_ctrl(struct sn9c102_device* cam, 6262- struct v4l2_control* ctrl)6161+static int pas202bcb_get_ctrl(struct sn9c102_device* cam,6262+ struct v4l2_control* ctrl)6363{6464 switch (ctrl->id) {6565 case V4L2_CID_EXPOSURE:···101101}102102103103104104-static int pas202bcb_set_pix_format(struct sn9c102_device* cam, 105105- const struct v4l2_pix_format* pix)104104+static int pas202bcb_set_pix_format(struct sn9c102_device* cam,105105+ const struct v4l2_pix_format* pix)106106{107107 int err = 0;108108···115115}116116117117118118-static int pas202bcb_set_ctrl(struct sn9c102_device* cam, 119119- const struct v4l2_control* ctrl)118118+static int pas202bcb_set_ctrl(struct sn9c102_device* cam,119119+ const struct v4l2_control* ctrl)120120{121121 int err = 0;122122···149149}150150151151152152-static int pas202bcb_set_crop(struct sn9c102_device* cam, 153153- const struct v4l2_rect* rect)152152+static int pas202bcb_set_crop(struct sn9c102_device* cam,153153+ const struct v4l2_rect* rect)154154{155155 struct sn9c102_sensor* s = &pas202bcb;156156 int err = 0;···167167static struct sn9c102_sensor pas202bcb = {168168 .name = "PAS202BCB",169169 .maintainer = "Carlos Eduardo Medaglia Dyonisio "170170- "<medaglia@undl.org.br>",170170+ "<medaglia@undl.org.br>",171171 .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE,172172 .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ,173173 .interface = SN9C102_I2C_2WIRES,
+35-35
drivers/media/video/sn9c102/sn9c102_sensor.h
···5858 Probing functions: on success, you must attach the sensor to the camera5959 by calling sn9c102_attach_sensor() provided below.6060 To enable the I2C communication, you might need to perform a really basic6161- initialization of the SN9C10X chip by using the write function declared 6161+ initialization of the SN9C10X chip by using the write function declared6262 ahead.6363 Functions must return 0 on success, the appropriate error otherwise.6464*/···73737474/*7575 Add the above entries to this table. Be sure to add the entry in the right7676- place, since, on failure, the next probing routine is called according to 7676+ place, since, on failure, the next probing routine is called according to7777 the order of the list below, from top to bottom.7878*/7979#define SN9C102_SENSOR_TABLE \···9494sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id);95959696/* Attach a probed sensor to the camera. */9797-extern void 9797+extern void9898sn9c102_attach_sensor(struct sn9c102_device* cam,9999- struct sn9c102_sensor* sensor);9999+ struct sn9c102_sensor* sensor);100100101101/*102102 Each SN9C10x camera has proper PID/VID identifiers.···105105*/106106#define SN9C102_USB_DEVICE(vend, prod, intclass) \107107 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \108108- USB_DEVICE_ID_MATCH_INT_CLASS, \108108+ USB_DEVICE_ID_MATCH_INT_CLASS, \109109 .idVendor = (vend), \110110 .idProduct = (prod), \111111 .bInterfaceClass = (intclass)···162162 Read/write routines: they always return -1 on error, 0 or the read value163163 otherwise. NOTE that a real read operation is not supported by the SN9C10X164164 chip for some of its registers. To work around this problem, a pseudo-read165165- call is provided instead: it returns the last successfully written value 165165+ call is provided instead: it returns the last successfully written value166166 on the register (0 if it has never been written), the usual -1 on error.167167*/168168169169/* The "try" I2C I/O versions are used when probing the sensor */170170extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*,171171- u8 address, u8 value);171171+ u8 address, u8 value);172172extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,173173- u8 address);173173+ u8 address);174174175175/*176176 These must be used if and only if the sensor doesn't implement the standard177177- I2C protocol. There are a number of good reasons why you must use the 177177+ I2C protocol. There are a number of good reasons why you must use the178178 single-byte versions of these functions: do not abuse. The first function179179 writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X180180 chip. The second one programs the registers 0x09 and 0x10 with data0 and···184184 byte.185185*/186186extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,187187- struct sn9c102_sensor* sensor, u8 n, 188188- u8 data0, u8 data1, u8 data2, u8 data3,189189- u8 data4, u8 data5);187187+ struct sn9c102_sensor* sensor, u8 n,188188+ u8 data0, u8 data1, u8 data2, u8 data3,189189+ u8 data4, u8 data5);190190extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,191191- struct sn9c102_sensor* sensor, u8 data0,192192- u8 data1, u8 n, u8 buffer[]);191191+ struct sn9c102_sensor* sensor, u8 data0,192192+ u8 data1, u8 n, u8 buffer[]);193193194194/* To be used after the sensor struct has been attached to the camera struct */195195extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value);···252252253253 /*254254 NOTE: Where not noted,most of the functions below are not mandatory.255255- Set to null if you do not implement them. If implemented,256256- they must return 0 on success, the proper error otherwise.255255+ Set to null if you do not implement them. If implemented,256256+ they must return 0 on success, the proper error otherwise.257257 */258258259259 int (*init)(struct sn9c102_device* cam);260260 /*261261- This function will be called after the sensor has been attached. 261261+ This function will be called after the sensor has been attached.262262 It should be used to initialize the sensor only, but may also263263 configure part of the SN9C10X chip if necessary. You don't need to264264 setup picture settings like brightness, contrast, etc.. here, if265265- the corrisponding controls are implemented (see below), since 265265+ the corrisponding controls are implemented (see below), since266266 they are adjusted in the core driver by calling the set_ctrl()267267 method after init(), where the arguments are the default values268268 specified in the v4l2_queryctrl list of supported controls;···273273274274 struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS];275275 /*276276- Optional list of default controls, defined as indicated in the 276276+ Optional list of default controls, defined as indicated in the277277 V4L2 API. Menu type controls are not handled by this interface.278278 */279279280280 int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl);281281 int (*set_ctrl)(struct sn9c102_device* cam,282282- const struct v4l2_control* ctrl);282282+ const struct v4l2_control* ctrl);283283 /*284284 You must implement at least the set_ctrl method if you have defined285285 the list above. The returned value must follow the V4L2···306306 specified in the cropcap substructures 'bounds' and 'defrect'.307307 By default, the source rectangle should cover the largest possible308308 area. Again, it is not always true that the largest source rectangle309309- can cover the entire active window, although it is a rare case for 309309+ can cover the entire active window, although it is a rare case for310310 the hardware we have. The bounds of the source rectangle _must_ be311311 multiple of 16 and must use the same coordinate system as indicated312312 before; their centers shall align initially.···317317 defined the correct default bounds in the structures.318318 See the V4L2 API for further details.319319 NOTE: once you have defined the bounds of the active window320320- (struct cropcap.bounds) you must not change them.anymore.320320+ (struct cropcap.bounds) you must not change them.anymore.321321 Only 'bounds' and 'defrect' fields are mandatory, other fields322322 will be ignored.323323 */324324325325 int (*set_crop)(struct sn9c102_device* cam,326326- const struct v4l2_rect* rect);326326+ const struct v4l2_rect* rect);327327 /*328328 To be called on VIDIOC_C_SETCROP. The core module always calls a329329 default routine which configures the appropriate SN9C10X regs (also···332332 case you override the default function, you always have to program333333 the chip to match those values; on error return the corresponding334334 error code without rolling back.335335- NOTE: in case, you must program the SN9C10X chip to get rid of 336336- blank pixels or blank lines at the _start_ of each line or337337- frame after each HSYNC or VSYNC, so that the image starts with338338- real RGB data (see regs 0x12, 0x13) (having set H_SIZE and,339339- V_SIZE you don't have to care about blank pixels or blank340340- lines at the end of each line or frame).335335+ NOTE: in case, you must program the SN9C10X chip to get rid of336336+ blank pixels or blank lines at the _start_ of each line or337337+ frame after each HSYNC or VSYNC, so that the image starts with338338+ real RGB data (see regs 0x12, 0x13) (having set H_SIZE and,339339+ V_SIZE you don't have to care about blank pixels or blank340340+ lines at the end of each line or frame).341341 */342342343343 struct v4l2_pix_format pix_format;···349349 number of bits per pixel for uncompressed video, 8 or 9 (despite the350350 current value of 'pixelformat').351351 NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4352352- of cropcap.defrect.width and cropcap.defrect.height. I353353- suggest 1/1.352352+ of cropcap.defrect.width and cropcap.defrect.height. I353353+ suggest 1/1.354354 NOTE 2: The initial compression quality is defined by the first bit355355- of reg 0x17 during the initialization of the image sensor.355355+ of reg 0x17 during the initialization of the image sensor.356356 NOTE 3: as said above, you have to program the SN9C10X chip to get357357- rid of any blank pixels, so that the output of the sensor358358- matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR).357357+ rid of any blank pixels, so that the output of the sensor358358+ matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR).359359 */360360361361 int (*set_pix_format)(struct sn9c102_device* cam,362362- const struct v4l2_pix_format* pix);362362+ const struct v4l2_pix_format* pix);363363 /*364364 To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to365365 SN9C10X pixel format or viceversa. On error return the corresponding
+6-6
drivers/media/video/sn9c102/sn9c102_tas5110c1b.c
···4444}454546464747-static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, 4848- const struct v4l2_control* ctrl)4747+static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,4848+ const struct v4l2_control* ctrl)4949{5050 int err = 0;5151···6161}626263636464-static int tas5110c1b_set_crop(struct sn9c102_device* cam, 6565- const struct v4l2_rect* rect)6464+static int tas5110c1b_set_crop(struct sn9c102_device* cam,6565+ const struct v4l2_rect* rect)6666{6767 struct sn9c102_sensor* s = &tas5110c1b;6868 int err = 0;···8181}828283838484-static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, 8585- const struct v4l2_pix_format* pix)8484+static int tas5110c1b_set_pix_format(struct sn9c102_device* cam,8585+ const struct v4l2_pix_format* pix)8686{8787 int err = 0;8888
+6-6
drivers/media/video/sn9c102/sn9c102_tas5130d1b.c
···4242}434344444545-static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, 4646- const struct v4l2_control* ctrl)4545+static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,4646+ const struct v4l2_control* ctrl)4747{4848 int err = 0;4949···6262}636364646565-static int tas5130d1b_set_crop(struct sn9c102_device* cam, 6666- const struct v4l2_rect* rect)6565+static int tas5130d1b_set_crop(struct sn9c102_device* cam,6666+ const struct v4l2_rect* rect)6767{6868 struct sn9c102_sensor* s = &tas5130d1b;6969 u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104,···8282}838384848585-static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, 8686- const struct v4l2_pix_format* pix)8585+static int tas5130d1b_set_pix_format(struct sn9c102_device* cam,8686+ const struct v4l2_pix_format* pix)8787{8888 int err = 0;8989
+5-5
drivers/media/video/stradis.c
···11-/* 11+/*22 * stradis.c - stradis 4:2:2 mpeg decoder driver33 *44 * Stradis 4:2:2 MPEG-2 Decoder Driver···11911191}1192119211931193/* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area11941194- * bitmap is fixed width, 128 bytes (1024 pixels represented) 11951195- * arranged most-sigificant-bit-left in 32-bit words 11961196- * based on saa7146 clipping hardware, it swaps bytes if LE 11941194+ * bitmap is fixed width, 128 bytes (1024 pixels represented)11951195+ * arranged most-sigificant-bit-left in 32-bit words11961196+ * based on saa7146 clipping hardware, it swaps bytes if LE11971197 * much of this makes up for egcs brain damage -- so if you11981198 * are wondering "why did he do this?" it is because the C11991199 * was adjusted to generate the optimal asm output without···12591259 clip_draw_rectangle(clipmap, cr[i].x, cr[i].y,12601260 cr[i].width, cr[i].height);12611261 }12621262- /* clip against viewing window AND screen 12621262+ /* clip against viewing window AND screen12631263 so we do not have to rely on the user program12641264 */12651265 clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ?
+24-24
drivers/media/video/stv680.c
···11/*22 * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net)33- * 44- * Thanks to STMicroelectronics for information on the usb commands, and 55- * to Steve Miller at STM for his help and encouragement while I was 33+ *44+ * Thanks to STMicroelectronics for information on the usb commands, and55+ * to Steve Miller at STM for his help and encouragement while I was66 * writing this driver.77 *88- * This driver is based heavily on the 88+ * This driver is based heavily on the99 * Endpoints (formerly known as AOX) se401 USB Camera Driver1010 * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)1111 *1212 * Still somewhat based on the Linux ov511 driver.1313- * 1313+ *1414 * This program is free software; you can redistribute it and/or modify it1515 * under the terms of the GNU General Public License as published by the1616 * Free Software Foundation; either version 2 of the License, or (at your···2525 * along with this program; if not, write to the Free Software Foundation,2626 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2727 *2828- * History: 2929- * ver 0.1 October, 2001. Initial attempt. 2828+ * History:2929+ * ver 0.1 October, 2001. Initial attempt.3030 *3131 * ver 0.2 November, 2001. Fixed asbility to resize, added brightness3232 * function, made more stable (?)3333 *3434- * ver 0.21 Nov, 2001. Added gamma correction and white balance, 3535- * due to Alexander Schwartz. Still trying to 3434+ * ver 0.21 Nov, 2001. Added gamma correction and white balance,3535+ * due to Alexander Schwartz. Still trying to3636 * improve stablility. Moved stuff into stv680.h3737 *3838- * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, 3939- * mike@easysw.com) from GIMP, also used in pencam. 3838+ * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet,3939+ * mike@easysw.com) from GIMP, also used in pencam.4040 * Simple, fast, good integer math routine.4141 *4242 * ver 0.23 Dec, 2001 (gkh)···4444 * Lindent, and did other minor tweaks to get4545 * things to work properly with 2.5.14646 *4747- * ver 0.24 Jan, 2002 (kjs) 4747+ * ver 0.24 Jan, 2002 (kjs)4848 * Fixed the problem with webcam crashing after4949- * two pictures. Changed the way pic is halved to 5050- * improve quality. Got rid of green line around 5151- * frame. Fix brightness reset when changing size 4949+ * two pictures. Changed the way pic is halved to5050+ * improve quality. Got rid of green line around5151+ * frame. Fix brightness reset when changing size5252 * bug. Adjusted gamma filters slightly.5353 *5454 * ver 0.25 Jan, 2002 (kjs)···484484 PDEBUG (1, "STV(i): swapRGB is (forced) ON");485485 else if (swapRGB_on == -1)486486 PDEBUG (1, "STV(i): swapRGB is (forced) OFF");487487-487487+488488 if (stv_set_video_mode (stv680) < 0) {489489 PDEBUG (0, "STV(e): Could not set video mode in stv_init");490490 return -1;···570570 if (stv680->brightness != p->brightness) {571571 stv680->chgbright = 1;572572 stv680->brightness = p->brightness;573573- } 573573+ }574574575575 stv680->whiteness = p->whiteness; /* greyscale */576576 stv680->colour = p->colour;···612612613613 case BUFFER_UNUSED:614614 memcpy (stv680->scratch[stv680->scratch_next].data,615615- (unsigned char *) urb->transfer_buffer, length);615615+ (unsigned char *) urb->transfer_buffer, length);616616 stv680->scratch[stv680->scratch_next].state = BUFFER_READY;617617 stv680->scratch[stv680->scratch_next].length = length;618618 if (waitqueue_active (&stv680->wq)) {···752752 PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight);753753 return 1;754754 }755755-755755+756756 /* Stop a current stream and start it again at the new size */757757 if (wasstreaming)758758 stv680_stop_stream (stv680);···773773774774/*775775 * STV0680 Vision Camera Chipset Driver776776- * Copyright (C) 2000 Adam Harrison <adam@antispin.org> 776776+ * Copyright (C) 2000 Adam Harrison <adam@antispin.org>777777*/778778779779#define RED 0···842842 colour = 2;843843 break;844844 }845845- i = (y * vw + x) * 3; 845845+ i = (y * vw + x) * 3;846846 *(output + i + colour) = (unsigned char) p;847847 } /* for x */848848···850850851851 /****** gamma correction plus hardcoded white balance */852852 /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code.853853- Correction values red[], green[], blue[], are generated by 854854- (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. 855855- White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and 853853+ Correction values red[], green[], blue[], are generated by854854+ (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255.855855+ White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and856856 converted to unsigned char. Values are in stv680.h */857857858858 for (y = 0; y < vh; y++) {
···3535module_param(debug, int, 0644);3636MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");3737#define dprintk(args...) \3838- do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)3838+ do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)39394040#define SWITCH 0x004141#define LEVEL_ADJUST 0x02
+1-1
drivers/media/video/tea6415c.c
···3737module_param(debug, int, 0644);3838MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");3939#define dprintk(args...) \4040- do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)4040+ do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)41414242#define TEA6415C_NUM_INPUTS 84343#define TEA6415C_NUM_OUTPUTS 6
+1-1
drivers/media/video/tea6420.c
···3737module_param(debug, int, 0644);3838MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");3939#define dprintk(args...) \4040- do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)4040+ do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)41414242/* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */4343static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END };
+25-25
drivers/media/video/tuner-3036.c
···55 *66 * The SAB3036 is just about different enough from the chips that77 * tuner.c copes with to make it not worth the effort to crowbar88- * the support into that file. So instead we have a separate driver. 88+ * the support into that file. So instead we have a separate driver.99 *1010 * This program is free software; you can redistribute it and/or1111 * modify it under the terms of the GNU General Public License···56565757#define TUNER_FL 0x8058585959-static int 5959+static int6060tuner_islocked (struct i2c_client *c)6161{6262- return (tuner_getstatus(c) & TUNER_FL);6262+ return (tuner_getstatus(c) & TUNER_FL);6363}64646565/* ---------------------------------------------------------------------- */66666767-static void 6767+static void6868set_tv_freq(struct i2c_client *c, int freq)6969{7070 u16 div = ((freq * 20) / 16);···73737474 if (debug)7575 printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div);7676-7676+7777 /* Select high tuning current */7878 buffer[0] = 0x29;7979 buffer[1] = 0x3e;80808181 if (i2c_master_send(c, buffer, 2) != 2)8282 printk("tuner: i2c i/o error 1\n");8383-8383+8484 buffer[0] = 0x80 | ((div>>8) & 0x7f);8585 buffer[1] = div & 0xff;86868787 if (i2c_master_send(c, buffer, 2) != 2)8888 printk("tuner: i2c i/o error 2\n");8989-8989+9090 while (!tuner_islocked(c) && time_before(jiffies, give_up))9191 schedule();9292-9292+9393 if (!tuner_islocked(c))9494 printk(KERN_WARNING "tuner: failed to achieve PLL lock\n");9595-9595+9696 /* Select low tuning current and engage AFC */9797 buffer[0] = 0x29;9898 buffer[1] = 0xb2;···106106107107/* ---------------------------------------------------------------------- */108108109109-static int 109109+static int110110tuner_attach(struct i2c_adapter *adap, int addr, int kind)111111{112112 static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 };···116116 if (this_adap > 0)117117 return -1;118118 this_adap++;119119-120120- client_template.adapter = adap;121121- client_template.addr = addr;119119+120120+ client_template.adapter = adap;121121+ client_template.addr = addr;122122123123 client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);124124- if (client == NULL)125125- return -ENOMEM;126126- memcpy(client, &client_template, sizeof(struct i2c_client));124124+ if (client == NULL)125125+ return -ENOMEM;126126+ memcpy(client, &client_template, sizeof(struct i2c_client));127127128128 printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client));129129130130- i2c_attach_client(client);130130+ i2c_attach_client(client);131131132132 if (i2c_master_send(client, buffer, 2) != 2)133133 printk("tuner: i2c i/o error 1\n");···138138 return 0;139139}140140141141-static int 141141+static int142142tuner_detach(struct i2c_client *c)143143{144144 return 0;145145}146146147147-static int 147147+static int148148tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)149149{150150 int *iarg = (int*)arg;151151152152- switch (cmd) 152152+ switch (cmd)153153 {154154 case VIDIOCSFREQ:155155 set_tv_freq(client, *iarg);156156 break;157157-157157+158158 default:159159 return -EINVAL;160160 }161161 return 0;162162}163163164164-static int 164164+static int165165tuner_probe(struct i2c_adapter *adap)166166{167167 this_adap = 0;···172172173173/* ----------------------------------------------------------------------- */174174175175-static struct i2c_driver 176176-i2c_driver_tuner = 175175+static struct i2c_driver176176+i2c_driver_tuner =177177{178178 .driver = {179179 .name = "sab3036",···186186187187static struct i2c_client client_template =188188{189189- .driver = &i2c_driver_tuner,189189+ .driver = &i2c_driver_tuner,190190 .name = "SAB3036",191191};192192
···3636enum ctrl_req {3737 SetWhitebal = 0x01,3838 SetBrightness = 0x02,3939- SetSharpness = 0x03,3939+ SetSharpness = 0x03,4040 SetContrast = 0x04,4141 SetSaturation = 0x05,4242};···4747 SIZE_160X136 = 1,4848 SIZE_176X144 = 2,4949 SIZE_320X240 = 3,5050-5050+5151};52525353#define MAX_FRAME_SIZE SIZE_320X240···6969/* Some default values for initial camera settings,7070 can be set by modprobe */71717272-static int size; 7272+static int size;7373static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */7474static int brightness = MAX_BRIGHTNESS/2;7575static int contrast = MAX_CONTRAST/2;···132132133133static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)134134{135135- int retval = usb_control_msg(uvd->dev,135135+ int retval = usb_control_msg(uvd->dev,136136 dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0),137137 request, 0x40 | dir, value, index, buf, len, 1000);138138- return retval < 0 ? retval : 0;138138+ return retval < 0 ? retval : 0;139139}140140141141142142static inline void konicawc_camera_on(struct uvd *uvd)143143{144144- DEBUG(0, "camera on");145145- konicawc_set_misc(uvd, 0x2, 1, 0x0b);144144+ DEBUG(0, "camera on");145145+ konicawc_set_misc(uvd, 0x2, 1, 0x0b);146146}147147148148149149static inline void konicawc_camera_off(struct uvd *uvd)150150{151151- DEBUG(0, "camera off");152152- konicawc_set_misc(uvd, 0x2, 0, 0x0b);151151+ DEBUG(0, "camera off");152152+ konicawc_set_misc(uvd, 0x2, 0, 0x0b);153153}154154155155···317317 button = !!(sts & 0x40);318318 sts &= ~0x40;319319 }320320-320320+321321 /* work out the button status, but don't do322322 anything with it for now */323323···331331 discard++;332332 continue;333333 }334334-334334+335335 if((sts > 0x01) && (sts < 0x80)) {336336 info("unknown status %2.2x", sts);337337 bad++;···350350 DEBUG(2, "found initial image");351351 cam->lastframe = -1;352352 }353353-353353+354354 marker[3] = sts & 0x7F;355355 RingQueue_Enqueue(&uvd->dp, marker, 4);356356 totlen += 4;···367367368368static void resubmit_urb(struct uvd *uvd, struct urb *urb)369369{370370- int i, ret;371371- for (i = 0; i < FRAMES_PER_DESC; i++) {372372- urb->iso_frame_desc[i].status = 0;373373- }374374- urb->dev = uvd->dev;375375- urb->status = 0;370370+ int i, ret;371371+ for (i = 0; i < FRAMES_PER_DESC; i++) {372372+ urb->iso_frame_desc[i].status = 0;373373+ }374374+ urb->dev = uvd->dev;375375+ urb->status = 0;376376 ret = usb_submit_urb(urb, GFP_ATOMIC);377377 DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length);378378- if(ret)379379- err("usb_submit_urb error (%d)", ret);378378+ if(ret)379379+ err("usb_submit_urb error (%d)", ret);380380381381}382382···490490 }491491492492 cam->last_data_urb = NULL;493493-493493+494494 /* Submit all URBs */495495 for (i=0; i < USBVIDEO_NUMSBUF; i++) {496496 errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL);···539539540540541541static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)542542-{ 542542+{543543 struct konicawc *cam = (struct konicawc *)uvd->user_data;544544 int maxline = cam->maxline;545545 int yplanesz = cam->yplanesz;···583583584584 if(frame->scanstate == ScanState_Scanning)585585 return;586586-586586+587587 /* Try to move data from queue into frame buffer588588 * We get data in blocks of 384 bytes made up of:589589 * 256 Y, 64 U, 64 V.590590 * This needs to be written out as a Y plane, a U plane and a V plane.591591 */592592-592592+593593 while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) {594594 /* Y */595595 RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256);
+1-1
drivers/media/video/usbvideo/ultracam.c
···2323typedef struct {2424 int initialized; /* Had we already sent init sequence? */2525 int camera_model; /* What type of IBM camera we got? */2626- int has_hdr;2626+ int has_hdr;2727} ultracam_t;2828#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))2929
+21-21
drivers/media/video/usbvideo/usbvideo.c
···574574 } else {575575 /* Just the blue screen */576576 }577577-577577+578578 *f++ = cb;579579 *f++ = cg;580580 *f++ = cr;···1243124312441244#if USBVIDEO_REPORT_STATS12451245 usbvideo_ReportStatistics(uvd);12461246-#endif 12461246+#endif1247124712481248 uvd->user--;12491249 if (uvd->remove_pending) {···12901290 return 0;12911291 }12921292 case VIDIOCSCHAN:12931293- { 12931293+ {12941294 struct video_channel *v = arg;12951295 if (v->channel != 0)12961296 return -EINVAL;···13471347 vw->chromakey = 0;13481348 if (VALID_CALLBACK(uvd, getFPS))13491349 vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);13501350- else 13501350+ else13511351 vw->flags = 10; /* FIXME: do better! */13521352 return 0;13531353 }···13591359 memset(vm, 0, sizeof(*vm));13601360 vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES;13611361 vm->frames = USBVIDEO_NUMFRAMES;13621362- for(i = 0; i < USBVIDEO_NUMFRAMES; i++) 13621362+ for(i = 0; i < USBVIDEO_NUMFRAMES; i++)13631363 vm->offsets[i] = i * uvd->max_frame_size;1364136413651365 return 0;···1425142514261426 if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES)14271427 return -EINVAL;14281428-14281428+14291429 if (uvd->debug >= 1)14301430 info("VIDIOCSYNC: syncing to frame %d.", *frameNum);14311431 if (uvd->flags & FLAGS_NO_DECODING)···14541454 struct video_buffer *vb = arg;1455145514561456 memset(vb, 0, sizeof(*vb));14571457- return 0;14581458- }14571457+ return 0;14581458+ }14591459 case VIDIOCKEY:14601460 return 0;14611461···17041704 info("Not streaming, but interrupt!");17051705 return;17061706 }17071707-17071707+17081708 uvd->stats.urb_count++;17091709 if (urb->actual_length <= 0)17101710 goto urb_done_with;···17631763 }17641764 if (VALID_CALLBACK(uvd, videoStart))17651765 GET_CALLBACK(uvd, videoStart)(uvd);17661766- else 17661766+ else17671767 err("%s: videoStart not set", __FUNCTION__);1768176817691769 /* We double buffer the Iso lists */···18301830 /* Invoke minidriver's magic to stop the camera */18311831 if (VALID_CALLBACK(uvd, videoStop))18321832 GET_CALLBACK(uvd, videoStop)(uvd);18331833- else 18331833+ else18341834 err("%s: videoStop not set", __FUNCTION__);1835183518361836 /* Set packet size to 0 */···19631963 info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);1964196419651965 switch (frame->frameState) {19661966- case FrameState_Unused:19661966+ case FrameState_Unused:19671967 if (uvd->debug >= 2)19681968 info("%s: FrameState_Unused", __FUNCTION__);19691969 return -EINVAL;19701970- case FrameState_Ready:19711971- case FrameState_Grabbing:19721972- case FrameState_Error:19731973- {19701970+ case FrameState_Ready:19711971+ case FrameState_Grabbing:19721972+ case FrameState_Error:19731973+ {19741974 int ntries, signalPending;19751975 redo:19761976 if (!CAMERA_IS_OPERATIONAL(uvd)) {···19781978 info("%s: Camera is not operational (1)", __FUNCTION__);19791979 return -EIO;19801980 }19811981- ntries = 0; 19811981+ ntries = 0;19821982 do {19831983 RingQueue_InterruptibleSleepOn(&uvd->dp);19841984 signalPending = signal_pending(current);···20102010 usbvideo_CollectRawData(uvd, frame);20112011 else if (VALID_CALLBACK(uvd, processData))20122012 GET_CALLBACK(uvd, processData)(uvd, frame);20132013- else 20132013+ else20142014 err("%s: processData not set", __FUNCTION__);20152015 }20162016 } while (frame->frameState == FrameState_Grabbing);···20272027 goto redo;20282028 }20292029 /* Note that we fall through to meet our destiny below */20302030- }20312031- case FrameState_Done:20302030+ }20312031+ case FrameState_Done:20322032 /*20332033 * Do all necessary postprocessing of data prepared in20342034 * "interrupt" code and the collecting code above. The···21572157 * History:21582158 * 09-Feb-2001 Created.21592159 */21602160-static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, 21602160+static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,21612161 struct usbvideo_frame *frame)21622162{21632163 int i, j, v4l_linesize;
+5-5
drivers/media/video/usbvideo/usbvideo.h
···189189190190/* Statistics that can be overlaid on screen */191191struct usbvideo_statistics {192192- unsigned long frame_num; /* Sequential number of the frame */193193- unsigned long urb_count; /* How many URBs we received so far */194194- unsigned long urb_length; /* Length of last URB */195195- unsigned long data_count; /* How many bytes we received */196196- unsigned long header_count; /* How many frame headers we found */192192+ unsigned long frame_num; /* Sequential number of the frame */193193+ unsigned long urb_count; /* How many URBs we received so far */194194+ unsigned long urb_length; /* Length of last URB */195195+ unsigned long data_count; /* How many bytes we received */196196+ unsigned long header_count; /* How many frame headers we found */197197 unsigned long iso_skip_count; /* How many empty ISO packets received */198198 unsigned long iso_err_count; /* How many bad ISO packets received */199199};
+14-14
drivers/media/video/usbvideo/vicam.c
···6969#define VICAM_HEADER_SIZE 6470707171#define clamp( x, l, h ) max_t( __typeof__( x ), \7272- ( l ), \7373- min_t( __typeof__( x ), \7474- ( h ), \7575- ( x ) ) )7272+ ( l ), \7373+ min_t( __typeof__( x ), \7474+ ( h ), \7575+ ( x ) ) )76767777/* Not sure what all the bytes in these char7878 * arrays do, but they're necessary to make···357357 * Not sure why these are not yet non-statics which I can reference through358358 * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime359359 * in the future.360360- * 360360+ *361361*/362362static void *rvmalloc(unsigned long size)363363{···603603 case VIDIOCSPICT:604604 {605605 struct video_picture vp;606606-606606+607607 if (copy_from_user(&vp, user_arg, sizeof(vp))) {608608 retval = -EFAULT;609609 break;610610 }611611-611611+612612 DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,613613 vp.palette);614614···655655 }656656657657 DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);658658-658658+659659 if ( vw.width != 320 || vw.height != 240 )660660 retval = -EFAULT;661661···809809 cam->needsDummyRead = 1;810810 cam->open_count++;811811812812- file->private_data = cam; 813813-812812+ file->private_data = cam;813813+814814 return 0;815815}816816817817-static int 817817+static int818818vicam_close(struct inode *inode, struct file *file)819819{820820 struct vicam_camera *cam = file->private_data;···1187118711881188 if ( !cam->proc_dir )11891189 return; // FIXME: We should probably return an error here11901190-11901190+11911191 ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR,11921192 cam->proc_dir);11931193 if (ent) {···12821282 const struct usb_host_interface *interface;12831283 const struct usb_endpoint_descriptor *endpoint;12841284 struct vicam_camera *cam;12851285-12851285+12861286 printk(KERN_INFO "ViCam based webcam connected\n");1287128712881288 interface = intf->cur_altsetting;···13311331 printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);1332133213331333 usb_set_intfdata (intf, cam);13341334-13341334+13351335 return 0;13361336}13371337
+26-26
drivers/media/video/videocodec.h
···5757 therfor they may not be initialized.58585959 The other fuctions are just for convenience, as they are for sure used by6060- most/all of the codecs. The last ones may be ommited, too. 6060+ most/all of the codecs. The last ones may be ommited, too.61616262 See the structure declaration below for more information and which data has6363 to be set up for the master and the slave.···7575/* ========================================== */76767777/*7878- ==== master setup ==== 7878+ ==== master setup ====7979 name -> name of the device structure for reference and debugging8080 master_data -> data ref. for the master (e.g. the zr36055,57,67)8181 readreg -> ref. to read-fn from register (setup by master, used by slave)8282 writereg -> ref. to write-fn to register (setup by master, used by slave)8383- this two functions do the lowlevel I/O job8383+ this two functions do the lowlevel I/O job84848585- ==== slave functionality setup ==== 8686- slave_data -> data ref. for the slave (e.g. the zr36050,60) 8585+ ==== slave functionality setup ====8686+ slave_data -> data ref. for the slave (e.g. the zr36050,60)8787 check -> fn-ref. checks availability of an device, returns -EIO on failure or8888- the type on success8989- this makes espcecially sense if a driver module supports more than9090- one codec which may be quite similar to access, nevertheless it9191- is good for a first functionality check 8888+ the type on success8989+ this makes espcecially sense if a driver module supports more than9090+ one codec which may be quite similar to access, nevertheless it9191+ is good for a first functionality check92929393- -- main functions you always need for compression/decompression -- 9393+ -- main functions you always need for compression/decompression --94949595 set_mode -> this fn-ref. resets the entire codec, and sets up the mode9696- with the last defined norm/size (or device default if not9797- available) - it returns 0 if the mode is possible 9696+ with the last defined norm/size (or device default if not9797+ available) - it returns 0 if the mode is possible9898 set_size -> this fn-ref. sets the norm and image size for9999- compression/decompression (returns 0 on success) 100100- the norm param is defined in videodev.h (VIDEO_MODE_*) 9999+ compression/decompression (returns 0 on success)100100+ the norm param is defined in videodev.h (VIDEO_MODE_*)101101102102 additional setup may be available, too - but the codec should work with103103- some default values even without this 103103+ some default values even without this104104105105- set_data -> sets device-specific data (tables, quality etc.) 106106- get_data -> query device-specific data (tables, quality etc.) 105105+ set_data -> sets device-specific data (tables, quality etc.)106106+ get_data -> query device-specific data (tables, quality etc.)107107108108- if the device delivers interrupts, they may be setup/handled here 109109- setup_interrupt -> codec irq setup (not needed for 36050/60) 110110- handle_interrupt -> codec irq handling (not needed for 36050/60) 108108+ if the device delivers interrupts, they may be setup/handled here109109+ setup_interrupt -> codec irq setup (not needed for 36050/60)110110+ handle_interrupt -> codec irq handling (not needed for 36050/60)111111112112- if the device delivers pictures, they may be handled here 113113- put_image -> puts image data to the codec (not needed for 36050/60) 114114- get_image -> gets image data from the codec (not needed for 36050/60) 115115- the calls include frame numbers and flags (even/odd/...) 116116- if needed and a flag which allows blocking until its ready 112112+ if the device delivers pictures, they may be handled here113113+ put_image -> puts image data to the codec (not needed for 36050/60)114114+ get_image -> gets image data from the codec (not needed for 36050/60)115115+ the calls include frame numbers and flags (even/odd/...)116116+ if needed and a flag which allows blocking until its ready117117*/118118119119/* ============== */120120/* user interface */121121/* ============== */122122123123-/* 123123+/*124124 Currently there is only a information display planned, as the layer125125 is not visible for the user space at all.126126
+2-2
drivers/media/video/vino.c
···15551555 unsigned int w = vcs->clipping.right - vcs->clipping.left;15561556 unsigned int d = vcs->decimation;15571557 unsigned int bpp = vino_data_formats[vcs->data_format].bpp;15581558- unsigned int lsize;15581558+ unsigned int lsize;1559155915601560 dprintk("update_line_size(): before: w = %d, d = %d, "15611561 "line_size = %d\n", w, d, vcs->line_size);1562156215631563- /* line size must be multiple of 8 bytes */15631563+ /* line size must be multiple of 8 bytes */15641564 lsize = (bpp * (w / d)) & ~7;15651565 w = (lsize / bpp) * d;15661566
+10-10
drivers/media/video/vpx3220.c
···11-/* 11+/*22 * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.133 *44 * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be>···176176177177static int178178vpx3220_write_fp_block (struct i2c_client *client,179179- const u16 *data,180180- unsigned int len)179179+ const u16 *data,180180+ unsigned int len)181181{182182 u8 reg;183183 int ret = 0;···316316 vpx3220_write_fp_block(client, init_fp,317317 sizeof(init_fp) >> 1);318318 switch (decoder->norm) {319319-319319+320320 case VIDEO_MODE_NTSC:321321 vpx3220_write_fp_block(client, init_ntsc,322322 sizeof(init_ntsc) >> 1);···324324325325 case VIDEO_MODE_PAL:326326 vpx3220_write_fp_block(client, init_pal,327327- sizeof(init_pal) >> 1);327327+ sizeof(init_pal) >> 1);328328 break;329329 case VIDEO_MODE_SECAM:330330 vpx3220_write_fp_block(client, init_secam,···332332 break;333333 default:334334 vpx3220_write_fp_block(client, init_pal,335335- sizeof(init_pal) >> 1);335335+ sizeof(init_pal) >> 1);336336 break;337337 }338338- } 338338+ }339339 break;340340341341 case DECODER_DUMP:···411411412412 /* Here we back up the input selection because it gets413413 overwritten when we fill the registers with the414414- choosen video norm */414414+ choosen video norm */415415 temp_input = vpx3220_fp_read(client, 0xf2);416416417417 dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n",···578578};579579580580static unsigned short ignore = I2C_CLIENT_END;581581-581581+582582static struct i2c_client_address_data addr_data = {583583 .normal_i2c = normal_i2c,584584 .probe = &ignore,···661661 break;662662 default:663663 dprintk(1,664664- KERN_INFO 664664+ KERN_INFO665665 "%s: Wrong part number (0x%04x)\n",666666 __func__, pn);667667 kfree(client);
+51-51
drivers/media/video/w9966.c
···2626 Does any other model using the w9966 interface chip exist ?27272828 Todo:2929-2929+3030 *Add a working EPP mode, since DMA ECP read isn't implemented3131 in the parport drivers. (That's why it's so sloow)3232···4747 *Probably some bugs that I don't know of48484949 Please support me by sending feedback!5050-5050+5151 Changes:5252-5252+5353 Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE5454 and owner support for newer module locks5555*/···204204 */205205206206207207-// Set camera phase flags, so we know what to uninit when terminating 207207+// Set camera phase flags, so we know what to uninit when terminating208208static inline void w9966_setState(struct w9966_dev* cam, int mask, int val)209209{210210 cam->dev_state = (cam->dev_state & ~mask) ^ val;···233233 parport_release(cam->pdev);234234 w9966_setState(cam, W9966_STATE_CLAIMED, 0);235235}236236-236236+237237// Read register from W9966 interface-chip238238// Expects a claimed pdev239239// -1 on error, else register data (byte)···242242 // ECP, read, regtransfer, REG, REG, REG, REG, REG243243 const unsigned char addr = 0x80 | (reg & 0x1f);244244 unsigned char val;245245-245245+246246 if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)247247 return -1;248248 if (parport_write(cam->pport, &addr, 1) != 1)···263263 // ECP, write, regtransfer, REG, REG, REG, REG, REG264264 const unsigned char addr = 0xc0 | (reg & 0x1f);265265 const unsigned char val = data;266266-266266+267267 if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)268268 return -1;269269 if (parport_write(cam->pport, &addr, 1) != 1)···284284{285285 if (cam->dev_state != 0)286286 return -1;287287-287287+288288 cam->pport = port;289289 cam->brightness = 128;290290 cam->contrast = 64;···302302 cam->ppmode = IEEE1284_MODE_EPP;303303 else304304 cam->ppmode = IEEE1284_MODE_ECP;305305- break; 305305+ break;306306 case 1: // hw- or sw-ecp307307 cam->ppmode = IEEE1284_MODE_ECP;308308 break;···310310 cam->ppmode = IEEE1284_MODE_EPP;311311 break;312312 }313313-313313+314314// Tell the parport driver that we exists315315 cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL);316316 if (cam->pdev == NULL) {···320320 w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);321321322322 w9966_pdev_claim(cam);323323-323323+324324// Setup a default capture mode325325 if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) {326326 DPRINTF("w9966_setup() failed.\n");···333333 memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));334334 cam->vdev.priv = cam;335335336336- if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) 336336+ if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1)337337 return -1;338338-338338+339339 w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);340340-340340+341341 // All ok342342 printk(343343 "w9966cf: Found and initialized a webcam on %s.\n",···391391 // Only continue as long as we keep getting better values392392 if (err > besterr)393393 break;394394-394394+395395 besterr = err;396396 bestlen = len;397397 }···399399 return bestlen;400400}401401402402-// Modify capture window (if necessary) 402402+// Modify capture window (if necessary)403403// and calculate downscaling404404// Return -1 on error405405static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor)···407407 int maxlen = max - min;408408 int len = *end - *beg + 1;409409 int newlen = w9966_findlen(len, size, maxlen);410410- int err = newlen - len; 410410+ int err = newlen - len;411411412412 // Check for bad format413413 if (newlen > maxlen || newlen < size)···452452 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,453453 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0454454 };455455-456456-455455+456456+457457 if (w*h*2 > W9966_SRAMSIZE)458458 {459459 DPRINTF("capture window exceeds SRAM size!.\n");···469469 cam->width = w;470470 cam->height = h;471471472472- enh_s = 0; 472472+ enh_s = 0;473473 enh_e = w*h*2;474474-474474+475475// Modify capture window if necessary and calculate downscaling476476 if (477477 w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 ||···482482 "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n",483483 w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80484484 );485485-485485+486486// Setup registers487487 regs[0x00] = 0x00; // Set normal operation488488 regs[0x01] = 0x18; // Capture mode489489 regs[0x02] = scale_y; // V-scaling490490 regs[0x03] = scale_x; // H-scaling491491-492492- // Capture window 491491+492492+ // Capture window493493 regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits)494494 regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits)495495 regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits)···499499 regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits)500500501501 regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb)502502-502502+503503 // Enhancement layer504504 regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7)505505 regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15)···515515 regs[0x19] = 0xff; // I/O port direction control516516 regs[0x1a] = 0xff; // I/O port data register517517 regs[0x1b] = 0x10; // ???518518-518518+519519 // SAA7111 chip settings520520 saa7111_regs[0x0a] = cam->brightness;521521 saa7111_regs[0x0b] = cam->contrast;···551551 cam->i2c_state |= W9966_I2C_W_DATA;552552 else553553 cam->i2c_state &= ~W9966_I2C_W_DATA;554554-554554+555555 w9966_wReg(cam, 0x18, cam->i2c_state);556556 udelay(5);557557}···577577578578 w9966_wReg(cam, 0x18, cam->i2c_state);579579 udelay(5);580580-580580+581581 // we go to high, we also expect the peripheral to ack.582582 if (state) {583583 timeout = jiffies + 100;···607607 w9966_i2c_setsda(cam, (data >> i) & 0x01);608608609609 if (w9966_i2c_setscl(cam, 1) == -1)610610- return -1; 610610+ return -1;611611 w9966_i2c_setscl(cam, 0);612612 }613613614614 w9966_i2c_setsda(cam, 1);615615-615615+616616 if (w9966_i2c_setscl(cam, 1) == -1)617617 return -1;618618 w9966_i2c_setscl(cam, 0);619619-619619+620620 return 0;621621}622622···626626static int w9966_i2c_rbyte(struct w9966_dev* cam)627627{628628 unsigned char data = 0x00;629629- int i; 630630-629629+ int i;630630+631631 w9966_i2c_setsda(cam, 1);632632633633 for (i = 0; i < 8; i++)···637637 data = data << 1;638638 if (w9966_i2c_getsda(cam))639639 data |= 0x01;640640-640640+641641 w9966_i2c_setscl(cam, 0);642642 }643643 return data;···673673 return -1;674674675675 w9966_i2c_setsda(cam, 0);676676-676676+677677 if (w9966_i2c_setscl(cam, 1) == -1)678678 return -1;679679 w9966_i2c_setsda(cam, 1);680680-680680+681681 return data;682682}683683#endif···699699 w9966_i2c_setsda(cam, 0);700700 if (w9966_i2c_setscl(cam, 1) == -1)701701 return -1;702702-702702+703703 w9966_i2c_setsda(cam, 1);704704705705 return 0;···714714{715715 struct video_device *vdev = video_devdata(file);716716 struct w9966_dev *cam = vdev->priv;717717-717717+718718 switch(cmd)719719 {720720 case VIDIOCGCAP:···790790 struct video_picture *vpic = arg;791791 if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422)792792 return -EINVAL;793793-793793+794794 cam->brightness = vpic->brightness >> 8;795795 cam->hue = (vpic->hue >> 8) - 128;796796 cam->color = vpic->colour >> 9;797797 cam->contrast = vpic->contrast >> 9;798798799799 w9966_pdev_claim(cam);800800-800800+801801 if (802802 w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||803803 w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||···807807 w9966_pdev_release(cam);808808 return -EIO;809809 }810810-810810+811811 w9966_pdev_release(cam);812812 return 0;813813 }···815815 {816816 int ret;817817 struct video_window *vwin = arg;818818-818818+819819 if (vwin->flags != 0)820820 return -EINVAL;821821 if (vwin->clipcount != 0)822822 return -EINVAL;823823 if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W)824824- return -EINVAL; 824824+ return -EINVAL;825825 if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H)826826 return -EINVAL;827827···829829 w9966_pdev_claim(cam);830830 ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height);831831 w9966_pdev_release(cam);832832-832832+833833 if (ret != 0) {834834 DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n");835835 return -EIO;836836 }837837-837837+838838 return 0;839839 }840840 case VIDIOCGWIN:···846846 return 0;847847 }848848 // Unimplemented849849- case VIDIOCCAPTURE: 849849+ case VIDIOCCAPTURE:850850 case VIDIOCGFBUF:851851 case VIDIOCSFBUF:852852 case VIDIOCKEY:···877877 unsigned char __user *dest = (unsigned char __user *)buf;878878 unsigned long dleft = count;879879 unsigned char *tbuf;880880-880880+881881 // Why would anyone want more than this??882882 if (count > cam->width * cam->height * 2)883883 return -EINVAL;884884-884884+885885 w9966_pdev_claim(cam);886886 w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer887887 w9966_wReg(cam, 0x00, 0x00); // Return to normal operation888888 w9966_wReg(cam, 0x01, 0x98); // Enable capture889889890890- // write special capture-addr and negotiate into data transfer 890890+ // write special capture-addr and negotiate into data transfer891891 if (892892 (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )||893893 (parport_write(cam->pport, &addr, 1) != 1 )||···906906 while(dleft > 0)907907 {908908 unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft;909909-909909+910910 if (parport_read(cam->pport, tbuf, tsize) < tsize) {911911 count = -EFAULT;912912 goto out;···933933static void w9966_attach(struct parport *port)934934{935935 int i;936936-936936+937937 for (i = 0; i < W9966_MAXCAMS; i++)938938 {939939 if (w9966_cams[i].dev_state != 0) // Cam is already assigned
+465-465
drivers/media/video/w9968cf.c
···7171static int ovmod_load = W9968CF_OVMOD_LOAD;7272static unsigned short simcams = W9968CF_SIMCAMS;7373static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/7474-static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = 7575- W9968CF_PACKET_SIZE};7676-static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = 7777- W9968CF_BUFFERS};7878-static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = 7979- W9968CF_DOUBLE_BUFFER};7474+static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] =7575+ W9968CF_PACKET_SIZE};7676+static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] =7777+ W9968CF_BUFFERS};7878+static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] =7979+ W9968CF_DOUBLE_BUFFER};8080static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING};8181-static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = 8282- W9968CF_FILTER_TYPE};8181+static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] =8282+ W9968CF_FILTER_TYPE};8383static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW};8484-static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = 8585- W9968CF_DECOMPRESSION};8484+static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] =8585+ W9968CF_DECOMPRESSION};8686static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING};8787static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0};8888static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB};8989static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT};9090static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP};9191-static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = 9292- W9968CF_LIGHTFREQ};9191+static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] =9292+ W9968CF_LIGHTFREQ};9393static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]=9494- W9968CF_BANDINGFILTER};9494+ W9968CF_BANDINGFILTER};9595static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV};9696static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT};9797static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR};9898static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME};9999-static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = 100100- W9968CF_BRIGHTNESS};9999+static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] =100100+ W9968CF_BRIGHTNESS};101101static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE};102102static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR};103103-static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = 104104- W9968CF_CONTRAST};105105-static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = 106106- W9968CF_WHITENESS};103103+static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] =104104+ W9968CF_CONTRAST};105105+static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] =106106+ W9968CF_WHITENESS};107107#ifdef W9968CF_DEBUG108108static unsigned short debug = W9968CF_DEBUG_LEVEL;109109static int specific_debug = W9968CF_SPECIFIC_DEBUG;···145145#endif146146147147#ifdef CONFIG_KMOD148148-MODULE_PARM_DESC(ovmod_load, 149149- "\n<0|1> Automatic 'ovcamchip' module loading."150150- "\n0 disabled, 1 enabled."151151- "\nIf enabled,'insmod' searches for the required 'ovcamchip'"152152- "\nmodule in the system, according to its configuration, and"153153- "\nattempts to load that module automatically. This action is"154154- "\nperformed once as soon as the 'w9968cf' module is loaded"155155- "\ninto memory."156156- "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"."157157- "\n");148148+MODULE_PARM_DESC(ovmod_load,149149+ "\n<0|1> Automatic 'ovcamchip' module loading."150150+ "\n0 disabled, 1 enabled."151151+ "\nIf enabled,'insmod' searches for the required 'ovcamchip'"152152+ "\nmodule in the system, according to its configuration, and"153153+ "\nattempts to load that module automatically. This action is"154154+ "\nperformed once as soon as the 'w9968cf' module is loaded"155155+ "\ninto memory."156156+ "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"."157157+ "\n");158158#endif159159-MODULE_PARM_DESC(simcams, 160160- "\n<n> Number of cameras allowed to stream simultaneously."161161- "\nn may vary from 0 to "162162- __MODULE_STRING(W9968CF_MAX_DEVICES)"."163163- "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"."164164- "\n");159159+MODULE_PARM_DESC(simcams,160160+ "\n<n> Number of cameras allowed to stream simultaneously."161161+ "\nn may vary from 0 to "162162+ __MODULE_STRING(W9968CF_MAX_DEVICES)"."163163+ "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"."164164+ "\n");165165MODULE_PARM_DESC(video_nr,166166- "\n<-1|n[,...]> Specify V4L minor mode number."167167- "\n -1 = use next available (default)"168168- "\n n = use minor number n (integer >= 0)"169169- "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES)170170- " cameras this way."171171- "\nFor example:"172172- "\nvideo_nr=-1,2,-1 would assign minor number 2 to"173173- "\nthe second camera and use auto for the first"174174- "\none and for every other camera."175175- "\n");166166+ "\n<-1|n[,...]> Specify V4L minor mode number."167167+ "\n -1 = use next available (default)"168168+ "\n n = use minor number n (integer >= 0)"169169+ "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES)170170+ " cameras this way."171171+ "\nFor example:"172172+ "\nvideo_nr=-1,2,-1 would assign minor number 2 to"173173+ "\nthe second camera and use auto for the first"174174+ "\none and for every other camera."175175+ "\n");176176MODULE_PARM_DESC(packet_size,177177- "\n<n[,...]> Specify the maximum data payload"178178- "\nsize in bytes for alternate settings, for each device."179179- "\nn is scaled between 63 and 1023 "180180- "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")."181181- "\n");177177+ "\n<n[,...]> Specify the maximum data payload"178178+ "\nsize in bytes for alternate settings, for each device."179179+ "\nn is scaled between 63 and 1023 "180180+ "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")."181181+ "\n");182182MODULE_PARM_DESC(max_buffers,183183- "\n<n[,...]> For advanced users."184184- "\nSpecify the maximum number of video frame buffers"185185- "\nto allocate for each device, from 2 to "186186- __MODULE_STRING(W9968CF_MAX_BUFFERS)187187- ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")."188188- "\n");189189-MODULE_PARM_DESC(double_buffer, 190190- "\n<0|1[,...]> "191191- "Hardware double buffering: 0 disabled, 1 enabled."192192- "\nIt should be enabled if you want smooth video output: if"193193- "\nyou obtain out of sync. video, disable it, or try to"194194- "\ndecrease the 'clockdiv' module parameter value."195195- "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER)196196- " for every device."197197- "\n");198198-MODULE_PARM_DESC(clamping, 199199- "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled."200200- "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING)201201- " for every device."202202- "\n");203203-MODULE_PARM_DESC(filter_type, 204204- "\n<0|1|2[,...]> Video filter type."205205- "\n0 none, 1 (1-2-1) 3-tap filter, "206206- "2 (2-3-6-3-2) 5-tap filter."207207- "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE)208208- " for every device."209209- "\nThe filter is used to reduce noise and aliasing artifacts"210210- "\nproduced by the CCD or CMOS image sensor, and the scaling"211211- " process."212212- "\n");213213-MODULE_PARM_DESC(largeview, 214214- "\n<0|1[,...]> Large view: 0 disabled, 1 enabled."215215- "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW)216216- " for every device."217217- "\n");218218-MODULE_PARM_DESC(upscaling, 219219- "\n<0|1[,...]> Software scaling (for non-compressed video):"220220- "\n0 disabled, 1 enabled."221221- "\nDisable it if you have a slow CPU or you don't have"222222- " enough memory."223223- "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING)224224- " for every device."225225- "\nIf 'w9968cf-vpp' is not present, this parameter is"226226- " set to 0."227227- "\n");183183+ "\n<n[,...]> For advanced users."184184+ "\nSpecify the maximum number of video frame buffers"185185+ "\nto allocate for each device, from 2 to "186186+ __MODULE_STRING(W9968CF_MAX_BUFFERS)187187+ ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")."188188+ "\n");189189+MODULE_PARM_DESC(double_buffer,190190+ "\n<0|1[,...]> "191191+ "Hardware double buffering: 0 disabled, 1 enabled."192192+ "\nIt should be enabled if you want smooth video output: if"193193+ "\nyou obtain out of sync. video, disable it, or try to"194194+ "\ndecrease the 'clockdiv' module parameter value."195195+ "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER)196196+ " for every device."197197+ "\n");198198+MODULE_PARM_DESC(clamping,199199+ "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled."200200+ "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING)201201+ " for every device."202202+ "\n");203203+MODULE_PARM_DESC(filter_type,204204+ "\n<0|1|2[,...]> Video filter type."205205+ "\n0 none, 1 (1-2-1) 3-tap filter, "206206+ "2 (2-3-6-3-2) 5-tap filter."207207+ "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE)208208+ " for every device."209209+ "\nThe filter is used to reduce noise and aliasing artifacts"210210+ "\nproduced by the CCD or CMOS image sensor, and the scaling"211211+ " process."212212+ "\n");213213+MODULE_PARM_DESC(largeview,214214+ "\n<0|1[,...]> Large view: 0 disabled, 1 enabled."215215+ "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW)216216+ " for every device."217217+ "\n");218218+MODULE_PARM_DESC(upscaling,219219+ "\n<0|1[,...]> Software scaling (for non-compressed video):"220220+ "\n0 disabled, 1 enabled."221221+ "\nDisable it if you have a slow CPU or you don't have"222222+ " enough memory."223223+ "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING)224224+ " for every device."225225+ "\nIf 'w9968cf-vpp' is not present, this parameter is"226226+ " set to 0."227227+ "\n");228228MODULE_PARM_DESC(decompression,229229- "\n<0|1|2[,...]> Software video decompression:"230230- "\n- 0 disables decompression (doesn't allow formats needing"231231- " decompression)"232232- "\n- 1 forces decompression (allows formats needing"233233- " decompression only);"234234- "\n- 2 allows any permitted formats."235235- "\nFormats supporting compressed video are YUV422P and"236236- " YUV420P/YUV420 "237237- "\nin any resolutions where both width and height are "238238- "a multiple of 16."239239- "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION)240240- " for every device."241241- "\nIf 'w9968cf-vpp' is not present, forcing decompression is "242242- "\nnot allowed; in this case this parameter is set to 2."243243- "\n");229229+ "\n<0|1|2[,...]> Software video decompression:"230230+ "\n- 0 disables decompression (doesn't allow formats needing"231231+ " decompression)"232232+ "\n- 1 forces decompression (allows formats needing"233233+ " decompression only);"234234+ "\n- 2 allows any permitted formats."235235+ "\nFormats supporting compressed video are YUV422P and"236236+ " YUV420P/YUV420 "237237+ "\nin any resolutions where both width and height are "238238+ "a multiple of 16."239239+ "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION)240240+ " for every device."241241+ "\nIf 'w9968cf-vpp' is not present, forcing decompression is "242242+ "\nnot allowed; in this case this parameter is set to 2."243243+ "\n");244244MODULE_PARM_DESC(force_palette,245245- "\n<0"246246- "|" __MODULE_STRING(VIDEO_PALETTE_UYVY)247247- "|" __MODULE_STRING(VIDEO_PALETTE_YUV420)248248- "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P)249249- "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P)250250- "|" __MODULE_STRING(VIDEO_PALETTE_YUYV)251251- "|" __MODULE_STRING(VIDEO_PALETTE_YUV422)252252- "|" __MODULE_STRING(VIDEO_PALETTE_GREY)253253- "|" __MODULE_STRING(VIDEO_PALETTE_RGB555)254254- "|" __MODULE_STRING(VIDEO_PALETTE_RGB565)255255- "|" __MODULE_STRING(VIDEO_PALETTE_RGB24)256256- "|" __MODULE_STRING(VIDEO_PALETTE_RGB32)257257- "[,...]>"258258- " Force picture palette."259259- "\nIn order:"260260- "\n- 0 allows any of the following formats:"261261- "\n- UYVY 16 bpp - Original video, compression disabled"262262- "\n- YUV420 12 bpp - Original video, compression enabled"263263- "\n- YUV422P 16 bpp - Original video, compression enabled"264264- "\n- YUV420P 12 bpp - Original video, compression enabled"265265- "\n- YUVY 16 bpp - Software conversion from UYVY"266266- "\n- YUV422 16 bpp - Software conversion from UYVY"267267- "\n- GREY 8 bpp - Software conversion from UYVY"268268- "\n- RGB555 16 bpp - Software conversion from UYVY"269269- "\n- RGB565 16 bpp - Software conversion from UYVY"270270- "\n- RGB24 24 bpp - Software conversion from UYVY"271271- "\n- RGB32 32 bpp - Software conversion from UYVY"272272- "\nWhen not 0, this parameter will override 'decompression'."273273- "\nDefault value is 0 for every device."274274- "\nInitial palette is "275275- __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"."276276- "\nIf 'w9968cf-vpp' is not present, this parameter is"277277- " set to 9 (UYVY)."278278- "\n");279279-MODULE_PARM_DESC(force_rgb, 280280- "\n<0|1[,...]> Read RGB video data instead of BGR:"281281- "\n 1 = use RGB component ordering."282282- "\n 0 = use BGR component ordering."283283- "\nThis parameter has effect when using RGBX palettes only."284284- "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB)285285- " for every device."286286- "\n");245245+ "\n<0"246246+ "|" __MODULE_STRING(VIDEO_PALETTE_UYVY)247247+ "|" __MODULE_STRING(VIDEO_PALETTE_YUV420)248248+ "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P)249249+ "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P)250250+ "|" __MODULE_STRING(VIDEO_PALETTE_YUYV)251251+ "|" __MODULE_STRING(VIDEO_PALETTE_YUV422)252252+ "|" __MODULE_STRING(VIDEO_PALETTE_GREY)253253+ "|" __MODULE_STRING(VIDEO_PALETTE_RGB555)254254+ "|" __MODULE_STRING(VIDEO_PALETTE_RGB565)255255+ "|" __MODULE_STRING(VIDEO_PALETTE_RGB24)256256+ "|" __MODULE_STRING(VIDEO_PALETTE_RGB32)257257+ "[,...]>"258258+ " Force picture palette."259259+ "\nIn order:"260260+ "\n- 0 allows any of the following formats:"261261+ "\n- UYVY 16 bpp - Original video, compression disabled"262262+ "\n- YUV420 12 bpp - Original video, compression enabled"263263+ "\n- YUV422P 16 bpp - Original video, compression enabled"264264+ "\n- YUV420P 12 bpp - Original video, compression enabled"265265+ "\n- YUVY 16 bpp - Software conversion from UYVY"266266+ "\n- YUV422 16 bpp - Software conversion from UYVY"267267+ "\n- GREY 8 bpp - Software conversion from UYVY"268268+ "\n- RGB555 16 bpp - Software conversion from UYVY"269269+ "\n- RGB565 16 bpp - Software conversion from UYVY"270270+ "\n- RGB24 24 bpp - Software conversion from UYVY"271271+ "\n- RGB32 32 bpp - Software conversion from UYVY"272272+ "\nWhen not 0, this parameter will override 'decompression'."273273+ "\nDefault value is 0 for every device."274274+ "\nInitial palette is "275275+ __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"."276276+ "\nIf 'w9968cf-vpp' is not present, this parameter is"277277+ " set to 9 (UYVY)."278278+ "\n");279279+MODULE_PARM_DESC(force_rgb,280280+ "\n<0|1[,...]> Read RGB video data instead of BGR:"281281+ "\n 1 = use RGB component ordering."282282+ "\n 0 = use BGR component ordering."283283+ "\nThis parameter has effect when using RGBX palettes only."284284+ "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB)285285+ " for every device."286286+ "\n");287287MODULE_PARM_DESC(autobright,288288- "\n<0|1[,...]> Image sensor automatically changes brightness:"289289- "\n 0 = no, 1 = yes"290290- "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT)291291- " for every device."292292- "\n");288288+ "\n<0|1[,...]> Image sensor automatically changes brightness:"289289+ "\n 0 = no, 1 = yes"290290+ "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT)291291+ " for every device."292292+ "\n");293293MODULE_PARM_DESC(autoexp,294294- "\n<0|1[,...]> Image sensor automatically changes exposure:"295295- "\n 0 = no, 1 = yes"296296- "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP)297297- " for every device."298298- "\n");294294+ "\n<0|1[,...]> Image sensor automatically changes exposure:"295295+ "\n 0 = no, 1 = yes"296296+ "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP)297297+ " for every device."298298+ "\n");299299MODULE_PARM_DESC(lightfreq,300300- "\n<50|60[,...]> Light frequency in Hz:"301301- "\n 50 for European and Asian lighting,"302302- " 60 for American lighting."303303- "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ)304304- " for every device."305305- "\n");300300+ "\n<50|60[,...]> Light frequency in Hz:"301301+ "\n 50 for European and Asian lighting,"302302+ " 60 for American lighting."303303+ "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ)304304+ " for every device."305305+ "\n");306306MODULE_PARM_DESC(bandingfilter,307307- "\n<0|1[,...]> Banding filter to reduce effects of"308308- " fluorescent lighting:"309309- "\n 0 disabled, 1 enabled."310310- "\nThis filter tries to reduce the pattern of horizontal"311311- "\nlight/dark bands caused by some (usually fluorescent)"312312- " lighting."313313- "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER)314314- " for every device."315315- "\n");307307+ "\n<0|1[,...]> Banding filter to reduce effects of"308308+ " fluorescent lighting:"309309+ "\n 0 disabled, 1 enabled."310310+ "\nThis filter tries to reduce the pattern of horizontal"311311+ "\nlight/dark bands caused by some (usually fluorescent)"312312+ " lighting."313313+ "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER)314314+ " for every device."315315+ "\n");316316MODULE_PARM_DESC(clockdiv,317317- "\n<-1|n[,...]> "318318- "Force pixel clock divisor to a specific value (for experts):"319319- "\n n may vary from 0 to 127."320320- "\n -1 for automatic value."321321- "\nSee also the 'double_buffer' module parameter."322322- "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV)323323- " for every device."324324- "\n");317317+ "\n<-1|n[,...]> "318318+ "Force pixel clock divisor to a specific value (for experts):"319319+ "\n n may vary from 0 to 127."320320+ "\n -1 for automatic value."321321+ "\nSee also the 'double_buffer' module parameter."322322+ "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV)323323+ " for every device."324324+ "\n");325325MODULE_PARM_DESC(backlight,326326- "\n<0|1[,...]> Objects are lit from behind:"327327- "\n 0 = no, 1 = yes"328328- "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT)329329- " for every device."330330- "\n");326326+ "\n<0|1[,...]> Objects are lit from behind:"327327+ "\n 0 = no, 1 = yes"328328+ "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT)329329+ " for every device."330330+ "\n");331331MODULE_PARM_DESC(mirror,332332- "\n<0|1[,...]> Reverse image horizontally:"333333- "\n 0 = no, 1 = yes"334334- "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR)335335- " for every device."336336- "\n");332332+ "\n<0|1[,...]> Reverse image horizontally:"333333+ "\n 0 = no, 1 = yes"334334+ "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR)335335+ " for every device."336336+ "\n");337337MODULE_PARM_DESC(monochrome,338338- "\n<0|1[,...]> Use image sensor as monochrome sensor:"339339- "\n 0 = no, 1 = yes"340340- "\nNot all the sensors support monochrome color."341341- "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME)342342- " for every device."343343- "\n");344344-MODULE_PARM_DESC(brightness, 345345- "\n<n[,...]> Set picture brightness (0-65535)."346346- "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS)347347- " for every device."348348- "\nThis parameter has no effect if 'autobright' is enabled."349349- "\n");350350-MODULE_PARM_DESC(hue, 351351- "\n<n[,...]> Set picture hue (0-65535)."352352- "\nDefault value is "__MODULE_STRING(W9968CF_HUE)353353- " for every device."354354- "\n");355355-MODULE_PARM_DESC(colour, 356356- "\n<n[,...]> Set picture saturation (0-65535)."357357- "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR)358358- " for every device."359359- "\n");360360-MODULE_PARM_DESC(contrast, 361361- "\n<n[,...]> Set picture contrast (0-65535)."362362- "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST)363363- " for every device."364364- "\n");365365-MODULE_PARM_DESC(whiteness, 366366- "\n<n[,...]> Set picture whiteness (0-65535)."367367- "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS)368368- " for every device."369369- "\n");338338+ "\n<0|1[,...]> Use image sensor as monochrome sensor:"339339+ "\n 0 = no, 1 = yes"340340+ "\nNot all the sensors support monochrome color."341341+ "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME)342342+ " for every device."343343+ "\n");344344+MODULE_PARM_DESC(brightness,345345+ "\n<n[,...]> Set picture brightness (0-65535)."346346+ "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS)347347+ " for every device."348348+ "\nThis parameter has no effect if 'autobright' is enabled."349349+ "\n");350350+MODULE_PARM_DESC(hue,351351+ "\n<n[,...]> Set picture hue (0-65535)."352352+ "\nDefault value is "__MODULE_STRING(W9968CF_HUE)353353+ " for every device."354354+ "\n");355355+MODULE_PARM_DESC(colour,356356+ "\n<n[,...]> Set picture saturation (0-65535)."357357+ "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR)358358+ " for every device."359359+ "\n");360360+MODULE_PARM_DESC(contrast,361361+ "\n<n[,...]> Set picture contrast (0-65535)."362362+ "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST)363363+ " for every device."364364+ "\n");365365+MODULE_PARM_DESC(whiteness,366366+ "\n<n[,...]> Set picture whiteness (0-65535)."367367+ "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS)368368+ " for every device."369369+ "\n");370370#ifdef W9968CF_DEBUG371371MODULE_PARM_DESC(debug,372372- "\n<n> Debugging information level, from 0 to 6:"373373- "\n0 = none (use carefully)"374374- "\n1 = critical errors"375375- "\n2 = significant informations"376376- "\n3 = configuration or general messages"377377- "\n4 = warnings"378378- "\n5 = called functions"379379- "\n6 = function internals"380380- "\nLevel 5 and 6 are useful for testing only, when only "381381- "one device is used."382382- "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"."383383- "\n");372372+ "\n<n> Debugging information level, from 0 to 6:"373373+ "\n0 = none (use carefully)"374374+ "\n1 = critical errors"375375+ "\n2 = significant informations"376376+ "\n3 = configuration or general messages"377377+ "\n4 = warnings"378378+ "\n5 = called functions"379379+ "\n6 = function internals"380380+ "\nLevel 5 and 6 are useful for testing only, when only "381381+ "one device is used."382382+ "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"."383383+ "\n");384384MODULE_PARM_DESC(specific_debug,385385- "\n<0|1> Enable or disable specific debugging messages:"386386- "\n0 = print messages concerning every level"387387- " <= 'debug' level."388388- "\n1 = print messages concerning the level"389389- " indicated by 'debug'."390390- "\nDefault value is "391391- __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"."392392- "\n");385385+ "\n<0|1> Enable or disable specific debugging messages:"386386+ "\n0 = print messages concerning every level"387387+ " <= 'debug' level."388388+ "\n1 = print messages concerning the level"389389+ " indicated by 'debug'."390390+ "\nDefault value is "391391+ __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"."392392+ "\n");393393#endif /* W9968CF_DEBUG */394394395395···406406static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long);407407static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*);408408static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int,409409- void __user *);409409+ void __user *);410410411411/* USB-specific */412412static int w9968cf_start_transfer(struct w9968cf_device*);···428428static int w9968cf_smbus_read_ack(struct w9968cf_device*);429429static int w9968cf_smbus_refresh_bus(struct w9968cf_device*);430430static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam,431431- u16 address, u8* value);432432-static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, 433433- u8 subaddress, u8* value);431431+ u16 address, u8* value);432432+static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address,433433+ u8 subaddress, u8* value);434434static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*,435435- u16 address, u8 subaddress);435435+ u16 address, u8 subaddress);436436static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*,437437- u16 address, u8 subaddress,438438- u8 value);437437+ u16 address, u8 subaddress,438438+ u8 value);439439440440/* I2C interface to kernel */441441static int w9968cf_i2c_init(struct w9968cf_device*);442442-static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, 443443- unsigned short flags, char read_write, 444444- u8 command, int size, union i2c_smbus_data*);442442+static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr,443443+ unsigned short flags, char read_write,444444+ u8 command, int size, union i2c_smbus_data*);445445static u32 w9968cf_i2c_func(struct i2c_adapter*);446446static int w9968cf_i2c_attach_inform(struct i2c_client*);447447static int w9968cf_i2c_detach_inform(struct i2c_client*);448448static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd,449449- unsigned long arg);449449+ unsigned long arg);450450451451/* Memory management */452452static void* rvmalloc(unsigned long size);···458458static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val);459459static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val);460460static int w9968cf_sensor_cmd(struct w9968cf_device*,461461- unsigned int cmd, void *arg);461461+ unsigned int cmd, void *arg);462462static int w9968cf_sensor_init(struct w9968cf_device*);463463static int w9968cf_sensor_update_settings(struct w9968cf_device*);464464static int w9968cf_sensor_get_picture(struct w9968cf_device*);465465-static int w9968cf_sensor_update_picture(struct w9968cf_device*, 466466- struct video_picture pict);465465+static int w9968cf_sensor_update_picture(struct w9968cf_device*,466466+ struct video_picture pict);467467468468/* Other helper functions */469469static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*,470470- enum w9968cf_model_id, 471471- const unsigned short dev_nr);470470+ enum w9968cf_model_id,471471+ const unsigned short dev_nr);472472static void w9968cf_adjust_configuration(struct w9968cf_device*);473473static int w9968cf_turn_on_led(struct w9968cf_device*);474474static int w9968cf_init_chip(struct w9968cf_device*);···477477static inline u8 w9968cf_need_decompression(u16 palette);478478static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture);479479static int w9968cf_set_window(struct w9968cf_device*, struct video_window);480480-static int w9968cf_postprocess_frame(struct w9968cf_device*, 481481- struct w9968cf_frame_t*);480480+static int w9968cf_postprocess_frame(struct w9968cf_device*,481481+ struct w9968cf_frame_t*);482482static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h);483483static void w9968cf_init_framelist(struct w9968cf_device*);484484static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num);···497497 const char *name;498498};499499500500-/*-------------------------------------------------------------------------- 500500+/*--------------------------------------------------------------------------501501 Returns the name of the matching element in the symbolic_list array. The502502 end of the list must be marked with an element that has a NULL name.503503 --------------------------------------------------------------------------*/504504-static inline const char * 504504+static inline const char *505505symbolic(struct w9968cf_symbolic_list list[], const int num)506506{507507 int i;···568568static struct w9968cf_symbolic_list decoder_errlist[] = {569569 { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" },570570 { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" },571571- { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, 571571+ { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" },572572 { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" },573573 { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" },574574 { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" },···695695 bpp = (w9968cf_vpp) ? 4 : 2;696696 if (cam->upscaling)697697 vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp,698698- cam->maxwidth*cam->maxheight*bpp);698698+ cam->maxwidth*cam->maxheight*bpp);699699 else700700 vpp_bufsize = cam->maxwidth*cam->maxheight*bpp;701701···704704 if (!(cam->transfer_buffer[i] =705705 kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) {706706 DBG(1, "Couldn't allocate memory for the isochronous "707707- "transfer buffers (%u bytes)", 707707+ "transfer buffers (%u bytes)",708708 p_size * W9968CF_ISO_PACKETS)709709 return -ENOMEM;710710 }···780780 of the next video frame; if an error is encountered in a packet, the entire781781 video frame is discarded and grabbed again.782782 If there are no requested frames in the FIFO list, packets are collected into783783- a temporary buffer. 783783+ a temporary buffer.784784 --------------------------------------------------------------------------*/785785static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs)786786{···799799 /* "(*f)" will be used instead of "cam->frame_current" */800800 f = &cam->frame_current;801801802802- /* If a frame has been requested and we are grabbing into 802802+ /* If a frame has been requested and we are grabbing into803803 the temporary frame, we'll switch to that requested frame */804804 if ((*f) == &cam->frame_tmp && *cam->requested_frame) {805805 if (cam->frame_tmp.status == F_GRABBING) {···808808 (*f)->length = cam->frame_tmp.length;809809 memcpy((*f)->buffer, cam->frame_tmp.buffer,810810 (*f)->length);811811- DBG(6, "Switched from temp. frame to frame #%d", 811811+ DBG(6, "Switched from temp. frame to frame #%d",812812 (*f)->number)813813 }814814 }···850850851851 if (cam->vpp_flag & VPP_DECOMPRESSION) {852852 err = w9968cf_vpp->check_headers((*f)->buffer,853853- (*f)->length);853853+ (*f)->length);854854 if (err) {855855 DBG(4, "Skip corrupted frame: %s",856856 symbolic(decoder_errlist, err))···975975 cam->frame_current = &cam->frame_tmp;976976977977 if (!(cam->vpp_flag & VPP_DECOMPRESSION))978978- DBG(5, "Isochronous transfer size: %lu bytes/frame", 978978+ DBG(5, "Isochronous transfer size: %lu bytes/frame",979979 (unsigned long)t_size*2)980980981981 DBG(5, "Starting the isochronous transfer...")···992992 usb_free_urb(cam->urb[j]);993993 }994994 DBG(1, "Couldn't send a transfer request to the "995995- "USB core (error #%d, %s)", err, 995995+ "USB core (error #%d, %s)", err,996996 symbolic(urb_errlist, err))997997 return err;998998 }···10161016 if (!cam->streaming)10171017 return 0;1018101810191019- /* This avoids race conditions with usb_submit_urb() 10191019+ /* This avoids race conditions with usb_submit_urb()10201020 in the URB completition handler */10211021 spin_lock_irqsave(&cam->urb_lock, lock_flags);10221022 cam->streaming = 0;···105010501051105110521052/*--------------------------------------------------------------------------10531053- Write a W9968CF register. 10531053+ Write a W9968CF register.10541054 Return 0 on success, -1 otherwise.10551055 --------------------------------------------------------------------------*/10561056static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index)···10591059 int res;1060106010611061 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0,10621062- USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,10631063- value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT);10621062+ USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,10631063+ value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT);1064106410651065 if (res < 0)10661066 DBG(4, "Failed to write a register "···107210721073107310741074/*--------------------------------------------------------------------------10751075- Read a W9968CF register. 10751075+ Read a W9968CF register.10761076 Return the register value on success, -1 otherwise.10771077 --------------------------------------------------------------------------*/10781078static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index)···10821082 int res;1083108310841084 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1,10851085- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,10861086- 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT);10851085+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,10861086+ 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT);1087108710881088 if (res < 0)10891089 DBG(4, "Failed to read a register "···11071107 value = *data++;1108110811091109 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0,11101110- USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,11111111- value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT);11101110+ USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,11111111+ value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT);1112111211131113 if (res < 0)11141114 DBG(4, "Failed to write the FSB registers "···128712871288128812891289/* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */12901290-static int 12911291-w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, 12921292- u16 address, u8 subaddress,u8 value)12901290+static int12911291+w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam,12921292+ u16 address, u8 subaddress,u8 value)12931293{12941294 u16* data = cam->data_buffer;12951295 int err = 0;···13481348 "value 0x%02X", address, subaddress, value)13491349 else13501350 DBG(5, "I2C write byte data failed, addr.0x%04X, "13511351- "subaddr.0x%02X, value 0x%02X", 13511351+ "subaddr.0x%02X, value 0x%02X",13521352 address, subaddress, value)1353135313541354 return err;···135613561357135713581358/* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */13591359-static int 13601360-w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, 13611361- u16 address, u8 subaddress, 13621362- u8* value)13591359+static int13601360+w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam,13611361+ u16 address, u8 subaddress,13621362+ u8* value)13631363{13641364 int err = 0;13651365···1384138413851385 if (!err)13861386 DBG(5, "I2C read byte data done, addr.0x%04X, "13871387- "subaddr.0x%02X, value 0x%02X", 13871387+ "subaddr.0x%02X, value 0x%02X",13881388 address, subaddress, *value)13891389 else13901390 DBG(5, "I2C read byte data failed, addr.0x%04X, "···139613961397139713981398/* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */13991399-static int 13991399+static int14001400w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam,14011401- u16 address, u8* value)14011401+ u16 address, u8* value)14021402{14031403 int err = 0;14041404···14111411 err += w9968cf_smbus_read_byte(cam, value);14121412 err += w9968cf_smbus_write_ack(cam);14131413 err += w9968cf_smbus_stop(cam);14141414-14141414+14151415 /* Serial data disable */14161416 err += w9968cf_write_sb(cam, 0x0000);14171417···142714271428142814291429/* SMBus protocol: S Addr Wr [A] Value [A] P */14301430-static int 14301430+static int14311431w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam,14321432- u16 address, u8 value)14321432+ u16 address, u8 value)14331433{14341434 DBG(4, "i2c_write_byte() is an unsupported transfer mode")14351435 return -EINVAL;···14421442 ****************************************************************************/1443144314441444static int14451445-w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, 14461446- unsigned short flags, char read_write, u8 command,14471447- int size, union i2c_smbus_data *data)14451445+w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,14461446+ unsigned short flags, char read_write, u8 command,14471447+ int size, union i2c_smbus_data *data)14481448{14491449 struct w9968cf_device* cam = i2c_get_adapdata(adapter);14501450 u8 i;14511451- int err = 0; 14511451+ int err = 0;1452145214531453 switch (addr) {14541454 case OV6xx0_SID:···14641464 addr <<= 1;1465146514661466 if (read_write == I2C_SMBUS_WRITE)14671467- err = w9968cf_i2c_adap_write_byte(cam, addr, command);14681468- else if (read_write == I2C_SMBUS_READ) 14671467+ err = w9968cf_i2c_adap_write_byte(cam, addr, command);14681468+ else if (read_write == I2C_SMBUS_READ)14691469 err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte);1470147014711471 } else if (size == I2C_SMBUS_BYTE_DATA) {14721472 addr <<= 1;1473147314741474 if (read_write == I2C_SMBUS_WRITE)14751475- err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr,14761476- command, data->byte);14751475+ err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr,14761476+ command, data->byte);14771477 else if (read_write == I2C_SMBUS_READ) {14781478 for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) {14791479 err = w9968cf_i2c_adap_read_byte_data(cam,addr,14801480- command, &data->byte);14801480+ command, &data->byte);14811481 if (err) {14821482 if (w9968cf_smbus_refresh_bus(cam)) {14831483 err = -EIO;···15201520 return err;15211521 }15221522 } else {15231523- DBG(4, "Rejected client [%s] with driver [%s]", 15231523+ DBG(4, "Rejected client [%s] with driver [%s]",15241524 client->name, client->driver->driver.name)15251525 return -EINVAL;15261526 }···15451545}154615461547154715481548-static int 15481548+static int15491549w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd,15501550- unsigned long arg)15501550+ unsigned long arg)15511551{15521552 return 0;15531553}···16251625static int w9968cf_init_chip(struct w9968cf_device* cam)16261626{16271627 unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2,16281628- y0 = 0x0000,16291629- u0 = y0 + hw_bufsize/2,16301630- v0 = u0 + hw_bufsize/4,16311631- y1 = v0 + hw_bufsize/4,16321632- u1 = y1 + hw_bufsize/2,16331633- v1 = u1 + hw_bufsize/4;16281628+ y0 = 0x0000,16291629+ u0 = y0 + hw_bufsize/2,16301630+ v0 = u0 + hw_bufsize/4,16311631+ y1 = v0 + hw_bufsize/4,16321632+ u1 = y1 + hw_bufsize/2,16331633+ v1 = u1 + hw_bufsize/4;16341634 int err = 0;1635163516361636 err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */···17621762 cam->vpp_flag = VPP_SWAP_YUV_BYTES;17631763 hw_palette = VIDEO_PALETTE_UYVY;17641764 break;17651765- /* Original video is used instead of RGBX palettes. 17651765+ /* Original video is used instead of RGBX palettes.17661766 Software conversion later. */17671767 case VIDEO_PALETTE_GREY:17681768 case VIDEO_PALETTE_RGB555:···17771777 }1778177817791779 /* NOTE: due to memory issues, it is better to disable the hardware17801780- double buffering during compression */17801780+ double buffering during compression */17811781 if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION))17821782 reg_v |= 0x0080;17831783···18321832 #define __UNSC(x) ((x) >> 10)1833183318341834 /* Make sure we are using a supported resolution */18351835- if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, 18361836- (u16*)&win.height)))18351835+ if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width,18361836+ (u16*)&win.height)))18371837 goto error;1838183818391839 /* Scaling factors */···19621962 /* Settings changed, so we clear the frame buffers */19631963 memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size);1964196419651965- DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", 19651965+ DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)",19661966 win.width, win.height, win.x, win.y)1967196719681968 PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, "···19781978}197919791980198019811981-/*-------------------------------------------------------------------------- 19811981+/*--------------------------------------------------------------------------19821982 Adjust the asked values for window width and height.19831983 Return 0 on success, -1 otherwise.19841984 --------------------------------------------------------------------------*/19851985-static int 19851985+static int19861986w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height)19871987{19881988 u16 maxw, maxh;···1992199219931993 maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) &&19941994 w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth)19951995- : cam->maxwidth;19951995+ : cam->maxwidth;19961996 maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) &&19971997 w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight)19981998- : cam->maxheight;19981998+ : cam->maxheight;1999199920002000 if (*width > maxw)20012001 *width = maxw;···20542054 Read, store and remove the first pointer in the FIFO list of requested20552055 frames. This function is called in interrupt context.20562056 --------------------------------------------------------------------------*/20572057-static void 20572057+static void20582058w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep)20592059{20602060 u8 i;···20782078 High-level video post-processing routine on grabbed frames.20792079 Return 0 on success, a negative number otherwise.20802080 --------------------------------------------------------------------------*/20812081-static int 20822082-w9968cf_postprocess_frame(struct w9968cf_device* cam, 20832083- struct w9968cf_frame_t* fr)20812081+static int20822082+w9968cf_postprocess_frame(struct w9968cf_device* cam,20832083+ struct w9968cf_frame_t* fr)20842084{20852085 void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp;20862086 u16 w = cam->window.width,···21272127 w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb);21282128 fr->length = (w*h*d)/8;21292129 _PSWAP(pIn, pOut)21302130- DBG(6, "UYVY-16bit to %s conversion done", 21302130+ DBG(6, "UYVY-16bit to %s conversion done",21312131 symbolic(v4l1_plist, fmt))21322132 }21332133···21432143 * Image sensor control routines *21442144 ****************************************************************************/2145214521462146-static int 21462146+static int21472147w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val)21482148{21492149 struct ovcamchip_control ctl;···21582158}215921592160216021612161-static int 21612161+static int21622162w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val)21632163{21642164 struct ovcamchip_control ctl;···21982198 int err = 0;2199219922002200 /* Auto brightness */22012201- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, 22022202- cam->auto_brt);22012201+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT,22022202+ cam->auto_brt);22032203 if (err)22042204 return err;2205220522062206 /* Auto exposure */22072207- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, 22082208- cam->auto_exp);22072207+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP,22082208+ cam->auto_exp);22092209 if (err)22102210 return err;2211221122122212 /* Banding filter */22132213- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, 22142214- cam->bandfilt);22132213+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT,22142214+ cam->bandfilt);22152215 if (err)22162216 return err;2217221722182218 /* Light frequency */22192219 err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ,22202220- cam->lightfreq);22202220+ cam->lightfreq);22212221 if (err)22222222 return err;2223222322242224 /* Back light */22252225 err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT,22262226- cam->backlight);22262226+ cam->backlight);22272227 if (err)22282228 return err;2229222922302230 /* Mirror */22312231 err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR,22322232- cam->mirror);22322232+ cam->mirror);22332233 if (err)22342234 return err;22352235···22812281 Returns: 0 on success, a negative number otherwise.22822282 --------------------------------------------------------------------------*/22832283static int22842284-w9968cf_sensor_update_picture(struct w9968cf_device* cam, 22852285- struct video_picture pict)22842284+w9968cf_sensor_update_picture(struct w9968cf_device* cam,22852285+ struct video_picture pict)22862286{22872287 int err = 0;2288228822892289 if ((!cam->sensor_initialized)22902290 || pict.contrast != cam->picture.contrast) {22912291 err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT,22922292- pict.contrast);22922292+ pict.contrast);22932293 if (err)22942294 goto fail;22952295 DBG(4, "Contrast changed from %u to %u",···22972297 cam->picture.contrast = pict.contrast;22982298 }2299229923002300- if (((!cam->sensor_initialized) || 23002300+ if (((!cam->sensor_initialized) ||23012301 pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) {23022302- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, 23032303- pict.brightness);23022302+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT,23032303+ pict.brightness);23042304 if (err)23052305 goto fail;23062306 DBG(4, "Brightness changed from %u to %u",···23092309 }2310231023112311 if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) {23122312- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, 23132313- pict.colour);23122312+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT,23132313+ pict.colour);23142314 if (err)23152315 goto fail;23162316 DBG(4, "Colour changed from %u to %u",···23192319 }2320232023212321 if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) {23222322- err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, 23232323- pict.hue);23222322+ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE,23232323+ pict.hue);23242324 if (err)23252325 goto fail;23262326 DBG(4, "Hue changed from %u to %u",···23492349{23502350 int err = 0;2351235123522352- if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, 23532353- &cam->monochrome)))23522352+ if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE,23532353+ &cam->monochrome)))23542354 goto error;2355235523562356- if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, 23572357- &cam->sensor)))23562356+ if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE,23572357+ &cam->sensor)))23582358 goto error;2359235923602360 /* NOTE: Make sure width and height are a multiple of 16 */···2416241624172417/*--------------------------------------------------------------------------24182418 Fill some basic fields in the main device data structure.24192419- This function is called once on w9968cf_usb_probe() for each recognized 24192419+ This function is called once on w9968cf_usb_probe() for each recognized24202420 camera.24212421 --------------------------------------------------------------------------*/24222422static void24232423w9968cf_configure_camera(struct w9968cf_device* cam,24242424- struct usb_device* udev,24252425- enum w9968cf_model_id mod_id,24262426- const unsigned short dev_nr)24242424+ struct usb_device* udev,24252425+ enum w9968cf_model_id mod_id,24262426+ const unsigned short dev_nr)24272427{24282428 mutex_init(&cam->fileop_mutex);24292429 init_waitqueue_head(&cam->open);···24442444 packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1];24452445 cam->altsetting++);2446244624472447- cam->max_buffers = (max_buffers[dev_nr] < 2 || 24482448- max_buffers[dev_nr] > W9968CF_MAX_BUFFERS)24492449- ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr];24472447+ cam->max_buffers = (max_buffers[dev_nr] < 2 ||24482448+ max_buffers[dev_nr] > W9968CF_MAX_BUFFERS)24492449+ ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr];2450245024512451- cam->double_buffer = (double_buffer[dev_nr] == 0 || 24522452- double_buffer[dev_nr] == 1)24532453- ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER;24512451+ cam->double_buffer = (double_buffer[dev_nr] == 0 ||24522452+ double_buffer[dev_nr] == 1)24532453+ ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER;2454245424552455 cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1)24562456- ? (u8)clamping[dev_nr] : W9968CF_CLAMPING;24572457-24562456+ ? (u8)clamping[dev_nr] : W9968CF_CLAMPING;24572457+24582458 cam->filter_type = (filter_type[dev_nr] == 0 ||24592459- filter_type[dev_nr] == 1 ||24602460- filter_type[dev_nr] == 2)24612461- ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE;24592459+ filter_type[dev_nr] == 1 ||24602460+ filter_type[dev_nr] == 2)24612461+ ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE;2462246224632463 cam->capture = 1;2464246424652465 cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1)24662466- ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW;24662466+ ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW;2467246724682468- cam->decompression = (decompression[dev_nr] == 0 || 24692469- decompression[dev_nr] == 1 ||24702470- decompression[dev_nr] == 2)24712471- ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION;24682468+ cam->decompression = (decompression[dev_nr] == 0 ||24692469+ decompression[dev_nr] == 1 ||24702470+ decompression[dev_nr] == 2)24712471+ ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION;2472247224732473- cam->upscaling = (upscaling[dev_nr] == 0 || 24742474- upscaling[dev_nr] == 1)24752475- ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING;24732473+ cam->upscaling = (upscaling[dev_nr] == 0 ||24742474+ upscaling[dev_nr] == 1)24752475+ ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING;2476247624772477 cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1)24782478- ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT;24782478+ ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT;2479247924802480 cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1)24812481- ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP;24812481+ ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP;2482248224832483 cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60)24842484- ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ;24842484+ ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ;2485248524862486- cam->bandfilt = (bandingfilter[dev_nr] == 0 || 24872487- bandingfilter[dev_nr] == 1)24882488- ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER;24862486+ cam->bandfilt = (bandingfilter[dev_nr] == 0 ||24872487+ bandingfilter[dev_nr] == 1)24882488+ ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER;2489248924902490 cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1)24912491- ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT;24912491+ ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT;2492249224932493 cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0)24942494- ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV;24942494+ ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV;2495249524962496 cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1)24972497- ? (u8)mirror[dev_nr] : W9968CF_MIRROR;24972497+ ? (u8)mirror[dev_nr] : W9968CF_MIRROR;2498249824992499 cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1)25002500- ? monochrome[dev_nr] : W9968CF_MONOCHROME;25002500+ ? monochrome[dev_nr] : W9968CF_MONOCHROME;2501250125022502 cam->picture.brightness = (u16)brightness[dev_nr];25032503 cam->picture.hue = (u16)hue[dev_nr];···25192519 cam->picture.depth = w9968cf_valid_depth(cam->picture.palette);2520252025212521 cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1)25222522- ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB;25222522+ ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB;2523252325242524 cam->window.x = 0;25252525 cam->window.y = 0;···2531253125322532 DBG(3, "%s configured with settings #%u:",25332533 symbolic(camlist, cam->id), dev_nr)25342534-25342534+25352535 DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes",25362536 wMaxPacketSize[cam->altsetting-1])25372537-25372537+25382538 DBG(3, "- Number of requested video frame buffers: %u",25392539 cam->max_buffers)2540254025412541 if (cam->double_buffer)25422542 DBG(3, "- Hardware double buffering enabled")25432543- else 25432543+ else25442544 DBG(3, "- Hardware double buffering disabled")2545254525462546 if (cam->filter_type == 0)···2648264826492649/*--------------------------------------------------------------------------26502650 Release the resources used by the driver.26512651- This function is called on disconnect 26512651+ This function is called on disconnect26522652 (or on close if deallocation has been deferred)26532653 --------------------------------------------------------------------------*/26542654static void w9968cf_release_resources(struct w9968cf_device* cam)···27062706 }27072707 mutex_unlock(&cam->dev_mutex);27082708 err = wait_event_interruptible_exclusive(cam->open,27092709- cam->disconnected ||27102710- !cam->users);27092709+ cam->disconnected ||27102710+ !cam->users);27112711 if (err) {27122712 up_read(&w9968cf_disconnect);27132713 return err;···28202820 w9968cf_push_frame(cam, 1);2821282128222822 err = wait_event_interruptible(cam->wait_queue,28232823- cam->frame[0].status == F_READY ||28242824- cam->frame[1].status == F_READY ||28252825- cam->disconnected);28232823+ cam->frame[0].status == F_READY ||28242824+ cam->frame[1].status == F_READY ||28252825+ cam->disconnected);28262826 if (err) {28272827 mutex_unlock(&cam->fileop_mutex);28282828 return err;···28592859static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma)28602860{28612861 struct w9968cf_device* cam = (struct w9968cf_device*)28622862- video_get_drvdata(video_devdata(filp));28622862+ video_get_drvdata(video_devdata(filp));28632863 unsigned long vsize = vma->vm_end - vma->vm_start,28642864- psize = cam->nbuffers * cam->frame[0].size,28652865- start = vma->vm_start,28662866- pos = (unsigned long)cam->frame[0].buffer,28672867- page;28642864+ psize = cam->nbuffers * cam->frame[0].size,28652865+ start = vma->vm_start,28662866+ pos = (unsigned long)cam->frame[0].buffer,28672867+ page;2868286828692869 if (cam->disconnected) {28702870 DBG(2, "Device not present")···2898289828992899static int29002900w9968cf_ioctl(struct inode* inode, struct file* filp,29012901- unsigned int cmd, unsigned long arg)29012901+ unsigned int cmd, unsigned long arg)29022902{29032903 struct w9968cf_device* cam;29042904 int err;···292829282929292929302930static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp,29312931- unsigned int cmd, void __user * arg)29312931+ unsigned int cmd, void __user * arg)29322932{29332933 struct w9968cf_device* cam;29342934 const char* v4l1_ioctls[] = {29352935- "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", 29352935+ "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER",29362936 "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF",29372937 "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO",29382938 "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE",29392939- "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", 29402940- "GVBIFMT", "SVBIFMT" 29392939+ "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE",29402940+ "GVBIFMT", "SVBIFMT"29412941 };2942294229432943 #define V4L1_IOCTL(cmd) \29442944- ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \29452945- v4l1_ioctls[_IOC_NR((cmd))] : "?")29442944+ ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \29452945+ v4l1_ioctls[_IOC_NR((cmd))] : "?")2946294629472947 cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp));29482948···29572957 .minwidth = cam->minwidth,29582958 .minheight = cam->minheight,29592959 };29602960- sprintf(cap.name, "W996[87]CF USB Camera #%d", 29612961- cam->v4ldev->minor);29602960+ sprintf(cap.name, "W996[87]CF USB Camera #%d",29612961+ cam->v4ldev->minor);29622962 cap.maxwidth = (cam->upscaling && w9968cf_vpp)29632963- ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) 29642964- : cam->maxwidth;29632963+ ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth)29642964+ : cam->maxwidth;29652965 cap.maxheight = (cam->upscaling && w9968cf_vpp)29662966- ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight)29672967- : cam->maxheight;29662966+ ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight)29672967+ : cam->maxheight;2968296829692969 if (copy_to_user(arg, &cap, sizeof(cap)))29702970 return -EFAULT;···30293029 if (copy_from_user(&pict, arg, sizeof(pict)))30303030 return -EFAULT;3031303130323032- if ( (cam->force_palette || !w9968cf_vpp) 30323032+ if ( (cam->force_palette || !w9968cf_vpp)30333033 && pict.palette != cam->picture.palette ) {30343034 DBG(4, "Palette %s rejected: only %s is allowed",30353035 symbolic(v4l1_plist, pict.palette),···30463046 if (!cam->force_palette) {30473047 if (cam->decompression == 0) {30483048 if (w9968cf_need_decompression(pict.palette)) {30493049- DBG(4, "Decompression disabled: palette %s is not "30503050- "allowed. VIDIOCSPICT failed",30513051- symbolic(v4l1_plist, pict.palette))30523052- return -EINVAL;30493049+ DBG(4, "Decompression disabled: palette %s is not "30503050+ "allowed. VIDIOCSPICT failed",30513051+ symbolic(v4l1_plist, pict.palette))30523052+ return -EINVAL;30533053 }30543054 } else if (cam->decompression == 1) {30553055 if (!w9968cf_need_decompression(pict.palette)) {30563056- DBG(4, "Decompression forced: palette %s is not "30573057- "allowed. VIDIOCSPICT failed",30583058- symbolic(v4l1_plist, pict.palette))30593059- return -EINVAL;30563056+ DBG(4, "Decompression forced: palette %s is not "30573057+ "allowed. VIDIOCSPICT failed",30583058+ symbolic(v4l1_plist, pict.palette))30593059+ return -EINVAL;30603060 }30613061 }30623062 }3063306330643064 if (pict.depth != w9968cf_valid_depth(pict.palette)) {30653065 DBG(4, "Requested depth %u bpp is not valid for %s "30663066- "palette: ignored and changed to %u bpp", 30663066+ "palette: ignored and changed to %u bpp",30673067 pict.depth, symbolic(v4l1_plist, pict.palette),30683068 w9968cf_valid_depth(pict.palette))30693069 pict.depth = w9968cf_valid_depth(pict.palette);···30743074 || cam->frame_current->queued) {30753075 err = wait_event_interruptible30763076 ( cam->wait_queue,30773077- cam->disconnected ||30783078- (!*cam->requested_frame &&30793079- !cam->frame_current->queued) );30773077+ cam->disconnected ||30783078+ (!*cam->requested_frame &&30793079+ !cam->frame_current->queued) );30803080 if (err)30813081 return err;30823082 if (cam->disconnected)···31163116 return -EINVAL;3117311731183118 if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width,31193119- (u16*)&win.height))) {31193119+ (u16*)&win.height))) {31203120 DBG(4, "Resolution not supported (%ux%u). "31213121 "VIDIOCSWIN failed", win.width, win.height)31223122 return err;···31303130 || cam->frame_current->queued) {31313131 err = wait_event_interruptible31323132 ( cam->wait_queue,31333133- cam->disconnected ||31343134- (!*cam->requested_frame &&31353135- !cam->frame_current->queued) );31333133+ cam->disconnected ||31343134+ (!*cam->requested_frame &&31353135+ !cam->frame_current->queued) );31363136 if (err)31373137 return err;31383138 if (cam->disconnected)···31753175 mbuf.frames = cam->nbuffers;31763176 for (i = 0; i < cam->nbuffers; i++)31773177 mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer -31783178- (unsigned long)cam->frame[0].buffer;31783178+ (unsigned long)cam->frame[0].buffer;3179317931803180 if (copy_to_user(arg, &mbuf, sizeof(mbuf)))31813181 return -EFAULT;···31943194 return -EFAULT;3195319531963196 DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d",31973197- mmap.frame, symbolic(v4l1_plist, mmap.format), 31973197+ mmap.frame, symbolic(v4l1_plist, mmap.format),31983198 mmap.width, mmap.height)3199319932003200 if (mmap.frame >= cam->nbuffers) {···32033203 return -EINVAL;32043204 }3205320532063206- if (mmap.format!=cam->picture.palette && 32063206+ if (mmap.format!=cam->picture.palette &&32073207 (cam->force_palette || !w9968cf_vpp)) {32083208 DBG(4, "Palette %s rejected: only %s is allowed",32093209 symbolic(v4l1_plist, mmap.format),···3213321332143214 if (!w9968cf_valid_palette(mmap.format)) {32153215 DBG(4, "Palette %s not supported. "32163216- "VIDIOCMCAPTURE failed", 32163216+ "VIDIOCMCAPTURE failed",32173217 symbolic(v4l1_plist, mmap.format))32183218 return -EINVAL;32193219 }···32213221 if (!cam->force_palette) {32223222 if (cam->decompression == 0) {32233223 if (w9968cf_need_decompression(mmap.format)) {32243224- DBG(4, "Decompression disabled: palette %s is not "32253225- "allowed. VIDIOCSPICT failed",32263226- symbolic(v4l1_plist, mmap.format))32273227- return -EINVAL;32243224+ DBG(4, "Decompression disabled: palette %s is not "32253225+ "allowed. VIDIOCSPICT failed",32263226+ symbolic(v4l1_plist, mmap.format))32273227+ return -EINVAL;32283228 }32293229 } else if (cam->decompression == 1) {32303230 if (!w9968cf_need_decompression(mmap.format)) {32313231- DBG(4, "Decompression forced: palette %s is not "32323232- "allowed. VIDIOCSPICT failed",32333233- symbolic(v4l1_plist, mmap.format))32343234- return -EINVAL;32313231+ DBG(4, "Decompression forced: palette %s is not "32323232+ "allowed. VIDIOCSPICT failed",32333233+ symbolic(v4l1_plist, mmap.format))32343234+ return -EINVAL;32353235 }32363236 }32373237 }3238323832393239- if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, 32403240- (u16*)&mmap.height))) {32393239+ if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width,32403240+ (u16*)&mmap.height))) {32413241 DBG(4, "Resolution not supported (%dx%d). "32423242 "VIDIOCMCAPTURE failed",32433243 mmap.width, mmap.height)···32583258 DBG(6, "VIDIOCMCAPTURE. Change settings for "32593259 "frame #%u: %dx%d, format %s. Wait...",32603260 mmap.frame, mmap.width, mmap.height,32613261- symbolic(v4l1_plist, mmap.format))32613261+ symbolic(v4l1_plist, mmap.format))32623262 err = wait_event_interruptible32633263 ( cam->wait_queue,32643264- cam->disconnected ||32653265- (!*cam->requested_frame &&32663266- !cam->frame_current->queued) );32643264+ cam->disconnected ||32653265+ (!*cam->requested_frame &&32663266+ !cam->frame_current->queued) );32673267 if (err)32683268 return err;32693269 if (cam->disconnected)···32803280 goto ioctl_fail;3281328132823282 /* This before set_window */32833283- if (w9968cf_set_picture(cam, pict)) 32833283+ if (w9968cf_set_picture(cam, pict))32843284 goto ioctl_fail;3285328532863286 if (w9968cf_set_window(cam, win))···32923292 } else if (fr->queued) {3293329332943294 DBG(6, "Wait until frame #%u is free", mmap.frame)32953295-32963296- err = wait_event_interruptible(cam->wait_queue, 32973297- cam->disconnected ||32983298- (!fr->queued));32953295+32963296+ err = wait_event_interruptible(cam->wait_queue,32973297+ cam->disconnected ||32983298+ (!fr->queued));32993299 if (err)33003300 return err;33013301 if (cam->disconnected)···33353335 }33363336 case F_ERROR:33373337 case F_GRABBING:33383338- err = wait_event_interruptible(cam->wait_queue, 33393339- (fr->status == F_READY)33403340- || cam->disconnected);33383338+ err = wait_event_interruptible(cam->wait_queue,33393339+ (fr->status == F_READY)33403340+ || cam->disconnected);33413341 if (err)33423342 return err;33433343 if (cam->disconnected)···34393439 DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s "34403440 "(type 0x%01X, "34413441 "n. 0x%01X, "34423442- "dir. 0x%01X, " 34423442+ "dir. 0x%01X, "34433443 "size 0x%02X)",34443444 V4L1_IOCTL(cmd),34453445 _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd))···34993499 le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct)35003500 mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */35013501 else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor &&35023502- le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct)35023502+ le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct)35033503 mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */35043504 else35053505 return -ENODEV;3506350635073507 cam = (struct w9968cf_device*)35083508- kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL);35083508+ kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL);35093509 if (!cam)35103510 return -ENOMEM;35113511···35693569 cam->v4ldev->dev = &cam->dev;3570357035713571 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,35723572- video_nr[dev_nr]);35723572+ video_nr[dev_nr]);35733573 if (err) {35743574 DBG(1, "V4L device registration failed")35753575 if (err == -ENFILE && video_nr[dev_nr] == -1)···3611361136123612static void w9968cf_usb_disconnect(struct usb_interface* intf)36133613{36143614- struct w9968cf_device* cam = 36143614+ struct w9968cf_device* cam =36153615 (struct w9968cf_device*)usb_get_intfdata(intf);3616361636173617 down_write(&w9968cf_disconnect);
+6-6
drivers/media/video/w9968cf.h
···61616262/* Maximum data payload sizes in bytes for alternate settings */6363static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575,6464- 511, 447, 383, 319, 255, 191, 127, 63};6464+ 511, 447, 383, 319, 255, 191, 127, 63};6565#define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */6666#define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */6767#define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */···134134 ****************************************************************************/135135136136#define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \137137- "Dual Mode Camera Chip"137137+ "Dual Mode Camera Chip"138138#define W9968CF_MODULE_VERSION "1:1.33-basic"139139#define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia"140140#define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"···270270271271 /* Locks */272272 struct mutex dev_mutex, /* for probe, disconnect,open and close */273273- fileop_mutex; /* for read and ioctl */273273+ fileop_mutex; /* for read and ioctl */274274 spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */275275- flist_lock; /* for requested frame list accesses */275275+ flist_lock; /* for requested frame list accesses */276276 wait_queue_head_t open, wait_queue;277277278278 char command[16]; /* name of the program holding the device */···299299 dev_warn(&cam->dev, fmt "\n", ## args); \300300 else if ((level) >= 5) \301301 dev_info(&cam->dev, "[%s:%d] " fmt "\n", \302302- __FUNCTION__, __LINE__ , ## args); \302302+ __FUNCTION__, __LINE__ , ## args); \303303 } \304304}305305/* For generic kernel (not device specific) messages */···311311 pr_info("w9968cf: " fmt "\n", ## args); \312312 else if ((level) >= 5) \313313 pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \314314- __LINE__ , ## args); \314314+ __LINE__ , ## args); \315315 } \316316}317317#else
+4-4
drivers/media/video/w9968cf_decoder.h
···7878#define W9968CF_DEC_ERR_NO_EOI -679798080extern void w9968cf_init_decoder(void);8181-extern int w9968cf_check_headers(const unsigned char* Pin, 8282- const unsigned long BUF_SIZE);8383-extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, 8484- const unsigned W, const unsigned H, char* Pout);8181+extern int w9968cf_check_headers(const unsigned char* Pin,8282+ const unsigned long BUF_SIZE);8383+extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE,8484+ const unsigned W, const unsigned H, char* Pout);85858686#endif /* _W9968CF_DECODER_H_ */
···4848/*****************************************************************************/49495050#define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \5151- "Image Processor and Control Chip"5151+ "Image Processor and Control Chip"5252#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"5353#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"5454#define ZC0301_MODULE_LICENSE "GPL"···6767static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1};6868module_param_array(video_nr, short, NULL, 0444);6969MODULE_PARM_DESC(video_nr,7070- "\n<-1|n[,...]> Specify V4L2 minor mode number."7171- "\n -1 = use next available (default)"7272- "\n n = use minor number n (integer >= 0)"7373- "\nYou can specify up to "7474- __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way."7575- "\nFor example:"7676- "\nvideo_nr=-1,2,-1 would assign minor number 2 to"7777- "\nthe second registered camera and use auto for the first"7878- "\none and for every other camera."7979- "\n");7070+ "\n<-1|n[,...]> Specify V4L2 minor mode number."7171+ "\n -1 = use next available (default)"7272+ "\n n = use minor number n (integer >= 0)"7373+ "\nYou can specify up to "7474+ __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way."7575+ "\nFor example:"7676+ "\nvideo_nr=-1,2,-1 would assign minor number 2 to"7777+ "\nthe second registered camera and use auto for the first"7878+ "\none and for every other camera."7979+ "\n");80808181static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] =8282- ZC0301_FORCE_MUNMAP};8282+ ZC0301_FORCE_MUNMAP};8383module_param_array(force_munmap, bool, NULL, 0444);8484MODULE_PARM_DESC(force_munmap,8585- "\n<0|1[,...]> Force the application to unmap previously"8686- "\nmapped buffer memory before calling any VIDIOC_S_CROP or"8787- "\nVIDIOC_S_FMT ioctl's. Not all the applications support"8888- "\nthis feature. This parameter is specific for each"8989- "\ndetected camera."9090- "\n 0 = do not force memory unmapping"9191- "\n 1 = force memory unmapping (save memory)"9292- "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."9393- "\n");8585+ "\n<0|1[,...]> Force the application to unmap previously"8686+ "\nmapped buffer memory before calling any VIDIOC_S_CROP or"8787+ "\nVIDIOC_S_FMT ioctl's. Not all the applications support"8888+ "\nthis feature. This parameter is specific for each"8989+ "\ndetected camera."9090+ "\n 0 = do not force memory unmapping"9191+ "\n 1 = force memory unmapping (save memory)"9292+ "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."9393+ "\n");94949595static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] =9696- ZC0301_FRAME_TIMEOUT};9696+ ZC0301_FRAME_TIMEOUT};9797module_param_array(frame_timeout, uint, NULL, 0644);9898MODULE_PARM_DESC(frame_timeout,9999- "\n<n[,...]> Timeout for a video frame in seconds."100100- "\nThis parameter is specific for each detected camera."101101- "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"."102102- "\n");9999+ "\n<n[,...]> Timeout for a video frame in seconds."100100+ "\nThis parameter is specific for each detected camera."101101+ "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"."102102+ "\n");103103104104#ifdef ZC0301_DEBUG105105static unsigned short debug = ZC0301_DEBUG_LEVEL;106106module_param(debug, ushort, 0644);107107MODULE_PARM_DESC(debug,108108- "\n<n> Debugging information level, from 0 to 3:"109109- "\n0 = none (use carefully)"110110- "\n1 = critical errors"111111- "\n2 = significant informations"112112- "\n3 = more verbose messages"113113- "\nLevel 3 is useful for testing only, when only "114114- "one device is used."115115- "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"."116116- "\n");108108+ "\n<n> Debugging information level, from 0 to 3:"109109+ "\n0 = none (use carefully)"110110+ "\n1 = critical errors"111111+ "\n2 = significant informations"112112+ "\n3 = more verbose messages"113113+ "\nLevel 3 is useful for testing only, when only "114114+ "one device is used."115115+ "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"."116116+ "\n");117117#endif118118119119/*****************************************************************************/120120121121static u32122122zc0301_request_buffers(struct zc0301_device* cam, u32 count,123123- enum zc0301_io_method io)123123+ enum zc0301_io_method io)124124{125125 struct v4l2_pix_format* p = &(cam->sensor.pix_format);126126 struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);127127 const size_t imagesize = cam->module_param.force_munmap ||128128- io == IO_READ ?129129- (p->width * p->height * p->priv) / 8 :130130- (r->width * r->height * p->priv) / 8;128128+ io == IO_READ ?129129+ (p->width * p->height * p->priv) / 8 :130130+ (r->width * r->height * p->priv) / 8;131131 void* buff = NULL;132132 u32 i;133133···216216 int res;217217218218 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40,219219- value, index, NULL, 0, ZC0301_CTRL_TIMEOUT);219219+ value, index, NULL, 0, ZC0301_CTRL_TIMEOUT);220220 if (res < 0) {221221 DBG(3, "Failed to write a register (index 0x%04X, "222222 "value 0x%02X, error %d)",index, value, res);···234234 int res;235235236236 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0,237237- 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT);237237+ 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT);238238 if (res < 0)239239 DBG(3, "Failed to read a register (index 0x%04X, error %d)",240240 index, res);···337337338338 if (!(*f))339339 (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t,340340- frame);340340+ frame);341341342342 imagesize = (cam->sensor.pix_format.width *343343- cam->sensor.pix_format.height *344344- cam->sensor.pix_format.priv) / 8;343343+ cam->sensor.pix_format.height *344344+ cam->sensor.pix_format.priv) / 8;345345346346 for (i = 0; i < urb->number_of_packets; i++) {347347 unsigned int len, status;···395395 list_move_tail(&(*f)->frame, &cam->outqueue);396396 if (!list_empty(&cam->inqueue))397397 (*f) = list_entry(cam->inqueue.next,398398- struct zc0301_frame_t,399399- frame);398398+ struct zc0301_frame_t,399399+ frame);400400 else401401 (*f) = NULL;402402 spin_unlock(&cam->queue_lock);···429429 struct usb_device *udev = cam->usbdev;430430 struct urb* urb;431431 const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384,432432- 512, 768, 1023};432432+ 512, 768, 1023};433433 const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING];434434 s8 i, j;435435 int err = 0;436436437437 for (i = 0; i < ZC0301_URBS; i++) {438438 cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz,439439- GFP_KERNEL);439439+ GFP_KERNEL);440440 if (!cam->transfer_buffer[i]) {441441 err = -ENOMEM;442442 DBG(1, "Not enough memory");···528528529529 cam->stream = STREAM_INTERRUPT;530530 timeout = wait_event_timeout(cam->wait_stream,531531- (cam->stream == STREAM_OFF) ||532532- (cam->state & DEV_DISCONNECTED),533533- ZC0301_URB_TIMEOUT);531531+ (cam->stream == STREAM_OFF) ||532532+ (cam->state & DEV_DISCONNECTED),533533+ ZC0301_URB_TIMEOUT);534534 if (cam->state & DEV_DISCONNECTED)535535 return -ENODEV;536536 else if (cam->stream != STREAM_OFF) {···548548549549static int550550zc0301_set_compression(struct zc0301_device* cam,551551- struct v4l2_jpegcompression* compression)551551+ struct v4l2_jpegcompression* compression)552552{553553 int r, err = 0;554554···670670 }671671 mutex_unlock(&cam->dev_mutex);672672 err = wait_event_interruptible_exclusive(cam->open,673673- cam->state & DEV_DISCONNECTED674674- || !cam->users);673673+ cam->state & DEV_DISCONNECTED674674+ || !cam->users);675675 if (err) {676676 up_read(&zc0301_disconnect);677677 return err;···802802 return -EAGAIN;803803 }804804 timeout = wait_event_interruptible_timeout805805- ( cam->wait_frame,806806- (!list_empty(&cam->outqueue)) ||807807- (cam->state & DEV_DISCONNECTED) ||808808- (cam->state & DEV_MISCONFIGURED),809809- cam->module_param.frame_timeout *810810- 1000 * msecs_to_jiffies(1) );805805+ ( cam->wait_frame,806806+ (!list_empty(&cam->outqueue)) ||807807+ (cam->state & DEV_DISCONNECTED) ||808808+ (cam->state & DEV_MISCONFIGURED),809809+ cam->module_param.frame_timeout *810810+ 1000 * msecs_to_jiffies(1) );811811 if (timeout < 0) {812812 mutex_unlock(&cam->fileop_mutex);813813 return timeout;···930930{931931 struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));932932 unsigned long size = vma->vm_end - vma->vm_start,933933- start = vma->vm_start;933933+ start = vma->vm_start;934934 void *pos;935935 u32 i;936936···998998 .driver = "zc0301",999999 .version = ZC0301_MODULE_VERSION_CODE,10001000 .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |10011001- V4L2_CAP_STREAMING,10011001+ V4L2_CAP_STREAMING,10021002 };1003100310041004 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));10051005 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)10061006 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,10071007- sizeof(cap.bus_info));10071007+ sizeof(cap.bus_info));1008100810091009 if (copy_to_user(arg, &cap, sizeof(cap)))10101010 return -EFAULT;···1337133713381338static int13391339zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd,13401340- void __user * arg)13401340+ void __user * arg)13411341{13421342 struct zc0301_sensor* s = &cam->sensor;13431343 struct v4l2_format format;···1600160016011601static int16021602zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp,16031603- void __user * arg)16031603+ void __user * arg)16041604{16051605 struct v4l2_buffer b;16061606 struct zc0301_frame_t *f;···16191619 if (filp->f_flags & O_NONBLOCK)16201620 return -EAGAIN;16211621 timeout = wait_event_interruptible_timeout16221622- ( cam->wait_frame,16231623- (!list_empty(&cam->outqueue)) ||16241624- (cam->state & DEV_DISCONNECTED) ||16251625- (cam->state & DEV_MISCONFIGURED),16261626- cam->module_param.frame_timeout *16271627- 1000 * msecs_to_jiffies(1) );16221622+ ( cam->wait_frame,16231623+ (!list_empty(&cam->outqueue)) ||16241624+ (cam->state & DEV_DISCONNECTED) ||16251625+ (cam->state & DEV_MISCONFIGURED),16261626+ cam->module_param.frame_timeout *16271627+ 1000 * msecs_to_jiffies(1) );16281628 if (timeout < 0)16291629 return timeout;16301630 if (cam->state & DEV_DISCONNECTED)···174817481749174917501750static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,17511751- unsigned int cmd, void __user * arg)17511751+ unsigned int cmd, void __user * arg)17521752{17531753 struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));17541754···184218421843184318441844static int zc0301_ioctl(struct inode* inode, struct file* filp,18451845- unsigned int cmd, unsigned long arg)18451845+ unsigned int cmd, unsigned long arg)18461846{18471847 struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));18481848 int err = 0;···19481948 mutex_lock(&cam->dev_mutex);1949194919501950 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,19511951- video_nr[dev_nr]);19511951+ video_nr[dev_nr]);19521952 if (err) {19531953 DBG(1, "V4L2 device registration failed");19541954 if (err == -ENFILE && video_nr[dev_nr] == -1)
+6-6
drivers/media/video/zc0301/zc0301_pas202bcb.c
···24242525/*2626 NOTE: Sensor controls are disabled for now, becouse changing them while2727- streaming sometimes results in out-of-sync video frames. We'll use2828- the default initialization, until we know how to stop and start video2929- in the chip. However, the image quality still looks good under various3030- light conditions.2727+ streaming sometimes results in out-of-sync video frames. We'll use2828+ the default initialization, until we know how to stop and start video2929+ in the chip. However, the image quality still looks good under various3030+ light conditions.3131*/32323333#include <linux/delay.h>···165165166166167167static int pas202bcb_get_ctrl(struct zc0301_device* cam,168168- struct v4l2_control* ctrl)168168+ struct v4l2_control* ctrl)169169{170170 switch (ctrl->id) {171171 case V4L2_CID_EXPOSURE:···208208209209210210static int pas202bcb_set_ctrl(struct zc0301_device* cam,211211- const struct v4l2_control* ctrl)211211+ const struct v4l2_control* ctrl)212212{213213 int err = 0;214214
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles card-specific data and detection77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:
+1-1
drivers/media/video/zoran_card.h
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles card-specific data and detection77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:
+8-8
drivers/media/video/zoran_device.c
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles device access (PCI/I2C/codec/...)77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:···492492 /* (Ronald) don't write this if overlay_mask = NULL */493493 if (zr->overlay_mask) {494494 /* Write overlay clipping mask data, but don't enable overlay clipping */495495- /* RJ: since this makes only sense on the screen, we use 495495+ /* RJ: since this makes only sense on the screen, we use496496 * zr->overlay_settings.width instead of video_width */497497498498 mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;···819819 if (zr->card.vfe_pol.hsync_pol)820820 btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);821821 else822822- btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); 822822+ btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);823823 reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) |824824 (tvn->Wt << ZR36057_HSP_LineTot);825825 btwrite(reg, ZR36057_HSP);826826 reg = ((zr->jpg_settings.img_x +827827- tvn->HStart + 4) << ZR36057_FHAP_NAX) |827827+ tvn->HStart + 4) << ZR36057_FHAP_NAX) |828828 (zr->jpg_settings.img_width << ZR36057_FHAP_PAX);829829 btwrite(reg, ZR36057_FHAP);830830···12721272 if (zr->JPEG_error != 1) {12731273 /*12741274 * First entry: error just happened during normal operation12751275- * 12751275+ *12761276 * In BUZ_MODE_MOTION_COMPRESS:12771277- * 12771277+ *12781278 * Possible glitch in TV signal. In this case we should12791279 * stop the codec and wait for good quality signal before12801280 * restarting it to avoid further problems12811281- * 12811281+ *12821282 * In BUZ_MODE_MOTION_DECOMPRESS:12831283- * 12831283+ *12841284 * Bad JPEG frame: we have to mark it as processed (codec crashed12851285 * and was not able to do it itself), and to remove it from queue.12861286 */
+1-1
drivers/media/video/zoran_device.h
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles card-specific data and detection77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:
+8-8
drivers/media/video/zoran_driver.c
···9494 V4L2_CAP_VIDEO_CAPTURE |\9595 V4L2_CAP_VIDEO_OUTPUT |\9696 V4L2_CAP_VIDEO_OVERLAY \9797- )9797+ )9898#endif9999100100#include <asm/byteorder.h>···165165#endif166166 .depth = 16,167167 .flags = ZORAN_FORMAT_CAPTURE |168168- ZORAN_FORMAT_OVERLAY,168168+ ZORAN_FORMAT_OVERLAY,169169 }, {170170 .name = "Hardware-encoded Motion-JPEG",171171 .palette = -1,···670670 j]))));671671 free_page((unsigned long)672672 bus_to_virt673673- (le32_to_cpu673673+ (le32_to_cpu674674 (fh->jpg_buffers.675675 buffer[i].676676 frag_tab[2 * j])));···1871187118721872static int18731873zoran_set_norm (struct zoran *zr,18741874- int norm) /* VIDEO_MODE_* */18741874+ int norm) /* VIDEO_MODE_* */18751875{18761876 int norm_encoder, on;18771877···2006200620072007static int20082008zoran_do_ioctl (struct inode *inode,20092009- struct file *file,20102010- unsigned int cmd,20112011- void *arg)20092009+ struct file *file,20102010+ unsigned int cmd,20112011+ void *arg)20122012{20132013 struct zoran_fh *fh = file->private_data;20142014 struct zoran *zr = fh->zr;···20952095 break;2096209620972097 /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says:20982098- * 20982098+ *20992099 * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input."21002100 * * ^^^^^^^21012101 * * The famos BTTV driver has it implemented with a struct video_channel argument
+1-1
drivers/media/video/zoran_procfs.c
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles the procFS entries (/proc/ZORAN[%d])77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:
+1-1
drivers/media/video/zoran_procfs.h
···44 * Media Labs LML33/LML33R10.55 *66 * This part handles card-specific data and detection77- * 77+ *88 * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>99 *1010 * Currently maintained by:
+11-11
drivers/media/video/zr36016.c
···3434#include <linux/types.h>3535#include <linux/wait.h>36363737-/* includes for structures and defines regarding video 3737+/* includes for structures and defines regarding video3838 #include<linux/videodev.h> */39394040/* I/O commands, error codes */···143143144144static void145145zr36016_writei (struct zr36016 *ptr,146146- u16 reg,147147- u8 value)146146+ u16 reg,147147+ u8 value)148148{149149 dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,150150 value, reg);···192192 dprintk(1, "\n");193193 }194194 // for testing just write 0, then the default value to a register and read195195- // it back in both cases 195195+ // it back in both cases196196 zr36016_writei(ptr, ZR016I_PAX_LO, 0x00);197197 if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) {198198 dprintk(1,···232232static int zr36016_pushit (struct zr36016 *ptr,233233 u16 startreg,234234 u16 len,235235- const char *data)235235+ const char *data)236236{237237- int i=0;237237+ int i=0;238238239239- dprintk(4, "%s: write data block to 0x%04x (len=%d)\n",239239+ dprintk(4, "%s: write data block to 0x%04x (len=%d)\n",240240 ptr->name, startreg,len);241241- while (i<len) {242242- zr36016_writei(ptr, startreg++, data[i++]);243243- }241241+ while (i<len) {242242+ zr36016_writei(ptr, startreg++, data[i++]);243243+ }244244245245- return i;245245+ return i;246246}247247#endif248248
+8-8
drivers/media/video/zr36050.c
···3434#include <linux/types.h>3535#include <linux/wait.h>36363737-/* includes for structures and defines regarding video 3737+/* includes for structures and defines regarding video3838 #include<linux/videodev.h> */39394040/* I/O commands, error codes */···171171/* =========================================================================172172 Local helper function:173173174174- basic test of "connectivity", writes/reads to/from memory the SOF marker 174174+ basic test of "connectivity", writes/reads to/from memory the SOF marker175175 ========================================================================= */176176177177static int···218218219219static int220220zr36050_pushit (struct zr36050 *ptr,221221- u16 startreg,222222- u16 len,223223- const char *data)221221+ u16 startreg,222222+ u16 len,223223+ const char *data)224224{225225 int i = 0;226226···345345/* ------------------------------------------------------------------------- */346346347347/* SOF (start of frame) segment depends on width, height and sampling ratio348348- of each color component */348348+ of each color component */349349350350static int351351zr36050_set_sof (struct zr36050 *ptr)···376376377377/* ------------------------------------------------------------------------- */378378379379-/* SOS (start of scan) segment depends on the used scan components 380380- of each color component */379379+/* SOS (start of scan) segment depends on the used scan components380380+ of each color component */381381382382static int383383zr36050_set_sos (struct zr36050 *ptr)
+5-5
drivers/media/video/zr36057.h
···11-/* 11+/*22 * zr36057.h - zr36057 register offsets33 *44 * Copyright (C) 1998 Dave Perks <dperks@ibm.net>···2727#define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */2828#define ZR36057_VFEHCR_HSPol (1<<30)2929#define ZR36057_VFEHCR_HStart 103030-#define ZR36057_VFEHCR_HEnd 03131-#define ZR36057_VFEHCR_Hmask 0x3ff3030+#define ZR36057_VFEHCR_HEnd 03131+#define ZR36057_VFEHCR_Hmask 0x3ff32323333#define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */3434#define ZR36057_VFEVCR_VSPol (1<<30)3535#define ZR36057_VFEVCR_VStart 103636-#define ZR36057_VFEVCR_VEnd 03737-#define ZR36057_VFEVCR_Vmask 0x3ff3636+#define ZR36057_VFEVCR_VEnd 03737+#define ZR36057_VFEVCR_Vmask 0x3ff38383939#define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */4040#define ZR36057_VFESPFR_ExtFl (1<<26)
+10-10
drivers/media/video/zr36060.c
···3434#include <linux/types.h>3535#include <linux/wait.h>36363737-/* includes for structures and defines regarding video 3737+/* includes for structures and defines regarding video3838 #include<linux/videodev.h> */39394040/* I/O commands, error codes */···173173/* =========================================================================174174 Local helper function:175175176176- basic test of "connectivity", writes/reads to/from memory the SOF marker 176176+ basic test of "connectivity", writes/reads to/from memory the SOF marker177177 ========================================================================= */178178179179static int···208208209209static int210210zr36060_pushit (struct zr36060 *ptr,211211- u16 startreg,212212- u16 len,213213- const char *data)211211+ u16 startreg,212212+ u16 len,213213+ const char *data)214214{215215 int i = 0;216216···335335/* ------------------------------------------------------------------------- */336336337337/* SOF (start of frame) segment depends on width, height and sampling ratio338338- of each color component */338338+ of each color component */339339340340static int341341zr36060_set_sof (struct zr36060 *ptr)···367367368368/* ------------------------------------------------------------------------- */369369370370-/* SOS (start of scan) segment depends on the used scan components 371371- of each color component */370370+/* SOS (start of scan) segment depends on the used scan components371371+ of each color component */372372373373static int374374zr36060_set_sos (struct zr36060 *ptr)···385385 for (i = 0; i < NO_OF_COMPONENTS; i++) {386386 sos_data[5 + (i * 2)] = i; // index387387 sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) |388388- zr36060_ta[i]; // AC/DC tbl.sel.388388+ zr36060_ta[i]; // AC/DC tbl.sel.389389 }390390 sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start391391 sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f;···999999 dprintk(1,10001000 "zr36060: something's wrong - %d codecs left somehow.\n",10011001 zr36060_codecs);10021002- } 10021002+ }1003100310041004 /* however, we can't just stay alive */10051005 videocodec_unregister(&zr36060_codec);
+23-23
drivers/media/video/zr36120.c
···316316 item->status = FBUFFER_BUSY;317317 if (!lastitem)318318 ztv->workqueue = item;319319- else 319319+ else320320 lastitem->next = item;321321 lastitem = item;322322 }···516516 zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR);517517}518518519519-struct tvnorm 519519+struct tvnorm520520{521521 u16 Wt, Wa, Ht, Ha, HStart, VStart;522522};···660660 int HorDcm = 64-X;661661 int hcrop1 = 2*(Wa-We)/4;662662 /*663663- * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> 663663+ * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi>664664 * found the solution to the color phase shift.665665 * See ChangeLog for the full explanation)666666 */···812812813813 zoran_common_close(ztv);814814815815- /*816816- * This is sucky but right now I can't find a good way to817817- * be sure its safe to free the buffer. We wait 5-6 fields818818- * which is more than sufficient to be sure.819819- */820820- msleep(100); /* Wait 1/10th of a second */815815+ /*816816+ * This is sucky but right now I can't find a good way to817817+ * be sure its safe to free the buffer. We wait 5-6 fields818818+ * which is more than sufficient to be sure.819819+ */820820+ msleep(100); /* Wait 1/10th of a second */821821822822 /* free the allocated framebuffer */823823 bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE);···1436143614371437 /* Why isn't this in the API?14381438 * And why doesn't it take a buffer number?14391439- case BTTV_FIELDNR: 14391439+ case BTTV_FIELDNR:14401440 {14411441 unsigned long v = ztv->lastfieldnr;14421442 if (copy_to_user(arg,&v,sizeof(v)))···1557155715581558 zoran_common_close(ztv);1559155915601560- /*15611561- * This is sucky but right now I can't find a good way to15621562- * be sure its safe to free the buffer. We wait 5-6 fields15631563- * which is more than sufficient to be sure.15641564- */15651565- msleep(100); /* Wait 1/10th of a second */15601560+ /*15611561+ * This is sucky but right now I can't find a good way to15621562+ * be sure its safe to free the buffer. We wait 5-6 fields15631563+ * which is more than sufficient to be sure.15641564+ */15651565+ msleep(100); /* Wait 1/10th of a second */1566156615671567 for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++)15681568 {···16201620 write_unlock_irq(&ztv->lock);16211621 return -EWOULDBLOCK;16221622 }16231623-16231623+16241624 /* mark the unused buffer as wanted */16251625 unused->status = FBUFFER_BUSY;16261626 unused->next = 0;···16711671 if (count == 2*19*2048) {16721672 /*16731673 * Extreme HACK, old VBI programs expect 2048 points16741674- * of data, and we only got 864 orso. Double each 16741674+ * of data, and we only got 864 orso. Double each16751675 * datapoint and clear the rest of the line.16761676 * This way we have appear to have a16771677 * sample_frequency of 29.5 Mc.···19561956 zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC);1957195719581958 /* external FL determines TOP frame */19591959- zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); 19591959+ zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC);1960196019611961 /* set HSpol */19621962 if (ztv->card->hsync_pos)···20122012 struct zoran *ztv;20132013 int i;2014201420152015- for (i=0;i<max; i++) 20152015+ for (i=0;i<max; i++)20162016 {20172017 ztv = &zorans[i];20182018···2029202920302030 /* free it */20312031 free_irq(ztv->dev->irq,ztv);20322032-20322032+20332033 /* unregister i2c_bus */20342034 i2c_unregister_bus((&ztv->i2c));20352035···20502050int __init zr36120_init(void)20512051{20522052 int card;20532053-20532053+20542054 handle_chipset();20552055 zoran_cards = find_zoran();20562056 if (zoran_cards<0)···20632063 /* only release the zorans we have registered */20642064 release_zoran(card);20652065 return -EIO;20662066- } 20662066+ }20672067 }20682068 return 0;20692069}