aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-10-16 04:29:20 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:19 -0400
commit3c03ec209af1dd8223888630482f1b2353dc6284 (patch)
tree500eff8ad713b183f00ccbdf8561a6b2e360c688
parent1c5dd170927b1aa8e3a01d43d611b840336cdaf2 (diff)
nvidiafb: Add boot option to reverse i2c port assignment
There are a few nvidia hardware where the i2c port assignments are reversed, i.e., the 1st i2c port is assigned to the secondary display and the 2nd i2c port to the primary display. In most cases, if only 1 display is attached, or if only 1 flatpanel and 1 analog display is attached, the port reversal is of no consequence. However if 2 flatpanels are attached, it can cause display problems. There is no sane way of determining if the hardware reversed the i2c port assignment, so the simplest fix is to add a boot/module option, "reverse_i2c to explicitly reverse the i2c port. This also restores i2c ordering back to the pre-2.6.22 state. Signed-off-by: Antonino Daplas <adaplas@gail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/nvidia/nv_i2c.c8
-rw-r--r--drivers/video/nvidia/nv_type.h1
-rw-r--r--drivers/video/nvidia/nvidia.c6
3 files changed, 11 insertions, 4 deletions
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index afe4567e1ff4..0cbcb3d833fb 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -125,11 +125,11 @@ void nvidia_create_i2c_busses(struct nvidia_par *par)
125 par->chan[1].par = par; 125 par->chan[1].par = par;
126 par->chan[2].par = par; 126 par->chan[2].par = par;
127 127
128 par->chan[0].ddc_base = 0x36; 128 par->chan[0].ddc_base = (par->reverse_i2c) ? 0x36 : 0x3e;
129 nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0", I2C_CLASS_HWMON); 129 nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0", 0);
130 130
131 par->chan[1].ddc_base = 0x3e; 131 par->chan[1].ddc_base = (par->reverse_i2c) ? 0x3e : 0x36;
132 nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1", 0); 132 nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1", I2C_CLASS_HWMON);
133 133
134 par->chan[2].ddc_base = 0x50; 134 par->chan[2].ddc_base = 0x50;
135 nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2", 0); 135 nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2", 0);
diff --git a/drivers/video/nvidia/nv_type.h b/drivers/video/nvidia/nv_type.h
index 2fdf77ec39fc..f132aab8c5de 100644
--- a/drivers/video/nvidia/nv_type.h
+++ b/drivers/video/nvidia/nv_type.h
@@ -135,6 +135,7 @@ struct nvidia_par {
135 int paneltweak; 135 int paneltweak;
136 int LVDS; 136 int LVDS;
137 int pm_state; 137 int pm_state;
138 int reverse_i2c;
138 u32 crtcSync_read; 139 u32 crtcSync_read;
139 u32 fpSyncs; 140 u32 fpSyncs;
140 u32 dmaPut; 141 u32 dmaPut;
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index a7fe214f0f77..30e14eb1f51e 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -79,6 +79,7 @@ static int noscale __devinitdata = 0;
79static int paneltweak __devinitdata = 0; 79static int paneltweak __devinitdata = 0;
80static int vram __devinitdata = 0; 80static int vram __devinitdata = 0;
81static int bpp __devinitdata = 8; 81static int bpp __devinitdata = 8;
82static int reverse_i2c __devinitdata;
82#ifdef CONFIG_MTRR 83#ifdef CONFIG_MTRR
83static int nomtrr __devinitdata = 0; 84static int nomtrr __devinitdata = 0;
84#endif 85#endif
@@ -1305,6 +1306,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1305 par->CRTCnumber = forceCRTC; 1306 par->CRTCnumber = forceCRTC;
1306 par->FpScale = (!noscale); 1307 par->FpScale = (!noscale);
1307 par->paneltweak = paneltweak; 1308 par->paneltweak = paneltweak;
1309 par->reverse_i2c = reverse_i2c;
1308 1310
1309 /* enable IO and mem if not already done */ 1311 /* enable IO and mem if not already done */
1310 pci_read_config_word(pd, PCI_COMMAND, &cmd); 1312 pci_read_config_word(pd, PCI_COMMAND, &cmd);
@@ -1486,6 +1488,8 @@ static int __devinit nvidiafb_setup(char *options)
1486 noaccel = 1; 1488 noaccel = 1;
1487 } else if (!strncmp(this_opt, "noscale", 7)) { 1489 } else if (!strncmp(this_opt, "noscale", 7)) {
1488 noscale = 1; 1490 noscale = 1;
1491 } else if (!strncmp(this_opt, "reverse_i2c", 11)) {
1492 reverse_i2c = 1;
1489 } else if (!strncmp(this_opt, "paneltweak:", 11)) { 1493 } else if (!strncmp(this_opt, "paneltweak:", 11)) {
1490 paneltweak = simple_strtoul(this_opt+11, NULL, 0); 1494 paneltweak = simple_strtoul(this_opt+11, NULL, 0);
1491 } else if (!strncmp(this_opt, "vram:", 5)) { 1495 } else if (!strncmp(this_opt, "vram:", 5)) {
@@ -1582,6 +1586,8 @@ MODULE_PARM_DESC(mode_option, "Specify initial video mode");
1582module_param(bpp, int, 0); 1586module_param(bpp, int, 0);
1583MODULE_PARM_DESC(bpp, "pixel width in bits" 1587MODULE_PARM_DESC(bpp, "pixel width in bits"
1584 "(default=8)"); 1588 "(default=8)");
1589module_param(reverse_i2c, int, 0);
1590MODULE_PARM_DESC(reverse_i2c, "reverse port assignment of the i2c bus");
1585#ifdef CONFIG_MTRR 1591#ifdef CONFIG_MTRR
1586module_param(nomtrr, bool, 0); 1592module_param(nomtrr, bool, 0);
1587MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " 1593MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) "