From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Antonio Borneo <borneo.antonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Benjamin Tissoires
<benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] hid: cp2112: support i2c_transfer() when num > 1
Date: Sun, 15 Mar 2015 13:10:20 +0100 [thread overview]
Message-ID: <20150315121020.GA14594@katana> (raw)
In-Reply-To: <1426419798-25360-1-git-send-email-borneo.antonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
On Sun, Mar 15, 2015 at 07:43:18PM +0800, Antonio Borneo wrote:
> The device cp2112 does not support i2c combined transactions,
> since unable to suppress the stop bit between adjacent i2c
> transactions.
Let's keep the precise terminology: a 'transfer' is anything between the
start and stop bit. It can consist of multiple 'messages' which are
combined with repeated start within one transfer.
> For this reason, in commit b9029345ed6483fcadadc4834b44a5656dd56d70
> ("HID: cp2112: add I2C mode") I have omitted the support for
> num > 1 in i2c_transfer().
Good. You should make use of the quirk framework soon in linux-next or
here: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/quirks
> 1) in few kernel drivers i2c_transfer() has been used to
> simplify the code by replacing a sequence of i2c_master_send()
> and i2c_master_recv(), e.g. in i2c-hid.c and iio subsystem.
> Those drivers will fail if used with current cp2112 driver.
I see two options for those:
1) revert the simplifications and sacrifice a bit of performance
to support the widest number of adapters
2) use the quirk infrastructure from above to query the
quirks of the adapter to chose between fast or compatible
Keep in mind that some devices do *require* that messages are combined
with repeated start because they will reset their state machine after
stop.
> 2) in drivers/i2c/busses/ there are already drivers that
> implement i2c_transfer() as a sequence of elementary (not
> combined) i2c transactions, e.g. i2c-bcm2835.c, i2c-puv3.c,
> i2c-qup.c, i2c-robotfuzz-osif.c, i2c-viperboard.c, i2c-xlr.c.
You misread that, most probably. They are iterating over the messages,
yes, but they are expected to connect them via repeated start. If there
is a driver sending stop after every message and accepting more than one
message per transfer, this is a bug.
> To fix 1) and considering 2), rewrite i2c_transfer() in case
> of num > 1 as a loop of non-combined i2c transactions.
For the above reasons, NAK.
> In [1] we had a talk about implementing i2c_transfer() as a
> sequence of elementary (not combined) i2c transactions.
> After Jonathan's reply in [2], I went to check better the
> existing I2C drivers and I changed opinion.
And why is this driver in hid? This is clearly an I2C master driver?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-15 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-15 11:43 [PATCH] hid: cp2112: support i2c_transfer() when num > 1 Antonio Borneo
[not found] ` <1426419798-25360-1-git-send-email-borneo.antonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-15 12:10 ` Wolfram Sang [this message]
2015-03-15 13:23 ` Antonio Borneo
2015-03-15 14:27 ` Wolfram Sang
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=20150315121020.GA14594@katana \
--to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
--cc=benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=borneo.antonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).