mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: johannes.goede@oss.qualcomm.com
To: Arun T <arun.t@intel.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio
Date: Mon, 2 Feb 2026 16:11:52 +0100	[thread overview]
Message-ID: <591ac511-d339-40d1-9cae-299e068a9b17@oss.qualcomm.com> (raw)
In-Reply-To: <20260130092431.2335363-2-arun.t@intel.com>

Hi Arun,

Thank you for your patch.

On 30-Jan-26 10:24, Arun T wrote:
> Ov13b10 sensor get clock and regulator from TPS68470 PMIC.
> Added tps68470 regulator/gpio names in power_on()
> 
> Signed-off-by: Arun T <arun.t@intel.com>
> ---
>  drivers/media/i2c/ov13b10.c | 38 ++++++++++++++++++++++++++++++++++---
>  1 file changed, 35 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c
> index 5421874732bc..c2469c88c722 100644
> --- a/drivers/media/i2c/ov13b10.c
> +++ b/drivers/media/i2c/ov13b10.c
> @@ -709,6 +709,10 @@ struct ov13b10 {
>  
>  	struct clk *img_clk;
>  	struct regulator *avdd;
> +	struct regulator *vio;
> +	struct regulator *core;
> +	struct gpio_desc *enable;

This new enable gpio does not seem to get used in the patch
at all ?

> +
>  	struct gpio_desc *reset;
>  
>  	/* V4L2 Controls */
> @@ -1475,12 +1479,19 @@ static int ov13b10_get_pm_resources(struct ov13b10 *ov13b)
>  	unsigned long freq;
>  	int ret;
>  
> -	ov13b->reset = devm_gpiod_get_optional(ov13b->dev, "reset", GPIOD_OUT_LOW);
> +	if (strstr(dev_name(ov13b->dev), "OVTI13B1:01"))
> +		ov13b->reset = devm_gpiod_get_optional(ov13b->dev, "s_resetn", GPIOD_OUT_LOW);
> +	else
> +		ov13b->reset = devm_gpiod_get_optional(ov13b->dev, "reset", GPIOD_OUT_LOW);

Nack, you're adding a lookup in patch 1/2, simply use "reset"
there instead of "s_resetn" and then you don't need this.

More importantly board/platform specific info like this must NOT
be present in sensor drivers.

All uses of "if (strstr(dev_name(ov13b->dev), "OVTI13B1:01"))"
in this patch MUST be dropped.

>  	if (IS_ERR(ov13b->reset))
>  		return dev_err_probe(ov13b->dev, PTR_ERR(ov13b->reset),
>  				     "failed to get reset gpio\n");
>  
> -	ov13b->img_clk = devm_v4l2_sensor_clk_get(ov13b->dev, NULL);
> +	if (strstr(dev_name(ov13b->dev), "OVTI13B1:01"))
> +		ov13b->img_clk = devm_v4l2_sensor_clk_get(ov13b->dev, "tps68470-clk");
> +	else
> +		ov13b->img_clk = devm_v4l2_sensor_clk_get(ov13b->dev, NULL);
> +

Same here, the old code with the NULL name arg will work fine since
there should be only 1 clk provider.

>  	if (IS_ERR(ov13b->img_clk))
>  		return dev_err_probe(ov13b->dev, PTR_ERR(ov13b->img_clk),
>  				     "failed to get imaging clock\n");
> @@ -1490,8 +1501,11 @@ static int ov13b10_get_pm_resources(struct ov13b10 *ov13b)
>  		return dev_err_probe(ov13b->dev, -EINVAL,
>  				     "external clock %lu is not supported\n",
>  				     freq);
> +	if (strstr(dev_name(ov13b->dev), "OVTI13B1:01"))
> +		ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "ana");
> +	else
> +		ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "avdd");

Again you're providing the map information in patch 1/2 just call it avdd!

>  
> -	ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "avdd");
>  	if (IS_ERR(ov13b->avdd)) {
>  		ret = PTR_ERR(ov13b->avdd);
>  		ov13b->avdd = NULL;
> @@ -1499,6 +1513,24 @@ static int ov13b10_get_pm_resources(struct ov13b10 *ov13b)
>  			return dev_err_probe(ov13b->dev, ret,
>  					     "failed to get avdd regulator\n");
>  	}
> +	if (strstr(dev_name(ov13b->dev), "OVTI13B1:01")){
> +		ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "dovdd");
> +		if (IS_ERR(ov13b->avdd)) {
> +			ret = PTR_ERR(ov13b->avdd);
> +			ov13b->avdd = NULL;
> +			if (ret != -ENODEV)
> +				return dev_err_probe(ov13b->dev, ret,
> +			               "failed to get avdd regulator\n");
> +		}
> +		ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "dvdd");
> +		if (IS_ERR(ov13b->avdd)) {
> +			ret = PTR_ERR(ov13b->avdd);
> +			ov13b->avdd = NULL;
> +			if (ret != -ENODEV)
> +				return dev_err_probe(ov13b->dev, ret,
> +					"failed to get avdd regulator\n");
> +		}
> +	}

You're using ov13b->avdd to store the other 2 regulators too that cannot
be right...

Also for adding multiple regulators you should use the bulk regulator API,
see e.g. :

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/media/i2c/hi556.c?id=375fc903e57cb3ca4d2d5408de98d6369d4c8334

And there is no need for the if (strstr(dev_name(ov13b->dev), "OVTI13B1:01")){
here, the regulator core will provide dummy regulators on boards
where there are no regulators defined for dovdd and dvdd.

Regards,

Hans



  reply	other threads:[~2026-02-02 15:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  9:24 [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl Arun T
2026-01-30  9:24 ` [PATCH 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio Arun T
2026-02-02 15:11   ` johannes.goede [this message]
2026-02-17  6:11     ` T, Arun
2026-02-24 18:21       ` T, Arun
2026-02-11 15:39   ` [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl Arun T
2026-02-11 15:39     ` [PATCH 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio Arun T
2026-02-11 16:16   ` [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl Arun T
2026-02-11 16:16     ` [PATCH 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio Arun T
2026-02-26  1:12   ` [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl Arun T
2026-02-26  1:12     ` [PATCH 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio Arun T
2026-02-26 11:15     ` [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl Kieran Bingham
2026-02-27 13:35   ` [PATCH v2 0/2] Add TPS68470 power supply support for ov13b10 sensor Arun T
2026-02-27 13:35     ` [PATCH v2 1/2] platform/x86: int3472: Add board data for Intel nvl Arun T
2026-03-01 14:37       ` Sakari Ailus
2026-03-04  9:29         ` johannes.goede
2026-03-06  8:47           ` T, Arun
2026-03-06  9:22             ` johannes.goede
2026-03-12  9:46               ` T, Arun
2026-03-16 17:57                 ` T, Arun
2026-02-27 13:35     ` [PATCH v2 2/2] media: i2c: ov13b10: Support tps68470 regulator and gpio Arun T
2026-03-01 14:40       ` Sakari Ailus
2026-03-02 17:46   ` [PATCH v3 0/2] Add TPS68470 power supply support for ov13b10 sensor Arun T
2026-03-02 17:46     ` [PATCH v3 1/2] platform/x86: int3472: Add TPS68470 board data for Intel nvl Arun T
2026-03-04  9:32       ` johannes.goede
2026-03-02 17:46     ` [PATCH v3 2/2] media: i2c: ov13b10: support tps68470 regulator and gpio Arun T
2026-02-02 15:10 ` [PATCH 1/2] platform/x86: int3472: Add board data for Intel nvl johannes.goede

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=591ac511-d339-40d1-9cae-299e068a9b17@oss.qualcomm.com \
    --to=johannes.goede@oss.qualcomm.com \
    --cc=arun.t@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.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®