• Home
  • Raw
  • Download

Lines Matching refs:gspca_dev

22 	struct gspca_dev gspca_dev;	/* !! must be the first item */  member
2890 static void reg_r_i(struct gspca_dev *gspca_dev, in reg_r_i() argument
2897 if (gspca_dev->usb_err < 0) in reg_r_i()
2899 ret = usb_control_msg(gspca_dev->dev, in reg_r_i()
2900 usb_rcvctrlpipe(gspca_dev->dev, 0), in reg_r_i()
2904 index, gspca_dev->usb_buf, len, in reg_r_i()
2908 gspca_dev->usb_err = ret; in reg_r_i()
2913 memset(gspca_dev->usb_buf, 0, USB_BUF_SZ); in reg_r_i()
2916 static void reg_r(struct gspca_dev *gspca_dev, in reg_r() argument
2921 reg_r_i(gspca_dev, req, index, len); in reg_r()
2922 if (gspca_dev->usb_err < 0) in reg_r()
2925 gspca_dbg(gspca_dev, D_USBI, "GET %02x 0001 %04x %02x\n", in reg_r()
2927 gspca_dev->usb_buf[0]); in reg_r()
2929 gspca_dbg(gspca_dev, D_USBI, "GET %02x 0001 %04x %*ph\n", in reg_r()
2930 req, index, 3, gspca_dev->usb_buf); in reg_r()
2933 static void reg_w_i(struct gspca_dev *gspca_dev, in reg_w_i() argument
2940 if (gspca_dev->usb_err < 0) in reg_w_i()
2942 ret = usb_control_msg(gspca_dev->dev, in reg_w_i()
2943 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w_i()
2950 gspca_dev->usb_err = ret; in reg_w_i()
2953 static void reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
2958 if (gspca_dev->usb_err < 0) in reg_w()
2960 gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", req, value, index); in reg_w()
2961 reg_w_i(gspca_dev, req, value, index); in reg_w()
2964 static u16 read_sensor_register(struct gspca_dev *gspca_dev, in read_sensor_register() argument
2970 reg_r(gspca_dev, 0xa1, 0xb33f, 1); in read_sensor_register()
2971 if (!(gspca_dev->usb_buf[0] & 0x02)) { in read_sensor_register()
2972 pr_err("I2c Bus Busy Wait %02x\n", gspca_dev->usb_buf[0]); in read_sensor_register()
2975 reg_w(gspca_dev, 0xa0, address, 0xb33a); in read_sensor_register()
2976 reg_w(gspca_dev, 0xa0, 0x02, 0xb339); in read_sensor_register()
2979 reg_r(gspca_dev, 0xa1, 0xb33b, 1); in read_sensor_register()
2980 if (gspca_dev->usb_buf[0] == 0x00) in read_sensor_register()
2985 reg_r(gspca_dev, 0xa1, 0xb33e, 1); in read_sensor_register()
2986 ldata = gspca_dev->usb_buf[0]; in read_sensor_register()
2987 reg_r(gspca_dev, 0xa1, 0xb33d, 1); in read_sensor_register()
2988 mdata = gspca_dev->usb_buf[0]; in read_sensor_register()
2989 reg_r(gspca_dev, 0xa1, 0xb33c, 1); in read_sensor_register()
2990 hdata = gspca_dev->usb_buf[0]; in read_sensor_register()
2992 gspca_dbg(gspca_dev, D_PROBE, "Read Sensor %02x%02x %02x\n", in read_sensor_register()
2994 reg_r(gspca_dev, 0xa1, 0xb334, 1); in read_sensor_register()
2995 if (gspca_dev->usb_buf[0] == 0x02) in read_sensor_register()
3000 static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) in vc032x_probe_sensor() argument
3002 struct sd *sd = (struct sd *) gspca_dev; in vc032x_probe_sensor()
3009 reg_w(gspca_dev, 0xa0, 0x01, 0xb301); in vc032x_probe_sensor()
3010 reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff); in vc032x_probe_sensor()
3014 reg_r(gspca_dev, 0xa1, 0xbfcf, 1); in vc032x_probe_sensor()
3015 gspca_dbg(gspca_dev, D_PROBE, "vc032%d check sensor header %02x\n", in vc032x_probe_sensor()
3016 sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]); in vc032x_probe_sensor()
3025 reg_w(gspca_dev, 0xa0, 0x02, 0xb334); in vc032x_probe_sensor()
3026 reg_w(gspca_dev, 0xa0, ptsensor_info->m1, 0xb300); in vc032x_probe_sensor()
3027 reg_w(gspca_dev, 0xa0, ptsensor_info->m2, 0xb300); in vc032x_probe_sensor()
3028 reg_w(gspca_dev, 0xa0, 0x01, 0xb308); in vc032x_probe_sensor()
3029 reg_w(gspca_dev, 0xa0, 0x0c, 0xb309); in vc032x_probe_sensor()
3030 reg_w(gspca_dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); in vc032x_probe_sensor()
3031 reg_w(gspca_dev, 0xa0, ptsensor_info->op, 0xb301); in vc032x_probe_sensor()
3032 value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); in vc032x_probe_sensor()
3034 value = read_sensor_register(gspca_dev, 0x83); in vc032x_probe_sensor()
3036 gspca_dbg(gspca_dev, D_PROBE, "Sensor ID %04x (%d)\n", in vc032x_probe_sensor()
3055 static void i2c_write(struct gspca_dev *gspca_dev, in i2c_write() argument
3061 if (gspca_dev->usb_err < 0) in i2c_write()
3064 gspca_dbg(gspca_dev, D_USBO, "i2c_w %02x %02x\n", reg, *val); in i2c_write()
3066 gspca_dbg(gspca_dev, D_USBO, "i2c_w %02x %02x%02x\n", in i2c_write()
3068 reg_r_i(gspca_dev, 0xa1, 0xb33f, 1); in i2c_write()
3070 reg_w_i(gspca_dev, 0xa0, size, 0xb334); in i2c_write()
3071 reg_w_i(gspca_dev, 0xa0, reg, 0xb33a); in i2c_write()
3072 reg_w_i(gspca_dev, 0xa0, val[0], 0xb336); in i2c_write()
3074 reg_w_i(gspca_dev, 0xa0, val[1], 0xb337); in i2c_write()
3075 reg_w_i(gspca_dev, 0xa0, 0x01, 0xb339); in i2c_write()
3078 reg_r_i(gspca_dev, 0xa1, 0xb33b, 1); in i2c_write()
3079 if (gspca_dev->usb_buf[0] == 0) in i2c_write()
3087 static void put_tab_to_reg(struct gspca_dev *gspca_dev, in put_tab_to_reg() argument
3094 reg_w(gspca_dev, 0xa0, tab[j], ad++); in put_tab_to_reg()
3097 static void usb_exchange(struct gspca_dev *gspca_dev, in usb_exchange() argument
3107 reg_w(gspca_dev, 0xa0, data[i][2], in usb_exchange()
3111 i2c_write(gspca_dev, data[i][1], &data[i][2], 1); in usb_exchange()
3114 i2c_write(gspca_dev, data[i][0], &data[i][1], 2); in usb_exchange()
3127 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
3130 struct sd *sd = (struct sd *) gspca_dev; in sd_config()
3143 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
3145 struct sd *sd = (struct sd *) gspca_dev; in sd_init()
3163 sensor = vc032x_probe_sensor(gspca_dev); in sd_init()
3172 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n"); in sd_init()
3175 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI0360\n"); in sd_init()
3179 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1310_SOC\n"); in sd_init()
3182 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1320\n"); in sd_init()
3185 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1320_SOC\n"); in sd_init()
3188 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7660\n"); in sd_init()
3191 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7670\n"); in sd_init()
3194 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO1200\n"); in sd_init()
3197 gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO3130NC\n"); in sd_init()
3200 gspca_dbg(gspca_dev, D_PROBE, "Sensor POxxxx\n"); in sd_init()
3205 cam = &gspca_dev->cam; in sd_init()
3239 reg_r(gspca_dev, 0x8a, 0, 3); in sd_init()
3240 reg_w(gspca_dev, 0x87, 0x00, 0x0f0f); in sd_init()
3241 reg_r(gspca_dev, 0x8b, 0, 3); in sd_init()
3242 reg_w(gspca_dev, 0x88, 0x00, 0x0202); in sd_init()
3244 reg_r(gspca_dev, 0xa1, 0xb300, 1); in sd_init()
3245 if (gspca_dev->usb_buf[0] != 0) { in sd_init()
3246 reg_w(gspca_dev, 0xa0, 0x26, 0xb300); in sd_init()
3247 reg_w(gspca_dev, 0xa0, 0x04, 0xb300); in sd_init()
3249 reg_w(gspca_dev, 0xa0, 0x00, 0xb300); in sd_init()
3252 return gspca_dev->usb_err; in sd_init()
3255 static void setbrightness(struct gspca_dev *gspca_dev, s32 val) in setbrightness() argument
3264 i2c_write(gspca_dev, 0x98, &data, 1); in setbrightness()
3267 static void setcontrast(struct gspca_dev *gspca_dev, u8 val) in setcontrast() argument
3269 i2c_write(gspca_dev, 0x99, &val, 1); in setcontrast()
3272 static void setcolors(struct gspca_dev *gspca_dev, u8 val) in setcolors() argument
3277 i2c_write(gspca_dev, 0x94, &data, 1); in setcolors()
3278 i2c_write(gspca_dev, 0x95, &val, 1); in setcolors()
3281 static void sethvflip(struct gspca_dev *gspca_dev, bool hflip, bool vflip) in sethvflip() argument
3283 struct sd *sd = (struct sd *) gspca_dev; in sethvflip()
3295 i2c_write(gspca_dev, 0xf0, data, 2); in sethvflip()
3299 i2c_write(gspca_dev, 0x20, data, 2); in sethvflip()
3306 i2c_write(gspca_dev, OV7660_REG_MVFP, data, 1); in sethvflip()
3310 i2c_write(gspca_dev, 0x03, data, 1); in sethvflip()
3314 i2c_write(gspca_dev, 0x1e, data, 1); in sethvflip()
3319 static void setlightfreq(struct gspca_dev *gspca_dev, s32 val) in setlightfreq() argument
3321 struct sd *sd = (struct sd *) gspca_dev; in setlightfreq()
3327 usb_exchange(gspca_dev, ov7660_freq_tb[val]); in setlightfreq()
3330 static void setsharpness(struct gspca_dev *gspca_dev, s32 val) in setsharpness() argument
3332 struct sd *sd = (struct sd *) gspca_dev; in setsharpness()
3338 i2c_write(gspca_dev, 0x03, &data, 1); in setsharpness()
3343 i2c_write(gspca_dev, 0x61, &data, 1); in setsharpness()
3350 i2c_write(gspca_dev, 0x59, &data, 1); in setsharpness()
3354 static void setgain(struct gspca_dev *gspca_dev, u8 val) in setgain() argument
3356 i2c_write(gspca_dev, 0x15, &val, 1); in setgain()
3359 static void setexposure(struct gspca_dev *gspca_dev, s32 val) in setexposure() argument
3364 i2c_write(gspca_dev, 0x1a, &data, 1); in setexposure()
3366 i2c_write(gspca_dev, 0x1b, &data, 1); in setexposure()
3369 static void setautogain(struct gspca_dev *gspca_dev, s32 val) in setautogain() argument
3373 i2c_write(gspca_dev, 0xd1, &data[val], 1); in setautogain()
3376 static void setgamma(struct gspca_dev *gspca_dev) in setgamma() argument
3379 usb_exchange(gspca_dev, poxxxx_gamma); in setgamma()
3382 static void setbacklight(struct gspca_dev *gspca_dev, s32 val) in setbacklight() argument
3388 i2c_write(gspca_dev, 0xaa, &data, 1); in setbacklight()
3391 i2c_write(gspca_dev, 0xc4, &data, 1); in setbacklight()
3393 i2c_write(gspca_dev, 0xc5, &data, 1); in setbacklight()
3396 i2c_write(gspca_dev, 0xc6, &data, 1); in setbacklight()
3398 i2c_write(gspca_dev, 0xc7, &data, 1); in setbacklight()
3401 i2c_write(gspca_dev, 0xc8, &data, 1); in setbacklight()
3403 i2c_write(gspca_dev, 0xc9, &data, 1); in setbacklight()
3406 i2c_write(gspca_dev, 0xca, &data, 1); in setbacklight()
3408 i2c_write(gspca_dev, 0xcb, &data, 1); in setbacklight()
3411 static void setwb(struct gspca_dev *gspca_dev) in setwb() argument
3416 i2c_write(gspca_dev, 0x16, &data[0], 1); in setwb()
3417 i2c_write(gspca_dev, 0x18, &data[1], 1); in setwb()
3420 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
3422 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
3435 reg_w(gspca_dev, 0x89, 0xf0ff, 0xffff); in sd_start()
3436 reg_w(gspca_dev, 0xa9, 0x8348, 0x000e); in sd_start()
3437 reg_w(gspca_dev, 0xa9, 0x0000, 0x001a); in sd_start()
3442 reg_w(gspca_dev, 0xa0, 0xff, 0xbfec); in sd_start()
3443 reg_w(gspca_dev, 0xa0, 0xff, 0xbfed); in sd_start()
3444 reg_w(gspca_dev, 0xa0, 0xff, 0xbfee); in sd_start()
3445 reg_w(gspca_dev, 0xa0, 0xff, 0xbfef); in sd_start()
3448 if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat in sd_start()
3455 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; in sd_start()
3519 usb_exchange(gspca_dev, init); in sd_start()
3529 usb_exchange(gspca_dev, poxxxx_init_common); in sd_start()
3530 setgamma(gspca_dev); in sd_start()
3531 usb_exchange(gspca_dev, poxxxx_init_start_3); in sd_start()
3536 usb_exchange(gspca_dev, init); in sd_start()
3537 reg_r(gspca_dev, 0x8c, 0x0000, 3); in sd_start()
3538 reg_w(gspca_dev, 0xa0, in sd_start()
3539 gspca_dev->usb_buf[2] & 1 ? 0 : 1, in sd_start()
3546 usb_exchange(gspca_dev, init); in sd_start()
3548 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a); in sd_start()
3549 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b); in sd_start()
3550 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c); in sd_start()
3551 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c); in sd_start()
3556 reg_w(gspca_dev, 0x89, 0x0400, 0x1415); in sd_start()
3559 reg_w(gspca_dev, 0x89, 0x058c, 0x0000); in sd_start()
3566 reg_w(gspca_dev, 0x87, 0xffff, 0xffff); in sd_start()
3567 reg_w(gspca_dev, 0x88, 0xff00, 0xf0f1); in sd_start()
3568 reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff); in sd_start()
3571 usb_exchange(gspca_dev, poxxxx_init_end_2); in sd_start()
3572 setwb(gspca_dev); in sd_start()
3574 reg_w(gspca_dev, 0x89, 0xffff, 0xfdff); in sd_start()
3577 return gspca_dev->usb_err; in sd_start()
3580 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
3582 struct sd *sd = (struct sd *) gspca_dev; in sd_stopN()
3586 reg_w(gspca_dev, 0x89, 0x058c, 0x00ff); in sd_stopN()
3592 reg_w(gspca_dev, 0x89, 0xffff, 0xffff); in sd_stopN()
3595 reg_w(gspca_dev, 0xa0, 0x01, 0xb301); in sd_stopN()
3596 reg_w(gspca_dev, 0xa0, 0x09, 0xb003); in sd_stopN()
3600 static void sd_stop0(struct gspca_dev *gspca_dev) in sd_stop0() argument
3602 struct sd *sd = (struct sd *) gspca_dev; in sd_stop0()
3604 if (!gspca_dev->present) in sd_stop0()
3608 reg_w(gspca_dev, 0x89, 0x058c, 0x00ff); in sd_stop0()
3610 reg_w(gspca_dev, 0x89, 0xffff, 0xffff); in sd_stop0()
3613 reg_w(gspca_dev, 0xa0, 0x26, 0xb300); in sd_stop0()
3614 reg_w(gspca_dev, 0xa0, 0x04, 0xb300); in sd_stop0()
3615 reg_w(gspca_dev, 0xa0, 0x00, 0xb300); in sd_stop0()
3619 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
3623 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
3626 gspca_dbg(gspca_dev, D_PACK, in sd_pkt_scan()
3628 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); in sd_pkt_scan()
3631 gspca_frame_add(gspca_dev, FIRST_PACKET, data, len); in sd_pkt_scan()
3640 l = gspca_dev->image_len; in sd_pkt_scan()
3641 size = gspca_dev->pixfmt.sizeimage; in sd_pkt_scan()
3645 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()
3650 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
3651 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
3652 struct sd *sd = (struct sd *)gspca_dev; in sd_s_ctrl()
3654 gspca_dev->usb_err = 0; in sd_s_ctrl()
3656 if (!gspca_dev->streaming && ctrl->id != V4L2_CID_POWER_LINE_FREQUENCY) in sd_s_ctrl()
3661 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
3664 setcontrast(gspca_dev, ctrl->val); in sd_s_ctrl()
3667 setcolors(gspca_dev, ctrl->val); in sd_s_ctrl()
3670 sethvflip(gspca_dev, sd->hflip->val, sd->vflip->val); in sd_s_ctrl()
3673 setsharpness(gspca_dev, ctrl->val); in sd_s_ctrl()
3676 setautogain(gspca_dev, ctrl->val); in sd_s_ctrl()
3679 setgain(gspca_dev, ctrl->val); in sd_s_ctrl()
3682 setexposure(gspca_dev, ctrl->val); in sd_s_ctrl()
3685 setbacklight(gspca_dev, ctrl->val); in sd_s_ctrl()
3688 setlightfreq(gspca_dev, ctrl->val); in sd_s_ctrl()
3691 return gspca_dev->usb_err; in sd_s_ctrl()
3698 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
3700 struct sd *sd = (struct sd *)gspca_dev; in sd_init_controls()
3701 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
3737 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()