From: "Antonino A. Daplas" <adaplas@hotpop.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH 1/9] fbdev: Cleanup i2c code of rivafb
Date: Tue, 21 Dec 2004 23:33:51 +0800 [thread overview]
Message-ID: <20041221213624.52ED31A0256@smtp-1.hotpop.com> (raw)
- Change timings to as close as possible to VESA specs and
use msecs_to_jiffies() instead of hard-coded number
- Attempt to read all i2c busses regardless of chipset type
Signed-off-by: Antonino Daplas <adaplas@pol.net>
---
fbdev.c | 8 +++++---
rivafb-i2c.c | 44 +++++++++++++-------------------------------
2 files changed, 18 insertions(+), 34 deletions(-)
diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
--- a/drivers/video/riva/fbdev.c 2004-12-18 20:36:25 +08:00
+++ b/drivers/video/riva/fbdev.c 2004-11-23 21:21:29 +08:00
@@ -1769,17 +1769,19 @@
static int __devinit riva_get_EDID_i2c(struct fb_info *info)
{
struct riva_par *par = (struct riva_par *) info->par;
+ struct fb_var_screeninfo var;
int i;
NVTRACE_ENTER();
riva_create_i2c_busses(par);
- for (i = par->bus; i >= 1; i--) {
- riva_probe_i2c_connector(par, i, &par->EDID);
- if (par->EDID) {
+ for (i = 0; i < par->bus; i++) {
+ riva_probe_i2c_connector(par, i+1, &par->EDID);
+ if (par->EDID && !fb_parse_edid(par->EDID, &var)) {
printk(PFX "Found EDID Block from BUS %i\n", i);
break;
}
}
+
NVTRACE_LEAVE();
return (par->EDID) ? 1 : 0;
}
diff -Nru a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
--- a/drivers/video/riva/rivafb-i2c.c 2004-10-19 20:24:18 +08:00
+++ b/drivers/video/riva/rivafb-i2c.c 2004-11-23 21:21:30 +08:00
@@ -19,6 +19,7 @@
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/fb.h>
+#include <linux/jiffies.h>
#include <asm/io.h>
@@ -106,8 +107,7 @@
chan->algo.getsda = riva_gpio_getsda;
chan->algo.getscl = riva_gpio_getscl;
chan->algo.udelay = 40;
- chan->algo.mdelay = 5;
- chan->algo.timeout = 20;
+ chan->algo.timeout = msecs_to_jiffies(2);
chan->algo.data = chan;
i2c_set_adapdata(&chan->adapter, chan);
@@ -127,39 +127,18 @@
void riva_create_i2c_busses(struct riva_par *par)
{
+ par->bus = 3;
+
par->chan[0].par = par;
par->chan[1].par = par;
par->chan[2].par = par;
- par->bus = 0;
-
- switch ((par->pdev->device >> 4) & 0xff) {
- case 0x17:
- case 0x18:
- case 0x25:
- case 0x28:
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- par->chan[2].ddc_base = 0x50;
- par->bus++;
- riva_setup_i2c_bus(&par->chan[2], "BUS3");
- case 0x04:
- case 0x05:
- case 0x10:
- case 0x11:
- case 0x15:
- case 0x20:
- par->chan[1].ddc_base = 0x36;
- par->bus++;
- riva_setup_i2c_bus(&par->chan[1], "BUS2");
- case 0x03:
- par->chan[0].ddc_base = 0x3e;
- par->bus++;
- riva_setup_i2c_bus(&par->chan[0], "BUS1");
- }
+ par->chan[0].ddc_base = 0x3e;
+ par->chan[1].ddc_base = 0x36;
+ par->chan[2].ddc_base = 0x50;
+ riva_setup_i2c_bus(&par->chan[0], "BUS1");
+ riva_setup_i2c_bus(&par->chan[1], "BUS2");
+ riva_setup_i2c_bus(&par->chan[2], "BUS3");
}
void riva_delete_i2c_busses(struct riva_par *par)
@@ -172,6 +151,9 @@
i2c_bit_del_bus(&par->chan[1].adapter);
par->chan[1].par = NULL;
+ if (par->chan[2].par)
+ i2c_bit_del_bus(&par->chan[2].adapter);
+ par->chan[2].par = NULL;
}
static u8 *riva_do_probe_i2c_edid(struct riva_i2c_chan *chan)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
reply other threads:[~2004-12-21 21:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041221213624.52ED31A0256@smtp-1.hotpop.com \
--to=adaplas@hotpop.com \
--cc=akpm@osdl.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).