All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Vaishnav Achath <vaishnav.a@ti.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mripard@kernel.org, mchehab@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, sakari.ailus@linux.intel.com,
	linux-kernel@vger.kernel.org, bparrot@ti.com,
	niklas.soderlund+renesas@ragnatech.se, j-luthra@ti.com,
	devarsht@ti.com, praneeth@ti.com, u-kumar1@ti.com,
	vigneshr@ti.com, nm@ti.com, martyn.welch@collabora.com
Subject: Re: [PATCH v7 10/13] media: ti: Add CSI2RX support for J721E
Date: Tue, 4 Apr 2023 14:43:05 +0300	[thread overview]
Message-ID: <781c9273-24c5-8b0d-b810-a5eb9b98679e@ideasonboard.com> (raw)
In-Reply-To: <20230324181425.GM18895@pendragon.ideasonboard.com>

On 24/03/2023 20:14, Laurent Pinchart wrote:

>> +static int ti_csi2rx_link_validate_get_fmt(struct media_pad *pad,
>> +					   struct v4l2_subdev_format *fmt)
>> +{
>> +	if (is_media_entity_v4l2_subdev(pad->entity)) {
>> +		struct v4l2_subdev *sd =
>> +			media_entity_to_v4l2_subdev(pad->entity);
>> +
>> +		fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE;
>> +		fmt->pad = pad->index;
>> +		return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
> 
> This will crash with any source that uses the subdev active state. You
> can't pass NULL for the state here.
> 
> How about exporting v4l2_subdev_link_validate_get_format() instead, to
> replace this function ?

I don't think that's a good idea, or needed. 
v4l2_subdev_link_validate_get_format() is an internal helper. Exporting 
it would potentially make maintenance more difficult in the future.

Here, you know the source is the cdns csi2rx. It's always a subdev, so 
is_media_entity_v4l2_subdev() is not needed (I'm not sure why it's used 
in v4l2_subdev_link_validate_get_format either...).

You can use v4l2_subdev_call_state_active() to call the get_fmt here.

Also, the fmt doesn't seem to be initialized to zero, so it'll contain 
garbage in, e.g. the stream field.

Moving to another topic, cdns-csi2rx driver is already (before this 
series) in upstream, but afaics j7 is the only user for it. In other 
words, it's not in use before this series.

I think it would make sense to convert cdns-csi2rx to use subdev state 
first, before adding the j7 csi2rx. That shouldn't be much work, and 
will clean up the driver nicely. With that you could also simplify the 
ti_csi2rx_link_validate by just locking the cdns csi2rx state, and using 
it directly, without using get_fmt and getting the copy of the format. 
It would also help later when adding streams support.

Personally I'd go straight to streams support, as adding it afterwards 
might have some pain points (based on my CAL experience...). At least 
WIP streams patches on top would be a very good thing to have, as they 
will highlight if there are any major changes needed.

  Tomi


  parent reply	other threads:[~2023-04-04 11:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 11:55 [PATCH v7 00/13] CSI2RX support on J721E Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 01/13] media: cadence: csi2rx: Unregister v4l2 async notifier Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 02/13] media: cadence: csi2rx: Cleanup media entity properly Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 03/13] media: cadence: csi2rx: Add get_fmt and set_fmt pad ops Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 04/13] media: cadence: csi2rx: Add external DPHY support Vaishnav Achath
2023-03-31 13:19   ` Sakari Ailus
2023-03-14 11:55 ` [PATCH v7 05/13] media: cadence: csi2rx: Soft reset the streams before starting capture Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 06/13] media: cadence: csi2rx: Set the STOP bit when stopping a stream Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 07/13] media: cadence: csi2rx: Fix stream data configuration Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 08/13] media: cadence: csi2rx: Populate subdev devnode Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 09/13] media: cadence: csi2rx: Add link validation Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 10/13] media: ti: Add CSI2RX support for J721E Vaishnav Achath
2023-03-20 12:51   ` Jai Luthra
2023-03-24 18:14   ` Laurent Pinchart
2023-03-28  8:19     ` Vaishnav Achath
2023-04-04 11:43     ` Tomi Valkeinen [this message]
2023-03-31 13:27   ` Sakari Ailus
2023-03-14 11:55 ` [PATCH v7 11/13] media: dt-bindings: Make sure items in data-lanes are unique Vaishnav Achath
2023-03-14 11:55 ` [PATCH v7 12/13] media: dt-bindings: Add DT bindings for TI J721E CSI2RX driver Vaishnav Achath
2023-03-14 14:10   ` Rob Herring
2023-03-15  7:44   ` Krzysztof Kozlowski
2023-03-14 11:55 ` [PATCH v7 13/13] media: dt-bindings: Convert Cadence CSI2RX binding to YAML Vaishnav Achath
2023-03-15  7:45   ` Krzysztof Kozlowski
2023-03-20  5:34     ` Vaishnav Achath
2023-03-23 19:36 ` [PATCH v7 00/13] CSI2RX support on J721E Martyn Welch
2023-03-28  6:01   ` Jai Luthra
2023-03-29 15:17     ` Martyn Welch
2023-04-04  8:44 ` Tomi Valkeinen
2023-06-22  9:18   ` Julien Massot
2023-06-22 11:04     ` Jai Luthra

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=781c9273-24c5-8b0d-b810-a5eb9b98679e@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=bparrot@ti.com \
    --cc=devarsht@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=j-luthra@ti.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martyn.welch@collabora.com \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=nm@ti.com \
    --cc=praneeth@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=u-kumar1@ti.com \
    --cc=vaishnav.a@ti.com \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.