diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2015-11-17 18:10:26 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-14 00:56:14 +0300 |
commit | 7b905f0583b2e6fe1494a85303a89aa0cd30b0b3 (patch) | |
tree | a5da79d56457b44624280f2f2fb73a5e0937ab03 /drivers/media/platform/vsp1/vsp1_rpf.c | |
parent | b7e5107eebb73d27affed95c20cedbf4784bf17c (diff) | |
download | linux-7b905f0583b2e6fe1494a85303a89aa0cd30b0b3.tar.xz |
[media] v4l: vsp1: Create a new configure operation to setup modules
The subdev s_stream operation is abused as a generic way to setup
modules at every frame. Move the code out to a new VSP1 entity configure
operation.
Most modules now have an empty s_stream operation that can be removed.
The only exception is the WPF module that needs to perform hardware
configuration when stopping the stream. The code can be simplified
accordingly as we know that that operation never fails.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_rpf.c')
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_rpf.c | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index cb3d5ed148cc..eb17fa134750 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -33,13 +33,43 @@ static inline void vsp1_rpf_write(struct vsp1_rwpf *rpf, u32 reg, u32 data) } /* ----------------------------------------------------------------------------- - * V4L2 Subdevice Core Operations + * V4L2 Subdevice Operations */ -static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) +static struct v4l2_subdev_pad_ops rpf_pad_ops = { + .init_cfg = vsp1_entity_init_cfg, + .enum_mbus_code = vsp1_rwpf_enum_mbus_code, + .enum_frame_size = vsp1_rwpf_enum_frame_size, + .get_fmt = vsp1_rwpf_get_format, + .set_fmt = vsp1_rwpf_set_format, + .get_selection = vsp1_rwpf_get_selection, + .set_selection = vsp1_rwpf_set_selection, +}; + +static struct v4l2_subdev_ops rpf_ops = { + .pad = &rpf_pad_ops, +}; + +/* ----------------------------------------------------------------------------- + * VSP1 Entity Operations + */ + +static void rpf_set_memory(struct vsp1_entity *entity) { - struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity); - struct vsp1_rwpf *rpf = to_rwpf(subdev); + struct vsp1_rwpf *rpf = entity_to_rwpf(entity); + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, + rpf->mem.addr[0] + rpf->offsets[0]); + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, + rpf->mem.addr[1] + rpf->offsets[1]); + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, + rpf->mem.addr[2] + rpf->offsets[1]); +} + +static void rpf_configure(struct vsp1_entity *entity) +{ + struct vsp1_pipeline *pipe = to_vsp1_pipeline(&entity->subdev.entity); + struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev); const struct vsp1_format_info *fmtinfo = rpf->fmtinfo; const struct v4l2_pix_format_mplane *format = &rpf->format; const struct v4l2_mbus_framefmt *source_format; @@ -50,9 +80,6 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) u32 pstride; u32 infmt; - if (!enable) - return 0; - /* Source size, stride and crop offsets. * * The crop offsets correspond to the location of the crop rectangle top @@ -136,51 +163,11 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0); vsp1_rpf_write(rpf, VI6_RPF_CKEY_CTRL, 0); - - return 0; -} - -/* ----------------------------------------------------------------------------- - * V4L2 Subdevice Operations - */ - -static struct v4l2_subdev_video_ops rpf_video_ops = { - .s_stream = rpf_s_stream, -}; - -static struct v4l2_subdev_pad_ops rpf_pad_ops = { - .init_cfg = vsp1_entity_init_cfg, - .enum_mbus_code = vsp1_rwpf_enum_mbus_code, - .enum_frame_size = vsp1_rwpf_enum_frame_size, - .get_fmt = vsp1_rwpf_get_format, - .set_fmt = vsp1_rwpf_set_format, - .get_selection = vsp1_rwpf_get_selection, - .set_selection = vsp1_rwpf_set_selection, -}; - -static struct v4l2_subdev_ops rpf_ops = { - .video = &rpf_video_ops, - .pad = &rpf_pad_ops, -}; - -/* ----------------------------------------------------------------------------- - * VSP1 Entity Operations - */ - -static void rpf_set_memory(struct vsp1_entity *entity) -{ - struct vsp1_rwpf *rpf = entity_to_rwpf(entity); - - vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, - rpf->mem.addr[0] + rpf->offsets[0]); - vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, - rpf->mem.addr[1] + rpf->offsets[1]); - vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, - rpf->mem.addr[2] + rpf->offsets[1]); } static const struct vsp1_entity_operations rpf_entity_ops = { .set_memory = rpf_set_memory, + .configure = rpf_configure, }; /* ----------------------------------------------------------------------------- |