From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Smirl Subject: Re: Re: [PATCH] Remove voodoo code from i2c Date: Fri, 5 Mar 2004 18:10:16 -0800 (PST) Sender: linux-fbdev-devel-admin@lists.sourceforge.net Message-ID: <20040306021016.46831.qmail@web14916.mail.yahoo.com> References: <20040306004747.GA3218@dreamland.darkstar.lan> Mime-Version: 1.0 Return-path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11] helo=sc8-sf-mx1.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1AzRV0-0007O9-IQ for linux-fbdev-devel@lists.sourceforge.net; Fri, 05 Mar 2004 18:25:10 -0800 Received: from web14916.mail.yahoo.com ([216.136.225.229]) by sc8-sf-mx1.sourceforge.net with smtp (Exim 4.30) id 1AzRGa-0000Wb-FS for linux-fbdev-devel@lists.sourceforge.net; Fri, 05 Mar 2004 18:10:16 -0800 In-Reply-To: <20040306004747.GA3218@dreamland.darkstar.lan> Errors-To: linux-fbdev-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: kronos@kronoz.cjb.net, Benjamin Herrenschmidt Cc: Linux Fbdev development list Can this be written as a generic i2c probe function by calling i2c chanel functions instead of directly calling radeon_gpio_setscl, etc? The i2c chan= el functions will then in turn call radeon_gpio_setscl, etc. I was under the impression that this code is used to wake up old style DDC = chips in the monitor. Waking them up is a function of the monitor, not the radeon card. If that is right, this is a monitor problem and this code needs to be= in every DDC driver, not just the radeon one. On the other hand I've tried eve= ry old monitor I have around here and none of them need this code. --- Kronos wrote: > Il Sat, Mar 06, 2004 at 10:55:14AM +1100, Benjamin Herrenschmidt ha scrit= to:=20 > > On Sat, 2004-03-06 at 08:52, Kronos wrote: > > > Hi, > > > radeon_probe_i2c_connector contains very strange code that just send > > > empty start-stop sequencies on the I2C bus. I copied the code from > > > XFree86, but speaking with I2C gurus the general feeling is that this > > > code can go away without any harm. I tested it on 3 different setup (= all > > > x86...) and it works well. I don't have any "old" monitor around to > > > fiddle with though. > > >=20 > > > Oh, if you think that this code should stay I'll send you another pat= ch > > > to make it more readable. > >=20 > > I'd rather keep the code as close to XFree as possible at this point.. >=20 > Ok, what about this (cosmetic) patch: >=20 > --- linux-2.6/drivers/video/aty/radeon_i2c.c.orig Sat Feb 28 18:11:42 2004 > +++ linux-2.6/drivers/video/aty/radeon_i2c.c Sat Feb 28 18:49:31 2004 > @@ -174,65 +174,59 @@ > int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 > **out_edid) > { > u32 reg =3D rinfo->i2c[conn-1].ddc_reg; > + struct radeon_i2c_chan *chan =3D &rinfo->i2c[conn-1]; > u8 *edid =3D NULL; > int i, j; > =20 > OUTREG(reg, INREG(reg) &=20 > ~(VGA_DDC_DATA_OUTPUT | VGA_DDC_CLK_OUTPUT)); > =20 > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setscl(chan, 1); > =20 > for (i =3D 0; i < 3; i++) { > /* For some old monitors we need the > * following process to initialize/stop DDC > */ > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setsda(chan, 1); > wait_ms(13); > =20 > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setscl(chan, 1); > for (j =3D 0; j < 5; j++) { > + /* Wait for ack */ > wait_ms(10); > - if (INREG(reg) & VGA_DDC_CLK_INPUT) > + if (radeon_gpio_getscl(chan)) > break; > } > if (j =3D=3D 5) > continue; > =20 > - OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN); > - (void)INREG(reg); > + radeon_gpio_setsda(chan, 0); > wait_ms(15); > - OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN); > - (void)INREG(reg); > + radeon_gpio_setscl(chan, 0); > wait_ms(15); > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setsda(chan, 1); > wait_ms(15); > =20 > /* Do the real work */ > - edid =3D radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]); > + edid =3D radeon_do_probe_i2c_edid(chan); > =20 > - OUTREG(reg, INREG(reg) |=20 > - (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setsda(chan, 0); > + radeon_gpio_setscl(chan, 0); > wait_ms(15); > - =09 > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN)); > - (void)INREG(reg); > +=09 > + radeon_gpio_setscl(chan, 1); > for (j =3D 0; j < 10; j++) { > + /* Wait for ack */ > wait_ms(10); > - if (INREG(reg) & VGA_DDC_CLK_INPUT) > + if (radeon_gpio_getscl(chan)) > break; > } > =20 > - OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); > - (void)INREG(reg); > + radeon_gpio_setsda(chan, 1); > wait_ms(15); > - OUTREG(reg, INREG(reg) | > - (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN)); > - (void)INREG(reg); > + > + radeon_gpio_setsda(chan, 0); > + radeon_gpio_setscl(chan, 0); > if (edid) > break; > } >=20 > In this way it clearer what's going on. >=20 > Luca > --=20 > Home: http://kronoz.cjb.net > "Sei l'unica donna della mia vita". > (Adamo) >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Linux-fbdev-devel mailing list > Linux-fbdev-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel =3D=3D=3D=3D=3D Jon Smirl jonsmirl@yahoo.com __________________________________ Do you Yahoo!? Yahoo! Search - Find what you=92re looking for faster http://search.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dclick