Devicetree
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Antoine Bernard <zalnir@proton.me>
Cc: Arec Kao <arec.kao@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"~postmarketos/upstreaming@lists.sr.ht"
	<~postmarketos/upstreaming@lists.sr.ht>
Subject: Re: [PATCH 1/3] media: i2c: ov13b10: Add dvdd, dovdd and device tree support
Date: Fri, 20 Mar 2026 23:34:23 +0200	[thread overview]
Message-ID: <ab29XzACA3gXE4MI@kekkonen.localdomain> (raw)
In-Reply-To: <WDExF9Cf1ELo55IwClyLBJqXeLe2-Kb2m3QYg7ex6qREa3HBG52CdMovctxuZ7W_ixhvHyjk9L73NDMCJi2ndkuDJcpzHSDs7Z5pEAgET60=@proton.me>

Hi Antoine,

Thanks for the patch.

On Fri, Mar 20, 2026 at 09:25:21AM +0000, Antoine Bernard wrote:
> From: Antoine Bernard <zalnir@proton.me>
> 
> The Xiaomi Pad 6 tablet uses the OV13B10 sensor with a device tree
> match and dvdd/dovdd voltage supply specified.
> 
> Add support for optional dvdd and dovdd voltage supply, and add
> a device tree match so that the rear camera can work on such tablets
> without an ACPI.
> 
> Signed-off-by: Antoine Bernard <zalnir@proton.me>
> ---
>  drivers/media/i2c/ov13b10.c | 53 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c
> index 5421874732bc..47eced60542c 100644
> --- a/drivers/media/i2c/ov13b10.c
> +++ b/drivers/media/i2c/ov13b10.c
> @@ -708,7 +708,11 @@ struct ov13b10 {
>  	struct v4l2_ctrl_handler ctrl_handler;
>  
>  	struct clk *img_clk;
> +
>  	struct regulator *avdd;
> +	struct regulator *dvdd;
> +	struct regulator *dovdd;

Could you use the regulator bulk API instead of adding each separately?

> +
>  	struct gpio_desc *reset;
>  
>  	/* V4L2 Controls */
> @@ -1197,6 +1201,10 @@ static int ov13b10_power_off(struct device *dev)
>  
>  	if (ov13b10->avdd)
>  		regulator_disable(ov13b10->avdd);
> +	if (ov13b10->dvdd)
> +		regulator_disable(ov13b10->dvdd);
> +	if (ov13b10->dovdd)
> +		regulator_disable(ov13b10->dovdd);
>  
>  	clk_disable_unprepare(ov13b10->img_clk);
>  
> @@ -1224,6 +1232,24 @@ static int ov13b10_power_on(struct device *dev)
>  		}
>  	}
>  
> +	if (ov13b10->dvdd) {
> +		ret = regulator_enable(ov13b10->dvdd);
> +		if (ret < 0) {
> +			dev_err(dev, "failed to enable dvdd: %d", ret);
> +			clk_disable_unprepare(ov13b10->img_clk);
> +			return ret;
> +		}
> +	}
> +
> +	if (ov13b10->dovdd) {
> +		ret = regulator_enable(ov13b10->dovdd);
> +		if (ret < 0) {
> +			dev_err(dev, "failed to enable dovdd: %d", ret);
> +			clk_disable_unprepare(ov13b10->img_clk);
> +			return ret;

Error handling needs some work here.

> +		}
> +	}
> +
>  	gpiod_set_value_cansleep(ov13b10->reset, 0);
>  	/* 5ms to wait ready after XSHUTDN assert */
>  	usleep_range(5000, 5500);
> @@ -1500,6 +1526,24 @@ static int ov13b10_get_pm_resources(struct ov13b10 *ov13b)
>  					     "failed to get avdd regulator\n");
>  	}
>  
> +	ov13b->dvdd = devm_regulator_get_optional(ov13b->dev, "dvdd");
> +	if (IS_ERR(ov13b->dvdd)) {
> +		ret = PTR_ERR(ov13b->dvdd);
> +		ov13b->dvdd = NULL;
> +		if (ret != -ENODEV)
> +			return dev_err_probe(ov13b->dev, ret,
> +					     "failed to get dvdd regulator\n");
> +	}
> +
> +	ov13b->dovdd = devm_regulator_get_optional(ov13b->dev, "dovdd");
> +	if (IS_ERR(ov13b->dovdd)) {
> +		ret = PTR_ERR(ov13b->dovdd);
> +		ov13b->dovdd = NULL;
> +		if (ret != -ENODEV)
> +			return dev_err_probe(ov13b->dev, ret,
> +					     "failed to get dovdd regulator\n");
> +	}
> +
>  	return 0;
>  }
>  
> @@ -1700,11 +1744,20 @@ static const struct acpi_device_id ov13b10_acpi_ids[] = {
>  MODULE_DEVICE_TABLE(acpi, ov13b10_acpi_ids);
>  #endif
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id ov13b10_of_match[] = {
> +	{.compatible = "ovti,ov13b10"},

{ Spaces inside braces, please. }

> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, ov13b10_of_match);
> +#endif
> +
>  static struct i2c_driver ov13b10_i2c_driver = {
>  	.driver = {
>  		.name = "ov13b10",
>  		.pm = pm_ptr(&ov13b10_pm_ops),
>  		.acpi_match_table = ACPI_PTR(ov13b10_acpi_ids),
> +		.of_match_table = of_match_ptr(ov13b10_of_match),

No need for of_match_ptr() here -- ACPI supports device probing through
of_match_table, too.

>  	},
>  	.probe = ov13b10_probe,
>  	.remove = ov13b10_remove,

-- 
Regards,

Sakari Ailus

       reply	other threads:[~2026-03-20 21:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <WDExF9Cf1ELo55IwClyLBJqXeLe2-Kb2m3QYg7ex6qREa3HBG52CdMovctxuZ7W_ixhvHyjk9L73NDMCJi2ndkuDJcpzHSDs7Z5pEAgET60=@proton.me>
2026-03-20 21:34 ` Sakari Ailus [this message]
2026-03-21  4:57   ` [PATCH 1/3] media: i2c: ov13b10: Add dvdd, dovdd and device tree support Antoine Bernard
2026-03-23  9:34     ` 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=ab29XzACA3gXE4MI@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=arec.kao@intel.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=zalnir@proton.me \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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