diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2015-11-17 13:10:26 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-13 18:56:14 -0300 |
commit | 7b905f0583b2e6fe1494a85303a89aa0cd30b0b3 (patch) | |
tree | a5da79d56457b44624280f2f2fb73a5e0937ab03 /drivers/media/platform/vsp1/vsp1_hsit.c | |
parent | b7e5107eebb73d27affed95c20cedbf4784bf17c (diff) |
[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_hsit.c')
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_hsit.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c index 4f87f6f8ee38..7360586c902a 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/vsp1/vsp1_hsit.c @@ -32,26 +32,7 @@ static inline void vsp1_hsit_write(struct vsp1_hsit *hsit, u32 reg, u32 data) } /* ----------------------------------------------------------------------------- - * V4L2 Subdevice Core Operations - */ - -static int hsit_s_stream(struct v4l2_subdev *subdev, int enable) -{ - struct vsp1_hsit *hsit = to_hsit(subdev); - - if (!enable) - return 0; - - if (hsit->inverse) - vsp1_hsit_write(hsit, VI6_HSI_CTRL, VI6_HSI_CTRL_EN); - else - vsp1_hsit_write(hsit, VI6_HST_CTRL, VI6_HST_CTRL_EN); - - return 0; -} - -/* ----------------------------------------------------------------------------- - * V4L2 Subdevice Pad Operations + * V4L2 Subdevice Operations */ static int hsit_enum_mbus_code(struct v4l2_subdev *subdev, @@ -167,14 +148,6 @@ static int hsit_set_format(struct v4l2_subdev *subdev, return 0; } -/* ----------------------------------------------------------------------------- - * V4L2 Subdevice Operations - */ - -static struct v4l2_subdev_video_ops hsit_video_ops = { - .s_stream = hsit_s_stream, -}; - static struct v4l2_subdev_pad_ops hsit_pad_ops = { .init_cfg = vsp1_entity_init_cfg, .enum_mbus_code = hsit_enum_mbus_code, @@ -184,11 +157,28 @@ static struct v4l2_subdev_pad_ops hsit_pad_ops = { }; static struct v4l2_subdev_ops hsit_ops = { - .video = &hsit_video_ops, .pad = &hsit_pad_ops, }; /* ----------------------------------------------------------------------------- + * VSP1 Entity Operations + */ + +static void hsit_configure(struct vsp1_entity *entity) +{ + struct vsp1_hsit *hsit = to_hsit(&entity->subdev); + + if (hsit->inverse) + vsp1_hsit_write(hsit, VI6_HSI_CTRL, VI6_HSI_CTRL_EN); + else + vsp1_hsit_write(hsit, VI6_HST_CTRL, VI6_HST_CTRL_EN); +} + +static const struct vsp1_entity_operations hsit_entity_ops = { + .configure = hsit_configure, +}; + +/* ----------------------------------------------------------------------------- * Initialization and Cleanup */ @@ -203,6 +193,8 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse) hsit->inverse = inverse; + hsit->entity.ops = &hsit_entity_ops; + if (inverse) hsit->entity.type = VSP1_ENTITY_HSI; else |