Wow, thanks! On 03/04/2011 11:37 PM, Andrew de Quincey wrote:
Hi, this has been annoying me for some time, so this evening I fixed it. If you use one of the above dual tuner devices (e.g. KWorld 399U), you get random tuning failures and i2c errors reported in dmesg such as:
[...]
Adding a "bus lock" to af9015_i2c_xfer() will not work as demod/tuner accesses will take multiple i2c transactions. Therefore, the following patch overrides the dvb_frontend_ops functions to add a per-device lock around them: only one frontend can now use the i2c bus at a time. Testing with the scripts above shows this has eliminated the errors.
This have annoyed me too, but since it does not broken functionality much I haven't put much effort for fixing it. I like that fix since it is in AF9015 driver where it logically belongs to. But it looks still rather complex. I see you have also considered "bus lock" to af9015_i2c_xfer() which could be much smaller in code size (that's I have tried to implement long time back).
I would like to ask if it possible to check I2C gate open / close inside af9015_i2c_xfer() and lock according that? Something like:
typical command sequence: >> FE0 open gate >> FE0 write reg >> FE0 close gate >> FE1 open gate >> FE1 read reg >> FE1 close gate if (locked == YES) if (locked_by != caller FE) return error locked by other FE else (locked_by == caller FE) allow reg access if (gate close req) locked = NO locked_by = NONE else (locked == NO) locked = YES locked_by = caller FE allow reg access Do you see it possible? thanks Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html