mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Jacopo Mondi" <jacopo@jmondi.org>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v3 4/4] media: platform: Add Renesas RZ/G2L CRU driver
Date: Tue, 25 Oct 2022 22:32:59 +0000	[thread overview]
Message-ID: <Y1hkG6NVFS08WTIg@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20221004234343.54777-5-prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi Prabhakar,

A few comments below... apologies for not reviewing this earlier. Looks
good in general but there are a few points that need some attention.

On Wed, Oct 05, 2022 at 12:43:43AM +0100, Prabhakar wrote:
...
> +static int rzg2l_cru_ip_pre_streamon(struct v4l2_subdev *sd, u32 flags)
> +{
> +	struct rzg2l_cru_dev *cru;
> +	int ret;
> +
> +	cru = v4l2_get_subdevdata(sd);
> +
> +	if (!cru->is_csi)
> +		return -EINVAL;
> +
> +	ret = v4l2_subdev_call(cru->ip.remote, video, pre_streamon, 0);

If you're calling pre_streamon successfully, you'll have to have an
equivalent number of post_streamoff calls.

...

> +static int rzg2l_cru_set_stream(struct rzg2l_cru_dev *cru, int on)
> +{
> +	struct media_pipeline *pipe;
> +	struct v4l2_subdev *sd;
> +	struct media_pad *pad;
> +	unsigned long flags;
> +	int ret;
> +
> +	pad = media_pad_remote_pad_first(&cru->pad);
> +	if (!pad)
> +		return -EPIPE;
> +
> +	sd = media_entity_to_v4l2_subdev(pad->entity);
> +
> +	if (!on) {
> +		media_pipeline_stop(&cru->vdev.entity);
> +		return v4l2_subdev_call(sd, video, s_stream, 0);

Ditto.

> +	}
> +
> +	ret = rzg2l_cru_mc_validate_format(cru, sd, pad);
> +	if (ret)
> +		return ret;
> +
> +	ret = v4l2_subdev_call(sd, video, pre_streamon, 0);
> +	if (ret == -ENOIOCTLCMD)
> +		ret = 0;
> +	if (ret)
> +		return ret;

For all cases below where streaming on doesn't succeed, you'll have to have
a call of post_streamoff.

> +
> +	spin_lock_irqsave(&cru->qlock, flags);
> +
> +	/* Select a video input */
> +	if (cru->is_csi)
> +		rzg2l_cru_write(cru, CRUnCTRL, CRUnCTRL_VINSEL(0));
> +
> +	/* Cancel the software reset for image processing block */
> +	rzg2l_cru_write(cru, CRUnRST, CRUnRST_VRESETN);
> +
> +	/* Disable and clear the interrupt before using */
> +	rzg2l_cru_write(cru, CRUnIE, 0);
> +	rzg2l_cru_write(cru, CRUnINTS, 0x001f000f);
> +
> +	/* Initialize the AXI master */
> +	rzg2l_cru_initialize_axi(cru);
> +
> +	/* Initialize image convert */
> +	ret = rzg2l_cru_initialize_image_conv(cru);
> +	if (ret) {
> +		spin_unlock_irqrestore(&cru->qlock, flags);
> +		return ret;
> +	}
> +
> +	/* Enable interrupt */
> +	rzg2l_cru_write(cru, CRUnIE, CRUnIE_EFE);
> +
> +	/* Enable image processing reception */
> +	rzg2l_cru_write(cru, ICnEN, ICnEN_ICEN);
> +
> +	spin_unlock_irqrestore(&cru->qlock, flags);
> +
> +	pipe = sd->entity.pipe ? sd->entity.pipe : &cru->vdev.pipe;
> +	ret = media_pipeline_start(&cru->vdev.entity, pipe);
> +	if (ret)
> +		return ret;
> +
> +	clk_disable_unprepare(cru->vclk);
> +
> +	ret = v4l2_subdev_call(sd, video, s_stream, 1);
> +	if (ret == -ENOIOCTLCMD)
> +		ret = 0;
> +	if (ret) {
> +		/* enable back vclk so that release() disables it */
> +		clk_prepare_enable(cru->vclk);
> +		media_pipeline_stop(&cru->vdev.entity);
> +		return ret;
> +	}
> +
> +	ret = clk_prepare_enable(cru->vclk);

What will happen if enabling vclk will fail here? (Or above?)

> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2022-10-25 22:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04 23:43 [PATCH v3 0/4] Add driver for CSI2 and CRU modules found on Renesas RZ/G2L SoC Prabhakar
2022-10-04 23:43 ` [PATCH v3 1/4] media: dt-bindings: Document Renesas RZ/G2L CSI-2 block Prabhakar
2022-10-04 23:43 ` [PATCH v3 2/4] media: dt-bindings: Document Renesas RZ/G2L CRU block Prabhakar
2022-10-05 13:30   ` Rob Herring
2022-10-04 23:43 ` [PATCH v3 3/4] media: platform: Add Renesas RZ/G2L MIPI CSI-2 receiver driver Prabhakar
2022-10-04 23:43 ` [PATCH v3 4/4] media: platform: Add Renesas RZ/G2L CRU driver Prabhakar
2022-10-25 22:32   ` Sakari Ailus [this message]
2022-10-26 17:29     ` Lad, Prabhakar

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=Y1hkG6NVFS08WTIg@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=p.zabel@pengutronix.de \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --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

all inboxes | Powered by JetHome®