Commit 3c03ec20 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

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: default avatarAntonino Daplas <adaplas@gail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1c5dd170
...@@ -125,11 +125,11 @@ void nvidia_create_i2c_busses(struct nvidia_par *par) ...@@ -125,11 +125,11 @@ void nvidia_create_i2c_busses(struct nvidia_par *par)
par->chan[1].par = par; par->chan[1].par = par;
par->chan[2].par = par; par->chan[2].par = par;
par->chan[0].ddc_base = 0x36; par->chan[0].ddc_base = (par->reverse_i2c) ? 0x36 : 0x3e;
nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0", I2C_CLASS_HWMON); nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0", 0);
par->chan[1].ddc_base = 0x3e; par->chan[1].ddc_base = (par->reverse_i2c) ? 0x3e : 0x36;
nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1", 0); nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1", I2C_CLASS_HWMON);
par->chan[2].ddc_base = 0x50; par->chan[2].ddc_base = 0x50;
nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2", 0); nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2", 0);
......
...@@ -135,6 +135,7 @@ struct nvidia_par { ...@@ -135,6 +135,7 @@ struct nvidia_par {
int paneltweak; int paneltweak;
int LVDS; int LVDS;
int pm_state; int pm_state;
int reverse_i2c;
u32 crtcSync_read; u32 crtcSync_read;
u32 fpSyncs; u32 fpSyncs;
u32 dmaPut; u32 dmaPut;
......
...@@ -79,6 +79,7 @@ static int noscale __devinitdata = 0; ...@@ -79,6 +79,7 @@ static int noscale __devinitdata = 0;
static int paneltweak __devinitdata = 0; static int paneltweak __devinitdata = 0;
static int vram __devinitdata = 0; static int vram __devinitdata = 0;
static int bpp __devinitdata = 8; static int bpp __devinitdata = 8;
static int reverse_i2c __devinitdata;
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
static int nomtrr __devinitdata = 0; static int nomtrr __devinitdata = 0;
#endif #endif
...@@ -1305,6 +1306,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, ...@@ -1305,6 +1306,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
par->CRTCnumber = forceCRTC; par->CRTCnumber = forceCRTC;
par->FpScale = (!noscale); par->FpScale = (!noscale);
par->paneltweak = paneltweak; par->paneltweak = paneltweak;
par->reverse_i2c = reverse_i2c;
/* enable IO and mem if not already done */ /* enable IO and mem if not already done */
pci_read_config_word(pd, PCI_COMMAND, &cmd); pci_read_config_word(pd, PCI_COMMAND, &cmd);
...@@ -1486,6 +1488,8 @@ static int __devinit nvidiafb_setup(char *options) ...@@ -1486,6 +1488,8 @@ static int __devinit nvidiafb_setup(char *options)
noaccel = 1; noaccel = 1;
} else if (!strncmp(this_opt, "noscale", 7)) { } else if (!strncmp(this_opt, "noscale", 7)) {
noscale = 1; noscale = 1;
} else if (!strncmp(this_opt, "reverse_i2c", 11)) {
reverse_i2c = 1;
} else if (!strncmp(this_opt, "paneltweak:", 11)) { } else if (!strncmp(this_opt, "paneltweak:", 11)) {
paneltweak = simple_strtoul(this_opt+11, NULL, 0); paneltweak = simple_strtoul(this_opt+11, NULL, 0);
} else if (!strncmp(this_opt, "vram:", 5)) { } else if (!strncmp(this_opt, "vram:", 5)) {
...@@ -1582,6 +1586,8 @@ MODULE_PARM_DESC(mode_option, "Specify initial video mode"); ...@@ -1582,6 +1586,8 @@ MODULE_PARM_DESC(mode_option, "Specify initial video mode");
module_param(bpp, int, 0); module_param(bpp, int, 0);
MODULE_PARM_DESC(bpp, "pixel width in bits" MODULE_PARM_DESC(bpp, "pixel width in bits"
"(default=8)"); "(default=8)");
module_param(reverse_i2c, int, 0);
MODULE_PARM_DESC(reverse_i2c, "reverse port assignment of the i2c bus");
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
module_param(nomtrr, bool, 0); module_param(nomtrr, bool, 0);
MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment