linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH] sm501fb: control panel pin usage with platform data flags
@ 2008-01-21 10:57 Magnus Damm
  2008-01-30 11:12 ` Ben Dooks
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2008-01-21 10:57 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: akpm, lethal, magnus.damm, ben-linux

sm501fb: control panel pin usage with platform data flags

This patch makes it possible to control panel pins usage with flags passed
from the platform data. Without this patch the sm501fb driver always controls
the VBIASEN and FPEN pins. The polarity and use of these pins are very platform
specific, so this patch introduces the flags SM501FB_FLAG_PANEL_USE_VBIASEN
and SM501FB_FLAG_PANEL_USE_FPEN which enable the use of these pins.

This patch is needed to support the a Sharp LQ104V1DG21 lcd panel on SuperH
platforms such as R2D-1 and R2D-PLUS boards. Letting the sm501fb driver control
the FPEN and VBIASEN pins like today just results in lcd panel flicker.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 This is the same patch that was sent to linux-fbdev-devel on 20071228.

 drivers/video/sm501fb.c |   41 +++++++++++++++++++++++++----------------
 include/linux/sm501.h   |    2 ++
 2 files changed, 27 insertions(+), 16 deletions(-)

--- 0003/drivers/video/sm501fb.c
+++ work/drivers/video/sm501fb.c	2007-12-27 14:18:28.000000000 +0900
@@ -639,6 +639,7 @@ static void sm501fb_panel_power(struct s
 {
 	unsigned long control;
 	void __iomem *ctrl_reg = fbi->regs + SM501_DC_PANEL_CONTROL;
+	struct sm501_platdata_fbsub *pd = fbi->pdata->fb_pnl;
 
 	control = readl(ctrl_reg);
 
@@ -655,26 +656,34 @@ static void sm501fb_panel_power(struct s
 		sm501fb_sync_regs(fbi);
 		mdelay(10);
 
-		control |= SM501_DC_PANEL_CONTROL_BIAS;	/* VBIASEN */
-		writel(control, ctrl_reg);
-		sm501fb_sync_regs(fbi);
-		mdelay(10);
-
-		control |= SM501_DC_PANEL_CONTROL_FPEN;
-		writel(control, ctrl_reg);
+		if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
+			control |= SM501_DC_PANEL_CONTROL_BIAS;	/* VBIASEN */
+			writel(control, ctrl_reg);
+			sm501fb_sync_regs(fbi);
+			mdelay(10);
+		}
 
+		if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
+			control |= SM501_DC_PANEL_CONTROL_FPEN;
+			writel(control, ctrl_reg);
+			sm501fb_sync_regs(fbi);
+			mdelay(10);
+		}
 	} else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
 		/* disable panel power */
+		if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
+			control &= ~SM501_DC_PANEL_CONTROL_FPEN;
+			writel(control, ctrl_reg);
+			sm501fb_sync_regs(fbi);
+			mdelay(10);
+		}
 
-		control &= ~SM501_DC_PANEL_CONTROL_FPEN;
-		writel(control, ctrl_reg);
-		sm501fb_sync_regs(fbi);
-		mdelay(10);
-
-		control &= ~SM501_DC_PANEL_CONTROL_BIAS;
-		writel(control, ctrl_reg);
-		sm501fb_sync_regs(fbi);
-		mdelay(10);
+		if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
+			control &= ~SM501_DC_PANEL_CONTROL_BIAS;
+			writel(control, ctrl_reg);
+			sm501fb_sync_regs(fbi);
+			mdelay(10);
+		}
 
 		control &= ~SM501_DC_PANEL_CONTROL_DATA;
 		writel(control, ctrl_reg);
--- 0001/include/linux/sm501.h
+++ work/include/linux/sm501.h	2007-12-27 14:13:40.000000000 +0900
@@ -70,6 +70,8 @@ extern unsigned long sm501_gpio_get(stru
 #define SM501FB_FLAG_DISABLE_AT_EXIT	(1<<1)
 #define SM501FB_FLAG_USE_HWCURSOR	(1<<2)
 #define SM501FB_FLAG_USE_HWACCEL	(1<<3)
+#define SM501FB_FLAG_PANEL_USE_FPEN	(1<<4)
+#define SM501FB_FLAG_PANEL_USE_VBIASEN	(1<<5)
 
 struct sm501_platdata_fbsub {
 	struct fb_videomode	*def_mode;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RESEND][PATCH] sm501fb: control panel pin usage with platform data flags
  2008-01-21 10:57 [RESEND][PATCH] sm501fb: control panel pin usage with platform data flags Magnus Damm
@ 2008-01-30 11:12 ` Ben Dooks
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Dooks @ 2008-01-30 11:12 UTC (permalink / raw)
  To: linux-fbdev-devel

On Mon, Jan 21, 2008 at 07:57:29PM +0900, Magnus Damm wrote:
> sm501fb: control panel pin usage with platform data flags
> 
> This patch makes it possible to control panel pins usage with flags passed
> from the platform data. Without this patch the sm501fb driver always controls
> the VBIASEN and FPEN pins. The polarity and use of these pins are very platform
> specific, so this patch introduces the flags SM501FB_FLAG_PANEL_USE_VBIASEN
> and SM501FB_FLAG_PANEL_USE_FPEN which enable the use of these pins.

Hi, can you change this to having these flags disable these functions,
say SM501FB_FLAG_PANEL_NO_VBIASEN so that existing functionality can
be retained without changing everyone else's usage.
 
> This patch is needed to support the a Sharp LQ104V1DG21 lcd panel on SuperH
> platforms such as R2D-1 and R2D-PLUS boards. Letting the sm501fb driver control
> the FPEN and VBIASEN pins like today just results in lcd panel flicker.
> 
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
> 
>  This is the same patch that was sent to linux-fbdev-devel on 20071228.
> 
>  drivers/video/sm501fb.c |   41 +++++++++++++++++++++++++----------------
>  include/linux/sm501.h   |    2 ++
>  2 files changed, 27 insertions(+), 16 deletions(-)
> 
> --- 0003/drivers/video/sm501fb.c
> +++ work/drivers/video/sm501fb.c	2007-12-27 14:18:28.000000000 +0900
> @@ -639,6 +639,7 @@ static void sm501fb_panel_power(struct s
>  {
>  	unsigned long control;
>  	void __iomem *ctrl_reg = fbi->regs + SM501_DC_PANEL_CONTROL;
> +	struct sm501_platdata_fbsub *pd = fbi->pdata->fb_pnl;
>  
>  	control = readl(ctrl_reg);
>  
> @@ -655,26 +656,34 @@ static void sm501fb_panel_power(struct s
>  		sm501fb_sync_regs(fbi);
>  		mdelay(10);
>  
> -		control |= SM501_DC_PANEL_CONTROL_BIAS;	/* VBIASEN */
> -		writel(control, ctrl_reg);
> -		sm501fb_sync_regs(fbi);
> -		mdelay(10);
> -
> -		control |= SM501_DC_PANEL_CONTROL_FPEN;
> -		writel(control, ctrl_reg);
> +		if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
> +			control |= SM501_DC_PANEL_CONTROL_BIAS;	/* VBIASEN */
> +			writel(control, ctrl_reg);
> +			sm501fb_sync_regs(fbi);
> +			mdelay(10);
> +		}
>  
> +		if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
> +			control |= SM501_DC_PANEL_CONTROL_FPEN;
> +			writel(control, ctrl_reg);
> +			sm501fb_sync_regs(fbi);
> +			mdelay(10);
> +		}
>  	} else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
>  		/* disable panel power */
> +		if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
> +			control &= ~SM501_DC_PANEL_CONTROL_FPEN;
> +			writel(control, ctrl_reg);
> +			sm501fb_sync_regs(fbi);
> +			mdelay(10);
> +		}
>  
> -		control &= ~SM501_DC_PANEL_CONTROL_FPEN;
> -		writel(control, ctrl_reg);
> -		sm501fb_sync_regs(fbi);
> -		mdelay(10);
> -
> -		control &= ~SM501_DC_PANEL_CONTROL_BIAS;
> -		writel(control, ctrl_reg);
> -		sm501fb_sync_regs(fbi);
> -		mdelay(10);
> +		if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
> +			control &= ~SM501_DC_PANEL_CONTROL_BIAS;
> +			writel(control, ctrl_reg);
> +			sm501fb_sync_regs(fbi);
> +			mdelay(10);
> +		}
>  
>  		control &= ~SM501_DC_PANEL_CONTROL_DATA;
>  		writel(control, ctrl_reg);
> --- 0001/include/linux/sm501.h
> +++ work/include/linux/sm501.h	2007-12-27 14:13:40.000000000 +0900
> @@ -70,6 +70,8 @@ extern unsigned long sm501_gpio_get(stru
>  #define SM501FB_FLAG_DISABLE_AT_EXIT	(1<<1)
>  #define SM501FB_FLAG_USE_HWCURSOR	(1<<2)
>  #define SM501FB_FLAG_USE_HWACCEL	(1<<3)
> +#define SM501FB_FLAG_PANEL_USE_FPEN	(1<<4)
> +#define SM501FB_FLAG_PANEL_USE_VBIASEN	(1<<5)
>  
>  struct sm501_platdata_fbsub {
>  	struct fb_videomode	*def_mode;
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-30 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 10:57 [RESEND][PATCH] sm501fb: control panel pin usage with platform data flags Magnus Damm
2008-01-30 11:12 ` Ben Dooks

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).