Lines Matching refs:ctx

38 	struct fimc_ctx *ctx = fimc->vid_cap.ctx;  in fimc_capture_hw_init()  local
42 if (ctx == NULL || ctx->s_frame.fmt == NULL) in fimc_capture_hw_init()
52 fimc_prepare_dma_offset(ctx, &ctx->d_frame); in fimc_capture_hw_init()
53 fimc_set_yuv_order(ctx); in fimc_capture_hw_init()
58 fimc_hw_set_camera_offset(fimc, &ctx->s_frame); in fimc_capture_hw_init()
60 ret = fimc_set_scaler_info(ctx); in fimc_capture_hw_init()
62 fimc_hw_set_input_path(ctx); in fimc_capture_hw_init()
63 fimc_hw_set_prescaler(ctx); in fimc_capture_hw_init()
64 fimc_hw_set_mainscaler(ctx); in fimc_capture_hw_init()
65 fimc_hw_set_target_format(ctx); in fimc_capture_hw_init()
66 fimc_hw_set_rotation(ctx); in fimc_capture_hw_init()
67 fimc_hw_set_effect(ctx); in fimc_capture_hw_init()
68 fimc_hw_set_output_path(ctx); in fimc_capture_hw_init()
69 fimc_hw_set_out_dma(ctx); in fimc_capture_hw_init()
71 fimc_hw_set_rgb_alpha(ctx); in fimc_capture_hw_init()
154 static int fimc_capture_config_update(struct fimc_ctx *ctx) in fimc_capture_config_update() argument
156 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_capture_config_update()
159 fimc_hw_set_camera_offset(fimc, &ctx->s_frame); in fimc_capture_config_update()
161 ret = fimc_set_scaler_info(ctx); in fimc_capture_config_update()
165 fimc_hw_set_prescaler(ctx); in fimc_capture_config_update()
166 fimc_hw_set_mainscaler(ctx); in fimc_capture_config_update()
167 fimc_hw_set_target_format(ctx); in fimc_capture_config_update()
168 fimc_hw_set_rotation(ctx); in fimc_capture_config_update()
169 fimc_hw_set_effect(ctx); in fimc_capture_config_update()
170 fimc_prepare_dma_offset(ctx, &ctx->d_frame); in fimc_capture_config_update()
171 fimc_hw_set_out_dma(ctx); in fimc_capture_config_update()
173 fimc_hw_set_rgb_alpha(ctx); in fimc_capture_config_update()
184 struct fimc_frame *f = &cap->ctx->d_frame; in fimc_capture_irq_handler()
248 fimc_capture_config_update(cap->ctx); in fimc_capture_irq_handler()
262 struct fimc_ctx *ctx = q->drv_priv; in start_streaming() local
263 struct fimc_dev *fimc = ctx->fimc_dev; in start_streaming()
282 fimc_activate_capture(ctx); in start_streaming()
293 struct fimc_ctx *ctx = q->drv_priv; in stop_streaming() local
294 struct fimc_dev *fimc = ctx->fimc_dev; in stop_streaming()
347 struct fimc_ctx *ctx = vq->drv_priv; in queue_setup() local
348 struct fimc_frame *frame = &ctx->d_frame; in queue_setup()
376 allocators[i] = ctx->fimc_dev->alloc_ctx; in queue_setup()
385 struct fimc_ctx *ctx = vq->drv_priv; in buffer_prepare() local
388 if (ctx->d_frame.fmt == NULL) in buffer_prepare()
391 for (i = 0; i < ctx->d_frame.fmt->memplanes; i++) { in buffer_prepare()
392 unsigned long size = ctx->d_frame.payload[i]; in buffer_prepare()
395 v4l2_err(&ctx->fimc_dev->vid_cap.ve.vdev, in buffer_prepare()
411 struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in buffer_queue() local
412 struct fimc_dev *fimc = ctx->fimc_dev; in buffer_queue()
419 fimc_prepare_addr(ctx, &buf->vb.vb2_buf, &ctx->d_frame, &buf->paddr); in buffer_queue()
446 fimc_activate_capture(ctx); in buffer_queue()
507 fimc_ctrls_delete(vc->ctx); in fimc_capture_open()
509 ret = fimc_ctrls_create(vc->ctx); in fimc_capture_open()
579 static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, in fimc_capture_try_format() argument
583 bool rotation = ctx->rotation == 90 || ctx->rotation == 270; in fimc_capture_try_format()
584 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_capture_try_format()
587 struct fimc_frame *dst = &ctx->d_frame; in fimc_capture_try_format()
593 if (code && ctx->s_frame.fmt && pad == FIMC_SD_PAD_SOURCE && in fimc_capture_try_format()
594 fimc_fmt_is_user_defined(ctx->s_frame.fmt->color)) in fimc_capture_try_format()
595 *code = ctx->s_frame.fmt->mbus_code; in fimc_capture_try_format()
626 *width = ctx->s_frame.f_width; in fimc_capture_try_format()
627 *height = ctx->s_frame.f_height; in fimc_capture_try_format()
632 if (ctx->state & FIMC_COMPOSE) { in fimc_capture_try_format()
656 static void fimc_capture_try_selection(struct fimc_ctx *ctx, in fimc_capture_try_selection() argument
660 bool rotate = ctx->rotation == 90 || ctx->rotation == 270; in fimc_capture_try_selection()
661 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_capture_try_selection()
664 struct fimc_frame *sink = &ctx->s_frame; in fimc_capture_try_selection()
670 if (fimc_fmt_is_user_defined(ctx->d_frame.fmt->color)) { in fimc_capture_try_selection()
677 if (ctx->rotation != 90 && ctx->rotation != 270) in fimc_capture_try_selection()
776 static int fimc_pipeline_try_format(struct fimc_ctx *ctx, in fimc_pipeline_try_format() argument
781 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_pipeline_try_format()
843 ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height, in fimc_pipeline_try_format()
845 ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height, in fimc_pipeline_try_format()
911 __fimc_get_format(&fimc->vid_cap.ctx->d_frame, f); in fimc_cap_g_fmt_mplane()
928 struct fimc_ctx *ctx = vc->ctx; in __video_try_or_set_format() local
934 fimc_capture_try_format(ctx, &pix->width, &pix->height, in __video_try_or_set_format()
941 ctx->s_frame.f_width = pix->width; in __video_try_or_set_format()
942 ctx->s_frame.f_height = pix->height; in __video_try_or_set_format()
947 *out_fmt = fimc_capture_try_format(ctx, &pix->width, &pix->height, in __video_try_or_set_format()
971 ret = fimc_pipeline_try_format(ctx, mf, inp_fmt, try); in __video_try_or_set_format()
1010 static void fimc_capture_mark_jpeg_xfer(struct fimc_ctx *ctx, in fimc_capture_mark_jpeg_xfer() argument
1015 ctx->scaler.enabled = !jpeg; in fimc_capture_mark_jpeg_xfer()
1016 fimc_ctrls_activate(ctx, !jpeg); in fimc_capture_mark_jpeg_xfer()
1019 set_bit(ST_CAPT_JPEG, &ctx->fimc_dev->state); in fimc_capture_mark_jpeg_xfer()
1021 clear_bit(ST_CAPT_JPEG, &ctx->fimc_dev->state); in fimc_capture_mark_jpeg_xfer()
1028 struct fimc_ctx *ctx = vc->ctx; in __fimc_capture_set_format() local
1030 struct fimc_frame *ff = &ctx->d_frame; in __fimc_capture_set_format()
1042 fimc_alpha_ctrl_update(ctx); in __fimc_capture_set_format()
1051 if (!(ctx->state & FIMC_COMPOSE)) in __fimc_capture_set_format()
1054 fimc_capture_mark_jpeg_xfer(ctx, ff->fmt->color); in __fimc_capture_set_format()
1058 ctx->s_frame.fmt = inp_fmt; in __fimc_capture_set_format()
1059 set_frame_bounds(&ctx->s_frame, pix->width, pix->height); in __fimc_capture_set_format()
1060 set_frame_crop(&ctx->s_frame, 0, 0, pix->width, pix->height); in __fimc_capture_set_format()
1146 struct fimc_frame *ff = &vc->ctx->s_frame; in fimc_pipeline_validate()
1174 struct fimc_frame *frame = &vc->ctx->d_frame; in fimc_pipeline_validate()
1276 struct fimc_ctx *ctx = fimc->vid_cap.ctx; in fimc_cap_g_selection() local
1277 struct fimc_frame *f = &ctx->s_frame; in fimc_cap_g_selection()
1285 f = &ctx->d_frame; in fimc_cap_g_selection()
1295 f = &ctx->d_frame; in fimc_cap_g_selection()
1324 struct fimc_ctx *ctx = fimc->vid_cap.ctx; in fimc_cap_s_selection() local
1333 f = &ctx->d_frame; in fimc_cap_s_selection()
1335 f = &ctx->s_frame; in fimc_cap_s_selection()
1339 fimc_capture_try_selection(ctx, &rect, s->target); in fimc_cap_s_selection()
1424 return v4l2_ctrl_add_handler(&vc->ctx->ctrls.handler, in fimc_link_setup()
1499 struct fimc_ctx *ctx = fimc->vid_cap.ctx; in fimc_subdev_get_fmt() local
1500 struct fimc_frame *ff = &ctx->s_frame; in fimc_subdev_get_fmt()
1542 struct fimc_ctx *ctx = vc->ctx; in fimc_subdev_set_fmt() local
1553 ffmt = fimc_capture_try_format(ctx, &mf->width, &mf->height, in fimc_subdev_set_fmt()
1568 fimc_alpha_ctrl_update(ctx); in fimc_subdev_set_fmt()
1570 fimc_capture_mark_jpeg_xfer(ctx, ffmt->color); in fimc_subdev_set_fmt()
1572 ff = &ctx->d_frame; in fimc_subdev_set_fmt()
1574 mf->width = ctx->s_frame.width; in fimc_subdev_set_fmt()
1575 mf->height = ctx->s_frame.height; in fimc_subdev_set_fmt()
1577 ff = &ctx->s_frame; in fimc_subdev_set_fmt()
1591 if (!(fmt->pad == FIMC_SD_PAD_SOURCE && (ctx->state & FIMC_COMPOSE))) in fimc_subdev_set_fmt()
1595 ctx->state &= ~FIMC_COMPOSE; in fimc_subdev_set_fmt()
1606 struct fimc_ctx *ctx = fimc->vid_cap.ctx; in fimc_subdev_get_selection() local
1607 struct fimc_frame *f = &ctx->s_frame; in fimc_subdev_get_selection()
1618 f = &ctx->d_frame; in fimc_subdev_get_selection()
1632 f = &ctx->d_frame; in fimc_subdev_get_selection()
1661 struct fimc_ctx *ctx = fimc->vid_cap.ctx; in fimc_subdev_set_selection() local
1662 struct fimc_frame *f = &ctx->s_frame; in fimc_subdev_set_selection()
1671 fimc_capture_try_selection(ctx, r, V4L2_SEL_TGT_CROP); in fimc_subdev_set_selection()
1679 f = &ctx->d_frame; in fimc_subdev_set_selection()
1693 ctx->state |= FIMC_COMPOSE; in fimc_subdev_set_selection()
1739 struct fimc_ctx *ctx; in fimc_register_capture_device() local
1744 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); in fimc_register_capture_device()
1745 if (!ctx) in fimc_register_capture_device()
1748 ctx->fimc_dev = fimc; in fimc_register_capture_device()
1749 ctx->in_path = FIMC_IO_CAMERA; in fimc_register_capture_device()
1750 ctx->out_path = FIMC_IO_DMA; in fimc_register_capture_device()
1751 ctx->state = FIMC_CTX_CAP; in fimc_register_capture_device()
1752 ctx->s_frame.fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); in fimc_register_capture_device()
1753 ctx->d_frame.fmt = ctx->s_frame.fmt; in fimc_register_capture_device()
1770 vid_cap->ctx = ctx; in fimc_register_capture_device()
1778 q->drv_priv = ctx; in fimc_register_capture_device()
1795 ctx->s_frame.width = FIMC_DEFAULT_WIDTH; in fimc_register_capture_device()
1796 ctx->s_frame.height = FIMC_DEFAULT_HEIGHT; in fimc_register_capture_device()
1797 ctx->s_frame.fmt = fmt; in fimc_register_capture_device()
1808 ret = fimc_ctrls_create(ctx); in fimc_register_capture_device()
1819 vfd->ctrl_handler = &ctx->ctrls.handler; in fimc_register_capture_device()
1823 fimc_ctrls_delete(ctx); in fimc_register_capture_device()
1827 kfree(ctx); in fimc_register_capture_device()
1870 fimc_ctrls_delete(fimc->vid_cap.ctx); in fimc_capture_subdev_unregistered()
1873 kfree(fimc->vid_cap.ctx); in fimc_capture_subdev_unregistered()
1874 fimc->vid_cap.ctx = NULL; in fimc_capture_subdev_unregistered()