Commit c6c8efb6 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Merge RPF and WPF pad ops structures

The two structures are identical, merge them and move the result to
vsp1_rwpf.c. All rwpf pad operations can now be declared static.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 7b905f05
...@@ -36,18 +36,8 @@ static inline void vsp1_rpf_write(struct vsp1_rwpf *rpf, u32 reg, u32 data) ...@@ -36,18 +36,8 @@ static inline void vsp1_rpf_write(struct vsp1_rwpf *rpf, u32 reg, u32 data)
* V4L2 Subdevice Operations * V4L2 Subdevice Operations
*/ */
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 = { static struct v4l2_subdev_ops rpf_ops = {
.pad = &rpf_pad_ops, .pad = &vsp1_rwpf_pad_ops,
}; };
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
...@@ -20,11 +20,18 @@ ...@@ -20,11 +20,18 @@
#define RWPF_MIN_WIDTH 1 #define RWPF_MIN_WIDTH 1
#define RWPF_MIN_HEIGHT 1 #define RWPF_MIN_HEIGHT 1
struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf,
struct v4l2_subdev_pad_config *config)
{
return v4l2_subdev_get_try_crop(&rwpf->entity.subdev, config,
RWPF_PAD_SINK);
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* V4L2 Subdevice Pad Operations * V4L2 Subdevice Pad Operations
*/ */
int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code) struct v4l2_subdev_mbus_code_enum *code)
{ {
...@@ -41,7 +48,7 @@ int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -41,7 +48,7 @@ int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev,
return 0; return 0;
} }
int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev, static int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_size_enum *fse) struct v4l2_subdev_frame_size_enum *fse)
{ {
...@@ -76,14 +83,7 @@ int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev, ...@@ -76,14 +83,7 @@ int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev,
return 0; return 0;
} }
struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf, static int vsp1_rwpf_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *config)
{
return v4l2_subdev_get_try_crop(&rwpf->entity.subdev, config,
RWPF_PAD_SINK);
}
int vsp1_rwpf_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt) struct v4l2_subdev_format *fmt)
{ {
...@@ -100,7 +100,7 @@ int vsp1_rwpf_get_format(struct v4l2_subdev *subdev, ...@@ -100,7 +100,7 @@ int vsp1_rwpf_get_format(struct v4l2_subdev *subdev,
return 0; return 0;
} }
int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt) struct v4l2_subdev_format *fmt)
{ {
...@@ -154,7 +154,7 @@ int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, ...@@ -154,7 +154,7 @@ int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
return 0; return 0;
} }
int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_selection *sel) struct v4l2_subdev_selection *sel)
{ {
...@@ -191,7 +191,7 @@ int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, ...@@ -191,7 +191,7 @@ int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
return 0; return 0;
} }
int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_selection *sel) struct v4l2_subdev_selection *sel)
{ {
...@@ -250,6 +250,16 @@ int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, ...@@ -250,6 +250,16 @@ int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
return 0; return 0;
} }
const struct v4l2_subdev_pad_ops vsp1_rwpf_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,
};
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Controls * Controls
*/ */
......
...@@ -68,24 +68,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index); ...@@ -68,24 +68,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index);
int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf); int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf);
int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, extern const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops;
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code);
int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_size_enum *fse);
int vsp1_rwpf_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt);
int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt);
int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_selection *sel);
int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_selection *sel);
struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf, struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf,
struct v4l2_subdev_pad_config *config); struct v4l2_subdev_pad_config *config);
......
...@@ -63,19 +63,9 @@ static struct v4l2_subdev_video_ops wpf_video_ops = { ...@@ -63,19 +63,9 @@ static struct v4l2_subdev_video_ops wpf_video_ops = {
.s_stream = wpf_s_stream, .s_stream = wpf_s_stream,
}; };
static struct v4l2_subdev_pad_ops wpf_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 wpf_ops = { static struct v4l2_subdev_ops wpf_ops = {
.video = &wpf_video_ops, .video = &wpf_video_ops,
.pad = &wpf_pad_ops, .pad = &vsp1_rwpf_pad_ops,
}; };
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment