From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: "Frank Schäfer" <fschaefer.oss-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Q: i2c block write emulation / handling of i2c message size constraints of a bus ?
Date: Mon, 29 Oct 2012 18:27:25 +0100 [thread overview]
Message-ID: <20121029182725.7abb3913@endymion.delvare> (raw)
In-Reply-To: <508E9FA0.4000505-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Hi Frank,
On Mon, 29 Oct 2012 17:24:16 +0200, Frank Schäfer wrote:
> Am 28.10.2012 19:39, schrieb Jean Delvare:
> > In theory, "fully I2C compliant" means that i2c_transfer() would
> > succeed regardless of the message set passed (unless protocol mangling
> > flags are used.) In practice, it is still OK to set I2C_FUNC_I2C if the
> > controller has limitations, as long as these limitations are less
> > restrictive than SMBus.
>
> I would say no, not true in my this case.
>
> So we have 1x pro and 2x contra I2C_FUNC_I2C.
>
> My feeling is, that a max. data size of 1 byte isn't what users of
> i2c_transfer, i2c_master_send and i2c_master_recv expect.
> So I think I will stay with I2C_FUNC_SMBUS_READ_BYTE |
> I2C_FUNC_SMBUS_BYTE_DATA only.
I agree.
> >> To summarize: there is no possibilty to determine the maximum i2c data
> >> length when using the i2c_xfer functions directly. It's basically try
> >> and error and if the message is too long, the adapters should return
> >> -EOPNOTSUPP.
> > Yes, this is correct. I2C_FUNC_* flags aren't fine-grained enough to
> > describe all cases, so they should be used as a way for device driver
> > to exclude transactions which aren't supported at all, but they may
> > still have to deal with -EOPNOTSUPP on supported transactions. This is
> > handled on a case-by-case basis.
> >
> > It could be argued that the I2C_FUNC_* flags aren't really necessary
> > and drivers could simply try what they need and deal with -EOPNOTSUPP
> > afterward. This is correct but it would probably make the driver code
> > more complex in most cases.
>
> What about adding a field/function i2c_xfer_maxlen to struct i2c_algortihm ?
This is only one of the various limitations we've seen in I2C
controllers so far. The maximum length may even by different in both
directions. Some controllers only support a discrete set of message
lengths or numbers. Etc... I don't think it makes sense to try to
exhaustively describe all these possible limitations. The current
approach where bus drivers return -EOPNOTSUPP on what they do not
support seems a lot better to me.
> It would also be useful for i2c_smbus_xfer_emulated, which can do a much
> better emulation with this information.
Can't see how. i2c_smbus_xfer_emulated translates an SMBus transaction
to an I2C message set, and there's only one way it can do that. Either
the controller can handle it, or it can't, but it's definitely not
i2c_smbus_xfer_emulated's job to silently tinkle the request to work
around hardware limitations.
--
Jean Delvare
next prev parent reply other threads:[~2012-10-29 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-27 14:17 Q: i2c block write emulation / handling of i2c message size constraints of a bus ? Frank Schäfer
[not found] ` <508BECFE.2010302-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-10-27 15:50 ` Jean Delvare
[not found] ` <20121027175030.0474249b-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-27 15:41 ` Frank Schäfer
[not found] ` <508C009F.30107-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-10-28 12:03 ` Jean Delvare
[not found] ` <20121028130301.64f032ff-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-28 13:32 ` Frank Schäfer
[not found] ` <508D33E0.6070808-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-10-28 15:33 ` Jean Delvare
[not found] ` <20121028163342.48bc40aa-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-28 15:25 ` Frank Schäfer
[not found] ` <508D4E5F.4070209-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-10-28 17:39 ` Jean Delvare
[not found] ` <20121028183913.79ad5ae3-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-29 15:24 ` Frank Schäfer
[not found] ` <508E9FA0.4000505-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-10-29 17:27 ` Jean Delvare [this message]
2012-10-28 15:11 ` Laurent Pinchart
2012-10-28 14:37 ` Frank Schäfer
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=20121029182725.7abb3913@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=fschaefer.oss-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
--cc=linux-i2c-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).