Message ID | 20240217112438.15240-2-hdegoede@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: atomisp: Changes for libcamera support | expand |
Quoting Hans de Goede (2024-02-17 11:24:30) > isp_subdev_propagate() is a wrapper around atomisp_subdev_set_selection() > which gets only used in a single place. > > Scall atomisp_subdev_set_selection() directly in that single place instead. s/Scall/Call/ Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > .../media/atomisp/pci/atomisp_subdev.c | 38 ++++--------------- > 1 file changed, 7 insertions(+), 31 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c > index a87fc74159e2..8293bda0c681 100644 > --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c > +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c > @@ -287,35 +287,6 @@ static void isp_get_fmt_rect(struct v4l2_subdev *sd, > } > } > > -static void isp_subdev_propagate(struct v4l2_subdev *sd, > - struct v4l2_subdev_state *sd_state, > - u32 which, uint32_t pad, uint32_t target, > - uint32_t flags) > -{ > - struct v4l2_mbus_framefmt *ffmt[ATOMISP_SUBDEV_PADS_NUM]; > - struct v4l2_rect *crop[ATOMISP_SUBDEV_PADS_NUM], > - *comp[ATOMISP_SUBDEV_PADS_NUM]; > - > - if (flags & V4L2_SEL_FLAG_KEEP_CONFIG) > - return; > - > - isp_get_fmt_rect(sd, sd_state, which, ffmt, crop, comp); > - > - switch (pad) { > - case ATOMISP_SUBDEV_PAD_SINK: { > - struct v4l2_rect r = {0}; > - > - /* Only crop target supported on sink pad. */ > - r.width = ffmt[pad]->width; > - r.height = ffmt[pad]->height; > - > - atomisp_subdev_set_selection(sd, sd_state, which, pad, > - target, flags, &r); > - break; > - } > - } > -} > - > static int isp_subdev_get_selection(struct v4l2_subdev *sd, > struct v4l2_subdev_state *sd_state, > struct v4l2_subdev_selection *sel) > @@ -541,6 +512,7 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, > case ATOMISP_SUBDEV_PAD_SINK: { > const struct atomisp_in_fmt_conv *fc = > atomisp_find_in_fmt_conv(ffmt->code); > + struct v4l2_rect r = {}; > > if (!fc) { > fc = atomisp_in_fmt_conv; > @@ -551,8 +523,12 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, > > *__ffmt = *ffmt; > > - isp_subdev_propagate(sd, sd_state, which, pad, > - V4L2_SEL_TGT_CROP, 0); > + /* Propagate new ffmt to selection */ > + r.width = ffmt->width; > + r.height = ffmt->height; > + /* Only crop target supported on sink pad. */ > + atomisp_subdev_set_selection(sd, sd_state, which, pad, > + V4L2_SEL_TGT_CROP, 0, &r); > > if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { > atomisp_css_input_set_resolution(isp_sd, > -- > 2.43.0 >
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index a87fc74159e2..8293bda0c681 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -287,35 +287,6 @@ static void isp_get_fmt_rect(struct v4l2_subdev *sd, } } -static void isp_subdev_propagate(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - u32 which, uint32_t pad, uint32_t target, - uint32_t flags) -{ - struct v4l2_mbus_framefmt *ffmt[ATOMISP_SUBDEV_PADS_NUM]; - struct v4l2_rect *crop[ATOMISP_SUBDEV_PADS_NUM], - *comp[ATOMISP_SUBDEV_PADS_NUM]; - - if (flags & V4L2_SEL_FLAG_KEEP_CONFIG) - return; - - isp_get_fmt_rect(sd, sd_state, which, ffmt, crop, comp); - - switch (pad) { - case ATOMISP_SUBDEV_PAD_SINK: { - struct v4l2_rect r = {0}; - - /* Only crop target supported on sink pad. */ - r.width = ffmt[pad]->width; - r.height = ffmt[pad]->height; - - atomisp_subdev_set_selection(sd, sd_state, which, pad, - target, flags, &r); - break; - } - } -} - static int isp_subdev_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_selection *sel) @@ -541,6 +512,7 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, case ATOMISP_SUBDEV_PAD_SINK: { const struct atomisp_in_fmt_conv *fc = atomisp_find_in_fmt_conv(ffmt->code); + struct v4l2_rect r = {}; if (!fc) { fc = atomisp_in_fmt_conv; @@ -551,8 +523,12 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, *__ffmt = *ffmt; - isp_subdev_propagate(sd, sd_state, which, pad, - V4L2_SEL_TGT_CROP, 0); + /* Propagate new ffmt to selection */ + r.width = ffmt->width; + r.height = ffmt->height; + /* Only crop target supported on sink pad. */ + atomisp_subdev_set_selection(sd, sd_state, which, pad, + V4L2_SEL_TGT_CROP, 0, &r); if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { atomisp_css_input_set_resolution(isp_sd,
isp_subdev_propagate() is a wrapper around atomisp_subdev_set_selection() which gets only used in a single place. Scall atomisp_subdev_set_selection() directly in that single place instead. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- .../media/atomisp/pci/atomisp_subdev.c | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-)