All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rui Miguel Silva <rui.silva@linaro.org>
To: mchehab@kernel.org, sakari.ailus@linux.intel.com,
	hverkuil@xs4all.nl, Rob Herring <robh+dt@kernel.org>
Cc: linux-media@vger.kernel.org,
	Fabio Estevam <fabio.estevam@nxp.com>,
	devicetree@vger.kernel.org, Ryan Harkin <ryan.harkin@linaro.org>,
	Rui Miguel Silva <rui.silva@linaro.org>
Subject: [PATCH 3/4] media: ov2680: rename powerdown gpio and fix polarity
Date: Mon,  7 May 2018 16:56:54 +0100	[thread overview]
Message-ID: <20180507155655.1555-4-rui.silva@linaro.org> (raw)
In-Reply-To: <20180507155655.1555-1-rui.silva@linaro.org>

Rename the power control gpio to reset, since it is the same, and fix the
polarity code since this gpio is active at low and not at high as controlled
before.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
---
 drivers/media/i2c/ov2680.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index cc3d06096d51..8962b397211a 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -98,7 +98,7 @@ struct ov2680_dev {
 	struct clk			*xvclk;
 	u32				xvclk_freq;
 
-	struct gpio_desc		*pwdn_gpio;
+	struct gpio_desc		*reset_gpio;
 	struct mutex			lock; /* protect members */
 
 	bool				mode_pending_changes;
@@ -295,19 +295,19 @@ static int ov2680_load_regs(struct ov2680_dev *sensor,
 
 static void ov2680_power_up(struct ov2680_dev *sensor)
 {
-	if (!sensor->pwdn_gpio)
+	if (!sensor->reset_gpio)
 		return;
 
-	gpiod_set_value(sensor->pwdn_gpio, 1);
+	gpiod_set_value(sensor->reset_gpio, 0);
 	usleep_range(5000, 10000);
 }
 
 static void ov2680_power_down(struct ov2680_dev *sensor)
 {
-	if (!sensor->pwdn_gpio)
+	if (!sensor->reset_gpio)
 		return;
 
-	gpiod_set_value(sensor->pwdn_gpio, 0);
+	gpiod_set_value(sensor->reset_gpio, 1);
 	usleep_range(5000, 10000);
 }
 
@@ -535,7 +535,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor)
 	if (sensor->is_enabled)
 		return 0;
 
-	if (!sensor->pwdn_gpio) {
+	if (!sensor->reset_gpio) {
 		ret = ov2680_write_reg(sensor, OV2680_REG_SOFT_RESET, 0x01);
 		if (ret != 0) {
 			dev_err(dev, "sensor soft reset failed\n");
@@ -990,11 +990,11 @@ static int ov2860_parse_dt(struct ov2680_dev *sensor)
 	struct device *dev = ov2680_to_dev(sensor);
 	int ret;
 
-	sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown",
-						    GPIOD_OUT_HIGH);
-	ret = PTR_ERR_OR_ZERO(sensor->pwdn_gpio);
+	sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+						     GPIOD_OUT_HIGH);
+	ret = PTR_ERR_OR_ZERO(sensor->reset_gpio);
 	if (ret < 0) {
-		dev_dbg(dev, "error while getting powerdown gpio: %d\n", ret);
+		dev_dbg(dev, "error while getting reset gpio: %d\n", ret);
 		return ret;
 	}
 
-- 
2.17.0

  parent reply	other threads:[~2018-05-07 15:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 15:56 [PATCH 0/4] media: ov2680: follow up from initial version Rui Miguel Silva
2018-05-07 15:56 ` [PATCH 1/4] media: ov2680: dt: add voltage supplies as required Rui Miguel Silva
2018-05-07 15:56 ` [PATCH 2/4] media: ov2680: dt: rename gpio to reset and fix polarity Rui Miguel Silva
2018-05-07 15:56 ` Rui Miguel Silva [this message]
2018-05-07 15:56 ` [PATCH 4/4] media: ov2680: add regulators to supply control Rui Miguel Silva
2018-05-08 13:29 ` [PATCH 0/4] media: ov2680: follow up from initial version Fabio Estevam
2018-05-08 13:52   ` Rui Miguel Silva
2018-05-08 13:52     ` Rui Miguel Silva
2018-05-08 13:55     ` Fabio Estevam
2018-05-08 20:03 ` Sakari Ailus
2018-05-09 11:03   ` Rui Miguel Silva

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=20180507155655.1555-4-rui.silva@linaro.org \
    --to=rui.silva@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ryan.harkin@linaro.org \
    --cc=sakari.ailus@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 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.