All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Sebastian Reichel <sre@kernel.org>, Milo Kim <Milo.Kim@ti.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Tony Lindgren <tony@atomide.com>
Cc: Jingoo Han <jingoohan1@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Subject: [PATCHv4 02/10] mfd: ti-lmu: switch to gpiod
Date: Fri, 30 Mar 2018 19:24:06 +0200	[thread overview]
Message-ID: <20180330172414.26575-3-sebastian.reichel@collabora.co.uk> (raw)
In-Reply-To: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk>

Use new descriptor based API instead of the legacy one.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 drivers/mfd/ti-lmu.c       | 28 ++++++++++++----------------
 include/linux/mfd/ti-lmu.h |  3 ++-
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
index 990437e5ed0a..e14cb9f41b44 100644
--- a/drivers/mfd/ti-lmu.c
+++ b/drivers/mfd/ti-lmu.c
@@ -12,7 +12,7 @@
 
 #include <linux/delay.h>
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/kernel.h>
 #include <linux/mfd/core.h>
@@ -21,7 +21,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/of_gpio.h>
 #include <linux/slab.h>
 
 struct ti_lmu_data {
@@ -32,17 +31,8 @@ struct ti_lmu_data {
 
 static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
 {
-	int ret;
-
-	if (gpio_is_valid(lmu->en_gpio)) {
-		ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
-					    GPIOF_OUT_INIT_HIGH, "lmu_hwen");
-		if (ret) {
-			dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
-				ret);
-			return ret;
-		}
-	}
+	if (lmu->en_gpio)
+		gpiod_set_value(lmu->en_gpio, 1);
 
 	/* Delay about 1ms after HW enable pin control */
 	usleep_range(1000, 1500);
@@ -59,8 +49,8 @@ static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
 
 static void ti_lmu_disable_hw(struct ti_lmu *lmu)
 {
-	if (gpio_is_valid(lmu->en_gpio))
-		gpio_set_value(lmu->en_gpio, 0);
+	if (lmu->en_gpio)
+		gpiod_set_value(lmu->en_gpio, 0);
 }
 
 static const struct mfd_cell lm3532_devices[] = {
@@ -204,7 +194,13 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 		return PTR_ERR(lmu->regmap);
 
 	/* HW enable pin control and additional power up sequence if required */
-	lmu->en_gpio = of_get_named_gpio(dev->of_node, "enable-gpios", 0);
+	lmu->en_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(lmu->en_gpio)) {
+		ret = PTR_ERR(lmu->en_gpio);
+		dev_err(dev, "Can not request enable GPIO: %d\n", ret);
+		return ret;
+	}
+
 	ret = ti_lmu_enable_hw(lmu, id->driver_data);
 	if (ret)
 		return ret;
diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h
index 09d5f30384e5..1ef51ed36be5 100644
--- a/include/linux/mfd/ti-lmu.h
+++ b/include/linux/mfd/ti-lmu.h
@@ -16,6 +16,7 @@
 #include <linux/gpio.h>
 #include <linux/notifier.h>
 #include <linux/regmap.h>
+#include <linux/gpio/consumer.h>
 
 /* Notifier event */
 #define LMU_EVENT_MONITOR_DONE		0x01
@@ -81,7 +82,7 @@ enum lm363x_regulator_id {
 struct ti_lmu {
 	struct device *dev;
 	struct regmap *regmap;
-	int en_gpio;
+	struct gpio_desc *en_gpio;
 	struct blocking_notifier_head notifier;
 };
 #endif
-- 
2.16.2

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Sebastian Reichel <sre@kernel.org>, Milo Kim <Milo.Kim@ti.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Tony Lindgren <tony@atomide.com>
Cc: Jingoo Han <jingoohan1@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Subject: [PATCHv4 02/10] mfd: ti-lmu: switch to gpiod
Date: Fri, 30 Mar 2018 17:24:06 +0000	[thread overview]
Message-ID: <20180330172414.26575-3-sebastian.reichel@collabora.co.uk> (raw)
In-Reply-To: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk>

Use new descriptor based API instead of the legacy one.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 drivers/mfd/ti-lmu.c       | 28 ++++++++++++----------------
 include/linux/mfd/ti-lmu.h |  3 ++-
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
index 990437e5ed0a..e14cb9f41b44 100644
--- a/drivers/mfd/ti-lmu.c
+++ b/drivers/mfd/ti-lmu.c
@@ -12,7 +12,7 @@
 
 #include <linux/delay.h>
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/kernel.h>
 #include <linux/mfd/core.h>
@@ -21,7 +21,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/of_gpio.h>
 #include <linux/slab.h>
 
 struct ti_lmu_data {
@@ -32,17 +31,8 @@ struct ti_lmu_data {
 
 static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
 {
-	int ret;
-
-	if (gpio_is_valid(lmu->en_gpio)) {
-		ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
-					    GPIOF_OUT_INIT_HIGH, "lmu_hwen");
-		if (ret) {
-			dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
-				ret);
-			return ret;
-		}
-	}
+	if (lmu->en_gpio)
+		gpiod_set_value(lmu->en_gpio, 1);
 
 	/* Delay about 1ms after HW enable pin control */
 	usleep_range(1000, 1500);
@@ -59,8 +49,8 @@ static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
 
 static void ti_lmu_disable_hw(struct ti_lmu *lmu)
 {
-	if (gpio_is_valid(lmu->en_gpio))
-		gpio_set_value(lmu->en_gpio, 0);
+	if (lmu->en_gpio)
+		gpiod_set_value(lmu->en_gpio, 0);
 }
 
 static const struct mfd_cell lm3532_devices[] = {
@@ -204,7 +194,13 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 		return PTR_ERR(lmu->regmap);
 
 	/* HW enable pin control and additional power up sequence if required */
-	lmu->en_gpio = of_get_named_gpio(dev->of_node, "enable-gpios", 0);
+	lmu->en_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(lmu->en_gpio)) {
+		ret = PTR_ERR(lmu->en_gpio);
+		dev_err(dev, "Can not request enable GPIO: %d\n", ret);
+		return ret;
+	}
+
 	ret = ti_lmu_enable_hw(lmu, id->driver_data);
 	if (ret)
 		return ret;
diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h
index 09d5f30384e5..1ef51ed36be5 100644
--- a/include/linux/mfd/ti-lmu.h
+++ b/include/linux/mfd/ti-lmu.h
@@ -16,6 +16,7 @@
 #include <linux/gpio.h>
 #include <linux/notifier.h>
 #include <linux/regmap.h>
+#include <linux/gpio/consumer.h>
 
 /* Notifier event */
 #define LMU_EVENT_MONITOR_DONE		0x01
@@ -81,7 +82,7 @@ enum lm363x_regulator_id {
 struct ti_lmu {
 	struct device *dev;
 	struct regmap *regmap;
-	int en_gpio;
+	struct gpio_desc *en_gpio;
 	struct blocking_notifier_head notifier;
 };
 #endif
-- 
2.16.2


  parent reply	other threads:[~2018-03-30 17:24 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 17:24 [PATCHv4 00/10] backlight: Add TI LMU backlight driver Sebastian Reichel
2018-03-30 17:24 ` Sebastian Reichel
2018-03-30 17:24 ` [PATCHv4 01/10] mfd: ti-lmu: constify mfd_cell tables Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-16 14:20   ` Lee Jones
2018-04-16 14:20     ` Lee Jones
2018-03-30 17:24 ` Sebastian Reichel [this message]
2018-03-30 17:24   ` [PATCHv4 02/10] mfd: ti-lmu: switch to gpiod Sebastian Reichel
2018-04-16 14:32   ` Lee Jones
2018-04-16 14:32     ` Lee Jones
2018-03-30 17:24 ` [PATCHv4 03/10] mfd: ti-lmu: use managed resource for everything Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-16 14:38   ` Lee Jones
2018-04-16 14:38     ` Lee Jones
2018-03-30 17:24 ` [PATCHv4 04/10] mfd: ti-lmu: drop of_compatible for backlight driver Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-16 14:40   ` Lee Jones
2018-04-16 14:40     ` Lee Jones
2018-03-30 17:24 ` [PATCHv4 05/10] mfd: ti-lmu: use of_device_get_match_data() helper Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-16 14:41   ` Lee Jones
2018-04-16 14:41     ` Lee Jones
2018-03-30 17:24 ` [PATCHv4 06/10] mfd: ti-lmu: add PWM support Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-03 10:48   ` Pavel Machek
2018-04-03 10:48     ` Pavel Machek
2018-04-04 19:04   ` Dan Murphy
2018-04-04 19:04     ` Dan Murphy
2018-04-04 19:04     ` Dan Murphy
2018-04-09 15:46     ` Sebastian Reichel
2018-04-09 15:46       ` Sebastian Reichel
2018-03-30 17:24 ` [PATCHv4 07/10] mfd: ti-lmu: register one backlight device per channel Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-16 14:42   ` Lee Jones
2018-04-16 14:42     ` Lee Jones
2018-03-30 17:24 ` [PATCHv4 08/10] backlight: add TI LMU backlight driver Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-03 10:49   ` Pavel Machek
2018-04-03 10:49     ` Pavel Machek
2018-04-09 15:54     ` Sebastian Reichel
2018-04-09 15:54       ` Sebastian Reichel
2018-04-10  6:38       ` Pavel Machek
2018-04-10  6:38         ` Pavel Machek
2018-04-04 14:57   ` Daniel Thompson
2018-04-04 14:57     ` Daniel Thompson
2018-04-09 16:14     ` Sebastian Reichel
2018-04-09 16:14       ` Sebastian Reichel
2018-04-04 18:30   ` Dan Murphy
2018-04-04 18:30     ` Dan Murphy
2018-04-04 18:30     ` Dan Murphy
2018-04-09 16:11     ` Sebastian Reichel
2018-04-09 16:11       ` Sebastian Reichel
2018-03-30 17:24 ` [PATCHv4 09/10] dt-bindings: mfd: ti-lmu: update for backlight Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-09 21:06   ` Rob Herring
2018-04-09 21:06     ` Rob Herring
2018-04-09 21:24     ` Sebastian Reichel
2018-04-09 21:24       ` Sebastian Reichel
2018-03-30 17:24 ` [PATCHv4 10/10] ARM: dts: omap4-droid4: update backlight led-controller Sebastian Reichel
2018-03-30 17:24   ` Sebastian Reichel
2018-04-03 10:49   ` Pavel Machek
2018-04-03 10:49     ` Pavel Machek

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=20180330172414.26575-3-sebastian.reichel@collabora.co.uk \
    --to=sebastian.reichel@collabora.co.uk \
    --cc=Milo.Kim@ti.com \
    --cc=daniel.thompson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=tony@atomide.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.