Devicetree
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Alexander Shiyan <eagle.alexander923@gmail.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil@kernel.org>,
	 Hans de Goede <hansg@kernel.org>,
	Tetsuya Nomura <tetsuya.nomura@soho-enterprise.com>,
	 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: Re: [PATCH 2/2] media: i2c: Add driver for Sony IMX662 sensor
Date: Fri, 13 Mar 2026 14:46:45 +0100	[thread overview]
Message-ID: <20260313-nippy-nebulous-quoll-3cb9ab@quoll> (raw)
In-Reply-To: <20260312150437.1091195-3-eagle.alexander923@gmail.com>

On Thu, Mar 12, 2026 at 06:04:37PM +0300, Alexander Shiyan wrote:
> This patch adds a V4L2 subdevice driver for the Sony IMX662 CMOS image

Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/process/submitting-patches.rst#L94

...

> +
> +static int imx662_power_on(struct device *dev)
> +{
> +	struct v4l2_subdev *sd = dev_get_drvdata(dev);
> +	struct imx662 *imx662 = to_imx662(sd);
> +	int ret;
> +
> +	ret = regulator_bulk_enable(ARRAY_SIZE(imx662->supplies),
> +				    imx662->supplies);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to enable regulators\n");

Is this probe path?

> +
> +	ret = clk_prepare_enable(imx662->clk);
> +	if (ret) {
> +		dev_err(dev, "Failed to enable clock\n");
> +		regulator_bulk_disable(ARRAY_SIZE(imx662->supplies),
> +				       imx662->supplies);

If yes, thus must be return dev_err_probe. If not, earlier code was
wrong.

> +		return ret;
> +	}
> +
> +	usleep_range(1, 2);
> +	gpiod_set_value_cansleep(imx662->reset, 1);

You did not test your code. Logical level 1 means reset is asserted, so
you leave your device in reset state after power on.

> +	usleep_range(30000, 31000);
> +
> +	return 0;
> +}
> +
> +static int imx662_power_off(struct device *dev)
> +{
> +	struct v4l2_subdev *sd = dev_get_drvdata(dev);
> +	struct imx662 *imx662 = to_imx662(sd);
> +
> +	gpiod_set_value_cansleep(imx662->reset, 0);

And you de-assert it in power off.

Look how other drivers do it. They even have explicit comment that above
is wrong.

Best regards,
Krzysztof


      parent reply	other threads:[~2026-03-13 13:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 15:04 [PATCH 0/2] media: i2c: Add support for Sony IMX662 sensor Alexander Shiyan
2026-03-12 15:04 ` [PATCH 1/2] dt-bindings: media: i2c: Add " Alexander Shiyan
2026-03-12 16:30   ` Rob Herring (Arm)
2026-03-13 13:52   ` Krzysztof Kozlowski
2026-03-12 15:04 ` [PATCH 2/2] media: i2c: Add driver for " Alexander Shiyan
2026-03-12 19:50   ` Dave Stevenson
2026-03-13  1:15     ` tetsuya.nomura
2026-03-13  7:55     ` Alexander Shiyan
2026-03-17 15:52       ` Dave Stevenson
2026-03-13 12:26     ` Alexander Shiyan
2026-07-20 14:44     ` Jai Luthra
2026-07-20 17:39       ` Dave Stevenson
2026-07-20 22:03         ` Sakari Ailus
2026-03-13 13:46   ` Krzysztof Kozlowski [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=20260313-nippy-nebulous-quoll-3cb9ab@quoll \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eagle.alexander923@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tetsuya.nomura@soho-enterprise.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