diff mbox series

[v2,1/4] media: i2c: ov2685: Make reset gpio optional

Message ID 20230129-ov2685-improvements-v2-1-210400f2b63e@z3ntu.xyz
State Superseded
Headers show
Series Improvements for OmniVision OV2685 driver | expand

Commit Message

Luca Weiss Feb. 1, 2023, 5:06 p.m. UTC
In some setups XSHUTDOWN is connected to DOVDD when it's unused,
therefore treat the reset gpio as optional.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 drivers/media/i2c/ov2685.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Stevenson Feb. 1, 2023, 5:24 p.m. UTC | #1
Hi Luca

On Wed, 1 Feb 2023 at 17:07, Luca Weiss <luca@z3ntu.xyz> wrote:
>
> In some setups XSHUTDOWN is connected to DOVDD when it's unused,
> therefore treat the reset gpio as optional.

The binding doc [1] says that reset-gpios is a required property.
Making it optional should therefore have a patch for the binding
first, and then a patch updating the driver.
Unfortunately my understanding is that means converting it to YAML as
well due to the txt docs being frozen.

I know the pain - I was doing exactly the same thing for ov7251 earlier today.
I haven't run the dt schema checks or had them reviewed yet, but
"media: dt-bindings: Convert ov7251.txt to YAML" and "media:
dt-bindings: ov7251: Make enable-gpio optional" on [2] may be of help
to you.

  Dave

[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/media/i2c/ov2685.txt#L10
[2] https://github.com/6by9/linux/commits/rpi-6.2.y-ov7251

> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>  drivers/media/i2c/ov2685.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
> index a3b524f15d89..a422f4c8a2eb 100644
> --- a/drivers/media/i2c/ov2685.c
> +++ b/drivers/media/i2c/ov2685.c
> @@ -734,7 +734,7 @@ static int ov2685_probe(struct i2c_client *client,
>         if (clk_get_rate(ov2685->xvclk) != OV2685_XVCLK_FREQ)
>                 dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
>
> -       ov2685->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> +       ov2685->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
>         if (IS_ERR(ov2685->reset_gpio)) {
>                 dev_err(dev, "Failed to get reset-gpios\n");
>                 return -EINVAL;
>
> --
> 2.39.1
>
Sakari Ailus March 14, 2023, 12:07 p.m. UTC | #2
Hi Luca,

On Wed, Feb 01, 2023 at 06:28:47PM +0100, Luca Weiss wrote:
> On Mittwoch, 1. Februar 2023 18:24:10 CET Dave Stevenson wrote:
> > Hi Luca
> > 
> > On Wed, 1 Feb 2023 at 17:07, Luca Weiss <luca@z3ntu.xyz> wrote:
> > > In some setups XSHUTDOWN is connected to DOVDD when it's unused,
> > > therefore treat the reset gpio as optional.
> > 
> > The binding doc [1] says that reset-gpios is a required property.
> > Making it optional should therefore have a patch for the binding
> > first, and then a patch updating the driver.
> > Unfortunately my understanding is that means converting it to YAML as
> > well due to the txt docs being frozen.
> 
> I already have the docs converted somewhere, I will send that separately. Hope 
> that's okay.

I took the rest of the three patches, there doesn't seem to be a dependency
between these. I'd suggest to merge new versions of this and the other
patch into a single set.
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
index a3b524f15d89..a422f4c8a2eb 100644
--- a/drivers/media/i2c/ov2685.c
+++ b/drivers/media/i2c/ov2685.c
@@ -734,7 +734,7 @@  static int ov2685_probe(struct i2c_client *client,
 	if (clk_get_rate(ov2685->xvclk) != OV2685_XVCLK_FREQ)
 		dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
 
-	ov2685->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+	ov2685->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ov2685->reset_gpio)) {
 		dev_err(dev, "Failed to get reset-gpios\n");
 		return -EINVAL;