[i2c] i2c_master_recv() vs. i2c_smbus_read_byte_data()

Jean Delvare khali at linux-fr.org
Sat Aug 11 16:45:55 CEST 2007


Hi Timur,

On Fri, 27 Jul 2007 15:55:13 -0500, Timur Tabi wrote:
> Other than the fact that i2c_master_recv() can receive a block of data, and 
> i2c_smbus_read_byte_data() can only receive one byte, why would I use one function over 
> another?

Please read the introduction of Documentation/i2c/smbus-protocol. Using
the i2c_smbus_* functions make your driver work even when the chip is
connected to a SMBus controller (as most PC motherboards have). If
using i2c_master_* or i2c_transfer, then your driver will only work
on top of "real" I2C adapters. Depending on what driver you're writing,
it's up to you to decide whether the overhead is worth the
compatibility benefit or not.

-- 
Jean Delvare



More information about the i2c mailing list