summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vsp1/vsp1_wpf.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2015-11-17 17:23:23 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-04-13 23:52:36 +0300
commit5243453472e7bce74764ddf9f206450dcc8769c5 (patch)
treef23eb718b6c6e5df792bce7c7b87b9c19d4af606 /drivers/media/platform/vsp1/vsp1_wpf.c
parent823329dfee7224712569cc4899720bc470a2fe56 (diff)
downloadlinux-5243453472e7bce74764ddf9f206450dcc8769c5.tar.xz
[media] v4l: vsp1: Consolidate entity ops in a struct vsp1_entity_operations
Entities have two operations, a destroy operation stored directly in vsp1_entity and a set_memory operation stored in a vsp1_rwpf_operations structure. Move the two to a more generic vsp1_entity_operations structure that will serve to implement additional operations. 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_wpf.c')
-rw-r--r--drivers/media/platform/vsp1/vsp1_wpf.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
index b81595eb51dc..84772fa258a5 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -152,17 +152,27 @@ static struct v4l2_subdev_ops wpf_ops = {
};
/* -----------------------------------------------------------------------------
- * Video Device Operations
+ * VSP1 Entity Operations
*/
-static void wpf_set_memory(struct vsp1_rwpf *wpf)
+static void vsp1_wpf_destroy(struct vsp1_entity *entity)
{
+ struct vsp1_rwpf *wpf = entity_to_rwpf(entity);
+
+ vsp1_dlm_destroy(wpf->dlm);
+}
+
+static void wpf_set_memory(struct vsp1_entity *entity)
+{
+ struct vsp1_rwpf *wpf = entity_to_rwpf(entity);
+
vsp1_wpf_write(wpf, VI6_WPF_DSTM_ADDR_Y, wpf->mem.addr[0]);
vsp1_wpf_write(wpf, VI6_WPF_DSTM_ADDR_C0, wpf->mem.addr[1]);
vsp1_wpf_write(wpf, VI6_WPF_DSTM_ADDR_C1, wpf->mem.addr[2]);
}
-static const struct vsp1_rwpf_operations wpf_vdev_ops = {
+static const struct vsp1_entity_operations wpf_entity_ops = {
+ .destroy = vsp1_wpf_destroy,
.set_memory = wpf_set_memory,
};
@@ -170,13 +180,6 @@ static const struct vsp1_rwpf_operations wpf_vdev_ops = {
* Initialization and Cleanup
*/
-static void vsp1_wpf_destroy(struct vsp1_entity *entity)
-{
- struct vsp1_rwpf *wpf = container_of(entity, struct vsp1_rwpf, entity);
-
- vsp1_dlm_destroy(wpf->dlm);
-}
-
struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
{
struct vsp1_rwpf *wpf;
@@ -187,12 +190,10 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
if (wpf == NULL)
return ERR_PTR(-ENOMEM);
- wpf->ops = &wpf_vdev_ops;
-
wpf->max_width = WPF_MAX_WIDTH;
wpf->max_height = WPF_MAX_HEIGHT;
- wpf->entity.destroy = vsp1_wpf_destroy;
+ wpf->entity.ops = &wpf_entity_ops;
wpf->entity.type = VSP1_ENTITY_WPF;
wpf->entity.index = index;