Lines Matching refs:vsensor

98 static void vimc_sensor_tpg_s_format(struct vimc_sensor_device *vsensor,  in vimc_sensor_tpg_s_format()  argument
103 tpg_reset_source(&vsensor->tpg, format->width, format->height, in vimc_sensor_tpg_s_format()
105 tpg_s_bytesperline(&vsensor->tpg, 0, format->width * vpix->bpp); in vimc_sensor_tpg_s_format()
106 tpg_s_buf_height(&vsensor->tpg, format->height); in vimc_sensor_tpg_s_format()
107 tpg_s_fourcc(&vsensor->tpg, vpix->pixelformat); in vimc_sensor_tpg_s_format()
109 tpg_s_field(&vsensor->tpg, format->field, false); in vimc_sensor_tpg_s_format()
110 tpg_s_colorspace(&vsensor->tpg, format->colorspace); in vimc_sensor_tpg_s_format()
111 tpg_s_ycbcr_enc(&vsensor->tpg, format->ycbcr_enc); in vimc_sensor_tpg_s_format()
112 tpg_s_quantization(&vsensor->tpg, format->quantization); in vimc_sensor_tpg_s_format()
113 tpg_s_xfer_func(&vsensor->tpg, format->xfer_func); in vimc_sensor_tpg_s_format()
141 struct vimc_sensor_device *vsensor = v4l2_get_subdevdata(sd); in vimc_sensor_set_fmt() local
145 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE && vsensor->frame) in vimc_sensor_set_fmt()
153 dev_dbg(vsensor->ved.dev, "%s: format update: " in vimc_sensor_set_fmt()
155 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vsensor->sd.name, in vimc_sensor_set_fmt()
180 struct vimc_sensor_device *vsensor = in vimc_sensor_process_frame() local
188 tpg_fill_plane_buffer(&vsensor->tpg, 0, 0, vsensor->frame); in vimc_sensor_process_frame()
189 tpg_calc_text_basep(&vsensor->tpg, basep, 0, vsensor->frame); in vimc_sensor_process_frame()
190 switch (vsensor->hw.osd_value) { in vimc_sensor_process_frame()
192 const char *order = tpg_g_color_order(&vsensor->tpg); in vimc_sensor_process_frame()
194 tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, in vimc_sensor_process_frame()
198 vsensor->tpg.brightness, in vimc_sensor_process_frame()
199 vsensor->tpg.contrast, in vimc_sensor_process_frame()
200 vsensor->tpg.saturation, in vimc_sensor_process_frame()
201 vsensor->tpg.hue); in vimc_sensor_process_frame()
202 tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); in vimc_sensor_process_frame()
204 vsensor->hw.size.width, vsensor->hw.size.height); in vimc_sensor_process_frame()
205 tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); in vimc_sensor_process_frame()
211 ms = div_u64(ktime_get_ns() - vsensor->hw.start_stream_ts, 1000000); in vimc_sensor_process_frame()
217 tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); in vimc_sensor_process_frame()
225 return vsensor->frame; in vimc_sensor_process_frame()
230 struct vimc_sensor_device *vsensor = in vimc_sensor_s_stream() local
243 vimc_sensor_tpg_s_format(vsensor, format); in vimc_sensor_s_stream()
249 vsensor->hw.size.width = format->width; in vimc_sensor_s_stream()
250 vsensor->hw.size.height = format->height; in vimc_sensor_s_stream()
258 vsensor->frame = vmalloc(frame_size); in vimc_sensor_s_stream()
259 if (!vsensor->frame) in vimc_sensor_s_stream()
262 vsensor->hw.start_stream_ts = ktime_get_ns(); in vimc_sensor_s_stream()
265 vfree(vsensor->frame); in vimc_sensor_s_stream()
266 vsensor->frame = NULL; in vimc_sensor_s_stream()
294 struct vimc_sensor_device *vsensor = in vimc_sensor_s_ctrl() local
299 tpg_s_pattern(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
302 tpg_s_hflip(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
305 tpg_s_vflip(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
308 tpg_s_brightness(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
311 tpg_s_contrast(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
314 tpg_s_hue(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
317 tpg_s_saturation(&vsensor->tpg, ctrl->val); in vimc_sensor_s_ctrl()
320 vsensor->hw.osd_value = ctrl->val; in vimc_sensor_s_ctrl()
334 struct vimc_sensor_device *vsensor = in vimc_sensor_release() local
337 v4l2_ctrl_handler_free(&vsensor->hdl); in vimc_sensor_release()
338 tpg_free(&vsensor->tpg); in vimc_sensor_release()
339 v4l2_subdev_cleanup(&vsensor->sd); in vimc_sensor_release()
340 media_entity_cleanup(vsensor->ved.ent); in vimc_sensor_release()
341 kfree(vsensor); in vimc_sensor_release()
381 struct vimc_sensor_device *vsensor; in vimc_sensor_add() local
385 vsensor = kzalloc(sizeof(*vsensor), GFP_KERNEL); in vimc_sensor_add()
386 if (!vsensor) in vimc_sensor_add()
389 v4l2_ctrl_handler_init(&vsensor->hdl, 4); in vimc_sensor_add()
391 v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_class, NULL); in vimc_sensor_add()
392 v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_test_pattern, NULL); in vimc_sensor_add()
393 v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_osd_mode, NULL); in vimc_sensor_add()
394 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
396 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
398 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
400 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
402 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
404 v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, in vimc_sensor_add()
406 vsensor->sd.ctrl_handler = &vsensor->hdl; in vimc_sensor_add()
407 if (vsensor->hdl.error) { in vimc_sensor_add()
408 ret = vsensor->hdl.error; in vimc_sensor_add()
413 tpg_init(&vsensor->tpg, fmt_default.width, fmt_default.height); in vimc_sensor_add()
414 ret = tpg_alloc(&vsensor->tpg, VIMC_FRAME_MAX_WIDTH); in vimc_sensor_add()
419 vsensor->pad.flags = MEDIA_PAD_FL_SOURCE; in vimc_sensor_add()
420 ret = vimc_ent_sd_register(&vsensor->ved, &vsensor->sd, v4l2_dev, in vimc_sensor_add()
422 MEDIA_ENT_F_CAM_SENSOR, 1, &vsensor->pad, in vimc_sensor_add()
427 vsensor->ved.process_frame = vimc_sensor_process_frame; in vimc_sensor_add()
428 vsensor->ved.dev = vimc->mdev.dev; in vimc_sensor_add()
430 return &vsensor->ved; in vimc_sensor_add()
433 tpg_free(&vsensor->tpg); in vimc_sensor_add()
435 v4l2_ctrl_handler_free(&vsensor->hdl); in vimc_sensor_add()
437 kfree(vsensor); in vimc_sensor_add()