Lines Matching refs:vsen
99 struct vimc_sen_device *vsen =
104 vsen->mbus_format;
109 static void vimc_sen_tpg_s_format(struct vimc_sen_device *vsen)
112 vimc_pix_map_by_code(vsen->mbus_format.code);
114 tpg_reset_source(&vsen->tpg, vsen->mbus_format.width,
115 vsen->mbus_format.height, vsen->mbus_format.field);
116 tpg_s_bytesperline(&vsen->tpg, 0, vsen->mbus_format.width * vpix->bpp);
117 tpg_s_buf_height(&vsen->tpg, vsen->mbus_format.height);
118 tpg_s_fourcc(&vsen->tpg, vpix->pixelformat);
120 tpg_s_field(&vsen->tpg, vsen->mbus_format.field, false);
121 tpg_s_colorspace(&vsen->tpg, vsen->mbus_format.colorspace);
122 tpg_s_ycbcr_enc(&vsen->tpg, vsen->mbus_format.ycbcr_enc);
123 tpg_s_quantization(&vsen->tpg, vsen->mbus_format.quantization);
124 tpg_s_xfer_func(&vsen->tpg, vsen->mbus_format.xfer_func);
152 struct vimc_sen_device *vsen = v4l2_get_subdevdata(sd);
157 if (vsen->frame)
160 mf = &vsen->mbus_format;
168 dev_dbg(vsen->ved.dev, "%s: format update: "
170 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vsen->sd.name,
196 struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device,
203 tpg_fill_plane_buffer(&vsen->tpg, 0, 0, vsen->frame);
204 tpg_calc_text_basep(&vsen->tpg, basep, 0, vsen->frame);
205 switch (vsen->osd_value) {
207 const char *order = tpg_g_color_order(&vsen->tpg);
209 tpg_gen_text(&vsen->tpg, basep, line++ * line_height,
213 vsen->tpg.brightness,
214 vsen->tpg.contrast,
215 vsen->tpg.saturation,
216 vsen->tpg.hue);
217 tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str);
219 vsen->mbus_format.width,
220 vsen->mbus_format.height);
221 tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str);
227 ms = div_u64(ktime_get_ns() - vsen->start_stream_ts, 1000000);
233 tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str);
241 return vsen->frame;
246 struct vimc_sen_device *vsen =
253 vsen->start_stream_ts = ktime_get_ns();
256 vpix = vimc_pix_map_by_code(vsen->mbus_format.code);
257 frame_size = vsen->mbus_format.width * vpix->bpp *
258 vsen->mbus_format.height;
264 vsen->frame = vmalloc(frame_size);
265 if (!vsen->frame)
269 vimc_sen_tpg_s_format(vsen);
273 vfree(vsen->frame);
274 vsen->frame = NULL;
298 struct vimc_sen_device *vsen =
303 tpg_s_pattern(&vsen->tpg, ctrl->val);
306 tpg_s_hflip(&vsen->tpg, ctrl->val);
309 tpg_s_vflip(&vsen->tpg, ctrl->val);
312 tpg_s_brightness(&vsen->tpg, ctrl->val);
315 tpg_s_contrast(&vsen->tpg, ctrl->val);
318 tpg_s_hue(&vsen->tpg, ctrl->val);
321 tpg_s_saturation(&vsen->tpg, ctrl->val);
324 vsen->osd_value = ctrl->val;
338 struct vimc_sen_device *vsen =
341 v4l2_ctrl_handler_free(&vsen->hdl);
342 tpg_free(&vsen->tpg);
343 media_entity_cleanup(vsen->ved.ent);
344 kfree(vsen);
384 struct vimc_sen_device *vsen;
387 /* Allocate the vsen struct */
388 vsen = kzalloc(sizeof(*vsen), GFP_KERNEL);
389 if (!vsen)
392 v4l2_ctrl_handler_init(&vsen->hdl, 4);
394 v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_class, NULL);
395 v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_test_pattern, NULL);
396 v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_osd_mode, NULL);
397 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
399 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
401 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
403 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
405 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
407 v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops,
409 vsen->sd.ctrl_handler = &vsen->hdl;
410 if (vsen->hdl.error) {
411 ret = vsen->hdl.error;
416 tpg_init(&vsen->tpg, vsen->mbus_format.width,
417 vsen->mbus_format.height);
418 ret = tpg_alloc(&vsen->tpg, VIMC_FRAME_MAX_WIDTH);
423 vsen->pad.flags = MEDIA_PAD_FL_SOURCE;
424 ret = vimc_ent_sd_register(&vsen->ved, &vsen->sd, v4l2_dev,
426 MEDIA_ENT_F_CAM_SENSOR, 1, &vsen->pad,
431 vsen->ved.process_frame = vimc_sen_process_frame;
432 vsen->ved.dev = vimc->mdev.dev;
435 vsen->mbus_format = fmt_default;
437 return &vsen->ved;
440 tpg_free(&vsen->tpg);
442 v4l2_ctrl_handler_free(&vsen->hdl);
444 kfree(vsen);