All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>,
	jeanmichel.hautbois@ideasonboard.com,
	paul.kocialkowski@bootlin.com, sakari.ailus@iki.fi,
	paul.elder@ideasonboard.com,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"open list:OMNIVISION OV5670 SENSOR DRIVER" 
	<linux-media@vger.kernel.org>
Subject: Re: [PATCH 4/6] media: i2c: ov5670: Probe GPIOs
Date: Sun, 13 Mar 2022 16:36:17 +0200	[thread overview]
Message-ID: <Yi4BYeVvF3/TSbP2@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220310130829.96001-5-jacopo@jmondi.org>

Hi Jacopo,

Thank you for the patch.

On Thu, Mar 10, 2022 at 02:08:27PM +0100, Jacopo Mondi wrote:
> The OV5670 has a powerdown and reset pin, named respectively "PWDN" and
> "XSHUTDOWN".
> 
> Optionally probe the gpios connected to the pins during the driver probe
> routine.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/i2c/ov5670.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
> index cba310aec011..ca5191d043ce 100644
> --- a/drivers/media/i2c/ov5670.c
> +++ b/drivers/media/i2c/ov5670.c
> @@ -1842,6 +1842,10 @@ struct ov5670 {
>  	/* Regulators */
>  	struct regulator_bulk_data supplies[OV5670_NUM_SUPPLIES];
>  
> +	/* Power-down and reset gpios. */
> +	struct gpio_desc *pwdn_gpio; /* PWDNB pin. */
> +	struct gpio_desc *reset_gpio; /* XSHUTDOWN pin. */
> +
>  	/* To serialize asynchronus callbacks */
>  	struct mutex mutex;
>  
> @@ -2494,6 +2498,23 @@ static int ov5670_regulators_probe(struct ov5670 *ov5670)
>  				       ov5670->supplies);
>  }
>  
> +static int ov5670_gpio_probe(struct ov5670 *ov5670)
> +{
> +	struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
> +
> +	ov5670->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "pwdn",
> +						    GPIOD_OUT_LOW);
> +	if (IS_ERR(ov5670->pwdn_gpio))
> +		return PTR_ERR(ov5670->pwdn_gpio);
> +
> +	ov5670->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
> +						     GPIOD_OUT_LOW);
> +	if (IS_ERR(ov5670->reset_gpio))
> +		return PTR_ERR(ov5670->reset_gpio);
> +
> +	return 0;
> +}
> +
>  static int ov5670_probe(struct i2c_client *client)
>  {
>  	struct ov5670 *ov5670;
> @@ -2522,6 +2543,12 @@ static int ov5670_probe(struct i2c_client *client)
>  		goto error_print;
>  	}
>  
> +	ret = ov5670_gpio_probe(ov5670);
> +	if (ret) {
> +		err_msg = "GPIO probe failed";
> +		goto error_print;
> +	}
> +
>  	full_power = acpi_dev_state_d0(&client->dev);
>  	if (full_power) {
>  		/* Check module identity */

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-03-13 14:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 13:08 [PATCH 0/6] media: i2c: ov5670: OF support, runtime_pm, regulators Jacopo Mondi
2022-03-10 13:08 ` [PATCH 1/6] media: dt-bindings: i2c: Document ov5670 Jacopo Mondi
2022-03-10 14:29   ` Krzysztof Kozlowski
2022-03-10 17:16     ` Jacopo Mondi
2022-03-10 17:26       ` Krzysztof Kozlowski
2022-03-10 23:30         ` Rob Herring
2022-03-11 16:05         ` Jacopo Mondi
2022-03-11 16:11           ` Krzysztof Kozlowski
2022-03-11 18:00             ` Jacopo Mondi
2022-03-12 10:30               ` Krzysztof Kozlowski
2022-03-13 14:30                 ` Laurent Pinchart
2022-03-10 13:08 ` [PATCH 2/6] media: i2c: ov5670: Allow probing with OF Jacopo Mondi
2022-03-10 18:16   ` kernel test robot
2022-03-10 20:29   ` kernel test robot
2022-03-10 20:39   ` kernel test robot
2022-03-13 14:33   ` Laurent Pinchart
2022-03-14  8:42     ` Jacopo Mondi
2022-03-14  8:50       ` Laurent Pinchart
2022-03-14  8:51         ` Laurent Pinchart
2022-03-10 13:08 ` [PATCH 3/6] media: i2c: ov5670: Probe regulators Jacopo Mondi
2022-03-13 14:35   ` Laurent Pinchart
2022-03-10 13:08 ` [PATCH 4/6] media: i2c: ov5670: Probe GPIOs Jacopo Mondi
2022-03-13 14:36   ` Laurent Pinchart [this message]
2022-03-10 13:08 ` [PATCH 5/6] media: i2c: ov5670: Add runtime_pm operations Jacopo Mondi
2022-03-13 14:42   ` Laurent Pinchart
2022-03-10 13:08 ` [PATCH 6/6] media: i2c: ov5670: Add .get_selection() support Jacopo Mondi
2022-03-13 14:44   ` Laurent Pinchart
2022-03-14 13:30     ` Jacopo Mondi
2022-03-14 13:40       ` Jacopo Mondi

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=Yi4BYeVvF3/TSbP2@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=jacopo@jmondi.org \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.