From: Markus Pargmann <mpa@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
devicetree@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/3] [media] mt9v032: Add reset and standby gpios
Date: Tue, 15 Dec 2015 10:13:18 +0100 [thread overview]
Message-ID: <2909716.jMugkd1BEg@adelgunde> (raw)
In-Reply-To: <1538607.GEJzzOouog@avalon>
[-- Attachment #1: Type: text/plain, Size: 4598 bytes --]
Hi,
On Monday 14 December 2015 21:26:25 Laurent Pinchart wrote:
> Hi Markus,
>
> Thank you for the patch.
>
> On Monday 14 December 2015 15:41:51 Markus Pargmann wrote:
> > Add optional reset and standby gpios. The reset gpio is used to reset
> > the chip in power_on().
> >
> > The standby gpio is not used currently. It is just unset, so the chip is
> > not in standby.
> >
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Acked-by: Rob Herring <robh@kernel.org>
> > ---
> > .../devicetree/bindings/media/i2c/mt9v032.txt | 2 ++
> > drivers/media/i2c/mt9v032.c | 28 +++++++++++++++++++
> > 2 files changed, 30 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> > b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt index
> > 202565313e82..100f0ae43269 100644
> > --- a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> > +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> > @@ -20,6 +20,8 @@ Optional Properties:
> >
> > - link-frequencies: List of allowed link frequencies in Hz. Each frequency
> > is expressed as a 64-bit big-endian integer.
> > +- reset-gpios: GPIO handle which is connected to the reset pin of the chip.
> > +- standby-gpios: GPIO handle which is connected to the standby pin of the
> > chip.
> >
> > For further reading on port node refer to
> > Documentation/devicetree/bindings/media/video-interfaces.txt.
> > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> > index a68ce94ee097..c1bc564a0979 100644
> > --- a/drivers/media/i2c/mt9v032.c
> > +++ b/drivers/media/i2c/mt9v032.c
> > @@ -14,6 +14,7 @@
> >
> > #include <linux/clk.h>
> > #include <linux/delay.h>
> > +#include <linux/gpio/consumer.h>
> > #include <linux/i2c.h>
> > #include <linux/log2.h>
> > #include <linux/mutex.h>
> > @@ -251,6 +252,8 @@ struct mt9v032 {
> >
> > struct regmap *regmap;
> > struct clk *clk;
> > + struct gpio_desc *reset_gpio;
> > + struct gpio_desc *standby_gpio;
> >
> > struct mt9v032_platform_data *pdata;
> > const struct mt9v032_model_info *model;
> > @@ -312,16 +315,31 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
> > struct regmap *map = mt9v032->regmap;
> > int ret;
> >
> > + if (mt9v032->reset_gpio)
> > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 1);
> > +
>
> gpiod_set_value_cansleep() already checks whether the gpiod is NULL, you don't
> need to duplicate the check here.
>
> Apart from that,
>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> No need to resubmit I'll fix this when applying.
Ok, thank you.
Best Regards,
Markus
>
> > ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk);
> > if (ret < 0)
> > return ret;
> >
> > + /* System clock has to be enabled before releasing the reset */
> > ret = clk_prepare_enable(mt9v032->clk);
> > if (ret)
> > return ret;
> >
> > udelay(1);
> >
> > + if (mt9v032->reset_gpio) {
> > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 0);
> > +
> > + /* After releasing reset we need to wait 10 clock cycles
> > + * before accessing the sensor over I2C. As the minimum SYSCLK
> > + * frequency is 13MHz, waiting 1µs will be enough in the worst
> > + * case.
> > + */
> > + udelay(1);
> > + }
> > +
> > /* Reset the chip and stop data read out */
> > ret = regmap_write(map, MT9V032_RESET, 1);
> > if (ret < 0)
> > @@ -954,6 +972,16 @@ static int mt9v032_probe(struct i2c_client *client,
> > if (IS_ERR(mt9v032->clk))
> > return PTR_ERR(mt9v032->clk);
> >
> > + mt9v032->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
> > + GPIOD_OUT_HIGH);
> > + if (IS_ERR(mt9v032->reset_gpio))
> > + return PTR_ERR(mt9v032->reset_gpio);
> > +
> > + mt9v032->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby",
> > + GPIOD_OUT_LOW);
> > + if (IS_ERR(mt9v032->standby_gpio))
> > + return PTR_ERR(mt9v032->standby_gpio);
> > +
> > mutex_init(&mt9v032->power_lock);
> > mt9v032->pdata = pdata;
> > mt9v032->model = (const void *)did->driver_data;
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2015-12-15 9:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 14:41 [PATCH v2 1/3] [media] mt9v032: Add reset and standby gpios Markus Pargmann
[not found] ` <1450104113-6392-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-12-14 14:41 ` [PATCH v2 2/3] [media] mt9v032: Do not unset master_mode Markus Pargmann
[not found] ` <1450104113-6392-2-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-12-14 19:37 ` Laurent Pinchart
2015-12-14 14:41 ` [PATCH v2 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC Markus Pargmann
2015-12-16 7:47 ` Laurent Pinchart
2015-12-16 10:14 ` Markus Pargmann
2015-12-29 9:38 ` Laurent Pinchart
2016-01-04 9:56 ` Markus Pargmann
2015-12-14 19:26 ` [PATCH v2 1/3] [media] mt9v032: Add reset and standby gpios Laurent Pinchart
2015-12-15 9:13 ` Markus Pargmann [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=2909716.jMugkd1BEg@adelgunde \
--to=mpa@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=hans.verkuil@cisco.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).