@@ -47,7 +47,7 @@ static int clu_set_table(struct vsp1_clu *clu, struct v4l2_ctrl *ctrl)
struct vsp1_dl_body *dlb;
unsigned int i;
- dlb = vsp1_dl_fragment_alloc(clu->entity.vsp1, 1 + 17 * 17 * 17);
+ dlb = vsp1_dl_fragment_get(clu->pool);
if (!dlb)
return -ENOMEM;
@@ -59,7 +59,7 @@ static int clu_set_table(struct vsp1_clu *clu, struct v4l2_ctrl *ctrl)
swap(clu->clu, dlb);
spin_unlock_irq(&clu->lock);
- vsp1_dl_fragment_free(dlb);
+ vsp1_dl_fragment_put(dlb);
return 0;
}
@@ -261,8 +261,16 @@ static void clu_configure(struct vsp1_entity *entity,
}
}
+static void clu_destroy(struct vsp1_entity *entity)
+{
+ struct vsp1_clu *clu = to_clu(&entity->subdev);
+
+ vsp1_dl_fragment_pool_free(clu->pool);
+}
+
static const struct vsp1_entity_operations clu_entity_ops = {
.configure = clu_configure,
+ .destroy = clu_destroy,
};
/* -----------------------------------------------------------------------------
@@ -288,6 +296,12 @@ struct vsp1_clu *vsp1_clu_create(struct vsp1_device *vsp1)
if (ret < 0)
return ERR_PTR(ret);
+ /* Allocate a fragment pool */
+ clu->pool = vsp1_dl_fragment_pool_alloc(clu->entity.vsp1, 2,
+ 1 + 17 * 17 * 17, 0);
+ if (!clu->pool)
+ return ERR_PTR(-ENOMEM);
+
/* Initialize the control handler. */
v4l2_ctrl_handler_init(&clu->ctrls, 2);
v4l2_ctrl_new_custom(&clu->ctrls, &clu_table_control, NULL);
@@ -36,6 +36,7 @@ struct vsp1_clu {
spinlock_t lock;
unsigned int mode;
struct vsp1_dl_body *clu;
+ struct vsp1_dl_fragment_pool *pool;
};
static inline struct vsp1_clu *to_clu(struct v4l2_subdev *subdev)
Adapt the CLU to allocate a fragment pool for passing the table updates to hardware. Two bodies are pre-allocated in the pool to manage a userspace update before the hardware has taken a previous set of tables. Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> --- drivers/media/platform/vsp1/vsp1_clu.c | 18 ++++++++++++++++-- drivers/media/platform/vsp1/vsp1_clu.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)