public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: johannes.goede@oss.qualcomm.com
To: Arun T <arun.t@intel.com>
Cc: sakari.ailus@linux.intel.com, arec.kao@intel.com,
	ilpo.jarvinen@linux.intel.com, dan.scally@ideasonboard.com,
	platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, mehdi.djait@intel.com
Subject: Re: [PATCH v6 2/2] media: ov13b10: Support multiple regulators
Date: Sat, 28 Mar 2026 12:50:53 +0100	[thread overview]
Message-ID: <3bc9fb28-b567-40da-a80e-548c2ea7f207@oss.qualcomm.com> (raw)
In-Reply-To: <20260327181959.3528753-3-arun.t@intel.com>

Hi,

On 27-Mar-26 19:19, Arun T wrote:
> The OV13B10 sensor driver currently handles a single regulator called
> avdd, however the sensor can be supplied by up to three regulators.
> Update the driver to handle all of them together using the regulator
> bulk API.
> 
> Signed-off-by: Arun T <arun.t@intel.com>
> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans



> ---
>  drivers/media/i2c/ov13b10.c | 47 ++++++++++++++++++++-----------------
>  1 file changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c
> index 5421874732bc..b0d34141a13a 100644
> --- a/drivers/media/i2c/ov13b10.c
> +++ b/drivers/media/i2c/ov13b10.c
> @@ -8,6 +8,7 @@
>  #include <linux/i2c.h>
>  #include <linux/module.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/regulator/consumer.h>
>  #include <media/v4l2-ctrls.h>
>  #include <media/v4l2-device.h>
>  #include <media/v4l2-fwnode.h>
> @@ -699,6 +700,12 @@ static const struct ov13b10_mode supported_2_lanes_modes[] = {
>  	},
>  };
>  
> +static const char * const ov13b10_supply_names[] = {
> +	"dovdd",        /* Digital I/O power */
> +	"avdd",         /* Analog power */
> +	"dvdd",         /* Digital core power */
> +};
> +
>  struct ov13b10 {
>  	struct device *dev;
>  
> @@ -708,7 +715,7 @@ struct ov13b10 {
>  	struct v4l2_ctrl_handler ctrl_handler;
>  
>  	struct clk *img_clk;
> -	struct regulator *avdd;
> +	struct regulator_bulk_data supplies[ARRAY_SIZE(ov13b10_supply_names)];
>  	struct gpio_desc *reset;
>  
>  	/* V4L2 Controls */
> @@ -1194,9 +1201,8 @@ static int ov13b10_power_off(struct device *dev)
>  	struct ov13b10 *ov13b10 = to_ov13b10(sd);
>  
>  	gpiod_set_value_cansleep(ov13b10->reset, 1);
> -
> -	if (ov13b10->avdd)
> -		regulator_disable(ov13b10->avdd);
> +	regulator_bulk_disable(ARRAY_SIZE(ov13b10_supply_names),
> +			       ov13b10->supplies);
>  
>  	clk_disable_unprepare(ov13b10->img_clk);
>  
> @@ -1214,14 +1220,12 @@ static int ov13b10_power_on(struct device *dev)
>  		dev_err(dev, "failed to enable imaging clock: %d", ret);
>  		return ret;
>  	}
> -
> -	if (ov13b10->avdd) {
> -		ret = regulator_enable(ov13b10->avdd);
> -		if (ret < 0) {
> -			dev_err(dev, "failed to enable avdd: %d", ret);
> -			clk_disable_unprepare(ov13b10->img_clk);
> -			return ret;
> -		}
> +	ret = regulator_bulk_enable(ARRAY_SIZE(ov13b10_supply_names),
> +				    ov13b10->supplies);
> +	if (ret < 0) {
> +		dev_err(dev, "failed to enable regulators\n");
> +		clk_disable_unprepare(ov13b10->img_clk);
> +		return ret;
>  	}
>  
>  	gpiod_set_value_cansleep(ov13b10->reset, 0);
> @@ -1475,7 +1479,8 @@ 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);
> +	ov13b->reset = devm_gpiod_get_optional(ov13b->dev, "reset",
> +					       GPIOD_OUT_LOW);
>  	if (IS_ERR(ov13b->reset))
>  		return dev_err_probe(ov13b->dev, PTR_ERR(ov13b->reset),
>  				     "failed to get reset gpio\n");
> @@ -1491,15 +1496,15 @@ static int ov13b10_get_pm_resources(struct ov13b10 *ov13b)
>  				     "external clock %lu is not supported\n",
>  				     freq);
>  
> -	ov13b->avdd = devm_regulator_get_optional(ov13b->dev, "avdd");
> -	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");
> -	}
> +	for (unsigned int i = 0; i < ARRAY_SIZE(ov13b10_supply_names); i++)
> +		ov13b->supplies[i].supply = ov13b10_supply_names[i];
>  
> +	ret = devm_regulator_bulk_get(ov13b->dev,
> +				      ARRAY_SIZE(ov13b10_supply_names),
> +				      ov13b->supplies);
> +	if (ret)
> +		return dev_err_probe(ov13b->dev, ret,
> +				     "failed to get regulators\n");
>  	return 0;
>  }
>  


      reply	other threads:[~2026-03-28 11:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 18:19 [PATCH v6 0/2] Add TPS68470 power supply support for ov13b10 sensor Arun T
2026-03-27 18:19 ` [PATCH v6 1/2] platform/x86: int3472: Add TPS68470 board data for Intel nvl Arun T
2026-03-28 11:50   ` johannes.goede
2026-03-31 11:26   ` Sakari Ailus
2026-04-01  6:43     ` T, Arun
2026-04-01 12:32       ` T, Arun
2026-03-27 18:19 ` [PATCH v6 2/2] media: ov13b10: Support multiple regulators Arun T
2026-03-28 11:50   ` johannes.goede [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=3bc9fb28-b567-40da-a80e-548c2ea7f207@oss.qualcomm.com \
    --to=johannes.goede@oss.qualcomm.com \
    --cc=arec.kao@intel.com \
    --cc=arun.t@intel.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mehdi.djait@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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