Message ID | 20211017182449.64192-10-jacopo+renesas@jmondi.org (mailing list archive) |
---|---|
State | New |
Delegated to: | Kieran Bingham |
Headers | show |
Series | media: Add multiplexed support to R-Car CSI-2 and GMSL | expand |
Hi Jacopo, Thank you for the patch. On Sun, Oct 17, 2021 at 08:24:45PM +0200, Jacopo Mondi wrote: > Add the set_routing() subdev operation to allow userspace to configure > routing on the R-Car CSI-2 receiver. > > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> > --- > drivers/media/platform/rcar-vin/rcar-csi2.c | 40 +++++++++++++++------ > 1 file changed, 29 insertions(+), 11 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c > index a74087b49e71..451a6da26e03 100644 > --- a/drivers/media/platform/rcar-vin/rcar-csi2.c > +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c > @@ -752,6 +752,33 @@ static int rcsi2_get_pad_format(struct v4l2_subdev *sd, > return 0; > } > > +static int _rcsi2_set_routing(struct v4l2_subdev *sd, __ is more customary. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + struct v4l2_subdev_state *state, > + struct v4l2_subdev_krouting *routing) > +{ > + int ret; > + > + ret = v4l2_routing_simple_verify(routing); > + if (ret) > + return ret; > + > + state = v4l2_subdev_validate_and_lock_state(sd, state); > + > + ret = v4l2_subdev_set_routing(sd, state, routing); > + > + v4l2_subdev_unlock_state(state); > + > + return ret; > +} > + > +static int rcsi2_set_routing(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state, > + enum v4l2_subdev_format_whence which, > + struct v4l2_subdev_krouting *routing) > +{ > + return _rcsi2_set_routing(sd, state, routing); > +} > + > static int rcsi2_init_cfg(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state) > { > @@ -792,17 +819,7 @@ static int rcsi2_init_cfg(struct v4l2_subdev *sd, > .routes = routes, > }; > > - int ret = v4l2_routing_simple_verify(&routing); > - if (ret) > - return ret; > - > - state = v4l2_subdev_validate_and_lock_state(sd, state); > - > - ret = v4l2_subdev_set_routing(sd, state, &routing); > - > - v4l2_subdev_unlock_state(state); > - > - return ret; > + return _rcsi2_set_routing(sd, state, &routing); > } > > static const struct v4l2_subdev_video_ops rcar_csi2_video_ops = { > @@ -813,6 +830,7 @@ static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = { > .init_cfg = rcsi2_init_cfg, > .set_fmt = rcsi2_set_pad_format, > .get_fmt = rcsi2_get_pad_format, > + .set_routing = rcsi2_set_routing, > }; > > static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c index a74087b49e71..451a6da26e03 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -752,6 +752,33 @@ static int rcsi2_get_pad_format(struct v4l2_subdev *sd, return 0; } +static int _rcsi2_set_routing(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + struct v4l2_subdev_krouting *routing) +{ + int ret; + + ret = v4l2_routing_simple_verify(routing); + if (ret) + return ret; + + state = v4l2_subdev_validate_and_lock_state(sd, state); + + ret = v4l2_subdev_set_routing(sd, state, routing); + + v4l2_subdev_unlock_state(state); + + return ret; +} + +static int rcsi2_set_routing(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + enum v4l2_subdev_format_whence which, + struct v4l2_subdev_krouting *routing) +{ + return _rcsi2_set_routing(sd, state, routing); +} + static int rcsi2_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { @@ -792,17 +819,7 @@ static int rcsi2_init_cfg(struct v4l2_subdev *sd, .routes = routes, }; - int ret = v4l2_routing_simple_verify(&routing); - if (ret) - return ret; - - state = v4l2_subdev_validate_and_lock_state(sd, state); - - ret = v4l2_subdev_set_routing(sd, state, &routing); - - v4l2_subdev_unlock_state(state); - - return ret; + return _rcsi2_set_routing(sd, state, &routing); } static const struct v4l2_subdev_video_ops rcar_csi2_video_ops = { @@ -813,6 +830,7 @@ static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = { .init_cfg = rcsi2_init_cfg, .set_fmt = rcsi2_set_pad_format, .get_fmt = rcsi2_get_pad_format, + .set_routing = rcsi2_set_routing, }; static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
Add the set_routing() subdev operation to allow userspace to configure routing on the R-Car CSI-2 receiver. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> --- drivers/media/platform/rcar-vin/rcar-csi2.c | 40 +++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-)