public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Michael Hunold <hunold-ml@web.de>, Greg KH <greg@kroah.com>,
	LM Sensors <sensors@stimpy.netroedge.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.6] Add command function to struct i2c_adapter
Date: Tue, 21 Sep 2004 17:02:00 -0400	[thread overview]
Message-ID: <9e47339104092114025e763da8@mail.gmail.com> (raw)
In-Reply-To: <20040921223325.66b07f78.khali@linux-fr.org>

This is the special wake code for older monitors.  ATI supplied it and
it is in the radeon driver.

My understanding that this is a generic problem with old DDC monitors
so the code should be in a DDC I2C driver instead of being added to
all of the video drivers. I don't want the DDC driver to decode the
EDID data, it just needs to handle this problem.

I can say that even my current monitors don't always return the EDID
data without being woken up. The only way to see this is to have
multiple video cards in your PC. The secondary cards won't be reset by
the kernel. Reseting the card will run the BIOS which wakes the
monitors up. If you try to get the EDID from the secondary cards
before they are reset you won't be able to reliably read it.

int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn,
u8 **out_edid)
{
	u32 reg = rinfo->i2c[conn-1].ddc_reg;
	u8 *edid = NULL;
	int i, j;

	OUTREG(reg, INREG(reg) & 
			~(VGA_DDC_DATA_OUTPUT | VGA_DDC_CLK_OUTPUT));

	OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
	(void)INREG(reg);

	for (i = 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);
		msleep(13);

		OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
		(void)INREG(reg);
		for (j = 0; j < 5; j++) {
			msleep(10);
			if (INREG(reg) & VGA_DDC_CLK_INPUT)
				break;
		}
		if (j == 5)
			continue;

		OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN);
		(void)INREG(reg);
		msleep(15);
		OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN);
		(void)INREG(reg);
		msleep(15);
		OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
		(void)INREG(reg);
		msleep(15);

		/* Do the real work */
		edid = radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]);

		OUTREG(reg, INREG(reg) | 
				(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
		(void)INREG(reg);
		msleep(15);
		
		OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
		(void)INREG(reg);
		for (j = 0; j < 10; j++) {
			msleep(10);
			if (INREG(reg) & VGA_DDC_CLK_INPUT)
				break;
		}

		OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
		(void)INREG(reg);
		msleep(15);
		OUTREG(reg, INREG(reg) |
				(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
		(void)INREG(reg);
		if (edid)
			break;
	}
	if (out_edid)
		*out_edid = edid;
	if (!edid) {
		RTRACE("radeonfb: I2C (port %d) ... not found\n", conn);
		return MT_NONE;
	}
	if (edid[0x14] & 0x80) {
		/* Fix detection using BIOS tables */
		if (rinfo->is_mobility /*&& conn == ddc_dvi*/ &&
		    (INREG(LVDS_GEN_CNTL) & LVDS_ON)) {
			RTRACE("radeonfb: I2C (port %d) ... found LVDS panel\n", conn);
			return MT_LCD;
		} else {
			RTRACE("radeonfb: I2C (port %d) ... found TMDS panel\n", conn);
			return MT_DFP;
		}
	}
       	RTRACE("radeonfb: I2C (port %d) ... found CRT display\n", conn);
	return MT_CRT;
}

-- 
Jon Smirl
jonsmirl@gmail.com

  reply	other threads:[~2004-09-21 21:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20 17:19 [PATCH][2.6] Add command function to struct i2c_adapter Michael Hunold
2004-09-21 15:41 ` Greg KH
2004-09-21 17:10   ` Michael Hunold
2004-09-21 17:39     ` Jon Smirl
2004-09-21 18:05       ` Michael Hunold
2004-09-22  8:56         ` Adrian Cox
2004-09-22 12:08           ` Jean Delvare
2004-09-22 11:54             ` Adrian Cox
2004-09-22 13:38               ` Jean Delvare
2004-09-22 13:13                 ` Adrian Cox
2004-09-22 15:40                 ` Jon Smirl
2004-09-22 15:56                   ` Adrian Cox
2004-09-22 16:07                     ` Jon Smirl
2004-09-22 16:51                       ` Adrian Cox
2004-09-22 17:17                         ` Jon Smirl
2004-09-22 18:55                         ` Jean Delvare
2004-09-22 18:32                 ` Adrian Cox
2004-09-22 20:04                   ` Mark M. Hoffman
2004-09-23  7:41                   ` Michael Hunold
2004-09-23  7:48                   ` Michael Hunold
2004-09-23  7:09               ` Michael Hunold
2004-09-23 20:18                 ` Adrian Cox
2004-09-21 20:33       ` Jean Delvare
2004-09-21 21:02         ` Jon Smirl [this message]
2004-09-24 17:06   ` Michael Hunold
2004-09-24 18:05     ` Jean Delvare
2004-09-24 20:21       ` Michael Hunold
2004-10-01  6:52         ` Greg KH
2004-10-01 12:22           ` Adrian Cox
2004-10-01 13:57             ` Jean Delvare
2004-10-01 23:41             ` Greg KH
     [not found] <41500BED.8090607@linuxtv.org>
2004-09-21 13:28 ` Jean Delvare
2004-09-21 14:38   ` Michael Hunold

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=9e47339104092114025e763da8@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=greg@kroah.com \
    --cc=hunold-ml@web.de \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.com \
    /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