Lines Matching refs:v4l2_flash

17 #define has_flash_op(v4l2_flash, op)				\  argument
18 (v4l2_flash && v4l2_flash->ops && v4l2_flash->ops->op)
20 #define call_flash_op(v4l2_flash, op, arg) \ argument
21 (has_flash_op(v4l2_flash, op) ? \
22 v4l2_flash->ops->op(v4l2_flash, arg) : \
79 static int v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash, in v4l2_flash_set_led_brightness() argument
82 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_set_led_brightness()
86 if (has_flash_op(v4l2_flash, intensity_to_led_brightness)) in v4l2_flash_set_led_brightness()
87 brightness = call_flash_op(v4l2_flash, in v4l2_flash_set_led_brightness()
99 if (has_flash_op(v4l2_flash, led_brightness_to_intensity)) in v4l2_flash_set_led_brightness()
100 ctrl->val = call_flash_op(v4l2_flash, in v4l2_flash_set_led_brightness()
108 if (WARN_ON_ONCE(!v4l2_flash->fled_cdev)) in v4l2_flash_set_led_brightness()
111 led_cdev = &v4l2_flash->fled_cdev->led_cdev; in v4l2_flash_set_led_brightness()
113 if (WARN_ON_ONCE(!v4l2_flash->iled_cdev)) in v4l2_flash_set_led_brightness()
116 led_cdev = v4l2_flash->iled_cdev; in v4l2_flash_set_led_brightness()
122 static int v4l2_flash_update_led_brightness(struct v4l2_flash *v4l2_flash, in v4l2_flash_update_led_brightness() argument
125 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_update_led_brightness()
139 if (WARN_ON_ONCE(!v4l2_flash->fled_cdev)) in v4l2_flash_update_led_brightness()
142 led_cdev = &v4l2_flash->fled_cdev->led_cdev; in v4l2_flash_update_led_brightness()
144 if (WARN_ON_ONCE(!v4l2_flash->iled_cdev)) in v4l2_flash_update_led_brightness()
147 led_cdev = v4l2_flash->iled_cdev; in v4l2_flash_update_led_brightness()
154 if (has_flash_op(v4l2_flash, led_brightness_to_intensity)) in v4l2_flash_update_led_brightness()
155 ctrl->val = call_flash_op(v4l2_flash, in v4l2_flash_update_led_brightness()
167 struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); in v4l2_flash_g_volatile_ctrl() local
168 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_g_volatile_ctrl()
175 return v4l2_flash_update_led_brightness(v4l2_flash, c); in v4l2_flash_g_volatile_ctrl()
215 struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); in v4l2_flash_s_ctrl() local
216 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_s_ctrl()
218 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in v4l2_flash_s_ctrl()
225 return v4l2_flash_set_led_brightness(v4l2_flash, c); in v4l2_flash_s_ctrl()
246 ret = call_flash_op(v4l2_flash, in v4l2_flash_s_ctrl()
253 ret = call_flash_op(v4l2_flash, in v4l2_flash_s_ctrl()
264 return v4l2_flash_set_led_brightness(v4l2_flash, in v4l2_flash_s_ctrl()
279 return call_flash_op(v4l2_flash, external_strobe_set, in v4l2_flash_s_ctrl()
320 static void __fill_ctrl_init_data(struct v4l2_flash *v4l2_flash, in __fill_ctrl_init_data() argument
324 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in __fill_ctrl_init_data()
330 if (v4l2_flash->iled_cdev) { in __fill_ctrl_init_data()
429 static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash, in v4l2_flash_init_controls() argument
438 v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev, in v4l2_flash_init_controls()
440 sizeof(*v4l2_flash->ctrls), in v4l2_flash_init_controls()
442 if (!v4l2_flash->ctrls) in v4l2_flash_init_controls()
451 __fill_ctrl_init_data(v4l2_flash, flash_cfg, ctrl_init_data); in v4l2_flash_init_controls()
457 v4l2_ctrl_handler_init(&v4l2_flash->hdl, num_ctrls); in v4l2_flash_init_controls()
466 ctrl = v4l2_ctrl_new_std_menu(&v4l2_flash->hdl, in v4l2_flash_init_controls()
473 ctrl = v4l2_ctrl_new_std(&v4l2_flash->hdl, in v4l2_flash_init_controls()
485 v4l2_flash->ctrls[i] = ctrl; in v4l2_flash_init_controls()
490 if (v4l2_flash->hdl.error) { in v4l2_flash_init_controls()
491 ret = v4l2_flash->hdl.error; in v4l2_flash_init_controls()
495 v4l2_ctrl_handler_setup(&v4l2_flash->hdl); in v4l2_flash_init_controls()
497 v4l2_flash->sd.ctrl_handler = &v4l2_flash->hdl; in v4l2_flash_init_controls()
502 v4l2_ctrl_handler_free(&v4l2_flash->hdl); in v4l2_flash_init_controls()
506 static int __sync_device_with_v4l2_controls(struct v4l2_flash *v4l2_flash) in __sync_device_with_v4l2_controls() argument
508 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in __sync_device_with_v4l2_controls()
509 struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; in __sync_device_with_v4l2_controls()
513 ret = v4l2_flash_set_led_brightness(v4l2_flash, in __sync_device_with_v4l2_controls()
520 ret = v4l2_flash_set_led_brightness(v4l2_flash, in __sync_device_with_v4l2_controls()
554 ret = call_flash_op(v4l2_flash, external_strobe_set, in __sync_device_with_v4l2_controls()
566 struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); in v4l2_flash_open() local
567 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_open()
569 struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev; in v4l2_flash_open()
593 ret = __sync_device_with_v4l2_controls(v4l2_flash); in v4l2_flash_open()
616 struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); in v4l2_flash_close() local
617 struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; in v4l2_flash_close()
619 struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev; in v4l2_flash_close()
628 if (v4l2_flash->ctrls[STROBE_SOURCE]) in v4l2_flash_close()
630 v4l2_flash->ctrls[STROBE_SOURCE], in v4l2_flash_close()
653 static struct v4l2_flash *__v4l2_flash_init( in __v4l2_flash_init()
658 struct v4l2_flash *v4l2_flash; in __v4l2_flash_init() local
665 v4l2_flash = devm_kzalloc(dev, sizeof(*v4l2_flash), GFP_KERNEL); in __v4l2_flash_init()
666 if (!v4l2_flash) in __v4l2_flash_init()
669 sd = &v4l2_flash->sd; in __v4l2_flash_init()
670 v4l2_flash->fled_cdev = fled_cdev; in __v4l2_flash_init()
671 v4l2_flash->iled_cdev = iled_cdev; in __v4l2_flash_init()
672 v4l2_flash->ops = ops; in __v4l2_flash_init()
686 ret = v4l2_flash_init_controls(v4l2_flash, config); in __v4l2_flash_init()
696 return v4l2_flash; in __v4l2_flash_init()
707 struct v4l2_flash *v4l2_flash_init( in v4l2_flash_init()
717 struct v4l2_flash *v4l2_flash_indicator_init( in v4l2_flash_indicator_init()
726 void v4l2_flash_release(struct v4l2_flash *v4l2_flash) in v4l2_flash_release() argument
730 if (IS_ERR_OR_NULL(v4l2_flash)) in v4l2_flash_release()
733 sd = &v4l2_flash->sd; in v4l2_flash_release()