Lines Matching +full:cam +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0-or-later
56 #if 0 /* This mode has extremely non square pixels, testing use only */
73 ret = usb_control_msg(gspca_dev->dev, in vicam_control_msg()
74 usb_sndctrlpipe(gspca_dev->dev, 0), in vicam_control_msg()
78 if (ret < 0) in vicam_control_msg()
89 if (ret < 0) in vicam_set_camera_power()
92 if (state) in vicam_set_camera_power()
104 u8 *req_data = gspca_dev->usb_buf; in vicam_read_frame()
105 s32 expo = v4l2_ctrl_g_ctrl(gspca_dev->exposure); in vicam_read_frame()
106 s32 gain = v4l2_ctrl_g_ctrl(gspca_dev->gain); in vicam_read_frame()
110 if (gspca_dev->pixfmt.width == 256) in vicam_read_frame()
111 req_data[1] |= 0x01; /* low nibble x-scale */ in vicam_read_frame()
112 if (gspca_dev->pixfmt.height <= 122) { in vicam_read_frame()
113 req_data[1] |= 0x10; /* high nibble y-scale */ in vicam_read_frame()
114 unscaled_height = gspca_dev->pixfmt.height * 2; in vicam_read_frame()
116 unscaled_height = gspca_dev->pixfmt.height; in vicam_read_frame()
118 if (unscaled_height <= 200) in vicam_read_frame()
120 else if (unscaled_height <= 242) /* Yes 242 not 240 */ in vicam_read_frame()
125 if (expo < 256) { in vicam_read_frame()
127 req_data[4] = 255 - expo; in vicam_read_frame()
138 req_data[8] = ((244 - unscaled_height) / 2) & ~0x01; /* vstart */ in vicam_read_frame()
139 /* bytes 9-15 do not seem to affect exposure or image quality */ in vicam_read_frame()
141 mutex_lock(&gspca_dev->usb_lock); in vicam_read_frame()
143 mutex_unlock(&gspca_dev->usb_lock); in vicam_read_frame()
144 if (ret < 0) in vicam_read_frame()
147 ret = usb_bulk_msg(gspca_dev->dev, in vicam_read_frame()
148 usb_rcvbulkpipe(gspca_dev->dev, 0x81), in vicam_read_frame()
151 if (ret < 0 || act_len != size) { in vicam_read_frame()
154 return -EIO; in vicam_read_frame()
163 * threads attempting to use gspca_dev->usb_buf we take the usb_lock when
170 struct gspca_dev *gspca_dev = &sd->gspca_dev; in vicam_dostream()
174 frame_sz = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].sizeimage + in vicam_dostream()
177 if (!buffer) { in vicam_dostream()
182 while (gspca_dev->present && gspca_dev->streaming) { in vicam_dostream()
184 if (gspca_dev->frozen) in vicam_dostream()
188 if (ret < 0) in vicam_dostream()
195 bother reading from the cam */ in vicam_dostream()
198 frame_sz - HEADER_SIZE); in vicam_dostream()
209 struct cam *cam = &gspca_dev->cam; in sd_config() local
213 cam->bulk = 1; in sd_config()
214 cam->bulk_size = 64; in sd_config()
215 cam->cam_mode = vicam_mode; in sd_config()
216 cam->nmodes = ARRAY_SIZE(vicam_mode); in sd_config()
218 INIT_WORK(&sd->work_struct, vicam_dostream); in sd_config()
232 &gspca_dev->dev->dev); in sd_init()
233 if (ret) { in sd_init()
239 if (!firmware_buf) { in sd_init()
240 ret = -ENOMEM; in sd_init()
243 for (rec = (void *)fw->data; rec; rec = ihex_next_binrec(rec)) { in sd_init()
244 memcpy(firmware_buf, rec->data, be16_to_cpu(rec->len)); in sd_init()
246 be16_to_cpu(rec->len)); in sd_init()
247 if (ret < 0) in sd_init()
264 if (ret < 0) in sd_start()
267 schedule_work(&sd->work_struct); in sd_start()
273 /* the usb_lock is held at entry - restore on exit */
279 mutex_unlock(&gspca_dev->usb_lock); in sd_stop0()
281 flush_work(&dev->work_struct); in sd_stop0()
282 mutex_lock(&gspca_dev->usb_lock); in sd_stop0()
284 if (gspca_dev->present) in sd_stop0()
290 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
292 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
294 gspca_dev->exposure = v4l2_ctrl_new_std(hdl, NULL, in sd_init_controls()
296 gspca_dev->gain = v4l2_ctrl_new_std(hdl, NULL, in sd_init_controls()
299 if (hdl->error) { in sd_init_controls()
301 return hdl->error; in sd_init_controls()
315 /* sub-driver description */
325 /* -- device connect -- */