Searched refs:xtpg (Results 1 - 1 of 1) sorted by relevance

/linux-4.1.27/drivers/media/platform/xilinx/
H A Dxilinx-tpg.c134 static void __xtpg_update_pattern_control(struct xtpg_device *xtpg, __xtpg_update_pattern_control() argument
137 u32 pattern_mask = (1 << (xtpg->pattern->maximum + 1)) - 1; __xtpg_update_pattern_control()
143 if (xtpg->npads == 1 || !xtpg->has_input) __xtpg_update_pattern_control()
154 __v4l2_ctrl_modify_range(xtpg->pattern, 0, xtpg->pattern->maximum, __xtpg_update_pattern_control()
158 static void xtpg_update_pattern_control(struct xtpg_device *xtpg, xtpg_update_pattern_control() argument
161 mutex_lock(xtpg->ctrl_handler.lock); xtpg_update_pattern_control()
162 __xtpg_update_pattern_control(xtpg, passthrough, pattern); xtpg_update_pattern_control()
163 mutex_unlock(xtpg->ctrl_handler.lock); xtpg_update_pattern_control()
172 struct xtpg_device *xtpg = to_tpg(subdev); xtpg_s_stream() local
173 unsigned int width = xtpg->formats[0].width; xtpg_s_stream()
174 unsigned int height = xtpg->formats[0].height; xtpg_s_stream()
179 xvip_stop(&xtpg->xvip); xtpg_s_stream()
180 if (xtpg->vtc) xtpg_s_stream()
181 xvtc_generator_stop(xtpg->vtc); xtpg_s_stream()
183 xtpg_update_pattern_control(xtpg, true, true); xtpg_s_stream()
184 xtpg->streaming = false; xtpg_s_stream()
188 xvip_set_frame_size(&xtpg->xvip, &xtpg->formats[0]); xtpg_s_stream()
190 if (xtpg->vtc) { xtpg_s_stream()
201 v4l2_ctrl_g_ctrl(xtpg->hblank) + width); xtpg_s_stream()
203 v4l2_ctrl_g_ctrl(xtpg->vblank) + height); xtpg_s_stream()
210 xvtc_generator_start(xtpg->vtc, &config); xtpg_s_stream()
219 mutex_lock(xtpg->ctrl_handler.lock); xtpg_s_stream()
221 xvip_clr_and_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_stream()
222 XTPG_PATTERN_MASK, xtpg->pattern->cur.val); xtpg_s_stream()
228 passthrough = xtpg->pattern->cur.val == 0; xtpg_s_stream()
229 __xtpg_update_pattern_control(xtpg, passthrough, !passthrough); xtpg_s_stream()
231 xtpg->streaming = true; xtpg_s_stream()
233 mutex_unlock(xtpg->ctrl_handler.lock); xtpg_s_stream()
240 : xtpg_get_bayer_phase(xtpg->formats[0].code); xtpg_s_stream()
241 xvip_write(&xtpg->xvip, XTPG_BAYER_PHASE, bayer_phase); xtpg_s_stream()
243 if (xtpg->vtmux_gpio) xtpg_s_stream()
244 gpiod_set_value_cansleep(xtpg->vtmux_gpio, !passthrough); xtpg_s_stream()
246 xvip_start(&xtpg->xvip); xtpg_s_stream()
256 __xtpg_get_pad_format(struct xtpg_device *xtpg, __xtpg_get_pad_format() argument
262 return v4l2_subdev_get_try_format(&xtpg->xvip.subdev, cfg, pad); __xtpg_get_pad_format()
264 return &xtpg->formats[pad]; __xtpg_get_pad_format()
274 struct xtpg_device *xtpg = to_tpg(subdev); xtpg_get_format() local
276 fmt->format = *__xtpg_get_pad_format(xtpg, cfg, fmt->pad, fmt->which); xtpg_get_format()
285 struct xtpg_device *xtpg = to_tpg(subdev); xtpg_set_format() local
289 __format = __xtpg_get_pad_format(xtpg, cfg, fmt->pad, fmt->which); xtpg_set_format()
294 if (xtpg->npads == 2 && fmt->pad == 1) { xtpg_set_format()
300 if (xtpg->bayer) { xtpg_set_format()
311 if (xtpg->npads == 2) { xtpg_set_format()
312 __format = __xtpg_get_pad_format(xtpg, cfg, 1, fmt->which); xtpg_set_format()
354 struct xtpg_device *xtpg = to_tpg(subdev); xtpg_open() local
358 *format = xtpg->default_format; xtpg_open()
360 if (xtpg->npads == 2) { xtpg_open()
362 *format = xtpg->default_format; xtpg_open()
375 struct xtpg_device *xtpg = container_of(ctrl->handler, xtpg_s_ctrl() local
380 xvip_clr_and_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
384 xvip_clr_or_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
388 xvip_clr_or_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
392 xvip_clr_and_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
398 xvip_clr_or_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
402 xvip_clr_or_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
406 xvip_clr_or_set(&xtpg->xvip, XTPG_PATTERN_CONTROL, xtpg_s_ctrl()
410 xvip_write(&xtpg->xvip, XTPG_MOTION_SPEED, ctrl->val); xtpg_s_ctrl()
413 xvip_clr_and_set(&xtpg->xvip, XTPG_CROSS_HAIRS, xtpg_s_ctrl()
418 xvip_clr_and_set(&xtpg->xvip, XTPG_CROSS_HAIRS, xtpg_s_ctrl()
423 xvip_clr_and_set(&xtpg->xvip, XTPG_ZPLATE_HOR_CONTROL, xtpg_s_ctrl()
428 xvip_clr_and_set(&xtpg->xvip, XTPG_ZPLATE_HOR_CONTROL, xtpg_s_ctrl()
433 xvip_clr_and_set(&xtpg->xvip, XTPG_ZPLATE_VER_CONTROL, xtpg_s_ctrl()
438 xvip_clr_and_set(&xtpg->xvip, XTPG_ZPLATE_VER_CONTROL, xtpg_s_ctrl()
443 xvip_write(&xtpg->xvip, XTPG_BOX_SIZE, ctrl->val); xtpg_s_ctrl()
446 xvip_write(&xtpg->xvip, XTPG_BOX_COLOR, ctrl->val); xtpg_s_ctrl()
449 xvip_write(&xtpg->xvip, XTPG_STUCK_PIXEL_THRESH, ctrl->val); xtpg_s_ctrl()
452 xvip_write(&xtpg->xvip, XTPG_NOISE_GAIN, ctrl->val); xtpg_s_ctrl()
691 struct xtpg_device *xtpg = dev_get_drvdata(dev); xtpg_pm_suspend() local
693 xvip_suspend(&xtpg->xvip); xtpg_pm_suspend()
700 struct xtpg_device *xtpg = dev_get_drvdata(dev); xtpg_pm_resume() local
702 xvip_resume(&xtpg->xvip); xtpg_pm_resume()
711 static int xtpg_parse_of(struct xtpg_device *xtpg) xtpg_parse_of() argument
713 struct device *dev = xtpg->xvip.dev; xtpg_parse_of()
714 struct device_node *node = xtpg->xvip.dev->of_node; xtpg_parse_of()
738 if (!xtpg->vip_format) { for_each_child_of_node()
739 xtpg->vip_format = format; for_each_child_of_node()
740 } else if (xtpg->vip_format != format) { for_each_child_of_node()
761 xtpg->npads = nports;
763 xtpg->has_input = true;
771 struct xtpg_device *xtpg; xtpg_probe() local
775 xtpg = devm_kzalloc(&pdev->dev, sizeof(*xtpg), GFP_KERNEL); xtpg_probe()
776 if (!xtpg) xtpg_probe()
779 xtpg->xvip.dev = &pdev->dev; xtpg_probe()
781 ret = xtpg_parse_of(xtpg); xtpg_probe()
785 ret = xvip_init_resources(&xtpg->xvip); xtpg_probe()
789 xtpg->vtmux_gpio = devm_gpiod_get_optional(&pdev->dev, "timing", xtpg_probe()
791 if (IS_ERR(xtpg->vtmux_gpio)) { xtpg_probe()
792 ret = PTR_ERR(xtpg->vtmux_gpio); xtpg_probe()
796 xtpg->vtc = xvtc_of_get(pdev->dev.of_node); xtpg_probe()
797 if (IS_ERR(xtpg->vtc)) { xtpg_probe()
798 ret = PTR_ERR(xtpg->vtc); xtpg_probe()
803 xvip_reset(&xtpg->xvip); xtpg_probe()
808 if (xtpg->npads == 2) { xtpg_probe()
809 xtpg->pads[0].flags = MEDIA_PAD_FL_SINK; xtpg_probe()
810 xtpg->pads[1].flags = MEDIA_PAD_FL_SOURCE; xtpg_probe()
812 xtpg->pads[0].flags = MEDIA_PAD_FL_SOURCE; xtpg_probe()
816 xtpg->default_format.code = xtpg->vip_format->code; xtpg_probe()
817 xtpg->default_format.field = V4L2_FIELD_NONE; xtpg_probe()
818 xtpg->default_format.colorspace = V4L2_COLORSPACE_SRGB; xtpg_probe()
819 xvip_get_frame_size(&xtpg->xvip, &xtpg->default_format); xtpg_probe()
821 bayer_phase = xtpg_get_bayer_phase(xtpg->vip_format->code); xtpg_probe()
823 xtpg->bayer = true; xtpg_probe()
825 xtpg->formats[0] = xtpg->default_format; xtpg_probe()
826 if (xtpg->npads == 2) xtpg_probe()
827 xtpg->formats[1] = xtpg->default_format; xtpg_probe()
830 subdev = &xtpg->xvip.subdev; xtpg_probe()
835 v4l2_set_subdevdata(subdev, xtpg); xtpg_probe()
839 ret = media_entity_init(&subdev->entity, xtpg->npads, xtpg->pads, 0); xtpg_probe()
843 v4l2_ctrl_handler_init(&xtpg->ctrl_handler, 3 + ARRAY_SIZE(xtpg_ctrls)); xtpg_probe()
845 xtpg->vblank = v4l2_ctrl_new_std(&xtpg->ctrl_handler, &xtpg_ctrl_ops, xtpg_probe()
848 xtpg->hblank = v4l2_ctrl_new_std(&xtpg->ctrl_handler, &xtpg_ctrl_ops, xtpg_probe()
851 xtpg->pattern = v4l2_ctrl_new_std_menu_items(&xtpg->ctrl_handler, xtpg_probe()
857 v4l2_ctrl_new_custom(&xtpg->ctrl_handler, &xtpg_ctrls[i], NULL); xtpg_probe()
859 if (xtpg->ctrl_handler.error) { xtpg_probe()
861 ret = xtpg->ctrl_handler.error; xtpg_probe()
864 subdev->ctrl_handler = &xtpg->ctrl_handler; xtpg_probe()
866 xtpg_update_pattern_control(xtpg, true, true); xtpg_probe()
868 ret = v4l2_ctrl_handler_setup(&xtpg->ctrl_handler); xtpg_probe()
874 platform_set_drvdata(pdev, xtpg); xtpg_probe()
876 xvip_print_version(&xtpg->xvip); xtpg_probe()
887 v4l2_ctrl_handler_free(&xtpg->ctrl_handler); xtpg_probe()
889 xvtc_put(xtpg->vtc); xtpg_probe()
891 xvip_cleanup_resources(&xtpg->xvip); xtpg_probe()
897 struct xtpg_device *xtpg = platform_get_drvdata(pdev); xtpg_remove() local
898 struct v4l2_subdev *subdev = &xtpg->xvip.subdev; xtpg_remove()
901 v4l2_ctrl_handler_free(&xtpg->ctrl_handler); xtpg_remove()
904 xvip_cleanup_resources(&xtpg->xvip); xtpg_remove()

Completed in 81 milliseconds