From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Helps: how to use i801--SMBus functions via
Date: Tue, 01 Nov 2005 16:59:59 +0000 [thread overview]
Message-ID: <20051101165935.381720a1.khali@linux-fr.org> (raw)
In-Reply-To: <20051101104855.41881.qmail@web31214.mail.mud.yahoo.com>
Hi Michael,
> Dear Sir,
We are not a sir. We are a number of different people, this is a
mailing list.
> I am new to Linux and Device driver programming. I am trying
> to write a device driver software module to access the ICH6
> SMBus controller on the motherboard of our PC running Linux
> 2.6.10 kernel.
This driver already exists, it's named i2c-i801. From the below, it
seems that you found that already, but your sentence is somewhat
confusing nevertheless.
> I configured my 2.6.10 kernel to have I2C built-in support
> and your i801 module loaded. Then I loaded the i2c-dev
> interface module and wrote a short application software to
> test the functions for SMBus. After my application opened the
> /dev/i2c device, I received messages saying "i2c-adaptor: i2c-0
> -- I2C level transfer not support" when my application software
> called the read and write function of the i2c-dev module. Further
> tracking inside the i2c-dev module shew that the algorithm
> parameter adap->algo->master_xfer = NULL. That means the i801
> driver was not properly loaded by the i2c-dev module.
No, this means just what the error message said. The ICH6 is an SMBus
master, not an I2C master. SMBus is a subset of I2C. I2C masters can
emulate SMBus transactions, but not the other way around.
> Could you advise how I can make use of the i801 module and your
> i2c-dev module to access the ICH6 SMBus controller?
Instead of using read() and write() on the device file, you have to use
ioctl(). See in i2c-dev.h (from the lm_sensors project) for a list of
available commands. You will at least need I2C_SLAVE to set the target
chip address, and I2C_SMBUS to run SMBus transactions. There are helper
functions in i2c-dev.h to make your life easier with SMBus
transactions, so you shouldn't have to use I2C_SMBUS explicitely.
There is some documentation available in the i2c package, or online at:
http://www2.lm-sensors.nu/~lm78/cvs/i2c/doc/dev-interface
You should take a look at prog/dump/i2cset.c in the lm_sensors package,
it is a nice example of how userspace programs can access SMBus. There
are a few other test programs in this package, but I think this is the
most simple one we have.
--
Jean Delvare
next prev parent reply other threads:[~2005-11-01 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-01 11:49 [lm-sensors] Helps: how to use i801--SMBus functions via i2c-dev MK GU
2005-11-01 16:59 ` Jean Delvare [this message]
2005-11-02 15:29 ` [lm-sensors] RE: Helps: how to use i801--SMBus functions via Gu, Mingkun
2005-11-04 20:48 ` Rudolf Marek
2005-11-07 13:38 ` [lm-sensors] Helps: how to use i801--SMBus functions viai2c-dev Gu, Mingkun
2005-11-07 15:51 ` Jean Delvare
2005-11-07 16:12 ` Gu, Mingkun
2005-11-07 16:31 ` Jean Delvare
2005-11-07 16:52 ` Gu, Mingkun
2005-11-07 17:03 ` Jean Delvare
2005-11-07 18:14 ` Gu, Mingkun
2005-11-07 19:33 ` Jean Delvare
2005-11-07 19:57 ` Gu, Mingkun
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=20051101165935.381720a1.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.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.