Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Rui Miguel Silva <rmfrfs@gmail.com>
Cc: linux-media@vger.kernel.org, Jacopo Mondi <jacopo@jmondi.org>,
	Paul Elder <paul.elder@ideasonboard.com>,
	kernel@pengutronix.de, linux-imx@nxp.com
Subject: Re: [PATCH 3/4] media: imx: imx-mipi-csis: Implement the .get_frame_desc() operation
Date: Thu, 16 Jun 2022 02:59:32 +0300	[thread overview]
Message-ID: <YqpyZOvD3f9MFq39@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220615235314.umyosoxusngzmvey@arch-thunder>

Hi Rui,

On Thu, Jun 16, 2022 at 12:53:14AM +0100, Rui Miguel Silva wrote:
> On Wed, Jun 15, 2022 at 10:26:01PM +0300, Laurent Pinchart wrote:
> > The CSIS is connected to its sink through an SoC-specific gasket that
> > needs to be configured. Depending on the platform, the gasket
> > configuration requires knowing the CSI-2 DT. To provide the needed
> > information, implement the .get_frame_desc() operation.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  drivers/media/platform/nxp/imx-mipi-csis.c | 27 ++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> > index 8674aaad5fa0..905072871ed2 100644
> > --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> > +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> > @@ -1160,6 +1160,32 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd,
> >  	return 0;
> >  }
> >  
> > +static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> > +				    struct v4l2_mbus_frame_desc *fd)
> > +{
> > +	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> > +	struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[0];
> 
> Think that you should check *fd before use here, other than that.

fd isn't supposed to be null, the same way sd isn't, or the various
format pointers passed to other subdev operations aren't. We don't check
those either, that's why I haven't checked fd here.

> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
> 
> > +
> > +	if (pad != CSIS_PAD_SOURCE)
> > +		return -EINVAL;
> > +
> > +	fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
> > +	fd->num_entries = 1;
> > +
> > +	memset(entry, 0, sizeof(*entry));
> > +
> > +	mutex_lock(&csis->lock);
> > +
> > +	entry->flags = 0;
> > +	entry->pixelcode = csis->csis_fmt->code;
> > +	entry->bus.csi2.vc = 0;
> > +	entry->bus.csi2.dt = csis->csis_fmt->data_type;
> > +
> > +	mutex_unlock(&csis->lock);
> > +
> > +	return 0;
> > +}
> > +
> >  static int mipi_csis_log_status(struct v4l2_subdev *sd)
> >  {
> >  	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> > @@ -1184,6 +1210,7 @@ static const struct v4l2_subdev_pad_ops mipi_csis_pad_ops = {
> >  	.enum_mbus_code		= mipi_csis_enum_mbus_code,
> >  	.get_fmt		= mipi_csis_get_fmt,
> >  	.set_fmt		= mipi_csis_set_fmt,
> > +	.get_frame_desc		= mipi_csis_get_frame_desc,
> >  };
> >  
> >  static const struct v4l2_subdev_ops mipi_csis_subdev_ops = {

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-06-15 23:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 19:25 [PATCH 0/4] media: imx: imx-mipi-csis: Add i.MX8MP support Laurent Pinchart
2022-06-15 19:25 ` [PATCH 1/4] media: imx: imx-mipi-csis: Set the subdev fwnode for endpoint matching Laurent Pinchart
2022-06-15 23:50   ` Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 2/4] media: imx: imx-mipi-csis: Add version register Laurent Pinchart
2022-06-15 23:51   ` Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 3/4] media: imx: imx-mipi-csis: Implement the .get_frame_desc() operation Laurent Pinchart
2022-06-15 23:53   ` Rui Miguel Silva
2022-06-15 23:59     ` Laurent Pinchart [this message]
2022-06-16  0:09       ` Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 4/4] dt-bindings: media: nxp,imx-mipi-csi2: i.MX8MP support Laurent Pinchart
2022-06-15 21:01   ` Krzysztof Kozlowski

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=YqpyZOvD3f9MFq39@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=rmfrfs@gmail.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