From: Hans de Goede <hdegoede@redhat.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: sakari.ailus@linux.intel.com, heimir.sverrisson@gmail.com,
linux-media@vger.kernel.org, stanislaw.gruszka@linux.intel.com,
ingvar@redpill-linpro.com, hao.yao@intel.com, mchehab@kernel.org
Subject: Re: [PATCH 2/4] media: i2c: ov02c10: Make reset gpio logic optional
Date: Sat, 15 Mar 2025 21:45:13 +0100 [thread overview]
Message-ID: <7b9fd58a-e545-4aa4-bf08-e7b05ee277c1@redhat.com> (raw)
In-Reply-To: <20250315134009.157132-3-bryan.odonoghue@linaro.org>
Hi Bryan,
On 15-Mar-25 2:40 PM, Bryan O'Donoghue wrote:
> The reset gpio is optional. Only trigger the reset logic if the reset gpio
> pin is valid.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/media/i2c/ov02c10.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
> index f6542cdf7472..595998e60b22 100644
> --- a/drivers/media/i2c/ov02c10.c
> +++ b/drivers/media/i2c/ov02c10.c
> @@ -664,7 +664,8 @@ static int ov02c10_power_off(struct device *dev)
> struct v4l2_subdev *sd = dev_get_drvdata(dev);
> struct ov02c10 *ov02c10 = to_ov02c10(sd);
>
> - gpiod_set_value_cansleep(ov02c10->reset, 1);
> + if (ov02c10->reset)
> + gpiod_set_value_cansleep(ov02c10->reset, 1);
This is not necessary, gpoid functions generally speaking
will happily take the NULL returned by gpiod_get_optional()
when the GPIO is not there without logging or returning
any errors. Note calling them with a PTR_ERR is not ok,
but we don't do that.
> regulator_bulk_disable(ARRAY_SIZE(ov02c10_supply_names),
> ov02c10->supplies);
> @@ -694,8 +695,10 @@ static int ov02c10_power_on(struct device *dev)
> return ret;
> }
>
> - gpiod_set_value_cansleep(ov02c10->reset, 0);
> - usleep_range(1500, 1800);
> + if (ov02c10->reset) {
> + gpiod_set_value_cansleep(ov02c10->reset, 0);
> + usleep_range(1500, 1800);
> + }
Same here for the gpiod_set_value_cansleep() call, as for
the sleep() I think we want to sleep even without a reset
since we have also just enabled the clk + powerrails...
Regards,
Hans
next prev parent reply other threads:[~2025-03-15 20:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 10:11 [PATCH v9 0/1] media: i2c: Add Omnivision OV02C10 sensor driver Hans de Goede
2025-03-14 10:11 ` [PATCH v9 1/1] " Hans de Goede
2025-03-14 12:46 ` Sakari Ailus
[not found] ` <CAGadeg1evCB9+uyvAmkrGC6rnNo2yP4HKOji1U+ied6HrUQTgA@mail.gmail.com>
2025-03-14 18:35 ` Hans de Goede
2025-03-19 14:59 ` Hans de Goede
2025-03-19 15:16 ` Sakari Ailus
2025-03-19 15:23 ` Hans de Goede
2025-03-15 13:40 ` [PATCH 0/4] ov02c10: OF extensions and fixups Bryan O'Donoghue
2025-03-15 13:40 ` [PATCH 1/4] media: i2c: ov02c10: Support full range of power rails Bryan O'Donoghue
2025-03-15 20:41 ` Hans de Goede
2025-03-15 20:44 ` Bryan O'Donoghue
2025-03-15 13:40 ` [PATCH 2/4] media: i2c: ov02c10: Make reset gpio logic optional Bryan O'Donoghue
2025-03-15 20:45 ` Hans de Goede [this message]
2025-03-15 13:40 ` [PATCH 3/4] media: i2c: ov02c10: Implement power-on reset Bryan O'Donoghue
2025-03-15 13:50 ` Bryan O'Donoghue
2025-03-15 21:05 ` Hans de Goede
2025-03-15 21:09 ` Bryan O'Donoghue
2025-03-15 21:12 ` Hans de Goede
2025-03-15 21:15 ` Bryan O'Donoghue
2025-03-15 13:40 ` [PATCH 4/4] media: i2c: ov02c10: Add OF probe support Bryan O'Donoghue
2025-03-15 21:06 ` Hans de Goede
2025-03-15 22:09 ` [PATCH] media: i2c: ov02c10: Get the OF clock rate Bryan O'Donoghue
2025-03-15 22:12 ` Bryan O'Donoghue
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=7b9fd58a-e545-4aa4-bf08-e7b05ee277c1@redhat.com \
--to=hdegoede@redhat.com \
--cc=bryan.odonoghue@linaro.org \
--cc=hao.yao@intel.com \
--cc=heimir.sverrisson@gmail.com \
--cc=ingvar@redpill-linpro.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stanislaw.gruszka@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