Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH] viafb: fix pointer type missmatch
From: Wang Shaoyan @ 2011-08-06 15:03 UTC (permalink / raw)
  To: Florian Tobias Schandinat; +Cc: linux-kernel, linux-fbdev, lethal, Wang Shaoyan
In-Reply-To: <4E3D5154.2040808@gmx.de>

hi, the gmail is just to send patch, I have to use it, because my work
mail server will append some spam information. So my signed-off-by is
right author, that's why I add an obvious "From:". Sorry to trobule
you.

> But as I assume you, who sent this email, are not the original author,
> please resent it with your Signed-off-by added. (as keeping track who
> received the patch from whom is one reasons for having those)


-- 
Wang Shaoyan

^ permalink raw reply

* Re: [PATCH] viafb: fix pointer type missmatch
From: Florian Tobias Schandinat @ 2011-08-06 14:36 UTC (permalink / raw)
  To: stufever; +Cc: linux-kernel, linux-fbdev, lethal, Wang Shaoyan
In-Reply-To: <1312637180-6107-1-git-send-email-wangshaoyan.pt@taobao.com>

Hi,

On 08/06/2011 01:26 PM, stufever@gmail.com wrote:
> From: Wang Shaoyan<wangshaoyan.pt@taobao.com>
>
>    drivers/video/via/via-core.c: In function 'via_pci_probe':
>    drivers/video/via/via-core.c:691: warning: assignment discards qualifiers from pointer target type
>
> Signed-off-by: Wang Shaoyan<wangshaoyan.pt@taobao.com>
> ---
>   drivers/video/via/via-core.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c
> index eb112b6..dd58b53 100644
> --- a/drivers/video/via/via-core.c
> +++ b/drivers/video/via/via-core.c
> @@ -35,7 +35,7 @@ static struct via_port_cfg adap_configs[] = {
>    * The OLPC XO-1.5 puts the camera power and reset lines onto
>    * GPIO 2C.
>    */
> -static const struct via_port_cfg olpc_adap_configs[] = {
> +static struct via_port_cfg olpc_adap_configs[] = {

Well the const was there as this object should really not be changed at runtime. 
But as the correct solution is not feasible as it conflicts with the I2C API and 
casting the const away would be evil as well I will accept this patch.
But as I assume you, who sent this email, are not the original author, please 
resent it with your Signed-off-by added. (as keeping track who received the 
patch from whom is one reasons for having those)

>   	[VIA_PORT_26]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x26 },
>   	[VIA_PORT_31]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x31 },
>   	[VIA_PORT_25]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x25 },

Thanks,

Florian Tobias Schandinat

^ permalink raw reply

* [PATCH] viafb: fix pointer type missmatch
From: stufever @ 2011-08-06 13:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fbdev, lethal, FlorianSchandinat, Wang Shaoyan

From: Wang Shaoyan <wangshaoyan.pt@taobao.com>

  drivers/video/via/via-core.c: In function 'via_pci_probe':
  drivers/video/via/via-core.c:691: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
 drivers/video/via/via-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c
index eb112b6..dd58b53 100644
--- a/drivers/video/via/via-core.c
+++ b/drivers/video/via/via-core.c
@@ -35,7 +35,7 @@ static struct via_port_cfg adap_configs[] = {
  * The OLPC XO-1.5 puts the camera power and reset lines onto
  * GPIO 2C.
  */
-static const struct via_port_cfg olpc_adap_configs[] = {
+static struct via_port_cfg olpc_adap_configs[] = {
 	[VIA_PORT_26]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x26 },
 	[VIA_PORT_31]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x31 },
 	[VIA_PORT_25]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x25 },
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 6/6] viafb: remove 640x480-60 CRT special case
From: Florian Tobias Schandinat @ 2011-08-05 21:59 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

The timing for 640x480-60 was handled different than all others.
This patch changes this by changing the blanking start and end.
The reason for this is that I can't find any reason for the old
behaviour and it was not consistent anyway as the special case for
LCD did not always trigger as the LCD code does not use this
function and it did trigger regardless of whether the display set is
CRT or LCD but only based whether any DVI/LCD device exists.
There are no negative effects observed for CRT or DVI devices.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/hw.c      |   14 --------------
 drivers/video/via/viamode.c |    2 +-
 2 files changed, 1 insertions(+), 15 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing
From: Florian Tobias Schandinat @ 2011-08-05 21:58 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

As the first argument is just part of the structure passed as the
second argument there is no need for it at all.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/dvi.c |    6 ++----
 drivers/video/via/hw.c  |   12 ++++++------
 drivers/video/via/hw.h  |    4 ++--
 3 files changed, 10 insertions(+), 12 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 4/6] viafb: remove superfluous mode lookup
From: Florian Tobias Schandinat @ 2011-08-05 21:58 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

As the result is not used anywhere there is no need to perform the
lookup at all.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/viafbdev.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 3/6] viafb: remove superfluous register unlocking/locking
From: Florian Tobias Schandinat @ 2011-08-05 21:55 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

The locking is done within the viafb_set_*_timing functions so there
is no need to do it here. Move a missing hardware reset into the
modesetting function.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/hw.c              |    7 -------
 drivers/video/via/via_modesetting.c |    4 ++++
 2 files changed, 4 insertions(+), 7 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 2/6] viafb: kill viafb_load_crtc_timing
From: Florian Tobias Schandinat @ 2011-08-05 21:55 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

This patch replaces calls to viafb_load_crtc_timing with the code.
This should make it easier to fix the oddity that in the modetable
the blank and sync end entries contain the length and we need to add
the start values to get those to be written to the hardware.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/hw.c  |   30 ++++++++----------------------
 drivers/video/via/lcd.c |   41 +++++++++++++++++++----------------------
 drivers/video/via/lcd.h |    2 --
 3 files changed, 27 insertions(+), 46 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 1/6] viafb: use more compact modesetting functions
From: Florian Tobias Schandinat @ 2011-08-05 21:52 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

This patch replaces the old timing setup code with a redesigned one.
The new code might be slightly faster as it has no conditinals and
does not write the same register multiple times. Also it makes the
comparison to the documentation easier.
Regressions are unlikely but could happen as a lot of hardware is
undocumented.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

 drivers/video/via/hw.c              |  296 +----------------------------------
 drivers/video/via/hw.h              |  273 --------------------------------
 drivers/video/via/share.h           |   19 +--
 drivers/video/via/via_modesetting.c |  100 ++++++++++++
 drivers/video/via/via_modesetting.h |   18 ++
 5 files changed, 128 insertions(+), 578 deletions(-)
-- 
1.6.3.2


^ permalink raw reply

* [PATCH 0/6] viafb modesetting update 1
From: Florian Tobias Schandinat @ 2011-08-05 21:49 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat

Hi all,

this is the first series containing some stable patches of my 
modesetting work. Adding the functions for setting the timing 
parameters in via_modesetting is an important step as well as 
pushing the strange behaviour that sync end and blanking end 
contained the length and not the end value one level up.
Additionally it has some related cleanups.
All this should be relatively stable, is not expected to cause 
regressions and was tested on CLE266, VX800 and VX855. These 
patches will show up in linux-next after the merge window is 
closed.
The next step will be to limit the influence of the modetable 
and hopefully replace parts of it by things provided in the 
subsystem to get rid of some bugs.


Thanks,

Florian Tobias Schandinat


Florian Tobias Schandinat (6):
  viafb: use more compact modesetting functions
  viafb: kill viafb_load_crtc_timing
  viafb: remove superfluous register unlocking/locking
  viafb: remove superfluous mode lookup
  viafb: simplify viafb_fill_crtc_timing
  viafb: remove 640x480-60 CRT special case

 drivers/video/via/dvi.c             |    6 +-
 drivers/video/via/hw.c              |  341 ++---------------------------------
 drivers/video/via/hw.h              |  277 +----------------------------
 drivers/video/via/lcd.c             |   41 ++---
 drivers/video/via/lcd.h             |    2 -
 drivers/video/via/share.h           |   19 +--
 drivers/video/via/via_modesetting.c |  104 +++++++++++
 drivers/video/via/via_modesetting.h |   18 ++
 drivers/video/via/viafbdev.c        |    2 -
 drivers/video/via/viamode.c         |    2 +-
 10 files changed, 161 insertions(+), 651 deletions(-)


^ permalink raw reply

* [PATCH 6/6] viafb: remove 640x480-60 CRT special case
From: Florian Tobias Schandinat @ 2011-08-05 21:47 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

The timing for 640x480-60 was handled different than all others.
This patch changes this by changing the blanking start and end.
The reason for this is that I can't find any reason for the old
behaviour and it was not consistent anyway as the special case for
LCD did not always trigger as the LCD code does not use this
function and it did trigger regardless of whether the display set is
CRT or LCD but only based whether any DVI/LCD device exists.
There are no negative effects observed for CRT or DVI devices.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/hw.c      |   14 --------------
 drivers/video/via/viamode.c |    2 +-
 2 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 2050fb8..c5e7833 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1488,20 +1488,6 @@ void viafb_fill_crtc_timing(struct VideoModeTable *video_mode, int bpp_byte,
 	}
 
 	crt_reg = crt_table[index].crtc;
-
-	/* Mode 640x480 has border, but LCD/DFP didn't have border. */
-	/* So we would delete border. */
-	if ((viafb_LCD_ON | viafb_DVI_ON)
-	    && video_mode->crtc[0].crtc.hor_addr = 640
-	    && video_mode->crtc[0].crtc.ver_addr = 480
-	    && refresh = 60) {
-		/* The border is 8 pixels. */
-		crt_reg.hor_blank_start = crt_reg.hor_blank_start - 8;
-
-		/* Blanking time should add left and right borders. */
-		crt_reg.hor_blank_end = crt_reg.hor_blank_end + 16;
-	}
-
 	crt_reg.hor_blank_end += crt_reg.hor_blank_start;
 	crt_reg.hor_sync_end += crt_reg.hor_sync_start;
 	crt_reg.ver_blank_end += crt_reg.ver_blank_start;
diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
index 58df74e..8a9f4fc 100644
--- a/drivers/video/via/viamode.c
+++ b/drivers/video/via/viamode.c
@@ -281,7 +281,7 @@ static struct crt_mode_table CRTM640x480[] = {
 	/*r_rate,hsp,vsp */
 	/*HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, M640X480_R60_HSP, M640X480_R60_VSP,
-	 {800, 640, 648, 144, 656, 96, 525, 480, 480, 45, 490, 2} },
+	 {800, 640, 640, 160, 656, 96, 525, 480, 480, 45, 490, 2} },
 	{REFRESH_75, M640X480_R75_HSP, M640X480_R75_VSP,
 	 {840, 640, 640, 200, 656, 64, 500, 480, 480, 20, 481, 3} },
 	{REFRESH_85, M640X480_R85_HSP, M640X480_R85_VSP,
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing
From: Florian Tobias Schandinat @ 2011-08-05 21:47 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

As the first argument is just part of the structure passed as the
second argument there is no need for it at all.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/dvi.c |    6 ++----
 drivers/video/via/hw.c  |   12 ++++++------
 drivers/video/via/hw.h  |    4 ++--
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index b1f3647..c7ff5c0 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -190,12 +190,10 @@ void viafb_dvi_set_mode(struct VideoModeTable *mode, int mode_bpp,
 	if ((maxPixelClock != 0) && (desirePixelClock > maxPixelClock)) {
 		rb_mode = viafb_get_rb_mode(mode->crtc[0].crtc.hor_addr,
 			mode->crtc[0].crtc.ver_addr);
-		if (rb_mode) {
+		if (rb_mode)
 			mode = rb_mode;
-			pDviTiming = rb_mode->crtc;
-		}
 	}
-	viafb_fill_crtc_timing(pDviTiming, mode, mode_bpp / 8, set_iga);
+	viafb_fill_crtc_timing(mode, mode_bpp / 8, set_iga);
 }
 
 /* Sense DVI Connector */
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 8b4bdf5..2050fb8 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1467,9 +1467,10 @@ void viafb_set_vclock(u32 clk, int set_iga)
 	via_write_misc_reg_mask(0x0C, 0x0C); /* select external clock */
 }
 
-void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
-	struct VideoModeTable *video_mode, int bpp_byte, int set_iga)
+void viafb_fill_crtc_timing(struct VideoModeTable *video_mode, int bpp_byte,
+	int set_iga)
 {
+	struct crt_mode_table *crt_table = video_mode->crtc;
 	struct display_timing crt_reg;
 	int i;
 	int index = 0;
@@ -1911,11 +1912,10 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
 	if (viafb_CRT_ON) {
 		if (viafb_SAMM_ON &&
 			viaparinfo->shared->iga2_devices & VIA_CRT) {
-			viafb_fill_crtc_timing(crt_timing1, vmode_tbl1,
-				video_bpp1 / 8, IGA2);
+			viafb_fill_crtc_timing(vmode_tbl1, video_bpp1 / 8,
+				IGA2);
 		} else {
-			viafb_fill_crtc_timing(crt_timing, vmode_tbl,
-				video_bpp / 8,
+			viafb_fill_crtc_timing(vmode_tbl, video_bpp / 8,
 				(viaparinfo->shared->iga1_devices & VIA_CRT)
 				? IGA1 : IGA2);
 		}
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 267c669..1fd8d98 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -637,8 +637,8 @@ extern int viafb_LCD_ON;
 extern int viafb_DVI_ON;
 extern int viafb_hotplug;
 
-void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
-	struct VideoModeTable *video_mode, int bpp_byte, int set_iga);
+void viafb_fill_crtc_timing(struct VideoModeTable *video_mode, int bpp_byte,
+	int set_iga);
 
 void viafb_set_vclock(u32 CLK, int set_iga);
 void viafb_load_reg(int timing_value, int viafb_load_reg_num,
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH 4/6] viafb: remove superfluous mode lookup
From: Florian Tobias Schandinat @ 2011-08-05 21:46 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

As the result is not used anywhere there is no need to perform the
lookup at all.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/viafbdev.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index bddae58..3eaf607 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1735,7 +1735,6 @@ static struct viafb_pm_hooks viafb_fb_pm_hooks = {
 int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
 {
 	u32 default_xres, default_yres;
-	struct VideoModeTable *vmode_entry;
 	struct fb_var_screeninfo default_var;
 	int rc;
 	u32 viafb_par_length;
@@ -1808,7 +1807,6 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
 	}
 
 	parse_mode(viafb_mode, &default_xres, &default_yres);
-	vmode_entry = viafb_get_mode(default_xres, default_yres);
 	if (viafb_SAMM_ON = 1)
 		parse_mode(viafb_mode1, &viafb_second_xres,
 			&viafb_second_yres);
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH 3/6] viafb: remove superfluous register unlocking/locking
From: Florian Tobias Schandinat @ 2011-08-05 21:46 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

The locking is done within the viafb_set_*_timing functions so there
is no need to do it here. Move a missing hardware reset into the
modesetting function.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/hw.c              |    7 -------
 drivers/video/via/via_modesetting.c |    4 ++++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 52d41f0..8b4bdf5 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1507,18 +1507,11 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
 	crt_reg.ver_sync_end += crt_reg.ver_sync_start;
 	h_addr = crt_reg.hor_addr;
 	v_addr = crt_reg.ver_addr;
-	if (set_iga = IGA1) {
-		viafb_unlock_crt();
-		viafb_write_reg_mask(CR17, VIACR, 0x00, BIT7);
-	}
-
 	if (set_iga = IGA1)
 		via_set_primary_timing(&crt_reg);
 	else if (set_iga = IGA2)
 		via_set_secondary_timing(&crt_reg);
 
-	viafb_lock_crt();
-	viafb_write_reg_mask(CR17, VIACR, 0x80, BIT7);
 	viafb_load_fetch_count_reg(h_addr, bpp_byte, set_iga);
 
 	/* load FIFO */
diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/via/via_modesetting.c
index 016d457..0e431ae 100644
--- a/drivers/video/via/via_modesetting.c
+++ b/drivers/video/via/via_modesetting.c
@@ -82,6 +82,10 @@ void via_set_primary_timing(const struct display_timing *timing)
 
 	/* lock timing registers */
 	via_write_reg_mask(VIACR, 0x11, 0x80, 0x80);
+
+	/* reset timing control */
+	via_write_reg_mask(VIACR, 0x17, 0x00, 0x80);
+	via_write_reg_mask(VIACR, 0x17, 0x80, 0x80);
 }
 
 void via_set_secondary_timing(const struct display_timing *timing)
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH 2/6] viafb: kill viafb_load_crtc_timing
From: Florian Tobias Schandinat @ 2011-08-05 21:45 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

This patch replaces calls to viafb_load_crtc_timing with the code.
This should make it easier to fix the oddity that in the modetable
the blank and sync end entries contain the length and we need to add
the start values to get those to be written to the hardware.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/hw.c  |   30 ++++++++----------------------
 drivers/video/via/lcd.c |   41 +++++++++++++++++++----------------------
 drivers/video/via/lcd.h |    2 --
 3 files changed, 27 insertions(+), 46 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 372ce4f..52d41f0 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1467,20 +1467,6 @@ void viafb_set_vclock(u32 clk, int set_iga)
 	via_write_misc_reg_mask(0x0C, 0x0C); /* select external clock */
 }
 
-void viafb_load_crtc_timing(struct display_timing device_timing,
-	int set_iga)
-{
-	device_timing.hor_blank_end += device_timing.hor_blank_start;
-	device_timing.hor_sync_end += device_timing.hor_sync_start;
-	device_timing.ver_blank_end += device_timing.ver_blank_start;
-	device_timing.ver_sync_end += device_timing.ver_sync_start;
-
-	if (set_iga = IGA1)
-		via_set_primary_timing(&device_timing);
-	else if (set_iga = IGA2)
-		via_set_secondary_timing(&device_timing);
-}
-
 void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
 	struct VideoModeTable *video_mode, int bpp_byte, int set_iga)
 {
@@ -1515,6 +1501,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
 		crt_reg.hor_blank_end = crt_reg.hor_blank_end + 16;
 	}
 
+	crt_reg.hor_blank_end += crt_reg.hor_blank_start;
+	crt_reg.hor_sync_end += crt_reg.hor_sync_start;
+	crt_reg.ver_blank_end += crt_reg.ver_blank_start;
+	crt_reg.ver_sync_end += crt_reg.ver_sync_start;
 	h_addr = crt_reg.hor_addr;
 	v_addr = crt_reg.ver_addr;
 	if (set_iga = IGA1) {
@@ -1522,14 +1512,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
 		viafb_write_reg_mask(CR17, VIACR, 0x00, BIT7);
 	}
 
-	switch (set_iga) {
-	case IGA1:
-		viafb_load_crtc_timing(crt_reg, IGA1);
-		break;
-	case IGA2:
-		viafb_load_crtc_timing(crt_reg, IGA2);
-		break;
-	}
+	if (set_iga = IGA1)
+		via_set_primary_timing(&crt_reg);
+	else if (set_iga = IGA2)
+		via_set_secondary_timing(&crt_reg);
 
 	viafb_lock_crt();
 	viafb_write_reg_mask(CR17, VIACR, 0x80, BIT7);
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 6e06981..0a38e4d 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -559,7 +559,7 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table,
 	int panel_hres = plvds_setting_info->lcd_panel_hres;
 	int panel_vres = plvds_setting_info->lcd_panel_vres;
 	u32 clock;
-	struct display_timing mode_crt_reg, panel_crt_reg;
+	struct display_timing mode_crt_reg, panel_crt_reg, timing;
 	struct crt_mode_table *panel_crt_table = NULL;
 	struct VideoModeTable *vmode_tbl = viafb_get_mode(panel_hres,
 		panel_vres);
@@ -576,31 +576,28 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table,
 	clock = panel_crt_reg.hor_total * panel_crt_reg.ver_total
 		* panel_crt_table->refresh_rate;
 	plvds_setting_info->vclk = clock;
-	if (set_iga = IGA1) {
-		/* IGA1 doesn't have LCD scaling, so set it as centering. */
-		viafb_load_crtc_timing(lcd_centering_timging
-				 (mode_crt_reg, panel_crt_reg), IGA1);
+
+	if (set_iga = IGA2 && (set_hres < panel_hres || set_vres < panel_vres)
+		&& plvds_setting_info->display_method = LCD_EXPANDSION) {
+		timing = panel_crt_reg;
+		load_lcd_scaling(set_hres, set_vres, panel_hres, panel_vres);
 	} else {
-		/* Expansion */
-		if (plvds_setting_info->display_method = LCD_EXPANDSION
-			&& (set_hres < panel_hres || set_vres < panel_vres)) {
-			/* expansion timing IGA2 loaded panel set timing*/
-			viafb_load_crtc_timing(panel_crt_reg, IGA2);
-			DEBUG_MSG(KERN_INFO "viafb_load_crtc_timing!!\n");
-			load_lcd_scaling(set_hres, set_vres, panel_hres,
-					 panel_vres);
-			DEBUG_MSG(KERN_INFO "load_lcd_scaling!!\n");
-		} else {	/* Centering */
-			/* centering timing IGA2 always loaded panel
-			   and mode releative timing */
-			viafb_load_crtc_timing(lcd_centering_timging
-					 (mode_crt_reg, panel_crt_reg), IGA2);
-			viafb_write_reg_mask(CR79, VIACR, 0x00,
+		timing = lcd_centering_timging(mode_crt_reg, panel_crt_reg);
+		if (set_iga = IGA2)
+			/* disable scaling */
+			via_write_reg_mask(VIACR, 0x79, 0x00,
 				BIT0 + BIT1 + BIT2);
-			/* LCD scaling disabled */
-		}
 	}
 
+	timing.hor_blank_end += timing.hor_blank_start;
+	timing.hor_sync_end += timing.hor_sync_start;
+	timing.ver_blank_end += timing.ver_blank_start;
+	timing.ver_sync_end += timing.ver_sync_start;
+	if (set_iga = IGA1)
+		via_set_primary_timing(&timing);
+	else if (set_iga = IGA2)
+		via_set_secondary_timing(&timing);
+
 	/* Fetch count for IGA2 only */
 	viafb_load_fetch_count_reg(set_hres, mode_bpp / 8, set_iga);
 
diff --git a/drivers/video/via/lcd.h b/drivers/video/via/lcd.h
index 75f60a6..3b9e539 100644
--- a/drivers/video/via/lcd.h
+++ b/drivers/video/via/lcd.h
@@ -85,7 +85,5 @@ void viafb_init_lvds_output_interface(struct lvds_chip_information
 				struct lvds_setting_information
 				*plvds_setting_info);
 bool viafb_lcd_get_mobile_state(bool *mobile);
-void viafb_load_crtc_timing(struct display_timing device_timing,
-	int set_iga);
 
 #endif /* __LCD_H__ */
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH 1/6] viafb: use more compact modesetting functions
From: Florian Tobias Schandinat @ 2011-08-05 21:44 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <cover.1312578946.git.FlorianSchandinat@gmx.de>

This patch replaces the old timing setup code with a redesigned one.
The new code might be slightly faster as it has no conditinals and
does not write the same register multiple times. Also it makes the
comparison to the documentation easier.
Regressions are unlikely but could happen as a lot of hardware is
undocumented.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/hw.c              |  296 +----------------------------------
 drivers/video/via/hw.h              |  273 --------------------------------
 drivers/video/via/share.h           |   19 +--
 drivers/video/via/via_modesetting.c |  100 ++++++++++++
 drivers/video/via/via_modesetting.h |   18 ++
 5 files changed, 128 insertions(+), 578 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 47b1353..372ce4f 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -191,67 +191,6 @@ static struct fetch_count fetch_count_reg = {
 	{IGA2_FETCH_COUNT_REG_NUM, {{CR65, 0, 7}, {CR67, 2, 3} } }
 };
 
-static struct iga1_crtc_timing iga1_crtc_reg = {
-	/* IGA1 Horizontal Total */
-	{IGA1_HOR_TOTAL_REG_NUM, {{CR00, 0, 7}, {CR36, 3, 3} } },
-	/* IGA1 Horizontal Addressable Video */
-	{IGA1_HOR_ADDR_REG_NUM, {{CR01, 0, 7} } },
-	/* IGA1 Horizontal Blank Start */
-	{IGA1_HOR_BLANK_START_REG_NUM, {{CR02, 0, 7} } },
-	/* IGA1 Horizontal Blank End */
-	{IGA1_HOR_BLANK_END_REG_NUM,
-	 {{CR03, 0, 4}, {CR05, 7, 7}, {CR33, 5, 5} } },
-	/* IGA1 Horizontal Sync Start */
-	{IGA1_HOR_SYNC_START_REG_NUM, {{CR04, 0, 7}, {CR33, 4, 4} } },
-	/* IGA1 Horizontal Sync End */
-	{IGA1_HOR_SYNC_END_REG_NUM, {{CR05, 0, 4} } },
-	/* IGA1 Vertical Total */
-	{IGA1_VER_TOTAL_REG_NUM,
-	 {{CR06, 0, 7}, {CR07, 0, 0}, {CR07, 5, 5}, {CR35, 0, 0} } },
-	/* IGA1 Vertical Addressable Video */
-	{IGA1_VER_ADDR_REG_NUM,
-	 {{CR12, 0, 7}, {CR07, 1, 1}, {CR07, 6, 6}, {CR35, 2, 2} } },
-	/* IGA1 Vertical Blank Start */
-	{IGA1_VER_BLANK_START_REG_NUM,
-	 {{CR15, 0, 7}, {CR07, 3, 3}, {CR09, 5, 5}, {CR35, 3, 3} } },
-	/* IGA1 Vertical Blank End */
-	{IGA1_VER_BLANK_END_REG_NUM, {{CR16, 0, 7} } },
-	/* IGA1 Vertical Sync Start */
-	{IGA1_VER_SYNC_START_REG_NUM,
-	 {{CR10, 0, 7}, {CR07, 2, 2}, {CR07, 7, 7}, {CR35, 1, 1} } },
-	/* IGA1 Vertical Sync End */
-	{IGA1_VER_SYNC_END_REG_NUM, {{CR11, 0, 3} } }
-};
-
-static struct iga2_crtc_timing iga2_crtc_reg = {
-	/* IGA2 Horizontal Total */
-	{IGA2_HOR_TOTAL_REG_NUM, {{CR50, 0, 7}, {CR55, 0, 3} } },
-	/* IGA2 Horizontal Addressable Video */
-	{IGA2_HOR_ADDR_REG_NUM, {{CR51, 0, 7}, {CR55, 4, 6} } },
-	/* IGA2 Horizontal Blank Start */
-	{IGA2_HOR_BLANK_START_REG_NUM, {{CR52, 0, 7}, {CR54, 0, 2} } },
-	/* IGA2 Horizontal Blank End */
-	{IGA2_HOR_BLANK_END_REG_NUM,
-	 {{CR53, 0, 7}, {CR54, 3, 5}, {CR5D, 6, 6} } },
-	/* IGA2 Horizontal Sync Start */
-	{IGA2_HOR_SYNC_START_REG_NUM,
-	 {{CR56, 0, 7}, {CR54, 6, 7}, {CR5C, 7, 7}, {CR5D, 7, 7} } },
-	/* IGA2 Horizontal Sync End */
-	{IGA2_HOR_SYNC_END_REG_NUM, {{CR57, 0, 7}, {CR5C, 6, 6} } },
-	/* IGA2 Vertical Total */
-	{IGA2_VER_TOTAL_REG_NUM, {{CR58, 0, 7}, {CR5D, 0, 2} } },
-	/* IGA2 Vertical Addressable Video */
-	{IGA2_VER_ADDR_REG_NUM, {{CR59, 0, 7}, {CR5D, 3, 5} } },
-	/* IGA2 Vertical Blank Start */
-	{IGA2_VER_BLANK_START_REG_NUM, {{CR5A, 0, 7}, {CR5C, 0, 2} } },
-	/* IGA2 Vertical Blank End */
-	{IGA2_VER_BLANK_END_REG_NUM, {{CR5B, 0, 7}, {CR5C, 3, 5} } },
-	/* IGA2 Vertical Sync Start */
-	{IGA2_VER_SYNC_START_REG_NUM, {{CR5E, 0, 7}, {CR5F, 5, 7} } },
-	/* IGA2 Vertical Sync End */
-	{IGA2_VER_SYNC_END_REG_NUM, {{CR5F, 0, 4} } }
-};
-
 static struct rgbLUT palLUT_table[] = {
 	/* {R,G,B} */
 	/* Index 0x00~0x03 */
@@ -1531,234 +1470,15 @@ void viafb_set_vclock(u32 clk, int set_iga)
 void viafb_load_crtc_timing(struct display_timing device_timing,
 	int set_iga)
 {
-	int i;
-	int viafb_load_reg_num = 0;
-	int reg_value = 0;
-	struct io_register *reg = NULL;
-
-	viafb_unlock_crt();
-
-	for (i = 0; i < 12; i++) {
-		if (set_iga = IGA1) {
-			switch (i) {
-			case H_TOTAL_INDEX:
-				reg_value -				    IGA1_HOR_TOTAL_FORMULA(device_timing.
-							   hor_total);
-				viafb_load_reg_num -					iga1_crtc_reg.hor_total.reg_num;
-				reg = iga1_crtc_reg.hor_total.reg;
-				break;
-			case H_ADDR_INDEX:
-				reg_value -				    IGA1_HOR_ADDR_FORMULA(device_timing.
-							  hor_addr);
-				viafb_load_reg_num -					iga1_crtc_reg.hor_addr.reg_num;
-				reg = iga1_crtc_reg.hor_addr.reg;
-				break;
-			case H_BLANK_START_INDEX:
-				reg_value -				    IGA1_HOR_BLANK_START_FORMULA
-				    (device_timing.hor_blank_start);
-				viafb_load_reg_num -				    iga1_crtc_reg.hor_blank_start.reg_num;
-				reg = iga1_crtc_reg.hor_blank_start.reg;
-				break;
-			case H_BLANK_END_INDEX:
-				reg_value -				    IGA1_HOR_BLANK_END_FORMULA
-				    (device_timing.hor_blank_start,
-				     device_timing.hor_blank_end);
-				viafb_load_reg_num -				    iga1_crtc_reg.hor_blank_end.reg_num;
-				reg = iga1_crtc_reg.hor_blank_end.reg;
-				break;
-			case H_SYNC_START_INDEX:
-				reg_value -				    IGA1_HOR_SYNC_START_FORMULA
-				    (device_timing.hor_sync_start);
-				viafb_load_reg_num -				    iga1_crtc_reg.hor_sync_start.reg_num;
-				reg = iga1_crtc_reg.hor_sync_start.reg;
-				break;
-			case H_SYNC_END_INDEX:
-				reg_value -				    IGA1_HOR_SYNC_END_FORMULA
-				    (device_timing.hor_sync_start,
-				     device_timing.hor_sync_end);
-				viafb_load_reg_num -				    iga1_crtc_reg.hor_sync_end.reg_num;
-				reg = iga1_crtc_reg.hor_sync_end.reg;
-				break;
-			case V_TOTAL_INDEX:
-				reg_value -				    IGA1_VER_TOTAL_FORMULA(device_timing.
-							   ver_total);
-				viafb_load_reg_num -					iga1_crtc_reg.ver_total.reg_num;
-				reg = iga1_crtc_reg.ver_total.reg;
-				break;
-			case V_ADDR_INDEX:
-				reg_value -				    IGA1_VER_ADDR_FORMULA(device_timing.
-							  ver_addr);
-				viafb_load_reg_num -					iga1_crtc_reg.ver_addr.reg_num;
-				reg = iga1_crtc_reg.ver_addr.reg;
-				break;
-			case V_BLANK_START_INDEX:
-				reg_value -				    IGA1_VER_BLANK_START_FORMULA
-				    (device_timing.ver_blank_start);
-				viafb_load_reg_num -				    iga1_crtc_reg.ver_blank_start.reg_num;
-				reg = iga1_crtc_reg.ver_blank_start.reg;
-				break;
-			case V_BLANK_END_INDEX:
-				reg_value -				    IGA1_VER_BLANK_END_FORMULA
-				    (device_timing.ver_blank_start,
-				     device_timing.ver_blank_end);
-				viafb_load_reg_num -				    iga1_crtc_reg.ver_blank_end.reg_num;
-				reg = iga1_crtc_reg.ver_blank_end.reg;
-				break;
-			case V_SYNC_START_INDEX:
-				reg_value -				    IGA1_VER_SYNC_START_FORMULA
-				    (device_timing.ver_sync_start);
-				viafb_load_reg_num -				    iga1_crtc_reg.ver_sync_start.reg_num;
-				reg = iga1_crtc_reg.ver_sync_start.reg;
-				break;
-			case V_SYNC_END_INDEX:
-				reg_value -				    IGA1_VER_SYNC_END_FORMULA
-				    (device_timing.ver_sync_start,
-				     device_timing.ver_sync_end);
-				viafb_load_reg_num -				    iga1_crtc_reg.ver_sync_end.reg_num;
-				reg = iga1_crtc_reg.ver_sync_end.reg;
-				break;
-
-			}
-		}
-
-		if (set_iga = IGA2) {
-			switch (i) {
-			case H_TOTAL_INDEX:
-				reg_value -				    IGA2_HOR_TOTAL_FORMULA(device_timing.
-							   hor_total);
-				viafb_load_reg_num -					iga2_crtc_reg.hor_total.reg_num;
-				reg = iga2_crtc_reg.hor_total.reg;
-				break;
-			case H_ADDR_INDEX:
-				reg_value -				    IGA2_HOR_ADDR_FORMULA(device_timing.
-							  hor_addr);
-				viafb_load_reg_num -					iga2_crtc_reg.hor_addr.reg_num;
-				reg = iga2_crtc_reg.hor_addr.reg;
-				break;
-			case H_BLANK_START_INDEX:
-				reg_value -				    IGA2_HOR_BLANK_START_FORMULA
-				    (device_timing.hor_blank_start);
-				viafb_load_reg_num -				    iga2_crtc_reg.hor_blank_start.reg_num;
-				reg = iga2_crtc_reg.hor_blank_start.reg;
-				break;
-			case H_BLANK_END_INDEX:
-				reg_value -				    IGA2_HOR_BLANK_END_FORMULA
-				    (device_timing.hor_blank_start,
-				     device_timing.hor_blank_end);
-				viafb_load_reg_num -				    iga2_crtc_reg.hor_blank_end.reg_num;
-				reg = iga2_crtc_reg.hor_blank_end.reg;
-				break;
-			case H_SYNC_START_INDEX:
-				reg_value -				    IGA2_HOR_SYNC_START_FORMULA
-				    (device_timing.hor_sync_start);
-				if (UNICHROME_CN700 <-					viaparinfo->chip_info->gfx_chip_name)
-					viafb_load_reg_num -					    iga2_crtc_reg.hor_sync_start.
-					    reg_num;
-				else
-					viafb_load_reg_num = 3;
-				reg = iga2_crtc_reg.hor_sync_start.reg;
-				break;
-			case H_SYNC_END_INDEX:
-				reg_value -				    IGA2_HOR_SYNC_END_FORMULA
-				    (device_timing.hor_sync_start,
-				     device_timing.hor_sync_end);
-				viafb_load_reg_num -				    iga2_crtc_reg.hor_sync_end.reg_num;
-				reg = iga2_crtc_reg.hor_sync_end.reg;
-				break;
-			case V_TOTAL_INDEX:
-				reg_value -				    IGA2_VER_TOTAL_FORMULA(device_timing.
-							   ver_total);
-				viafb_load_reg_num -					iga2_crtc_reg.ver_total.reg_num;
-				reg = iga2_crtc_reg.ver_total.reg;
-				break;
-			case V_ADDR_INDEX:
-				reg_value -				    IGA2_VER_ADDR_FORMULA(device_timing.
-							  ver_addr);
-				viafb_load_reg_num -					iga2_crtc_reg.ver_addr.reg_num;
-				reg = iga2_crtc_reg.ver_addr.reg;
-				break;
-			case V_BLANK_START_INDEX:
-				reg_value -				    IGA2_VER_BLANK_START_FORMULA
-				    (device_timing.ver_blank_start);
-				viafb_load_reg_num -				    iga2_crtc_reg.ver_blank_start.reg_num;
-				reg = iga2_crtc_reg.ver_blank_start.reg;
-				break;
-			case V_BLANK_END_INDEX:
-				reg_value -				    IGA2_VER_BLANK_END_FORMULA
-				    (device_timing.ver_blank_start,
-				     device_timing.ver_blank_end);
-				viafb_load_reg_num -				    iga2_crtc_reg.ver_blank_end.reg_num;
-				reg = iga2_crtc_reg.ver_blank_end.reg;
-				break;
-			case V_SYNC_START_INDEX:
-				reg_value -				    IGA2_VER_SYNC_START_FORMULA
-				    (device_timing.ver_sync_start);
-				viafb_load_reg_num -				    iga2_crtc_reg.ver_sync_start.reg_num;
-				reg = iga2_crtc_reg.ver_sync_start.reg;
-				break;
-			case V_SYNC_END_INDEX:
-				reg_value -				    IGA2_VER_SYNC_END_FORMULA
-				    (device_timing.ver_sync_start,
-				     device_timing.ver_sync_end);
-				viafb_load_reg_num -				    iga2_crtc_reg.ver_sync_end.reg_num;
-				reg = iga2_crtc_reg.ver_sync_end.reg;
-				break;
+	device_timing.hor_blank_end += device_timing.hor_blank_start;
+	device_timing.hor_sync_end += device_timing.hor_sync_start;
+	device_timing.ver_blank_end += device_timing.ver_blank_start;
+	device_timing.ver_sync_end += device_timing.ver_sync_start;
 
-			}
-		}
-		viafb_load_reg(reg_value, viafb_load_reg_num, reg, VIACR);
-	}
-
-	viafb_lock_crt();
+	if (set_iga = IGA1)
+		via_set_primary_timing(&device_timing);
+	else if (set_iga = IGA2)
+		via_set_secondary_timing(&device_timing);
 }
 
 void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index c7239eb..267c669 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -51,40 +51,6 @@
 #define VIA_HSYNC_NEGATIVE	0x01
 #define VIA_VSYNC_NEGATIVE	0x02
 
-/***************************************************
-* Definition IGA1 Design Method of CRTC Registers *
-****************************************************/
-#define IGA1_HOR_TOTAL_FORMULA(x)           (((x)/8)-5)
-#define IGA1_HOR_ADDR_FORMULA(x)            (((x)/8)-1)
-#define IGA1_HOR_BLANK_START_FORMULA(x)     (((x)/8)-1)
-#define IGA1_HOR_BLANK_END_FORMULA(x, y)     (((x+y)/8)-1)
-#define IGA1_HOR_SYNC_START_FORMULA(x)      ((x)/8)
-#define IGA1_HOR_SYNC_END_FORMULA(x, y)      ((x+y)/8)
-
-#define IGA1_VER_TOTAL_FORMULA(x)           ((x)-2)
-#define IGA1_VER_ADDR_FORMULA(x)            ((x)-1)
-#define IGA1_VER_BLANK_START_FORMULA(x)     ((x)-1)
-#define IGA1_VER_BLANK_END_FORMULA(x, y)     ((x+y)-1)
-#define IGA1_VER_SYNC_START_FORMULA(x)      ((x)-1)
-#define IGA1_VER_SYNC_END_FORMULA(x, y)      ((x+y)-1)
-
-/***************************************************
-** Definition IGA2 Design Method of CRTC Registers *
-****************************************************/
-#define IGA2_HOR_TOTAL_FORMULA(x)           ((x)-1)
-#define IGA2_HOR_ADDR_FORMULA(x)            ((x)-1)
-#define IGA2_HOR_BLANK_START_FORMULA(x)     ((x)-1)
-#define IGA2_HOR_BLANK_END_FORMULA(x, y)     ((x+y)-1)
-#define IGA2_HOR_SYNC_START_FORMULA(x)      ((x)-1)
-#define IGA2_HOR_SYNC_END_FORMULA(x, y)      ((x+y)-1)
-
-#define IGA2_VER_TOTAL_FORMULA(x)           ((x)-1)
-#define IGA2_VER_ADDR_FORMULA(x)            ((x)-1)
-#define IGA2_VER_BLANK_START_FORMULA(x)     ((x)-1)
-#define IGA2_VER_BLANK_END_FORMULA(x, y)     ((x+y)-1)
-#define IGA2_VER_SYNC_START_FORMULA(x)      ((x)-1)
-#define IGA2_VER_SYNC_END_FORMULA(x, y)      ((x+y)-1)
-
 /**********************************************************/
 /* Definition IGA2 Design Method of CRTC Shadow Registers */
 /**********************************************************/
@@ -97,33 +63,6 @@
 #define IGA2_VER_SYNC_START_SHADOW_FORMULA(x)      (x)
 #define IGA2_VER_SYNC_END_SHADOW_FORMULA(x, y)      (x+y)
 
-/* Define Register Number for IGA1 CRTC Timing */
-
-/* location: {CR00,0,7},{CR36,3,3} */
-#define IGA1_HOR_TOTAL_REG_NUM		2
-/* location: {CR01,0,7} */
-#define IGA1_HOR_ADDR_REG_NUM		1
-/* location: {CR02,0,7} */
-#define IGA1_HOR_BLANK_START_REG_NUM    1
-/* location: {CR03,0,4},{CR05,7,7},{CR33,5,5} */
-#define IGA1_HOR_BLANK_END_REG_NUM	3
-/* location: {CR04,0,7},{CR33,4,4} */
-#define IGA1_HOR_SYNC_START_REG_NUM	2
-/* location: {CR05,0,4} */
-#define IGA1_HOR_SYNC_END_REG_NUM       1
-/* location: {CR06,0,7},{CR07,0,0},{CR07,5,5},{CR35,0,0} */
-#define IGA1_VER_TOTAL_REG_NUM          4
-/* location: {CR12,0,7},{CR07,1,1},{CR07,6,6},{CR35,2,2} */
-#define IGA1_VER_ADDR_REG_NUM           4
-/* location: {CR15,0,7},{CR07,3,3},{CR09,5,5},{CR35,3,3} */
-#define IGA1_VER_BLANK_START_REG_NUM    4
-/* location: {CR16,0,7} */
-#define IGA1_VER_BLANK_END_REG_NUM      1
-/* location: {CR10,0,7},{CR07,2,2},{CR07,7,7},{CR35,1,1} */
-#define IGA1_VER_SYNC_START_REG_NUM     4
-/* location: {CR11,0,3} */
-#define IGA1_VER_SYNC_END_REG_NUM       1
-
 /* Define Register Number for IGA2 Shadow CRTC Timing */
 
 /* location: {CR6D,0,7},{CR71,3,3} */
@@ -143,37 +82,6 @@
 /* location: {CR76,0,3} */
 #define IGA2_SHADOW_VER_SYNC_END_REG_NUM    1
 
-/* Define Register Number for IGA2 CRTC Timing */
-
-/* location: {CR50,0,7},{CR55,0,3} */
-#define IGA2_HOR_TOTAL_REG_NUM          2
-/* location: {CR51,0,7},{CR55,4,6} */
-#define IGA2_HOR_ADDR_REG_NUM           2
-/* location: {CR52,0,7},{CR54,0,2} */
-#define IGA2_HOR_BLANK_START_REG_NUM    2
-/* location: CLE266: {CR53,0,7},{CR54,3,5} => CLE266's CR5D[6]
-is reserved, so it may have problem to set 1600x1200 on IGA2. */
-/*         	Others: {CR53,0,7},{CR54,3,5},{CR5D,6,6} */
-#define IGA2_HOR_BLANK_END_REG_NUM      3
-/* location: {CR56,0,7},{CR54,6,7},{CR5C,7,7} */
-/* VT3314 and Later: {CR56,0,7},{CR54,6,7},{CR5C,7,7}, {CR5D,7,7} */
-#define IGA2_HOR_SYNC_START_REG_NUM     4
-
-/* location: {CR57,0,7},{CR5C,6,6} */
-#define IGA2_HOR_SYNC_END_REG_NUM       2
-/* location: {CR58,0,7},{CR5D,0,2} */
-#define IGA2_VER_TOTAL_REG_NUM          2
-/* location: {CR59,0,7},{CR5D,3,5} */
-#define IGA2_VER_ADDR_REG_NUM           2
-/* location: {CR5A,0,7},{CR5C,0,2} */
-#define IGA2_VER_BLANK_START_REG_NUM    2
-/* location: {CR5E,0,7},{CR5C,3,5} */
-#define IGA2_VER_BLANK_END_REG_NUM      2
-/* location: {CR5E,0,7},{CR5F,5,7} */
-#define IGA2_VER_SYNC_START_REG_NUM     2
-/* location: {CR5F,0,4} */
-#define IGA2_VER_SYNC_END_REG_NUM       1
-
 /* Define Fetch Count Register*/
 
 /* location: {SR1C,0,7},{SR1D,0,1} */
@@ -446,87 +354,12 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */
 /* location: {CR78,0,7},{CR79,6,7} */
 #define LCD_VER_SCALING_FACTOR_REG_NUM_CLE  2
 
-/************************************************
- *****     Define IGA1 Display Timing       *****
- ************************************************/
 struct io_register {
 	u8 io_addr;
 	u8 start_bit;
 	u8 end_bit;
 };
 
-/* IGA1 Horizontal Total */
-struct iga1_hor_total {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_TOTAL_REG_NUM];
-};
-
-/* IGA1 Horizontal Addressable Video */
-struct iga1_hor_addr {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_ADDR_REG_NUM];
-};
-
-/* IGA1 Horizontal Blank Start */
-struct iga1_hor_blank_start {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_BLANK_START_REG_NUM];
-};
-
-/* IGA1 Horizontal Blank End */
-struct iga1_hor_blank_end {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_BLANK_END_REG_NUM];
-};
-
-/* IGA1 Horizontal Sync Start */
-struct iga1_hor_sync_start {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_SYNC_START_REG_NUM];
-};
-
-/* IGA1 Horizontal Sync End */
-struct iga1_hor_sync_end {
-	int reg_num;
-	struct io_register reg[IGA1_HOR_SYNC_END_REG_NUM];
-};
-
-/* IGA1 Vertical Total */
-struct iga1_ver_total {
-	int reg_num;
-	struct io_register reg[IGA1_VER_TOTAL_REG_NUM];
-};
-
-/* IGA1 Vertical Addressable Video */
-struct iga1_ver_addr {
-	int reg_num;
-	struct io_register reg[IGA1_VER_ADDR_REG_NUM];
-};
-
-/* IGA1 Vertical Blank Start */
-struct iga1_ver_blank_start {
-	int reg_num;
-	struct io_register reg[IGA1_VER_BLANK_START_REG_NUM];
-};
-
-/* IGA1 Vertical Blank End */
-struct iga1_ver_blank_end {
-	int reg_num;
-	struct io_register reg[IGA1_VER_BLANK_END_REG_NUM];
-};
-
-/* IGA1 Vertical Sync Start */
-struct iga1_ver_sync_start {
-	int reg_num;
-	struct io_register reg[IGA1_VER_SYNC_START_REG_NUM];
-};
-
-/* IGA1 Vertical Sync End */
-struct iga1_ver_sync_end {
-	int reg_num;
-	struct io_register reg[IGA1_VER_SYNC_END_REG_NUM];
-};
-
 /*****************************************************
 **      Define IGA2 Shadow Display Timing         ****
 *****************************************************/
@@ -579,82 +412,6 @@ struct iga2_shadow_ver_sync_end {
 	struct io_register reg[IGA2_SHADOW_VER_SYNC_END_REG_NUM];
 };
 
-/*****************************************************
-**      Define IGA2 Display Timing                ****
-******************************************************/
-
-/* IGA2 Horizontal Total */
-struct iga2_hor_total {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_TOTAL_REG_NUM];
-};
-
-/* IGA2 Horizontal Addressable Video */
-struct iga2_hor_addr {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_ADDR_REG_NUM];
-};
-
-/* IGA2 Horizontal Blank Start */
-struct iga2_hor_blank_start {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_BLANK_START_REG_NUM];
-};
-
-/* IGA2 Horizontal Blank End */
-struct iga2_hor_blank_end {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_BLANK_END_REG_NUM];
-};
-
-/* IGA2 Horizontal Sync Start */
-struct iga2_hor_sync_start {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_SYNC_START_REG_NUM];
-};
-
-/* IGA2 Horizontal Sync End */
-struct iga2_hor_sync_end {
-	int reg_num;
-	struct io_register reg[IGA2_HOR_SYNC_END_REG_NUM];
-};
-
-/* IGA2 Vertical Total */
-struct iga2_ver_total {
-	int reg_num;
-	struct io_register reg[IGA2_VER_TOTAL_REG_NUM];
-};
-
-/* IGA2 Vertical Addressable Video */
-struct iga2_ver_addr {
-	int reg_num;
-	struct io_register reg[IGA2_VER_ADDR_REG_NUM];
-};
-
-/* IGA2 Vertical Blank Start */
-struct iga2_ver_blank_start {
-	int reg_num;
-	struct io_register reg[IGA2_VER_BLANK_START_REG_NUM];
-};
-
-/* IGA2 Vertical Blank End */
-struct iga2_ver_blank_end {
-	int reg_num;
-	struct io_register reg[IGA2_VER_BLANK_END_REG_NUM];
-};
-
-/* IGA2 Vertical Sync Start */
-struct iga2_ver_sync_start {
-	int reg_num;
-	struct io_register reg[IGA2_VER_SYNC_START_REG_NUM];
-};
-
-/* IGA2 Vertical Sync End */
-struct iga2_ver_sync_end {
-	int reg_num;
-	struct io_register reg[IGA2_VER_SYNC_END_REG_NUM];
-};
-
 /* IGA1 Fetch Count Register */
 struct iga1_fetch_count {
 	int reg_num;
@@ -817,21 +574,6 @@ struct display_queue_expire_num {
 	 iga2_display_queue_expire_num_reg;
 };
 
-struct iga1_crtc_timing {
-	struct iga1_hor_total hor_total;
-	struct iga1_hor_addr hor_addr;
-	struct iga1_hor_blank_start hor_blank_start;
-	struct iga1_hor_blank_end hor_blank_end;
-	struct iga1_hor_sync_start hor_sync_start;
-	struct iga1_hor_sync_end hor_sync_end;
-	struct iga1_ver_total ver_total;
-	struct iga1_ver_addr ver_addr;
-	struct iga1_ver_blank_start ver_blank_start;
-	struct iga1_ver_blank_end ver_blank_end;
-	struct iga1_ver_sync_start ver_sync_start;
-	struct iga1_ver_sync_end ver_sync_end;
-};
-
 struct iga2_shadow_crtc_timing {
 	struct iga2_shadow_hor_total hor_total_shadow;
 	struct iga2_shadow_hor_blank_end hor_blank_end_shadow;
@@ -843,21 +585,6 @@ struct iga2_shadow_crtc_timing {
 	struct iga2_shadow_ver_sync_end ver_sync_end_shadow;
 };
 
-struct iga2_crtc_timing {
-	struct iga2_hor_total hor_total;
-	struct iga2_hor_addr hor_addr;
-	struct iga2_hor_blank_start hor_blank_start;
-	struct iga2_hor_blank_end hor_blank_end;
-	struct iga2_hor_sync_start hor_sync_start;
-	struct iga2_hor_sync_end hor_sync_end;
-	struct iga2_ver_total ver_total;
-	struct iga2_ver_addr ver_addr;
-	struct iga2_ver_blank_start ver_blank_start;
-	struct iga2_ver_blank_end ver_blank_end;
-	struct iga2_ver_sync_start ver_sync_start;
-	struct iga2_ver_sync_end ver_sync_end;
-};
-
 /* device ID */
 #define CLE266_FUNCTION3    0x3123
 #define KM400_FUNCTION3     0x3205
diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h
index 61b0bd5..2906b2d 100644
--- a/drivers/video/via/share.h
+++ b/drivers/video/via/share.h
@@ -22,6 +22,8 @@
 #ifndef __SHARE_H__
 #define __SHARE_H__
 
+#include "via_modesetting.h"
+
 /* Define Bit Field */
 #define BIT0    0x01
 #define BIT1    0x02
@@ -648,23 +650,6 @@
 #define     LCD_OPENLDI               0x00
 #define     LCD_SPWG                  0x01
 
-/* Define display timing
-*/
-struct display_timing {
-	u16 hor_total;
-	u16 hor_addr;
-	u16 hor_blank_start;
-	u16 hor_blank_end;
-	u16 hor_sync_start;
-	u16 hor_sync_end;
-	u16 ver_total;
-	u16 ver_addr;
-	u16 ver_blank_start;
-	u16 ver_blank_end;
-	u16 ver_sync_start;
-	u16 ver_sync_end;
-};
-
 struct crt_mode_table {
 	int refresh_rate;
 	int h_sync_polarity;
diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/via/via_modesetting.c
index 3cddcff..016d457 100644
--- a/drivers/video/via/via_modesetting.c
+++ b/drivers/video/via/via_modesetting.c
@@ -29,6 +29,106 @@
 #include "share.h"
 #include "debug.h"
 
+
+void via_set_primary_timing(const struct display_timing *timing)
+{
+	struct display_timing raw;
+
+	raw.hor_total = timing->hor_total / 8 - 5;
+	raw.hor_addr = timing->hor_addr / 8 - 1;
+	raw.hor_blank_start = timing->hor_blank_start / 8 - 1;
+	raw.hor_blank_end = timing->hor_blank_end / 8 - 1;
+	raw.hor_sync_start = timing->hor_sync_start / 8;
+	raw.hor_sync_end = timing->hor_sync_end / 8;
+	raw.ver_total = timing->ver_total - 2;
+	raw.ver_addr = timing->ver_addr - 1;
+	raw.ver_blank_start = timing->ver_blank_start - 1;
+	raw.ver_blank_end = timing->ver_blank_end - 1;
+	raw.ver_sync_start = timing->ver_sync_start - 1;
+	raw.ver_sync_end = timing->ver_sync_end - 1;
+
+	/* unlock timing registers */
+	via_write_reg_mask(VIACR, 0x11, 0x00, 0x80);
+
+	via_write_reg(VIACR, 0x00, raw.hor_total & 0xFF);
+	via_write_reg(VIACR, 0x01, raw.hor_addr & 0xFF);
+	via_write_reg(VIACR, 0x02, raw.hor_blank_start & 0xFF);
+	via_write_reg_mask(VIACR, 0x03, raw.hor_blank_end & 0x1F, 0x1F);
+	via_write_reg(VIACR, 0x04, raw.hor_sync_start & 0xFF);
+	via_write_reg_mask(VIACR, 0x05, (raw.hor_sync_end & 0x1F)
+		| (raw.hor_blank_end << (7 - 5) & 0x80), 0x9F);
+	via_write_reg(VIACR, 0x06, raw.ver_total & 0xFF);
+	via_write_reg_mask(VIACR, 0x07, (raw.ver_total >> 8 & 0x01)
+		| (raw.ver_addr >> (8 - 1) & 0x02)
+		| (raw.ver_sync_start >> (8 - 2) & 0x04)
+		| (raw.ver_blank_start >> (8 - 3) & 0x08)
+		| (raw.ver_total >> (9 - 5) & 0x20)
+		| (raw.ver_addr >> (9 - 6) & 0x40)
+		| (raw.ver_sync_start >> (9 - 7) & 0x80), 0xEF);
+	via_write_reg_mask(VIACR, 0x09, raw.ver_blank_start >> (9 - 5) & 0x20,
+		0x20);
+	via_write_reg(VIACR, 0x10, raw.ver_sync_start & 0xFF);
+	via_write_reg_mask(VIACR, 0x11, raw.ver_sync_end & 0x0F, 0x0F);
+	via_write_reg(VIACR, 0x12, raw.ver_addr & 0xFF);
+	via_write_reg(VIACR, 0x15, raw.ver_blank_start & 0xFF);
+	via_write_reg(VIACR, 0x16, raw.ver_blank_end & 0xFF);
+	via_write_reg_mask(VIACR, 0x33, (raw.hor_sync_start >> (8 - 4) & 0x10)
+		| (raw.hor_blank_end >> (6 - 5) & 0x20), 0x30);
+	via_write_reg_mask(VIACR, 0x35, (raw.ver_total >> 10 & 0x01)
+		| (raw.ver_sync_start >> (10 - 1) & 0x02)
+		| (raw.ver_addr >> (10 - 2) & 0x04)
+		| (raw.ver_blank_start >> (10 - 3) & 0x08), 0x0F);
+	via_write_reg_mask(VIACR, 0x36, raw.hor_total >> (8 - 3) & 0x08, 0x08);
+
+	/* lock timing registers */
+	via_write_reg_mask(VIACR, 0x11, 0x80, 0x80);
+}
+
+void via_set_secondary_timing(const struct display_timing *timing)
+{
+	struct display_timing raw;
+
+	raw.hor_total = timing->hor_total - 1;
+	raw.hor_addr = timing->hor_addr - 1;
+	raw.hor_blank_start = timing->hor_blank_start - 1;
+	raw.hor_blank_end = timing->hor_blank_end - 1;
+	raw.hor_sync_start = timing->hor_sync_start - 1;
+	raw.hor_sync_end = timing->hor_sync_end - 1;
+	raw.ver_total = timing->ver_total - 1;
+	raw.ver_addr = timing->ver_addr - 1;
+	raw.ver_blank_start = timing->ver_blank_start - 1;
+	raw.ver_blank_end = timing->ver_blank_end - 1;
+	raw.ver_sync_start = timing->ver_sync_start - 1;
+	raw.ver_sync_end = timing->ver_sync_end - 1;
+
+	via_write_reg(VIACR, 0x50, raw.hor_total & 0xFF);
+	via_write_reg(VIACR, 0x51, raw.hor_addr & 0xFF);
+	via_write_reg(VIACR, 0x52, raw.hor_blank_start & 0xFF);
+	via_write_reg(VIACR, 0x53, raw.hor_blank_end & 0xFF);
+	via_write_reg(VIACR, 0x54, (raw.hor_blank_start >> 8 & 0x07)
+		| (raw.hor_blank_end >> (8 - 3) & 0x38)
+		| (raw.hor_sync_start >> (8 - 6) & 0xC0));
+	via_write_reg_mask(VIACR, 0x55, (raw.hor_total >> 8 & 0x0F)
+		| (raw.hor_addr >> (8 - 4) & 0x70), 0x7F);
+	via_write_reg(VIACR, 0x56, raw.hor_sync_start & 0xFF);
+	via_write_reg(VIACR, 0x57, raw.hor_sync_end & 0xFF);
+	via_write_reg(VIACR, 0x58, raw.ver_total & 0xFF);
+	via_write_reg(VIACR, 0x59, raw.ver_addr & 0xFF);
+	via_write_reg(VIACR, 0x5A, raw.ver_blank_start & 0xFF);
+	via_write_reg(VIACR, 0x5B, raw.ver_blank_end & 0xFF);
+	via_write_reg(VIACR, 0x5C, (raw.ver_blank_start >> 8 & 0x07)
+		| (raw.ver_blank_end >> (8 - 3) & 0x38)
+		| (raw.hor_sync_end >> (8 - 6) & 0x40)
+		| (raw.hor_sync_start >> (10 - 7) & 0x80));
+	via_write_reg(VIACR, 0x5D, (raw.ver_total >> 8 & 0x07)
+		| (raw.ver_addr >> (8 - 3) & 0x38)
+		| (raw.hor_blank_end >> (11 - 6) & 0x40)
+		| (raw.hor_sync_start >> (11 - 7) & 0x80));
+	via_write_reg(VIACR, 0x5E, raw.ver_sync_start & 0xFF);
+	via_write_reg(VIACR, 0x5F, (raw.ver_sync_end & 0x1F)
+		| (raw.ver_sync_start >> (8 - 5) & 0xE0));
+}
+
 void via_set_primary_address(u32 addr)
 {
 	DEBUG_MSG(KERN_DEBUG "via_set_primary_address(0x%08X)\n", addr);
diff --git a/drivers/video/via/via_modesetting.h b/drivers/video/via/via_modesetting.h
index 0138845..06e09fe 100644
--- a/drivers/video/via/via_modesetting.h
+++ b/drivers/video/via/via_modesetting.h
@@ -33,6 +33,24 @@
 #define VIA_PITCH_MAX	0x3FF8
 
 
+struct display_timing {
+	u16 hor_total;
+	u16 hor_addr;
+	u16 hor_blank_start;
+	u16 hor_blank_end;
+	u16 hor_sync_start;
+	u16 hor_sync_end;
+	u16 ver_total;
+	u16 ver_addr;
+	u16 ver_blank_start;
+	u16 ver_blank_end;
+	u16 ver_sync_start;
+	u16 ver_sync_end;
+};
+
+
+void via_set_primary_timing(const struct display_timing *timing);
+void via_set_secondary_timing(const struct display_timing *timing);
 void via_set_primary_address(u32 addr);
 void via_set_secondary_address(u32 addr);
 void via_set_primary_pitch(u32 pitch);
-- 
1.6.3.2


^ permalink raw reply related

* Re: [Bugme-new] [Bug 40492] New: FB_BACKLIGHT should be set by
From: Randy Dunlap @ 2011-08-04 15:46 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <20110803175541.7ed2fb24.rdunlap@xenotime.net>

On Thu, 04 Aug 2011 14:04:46 +0200 David wrote:

> On Thursday 04 August 2011 07:55:16 you wrote:
> > On Mit, 2011-08-03 at 17:55 -0700, Randy Dunlap wrote:
> > > On Wed, 3 Aug 2011 18:55:41 GMT bugzilla-daemon@bugzilla.kernel.org wrote:
> > > > https://bugzilla.kernel.org/show_bug.cgi?id@492
> > > > 
> > > >            Summary: FB_BACKLIGHT should be set by
> > > >            BACKLIGHT_CLASS_DEVICE Product: Other
> > > >            Version: 2.5
> > > >     
> > > >     Kernel Version: 3.0.0
> > > >     
> > > >           Platform: All
> > > >         
> > > >         OS/Version: Linux
> > > >         
> > > >               Tree: Mainline
> > > >             
> > > >             Status: NEW
> > > >           
> > > >           Severity: normal
> > > >           Priority: P1
> > > >          
> > > >          Component: Configuration
> > > >         
> > > >         AssignedTo: other_configuration@kernel-bugs.osdl.org
> > > >         ReportedBy: StormByte@gmail.com
> > > >         Regression: No
> > > > 
> > > > Created an attachment (idg432)
> > > > 
> > > >  --> (https://bugzilla.kernel.org/attachment.cgi?idg432)
> > > > 
> > > > Kernel's config
> > > > 
> > > > I discovered a scenario in which menuconfig fails to set
> > > > FB_BACKLIGHT symbol when needed.
> > > > 
> > > > In my case, I have propietary nvidia drivers once loaded Xorg, but
> > > > in the meanwhile, I have configured an uvesafb framebuffer (thus,
> > > > no other framebuffer active nor compiled).
> > > > 
> > > > System works ok, but when trying to install nvidiabl[1] (to control
> > > > nvidia's backlight) I find that FB_BACKLIGHT is not set where it
> > > > should be because I have BACKLIGHT_CLASS_DEVICE set.
> > > > 
> > > > The result is that nvidiabl does not compile.
> > 
> > Sounds like an nvidiabl bug. I'm successfully using backlight control
> > with radeon KMS with
> > 
> > # CONFIG_FB_BACKLIGHT is not set
> > CONFIG_BACKLIGHT_CLASS_DEVICE=m
> 
> It does not seem a bug in nvidiabl, it needs this symbol in order to get 2 
> defines (from include/linux/fb.h)
> 394 #ifdef CONFIG_FB_BACKLIGHT
> 395 /* Settings for the generic backlight code */
> 396 #define FB_BACKLIGHT_LEVELS     128
> 397 #define FB_BACKLIGHT_MAX        0xFF
> 398 #endif
> 
> I think nvidiabl uses those instead of having them hardcoded in its source, 
> and thus not a bug really.

David,

You could propose a patch that makes those 2 defines not be conditional
on the CONFIB_FB_BACKLIGHT symbol.

Or you could propose a patch that makes the FB_BACKLIGHT symbol
user-configurable.  Currently it is not user-configurable since it
does not have a prompt string.  I think all it would take is
changing the "bool" line to include a prompt string and adding some
help text.  Something like (not tested, probably needs some
wordsmithing):

config FB_BACKLIGHT
	bool "Generic video backlight support"
	depends on FB
	select BACKLIGHT_LCD_SUPPORT
	select BACKLIGHT_CLASS_DEVICE
	default n
	help
	  This option provides a little video backlight support.
	  Most drivers that need it enable it automatically.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: [PATCH] ARM: OMAP2+ Add Primview dispalys to panel-generic
From: Tomi Valkeinen @ 2011-08-04 12:18 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1310122034-6561-1-git-send-email-j.weitzel@phytec.de>

Hi,

On Fri, 2011-07-08 at 12:47 +0200, Jan Weitzel wrote:
> Add displays to panel-generic-dpi.c
> Prime View PD035VL1 (640 x 480)
> Prime View PD050VL1 (640 x 480)
> Prime View PD104SLF (800 x 600)
> Prime View PM070WL4 (800 x 480)

Did you copy the acb and power_on/off_delay values from the sharp panel?
acbi and acb are not needed at all, and you should check if
power_on/off_delay are needed and if they are, what they should be.

Also, the first two panels look identical. While there's nothing wrong
with that, I wonder if could be a more generic "family" name for the
panels, and there would be need to define the timings only once.

 Tomi

> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
>  drivers/video/omap2/displays/panel-generic-dpi.c |  100 ++++++++++++++++++++++
>  1 files changed, 100 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
> index 9c90f75..87d9ba1 100644
> --- a/drivers/video/omap2/displays/panel-generic-dpi.c
> +++ b/drivers/video/omap2/displays/panel-generic-dpi.c
> @@ -232,6 +232,106 @@ static struct panel_config generic_dpi_panels[] = {
>  		.power_off_delay	= 0,
>  		.name			= "powertip_ph480272t",
>  	},
> +
> +	/* Prime-View PD035VL1 */
> +	{
> +		{
> +			.x_res		= 640,
> +			.y_res		= 480,
> +
> +			.pixel_clock	= 25000,
> +
> +			.hsw		= 96,
> +			.hfp		= 18,
> +			.hbp		= 46,
> +
> +			.vsw		= 2,
> +			.vfp		= 10,
> +			.vbp		= 33,
> +		},
> +		.acbi			= 0x0,
> +		.acb			= 0x28,
> +		.config			= OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
> +					  OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC,
> +		.power_on_delay		= 50,
> +		.power_off_delay	= 100,
> +		.name			= "pd035vl1",
> +	},
> +
> +	/* Prime-View PD050VL1 */
> +	{
> +		{
> +			.x_res		= 640,
> +			.y_res		= 480,
> +
> +			.pixel_clock	= 25000,
> +
> +			.hsw		= 96,
> +			.hfp		= 18,
> +			.hbp		= 46,
> +
> +			.vsw		= 2,
> +			.vfp		= 10,
> +			.vbp		= 33,
> +		},
> +		.acbi			= 0x0,
> +		.acb			= 0x28,
> +		.config			= OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
> +					  OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC,
> +		.power_on_delay		= 50,
> +		.power_off_delay	= 100,
> +		.name			= "pd050vl1",
> +	},
> +
> +	/* Prime-View PM070WL4 */
> +	{
> +		{
> +			.x_res		= 800,
> +			.y_res		= 480,
> +
> +			.pixel_clock	= 32000,
> +
> +			.hsw		= 128,
> +			.hfp		= 42,
> +			.hbp		= 86,
> +
> +			.vsw		= 2,
> +			.vfp		= 10,
> +			.vbp		= 33,
> +		},
> +		.acbi			= 0x0,
> +		.acb			= 0x28,
> +		.config			= OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
> +					  OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC,
> +		.power_on_delay		= 50,
> +		.power_off_delay	= 100,
> +		.name			= "pm070wl4",
> +	},
> +
> +	/* Prime-View PD104SLF */
> +	{
> +		{
> +			.x_res		= 800,
> +			.y_res		= 600,
> +
> +			.pixel_clock	= 40000,
> +
> +			.hsw		= 128,
> +			.hfp		= 42,
> +			.hbp		= 86,
> +
> +			.vsw		= 4,
> +			.vfp		= 1,
> +			.vbp		= 23,
> +		},
> +		.acbi			= 0x0,
> +		.acb			= 0x28,
> +		.config			= OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
> +					  OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC,
> +		.power_on_delay		= 50,
> +		.power_off_delay	= 100,
> +		.name			= "pd104slf",
> +	},
>  };
>  
>  struct panel_drv_data {



^ permalink raw reply

* Re: [Bugme-new] [Bug 40492] New: FB_BACKLIGHT should be set by
From: Michel Dänzer @ 2011-08-04 12:09 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <20110803175541.7ed2fb24.rdunlap@xenotime.net>

On Don, 2011-08-04 at 14:04 +0200, David wrote: 
> On Thursday 04 August 2011 07:55:16 you wrote:
> > On Mit, 2011-08-03 at 17:55 -0700, Randy Dunlap wrote:
> > > On Wed, 3 Aug 2011 18:55:41 GMT bugzilla-daemon@bugzilla.kernel.org wrote:
> > > > https://bugzilla.kernel.org/show_bug.cgi?id@492
> > > > 
> > > >            Summary: FB_BACKLIGHT should be set by
> > > >            BACKLIGHT_CLASS_DEVICE Product: Other
> > > >            Version: 2.5
> > > >     
> > > >     Kernel Version: 3.0.0
> > > >     
> > > >           Platform: All
> > > >         
> > > >         OS/Version: Linux
> > > >         
> > > >               Tree: Mainline
> > > >             
> > > >             Status: NEW
> > > >           
> > > >           Severity: normal
> > > >           Priority: P1
> > > >          
> > > >          Component: Configuration
> > > >         
> > > >         AssignedTo: other_configuration@kernel-bugs.osdl.org
> > > >         ReportedBy: StormByte@gmail.com
> > > >         Regression: No
> > > > 
> > > > Created an attachment (idg432)
> > > > 
> > > >  --> (https://bugzilla.kernel.org/attachment.cgi?idg432)
> > > > 
> > > > Kernel's config
> > > > 
> > > > I discovered a scenario in which menuconfig fails to set
> > > > FB_BACKLIGHT symbol when needed.
> > > > 
> > > > In my case, I have propietary nvidia drivers once loaded Xorg, but
> > > > in the meanwhile, I have configured an uvesafb framebuffer (thus,
> > > > no other framebuffer active nor compiled).
> > > > 
> > > > System works ok, but when trying to install nvidiabl[1] (to control
> > > > nvidia's backlight) I find that FB_BACKLIGHT is not set where it
> > > > should be because I have BACKLIGHT_CLASS_DEVICE set.
> > > > 
> > > > The result is that nvidiabl does not compile.
> > 
> > Sounds like an nvidiabl bug. I'm successfully using backlight control
> > with radeon KMS with
> > 
> > # CONFIG_FB_BACKLIGHT is not set
> > CONFIG_BACKLIGHT_CLASS_DEVICE=m
> 
> It does not seem a bug in nvidiabl, it needs this symbol in order to get 2 
> defines (from include/linux/fb.h)
> 394 #ifdef CONFIG_FB_BACKLIGHT
> 395 /* Settings for the generic backlight code */
> 396 #define FB_BACKLIGHT_LEVELS     128
> 397 #define FB_BACKLIGHT_MAX        0xFF
> 398 #endif
> 
> I think nvidiabl uses those instead of having them hardcoded in its source, 
> and thus not a bug really.

If those defines are relevant outside of CONFIG_FB_BACKLIGHT (radeon KMS
doesn't use them), they should probably be defined somewhere else.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer

^ permalink raw reply

* Re: [Bugme-new] [Bug 40492] New: FB_BACKLIGHT should be set by BACKLIGHT_CLASS_DEVICE
From: David @ 2011-08-04 12:04 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <20110803175541.7ed2fb24.rdunlap@xenotime.net>

On Thursday 04 August 2011 07:55:16 you wrote:
> On Mit, 2011-08-03 at 17:55 -0700, Randy Dunlap wrote:
> > On Wed, 3 Aug 2011 18:55:41 GMT bugzilla-daemon@bugzilla.kernel.org wrote:
> > > https://bugzilla.kernel.org/show_bug.cgi?id@492
> > > 
> > >            Summary: FB_BACKLIGHT should be set by
> > >            BACKLIGHT_CLASS_DEVICE Product: Other
> > >            Version: 2.5
> > >     
> > >     Kernel Version: 3.0.0
> > >     
> > >           Platform: All
> > >         
> > >         OS/Version: Linux
> > >         
> > >               Tree: Mainline
> > >             
> > >             Status: NEW
> > >           
> > >           Severity: normal
> > >           Priority: P1
> > >          
> > >          Component: Configuration
> > >         
> > >         AssignedTo: other_configuration@kernel-bugs.osdl.org
> > >         ReportedBy: StormByte@gmail.com
> > >         Regression: No
> > > 
> > > Created an attachment (idg432)
> > > 
> > >  --> (https://bugzilla.kernel.org/attachment.cgi?idg432)
> > > 
> > > Kernel's config
> > > 
> > > I discovered a scenario in which menuconfig fails to set
> > > FB_BACKLIGHT symbol when needed.
> > > 
> > > In my case, I have propietary nvidia drivers once loaded Xorg, but
> > > in the meanwhile, I have configured an uvesafb framebuffer (thus,
> > > no other framebuffer active nor compiled).
> > > 
> > > System works ok, but when trying to install nvidiabl[1] (to control
> > > nvidia's backlight) I find that FB_BACKLIGHT is not set where it
> > > should be because I have BACKLIGHT_CLASS_DEVICE set.
> > > 
> > > The result is that nvidiabl does not compile.
> 
> Sounds like an nvidiabl bug. I'm successfully using backlight control
> with radeon KMS with
> 
> # CONFIG_FB_BACKLIGHT is not set
> CONFIG_BACKLIGHT_CLASS_DEVICE=m

It does not seem a bug in nvidiabl, it needs this symbol in order to get 2 
defines (from include/linux/fb.h)
394 #ifdef CONFIG_FB_BACKLIGHT
395 /* Settings for the generic backlight code */
396 #define FB_BACKLIGHT_LEVELS     128
397 #define FB_BACKLIGHT_MAX        0xFF
398 #endif

I think nvidiabl uses those instead of having them hardcoded in its source, 
and thus not a bug really.


^ permalink raw reply

* Re: [PATCH] OMAPFB: make debug message more useful
From: Tomi Valkeinen @ 2011-08-04  8:09 UTC (permalink / raw)
  To: Andy Doan; +Cc: linux-fbdev, linux-omap
In-Reply-To: <1309972109-23778-1-git-send-email-andy.doan@linaro.org>

On Wed, 2011-07-06 at 12:08 -0500, Andy Doan wrote:
> Make the debug message useful by printing the name of the device
> that no associated driver could be found for.
> 
> Signed-off-by: Andy Doan <andy.doan@linaro.org>
> ---
>  drivers/video/omap2/omapfb/omapfb-main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
> index 602b71a..e5a64b3 100644
> --- a/drivers/video/omap2/omapfb/omapfb-main.c
> +++ b/drivers/video/omap2/omapfb/omapfb-main.c
> @@ -2373,7 +2373,8 @@ static int omapfb_probe(struct platform_device *pdev)
>  		omap_dss_get_device(dssdev);
>  
>  		if (!dssdev->driver) {
> -			dev_err(&pdev->dev, "no driver for display\n");
> +			dev_err(&pdev->dev, "no driver for display: %s\n",
> +				dssdev->name);
>  			r = -ENODEV;
>  		}
>  

Thanks, applying.

 Tomi



^ permalink raw reply

* Re: [PATCH] OMAP: DSS2: Don't allow moving managers away from
From: Tomi Valkeinen @ 2011-08-04  8:08 UTC (permalink / raw)
  To: Daniel Morsing; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1312402251-31588-1-git-send-email-daniel.morsing@gmail.com>

On Wed, 2011-08-03 at 22:10 +0200, Daniel Morsing wrote:
> If a manager is moved while attached to an enabled display, the DSS
> system will be left in an inconsistent state. This will eventually cause
> a kernel oops when the enabled display is disabled.
> 
> Fix this by not allowing the user to move a manager away from an enabled
> display.

Thanks, applying.

 Tomi



^ permalink raw reply

* Re: [Bugme-new] [Bug 40492] New: FB_BACKLIGHT should be set by
From: Michel Dänzer @ 2011-08-04  5:55 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <20110803175541.7ed2fb24.rdunlap@xenotime.net>

On Mit, 2011-08-03 at 17:55 -0700, Randy Dunlap wrote: 
> On Wed, 3 Aug 2011 18:55:41 GMT bugzilla-daemon@bugzilla.kernel.org wrote:
> 
> > https://bugzilla.kernel.org/show_bug.cgi?id@492
> > 
> >            Summary: FB_BACKLIGHT should be set by BACKLIGHT_CLASS_DEVICE
> >            Product: Other
> >            Version: 2.5
> >     Kernel Version: 3.0.0
> >           Platform: All
> >         OS/Version: Linux
> >               Tree: Mainline
> >             Status: NEW
> >           Severity: normal
> >           Priority: P1
> >          Component: Configuration
> >         AssignedTo: other_configuration@kernel-bugs.osdl.org
> >         ReportedBy: StormByte@gmail.com
> >         Regression: No
> > 
> > 
> > Created an attachment (idg432)
> >  --> (https://bugzilla.kernel.org/attachment.cgi?idg432)
> > Kernel's config
> > 
> > I discovered a scenario in which menuconfig fails to set FB_BACKLIGHT symbol
> > when needed.
> > 
> > In my case, I have propietary nvidia drivers once loaded Xorg, but in the
> > meanwhile, I have configured an uvesafb framebuffer (thus, no other framebuffer
> > active nor compiled).
> > 
> > System works ok, but when trying to install nvidiabl[1] (to control nvidia's
> > backlight) I find that FB_BACKLIGHT is not set where it should be because I
> > have BACKLIGHT_CLASS_DEVICE set.
> > 
> > The result is that nvidiabl does not compile.

Sounds like an nvidiabl bug. I'm successfully using backlight control
with radeon KMS with

# CONFIG_FB_BACKLIGHT is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=m


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer

^ permalink raw reply

* Re: [Bugme-new] [Bug 40492] New: FB_BACKLIGHT should be set by
From: Randy Dunlap @ 2011-08-04  0:55 UTC (permalink / raw)
  To: linux-fbdev

On Wed, 3 Aug 2011 18:55:41 GMT bugzilla-daemon@bugzilla.kernel.org wrote:

> https://bugzilla.kernel.org/show_bug.cgi?id@492
> 
>            Summary: FB_BACKLIGHT should be set by BACKLIGHT_CLASS_DEVICE
>            Product: Other
>            Version: 2.5
>     Kernel Version: 3.0.0
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Configuration
>         AssignedTo: other_configuration@kernel-bugs.osdl.org
>         ReportedBy: StormByte@gmail.com
>         Regression: No
> 
> 
> Created an attachment (idg432)
>  --> (https://bugzilla.kernel.org/attachment.cgi?idg432)
> Kernel's config
> 
> I discovered a scenario in which menuconfig fails to set FB_BACKLIGHT symbol
> when needed.
> 
> In my case, I have propietary nvidia drivers once loaded Xorg, but in the
> meanwhile, I have configured an uvesafb framebuffer (thus, no other framebuffer
> active nor compiled).
> 
> System works ok, but when trying to install nvidiabl[1] (to control nvidia's
> backlight) I find that FB_BACKLIGHT is not set where it should be because I
> have BACKLIGHT_CLASS_DEVICE set.
> 
> The result is that nvidiabl does not compile.
> 
> The workarround for this now is to enable as a modile any component with
> support for backlight [Nvidia Framebuffer (CONFIG_FB_NVIDIA), ATI Radeon
> display (CONFIG_FB_RADEON), etc...]
> 
> I propose either enabling it automatically with CONFIG_BACKLIGHT_CLASS_DEVICE,
> or either having a separate option to allow it to be selected manually for
> external modules.
> 
> I add an attachment of a kernel config showing this scenario with FB_BACKLIGHT
> not set nor any other framebuffer than uvesafb
> 
> -- 

Any fbdev comments on this bug report?

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* [PATCH] savagedb: Fix savage4 series video chip detection regression
From: John Stanley @ 2011-08-04  0:41 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, adaplas, Andrew Morton, linux-fbdev

From: John Stanley <jpsinthemix@verizon.net>

savagedb: Fix typo causing regression in savage4 series video chip detection

Two additional savage4 variants were added, but the S3_SAVAGE4_SERIES 
macro was incompletely modified, resulting in a false positive detection 
of a savage4 card regardless of which savage card is actually present. 
For non-savage4 series
cards, such as a Savage/IX-MV card, this results in garbled video and/or 
a hard-hang at boot time. Fix this by changing an '||' to an '&&' in the 
S3_SAVAGE4_SERIES macro.

Signed-off-by: John P. Stanley <jpsinthemix@verizon.net>
Reviewed-by: Tormod Volden <debian.tormod@gmail.com>

---

Specifically, prior to linux-3.0, there were two savage4 variants 
(S3_SAVAGE4 and S3_PROSAVAGE). Hence, S3_SAVAGE4_SERIES was defined as

   S3_SAVAGE4 or S3_PROSAVAGE

In linux-3.0, two additional savage4 variants (S3_TWISTER and 
S3_PROSAVAGEDDR) have been added. Hence S3_SAVAGE4_SERIES should be 
defined as

   S3_SAVAGE4, S3_PROSAVAGE, S3_TWISTER, or S3_PROSAVAGEDDR

However, the #define macro for S3_SAVAGE4_SERIES was incompletely 
updated: the '||' should have been changed to an '&&'.

--- linux-3.0.0/drivers/video/savage/savagefb.h.orig    2011-07-21 
22:17:23.000000000 -0400
+++ linux-3.0.0/drivers/video/savage/savagefb.h 2011-07-31 
05:27:47.314798215 -0400
@@ -55,7 +55,7 @@

  #define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && 
(chip<=S3_SAVAGE_MX))

-#define S3_SAVAGE4_SERIES(chip)   ((chip>=S3_SAVAGE4) || 
(chip<=S3_PROSAVAGEDDR))
+#define S3_SAVAGE4_SERIES(chip)   ((chip>=S3_SAVAGE4) && 
(chip<=S3_PROSAVAGEDDR))

  #define S3_SAVAGE_MOBILE_SERIES(chip)  ((chip=S3_SAVAGE_MX) || 
(chip=S3_SUPERSAVAGE))


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox