From: festevam@gmail.com (Fabio Estevam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/2] video: mxsfb: Use devm_regulator_get()
Date: Thu, 4 Apr 2013 23:20:55 -0300 [thread overview]
Message-ID: <1365128456-8762-2-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1365128456-8762-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <fabio.estevam@freescale.com>
Instead of using a custom binding for retrieving the GPIO that activates the
LCD from devicetree, use the standard devm_regulator_get().
This approach has the advantage to be more generic.
For example: in the case of a board that has a PMIC supplying the LCD voltage,
the current approach would not work, as it only searches for a GPIO pin.
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v3:
- None
Changes since v2:
- Use devm_regulator_get()
Changes since v1:
- No changes
drivers/video/mxsfb.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index eac7c1a..c536887 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -42,7 +42,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/of_device.h>
-#include <linux/of_gpio.h>
#include <video/of_display_timing.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
@@ -51,6 +50,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/fb.h>
#include <video/videomode.h>
+#include <linux/regulator/consumer.h>
#define REG_SET 4
#define REG_CLR 8
@@ -859,9 +859,8 @@ static int mxsfb_probe(struct platform_device *pdev)
struct fb_info *fb_info;
struct fb_modelist *modelist;
struct pinctrl *pinctrl;
- int panel_enable;
- enum of_gpio_flags flags;
int ret;
+ struct regulator *reg_lcd;
if (of_id)
pdev->id_entry = of_id->data;
@@ -904,18 +903,12 @@ static int mxsfb_probe(struct platform_device *pdev)
goto fb_release;
}
- panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
- "panel-enable-gpios", 0, &flags);
- if (gpio_is_valid(panel_enable)) {
- unsigned long f = GPIOF_OUT_INIT_HIGH;
- if (flags == OF_GPIO_ACTIVE_LOW)
- f = GPIOF_OUT_INIT_LOW;
- ret = devm_gpio_request_one(&pdev->dev, panel_enable,
- f, "panel-enable");
+ reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
+ if (!IS_ERR(reg_lcd)) {
+ ret = regulator_enable(reg_lcd);
if (ret) {
dev_err(&pdev->dev,
- "failed to request gpio %d: %d\n",
- panel_enable, ret);
+ "Failed to enable lcd regulator: %d\n", ret);
goto fb_release;
}
}
--
1.7.9.5
next prev parent reply other threads:[~2013-04-05 2:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 2:20 [PATCH v4 1/2] ARM: dts: mxs: Use 'regulator-fixed' for turning on LCD Fabio Estevam
2013-04-05 2:20 ` Fabio Estevam [this message]
2013-04-05 3:39 ` [PATCH v4 2/2] video: mxsfb: Use devm_regulator_get() Fabio Estevam
2013-04-05 9:21 ` [PATCH v4 1/2] ARM: dts: mxs: Use 'regulator-fixed' for turning on LCD Shawn Guo
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=1365128456-8762-2-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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