All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonino A. Daplas" <adaplas@gmail.com>
To: Christian Trefzer <ctrefzer@gmx.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] neofb: add more logic to determine sensibility of register readback
Date: Fri, 10 Feb 2006 19:53:11 +0800	[thread overview]
Message-ID: <43EC7EA7.5030105@gmail.com> (raw)
In-Reply-To: <20060210113616.GA17482@hermes.uziel.local>

Christian Trefzer wrote:
> Hello everyone,
> 
> testing my latest patches through productive use I noticed that we
> require a bit of a logic for the register read to not cause trouble at
> the time of unblanking. Thing is, blanking is implemented through
> deactivation of the LCD activation bit, so if we read back the register,
> the LCD backlight won't come back on until the LID is shut and reopened,
> effectively pushing the work to the BIOS.
> 
> The following patch is on top of my previous one, adding a variable to
> struct neofb_par to remember if we want to read the respective register
> values next time we (un)blank.
> 
> Logic depends on the assumption that we won't change display config in a
> blanked state, as a keypress should already be answered by unblanking.
> Essentially, we should read back the register values to variable on
> blank, and ignore them on unblank. Unfortunately, only checking for
> !blank_mode won't avoid the backlight remaining off, hence the
> additional checks. 
> 
> Signed-off-by: Christian Trefzer <ctrefzer@gmx.de>
> 
> 
> --- a/include/video/neomagic.h	2006-01-03 04:21:10.000000000 +0100
> +++ b/include/video/neomagic.h	2006-02-09 20:59:20.164839408 +0100
> @@ -159,6 +159,7 @@
>  	unsigned char PanelDispCntlReg1;
>  	unsigned char PanelDispCntlReg2;
>  	unsigned char PanelDispCntlReg3;
> +	unsigned char PanelDispCntlRegRead;
>  	unsigned char PanelVertCenterReg1;
>  	unsigned char PanelVertCenterReg2;
>  	unsigned char PanelVertCenterReg3;
> --- a/drivers/video/neofb.c	2006-02-08 21:24:05.000000000 +0100
> +++ b/drivers/video/neofb.c	2006-02-09 23:21:33.489914472 +0100
> @@ -1334,8 +1334,11 @@
>  	struct neofb_par *par = (struct neofb_par *)info->par;
>  	int seqflags, lcdflags, dpmsflags, reg;
>  
> -	/* Reload the value stored in the register, might have been changed via FN keystroke */
> -	par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
> +	/* Reload the value stored in the register, if sensible. It might have been
> +	 * changed via FN keystroke. */
> +	if (par->PanelDispCntlRegRead && !blank_mode) {
> +		par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
> +	}
>  	
>  	switch (blank_mode) {
>  	case FB_BLANK_POWERDOWN:	/* powerdown - both sync lines down */
> @@ -1355,21 +1358,25 @@
>  			tosh_smm(&regs);
>  		}
>  #endif
> +		par->PanelDispCntlRegRead = 0;
>  		break;
>  	case FB_BLANK_HSYNC_SUSPEND:		/* hsync off */
>  		seqflags = VGA_SR01_SCREEN_OFF;	/* Disable sequencer */
>  		lcdflags = 0;			/* LCD off */
>  		dpmsflags = NEO_GR01_SUPPRESS_HSYNC;
> +		par->PanelDispCntlRegRead = 0;
>  		break;
>  	case FB_BLANK_VSYNC_SUSPEND:		/* vsync off */
>  		seqflags = VGA_SR01_SCREEN_OFF;	/* Disable sequencer */
>  		lcdflags = 0;			/* LCD off */
>  		dpmsflags = NEO_GR01_SUPPRESS_VSYNC;
> +		par->PanelDispCntlRegRead = 0;
>  		break;
>  	case FB_BLANK_NORMAL:		/* just blank screen (backlight stays on) */
>  		seqflags = VGA_SR01_SCREEN_OFF;	/* Disable sequencer */
>  		lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */
>  		dpmsflags = 0x00;	/* no hsync/vsync suppression */
> +		par->PanelDispCntlRegRead = 0;
>  		break;
>  	case FB_BLANK_UNBLANK:		/* unblank */
>  		seqflags = 0;			/* Enable sequencer */
> @@ -1387,6 +1394,7 @@
>  			tosh_smm(&regs);
>  		}
>  #endif
> +		par->PanelDispCntlRegRead = 1;
>  		break;
>  	default:	/* Anything else we don't understand; return 1 to tell
>  			 * fb_blank we didn't aactually do anything */

You can save a few lines by

par->PanelDispCntlRegRead = (blank_mode) ? 0 : 1;

Tony

  reply	other threads:[~2006-02-10 11:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08 20:22 [PATCH] neofb: avoid resetting display config on unblank Christian Trefzer
2006-02-10 11:36 ` [PATCH] neofb: add more logic to determine sensibility of register readback Christian Trefzer
2006-02-10 11:53   ` Antonino A. Daplas [this message]
2006-02-10 13:57     ` Christian Trefzer
2006-02-10 16:41     ` Kyle Moffett
2006-02-11 10:42       ` Christian Trefzer

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=43EC7EA7.5030105@gmail.com \
    --to=adaplas@gmail.com \
    --cc=ctrefzer@gmx.de \
    --cc=linux-kernel@vger.kernel.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.