<div class="gmail_quote">On Thu, Oct 20, 2011 at 10:33, Jean Delvare <span dir="ltr">&lt;<a href="mailto:khali@linux-fr.org">khali@linux-fr.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div>Just to clarify: by &quot;connectivity is setup&quot;, do you mean code in the<br></div>
driver setting the GPIO pin direction etc., or a display being<br>
connected to the graphics card?<br>
<br>
I admit I am a little surprised. I2C buses should have their lines up<br>
by default, thanks to pull-up resistors, and masters and slaves should<br>
merely drive the lines low as needed. The absence of slaves should have<br>
no impact on the line behavior. If the Intel graphics chips (or the<br>
driver) rely on the display to hold the lines high, I&#39;d say this is a<br>
seriously broken design.<br>
<br>
As a side note, I thought that HDMI had the capability of presence<br>
detection, so there may be a better way to know if a display is<br>
connected or not, and this information could used to dynamically<br>
instantiate and delete the I2C buses? That way we could skip probing<br>
for EDID when there is no chance of success.<br></blockquote><div><br>Yes, I think so too.<br><br>I admit I haven&#39;t got to the root of the problem here. My test was really simple, borrowed from the test_bus() at i2c-algo-bit.c - without HDMI cable plugged in, I was getting the &quot;SDA stuck high&quot; messages; with the cable plugged in, I wasn&#39;t getting any of those.<br>

<br>But in any case, I haven&#39;t investigated it deeper in the hardware direction after figuring out that drm_get_edid would retry its attempts for retreiving the edid for 15 times, getting the -ENXIO error for all of them.<br>

 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Well, you could always do manual line testing of the I2C bus _before_<br>
calling drm_do_probe_ddc_edid()? And skip the call if the test fails<br>
(i.e. the bus isn&#39;t ready for use.) As said before, I am willing to<br>
export bit_test if it helps any. I&#39;ve attached a patch doing exactly<br>
this. Let me know if you want me to commit it.<br></blockquote><div><br>Yes, surely, I can do this. I did a similar test in the i915-specific patch, checking if we can talk to i2c adapter pior to call drm_do_probe_ddc_edid, but I thought that perhaps it would be easier for all the cards relying on drm_get_edid to have a faster return path in case of problems.<br>

<br>I am fine with any solution, if this problem is happening to appear on i915 cards only, we could do this in our driver. It is that 15 attempts looks a bit overkill.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


Your proposed patch is better than I first thought. I had forgotten<br>
that i2c-algo-bit tries up to 3 times to get a first ack from a slave.<br>
So if i2c_transfer returns -ENXIO, this means that i2c-algo-bit has<br>
already attempted 3 times to contact the slave, with no reply, so<br>
there&#39;s probably no point going on. A communication problem with a<br>
present slave would have returned a different error code.<br>
<br>
Without your patch, a missing slave would cause 3 * 5 = 15 retries,<br>
which is definitely too much.<br>
<br>
That being said, even then the whole probe sequence shouldn&#39;t exceed<br>
10 ms, which I wouldn&#39;t expect a user to notice. The user-reported 4<br>
second delay when running xrandr can&#39;t be caused by this. 4 seconds for<br>
15 attempts is 250 ms per attempt, this looks like a timeout due to<br>
non-functional bus, not a nack. Not that 250 ms is 1 jiffy for HZ=250,<br>
which I guess was what the reporting user was running. So even with<br>
your patch, there&#39;s still 750 ms to wait, I don&#39;t think this is<br>
acceptable. You really have to fix that I2C bus or skip probing it.<br></blockquote><div><br>Yep, true. I&#39;ve followed the easiest route so far - find out where the initial problem happens, and attempt at solving it. This change in drm_get_edid solves the delay at its origin, but we certainly could have additional delays propagated somewhere else. I couldn&#39;t reproduce the original reporter&#39;s huge delay, so I looked at what was within my reach.<br clear="all">

</div></div><br>In any case - looking at a faster way to leave the drm_do_probe_ddc_edid, while also allowing a way for having a more detailed probing - would it be an acceptable solution to add a:<br><br>MODULE_PARM(skip_unresponsive_edid, &quot;Ignore outputs which do not provide edid on first attempt&quot;);<br>

<br>and update the patch to use this option?<br><br>-- <br>Eugeni Dodonov<a href="http://eugeni.dodonov.net/" target="_blank"><br></a><br>