[PATCH 01/11] viafb: reset correct PLL

Previous thread: RTC: LPC32xx: Introduce RTC driver for the LPC32xx (v2) by wellsk40 on Wednesday, August 11, 2010 - 4:06 pm. (5 messages)

Next thread: mmotm 2010-08-11-16-10 uploaded by akpm on Wednesday, August 11, 2010 - 4:10 pm. (16 messages)
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 4:49 pm

Hi,

the objection of this patch series is to clean the output device 
handling up. The end result should be saner code (not setting devices 
that do not exist) as well as more powerfull control over existing 
devices and easier addition of new devices.
This is the first part doing some structural changes and using those to 
switch which of the 2 display data sources (IGA1 or IGA2) is used.
Things that are still missing and (hopefully) will come in follow up 
series are device enable/disable following the same design and exporting 
this flexability in an easy to use way to userspace.

These patches can also be found at
	git://github.com/schandinat/linux-2.6.git viafb-s2v1

Some tests were performed on CLE266, VX800 and VX855.

Any opinions/suggestions?


Regards,

Florian Tobias Schandinat


Florian Tobias Schandinat (11):
      viafb: reset correct PLL
      viafb: remove lcdtbl.h
      viafb: remove stub
      viafb: unify output path configuration
      viafb: enable second display channel at central place
      viafb: rework output device routing
      viafb: propagate __init and __devinit
      viafb: reduce viafb_set_iga_path usage
      viafb: add new output device management
      viafb: use new device routing
      viafb: merge the remaining output path with enable functions

--

From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 4:49 pm

viafb: reset correct PLL

Looks like we did reset the PLL of the (whatever) engine instead of
the PLL of the secondary display (IGA2, LCDCK). This patch fixes it.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 7dcb4d5..53b0651 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1688,8 +1688,8 @@ void viafb_set_vclock(u32 clk, int set_iga)
 	}
 
 	if (set_iga == IGA2) {
-		viafb_write_reg_mask(SR40, VIASR, 0x01, BIT0);
-		viafb_write_reg_mask(SR40, VIASR, 0x00, BIT0);
+		viafb_write_reg_mask(SR40, VIASR, 0x04, BIT2);
+		viafb_write_reg_mask(SR40, VIASR, 0x00, BIT2);
 	}
 
 	/* Fire! */
-- 
1.6.3.2

--

From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 4:49 pm

viafb: remove lcdtbl.h

This patch moves the power on/off sequences to lcd.c as they are only
used there. This allows removing lcdtbl.h as the other stuff is not
used.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/lcd.c    |    8 +-
 drivers/video/via/lcdtbl.h |  591 --------------------------------------------
 2 files changed, 7 insertions(+), 592 deletions(-)
 delete mode 100644 drivers/video/via/lcdtbl.h

diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index fc25ae3..bda1246 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -21,10 +21,16 @@
 #include <linux/via-core.h>
 #include <linux/via_i2c.h>
 #include "global.h"
-#include "lcdtbl.h"
 
 #define viafb_compact_res(x, y) (((x)<<16)|(y))
 
+/* CLE266 Software Power Sequence */
+/* {Mask}, {Data}, {Delay} */
+int PowerSequenceOn[3][3] = { {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06},
+	{0x19, 0x1FE, 0x01} };
+int PowerSequenceOff[3][3] = { {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00},
+	{0xD2, 0x19, 0x01} };
+
 static struct _lcd_scaling_factor lcd_scaling_factor = {
 	/* LCD Horizontal Scaling Factor Register */
 	{LCD_HOR_SCALING_FACTOR_REG_NUM,
diff --git a/drivers/video/via/lcdtbl.h b/drivers/video/via/lcdtbl.h
deleted file mode 100644
index 6f3dd80..0000000
--- a/drivers/video/via/lcdtbl.h
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 4:49 pm

viafb: unify output path configuration

Move all output path routing directly in the viafb_setmode. This
gives a better overview and allows to factor similar parts out.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/dvi.c |    2 --
 drivers/video/via/hw.c  |   19 +++++++++++++++++--
 drivers/video/via/lcd.c |    3 ---
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index 39b040b..92a2027 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -208,8 +208,6 @@ void viafb_dvi_set_mode(struct VideoModeTable *mode, int mode_bpp,
 		}
 	}
 	viafb_fill_crtc_timing(pDviTiming, mode, mode_bpp / 8, set_iga);
-	viafb_set_output_path(DEVICE_DVI, set_iga,
-			viaparinfo->chip_info->tmds_chip_info.output_interface);
 }
 
 /* Sense DVI Connector */
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 63b6722..a3db804 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2377,8 +2377,6 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
 				viaparinfo->crt_setting_info->iga_path);
 		}
 
-		set_crt_output_path(viaparinfo->crt_setting_info->iga_path);
-
 		/* Patch if set_hres is not 8 alignment (1366) to viafb_setmode
 		to 8 alignment (1368),there is several pixels (2 pixels)
 		on right side of screen. */
@@ -2388,6 +2386,9 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
 				viafb_read_reg(VIACR, CR02) - 1);
 			viafb_lock_crt();
 		}
+
+		viafb_set_output_path(DEVICE_CRT,
+			viaparinfo->crt_setting_info->iga_path, 0);
 	}
 
 	if (viafb_DVI_ON) {
@@ -2407,6 +2408,10 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
 				     video_bpp, viaparinfo->
 				     tmds_setting_info->iga_path);
 ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 4:49 pm

viafb: remove stub

This is a nop so removing it is safe.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c |   17 -----------------
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 53b0651..63b6722 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -720,7 +720,6 @@ static struct rgbLUT palLUT_table[] = {
 
 static void set_crt_output_path(int set_iga);
 static void dvi_patch_skew_dvp0(void);
-static void dvi_patch_skew_dvp1(void);
 static void dvi_patch_skew_dvp_low(void);
 static void set_dvi_output_path(int set_iga, int output_interface);
 static void set_lcd_output_path(int set_iga, int output_interface);
@@ -910,21 +909,6 @@ static void dvi_patch_skew_dvp0(void)
 	}
 }
 
-static void dvi_patch_skew_dvp1(void)
-{
-	switch (viaparinfo->chip_info->gfx_chip_name) {
-	case UNICHROME_CX700:
-		{
-			break;
-		}
-
-	default:
-		{
-			break;
-		}
-	}
-}
-
 static void dvi_patch_skew_dvp_low(void)
 {
 	switch (viaparinfo->chip_info->gfx_chip_name) {
@@ -992,7 +976,6 @@ static void set_dvi_output_path(int set_iga, int output_interface)
 		}
 
 		viafb_write_reg_mask(SR1E, VIASR, 0x30, BIT4 + BIT5);
-		dvi_patch_skew_dvp1();
 		break;
 	case INTERFACE_DFP_HIGH:
 		if (viaparinfo->chip_info->gfx_chip_name != UNICHROME_CLE266) {
-- 
1.6.3.2

--

From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:05 pm

viafb: enable second display channel at central place

Move the enabling of the second display channel to the generic
output routing function and do it exactly if something is using it.
This unifies a zoo of variants how to do it and does no longer
disable it if LCD is not on the second display which is much saner
as there can be other users who need it. Probably this did not cause
any problems so far as we only recently started dual fb support and
otherwise there won't be other users and LCD is preferred assigned to
second display channel.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c |   35 +++++------------------------------
 1 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index a3db804..1ce2c21 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -733,7 +733,6 @@ static void set_display_channel(void);
 static void device_off(void);
 static void device_on(void);
 static void enable_second_display_channel(void);
-static void disable_second_display_channel(void);
 
 void viafb_lock_crt(void)
 {
@@ -856,6 +855,9 @@ void viafb_set_output_path(int device, int set_iga, int output_interface)
 		set_lcd_output_path(set_iga, output_interface);
 		break;
 	}
+
+	if (set_iga == IGA2)
+		enable_second_display_channel();
 }
 
 static void set_crt_output_path(int set_iga)
@@ -867,7 +869,6 @@ static void set_crt_output_path(int set_iga)
 		viafb_write_reg_mask(SR16, VIASR, 0x00, BIT6);
 		break;
 	case IGA2:
-		viafb_write_reg_mask(CR6A, VIACR, 0xC0, BIT6 + BIT7);
 		viafb_write_reg_mask(SR16, VIASR, 0x40, BIT6);
 		break;
 	}
@@ -1017,7 +1018,6 @@ static void set_dvi_output_path(int set_iga, int output_interface)
 	}
 
 	if (set_iga == IGA2) {
-		enable_second_display_channel();
 		/* Disable LCD Scaling */
 		viafb_write_reg_mask(CR79, VIACR, 0x00, BIT0);
 	}
@@ -1028,21 +1028,9 @@ static void ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:06 pm

viafb: rework output device routing

This patch rips the device routing out of the 3 main functions to
separate functions to make them available for transition to a better
controlling scheme.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c |  183 +++++++++++++++++++++++++-----------------------
 1 files changed, 94 insertions(+), 89 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 1ce2c21..2f7f640 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -860,18 +860,78 @@ void viafb_set_output_path(int device, int set_iga, int output_interface)
 		enable_second_display_channel();
 }
 
-static void set_crt_output_path(int set_iga)
+static void set_source_common(u8 index, u8 offset, u8 iga)
 {
-	viafb_write_reg_mask(CR36, VIACR, 0x00, BIT4 + BIT5);
+	u8 value, mask = 1 << offset;
 
-	switch (set_iga) {
+	switch (iga) {
+	case IGA1:
+		value = 0x00;
+		break;
+	case IGA2:
+		value = mask;
+		break;
+	default:
+		printk(KERN_WARNING "viafb: Unsupported source: %d\n", iga);
+		return;
+	}
+
+	via_write_reg_mask(VIACR, index, value, mask);
+}
+
+static void set_crt_source(u8 iga)
+{
+	u8 value;
+
+	switch (iga) {
 	case IGA1:
-		viafb_write_reg_mask(SR16, VIASR, 0x00, BIT6);
+		value = 0x00;
 		break;
 	case IGA2:
-		viafb_write_reg_mask(SR16, VIASR, 0x40, BIT6);
+		value = 0x40;
 		break;
+	default:
+		printk(KERN_WARNING "viafb: Unsupported source: %d\n", iga);
+		return;
 	}
+
+	via_write_reg_mask(VIASR, 0x16, value, 0x40);
+}
+
+static inline void set_6C_source(u8 iga)
+{
+	set_source_common(0x6C, 7, iga);
+}
+
+static inline void set_93_source(u8 iga)
+{
+	set_source_common(0x93, 7, iga);
+}
+
+static inline void set_96_source(u8 iga)
+{
+	set_source_common(0x96, 4, iga);
+}
+
+static inline void set_dvp1_source(u8 iga)
+{
+	set_source_common(0x9B, 4, iga);
+}
+
+static inline void ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:07 pm

viafb: propagate __init and __devinit

There are a lot of init functions which are not marked as such.
Fix this.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/dvi.c      |   24 ++++++++++++++----------
 drivers/video/via/dvi.h      |    4 ++--
 drivers/video/via/hw.c       |   16 ++++++++--------
 drivers/video/via/hw.h       |    4 ++--
 drivers/video/via/lcd.c      |   10 +++++-----
 drivers/video/via/lcd.h      |    6 +++---
 drivers/video/via/viafbdev.c |    8 ++++----
 7 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index 92a2027..ab6145d 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -25,10 +25,12 @@
 static void tmds_register_write(int index, u8 data);
 static int tmds_register_read(int index);
 static int tmds_register_read_bytes(int index, u8 *buff, int buff_len);
-static void dvi_get_panel_size_from_DDCv1(struct tmds_chip_information
-	*tmds_chip, struct tmds_setting_information *tmds_setting);
-static void dvi_get_panel_size_from_DDCv2(struct tmds_chip_information
-	*tmds_chip, struct tmds_setting_information *tmds_setting);
+static void __devinit dvi_get_panel_size_from_DDCv1(
+	struct tmds_chip_information *tmds_chip,
+	struct tmds_setting_information *tmds_setting);
+static void __devinit dvi_get_panel_size_from_DDCv2(
+	struct tmds_chip_information *tmds_chip,
+	struct tmds_setting_information *tmds_setting);
 static int viafb_dvi_query_EDID(void);
 
 static int check_tmds_chip(int device_id_subaddr, int device_id)
@@ -39,7 +41,7 @@ static int check_tmds_chip(int device_id_subaddr, int device_id)
 		return FAIL;
 }
 
-void viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
+void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
 	struct tmds_setting_information *tmds_setting)
 {
 	DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n");
@@ -60,7 +62,7 @@ ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:10 pm

viafb: add new output device management

This patch adds a new output device management that stores for each
IGA which output devices are routed to it and a compatiblity layer
that converts the old per-output device values in the new format.
Bounding the output devices to each IGA is a central idea of the
cleanup. Doing it this way should be easier and make much more sense
than the old format which happily mixed different output devices
together and did not even take into account that some devices are no
longer available on newer chipsets.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c       |  102 ++++++++++++++++++++++++++++++++++++++++++
 drivers/video/via/hw.h       |    9 ++++
 drivers/video/via/viafbdev.h |    3 +
 3 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 638cf96..30cc2f0 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -753,6 +753,66 @@ void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
 	outb(b, LUT_DATA);
 }
 
+static u32 get_dvi_devices(int output_interface)
+{
+	switch (output_interface) {
+	case INTERFACE_DVP0:
+		return VIA_96 | VIA_6C;
+
+	case INTERFACE_DVP1:
+		if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
+			return VIA_93;
+		else
+			return VIA_DVP1;
+
+	case INTERFACE_DFP_HIGH:
+		if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
+			return 0;
+		else
+			return VIA_LVDS2 | VIA_96;
+
+	case INTERFACE_DFP_LOW:
+		if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
+			return 0;
+		else
+			return VIA_DVP1 | VIA_LVDS1;
+
+	case INTERFACE_TMDS:
+		return VIA_LVDS1;
+	}
+
+	return 0;
+}
+
+static u32 get_lcd_devices(int output_interface)
+{
+	switch (output_interface) {
+	case INTERFACE_DVP0:
+		return VIA_96;
+
+	case INTERFACE_DVP1:
+		return VIA_DVP1;
+
+	case INTERFACE_DFP_HIGH:
+		return VIA_LVDS2 | ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:11 pm

viafb: use new device routing

This patch uses the iga{1,2}_devices variables to select which IGA
should be the source. Doing this is convinient, more powerfull
than the older scheme and easy extendable to support further output
devices. It is not yet completed as the device on/off selection needs
to be converted to the same scheme to take full advantage.
No visible changes yet as we want to complete the transition before
anouncing any unstabke interface.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c |  101 ++++++++++++++++++------------------------------
 1 files changed, 38 insertions(+), 63 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 30cc2f0..c8f2405 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -718,7 +718,6 @@ static struct rgbLUT palLUT_table[] = {
 								     0x00}
 };
 
-static void set_crt_output_path(int set_iga);
 static void dvi_patch_skew_dvp0(void);
 static void dvi_patch_skew_dvp_low(void);
 static void set_dvi_output_path(int set_iga, int output_interface);
@@ -733,6 +732,7 @@ static void set_display_channel(void);
 static void device_off(void);
 static void device_on(void);
 static void enable_second_display_channel(void);
+static void disable_second_display_channel(void);
 
 void viafb_lock_crt(void)
 {
@@ -948,7 +948,7 @@ void viafb_set_output_path(int device, int set_iga, int output_interface)
 {
 	switch (device) {
 	case DEVICE_CRT:
-		set_crt_output_path(set_iga);
+		viafb_write_reg_mask(CR36, VIACR, 0x00, BIT4 + BIT5);
 		break;
 	case DEVICE_DVI:
 		set_dvi_output_path(set_iga, output_interface);
@@ -957,9 +957,6 @@ void viafb_set_output_path(int device, int set_iga, int output_interface)
 		set_lcd_output_path(set_iga, output_interface);
 		break;
 	}
-
-	if (set_iga == IGA2)
-		enable_second_display_channel();
 }
 
 static void set_source_common(u8 index, u8 offset, u8 iga)
@@ ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:11 pm

viafb: merge the remaining output path with enable functions

This patch merges the remaining functionality of the output path
function in the associated enabling functions. This is very natural as
most of the remaining code does actually enable the device.
Just some more or less intelligent code merge. If no stupid mistakes
occured there should be no regressions.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/dvi.c |  146 +++++++++++++++++++++++++++++++-----------
 drivers/video/via/hw.c  |  164 -----------------------------------------------
 drivers/video/via/hw.h  |    3 -
 drivers/video/via/lcd.c |   28 ++++++++
 4 files changed, 136 insertions(+), 205 deletions(-)

diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index ab6145d..7c82f6f 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -496,38 +496,103 @@ void viafb_dvi_disable(void)
 		viafb_read_reg(VIACR, CRD2) | 0x08);
 }
 
+static void dvi_patch_skew_dvp0(void)
+{
+	/* Reset data driving first: */
+	viafb_write_reg_mask(SR1B, VIASR, 0, BIT1);
+	viafb_write_reg_mask(SR2A, VIASR, 0, BIT4);
+
+	switch (viaparinfo->chip_info->gfx_chip_name) {
+	case UNICHROME_P4M890:
+		{
+			if ((viaparinfo->tmds_setting_info->h_active == 1600) &&
+				(viaparinfo->tmds_setting_info->v_active ==
+				1200))
+				viafb_write_reg_mask(CR96, VIACR, 0x03,
+					       BIT0 + BIT1 + BIT2);
+			else
+				viafb_write_reg_mask(CR96, VIACR, 0x07,
+					       BIT0 + BIT1 + BIT2);
+			break;
+		}
+
+	case UNICHROME_P4M900:
+		{
+			viafb_write_reg_mask(CR96, VIACR, 0x07,
+				       BIT0 + BIT1 + BIT2 + BIT3);
+			viafb_write_reg_mask(SR1B, VIASR, 0x02, BIT1);
+			viafb_write_reg_mask(SR2A, VIASR, 0x10, BIT4);
+			break;
+		}
+
+	default:
+		{
+			break;
+		}
+	}
+}
+
+static void dvi_patch_skew_dvp_low(void)
+{
+	switch (viaparinfo->chip_info->gfx_chip_name) {
+	case ...
From: Florian Tobias Schandinat
Date: Wednesday, August 11, 2010 - 5:08 pm

viafb: reduce viafb_set_iga_path usage

The result of viafb_set_iga_path can change after init only in the
hotplug ioctl. So we can move it there rather than doing it always
when a new mode is set. The setup during init is done via a call
from the init chip funtion.
This change enables a stable mapping between the old device scheme
and a new more powerfull one.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
---
 drivers/video/via/hw.c    |    1 -
 drivers/video/via/ioctl.c |    2 ++
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 4407943..638cf96 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2313,7 +2313,6 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
 		via_write_reg(VIASR, i, VPIT.SR[i - 1]);
 
 	viafb_write_reg_mask(0x15, VIASR, 0xA2, 0xA2);
-	viafb_set_iga_path();
 
 	/* Write CRTC */
 	viafb_fill_crtc_timing(crt_timing, vmode_tbl, video_bpp / 8, IGA1);
diff --git a/drivers/video/via/ioctl.c b/drivers/video/via/ioctl.c
index da03c07..455b39f 100644
--- a/drivers/video/via/ioctl.c
+++ b/drivers/video/via/ioctl.c
@@ -92,6 +92,7 @@ int viafb_ioctl_hotplug(int hres, int vres, int bpp)
 				viafb_CRT_ON = 0;
 				viafb_LCD_ON = 0;
 				viafb_DeviceStatus = DVI_Device;
+				viafb_set_iga_path();
 				return viafb_DeviceStatus;
 			}
 			status = 1;
@@ -105,6 +106,7 @@ int viafb_ioctl_hotplug(int hres, int vres, int bpp)
 		viafb_LCD_ON = 0;
 
 		viafb_DeviceStatus = CRT_Device;
+		viafb_set_iga_path();
 		return viafb_DeviceStatus;
 	}
 
-- 
1.6.3.2

--

Previous thread: RTC: LPC32xx: Introduce RTC driver for the LPC32xx (v2) by wellsk40 on Wednesday, August 11, 2010 - 4:06 pm. (5 messages)

Next thread: mmotm 2010-08-11-16-10 uploaded by akpm on Wednesday, August 11, 2010 - 4:10 pm. (16 messages)