Re: [Linux-fbdev-devel] [PATCH] nvidiafb: allow ignoring EDID info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry for the delay.

Il Thu, Feb 08, 2007 at 01:19:08AM +0100, Giuseppe Bilotta ha scritto: 
> On 2/8/07, Luca Tettamanti <[email protected]> wrote:
> >Il Tue, Feb 06, 2007 at 09:22:00PM +0000, James Simmons ha scritto:
> >> There is no stand alone nvidia card i2c driver. Its the issue of sharing
> >> device interfaces with the same hardware problem again!!!
> >
> >Nah, nvidiafb registers the I2C busses, you can drive them with whatever
> >you want through the devices exported by I2C core.
> >The fact the none of them work makes me think that the EDID is coming
> >from the BIOS, we do VBE calls in real mode during early kernel setup.
> 
> So what am I supposed to do to dump it, since neither i2cdump neither
> get-edid seem to work?

Good question :)

The following patch fixes a real bug in SCL control and add a few debug
info. Can you try it?

diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index 8454adf..ca8bd7e 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -25,6 +25,12 @@
 
 #include "../edid.h"
 
+#define DDC_SDA_READ_MASK  (1 << 3)
+#define DDC_SCL_READ_MASK  (1 << 2)
+#define DDC_SDA_WRITE_MASK (1 << 4)
+#define DDC_SCL_WRITE_MASK (1 << 5)
+
+
 static void nvidia_gpio_setscl(void *data, int state)
 {
 	struct nvidia_i2c_chan *chan = data;
@@ -35,9 +41,9 @@ static void nvidia_gpio_setscl(void *data, int state)
 	val = VGA_RD08(par->PCIO, 0x3d5) & 0xf0;
 
 	if (state)
-		val |= 0x20;
+		val |= DDC_SDA_WRITE_MASK;
 	else
-		val &= ~0x20;
+		val &= ~DDC_SDA_WRITE_MASK;
 
 	VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1);
 	VGA_WR08(par->PCIO, 0x3d5, val | 0x1);
@@ -53,9 +59,9 @@ static void nvidia_gpio_setsda(void *data, int state)
 	val = VGA_RD08(par->PCIO, 0x3d5) & 0xf0;
 
 	if (state)
-		val |= 0x10;
+		val |= DDC_SDA_WRITE_MASK;
 	else
-		val &= ~0x10;
+		val &= ~DDC_SDA_WRITE_MASK;
 
 	VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1);
 	VGA_WR08(par->PCIO, 0x3d5, val | 0x1);
@@ -68,11 +74,9 @@ static int nvidia_gpio_getscl(void *data)
 	u32 val = 0;
 
 	VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base);
-	if (VGA_RD08(par->PCIO, 0x3d5) & 0x04)
+	if (VGA_RD08(par->PCIO, 0x3d5) & DDC_SCL_READ_MASK)
 		val = 1;
 
-	val = VGA_RD08(par->PCIO, 0x3d5);
-
 	return val;
 }
 
@@ -83,7 +87,7 @@ static int nvidia_gpio_getsda(void *data)
 	u32 val = 0;
 
 	VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base);
-	if (VGA_RD08(par->PCIO, 0x3d5) & 0x08)
+	if (VGA_RD08(par->PCIO, 0x3d5) & DDC_SDA_READ_MASK)
 		val = 1;
 
 	return val;
@@ -188,7 +192,7 @@ static u8 *nvidia_do_probe_i2c_edid(struct nvidia_i2c_chan *chan)
 
 	if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
 		return buf;
-	dev_dbg(&chan->par->pci_dev->dev, "Unable to read EDID block.\n");
+	dev_warn(&chan->par->pci_dev->dev, "Unable to read EDID block.\n");
 	kfree(buf);
 	return NULL;
 }
@@ -208,7 +212,10 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
 
 	if (!edid && conn == 1) {
 		/* try to get from firmware */
-		const u8 *e = fb_firmware_edid(info->device);
+		const u8 *e;
+		printk("I2C probe failed for connector %d, falling back to firmware\n", conn);
+		
+		e = fb_firmware_edid(info->device);
 
 		if (e != NULL)
 			edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);

Luca
-- 
"La teoria e` quando sappiamo come funzionano le cose ma non funzionano.
 La pratica e` quando le cose funzionano ma non sappiamo perche`.
 Abbiamo unito la teoria e la pratica: le cose non funzionano piu` e non
 sappiamo il perche`." -- A. Einstein
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux