From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Mylene Josserand
<Mylene.Josserand-207QzMZ2trZBDgjK7y7TUQ@public.gmane.org>
Cc: anish singh
<anish198519851985-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
kernelnewbies
<kernelnewbies-7JyXY6prKcjpASu1u0TL5ti2O/JbrIOy@public.gmane.org>,
Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kernel-mail
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [I2C] informations + advice about messages handling
Date: Fri, 24 May 2013 14:20:17 +0200 [thread overview]
Message-ID: <20130524142017.52545a52@endymion.delvare> (raw)
In-Reply-To: <CA78C307B8F06747967D122FC656B15398644B-h91saMYnf+Sy7mydlWgvtqzUEOm+Xw19@public.gmane.org>
On Fri, 24 May 2013 11:52:54 +0200, Mylene Josserand wrote:
> Right now, my company uses the "i2c_smbus_read/write_byte_data"
> functions to talk to devices through an application. On the datasheet of
> these devices, I search but did not seem to be SMBus compliant.
> As it was a software which was using these functions, we thought that a
> driver (that I would write) should be better. And here I am ! I prefer
> to understand well the mechanism before coding anything and it is
> interesting !
If the application was using i2c_smbus_read/write_byte_data from
user-space, then a kernel driver would call the same functions. No
reason why this wouldn't work.
> (...)
> Thanks for the explanation.
> No problem, we have 2 devices used without drivers :
> - an odometer PIC18F24201 : In the datasheet, there is a SMBus select
> bit but I don't know if it is SMBus compliant.
Couldn't find the datasheet for this one, unfortunately.
> - an audio codec tlv320aic3204 : There is a driver for this device but
> for some reasons, we did not use it. Did not find a "SMBus compliant" in
> its datasheet.
The tlv320aic32x4 driver uses i2c_master_send, which is a shortcut to
i2c_transfer. However it seems to only send 2 bytes on the bus at once,
the same could be achieved with i2c_smbus_write_byte_data if needed.
For completeness: a device might use transactions which are compliant
with SMBus without being formally "SMBus-compliant", because SMBus has
more constraints than just transaction types (I kept things simple
originally to not confuse you.) This may explain why it isn't mentioned
in the datasheet. Or just because the manufacturer did not care because
they target fully I2C-capable systems anyway.
What you have to look at is the transaction types. They are usually
described in the datasheet. Then compare with either the SMBus
specification or
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/i2c/smbus-protocol
and if they match then you can use the i2c_smbus_*() calls.
> (...)
> Thanks a lot for your help !
You're welcome.
--
Jean Delvare
next prev parent reply other threads:[~2013-05-24 12:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA78C307B8F06747967D122FC656B153986448@SERVEUR0.nvp.local>
2013-05-24 7:22 ` [I2C] informations + advice about messages handling anish singh
[not found] ` <CAK7N6vpg6QUAKODKO2Msr4+GTASLDpA2cG1teQV3yiwt7D4SSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-24 7:44 ` Jean Delvare
2013-05-24 8:54 ` Mylene Josserand
2013-05-24 9:07 ` Jean Delvare
[not found] ` <20130524110706.6052493e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-05-24 9:52 ` Mylene Josserand
[not found] ` <CA78C307B8F06747967D122FC656B15398644B-h91saMYnf+Sy7mydlWgvtqzUEOm+Xw19@public.gmane.org>
2013-05-24 12:20 ` Jean Delvare [this message]
2013-05-29 10:17 ` Mylene Josserand
[not found] ` <20130524094407.61d0ec42-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-05-24 10:59 ` anish singh
[not found] ` <CAK7N6vqqG68c4vx1uBsNLF8zpSRQWwY5jERqjVYKE7NkEEzFSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-24 12:10 ` Jean Delvare
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=20130524142017.52545a52@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=Mylene.Josserand-207QzMZ2trZBDgjK7y7TUQ@public.gmane.org \
--cc=anish198519851985-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=kernelnewbies-7JyXY6prKcjpASu1u0TL5ti2O/JbrIOy@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-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).