[media] tda18271-common: hold the I2C adapter during write transfers
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 28 Sep 2012 14:04:21 +0000 (11:04 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 7 Oct 2012 12:43:01 +0000 (09:43 -0300)
commit78ef81f6ea9649fd09d1fafcfa0ad68763172c42
tree7e7737736c2c7b08cc9aa682538b91d6cbda9538
parent034351ff6372c1a880ed4c5d333e430e9c83d467
[media] tda18271-common: hold the I2C adapter during write transfers

The tda18271 datasheet says:
"The image rejection calibration and RF tracking filter
 calibration must be launched exactly as described in the
 flowchart, otherwise bad calibration or even blocking of the
 TDA18211HD can result making it impossible to communicate
 via the I2C-bus."
(yeah, tda18271 refers there to tda18211 - likely a typo at their
 datasheets)
That likely explains why sometimes tda18271 stops answering. That
is now happening more often on designs with drx-k chips, as the
firmware is now loaded asyncrousnly there.
While the above text doesn't explicitly tell that the I2C bus
couldn't be used by other devices during such initialization,
that seems to be a requirement there.
So, let's explicitly use the I2C lock there, avoiding I2C bus
share during those critical moments.
Compile-tested only. Please test.

Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/tuners/tda18271-common.c