From: denis@eukrea.com (Denis Carikli)
To: linux-arm-kernel@lists.infradead.org
Subject: [Patch v2][ 07/37] video: mx3fb: Introduce regulator support.
Date: Thu, 17 Oct 2013 17:02:05 +0200 [thread overview]
Message-ID: <1382022155-21954-8-git-send-email-denis@eukrea.com> (raw)
In-Reply-To: <1382022155-21954-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: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev at vger.kernel.org
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: linux-arm-kernel at lists.infradead.org
Cc: Eric B?nard <eric@eukrea.com>
Signed-off-by: Denis Carikli <denis@eukrea.com>
---
drivers/video/mx3fb.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 804f874..37704da 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -27,6 +27,7 @@
#include <linux/clk.h>
#include <linux/mutex.h>
#include <linux/dma/ipu-dma.h>
+#include <linux/regulator/consumer.h>
#include <linux/platform_data/dma-imx.h>
#include <linux/platform_data/video-mx3fb.h>
@@ -267,6 +268,7 @@ struct mx3fb_info {
struct dma_async_tx_descriptor *txd;
dma_cookie_t cookie;
struct scatterlist sg[2];
+ struct regulator *reg_lcd;
struct fb_var_screeninfo cur_var; /* current var info */
};
@@ -1001,6 +1003,7 @@ static void __blank(int blank, struct fb_info *fbi)
struct mx3fb_info *mx3_fbi = fbi->par;
struct mx3fb_data *mx3fb = mx3_fbi->mx3fb;
int was_blank = mx3_fbi->blank;
+ int ret;
mx3_fbi->blank = blank;
@@ -1019,6 +1022,15 @@ static void __blank(int blank, struct fb_info *fbi)
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_NORMAL:
sdc_set_brightness(mx3fb, 0);
+ if (mx3_fbi->reg_lcd) {
+ if (regulator_is_enabled(mx3_fbi->reg_lcd)) {
+ ret = regulator_disable(mx3_fbi->reg_lcd);
+ if (ret)
+ dev_warn(fbi->device,
+ "lcd regulator disable failed "
+ "with error: %d\n", ret);
+ }
+ }
memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
/* Give LCD time to update - enough for 50 and 60 Hz */
msleep(25);
@@ -1026,7 +1038,17 @@ static void __blank(int blank, struct fb_info *fbi)
break;
case FB_BLANK_UNBLANK:
sdc_enable_channel(mx3_fbi);
+ if (mx3_fbi->reg_lcd) {
+ if (!regulator_is_enabled(mx3_fbi->reg_lcd)) {
+ ret = regulator_enable(mx3_fbi->reg_lcd);
+ if (ret)
+ dev_warn(fbi->device,
+ "lcd regulator enable failed "
+ "with error: %d\n", ret);
+ }
+ }
sdc_set_brightness(mx3fb, mx3fb->backlight_level);
+
break;
}
}
@@ -1202,6 +1224,7 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)
{
struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
+ int ret;
console_lock();
fb_set_suspend(mx3fb->fbi, 1);
@@ -1210,7 +1233,15 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)
if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
sdc_disable_channel(mx3_fbi);
sdc_set_brightness(mx3fb, 0);
-
+ if (mx3_fbi->reg_lcd) {
+ if (regulator_is_enabled(mx3_fbi->reg_lcd)) {
+ ret = regulator_disable(mx3_fbi->reg_lcd);
+ if (ret)
+ dev_warn(&pdev->dev,
+ "lcd regulator disable failed "
+ "with error: %d\n", ret);
+ }
+ }
}
return 0;
}
@@ -1222,10 +1253,20 @@ static int mx3fb_resume(struct platform_device *pdev)
{
struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
+ int ret;
if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
sdc_enable_channel(mx3_fbi);
sdc_set_brightness(mx3fb, mx3fb->backlight_level);
+ if (mx3_fbi->reg_lcd) {
+ if (!regulator_is_enabled(mx3_fbi->reg_lcd)) {
+ ret = regulator_enable(mx3_fbi->reg_lcd);
+ if (ret)
+ dev_warn(&pdev->dev,
+ "lcd regulator enable failed "
+ "with error: %d\n", ret);
+ }
+ }
}
console_lock();
@@ -1438,6 +1479,10 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
if (ret < 0)
goto erfb;
+ mx3fbi->reg_lcd = devm_regulator_get(dev, "lcd");
+ if (IS_ERR(mx3fbi->reg_lcd))
+ mx3fbi->reg_lcd = NULL;
+
return 0;
erfb:
--
1.7.9.5
next prev parent reply other threads:[~2013-10-17 15:02 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-17 15:01 Devicetree support for Eukrea cpuimx{25,35,51} (v2) Denis Carikli
2013-10-17 15:01 ` [Patch v2][ 01/37] of: add vendor prefix for Eukréa Electromatique Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 02/37] dma: ipu: Add devicetree support Denis Carikli
2013-10-18 6:42 ` Sascha Hauer
2013-10-17 15:02 ` [Patch v2][ 03/37] drm: Add the lacking DRM_MODE_FLAG_* for matching the DISPLAY_FLAGS_* Denis Carikli
2013-10-18 7:46 ` Ville Syrjälä
2013-10-23 14:48 ` Denis Carikli
2013-10-23 15:38 ` Ville Syrjälä
2013-10-23 15:47 ` Matt Sealey
2013-10-17 15:02 ` [Patch v2][ 04/37] [media] v4l2: add new V4L2_PIX_FMT_RGB666 pixel format Denis Carikli
2013-10-31 13:18 ` Mauro Carvalho Chehab
2013-10-31 14:06 ` Laurent Pinchart
2013-10-17 15:02 ` [Patch v2][ 05/37] fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_* Denis Carikli
2013-10-19 11:08 ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-17 15:02 ` [Patch v2][ 06/37] video: backlight: gpio-backlight: Add DT support Denis Carikli
2013-10-17 15:02 ` Denis Carikli [this message]
2013-10-19 11:08 ` [Patch v2][ 07/37] video: mx3fb: Introduce regulator support Jean-Christophe PLAGNIOL-VILLARD
2013-10-17 15:02 ` [Patch v2][ 08/37] video: mx3fb: Add device tree suport Denis Carikli
2013-10-19 11:04 ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-21 8:03 ` Sascha Hauer
2013-10-17 15:02 ` [Patch v2][ 09/37] video: imxfb: Introduce regulator support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 10/37] video: imxfb: Also add pwmr for the device tree Denis Carikli
2013-10-19 10:57 ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-17 15:02 ` [Patch v2][ 11/37] staging: imx-drm: use of_get_display_timings Denis Carikli
2013-10-18 6:46 ` Sascha Hauer
2013-10-17 15:02 ` [Patch v2][ 12/37] staging: imx-drm: ipuv3-crtc: don't harcode some mode flags Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 13/37] staging: imx-drm: Add RGB666 support for parallel display Denis Carikli
2013-10-31 13:18 ` Mauro Carvalho Chehab
2013-10-17 15:02 ` [Patch v2][ 14/37] staging: imx-drm: parallel display: add regulator support Denis Carikli
2013-10-17 16:47 ` Dan Carpenter
2013-10-17 15:02 ` [Patch v2][ 15/37] Input: tsc2007: Add device tree support Denis Carikli
2013-10-18 8:36 ` Lothar Waßmann
2013-10-17 15:02 ` [Patch v2][ 16/37] ASoC: eukrea-tlv320: Add DT support Denis Carikli
2013-10-18 9:19 ` Lothar Waßmann
2013-10-17 15:02 ` [Patch v2][ 17/37] DT: Add basic support for imx35-based devices Denis Carikli
2013-10-18 6:58 ` Sascha Hauer
2013-10-17 15:02 ` [Patch v2][ 18/37] ARM: imx{25, 27} DT: Permit the selection of the imxfb framebuffer driver Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 19/37] pinctrl: pinctrl-imx: add imx25 pinctrl driver Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 20/37] arm/dts: imx25.dtsi: Add some pinmux pins Denis Carikli
2013-10-18 7:02 ` Sascha Hauer
2013-10-17 15:02 ` [Patch v2][ 21/37] arm/dts: i.MX25: Add ssi clocks and DMA events Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 22/37] arm/dts: i.MX25: Add sdma script path Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 23/37] arm/dts: imx25.dtsi: Add an alias for the Audio Multiplexer Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 24/37] arm/dts: Add support for the cpuimx25 board from Eukrea and its baseboard Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 25/37] arm/dts: imx51.dtsi: Add some pinmux pins Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 26/37] arm/dts: Add support for the cpuimx51 board from Eukrea and its baseboard Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 27/37] arm/dts: Add support for the cpuimx35 " Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 28/37] ARM: imx_v6_v7_defconfig: Enable i.MX35 DT support Denis Carikli
2013-10-18 8:23 ` Shawn Guo
2013-10-17 15:02 ` [Patch v2][ 29/37] ARM: imx_v6_v7_defconfig: Enable tsc2007 support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 30/37] ARM: imx_v6_v7_defconfig: Enable pcf8563 support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 31/37] ARM: imx_v6_v7_defconfig: Enable gpio regulator support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 32/37] ARM: imx_v4_v5_defconfig: " Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 33/37] ARM: imx_v4_v5_defconfig: Enable backlight gpio support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 34/37] ARM: imx_v6_v7_defconfig: " Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 35/37] ARM: imx_v4_v5_defconfig: Enable gpio button/keyboard support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 36/37] ARM: imx_v6_v7_defconfig: Enable led gpio support Denis Carikli
2013-10-17 15:02 ` [Patch v2][ 37/37] ARM: imx_v6_v7_defconfig: Enable heartbeat led trigger Denis Carikli
2013-10-18 7:59 ` Devicetree support for Eukrea cpuimx{25,35,51} (v2) Sascha Hauer
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=1382022155-21954-8-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 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).