From: Jacopo Mondi <jacopo@jmondi.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
tomi.valkeinen@ideasonboard.com, sakari.ailus@linux.intel.com,
niklas.soderlund@ragnatech.se, kieran.bingham@ideasonboard.com,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v4 6/6] media: max9286: Implement get_frame_desc()
Date: Fri, 17 Dec 2021 15:12:05 +0100 [thread overview]
Message-ID: <20211217141205.6fu4psfq734hpeze@uno.localdomain> (raw)
In-Reply-To: <Ybv5roGoqemlQ/NH@pendragon.ideasonboard.com>
Hi Laurent,
On Fri, Dec 17, 2021 at 04:45:02AM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Thu, Dec 16, 2021 at 06:47:46PM +0100, Jacopo Mondi wrote:
> > Implement the get_frame_desc pad operation to allow retrieving the
> > stream configuration of the max9286 subdevice.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > ---
> > drivers/media/i2c/max9286.c | 53 +++++++++++++++++++++++++++++++++++++
> > 1 file changed, 53 insertions(+)
> >
> > diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> > index aa7cb7c10fc0..78988f2bdf91 100644
> > --- a/drivers/media/i2c/max9286.c
> > +++ b/drivers/media/i2c/max9286.c
> > @@ -876,6 +876,58 @@ static int max9286_set_fmt(struct v4l2_subdev *sd,
> > return ret;
> > }
> >
> > +static int max9286_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> > + struct v4l2_mbus_frame_desc *fd)
> > +{
> > + struct v4l2_subdev_route *route;
> > + struct v4l2_subdev_state *state;
> > + int ret = 0;
> > +
> > + if (pad != MAX9286_SRC_PAD)
> > + return -EINVAL;
> > +
> > + state = v4l2_subdev_lock_active_state(sd);
> > +
> > + memset(fd, 0, sizeof(*fd));
> > +
> > + /* One stream entry per each connected route. */
> > + for_each_active_route(&state->routing, route) {
> > + struct v4l2_mbus_frame_desc_entry *entry =
> > + &fd->entry[fd->num_entries];
> > + struct v4l2_mbus_framefmt *fmt;
>
> This can be const.
>
Indeed!
> > +
> > + fmt = v4l2_state_get_stream_format(state, pad,
> > + route->source_stream);
> > + if (!fmt) {
> > + ret = -EINVAL;
> > + goto out;
> > + }
> > +
> > + /*
> > + * Assume a YUYV format (0x1e DT) and 16 bpp: we only support
> > + * these formats at the moment.
> > + */
> > + entry->stream = fd->num_entries++;
> > + entry->flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
> > + entry->length = fmt->width * fmt->height * 16 / 8;
> > + entry->pixelcode = fmt->code;
> > +
> > + /*
> > + * The source stream id corresponds to the virtual channel a
> > + * stream is output on.
> > + */
> > + entry->bus.csi2.vc = route->source_stream;
> > + entry->bus.csi2.dt = 0x1e;
>
> A header file for the CSI-2 data types could be useful (out of scope for
> this series, unless you insist :-)).
Nice try!
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Thanks
j
>
> > + }
> > +
> > + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> > +
> > +out:
> > + v4l2_subdev_unlock_state(state);
> > +
> > + return ret;
> > +}
> > +
> > static int max9286_routing_validate(struct max9286_priv *priv,
> > struct v4l2_subdev_krouting *routing)
> > {
> > @@ -1025,6 +1077,7 @@ static const struct v4l2_subdev_pad_ops max9286_pad_ops = {
> > .enum_mbus_code = max9286_enum_mbus_code,
> > .get_fmt = v4l2_subdev_get_fmt,
> > .set_fmt = max9286_set_fmt,
> > + .get_frame_desc = max9286_get_frame_desc,
> > .set_routing = max9286_set_routing,
> > };
> >
>
> --
> Regards,
>
> Laurent Pinchart
prev parent reply other threads:[~2021-12-17 14:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 17:47 [PATCH v4 0/6] media: max9286: Add multiplexed streams support Jacopo Mondi
2021-12-16 17:47 ` [PATCH v4 1/6] media: max9286: Add support for v4l2_subdev_state Jacopo Mondi
2021-12-16 18:33 ` Laurent Pinchart
2021-12-16 17:47 ` [PATCH v4 2/6] media: max9286: Implement set_routing Jacopo Mondi
2021-12-17 1:56 ` Laurent Pinchart
2021-12-17 2:18 ` Laurent Pinchart
2021-12-17 2:24 ` Laurent Pinchart
2021-12-17 13:28 ` Jacopo Mondi
2021-12-16 17:47 ` [PATCH v4 3/6] media: max9286: Use enabled routes to calculate pixelrate Jacopo Mondi
2021-12-17 2:29 ` Laurent Pinchart
2021-12-17 13:32 ` Jacopo Mondi
2021-12-16 17:47 ` [PATCH v4 4/6] media: max9286: Use routes to configure link order Jacopo Mondi
2021-12-17 2:35 ` Laurent Pinchart
2021-12-17 13:38 ` Jacopo Mondi
2021-12-16 17:47 ` [PATCH v4 5/6] media: max9286: Move format to subdev state Jacopo Mondi
2021-12-17 2:40 ` Laurent Pinchart
2021-12-17 3:09 ` Laurent Pinchart
2021-12-17 14:11 ` Jacopo Mondi
2024-05-09 13:11 ` Laurent Pinchart
2021-12-16 17:47 ` [PATCH v4 6/6] media: max9286: Implement get_frame_desc() Jacopo Mondi
2021-12-17 2:45 ` Laurent Pinchart
2021-12-17 14:12 ` Jacopo Mondi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211217141205.6fu4psfq734hpeze@uno.localdomain \
--to=jacopo@jmondi.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo+renesas@jmondi.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).