Lines Matching refs:v4l2_flash
20 #define has_flash_op(v4l2_flash, op) \ argument
21 (v4l2_flash && v4l2_flash->ops->op)
23 #define call_flash_op(v4l2_flash, op, arg) \ argument
24 (has_flash_op(v4l2_flash, op) ? \
25 v4l2_flash->ops->op(v4l2_flash, arg) : \
82 static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash, in v4l2_flash_set_led_brightness() argument
85 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_set_led_brightness()
88 if (has_flash_op(v4l2_flash, intensity_to_led_brightness)) in v4l2_flash_set_led_brightness()
89 brightness = call_flash_op(v4l2_flash, in v4l2_flash_set_led_brightness()
101 if (has_flash_op(v4l2_flash, led_brightness_to_intensity)) in v4l2_flash_set_led_brightness()
102 ctrl->val = call_flash_op(v4l2_flash, in v4l2_flash_set_led_brightness()
110 led_set_brightness(&v4l2_flash->fled_cdev->led_cdev, in v4l2_flash_set_led_brightness()
113 led_set_brightness(&v4l2_flash->iled_cdev->led_cdev, in v4l2_flash_set_led_brightness()
118 static int v4l2_flash_update_led_brightness(struct v4l2_flash *v4l2_flash, in v4l2_flash_update_led_brightness() argument
121 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_update_led_brightness()
134 led_cdev = &v4l2_flash->fled_cdev->led_cdev; in v4l2_flash_update_led_brightness()
136 led_cdev = &v4l2_flash->iled_cdev->led_cdev; in v4l2_flash_update_led_brightness()
143 if (has_flash_op(v4l2_flash, led_brightness_to_intensity)) in v4l2_flash_update_led_brightness()
144 ctrl->val = call_flash_op(v4l2_flash, in v4l2_flash_update_led_brightness()
156 struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); in v4l2_flash_g_volatile_ctrl() local
157 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_g_volatile_ctrl()
164 return v4l2_flash_update_led_brightness(v4l2_flash, c); in v4l2_flash_g_volatile_ctrl()
198 struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); in v4l2_flash_s_ctrl() local
199 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_s_ctrl()
201 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_s_ctrl()
218 ret = call_flash_op(v4l2_flash, in v4l2_flash_s_ctrl()
225 ret = call_flash_op(v4l2_flash, in v4l2_flash_s_ctrl()
236 v4l2_flash_set_led_brightness(v4l2_flash, in v4l2_flash_s_ctrl()
252 return call_flash_op(v4l2_flash, external_strobe_set, in v4l2_flash_s_ctrl()
276 v4l2_flash_set_led_brightness(v4l2_flash, c); in v4l2_flash_s_ctrl()
297 static void __fill_ctrl_init_data(struct v4l2_flash *v4l2_flash, in __fill_ctrl_init_data() argument
301 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in __fill_ctrl_init_data()
340 if (v4l2_flash->iled_cdev) { in __fill_ctrl_init_data()
407 static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash, in v4l2_flash_init_controls() argument
416 v4l2_flash->ctrls = devm_kzalloc(v4l2_flash->sd.dev, in v4l2_flash_init_controls()
417 sizeof(*v4l2_flash->ctrls) * in v4l2_flash_init_controls()
419 if (!v4l2_flash->ctrls) in v4l2_flash_init_controls()
428 __fill_ctrl_init_data(v4l2_flash, flash_cfg, ctrl_init_data); in v4l2_flash_init_controls()
434 v4l2_ctrl_handler_init(&v4l2_flash->hdl, num_ctrls); in v4l2_flash_init_controls()
443 ctrl = v4l2_ctrl_new_std_menu(&v4l2_flash->hdl, in v4l2_flash_init_controls()
450 ctrl = v4l2_ctrl_new_std(&v4l2_flash->hdl, in v4l2_flash_init_controls()
462 v4l2_flash->ctrls[i] = ctrl; in v4l2_flash_init_controls()
467 if (v4l2_flash->hdl.error) { in v4l2_flash_init_controls()
468 ret = v4l2_flash->hdl.error; in v4l2_flash_init_controls()
472 v4l2_ctrl_handler_setup(&v4l2_flash->hdl); in v4l2_flash_init_controls()
474 v4l2_flash->sd.ctrl_handler = &v4l2_flash->hdl; in v4l2_flash_init_controls()
479 v4l2_ctrl_handler_free(&v4l2_flash->hdl); in v4l2_flash_init_controls()
483 static int __sync_device_with_v4l2_controls(struct v4l2_flash *v4l2_flash) in __sync_device_with_v4l2_controls() argument
485 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in __sync_device_with_v4l2_controls()
486 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in __sync_device_with_v4l2_controls()
489 v4l2_flash_set_led_brightness(v4l2_flash, ctrls[TORCH_INTENSITY]); in __sync_device_with_v4l2_controls()
492 v4l2_flash_set_led_brightness(v4l2_flash, in __sync_device_with_v4l2_controls()
517 ret = call_flash_op(v4l2_flash, external_strobe_set, in __sync_device_with_v4l2_controls()
529 struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); in v4l2_flash_open() local
530 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_open()
532 struct led_classdev_flash *iled_cdev = v4l2_flash->iled_cdev; in v4l2_flash_open()
557 ret = __sync_device_with_v4l2_controls(v4l2_flash); in v4l2_flash_open()
578 struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); in v4l2_flash_close() local
579 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_close()
581 struct led_classdev_flash *iled_cdev = v4l2_flash->iled_cdev; in v4l2_flash_close()
589 if (v4l2_flash->ctrls[STROBE_SOURCE]) in v4l2_flash_close()
590 ret = v4l2_ctrl_s_ctrl(v4l2_flash->ctrls[STROBE_SOURCE], in v4l2_flash_close()
621 struct v4l2_flash *v4l2_flash_init( in v4l2_flash_init()
628 struct v4l2_flash *v4l2_flash; in v4l2_flash_init() local
638 v4l2_flash = devm_kzalloc(led_cdev->dev, sizeof(*v4l2_flash), in v4l2_flash_init()
640 if (!v4l2_flash) in v4l2_flash_init()
643 sd = &v4l2_flash->sd; in v4l2_flash_init()
644 v4l2_flash->fled_cdev = fled_cdev; in v4l2_flash_init()
645 v4l2_flash->iled_cdev = iled_cdev; in v4l2_flash_init()
646 v4l2_flash->ops = ops; in v4l2_flash_init()
660 ret = v4l2_flash_init_controls(v4l2_flash, config); in v4l2_flash_init()
673 return v4l2_flash; in v4l2_flash_init()
685 void v4l2_flash_release(struct v4l2_flash *v4l2_flash) in v4l2_flash_release() argument
690 if (IS_ERR_OR_NULL(v4l2_flash)) in v4l2_flash_release()
693 sd = &v4l2_flash->sd; in v4l2_flash_release()
694 led_cdev = &v4l2_flash->fled_cdev->led_cdev; in v4l2_flash_release()