Lines Matching +full:1 +full:- +full:sd

1 // SPDX-License-Identifier: GPL-2.0-only
20 static void ov7660_dump_registers(struct sd *sd);
193 int ov7660_probe(struct sd *sd) in ov7660_probe() argument
205 return -ENODEV; in ov7660_probe()
213 err = m5602_write_bridge(sd, in ov7660_probe()
214 preinit_ov7660[i][1], in ov7660_probe()
218 err = m5602_write_sensor(sd, in ov7660_probe()
219 preinit_ov7660[i][1], data, 1); in ov7660_probe()
225 if (m5602_read_sensor(sd, OV7660_PID, &prod_id, 1)) in ov7660_probe()
226 return -ENODEV; in ov7660_probe()
228 if (m5602_read_sensor(sd, OV7660_VER, &ver_id, 1)) in ov7660_probe()
229 return -ENODEV; in ov7660_probe()
237 return -ENODEV; in ov7660_probe()
240 sd->gspca_dev.cam.cam_mode = ov7660_modes; in ov7660_probe()
241 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov7660_modes); in ov7660_probe()
246 int ov7660_init(struct sd *sd) in ov7660_init() argument
255 err = m5602_write_bridge(sd, in ov7660_init()
256 init_ov7660[i][1], in ov7660_init()
260 err = m5602_write_sensor(sd, in ov7660_init()
261 init_ov7660[i][1], data, 1); in ov7660_init()
268 ov7660_dump_registers(sd); in ov7660_init()
273 int ov7660_init_controls(struct sd *sd) in ov7660_init_controls() argument
275 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; in ov7660_init_controls()
277 sd->gspca_dev.vdev.ctrl_handler = hdl; in ov7660_init_controls()
281 0, 1, 1, 1); in ov7660_init_controls()
283 V4L2_CID_EXPOSURE_AUTO, 1, 0, V4L2_EXPOSURE_AUTO); in ov7660_init_controls()
285 sd->autogain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, in ov7660_init_controls()
286 V4L2_CID_AUTOGAIN, 0, 1, 1, 1); in ov7660_init_controls()
287 sd->gain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_GAIN, 0, in ov7660_init_controls()
288 255, 1, OV7660_DEFAULT_GAIN); in ov7660_init_controls()
290 sd->hflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_HFLIP, in ov7660_init_controls()
291 0, 1, 1, 0); in ov7660_init_controls()
292 sd->vflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_VFLIP, in ov7660_init_controls()
293 0, 1, 1, 0); in ov7660_init_controls()
295 if (hdl->error) { in ov7660_init_controls()
297 return hdl->error; in ov7660_init_controls()
300 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); in ov7660_init_controls()
301 v4l2_ctrl_cluster(2, &sd->hflip); in ov7660_init_controls()
306 int ov7660_start(struct sd *sd) in ov7660_start() argument
311 int ov7660_stop(struct sd *sd) in ov7660_stop() argument
316 void ov7660_disconnect(struct sd *sd) in ov7660_disconnect() argument
318 ov7660_stop(sd); in ov7660_disconnect()
320 sd->sensor = NULL; in ov7660_disconnect()
327 struct sd *sd = (struct sd *) gspca_dev; in ov7660_set_gain() local
331 err = m5602_write_sensor(sd, OV7660_GAIN, &i2c_data, 1); in ov7660_set_gain()
340 struct sd *sd = (struct sd *) gspca_dev; in ov7660_set_auto_white_balance() local
344 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_white_balance()
348 i2c_data = ((i2c_data & 0xfd) | ((val & 0x01) << 1)); in ov7660_set_auto_white_balance()
349 err = m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_white_balance()
358 struct sd *sd = (struct sd *) gspca_dev; in ov7660_set_auto_gain() local
362 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_gain()
368 return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_gain()
376 struct sd *sd = (struct sd *) gspca_dev; in ov7660_set_auto_exposure() local
380 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_exposure()
387 return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); in ov7660_set_auto_exposure()
394 struct sd *sd = (struct sd *) gspca_dev; in ov7660_set_hvflip() local
397 sd->hflip->val, sd->vflip->val); in ov7660_set_hvflip()
399 i2c_data = (sd->hflip->val << 5) | (sd->vflip->val << 4); in ov7660_set_hvflip()
401 err = m5602_write_sensor(sd, OV7660_MVFP, &i2c_data, 1); in ov7660_set_hvflip()
409 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in ov7660_s_ctrl()
410 struct sd *sd = (struct sd *) gspca_dev; in ov7660_s_ctrl() local
413 if (!gspca_dev->streaming) in ov7660_s_ctrl()
416 switch (ctrl->id) { in ov7660_s_ctrl()
418 err = ov7660_set_auto_white_balance(gspca_dev, ctrl->val); in ov7660_s_ctrl()
421 err = ov7660_set_auto_exposure(gspca_dev, ctrl->val); in ov7660_s_ctrl()
424 err = ov7660_set_auto_gain(gspca_dev, ctrl->val); in ov7660_s_ctrl()
425 if (err || ctrl->val) in ov7660_s_ctrl()
427 err = ov7660_set_gain(gspca_dev, sd->gain->val); in ov7660_s_ctrl()
433 return -EINVAL; in ov7660_s_ctrl()
439 static void ov7660_dump_registers(struct sd *sd) in ov7660_dump_registers() argument
445 m5602_read_sensor(sd, address, &value, 1); in ov7660_dump_registers()
456 m5602_read_sensor(sd, address, &old_value, 1); in ov7660_dump_registers()
457 m5602_write_sensor(sd, address, test_value, 1); in ov7660_dump_registers()
458 m5602_read_sensor(sd, address, &ctrl_value, 1); in ov7660_dump_registers()
466 m5602_write_sensor(sd, address, &old_value, 1); in ov7660_dump_registers()