Lines Matching refs:gspca_dev
70 struct gspca_dev gspca_dev; member
909 static void reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length) in reg_r() argument
911 struct usb_device *dev = gspca_dev->dev; in reg_r()
914 if (gspca_dev->usb_err < 0) in reg_r()
921 gspca_dev->usb_buf, in reg_r()
926 gspca_dev->usb_err = result; in reg_r()
930 static void reg_w(struct gspca_dev *gspca_dev, u16 reg, in reg_w() argument
933 struct usb_device *dev = gspca_dev->dev; in reg_w()
936 if (gspca_dev->usb_err < 0) in reg_w()
938 memcpy(gspca_dev->usb_buf, buffer, length); in reg_w()
944 gspca_dev->usb_buf, in reg_w()
949 gspca_dev->usb_err = result; in reg_w()
953 static void reg_w1(struct gspca_dev *gspca_dev, u16 reg, const u8 value) in reg_w1() argument
955 reg_w(gspca_dev, reg, &value, 1); in reg_w1()
958 static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buffer) in i2c_w() argument
962 reg_w(gspca_dev, 0x10c0, buffer, 8); in i2c_w()
964 reg_r(gspca_dev, 0x10c0, 1); in i2c_w()
965 if (gspca_dev->usb_err < 0) in i2c_w()
967 if (gspca_dev->usb_buf[0] & 0x04) { in i2c_w()
968 if (gspca_dev->usb_buf[0] & 0x08) { in i2c_w()
970 gspca_dev->usb_err = -EIO; in i2c_w()
980 static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) in i2c_w1() argument
982 struct sd *sd = (struct sd *) gspca_dev; in i2c_w1()
998 i2c_w(gspca_dev, row); in i2c_w1()
1001 static void i2c_w1_buf(struct gspca_dev *gspca_dev, in i2c_w1_buf() argument
1005 i2c_w1(gspca_dev, buf->reg, buf->val); in i2c_w1_buf()
1010 static void i2c_w2(struct gspca_dev *gspca_dev, u8 reg, u16 val) in i2c_w2() argument
1012 struct sd *sd = (struct sd *) gspca_dev; in i2c_w2()
1028 i2c_w(gspca_dev, row); in i2c_w2()
1031 static void i2c_w2_buf(struct gspca_dev *gspca_dev, in i2c_w2_buf() argument
1035 i2c_w2(gspca_dev, buf->reg, buf->val); in i2c_w2_buf()
1040 static void i2c_r1(struct gspca_dev *gspca_dev, u8 reg, u8 *val) in i2c_r1() argument
1042 struct sd *sd = (struct sd *) gspca_dev; in i2c_r1()
1053 i2c_w(gspca_dev, row); in i2c_r1()
1056 i2c_w(gspca_dev, row); in i2c_r1()
1057 reg_r(gspca_dev, 0x10c2, 5); in i2c_r1()
1058 *val = gspca_dev->usb_buf[4]; in i2c_r1()
1061 static void i2c_r2(struct gspca_dev *gspca_dev, u8 reg, u16 *val) in i2c_r2() argument
1063 struct sd *sd = (struct sd *) gspca_dev; in i2c_r2()
1074 i2c_w(gspca_dev, row); in i2c_r2()
1077 i2c_w(gspca_dev, row); in i2c_r2()
1078 reg_r(gspca_dev, 0x10c2, 5); in i2c_r2()
1079 *val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; in i2c_r2()
1082 static void ov9650_init_sensor(struct gspca_dev *gspca_dev) in ov9650_init_sensor() argument
1085 struct sd *sd = (struct sd *) gspca_dev; in ov9650_init_sensor()
1087 i2c_r2(gspca_dev, 0x1c, &id); in ov9650_init_sensor()
1088 if (gspca_dev->usb_err < 0) in ov9650_init_sensor()
1093 gspca_dev->usb_err = -ENODEV; in ov9650_init_sensor()
1097 i2c_w1(gspca_dev, 0x12, 0x80); /* sensor reset */ in ov9650_init_sensor()
1099 i2c_w1_buf(gspca_dev, ov9650_init, ARRAY_SIZE(ov9650_init)); in ov9650_init_sensor()
1100 if (gspca_dev->usb_err < 0) in ov9650_init_sensor()
1106 static void ov9655_init_sensor(struct gspca_dev *gspca_dev) in ov9655_init_sensor() argument
1108 struct sd *sd = (struct sd *) gspca_dev; in ov9655_init_sensor()
1110 i2c_w1(gspca_dev, 0x12, 0x80); /* sensor reset */ in ov9655_init_sensor()
1112 i2c_w1_buf(gspca_dev, ov9655_init, ARRAY_SIZE(ov9655_init)); in ov9655_init_sensor()
1113 if (gspca_dev->usb_err < 0) in ov9655_init_sensor()
1120 static void soi968_init_sensor(struct gspca_dev *gspca_dev) in soi968_init_sensor() argument
1122 struct sd *sd = (struct sd *) gspca_dev; in soi968_init_sensor()
1124 i2c_w1(gspca_dev, 0x12, 0x80); /* sensor reset */ in soi968_init_sensor()
1126 i2c_w1_buf(gspca_dev, soi968_init, ARRAY_SIZE(soi968_init)); in soi968_init_sensor()
1127 if (gspca_dev->usb_err < 0) in soi968_init_sensor()
1134 static void ov7660_init_sensor(struct gspca_dev *gspca_dev) in ov7660_init_sensor() argument
1136 struct sd *sd = (struct sd *) gspca_dev; in ov7660_init_sensor()
1138 i2c_w1(gspca_dev, 0x12, 0x80); /* sensor reset */ in ov7660_init_sensor()
1140 i2c_w1_buf(gspca_dev, ov7660_init, ARRAY_SIZE(ov7660_init)); in ov7660_init_sensor()
1141 if (gspca_dev->usb_err < 0) in ov7660_init_sensor()
1147 static void ov7670_init_sensor(struct gspca_dev *gspca_dev) in ov7670_init_sensor() argument
1149 struct sd *sd = (struct sd *) gspca_dev; in ov7670_init_sensor()
1151 i2c_w1(gspca_dev, 0x12, 0x80); /* sensor reset */ in ov7670_init_sensor()
1153 i2c_w1_buf(gspca_dev, ov7670_init, ARRAY_SIZE(ov7670_init)); in ov7670_init_sensor()
1154 if (gspca_dev->usb_err < 0) in ov7670_init_sensor()
1161 static void mt9v_init_sensor(struct gspca_dev *gspca_dev) in mt9v_init_sensor() argument
1163 struct sd *sd = (struct sd *) gspca_dev; in mt9v_init_sensor()
1167 i2c_r2(gspca_dev, 0xff, &value); in mt9v_init_sensor()
1168 if (gspca_dev->usb_err >= 0 in mt9v_init_sensor()
1170 i2c_w2_buf(gspca_dev, mt9v011_init, ARRAY_SIZE(mt9v011_init)); in mt9v_init_sensor()
1171 if (gspca_dev->usb_err < 0) { in mt9v_init_sensor()
1182 gspca_dev->usb_err = 0; in mt9v_init_sensor()
1184 i2c_w2(gspca_dev, 0x01, 0x0004); in mt9v_init_sensor()
1185 i2c_r2(gspca_dev, 0xff, &value); in mt9v_init_sensor()
1186 if (gspca_dev->usb_err >= 0 in mt9v_init_sensor()
1188 i2c_w2_buf(gspca_dev, mt9v111_init, ARRAY_SIZE(mt9v111_init)); in mt9v_init_sensor()
1189 if (gspca_dev->usb_err < 0) { in mt9v_init_sensor()
1200 gspca_dev->usb_err = 0; in mt9v_init_sensor()
1202 i2c_w2(gspca_dev, 0xf0, 0x0000); in mt9v_init_sensor()
1203 if (gspca_dev->usb_err < 0) { in mt9v_init_sensor()
1204 gspca_dev->usb_err = 0; in mt9v_init_sensor()
1206 i2c_w2(gspca_dev, 0xf0, 0x0000); in mt9v_init_sensor()
1208 i2c_r2(gspca_dev, 0x00, &value); in mt9v_init_sensor()
1209 if (gspca_dev->usb_err >= 0 in mt9v_init_sensor()
1211 i2c_w2_buf(gspca_dev, mt9v112_init, ARRAY_SIZE(mt9v112_init)); in mt9v_init_sensor()
1212 if (gspca_dev->usb_err < 0) { in mt9v_init_sensor()
1223 gspca_dev->usb_err = -ENODEV; in mt9v_init_sensor()
1226 static void mt9m112_init_sensor(struct gspca_dev *gspca_dev) in mt9m112_init_sensor() argument
1228 struct sd *sd = (struct sd *) gspca_dev; in mt9m112_init_sensor()
1230 i2c_w2_buf(gspca_dev, mt9m112_init, ARRAY_SIZE(mt9m112_init)); in mt9m112_init_sensor()
1231 if (gspca_dev->usb_err < 0) in mt9m112_init_sensor()
1238 static void mt9m111_init_sensor(struct gspca_dev *gspca_dev) in mt9m111_init_sensor() argument
1240 struct sd *sd = (struct sd *) gspca_dev; in mt9m111_init_sensor()
1242 i2c_w2_buf(gspca_dev, mt9m111_init, ARRAY_SIZE(mt9m111_init)); in mt9m111_init_sensor()
1243 if (gspca_dev->usb_err < 0) in mt9m111_init_sensor()
1250 static void mt9m001_init_sensor(struct gspca_dev *gspca_dev) in mt9m001_init_sensor() argument
1252 struct sd *sd = (struct sd *) gspca_dev; in mt9m001_init_sensor()
1255 i2c_r2(gspca_dev, 0x00, &id); in mt9m001_init_sensor()
1256 if (gspca_dev->usb_err < 0) in mt9m001_init_sensor()
1270 gspca_dev->usb_err = -ENODEV; in mt9m001_init_sensor()
1274 i2c_w2_buf(gspca_dev, mt9m001_init, ARRAY_SIZE(mt9m001_init)); in mt9m001_init_sensor()
1275 if (gspca_dev->usb_err < 0) in mt9m001_init_sensor()
1282 static void hv7131r_init_sensor(struct gspca_dev *gspca_dev) in hv7131r_init_sensor() argument
1284 struct sd *sd = (struct sd *) gspca_dev; in hv7131r_init_sensor()
1286 i2c_w1_buf(gspca_dev, hv7131r_init, ARRAY_SIZE(hv7131r_init)); in hv7131r_init_sensor()
1287 if (gspca_dev->usb_err < 0) in hv7131r_init_sensor()
1294 static void set_cmatrix(struct gspca_dev *gspca_dev, in set_cmatrix() argument
1330 reg_w(gspca_dev, 0x10e1, cmatrix, 21); in set_cmatrix()
1333 static void set_gamma(struct gspca_dev *gspca_dev, s32 val) in set_gamma() argument
1356 reg_w(gspca_dev, 0x1190, gamma, 17); in set_gamma()
1359 static void set_redblue(struct gspca_dev *gspca_dev, s32 blue, s32 red) in set_redblue() argument
1361 reg_w1(gspca_dev, 0x118c, red); in set_redblue()
1362 reg_w1(gspca_dev, 0x118f, blue); in set_redblue()
1365 static void set_hvflip(struct gspca_dev *gspca_dev, s32 hflip, s32 vflip) in set_hvflip() argument
1369 struct sd *sd = (struct sd *) gspca_dev; in set_hvflip()
1387 reg_w1(gspca_dev, 0x1182, sd->vstart); in set_hvflip()
1388 i2c_w1(gspca_dev, 0x1e, value); in set_hvflip()
1391 i2c_r1(gspca_dev, 0x1e, &value); in set_hvflip()
1400 i2c_w1(gspca_dev, 0x1e, value); in set_hvflip()
1401 i2c_w1(gspca_dev, 0x3a, tslb); in set_hvflip()
1405 i2c_r2(gspca_dev, 0x20, &value2); in set_hvflip()
1411 i2c_w2(gspca_dev, 0x20, value2); in set_hvflip()
1416 i2c_r2(gspca_dev, 0x20, &value2); in set_hvflip()
1422 i2c_w2(gspca_dev, 0x20, value2); in set_hvflip()
1425 i2c_r1(gspca_dev, 0x01, &value); in set_hvflip()
1431 i2c_w1(gspca_dev, 0x01, value); in set_hvflip()
1436 static void set_exposure(struct gspca_dev *gspca_dev, s32 expo) in set_exposure() argument
1438 struct sd *sd = (struct sd *) gspca_dev; in set_exposure()
1443 if (gspca_dev->streaming) in set_exposure()
1459 i2c_w(gspca_dev, exp); in set_exposure()
1463 i2c_w(gspca_dev, exp); in set_exposure()
1489 i2c_w(gspca_dev, exp); in set_exposure()
1492 static void set_gain(struct gspca_dev *gspca_dev, s32 g) in set_gain() argument
1494 struct sd *sd = (struct sd *) gspca_dev; in set_gain()
1498 if (gspca_dev->streaming) in set_gain()
1536 i2c_w(gspca_dev, gain); in set_gain()
1539 static void set_quality(struct gspca_dev *gspca_dev, s32 val) in set_quality() argument
1541 struct sd *sd = (struct sd *) gspca_dev; in set_quality()
1544 reg_w1(gspca_dev, 0x1061, 0x01); /* stop transfer */ in set_quality()
1545 reg_w1(gspca_dev, 0x10e0, sd->fmt | 0x20); /* write QTAB */ in set_quality()
1546 reg_w(gspca_dev, 0x1100, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); in set_quality()
1547 reg_w(gspca_dev, 0x1140, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); in set_quality()
1548 reg_w1(gspca_dev, 0x1061, 0x03); /* restart transfer */ in set_quality()
1549 reg_w1(gspca_dev, 0x10e0, sd->fmt); in set_quality()
1551 reg_w1(gspca_dev, 0x10e0, sd->fmt); in set_quality()
1555 static int sd_dbg_g_register(struct gspca_dev *gspca_dev, in sd_dbg_g_register() argument
1558 struct sd *sd = (struct sd *) gspca_dev; in sd_dbg_g_register()
1565 reg_r(gspca_dev, reg->reg, 1); in sd_dbg_g_register()
1566 reg->val = gspca_dev->usb_buf[0]; in sd_dbg_g_register()
1567 return gspca_dev->usb_err; in sd_dbg_g_register()
1571 i2c_r2(gspca_dev, reg->reg, (u16 *) ®->val); in sd_dbg_g_register()
1574 i2c_r1(gspca_dev, reg->reg, (u8 *) ®->val); in sd_dbg_g_register()
1576 return gspca_dev->usb_err; in sd_dbg_g_register()
1581 static int sd_dbg_s_register(struct gspca_dev *gspca_dev, in sd_dbg_s_register() argument
1584 struct sd *sd = (struct sd *) gspca_dev; in sd_dbg_s_register()
1590 reg_w1(gspca_dev, reg->reg, reg->val); in sd_dbg_s_register()
1591 return gspca_dev->usb_err; in sd_dbg_s_register()
1595 i2c_w2(gspca_dev, reg->reg, reg->val); in sd_dbg_s_register()
1597 i2c_w1(gspca_dev, reg->reg, reg->val); in sd_dbg_s_register()
1599 return gspca_dev->usb_err; in sd_dbg_s_register()
1604 static int sd_chip_info(struct gspca_dev *gspca_dev, in sd_chip_info() argument
1615 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
1618 struct sd *sd = (struct sd *) gspca_dev; in sd_config()
1621 cam = &gspca_dev->cam; in sd_config()
1661 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
1662 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
1663 struct sd *sd = (struct sd *)gspca_dev; in sd_s_ctrl()
1665 gspca_dev->usb_err = 0; in sd_s_ctrl()
1667 if (!gspca_dev->streaming) in sd_s_ctrl()
1673 set_cmatrix(gspca_dev, sd->brightness->val, in sd_s_ctrl()
1677 set_gamma(gspca_dev, ctrl->val); in sd_s_ctrl()
1681 set_redblue(gspca_dev, sd->blue->val, sd->red->val); in sd_s_ctrl()
1685 set_hvflip(gspca_dev, sd->hflip->val, sd->vflip->val); in sd_s_ctrl()
1689 set_exposure(gspca_dev, ctrl->val); in sd_s_ctrl()
1693 set_gain(gspca_dev, ctrl->val); in sd_s_ctrl()
1698 set_gain(gspca_dev, sd->gain->val); in sd_s_ctrl()
1700 set_exposure(gspca_dev, sd->exposure->val); in sd_s_ctrl()
1703 set_quality(gspca_dev, ctrl->val); in sd_s_ctrl()
1706 return gspca_dev->usb_err; in sd_s_ctrl()
1713 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
1715 struct sd *sd = (struct sd *) gspca_dev; in sd_init_controls()
1716 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
1718 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
1785 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
1787 struct sd *sd = (struct sd *) gspca_dev; in sd_init()
1796 reg_w(gspca_dev, bridge_init[i][0], &value, 1); in sd_init()
1797 if (gspca_dev->usb_err < 0) { in sd_init()
1799 return gspca_dev->usb_err; in sd_init()
1804 reg_w1(gspca_dev, 0x1006, 0x00); in sd_init()
1806 reg_w1(gspca_dev, 0x1006, 0x20); in sd_init()
1808 reg_w(gspca_dev, 0x10c0, i2c_init, 9); in sd_init()
1809 if (gspca_dev->usb_err < 0) { in sd_init()
1811 return gspca_dev->usb_err; in sd_init()
1816 ov9650_init_sensor(gspca_dev); in sd_init()
1817 if (gspca_dev->usb_err < 0) in sd_init()
1822 ov9655_init_sensor(gspca_dev); in sd_init()
1823 if (gspca_dev->usb_err < 0) in sd_init()
1828 soi968_init_sensor(gspca_dev); in sd_init()
1829 if (gspca_dev->usb_err < 0) in sd_init()
1834 ov7660_init_sensor(gspca_dev); in sd_init()
1835 if (gspca_dev->usb_err < 0) in sd_init()
1840 ov7670_init_sensor(gspca_dev); in sd_init()
1841 if (gspca_dev->usb_err < 0) in sd_init()
1846 mt9v_init_sensor(gspca_dev); in sd_init()
1847 if (gspca_dev->usb_err < 0) in sd_init()
1852 mt9m111_init_sensor(gspca_dev); in sd_init()
1853 if (gspca_dev->usb_err < 0) in sd_init()
1858 mt9m112_init_sensor(gspca_dev); in sd_init()
1859 if (gspca_dev->usb_err < 0) in sd_init()
1864 mt9m001_init_sensor(gspca_dev); in sd_init()
1865 if (gspca_dev->usb_err < 0) in sd_init()
1869 hv7131r_init_sensor(gspca_dev); in sd_init()
1870 if (gspca_dev->usb_err < 0) in sd_init()
1876 gspca_dev->usb_err = -ENODEV; in sd_init()
1878 return gspca_dev->usb_err; in sd_init()
1881 static void configure_sensor_output(struct gspca_dev *gspca_dev, int mode) in configure_sensor_output() argument
1883 struct sd *sd = (struct sd *) gspca_dev; in configure_sensor_output()
1889 i2c_w1(gspca_dev, 0x17, 0x1d); in configure_sensor_output()
1890 i2c_w1(gspca_dev, 0x18, 0xbd); in configure_sensor_output()
1891 i2c_w1(gspca_dev, 0x19, 0x01); in configure_sensor_output()
1892 i2c_w1(gspca_dev, 0x1a, 0x81); in configure_sensor_output()
1893 i2c_w1(gspca_dev, 0x12, 0x00); in configure_sensor_output()
1897 i2c_w1(gspca_dev, 0x17, 0x13); in configure_sensor_output()
1898 i2c_w1(gspca_dev, 0x18, 0x63); in configure_sensor_output()
1899 i2c_w1(gspca_dev, 0x19, 0x01); in configure_sensor_output()
1900 i2c_w1(gspca_dev, 0x1a, 0x79); in configure_sensor_output()
1901 i2c_w1(gspca_dev, 0x12, 0x40); in configure_sensor_output()
1908 i2c_w1(gspca_dev, 0x17, 0x1b); in configure_sensor_output()
1909 i2c_w1(gspca_dev, 0x18, 0xbc); in configure_sensor_output()
1910 i2c_w1(gspca_dev, 0x19, 0x01); in configure_sensor_output()
1911 i2c_w1(gspca_dev, 0x1a, 0x82); in configure_sensor_output()
1912 i2c_r1(gspca_dev, 0x12, &value); in configure_sensor_output()
1913 i2c_w1(gspca_dev, 0x12, value & 0x07); in configure_sensor_output()
1915 i2c_w1(gspca_dev, 0x17, 0x24); in configure_sensor_output()
1916 i2c_w1(gspca_dev, 0x18, 0xc5); in configure_sensor_output()
1917 i2c_w1(gspca_dev, 0x19, 0x00); in configure_sensor_output()
1918 i2c_w1(gspca_dev, 0x1a, 0x3c); in configure_sensor_output()
1919 i2c_r1(gspca_dev, 0x12, &value); in configure_sensor_output()
1920 i2c_w1(gspca_dev, 0x12, (value & 0x7) | 0x40); in configure_sensor_output()
1926 i2c_w2(gspca_dev, 0xf0, 0x0002); in configure_sensor_output()
1927 i2c_w2(gspca_dev, 0xc8, 0x970b); in configure_sensor_output()
1928 i2c_w2(gspca_dev, 0xf0, 0x0000); in configure_sensor_output()
1930 i2c_w2(gspca_dev, 0xf0, 0x0002); in configure_sensor_output()
1931 i2c_w2(gspca_dev, 0xc8, 0x8000); in configure_sensor_output()
1932 i2c_w2(gspca_dev, 0xf0, 0x0000); in configure_sensor_output()
1938 static int sd_isoc_init(struct gspca_dev *gspca_dev) in sd_isoc_init() argument
1941 u32 flags = gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv; in sd_isoc_init()
1949 intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); in sd_isoc_init()
1955 gspca_dev->alt = intf->num_altsetting; in sd_isoc_init()
1959 switch (gspca_dev->pixfmt.width) { in sd_isoc_init()
1961 gspca_dev->alt = 2; in sd_isoc_init()
1964 gspca_dev->alt = 6; in sd_isoc_init()
1967 gspca_dev->alt = 9; in sd_isoc_init()
1985 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
1987 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
1988 int mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; in sd_start()
1989 int width = gspca_dev->pixfmt.width; in sd_start()
1990 int height = gspca_dev->pixfmt.height; in sd_start()
2024 configure_sensor_output(gspca_dev, mode); in sd_start()
2025 reg_w(gspca_dev, 0x1100, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); in sd_start()
2026 reg_w(gspca_dev, 0x1140, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); in sd_start()
2027 reg_w(gspca_dev, 0x10fb, CLR_WIN(width, height), 5); in sd_start()
2028 reg_w(gspca_dev, 0x1180, HW_WIN(mode, sd->hstart, sd->vstart), 6); in sd_start()
2029 reg_w1(gspca_dev, 0x1189, scale); in sd_start()
2030 reg_w1(gspca_dev, 0x10e0, fmt); in sd_start()
2032 set_cmatrix(gspca_dev, v4l2_ctrl_g_ctrl(sd->brightness), in sd_start()
2036 set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); in sd_start()
2037 set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), in sd_start()
2040 set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); in sd_start()
2042 set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); in sd_start()
2044 set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), in sd_start()
2047 reg_w1(gspca_dev, 0x1007, 0x20); in sd_start()
2048 reg_w1(gspca_dev, 0x1061, 0x03); in sd_start()
2058 return gspca_dev->usb_err; in sd_start()
2061 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
2063 reg_w1(gspca_dev, 0x1007, 0x00); in sd_stopN()
2064 reg_w1(gspca_dev, 0x1061, 0x01); in sd_stopN()
2069 static void sd_stop0(struct gspca_dev *gspca_dev) in sd_stop0() argument
2071 struct sd *sd = (struct sd *) gspca_dev; in sd_stop0()
2074 mutex_unlock(&gspca_dev->usb_lock); in sd_stop0()
2076 mutex_lock(&gspca_dev->usb_lock); in sd_stop0()
2081 static void do_autoexposure(struct gspca_dev *gspca_dev, u16 avg_lum) in do_autoexposure() argument
2083 struct sd *sd = (struct sd *) gspca_dev; in do_autoexposure()
2132 static void do_autogain(struct gspca_dev *gspca_dev, u16 avg_lum) in do_autogain() argument
2134 struct sd *sd = (struct sd *) gspca_dev; in do_autogain()
2143 static void sd_dqcallback(struct gspca_dev *gspca_dev) in sd_dqcallback() argument
2145 struct sd *sd = (struct sd *) gspca_dev; in sd_dqcallback()
2153 do_autogain(gspca_dev, avg_lum); in sd_dqcallback()
2155 do_autoexposure(gspca_dev, avg_lum); in sd_dqcallback()
2163 struct gspca_dev *gspca_dev = &sd->gspca_dev; in qual_upd() local
2167 mutex_lock(&gspca_dev->usb_lock); in qual_upd()
2169 gspca_dev->usb_err = 0; in qual_upd()
2170 set_quality(gspca_dev, qual); in qual_upd()
2171 mutex_unlock(&gspca_dev->usb_lock); in qual_upd()
2175 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, in sd_int_pkt_scan() argument
2179 struct sd *sd = (struct sd *) gspca_dev; in sd_int_pkt_scan()
2182 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); in sd_int_pkt_scan()
2183 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
2184 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); in sd_int_pkt_scan()
2185 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
2193 static void transfer_check(struct gspca_dev *gspca_dev, in transfer_check() argument
2196 struct sd *sd = (struct sd *) gspca_dev; in transfer_check()
2203 gspca_dev->last_packet_type = DISCARD_PACKET; in transfer_check()
2210 gspca_dev->urb[0]->iso_frame_desc[0].length); in transfer_check()
2240 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
2244 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
2280 transfer_check(gspca_dev, data); in sd_pkt_scan()
2282 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); in sd_pkt_scan()
2288 if (gspca_dev->last_packet_type == LAST_PACKET) { in sd_pkt_scan()
2290 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
2292 gspca_frame_add(gspca_dev, INTER_PACKET, in sd_pkt_scan()
2295 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
2304 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()