Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96910
b: refs/heads/master
c: af6061a
h: refs/heads/master
v: v3
  • Loading branch information
Dave Airlie committed May 7, 2008
1 parent 1da6048 commit a6f9de7
Show file tree
Hide file tree
Showing 1,108 changed files with 13,511 additions and 29,288 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1bf99477226963d84b182b3995e355d3091199be
refs/heads/master: af6061af0d9f84a4665f88186dc1ff9e4fb78330
1 change: 1 addition & 0 deletions trunk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ series
cscope.*

*.orig
*.rej
*~
\#*#
4 changes: 2 additions & 2 deletions trunk/Documentation/cgroups.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ and then start a subshell 'sh' in that cgroup:
cd /dev/cgroup
mkdir Charlie
cd Charlie
/bin/echo 2-3 > cpuset.cpus
/bin/echo 1 > cpuset.mems
/bin/echo 2-3 > cpus
/bin/echo 1 > mems
/bin/echo $$ > tasks
sh
# The subshell 'sh' is now running in cgroup Charlie
Expand Down
8 changes: 0 additions & 8 deletions trunk/Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,6 @@ Who: Glauber Costa <gcosta@redhat.com>

---------------------------

What: old style serial driver for ColdFire (CONFIG_SERIAL_COLDFIRE)
When: 2.6.28
Why: This driver still uses the old interface and has been replaced
by CONFIG_SERIAL_MCF.
Who: Sebastian Siewior <sebastian@breakpoint.cc>

---------------------------

What: /sys/o2cb symlink
When: January 2010
Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb
Expand Down
3 changes: 1 addition & 2 deletions trunk/Documentation/hwmon/adt7473
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ point2: Set the pwm speed at a higher temperature bound.

The ADT7473 will scale the pwm between the lower and higher pwm speed when
the temperature is between the two temperature boundaries. PWM values range
from 0 (off) to 255 (full speed). Fan speed will be set to maximum when the
temperature sensor associated with the PWM control exceeds temp#_max.
from 0 (off) to 255 (full speed).

Notes
-----
Expand Down
95 changes: 43 additions & 52 deletions trunk/Documentation/i2c/functionality
Original file line number Diff line number Diff line change
Expand Up @@ -51,72 +51,63 @@ A few combinations of the above flags are also defined for your convenience:
the transparent emulation layer)


ADAPTER IMPLEMENTATION
----------------------
ALGORITHM/ADAPTER IMPLEMENTATION
--------------------------------

When you write a new adapter driver, you will have to implement a
function callback `functionality'. Typical implementations are given
below.
When you write a new algorithm driver, you will have to implement a
function callback `functionality', that gets an i2c_adapter structure
pointer as its only parameter:

A typical SMBus-only adapter would list all the SMBus transactions it
supports. This example comes from the i2c-piix4 driver:

static u32 piix4_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA;
struct i2c_algorithm {
/* Many other things of course; check <linux/i2c.h>! */
u32 (*functionality) (struct i2c_adapter *);
}

A typical full-I2C adapter would use the following (from the i2c-pxa
driver):
A typically implementation is given below, from i2c-algo-bit.c:

static u32 i2c_pxa_functionality(struct i2c_adapter *adap)
static u32 bit_func(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR |
I2C_FUNC_PROTOCOL_MANGLING;
}

I2C_FUNC_SMBUS_EMUL includes all the SMBus transactions (with the
addition of I2C block transactions) which i2c-core can emulate using
I2C_FUNC_I2C without any help from the adapter driver. The idea is
to let the client drivers check for the support of SMBus functions
without having to care whether the said functions are implemented in
hardware by the adapter, or emulated in software by i2c-core on top
of an I2C adapter.


CLIENT CHECKING
---------------

Before a client tries to attach to an adapter, or even do tests to check
whether one of the devices it supports is present on an adapter, it should
check whether the needed functionality is present. The typical way to do
this is (from the lm75 driver):
check whether the needed functionality is present. There are two functions
defined which should be used instead of calling the functionality hook
in the algorithm structure directly:

/* Return the functionality mask */
extern u32 i2c_get_functionality (struct i2c_adapter *adap);

/* Return 1 if adapter supports everything we need, 0 if not. */
extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);

static int lm75_detect(...)
This is a typical way to use these functions (from the writing-clients
document):
int foo_detect_client(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind)
{
(...)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA))
goto exit;
(...)
}
/* Define needed variables */

/* As the very first action, we check whether the adapter has the
needed functionality: we need the SMBus read_word_data,
write_word_data and write_byte functions in this example. */
if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_WRITE_BYTE))
goto ERROR0;

Here, the lm75 driver checks if the adapter can do both SMBus byte data
and SMBus word data transactions. If not, then the driver won't work on
this adapter and there's no point in going on. If the check above is
successful, then the driver knows that it can call the following
functions: i2c_smbus_read_byte_data(), i2c_smbus_write_byte_data(),
i2c_smbus_read_word_data() and i2c_smbus_write_word_data(). As a rule of
thumb, the functionality constants you test for with
i2c_check_functionality() should match exactly the i2c_smbus_* functions
which you driver is calling.
/* Now we can do the real detection */

ERROR0:
/* Return an error */
}

Note that the check above doesn't tell whether the functionalities are
implemented in hardware by the underlying adapter or emulated in
software by i2c-core. Client drivers don't have to care about this, as
i2c-core will transparently implement SMBus transactions on top of I2C
adapters.


CHECKING THROUGH /DEV
Expand All @@ -125,19 +116,19 @@ CHECKING THROUGH /DEV
If you try to access an adapter from a userspace program, you will have
to use the /dev interface. You will still have to check whether the
functionality you need is supported, of course. This is done using
the I2C_FUNCS ioctl. An example, adapted from the i2cdetect program, is
below:
the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2cdetect
program, is below:

int file;
if (file = open("/dev/i2c-0", O_RDWR) < 0) {
if (file = open("/dev/i2c-0",O_RDWR) < 0) {
/* Some kind of error handling */
exit(1);
}
if (ioctl(file, I2C_FUNCS, &funcs) < 0) {
if (ioctl(file,I2C_FUNCS,&funcs) < 0) {
/* Some kind of error handling */
exit(1);
}
if (!(funcs & I2C_FUNC_SMBUS_QUICK)) {
if (! (funcs & I2C_FUNC_SMBUS_QUICK)) {
/* Oops, the needed functionality (SMBus write_quick function) is
not available! */
exit(1);
Expand Down
81 changes: 35 additions & 46 deletions trunk/Documentation/i2c/smbus-protocol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SMBus Protocol Summary
======================

The following is a summary of the SMBus protocol. It applies to
all revisions of the protocol (1.0, 1.1, and 2.0).
Certain protocol features which are not supported by
Expand All @@ -9,20 +8,14 @@ this package are briefly described at the end of this document.
Some adapters understand only the SMBus (System Management Bus) protocol,
which is a subset from the I2C protocol. Fortunately, many devices use
only the same subset, which makes it possible to put them on an SMBus.

If you write a driver for some I2C device, please try to use the SMBus
commands if at all possible (if the device uses only that subset of the
I2C protocol). This makes it possible to use the device driver on both
SMBus adapters and I2C adapters (the SMBus command set is automatically
translated to I2C on I2C adapters, but plain I2C commands can not be
handled at all on most pure SMBus adapters).

Below is a list of SMBus protocol operations, and the functions executing
them. Note that the names used in the SMBus protocol specifications usually
don't match these function names. For some of the operations which pass a
single data byte, the functions using SMBus protocol operation names execute
a different protocol operation entirely.

Below is a list of SMBus commands.

Key to symbols
==============
Expand All @@ -42,16 +35,17 @@ Count (8 bits): A data byte containing the length of a block operation.
[..]: Data sent by I2C device, as opposed to data sent by the host adapter.


SMBus Quick Command: i2c_smbus_write_quick()
=============================================
SMBus Write Quick
=================

This sends a single bit to the device, at the place of the Rd/Wr bit.
There is no equivalent Read Quick command.

A Addr Rd/Wr [A] P


SMBus Receive Byte: i2c_smbus_read_byte()
==========================================
SMBus Read Byte
===============

This reads a single byte from a device, without specifying a device
register. Some devices are so simple that this interface is enough; for
Expand All @@ -61,48 +55,48 @@ the previous SMBus command.
S Addr Rd [A] [Data] NA P


SMBus Send Byte: i2c_smbus_write_byte()
========================================
SMBus Write Byte
================

This operation is the reverse of Receive Byte: it sends a single byte
to a device. See Receive Byte for more information.
This is the reverse of Read Byte: it sends a single byte to a device.
See Read Byte for more information.

S Addr Wr [A] Data [A] P


SMBus Read Byte: i2c_smbus_read_byte_data()
============================================
SMBus Read Byte Data
====================

This reads a single byte from a device, from a designated register.
The register is specified through the Comm byte.

S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P


SMBus Read Word: i2c_smbus_read_word_data()
============================================
SMBus Read Word Data
====================

This operation is very like Read Byte; again, data is read from a
This command is very like Read Byte Data; again, data is read from a
device, from a designated register that is specified through the Comm
byte. But this time, the data is a complete word (16 bits).

S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P


SMBus Write Byte: i2c_smbus_write_byte_data()
==============================================
SMBus Write Byte Data
=====================

This writes a single byte to a device, to a designated register. The
register is specified through the Comm byte. This is the opposite of
the Read Byte operation.
the Read Byte Data command.

S Addr Wr [A] Comm [A] Data [A] P


SMBus Write Word: i2c_smbus_write_word_data()
==============================================
SMBus Write Word Data
=====================

This is the opposite of the Read Word operation. 16 bits
This is the opposite operation of the Read Word Data command. 16 bits
of data is written to a device, to the designated register that is
specified through the Comm byte.

Expand All @@ -119,8 +113,8 @@ S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
S Addr Rd [A] [DataLow] A [DataHigh] NA P


SMBus Block Read: i2c_smbus_read_block_data()
==============================================
SMBus Block Read
================

This command reads a block of up to 32 bytes from a device, from a
designated register that is specified through the Comm byte. The amount
Expand All @@ -130,8 +124,8 @@ S Addr Wr [A] Comm [A]
S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P


SMBus Block Write: i2c_smbus_write_block_data()
================================================
SMBus Block Write
=================

The opposite of the Block Read command, this writes up to 32 bytes to
a device, to a designated register that is specified through the
Expand All @@ -140,11 +134,10 @@ Comm byte. The amount of data is specified in the Count byte.
S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P


SMBus Block Write - Block Read Process Call
===========================================
SMBus Block Process Call
========================

SMBus Block Write - Block Read Process Call was introduced in
Revision 2.0 of the specification.
SMBus Block Process Call was introduced in Revision 2.0 of the specification.

This command selects a device register (through the Comm byte), sends
1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return.
Expand All @@ -166,16 +159,13 @@ alerting device's address.

Packet Error Checking (PEC)
===========================

Packet Error Checking was introduced in Revision 1.1 of the specification.

PEC adds a CRC-8 error-checking byte to transfers using it, immediately
before the terminating STOP.
PEC adds a CRC-8 error-checking byte to all transfers.


Address Resolution Protocol (ARP)
=================================

The Address Resolution Protocol was introduced in Revision 2.0 of
the specification. It is a higher-layer protocol which uses the
messages above.
Expand All @@ -187,17 +177,14 @@ require PEC checksums.

I2C Block Transactions
======================

The following I2C block transactions are supported by the
SMBus layer and are described here for completeness.
They are *NOT* defined by the SMBus specification.

I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.


I2C Block Read: i2c_smbus_read_i2c_block_data()
================================================
I2C Block Read
==============

This command reads a block of bytes from a device, from a
designated register that is specified through the Comm byte.
Expand All @@ -216,12 +203,14 @@ S Addr Wr [A] Comm1 [A] Comm2 [A]
S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P


I2C Block Write: i2c_smbus_write_i2c_block_data()
==================================================
I2C Block Write
===============

The opposite of the Block Read command, this writes bytes to
a device, to a designated register that is specified through the
Comm byte. Note that command lengths of 0, 2, or more bytes are
supported as they are indistinguishable from data.

S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P


Loading

0 comments on commit a6f9de7

Please sign in to comment.