All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Carikli <denis@eukrea.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/11] video: imxfb: Introduce regulator support.
Date: Fri, 18 Oct 2013 15:04:23 +0000	[thread overview]
Message-ID: <1382108672-23269-2-git-send-email-denis@eukrea.com> (raw)
In-Reply-To: <1382108672-23269-1-git-send-email-denis@eukrea.com>

This commit is based on the following commit by Fabio Estevam:
  4344429 video: mxsfb: Introduce regulator support

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Eric Bénard <eric@eukrea.com>
Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/video/imxfb.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 44ee678..4dd7678 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -28,6 +28,7 @@
 #include <linux/cpufreq.h>
 #include <linux/clk.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/math64.h>
@@ -145,6 +146,7 @@ struct imxfb_info {
 	struct clk		*clk_ipg;
 	struct clk		*clk_ahb;
 	struct clk		*clk_per;
+	struct regulator	*reg_lcd;
 	enum imxfb_type		devtype;
 	bool			enabled;
 
@@ -563,12 +565,23 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi)
 
 static void imxfb_enable_controller(struct imxfb_info *fbi)
 {
+	int ret;
 
 	if (fbi->enabled)
 		return;
 
 	pr_debug("Enabling LCD controller\n");
 
+	if (fbi->reg_lcd) {
+		ret = regulator_enable(fbi->reg_lcd);
+		if (ret) {
+			dev_err(&fbi->pdev->dev,
+				"lcd regulator enable failed with error: %d\n",
+				ret);
+			return;
+		}
+	}
+
 	writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
 
 	/* panning offset 0 (0 pixel offset)        */
@@ -597,6 +610,8 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 
 static void imxfb_disable_controller(struct imxfb_info *fbi)
 {
+	int ret;
+
 	if (!fbi->enabled)
 		return;
 
@@ -613,6 +628,14 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 	fbi->enabled = false;
 
 	writel(0, fbi->regs + LCDC_RMCR);
+
+	if (fbi->reg_lcd) {
+		ret = regulator_disable(fbi->reg_lcd);
+		if (ret)
+			dev_err(&fbi->pdev->dev,
+				"lcd regulator disable failed with error: %d\n",
+				ret);
+	}
 }
 
 static int imxfb_blank(int blank, struct fb_info *info)
@@ -1020,6 +1043,10 @@ static int imxfb_probe(struct platform_device *pdev)
 		goto failed_register;
 	}
 
+	fbi->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
+	if (IS_ERR(fbi->reg_lcd))
+		fbi->reg_lcd = NULL;
+
 	imxfb_enable_controller(fbi);
 	fbi->pdev = pdev;
 #ifdef PWMR_BACKLIGHT_AVAILABLE
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: denis@eukrea.com (Denis Carikli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/11] video: imxfb: Introduce regulator support.
Date: Fri, 18 Oct 2013 17:04:23 +0200	[thread overview]
Message-ID: <1382108672-23269-2-git-send-email-denis@eukrea.com> (raw)
In-Reply-To: <1382108672-23269-1-git-send-email-denis@eukrea.com>

This commit is based on the following commit by Fabio Estevam:
  4344429 video: mxsfb: Introduce regulator support

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: linux-arm-kernel at lists.infradead.org
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev at vger.kernel.org
Cc: Eric B?nard <eric@eukrea.com>
Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/video/imxfb.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 44ee678..4dd7678 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -28,6 +28,7 @@
 #include <linux/cpufreq.h>
 #include <linux/clk.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/math64.h>
@@ -145,6 +146,7 @@ struct imxfb_info {
 	struct clk		*clk_ipg;
 	struct clk		*clk_ahb;
 	struct clk		*clk_per;
+	struct regulator	*reg_lcd;
 	enum imxfb_type		devtype;
 	bool			enabled;
 
@@ -563,12 +565,23 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi)
 
 static void imxfb_enable_controller(struct imxfb_info *fbi)
 {
+	int ret;
 
 	if (fbi->enabled)
 		return;
 
 	pr_debug("Enabling LCD controller\n");
 
+	if (fbi->reg_lcd) {
+		ret = regulator_enable(fbi->reg_lcd);
+		if (ret) {
+			dev_err(&fbi->pdev->dev,
+				"lcd regulator enable failed with error: %d\n",
+				ret);
+			return;
+		}
+	}
+
 	writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
 
 	/* panning offset 0 (0 pixel offset)        */
@@ -597,6 +610,8 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 
 static void imxfb_disable_controller(struct imxfb_info *fbi)
 {
+	int ret;
+
 	if (!fbi->enabled)
 		return;
 
@@ -613,6 +628,14 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 	fbi->enabled = false;
 
 	writel(0, fbi->regs + LCDC_RMCR);
+
+	if (fbi->reg_lcd) {
+		ret = regulator_disable(fbi->reg_lcd);
+		if (ret)
+			dev_err(&fbi->pdev->dev,
+				"lcd regulator disable failed with error: %d\n",
+				ret);
+	}
 }
 
 static int imxfb_blank(int blank, struct fb_info *info)
@@ -1020,6 +1043,10 @@ static int imxfb_probe(struct platform_device *pdev)
 		goto failed_register;
 	}
 
+	fbi->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
+	if (IS_ERR(fbi->reg_lcd))
+		fbi->reg_lcd = NULL;
+
 	imxfb_enable_controller(fbi);
 	fbi->pdev = pdev;
 #ifdef PWMR_BACKLIGHT_AVAILABLE
-- 
1.7.9.5

  reply	other threads:[~2013-10-18 15:04 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 15:04 [PATCH 01/11] of: add vendor prefix for Eukréa Electromatique Denis Carikli
2013-10-18 15:04 ` Denis Carikli
2013-10-18 15:04 ` Denis Carikli [this message]
2013-10-18 15:04   ` [PATCH 02/11] video: imxfb: Introduce regulator support Denis Carikli
2013-10-19 10:45   ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-19 10:45     ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]     ` <20131019104555.GI18477-HVbc7XotTAhnXn40ka+A6Q@public.gmane.org>
2013-10-21  9:13       ` [PATCHv4] video: backlight: gpio-backlight: Add DT support Denis Carikli
2013-10-21  9:13         ` Denis Carikli
     [not found]         ` <1382346813-8449-1-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
2013-10-21 22:48           ` Laurent Pinchart
2013-10-21 22:48             ` Laurent Pinchart
2013-10-22  5:11             ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-22  5:11               ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-22  4:58         ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-22  4:58           ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]           ` <20131022045833.GB17512-HVbc7XotTAhnXn40ka+A6Q@public.gmane.org>
2013-10-22  7:23             ` Thierry Reding
2013-10-22  7:23               ` Thierry Reding
2013-10-22 15:34               ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-22 15:34                 ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]                 ` <20131022153445.GD17512-HVbc7XotTAhnXn40ka+A6Q@public.gmane.org>
2013-10-22 20:01                   ` Thierry Reding
2013-10-22 20:01                     ` Thierry Reding
2013-10-23 13:42                     ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-23 13:42                       ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]                       ` <20131023134236.GE17512-HVbc7XotTAhnXn40ka+A6Q@public.gmane.org>
2013-10-23 16:49                         ` Stephen Warren
2013-10-23 16:49                           ` Stephen Warren
     [not found]                           ` <5267FE02.6000001-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-23 20:08                             ` Thierry Reding
2013-10-23 20:08                               ` Thierry Reding
2013-10-23 16:51                     ` Stephen Warren
2013-10-23 16:51                       ` Stephen Warren
     [not found]                       ` <5267FE81.3070201-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-23 20:20                         ` Thierry Reding
2013-10-23 20:20                           ` Thierry Reding
2013-10-23 22:38                           ` Laurent Pinchart
2013-10-23 22:38                             ` Laurent Pinchart
2013-10-24 11:05                             ` Thierry Reding
2013-10-24 11:05                               ` Thierry Reding
     [not found]                               ` <20131024110524.GB11296-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-10-25 13:57                                 ` Laurent Pinchart
2013-10-25 13:57                                   ` Laurent Pinchart
2013-10-31 23:44                                   ` Jingoo Han
2013-10-31 23:44                                     ` Jingoo Han
     [not found]                                     ` <003701ced693$2f856150$8e9023f0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-11-01  9:57                                       ` Thierry Reding
2013-11-01  9:57                                         ` Thierry Reding
     [not found]                                         ` <20131101095754.GJ27864-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-11-04  0:20                                           ` Jingoo Han
2013-11-04  0:20                                             ` Jingoo Han
2013-10-31 23:37                     ` Jingoo Han
2013-10-31 23:37                       ` Jingoo Han
     [not found]                       ` <001e01ced692$267a6d90$736f48b0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-11-01 10:13                         ` Thierry Reding
2013-11-01 10:13                           ` Thierry Reding
     [not found]                           ` <20131101101346.GK27864-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-11-06  0:08                             ` Laurent Pinchart
2013-11-06  0:08                               ` Laurent Pinchart
2013-10-25 20:10         ` Grant Likely
2013-10-25 20:10           ` Grant Likely

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=1382108672-23269-2-git-send-email-denis@eukrea.com \
    --to=denis@eukrea.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 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.