public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Julien Massot <julien.massot@collabora.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	kernel@collabora.com, linux-kernel@vger.kernel.org,
	mchehab@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 4/4] media: i2c: add MAX96714 driver
Date: Wed, 24 Apr 2024 08:30:22 +0000	[thread overview]
Message-ID: <ZijDHtSa2vACgBjl@valkosipuli.retiisi.eu> (raw)
In-Reply-To: <a70e3792-b938-4c20-840d-5dfa9bdc4b9c@collabora.com>

Hi Julien,

On Tue, Apr 23, 2024 at 04:01:16PM +0200, Julien Massot wrote:

...

> > > +static int max96714_enable_streams(struct v4l2_subdev *sd,
> > > +				   struct v4l2_subdev_state *state,
> > > +				   u32 source_pad, u64 streams_mask)
> > > +{
> > > +	struct max96714_priv *priv = sd_to_max96714(sd);
> > > +	u64 sink_streams;
> > > +	int ret;
> > > +
> > > +	if (!priv->enabled_source_streams)
> > > +		max96714_enable_tx_port(priv);
> > > +
> > > +	ret = max96714_apply_patgen(priv, state);
> > > +	if (ret)
> > > +		goto err;
> > > +
> > > +	if (!priv->pattern) {
> > > +		if (!priv->rxport.source.sd) {
> > > +			ret = -ENODEV;
> > > +			goto err;
> > > +		}
> > > +
> > > +		sink_streams =
> > > +			v4l2_subdev_state_xlate_streams(state,
> > > +							MAX96714_PAD_SOURCE,
> > > +							MAX96714_PAD_SINK,
> > > +							&streams_mask);
> > > +
> > > +		ret = v4l2_subdev_enable_streams(priv->rxport.source.sd,
> > > +						 priv->rxport.source.pad,
> > > +						 sink_streams);
> > > +		if (ret)
> > > +			goto err;
> > > +	}
> > > +
> > > +	priv->enabled_source_streams |= streams_mask;
> > > +
> > > +	return 0;
> > > +
> > > +err:
> > > +	if (!priv->enabled_source_streams)
> > > +		max96714_disable_tx_port(priv);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static int max96714_disable_streams(struct v4l2_subdev *sd,
> > > +				    struct v4l2_subdev_state *state,
> > > +				    u32 source_pad, u64 streams_mask)
> > > +{
> > > +	struct max96714_priv *priv = sd_to_max96714(sd);
> > > +	u64 sink_streams;
> > > +	int ret;
> > > +
> > > +	if (!priv->pattern && priv->rxport.source.sd) {
> > 
> > When will priv->rxport.source.sd be NULL here?
> 
> Indeed it should not, the priv->rxport.source.sd can only be null if:
> - There is no serializer
> - The stream has been started with pattern generator and the pattern
> generator
> has been disabled while streaming.

It seems priv->rxport.source.sd is also accessed in
max96714_enable_streams() without such a check.

> 
> In V7 I will drop this check and add another one to prevent disabling the
> pattern
> generator while streaming.

Sounds good.

> > > +static void max96714_v4l2_notifier_unregister(struct max96714_priv *priv)
> > > +{
> > > +	v4l2_async_nf_unregister(&priv->notifier);
> > > +	v4l2_async_nf_cleanup(&priv->notifier);
> > 
> > It'd be nicer to call these directly IMO. Maybe we could introduce
> > v4l2_async_nf_unregister_cleanup()? Feel free to post a patch. :-)
> Ok, I will call these directly, and I will do the same for the MAX96717
> serializer.
> 
> I will post a patchset later introducing the
> `v4l2_async_nf_unregister_cleanup`
> and converting all the drivers calling these two functions.

That would be nice. :-) It should be easy to do that with Coccinelle.

...

> > > +	ret = max96714_enable_core_hw(priv);
> > 
> > Please switch to runtime PM.
> 
> Ok, the v7 will use runtime PM and I will use the powerdown gpio
> to poweroff the device. However it implies to move some functions arround
> e.g initialize the tx or the pattern generator ..
> So it it will be done as separate patches.
> 
> Playing with the pm_runtime operation also showed up that the connection
> doesn't always resume properly, I will extra patches to fix that.

Ack.

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2024-04-24  8:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 13:16 [PATCH v6 0/4] Add support for MAX96714/F and MAX96717/F GMSL2 ser/des Julien Massot
2024-03-25 13:16 ` [PATCH v6 1/4] dt-bindings: media: add Maxim MAX96717 GMSL2 Serializer Julien Massot
2024-03-25 18:17   ` Conor Dooley
2024-04-12 11:10   ` Sakari Ailus
2024-04-23 13:36     ` Julien Massot
2024-04-23 21:43       ` Sakari Ailus
2024-03-25 13:16 ` [PATCH v6 2/4] dt-bindings: media: add Maxim MAX96714 GMSL2 Deserializer Julien Massot
2024-03-25 18:41   ` Conor Dooley
2024-03-25 13:16 ` [PATCH v6 3/4] media: i2c: add MAX96717 driver Julien Massot
2024-04-12 11:23   ` Sakari Ailus
2024-04-23 13:38     ` Julien Massot
2024-03-25 13:16 ` [PATCH v6 4/4] media: i2c: add MAX96714 driver Julien Massot
2024-04-12 11:25   ` Sakari Ailus
2024-04-23 14:01     ` Julien Massot
2024-04-24  8:30       ` Sakari Ailus [this message]
2024-04-24  8:42         ` Julien Massot
2024-04-24  8:45           ` Sakari Ailus

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=ZijDHtSa2vACgBjl@valkosipuli.retiisi.eu \
    --to=sakari.ailus@iki.fi \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=julien.massot@collabora.com \
    --cc=kernel@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    /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