--- DirectFB-0.9.20/gfxdrivers/matrox/matrox_maven.c.orig 2003-07-08 14:44:19.000000000 +0000 +++ DirectFB-0.9.20/gfxdrivers/matrox/matrox_maven.c 2003-11-12 15:16:53.000000000 +0000 @@ -29,7 +29,61 @@ #include #include #include +/* i2c-dev.h is broken in i2c 2.8.[01] - must include first :/ + * but is included in , which is needed too + * ...and i2c.h is broken even (MUCH!) more, because it uses internal kernel types + * inside not #ifdef __KERNEL__-ed part!!! argh!!! */ +#include #include +#ifndef I2C_SLAVE +/* #include cannot be used with i2c 2.8.x - it's for internal + * kernel use; stuff below is copied from i2c.h and old i2c-dev.h */ +#define I2C_SLAVE 0x0703 /* Change slave address */ + /* Attn.: Slave address is 7 or 10 bits */ +/* + * Data for SMBus Messages + */ +#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ +union i2c_smbus_data { + __u8 byte; + __u16 word; + __u8 block[I2C_SMBUS_BLOCK_MAX + 3]; /* block[0] is used for length */ + /* one more for read length in block process call */ + /* and one more for PEC */ +}; +#define I2C_SMBUS 0x0720 /* SMBus-level access */ +static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, + int size, union i2c_smbus_data *data) +{ + struct i2c_smbus_ioctl_data args; + + args.read_write = read_write; + args.command = command; + args.size = size; + args.data = data; + return ioctl(file,I2C_SMBUS,&args); +} +/* smbus_access read or write markers */ +#define I2C_SMBUS_WRITE 0 +#define I2C_SMBUS_BYTE_DATA 2 +#define I2C_SMBUS_WORD_DATA 3 +static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, + __u8 value) +{ + union i2c_smbus_data data; + data.byte = value; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_BYTE_DATA, &data); +} +static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, + __u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_WORD_DATA, &data); +} +#endif #include #include