From: Jean Delvare <khali@linux-fr.org>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Andy Walls <awalls@radix.net>, Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: bttv, tvaudio and ir-kbd-i2c probing conflict
Date: Mon, 16 Mar 2009 09:35:25 +0100 [thread overview]
Message-ID: <20090316093525.15f3dd62@hyperion.delvare> (raw)
In-Reply-To: <Pine.LNX.4.58.0903151637370.28292@shell2.speakeasy.net>
Hi Trent,
On Sun, 15 Mar 2009 16:46:36 -0700 (PDT), Trent Piepho wrote:
> On Sun, 15 Mar 2009, Andy Walls wrote:
> > But the specific problem that Hans' brings up is precisely a Linux
> > kernel I2C subsystem *software* prohibition on two i2c_clients binding
> > to the same address on the same adapter.
>
> For a lot of i2c devices, it would be difficult for two drivers to access
> the device at the same time without some kind of locking.
>
> If you take the reads and writes of one driver and then intersperse the
> reads and writes of another driver, the resulting sequence from the i2c
> device's point of view is completely broken.
Correct.
> But, I suppose there are some devices where if the drivers all use
> i2c_smbus_read/write_byte/word_data or equivalent atomic transactions
> with i2c_transfer(), then you could get away with two drivers talking to
> the same chip.
Yes, this may be possible for some devices, but it can't be
generalized. Non-atomic transactions are one problem but there are
others, for example some I2C devices do not have a flat address space
(the same I2C transaction can access different registers depending on
the value of another register commonly known as bank selector.) Another
problem is read-modify-write cycles, which in my experience are often
needed for I2C devices, and which are racy if several drivers attempt
to handle the same device and want to touch the same register.
So, all in all, great care should always be taken when more than one
driver accesses the same I2C device. And even if only one driver
accesses the I2C device, all accesses that can happen in parallel (for
example triggered by sysfs attribute reads or writes) may have to be
serialized by the driver.
--
Jean Delvare
next prev parent reply other threads:[~2009-03-16 8:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-15 12:44 bttv, tvaudio and ir-kbd-i2c probing conflict Hans Verkuil
2009-03-15 17:12 ` Jean Delvare
2009-03-15 17:42 ` Trent Piepho
2009-03-15 17:53 ` Jean Delvare
2009-03-16 9:08 ` Mauro Carvalho Chehab
2009-03-16 9:34 ` Mauro Carvalho Chehab
2009-03-16 11:18 ` Jean Delvare
2009-03-16 12:52 ` Mauro Carvalho Chehab
2009-03-16 14:28 ` Jean Delvare
2009-03-16 15:31 ` Mauro Carvalho Chehab
2009-03-16 19:43 ` Trent Piepho
2009-03-16 21:40 ` Jean Delvare
2009-03-16 21:58 ` Hans Verkuil
2009-03-16 22:47 ` Trent Piepho
2009-03-17 9:31 ` Jean Delvare
2009-03-17 20:23 ` Trent Piepho
2009-03-15 19:34 ` Andy Walls
2009-03-15 22:09 ` Hans Verkuil
2009-03-15 22:28 ` Jean Delvare
2009-03-15 22:26 ` Jean Delvare
2009-03-16 0:52 ` Andy Walls
2009-03-16 4:26 ` hermann pitton
2009-03-16 12:58 ` Jean Delvare
2009-03-15 23:46 ` Trent Piepho
2009-03-16 8:35 ` Jean Delvare [this message]
2009-03-16 11:35 ` Andy Walls
-- strict thread matches above, loose matches on Subject: below --
2009-03-16 11:56 Hans Verkuil
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=20090316093525.15f3dd62@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=awalls@radix.net \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=xyzzy@speakeasy.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.