Commit 769d5fe4 authored by Laurent Pinchart's avatar Laurent Pinchart

media: renesas: vsp1: Drop vsp1_entity_get_pad_selection() wrapper

The vsp1_entity_get_pad_selection() function is just a wrapper around
v4l2_subdev_state_get_crop() or v4l2_subdev_state_get_compose() without
any added value. Drop it and call the functions it wraps directly.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
parent 0aaf7db0
...@@ -127,32 +127,6 @@ vsp1_entity_get_state(struct vsp1_entity *entity, ...@@ -127,32 +127,6 @@ vsp1_entity_get_state(struct vsp1_entity *entity,
} }
} }
/**
* vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
* @entity: the entity
* @sd_state: the state storage
* @pad: the pad number
* @target: the selection target
*
* Return the selection rectangle stored in the given configuration for an
* entity's pad. The configuration can be an ACTIVE or TRY configuration. The
* selection target can be COMPOSE or CROP.
*/
struct v4l2_rect *
vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state,
unsigned int pad, unsigned int target)
{
switch (target) {
case V4L2_SEL_TGT_COMPOSE:
return v4l2_subdev_state_get_compose(sd_state, pad);
case V4L2_SEL_TGT_CROP:
return v4l2_subdev_state_get_crop(sd_state, pad);
default:
return NULL;
}
}
/* /*
* vsp1_subdev_get_pad_format - Subdev pad get_fmt handler * vsp1_subdev_get_pad_format - Subdev pad get_fmt handler
* @subdev: V4L2 subdevice * @subdev: V4L2 subdevice
...@@ -361,15 +335,13 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, ...@@ -361,15 +335,13 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
*format = fmt->format; *format = fmt->format;
/* Reset the crop and compose rectangles. */ /* Reset the crop and compose rectangles. */
selection = vsp1_entity_get_pad_selection(entity, state, fmt->pad, selection = v4l2_subdev_state_get_crop(state, fmt->pad);
V4L2_SEL_TGT_CROP);
selection->left = 0; selection->left = 0;
selection->top = 0; selection->top = 0;
selection->width = format->width; selection->width = format->width;
selection->height = format->height; selection->height = format->height;
selection = vsp1_entity_get_pad_selection(entity, state, fmt->pad, selection = v4l2_subdev_state_get_compose(state, fmt->pad);
V4L2_SEL_TGT_COMPOSE);
selection->left = 0; selection->left = 0;
selection->top = 0; selection->top = 0;
selection->width = format->width; selection->width = format->width;
......
...@@ -138,10 +138,6 @@ struct v4l2_subdev_state * ...@@ -138,10 +138,6 @@ struct v4l2_subdev_state *
vsp1_entity_get_state(struct vsp1_entity *entity, vsp1_entity_get_state(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
enum v4l2_subdev_format_whence which); enum v4l2_subdev_format_whence which);
struct v4l2_rect *
vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state,
unsigned int pad, unsigned int target);
void vsp1_entity_route_setup(struct vsp1_entity *entity, void vsp1_entity_route_setup(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
......
...@@ -140,11 +140,8 @@ static void hgo_configure_stream(struct vsp1_entity *entity, ...@@ -140,11 +140,8 @@ static void hgo_configure_stream(struct vsp1_entity *entity,
unsigned int hratio; unsigned int hratio;
unsigned int vratio; unsigned int vratio;
crop = vsp1_entity_get_pad_selection(entity, entity->state, crop = v4l2_subdev_state_get_crop(entity->state, HISTO_PAD_SINK);
HISTO_PAD_SINK, V4L2_SEL_TGT_CROP); compose = v4l2_subdev_state_get_compose(entity->state, HISTO_PAD_SINK);
compose = vsp1_entity_get_pad_selection(entity, entity->state,
HISTO_PAD_SINK,
V4L2_SEL_TGT_COMPOSE);
vsp1_hgo_write(hgo, dlb, VI6_HGO_REGRST, VI6_HGO_REGRST_RCLEA); vsp1_hgo_write(hgo, dlb, VI6_HGO_REGRST, VI6_HGO_REGRST_RCLEA);
......
...@@ -139,11 +139,8 @@ static void hgt_configure_stream(struct vsp1_entity *entity, ...@@ -139,11 +139,8 @@ static void hgt_configure_stream(struct vsp1_entity *entity,
u8 upper; u8 upper;
unsigned int i; unsigned int i;
crop = vsp1_entity_get_pad_selection(entity, entity->state, crop = v4l2_subdev_state_get_crop(entity->state, HISTO_PAD_SINK);
HISTO_PAD_SINK, V4L2_SEL_TGT_CROP); compose = v4l2_subdev_state_get_compose(entity->state, HISTO_PAD_SINK);
compose = vsp1_entity_get_pad_selection(entity, entity->state,
HISTO_PAD_SINK,
V4L2_SEL_TGT_COMPOSE);
vsp1_hgt_write(hgt, dlb, VI6_HGT_REGRST, VI6_HGT_REGRST_RCLEA); vsp1_hgt_write(hgt, dlb, VI6_HGT_REGRST, VI6_HGT_REGRST_RCLEA);
......
...@@ -218,9 +218,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, ...@@ -218,9 +218,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev,
switch (sel->target) { switch (sel->target) {
case V4L2_SEL_TGT_COMPOSE_BOUNDS: case V4L2_SEL_TGT_COMPOSE_BOUNDS:
case V4L2_SEL_TGT_COMPOSE_DEFAULT: case V4L2_SEL_TGT_COMPOSE_DEFAULT:
crop = vsp1_entity_get_pad_selection(&histo->entity, state, crop = v4l2_subdev_state_get_crop(state, HISTO_PAD_SINK);
HISTO_PAD_SINK,
V4L2_SEL_TGT_CROP);
sel->r.left = 0; sel->r.left = 0;
sel->r.top = 0; sel->r.top = 0;
sel->r.width = crop->width; sel->r.width = crop->width;
...@@ -237,9 +235,11 @@ static int histo_get_selection(struct v4l2_subdev *subdev, ...@@ -237,9 +235,11 @@ static int histo_get_selection(struct v4l2_subdev *subdev,
break; break;
case V4L2_SEL_TGT_COMPOSE: case V4L2_SEL_TGT_COMPOSE:
sel->r = *v4l2_subdev_state_get_compose(state, sel->pad);
break;
case V4L2_SEL_TGT_CROP: case V4L2_SEL_TGT_CROP:
sel->r = *vsp1_entity_get_pad_selection(&histo->entity, state, sel->r = *v4l2_subdev_state_get_crop(state, sel->pad);
sel->pad, sel->target);
break; break;
default: default:
...@@ -256,9 +256,7 @@ static int histo_set_crop(struct v4l2_subdev *subdev, ...@@ -256,9 +256,7 @@ static int histo_set_crop(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel) struct v4l2_subdev_selection *sel)
{ {
struct vsp1_histogram *histo = subdev_to_histo(subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
struct v4l2_rect *selection;
/* The crop rectangle must be inside the input frame. */ /* The crop rectangle must be inside the input frame. */
format = v4l2_subdev_state_get_format(sd_state, HISTO_PAD_SINK); format = v4l2_subdev_state_get_format(sd_state, HISTO_PAD_SINK);
...@@ -270,14 +268,8 @@ static int histo_set_crop(struct v4l2_subdev *subdev, ...@@ -270,14 +268,8 @@ static int histo_set_crop(struct v4l2_subdev *subdev,
format->height - sel->r.top); format->height - sel->r.top);
/* Set the crop rectangle and reset the compose rectangle. */ /* Set the crop rectangle and reset the compose rectangle. */
selection = vsp1_entity_get_pad_selection(&histo->entity, sd_state, *v4l2_subdev_state_get_crop(sd_state, sel->pad) = sel->r;
sel->pad, V4L2_SEL_TGT_CROP); *v4l2_subdev_state_get_compose(sd_state, sel->pad) = sel->r;
*selection = sel->r;
selection = vsp1_entity_get_pad_selection(&histo->entity, sd_state,
sel->pad,
V4L2_SEL_TGT_COMPOSE);
*selection = sel->r;
return 0; return 0;
} }
...@@ -286,7 +278,6 @@ static int histo_set_compose(struct v4l2_subdev *subdev, ...@@ -286,7 +278,6 @@ static int histo_set_compose(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel) struct v4l2_subdev_selection *sel)
{ {
struct vsp1_histogram *histo = subdev_to_histo(subdev);
struct v4l2_rect *compose; struct v4l2_rect *compose;
struct v4l2_rect *crop; struct v4l2_rect *crop;
unsigned int ratio; unsigned int ratio;
...@@ -299,9 +290,7 @@ static int histo_set_compose(struct v4l2_subdev *subdev, ...@@ -299,9 +290,7 @@ static int histo_set_compose(struct v4l2_subdev *subdev,
sel->r.left = 0; sel->r.left = 0;
sel->r.top = 0; sel->r.top = 0;
crop = vsp1_entity_get_pad_selection(&histo->entity, sd_state, crop = v4l2_subdev_state_get_crop(sd_state, sel->pad);
sel->pad,
V4L2_SEL_TGT_CROP);
/* /*
* Clamp the width and height to acceptable values first and then * Clamp the width and height to acceptable values first and then
...@@ -326,9 +315,7 @@ static int histo_set_compose(struct v4l2_subdev *subdev, ...@@ -326,9 +315,7 @@ static int histo_set_compose(struct v4l2_subdev *subdev,
ratio = 1 << (crop->height * 2 / sel->r.height / 3); ratio = 1 << (crop->height * 2 / sel->r.height / 3);
sel->r.height = crop->height / ratio; sel->r.height = crop->height / ratio;
compose = vsp1_entity_get_pad_selection(&histo->entity, sd_state, compose = v4l2_subdev_state_get_compose(sd_state, sel->pad);
sel->pad,
V4L2_SEL_TGT_COMPOSE);
*compose = sel->r; *compose = sel->r;
return 0; return 0;
......
...@@ -155,10 +155,8 @@ static void rpf_configure_stream(struct vsp1_entity *entity, ...@@ -155,10 +155,8 @@ static void rpf_configure_stream(struct vsp1_entity *entity,
if (pipe->brx) { if (pipe->brx) {
const struct v4l2_rect *compose; const struct v4l2_rect *compose;
compose = vsp1_entity_get_pad_selection(pipe->brx, compose = v4l2_subdev_state_get_compose(pipe->brx->state,
pipe->brx->state, rpf->brx_input);
rpf->brx_input,
V4L2_SEL_TGT_COMPOSE);
left = compose->left; left = compose->left;
top = compose->top; top = compose->top;
} }
......
...@@ -112,8 +112,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, ...@@ -112,8 +112,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev,
break; break;
case V4L2_SEL_TGT_CROP: case V4L2_SEL_TGT_CROP:
sel->r = *vsp1_entity_get_pad_selection(&uif->entity, state, sel->r = *v4l2_subdev_state_get_crop(state, sel->pad);
sel->pad, sel->target);
break; break;
default: default:
...@@ -159,8 +158,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, ...@@ -159,8 +158,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev,
format->height - sel->r.top); format->height - sel->r.top);
/* Store the crop rectangle. */ /* Store the crop rectangle. */
selection = vsp1_entity_get_pad_selection(&uif->entity, state, selection = v4l2_subdev_state_get_crop(state, sel->pad);
sel->pad, V4L2_SEL_TGT_CROP);
*selection = sel->r; *selection = sel->r;
done: done:
...@@ -202,8 +200,7 @@ static void uif_configure_stream(struct vsp1_entity *entity, ...@@ -202,8 +200,7 @@ static void uif_configure_stream(struct vsp1_entity *entity,
vsp1_uif_write(uif, dlb, VI6_UIF_DISCOM_DOCMPMR, vsp1_uif_write(uif, dlb, VI6_UIF_DISCOM_DOCMPMR,
VI6_UIF_DISCOM_DOCMPMR_SEL(9)); VI6_UIF_DISCOM_DOCMPMR_SEL(9));
crop = vsp1_entity_get_pad_selection(entity, entity->state, crop = v4l2_subdev_state_get_crop(entity->state, UIF_PAD_SINK);
UIF_PAD_SINK, V4L2_SEL_TGT_CROP);
left = crop->left; left = crop->left;
width = crop->width; width = crop->width;
......
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