Lines Matching full:sd
164 static void s5k83a_dump_registers(struct sd *sd);
165 static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data);
166 static int s5k83a_set_led_indication(struct sd *sd, u8 val);
170 int s5k83a_probe(struct sd *sd) in s5k83a_probe() argument
174 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; in s5k83a_probe()
192 err = m5602_write_sensor(sd, preinit_s5k83a[i][1], in s5k83a_probe()
195 err = m5602_write_bridge(sd, preinit_s5k83a[i][1], in s5k83a_probe()
202 if (m5602_read_sensor(sd, 0x00, &prod_id, 1)) in s5k83a_probe()
205 if (m5602_read_sensor(sd, 0x01, &ver_id, 1)) in s5k83a_probe()
214 sd->gspca_dev.cam.cam_mode = s5k83a_modes; in s5k83a_probe()
215 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes); in s5k83a_probe()
218 sd->rotation_thread = NULL; in s5k83a_probe()
223 int s5k83a_init(struct sd *sd) in s5k83a_init() argument
232 err = m5602_write_bridge(sd, in s5k83a_init()
239 err = m5602_write_sensor(sd, in s5k83a_init()
246 err = m5602_write_sensor(sd, in s5k83a_init()
256 s5k83a_dump_registers(sd); in s5k83a_init()
261 int s5k83a_init_controls(struct sd *sd) in s5k83a_init_controls() argument
263 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; in s5k83a_init_controls()
265 sd->gspca_dev.vdev.ctrl_handler = hdl; in s5k83a_init_controls()
278 sd->hflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_HFLIP, in s5k83a_init_controls()
280 sd->vflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_VFLIP, in s5k83a_init_controls()
288 v4l2_ctrl_cluster(2, &sd->hflip); in s5k83a_init_controls()
295 struct sd *sd = (struct sd *) data; in rotation_thread_function() local
301 if (mutex_lock_interruptible(&sd->gspca_dev.usb_lock)) in rotation_thread_function()
304 s5k83a_get_rotation(sd, ®); in rotation_thread_function()
309 hflip = sd->hflip->val; in rotation_thread_function()
310 vflip = sd->vflip->val; in rotation_thread_function()
316 s5k83a_set_flip_real((struct gspca_dev *) sd, in rotation_thread_function()
320 mutex_unlock(&sd->gspca_dev.usb_lock); in rotation_thread_function()
326 hflip = sd->hflip->val; in rotation_thread_function()
327 vflip = sd->vflip->val; in rotation_thread_function()
328 s5k83a_set_flip_real((struct gspca_dev *) sd, vflip, hflip); in rotation_thread_function()
331 sd->rotation_thread = NULL; in rotation_thread_function()
335 int s5k83a_start(struct sd *sd) in s5k83a_start() argument
342 sd->rotation_thread = kthread_run(rotation_thread_function, in s5k83a_start()
343 sd, "rotation thread"); in s5k83a_start()
344 if (IS_ERR(sd->rotation_thread)) { in s5k83a_start()
345 err = PTR_ERR(sd->rotation_thread); in s5k83a_start()
346 sd->rotation_thread = NULL; in s5k83a_start()
354 err = m5602_write_sensor(sd, start_s5k83a[i][1], in s5k83a_start()
357 err = m5602_write_bridge(sd, start_s5k83a[i][1], in s5k83a_start()
363 return s5k83a_set_led_indication(sd, 1); in s5k83a_start()
366 int s5k83a_stop(struct sd *sd) in s5k83a_stop() argument
368 if (sd->rotation_thread) in s5k83a_stop()
369 kthread_stop(sd->rotation_thread); in s5k83a_stop()
371 return s5k83a_set_led_indication(sd, 0); in s5k83a_stop()
374 void s5k83a_disconnect(struct sd *sd) in s5k83a_disconnect() argument
376 s5k83a_stop(sd); in s5k83a_disconnect()
378 sd->sensor = NULL; in s5k83a_disconnect()
385 struct sd *sd = (struct sd *) gspca_dev; in s5k83a_set_gain() local
389 err = m5602_write_sensor(sd, 0x14, data, 2); in s5k83a_set_gain()
395 err = m5602_write_sensor(sd, 0x0d, data, 2); in s5k83a_set_gain()
403 err = m5602_write_sensor(sd, S5K83A_GAIN, data, 2); in s5k83a_set_gain()
411 struct sd *sd = (struct sd *) gspca_dev; in s5k83a_set_brightness() local
414 return m5602_write_sensor(sd, S5K83A_BRIGHTNESS, data, 1); in s5k83a_set_brightness()
420 struct sd *sd = (struct sd *) gspca_dev; in s5k83a_set_exposure() local
424 return m5602_write_sensor(sd, S5K83A_EXPOSURE, data, 2); in s5k83a_set_exposure()
432 struct sd *sd = (struct sd *) gspca_dev; in s5k83a_set_flip_real() local
435 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); in s5k83a_set_flip_real()
444 err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1); in s5k83a_set_flip_real()
449 err = m5602_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1); in s5k83a_set_flip_real()
454 err = m5602_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1); in s5k83a_set_flip_real()
462 struct sd *sd = (struct sd *) gspca_dev; in s5k83a_set_hvflip() local
463 int hflip = sd->hflip->val; in s5k83a_set_hvflip()
464 int vflip = sd->vflip->val; in s5k83a_set_hvflip()
466 err = s5k83a_get_rotation(sd, ®); in s5k83a_set_hvflip()
507 static int s5k83a_set_led_indication(struct sd *sd, u8 val) in s5k83a_set_led_indication() argument
512 err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, data); in s5k83a_set_led_indication()
521 err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); in s5k83a_set_led_indication()
527 static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data) in s5k83a_get_rotation() argument
529 int err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, reg_data); in s5k83a_get_rotation()
534 static void s5k83a_dump_registers(struct sd *sd) in s5k83a_dump_registers() argument
538 m5602_read_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); in s5k83a_dump_registers()
541 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); in s5k83a_dump_registers()
546 m5602_read_sensor(sd, address, &val, 1); in s5k83a_dump_registers()
553 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); in s5k83a_dump_registers()
559 m5602_read_sensor(sd, address, &old_val, 1); in s5k83a_dump_registers()
560 m5602_write_sensor(sd, address, &test_val, 1); in s5k83a_dump_registers()
561 m5602_read_sensor(sd, address, &ctrl_val, 1); in s5k83a_dump_registers()
571 m5602_write_sensor(sd, address, &old_val, 1); in s5k83a_dump_registers()
575 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); in s5k83a_dump_registers()