Lines Matching +full:12 +full:bit +full:- +full:clkdiv +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (C) 2009-2011 Jean-François Moine <http://moinejf.free.fr>
17 MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
103 #define SCL_SEL_OD 0x20 /* open-drain mode */
301 /* sequence specific to the sensors - !! index = SENSOR_xxx */
616 {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, /* op mode ctrl */
627 {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, /* read mode */
646 /* factory mode */
652 /* auto-exposure speed (0) / white balance mode (auto RGB) */
654 * set color mode */
666 /* luminance mode (0x4f -> AutoExpo on) */
776 /* {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, * GAIN - def */
777 /* {0xb1, 0x21, 0x01, 0x6c, 0x6c, 0x00, 0x00, 0x10}, * B R - def: 80 */
784 /* {0xb1, 0x21, 0x01, 0x64, 0x84, 0x00, 0x00, 0x10}, * B R - def: 80 */
851 /* not in all ms-win traces*/
923 /* from ms-win traces - these values change with auto gain/expo/wb.. */
1029 /* global gain ? : 07 - change with 0x15 at the end */
1033 /* exposure ? : 0200 - change with 0x1e at the end */
1140 /* read <len> bytes to gspca_dev->usb_buf */
1146 if (gspca_dev->usb_err < 0) in reg_r()
1153 ret = usb_control_msg(gspca_dev->dev, in reg_r()
1154 usb_rcvctrlpipe(gspca_dev->dev, 0), in reg_r()
1158 gspca_dev->usb_buf, len, in reg_r()
1160 gspca_dbg(gspca_dev, D_USBI, "reg_r [%02x] -> %02x\n", in reg_r()
1161 value, gspca_dev->usb_buf[0]); in reg_r()
1164 gspca_dev->usb_err = ret; in reg_r()
1169 memset(gspca_dev->usb_buf, 0, USB_BUF_SZ); in reg_r()
1179 if (gspca_dev->usb_err < 0) in reg_w1()
1182 gspca_dev->usb_buf[0] = data; in reg_w1()
1183 ret = usb_control_msg(gspca_dev->dev, in reg_w1()
1184 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w1()
1189 gspca_dev->usb_buf, 1, in reg_w1()
1193 gspca_dev->usb_err = ret; in reg_w1()
1203 if (gspca_dev->usb_err < 0) in reg_w()
1213 memcpy(gspca_dev->usb_buf, buffer, len); in reg_w()
1214 ret = usb_control_msg(gspca_dev->dev, in reg_w()
1215 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w()
1219 gspca_dev->usb_buf, len, in reg_w()
1223 gspca_dev->usb_err = ret; in reg_w()
1233 if (gspca_dev->usb_err < 0) in i2c_w1()
1236 switch (sd->sensor) { in i2c_w1()
1240 gspca_dev->usb_buf[0] = 0x80 | (2 << 4); in i2c_w1()
1243 gspca_dev->usb_buf[0] = 0x81 | (2 << 4); in i2c_w1()
1246 gspca_dev->usb_buf[1] = sd->i2c_addr; in i2c_w1()
1247 gspca_dev->usb_buf[2] = reg; in i2c_w1()
1248 gspca_dev->usb_buf[3] = val; in i2c_w1()
1249 gspca_dev->usb_buf[4] = 0; in i2c_w1()
1250 gspca_dev->usb_buf[5] = 0; in i2c_w1()
1251 gspca_dev->usb_buf[6] = 0; in i2c_w1()
1252 gspca_dev->usb_buf[7] = 0x10; in i2c_w1()
1253 ret = usb_control_msg(gspca_dev->dev, in i2c_w1()
1254 usb_sndctrlpipe(gspca_dev->dev, 0), in i2c_w1()
1259 gspca_dev->usb_buf, 8, in i2c_w1()
1264 gspca_dev->usb_err = ret; in i2c_w1()
1274 if (gspca_dev->usb_err < 0) in i2c_w8()
1278 memcpy(gspca_dev->usb_buf, buffer, 8); in i2c_w8()
1279 ret = usb_control_msg(gspca_dev->dev, in i2c_w8()
1280 usb_sndctrlpipe(gspca_dev->dev, 0), in i2c_w8()
1284 gspca_dev->usb_buf, 8, in i2c_w8()
1289 gspca_dev->usb_err = ret; in i2c_w8()
1293 /* sensor read 'len' (1..5) bytes in gspca_dev->usb_buf */
1297 u8 mode[8]; in i2c_r() local
1299 switch (sd->sensor) { in i2c_r()
1303 mode[0] = 0x80 | 0x10; in i2c_r()
1306 mode[0] = 0x81 | 0x10; in i2c_r()
1309 mode[1] = sd->i2c_addr; in i2c_r()
1310 mode[2] = reg; in i2c_r()
1311 mode[3] = 0; in i2c_r()
1312 mode[4] = 0; in i2c_r()
1313 mode[5] = 0; in i2c_r()
1314 mode[6] = 0; in i2c_r()
1315 mode[7] = 0x10; in i2c_r()
1316 i2c_w8(gspca_dev, mode); in i2c_r()
1318 mode[0] = (mode[0] & 0x81) | (len << 4) | 0x02; in i2c_r()
1319 mode[2] = 0; in i2c_r()
1320 i2c_w8(gspca_dev, mode); in i2c_r()
1346 if (gspca_dev->usb_buf[0] == 0x02 /* chip ID (02 is R) */ in hv7131r_probe()
1347 && gspca_dev->usb_buf[1] == 0x09 in hv7131r_probe()
1348 && gspca_dev->usb_buf[2] == 0x01) { in hv7131r_probe()
1353 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], in hv7131r_probe()
1354 gspca_dev->usb_buf[2]); in hv7131r_probe()
1384 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in mi0360_probe()
1392 if (gspca_dev->usb_err < 0) in mi0360_probe()
1397 sd->sensor = SENSOR_MI0360B; in mi0360_probe()
1401 sd->sensor = SENSOR_MT9V111; in mi0360_probe()
1407 gspca_dbg(gspca_dev, D_PROBE, "Unknown sensor %04x - forced to mi0360\n", in mi0360_probe()
1421 sd->i2c_addr = 0x21; in ov7630_probe()
1423 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in ov7630_probe()
1426 if (gspca_dev->usb_err < 0) in ov7630_probe()
1429 sd->sensor = SENSOR_SOI768; in ov7630_probe()
1431 gspca_dev->cam.input_flags = in ov7630_probe()
1447 sd->i2c_addr = 0x21; in ov7648_probe()
1449 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in ov7648_probe()
1460 sd->i2c_addr = 0x6e; in ov7648_probe()
1462 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in ov7648_probe()
1465 if (gspca_dev->usb_err < 0) in ov7648_probe()
1469 sd->sensor = SENSOR_PO1030; in ov7648_probe()
1485 sd->i2c_addr = 0x21; in po2030n_probe()
1487 val = gspca_dev->usb_buf[4]; in po2030n_probe()
1492 sd->sensor = SENSOR_GC0307; in po2030n_probe()
1499 sd->i2c_addr = 0x6e; in po2030n_probe()
1501 val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in po2030n_probe()
1504 if (gspca_dev->usb_err < 0) in po2030n_probe()
1508 /* sd->sensor = SENSOR_PO2030N; */ in po2030n_probe()
1521 sd->bridge = id->driver_info >> 16; in sd_config()
1522 sd->sensor = id->driver_info >> 8; in sd_config()
1523 sd->flags = id->driver_info; in sd_config()
1525 cam = &gspca_dev->cam; in sd_config()
1526 if (sd->sensor == SENSOR_ADCM1700) { in sd_config()
1527 cam->cam_mode = cif_mode; in sd_config()
1528 cam->nmodes = ARRAY_SIZE(cif_mode); in sd_config()
1530 cam->cam_mode = vga_mode; in sd_config()
1531 cam->nmodes = ARRAY_SIZE(vga_mode); in sd_config()
1533 cam->npkt = 24; /* 24 packets per ISOC message */ in sd_config()
1535 sd->ag_cnt = -1; in sd_config()
1536 sd->quality = QUALITY_DEF; in sd_config()
1538 INIT_WORK(&sd->work, qual_upd); in sd_config()
1556 regF1 = gspca_dev->usb_buf[0]; in sd_init()
1557 if (gspca_dev->usb_err < 0) in sd_init()
1558 return gspca_dev->usb_err; in sd_init()
1560 if (gspca_dev->audio) in sd_init()
1562 switch (sd->bridge) { in sd_init()
1566 return -ENODEV; in sd_init()
1572 return -ENODEV; in sd_init()
1575 switch (sd->sensor) { in sd_init()
1590 switch (sd->bridge) { in sd_init()
1599 /* Note we do not disable the sensor clock here (power saving mode), in sd_init()
1604 sn9c1xx = sn_tb[sd->sensor]; in sd_init()
1605 sd->i2c_addr = sn9c1xx[9]; in sd_init()
1607 return gspca_dev->usb_err; in sd_init()
1620 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
1622 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
1625 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1628 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1631 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1633 sd->red_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1635 sd->blue_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1638 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1641 if (sd->sensor == SENSOR_OM6802) in sd_init_controls()
1642 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1645 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1648 if (sd->flags & F_ILLUM) in sd_init_controls()
1649 sd->illum = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1652 if (sd->sensor == SENSOR_PO2030N) { in sd_init_controls()
1653 gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1655 gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1657 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1661 if (sd->sensor != SENSOR_ADCM1700 && sd->sensor != SENSOR_OV7660 && in sd_init_controls()
1662 sd->sensor != SENSOR_PO1030 && sd->sensor != SENSOR_SOI768 && in sd_init_controls()
1663 sd->sensor != SENSOR_SP80708) in sd_init_controls()
1664 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1667 if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_OV7630 || in sd_init_controls()
1668 sd->sensor == SENSOR_OV7648 || sd->sensor == SENSOR_PO2030N) in sd_init_controls()
1669 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
1672 if (sd->sensor == SENSOR_OV7630 || sd->sensor == SENSOR_OV7648 || in sd_init_controls()
1673 sd->sensor == SENSOR_OV7660) in sd_init_controls()
1674 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, in sd_init_controls()
1679 if (hdl->error) { in sd_init_controls()
1681 return hdl->error; in sd_init_controls()
1684 v4l2_ctrl_cluster(2, &sd->red_bal); in sd_init_controls()
1685 if (sd->sensor == SENSOR_PO2030N) { in sd_init_controls()
1686 v4l2_ctrl_cluster(2, &sd->vflip); in sd_init_controls()
1687 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false); in sd_init_controls()
1698 switch (sd->sensor) { in expo_adjust()
1702 /* expo = 0..255 -> a = 19..43 */ in expo_adjust()
1705 a -= 12; in expo_adjust()
1723 u8 expoMi[] = /* exposure 0x0635 -> 4 fp/s 0x10 */ in expo_adjust()
1781 /* preset AGC - works when AutoExpo = off */ in expo_adjust()
1801 int brightness = sd->brightness->val; in setbrightness()
1804 k2 = (brightness - 0x80) >> 2; in setbrightness()
1805 switch (sd->sensor) { in setbrightness()
1811 expo = brightness << 12; in setbrightness()
1816 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1821 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1825 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1829 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1833 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1837 sd->exposure = expo_adjust(gspca_dev, expo); in setbrightness()
1850 k2 = sd->contrast->val * 37 / (CONTRAST_MAX + 1) in setcontrast()
1866 u8 reg8a[12]; /* U & V gains */ in setcolors()
1868 -24, -38, 64, /* UR UG UB */ in setcolors()
1869 62, -51, -9 /* VR VG VB */ in setcolors()
1872 -20, -38, 64, /* UR UG UB */ in setcolors()
1873 60, -51, -9 /* VR VG VB */ in setcolors()
1876 colors = sd->saturation->val; in setcolors()
1877 if (sd->sensor == SENSOR_MI0360B) in setcolors()
1893 if (sd->sensor == SENSOR_PO2030N) { in setredblue()
1898 rg1b[3] = sd->red_bal->val * 2; in setredblue()
1899 rg1b[5] = sd->blue_bal->val * 2; in setredblue()
1903 reg_w1(gspca_dev, 0x05, sd->red_bal->val); in setredblue()
1905 reg_w1(gspca_dev, 0x06, sd->blue_bal->val); in setredblue()
1919 switch (sd->sensor) { in setgamma()
1939 val = sd->gamma->val; in setgamma()
1942 + delta[i] * (val - GAMMA_DEF) / 32; in setgamma()
1950 if (sd->sensor == SENSOR_PO2030N) { in setexposure()
1954 rexpo[3] = gspca_dev->exposure->val >> 8; in setexposure()
1958 rexpo[3] = gspca_dev->exposure->val; in setexposure()
1967 switch (sd->sensor) { in setautogain()
1972 if (sd->sensor == SENSOR_OV7630) in setautogain()
1976 if (gspca_dev->autogain->val) in setautogain()
1978 i2c_w1(&sd->gspca_dev, 0x13, comb); in setautogain()
1982 if (gspca_dev->autogain->val) in setautogain()
1983 sd->ag_cnt = AG_CNT_START; in setautogain()
1985 sd->ag_cnt = -1; in setautogain()
1992 if (sd->sensor == SENSOR_PO2030N) { in setgain()
1996 rgain[3] = gspca_dev->gain->val; in setgain()
2006 switch (sd->sensor) { in sethvflip()
2008 comn = 0x18; /* clkdiv = 1, ablcen = 1 */ in sethvflip()
2009 if (sd->vflip->val) in sethvflip()
2015 if (!sd->vflip->val) in sethvflip()
2021 if (sd->vflip->val) in sethvflip()
2032 * bit3-0: X in sethvflip()
2035 if (sd->hflip->val) in sethvflip()
2037 if (sd->vflip->val) in sethvflip()
2039 i2c_w1(&sd->gspca_dev, 0x1e, comn); in sethvflip()
2048 reg_w1(gspca_dev, 0x99, sd->sharpness->val); in setsharpness()
2055 switch (sd->sensor) { in setillum()
2058 sd->illum->val ? 0x64 : 0x60); in setillum()
2062 sd->illum->val ? 0x77 : 0x74); in setillum()
2074 if (sd->sensor == SENSOR_OV7660) { in setfreq()
2078 switch (sd->freq->val) { in setfreq()
2095 switch (sd->sensor) { in setfreq()
2106 switch (sd->freq->val) { in setfreq()
2129 jpeg_set_qual(sd->jpeg_hdr, sd->quality); in setjpegqual()
2133 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); in setjpegqual()
2134 usb_control_msg(gspca_dev->dev, in setjpegqual()
2135 usb_sndctrlpipe(gspca_dev->dev, 0), in setjpegqual()
2139 gspca_dev->usb_buf, 64, in setjpegqual()
2141 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); in setjpegqual()
2142 usb_control_msg(gspca_dev->dev, in setjpegqual()
2143 usb_sndctrlpipe(gspca_dev->dev, 0), in setjpegqual()
2147 gspca_dev->usb_buf, 64, in setjpegqual()
2150 sd->reg18 ^= 0x40; in setjpegqual()
2151 reg_w1(gspca_dev, 0x18, sd->reg18); in setjpegqual()
2159 struct gspca_dev *gspca_dev = &sd->gspca_dev; in qual_upd()
2161 /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ in qual_upd()
2162 mutex_lock(&gspca_dev->usb_lock); in qual_upd()
2163 gspca_dbg(gspca_dev, D_STREAM, "qual_upd %d%%\n", sd->quality); in qual_upd()
2164 gspca_dev->usb_err = 0; in qual_upd()
2166 mutex_unlock(&gspca_dev->usb_lock); in qual_upd()
2169 /* -- start the camera -- */
2179 int mode; in sd_start() local
2200 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
2201 gspca_dev->pixfmt.width, in sd_start()
2205 sn9c1xx = sn_tb[sd->sensor]; in sd_start()
2210 if (sd->flags & F_PDN_INV) in sd_start()
2217 if (gspca_dev->audio) in sd_start()
2222 switch (sd->sensor) { in sd_start()
2242 switch (sd->sensor) { in sd_start()
2264 reg01 &= ~SCL_SEL_OD; /* remove open-drain mode */ in sd_start()
2267 switch (sd->sensor) { in sd_start()
2287 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); in sd_start()
2294 if (sd->sensor == SENSOR_ADCM1700) { in sd_start()
2303 if (sd->sensor == SENSOR_ADCM1700) { in sd_start()
2311 switch (sd->sensor) { in sd_start()
2331 switch (sd->sensor) { in sd_start()
2362 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; in sd_start()
2366 switch (sd->sensor) { in sd_start()
2375 if (!mode) in sd_start()
2384 if (mode) { /* if 320x240 */ in sd_start()
2395 if (!mode) { /* if 640x480 */ in sd_start()
2429 /* more sensor initialization - param1 */ in sd_start()
2436 switch (sd->sensor) { in sd_start()
2449 switch (sd->sensor) { in sd_start()
2469 /* here change size mode 0 -> VGA; 1 -> CIF */ in sd_start()
2470 sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40; in sd_start()
2471 reg_w1(gspca_dev, 0x18, sd->reg18); in sd_start()
2476 sd->reg01 = reg01; in sd_start()
2477 sd->reg17 = reg17; in sd_start()
2479 sd->pktsz = sd->npkt = 0; in sd_start()
2480 sd->nchg = sd->short_mark = 0; in sd_start()
2482 return gspca_dev->usb_err; in sd_start()
2499 reg01 = sd->reg01; in sd_stopN()
2500 reg17 = sd->reg17 & ~SEN_CLK_EN; in sd_stopN()
2501 switch (sd->sensor) { in sd_stopN()
2559 /* the usb_lock is held at entry - restore on exit */
2564 mutex_unlock(&gspca_dev->usb_lock); in sd_stop0()
2565 flush_work(&sd->work); in sd_stop0()
2566 mutex_lock(&gspca_dev->usb_lock); in sd_stop0()
2578 if (sd->ag_cnt < 0) in do_autogain()
2580 if (--sd->ag_cnt >= 0) in do_autogain()
2582 sd->ag_cnt = AG_CNT_START; in do_autogain()
2584 delta = atomic_read(&sd->avg_lum); in do_autogain()
2587 if (sd->sensor == SENSOR_PO2030N) { in do_autogain()
2593 if (delta < luma_mean - luma_delta || in do_autogain()
2595 switch (sd->sensor) { in do_autogain()
2597 expotimes = sd->exposure; in do_autogain()
2598 expotimes += (luma_mean - delta) >> 6; in do_autogain()
2601 sd->exposure = expo_adjust(gspca_dev, in do_autogain()
2605 expotimes = sd->exposure >> 8; in do_autogain()
2606 expotimes += (luma_mean - delta) >> 4; in do_autogain()
2609 sd->exposure = expo_adjust(gspca_dev, in do_autogain()
2614 expotimes = sd->exposure; in do_autogain()
2615 expotimes += (luma_mean - delta) >> 2; in do_autogain()
2618 sd->exposure = expo_adjust(gspca_dev, in do_autogain()
2626 expotimes = sd->exposure; in do_autogain()
2627 expotimes += (luma_mean - delta) >> 6; in do_autogain()
2630 sd->exposure = expo_adjust(gspca_dev, in do_autogain()
2658 atomic_set(&sd->avg_lum, avg_lum); in set_lum()
2681 * When the bit 'USB full' is set, the frame must be discarded; in sd_pkt_scan()
2687 sd->npkt++; in sd_pkt_scan()
2688 sd->pktsz += len; in sd_pkt_scan()
2691 * - there can be only one marker in a packet in sd_pkt_scan()
2695 i = sd->short_mark; in sd_pkt_scan()
2697 sd->short_mark = 0; in sd_pkt_scan()
2706 len -= i; in sd_pkt_scan()
2713 for (i = len - 1; --i >= 0; ) { in sd_pkt_scan()
2715 i--; in sd_pkt_scan()
2728 if (data[len - 1] == 0xff) in sd_pkt_scan()
2729 sd->short_mark = -1; in sd_pkt_scan()
2730 if (gspca_dev->last_packet_type == LAST_PACKET) in sd_pkt_scan()
2732 sd->jpeg_hdr, JPEG_HDR_SZ); in sd_pkt_scan()
2741 if (data[i - 2] != 0xff || data[i - 1] != 0xd9) { in sd_pkt_scan()
2742 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
2743 new_qual = -3; in sd_pkt_scan()
2747 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
2748 new_qual = -5; in sd_pkt_scan()
2758 r = (sd->pktsz * 100) / in sd_pkt_scan()
2759 (sd->npkt * in sd_pkt_scan()
2760 gspca_dev->urb[0]->iso_frame_desc[0].length); in sd_pkt_scan()
2762 new_qual = -3; in sd_pkt_scan()
2767 sd->nchg += new_qual; in sd_pkt_scan()
2768 if (sd->nchg < -6 || sd->nchg >= 12) { in sd_pkt_scan()
2769 sd->nchg = 0; in sd_pkt_scan()
2770 new_qual += sd->quality; in sd_pkt_scan()
2775 if (new_qual != sd->quality) { in sd_pkt_scan()
2776 sd->quality = new_qual; in sd_pkt_scan()
2777 schedule_work(&sd->work); in sd_pkt_scan()
2781 sd->nchg = 0; in sd_pkt_scan()
2783 sd->pktsz = sd->npkt = 0; in sd_pkt_scan()
2788 sd->short_mark = i + 62 - len; in sd_pkt_scan()
2791 if (sd->ag_cnt >= 0) in sd_pkt_scan()
2798 len -= i; in sd_pkt_scan()
2800 sd->jpeg_hdr, JPEG_HDR_SZ); in sd_pkt_scan()
2808 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
2810 gspca_dev->usb_err = 0; in sd_s_ctrl()
2812 if (!gspca_dev->streaming) in sd_s_ctrl()
2815 switch (ctrl->id) { in sd_s_ctrl()
2849 return -EINVAL; in sd_s_ctrl()
2851 return gspca_dev->usb_err; in sd_s_ctrl()
2859 int ret = -EINVAL; in sd_int_pkt_scan()
2862 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); in sd_int_pkt_scan()
2863 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
2864 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); in sd_int_pkt_scan()
2865 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
2873 /* sub-driver description */
2889 /* -- module initialisation -- */
2961 /* -- device connect -- */