From: Denis Carikli <denis@eukrea.com> To: linux-arm-kernel@lists.infradead.org Subject: [PATCHv11][ 1/7] video: imxfb: Introduce regulator support. Date: Tue, 05 Nov 2013 14:39:08 +0000 [thread overview] Message-ID: <1383662354-22417-1-git-send-email-denis@eukrea.com> (raw) 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> --- ChangeLog v9->v10: - Added a return 0; at the end of imxfb_disable_controller. ChangeLog v8->v9: - return an error if regulator_{enable,disable} fails in imxfb_{enable,disable}_controller, and use it. --- drivers/video/imxfb.c | 55 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 38733ac..a2fe8bd 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; @@ -561,14 +563,25 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi) } #endif -static void imxfb_enable_controller(struct imxfb_info *fbi) +static int imxfb_enable_controller(struct imxfb_info *fbi) { + int ret; if (fbi->enabled) - return; + return 0; 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 ret; + } + } + writel(fbi->screen_dma, fbi->regs + LCDC_SSA); /* panning offset 0 (0 pixel offset) */ @@ -593,12 +606,16 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) fbi->backlight_power(1); if (fbi->lcd_power) fbi->lcd_power(1); + + return 0; } -static void imxfb_disable_controller(struct imxfb_info *fbi) +static int imxfb_disable_controller(struct imxfb_info *fbi) { + int ret; + if (!fbi->enabled) - return; + return 0; pr_debug("Disabling LCD controller\n"); @@ -613,6 +630,17 @@ 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); + return ret; + } + + return 0; } static int imxfb_blank(int blank, struct fb_info *info) @@ -626,13 +654,12 @@ static int imxfb_blank(int blank, struct fb_info *info) case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_NORMAL: - imxfb_disable_controller(fbi); - break; + return imxfb_disable_controller(fbi); case FB_BLANK_UNBLANK: - imxfb_enable_controller(fbi); - break; + return imxfb_enable_controller(fbi); } + return 0; } @@ -734,8 +761,7 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state) pr_debug("%s\n", __func__); - imxfb_disable_controller(fbi); - return 0; + return imxfb_disable_controller(fbi); } static int imxfb_resume(struct platform_device *dev) @@ -745,8 +771,7 @@ static int imxfb_resume(struct platform_device *dev) pr_debug("%s\n", __func__); - imxfb_enable_controller(fbi); - return 0; + return imxfb_enable_controller(fbi); } #else #define imxfb_suspend NULL @@ -1020,6 +1045,12 @@ 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)) { + dev_info(&pdev->dev, "No lcd regulator used.\n"); + 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: [PATCHv11][ 1/7] video: imxfb: Introduce regulator support. Date: Tue, 5 Nov 2013 15:39:08 +0100 [thread overview] Message-ID: <1383662354-22417-1-git-send-email-denis@eukrea.com> (raw) 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> --- ChangeLog v9->v10: - Added a return 0; at the end of imxfb_disable_controller. ChangeLog v8->v9: - return an error if regulator_{enable,disable} fails in imxfb_{enable,disable}_controller, and use it. --- drivers/video/imxfb.c | 55 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 38733ac..a2fe8bd 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; @@ -561,14 +563,25 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi) } #endif -static void imxfb_enable_controller(struct imxfb_info *fbi) +static int imxfb_enable_controller(struct imxfb_info *fbi) { + int ret; if (fbi->enabled) - return; + return 0; 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 ret; + } + } + writel(fbi->screen_dma, fbi->regs + LCDC_SSA); /* panning offset 0 (0 pixel offset) */ @@ -593,12 +606,16 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) fbi->backlight_power(1); if (fbi->lcd_power) fbi->lcd_power(1); + + return 0; } -static void imxfb_disable_controller(struct imxfb_info *fbi) +static int imxfb_disable_controller(struct imxfb_info *fbi) { + int ret; + if (!fbi->enabled) - return; + return 0; pr_debug("Disabling LCD controller\n"); @@ -613,6 +630,17 @@ 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); + return ret; + } + + return 0; } static int imxfb_blank(int blank, struct fb_info *info) @@ -626,13 +654,12 @@ static int imxfb_blank(int blank, struct fb_info *info) case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_NORMAL: - imxfb_disable_controller(fbi); - break; + return imxfb_disable_controller(fbi); case FB_BLANK_UNBLANK: - imxfb_enable_controller(fbi); - break; + return imxfb_enable_controller(fbi); } + return 0; } @@ -734,8 +761,7 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state) pr_debug("%s\n", __func__); - imxfb_disable_controller(fbi); - return 0; + return imxfb_disable_controller(fbi); } static int imxfb_resume(struct platform_device *dev) @@ -745,8 +771,7 @@ static int imxfb_resume(struct platform_device *dev) pr_debug("%s\n", __func__); - imxfb_enable_controller(fbi); - return 0; + return imxfb_enable_controller(fbi); } #else #define imxfb_suspend NULL @@ -1020,6 +1045,12 @@ 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)) { + dev_info(&pdev->dev, "No lcd regulator used.\n"); + fbi->reg_lcd = NULL; + } + imxfb_enable_controller(fbi); fbi->pdev = pdev; #ifdef PWMR_BACKLIGHT_AVAILABLE -- 1.7.9.5
next reply other threads:[~2013-11-05 14:39 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-11-05 14:39 Denis Carikli [this message] 2013-11-05 14:39 ` [PATCHv11][ 1/7] video: imxfb: Introduce regulator support Denis Carikli [not found] ` <1383662354-22417-1-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org> 2013-11-05 14:39 ` [PATCHv11][ 2/7] video: imxfb: Also add pwmr for the device tree Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` [PATCHv11][ 3/7] video: Kconfig: Allow more broad selection of the imxfb framebuffer driver Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` [PATCHv11][ 4/7] pinctrl: pinctrl-imx: add imx25 pinctrl driver Denis Carikli 2013-11-05 14:39 ` Denis Carikli [not found] ` <1383662354-22417-4-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org> 2013-11-05 14:56 ` Markus Pargmann 2013-11-05 14:56 ` Markus Pargmann 2013-11-05 14:39 ` [PATCHv11][ 5/7] ARM: dts: imx25.dtsi: Permit to use the iomuxc in the dts Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` [PATCHv11][ 6/7] ARM i.MX25: build in pinctrl support Denis Carikli 2013-11-05 14:39 ` Denis Carikli 2013-11-05 14:39 ` [PATCHv11][ 7/7] ARM: dts: Add support for the cpuimx25 board from Eukrea and its baseboard Denis Carikli 2013-11-05 14:39 ` Denis Carikli
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=1383662354-22417-1-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: linkBe 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.