~ubuntu-branches/ubuntu/oneiric/lm-sensors/oneiric

« back to all changes in this revision

Viewing changes to kernel/include/i2c-dev.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-08-09 10:34:46 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070809103446-37pcunbx5dh4kqqy
Tags: 1:2.10.4-1ubuntu1
* Merge with Debian; remaining changes:
  - remove stop links from rc0 and rc6
  - lsb init script
  - don't ship modprobe directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
20
*/
21
21
 
22
 
/* $Id: i2c-dev.h 3177 2005-11-05 17:11:47Z khali $ */
 
22
/* $Id: i2c-dev.h 4417 2007-05-28 08:57:41Z khali $ */
23
23
 
24
24
#ifndef LIB_I2CDEV_H
25
25
#define LIB_I2CDEV_H
106
106
#define I2C_SMBUS_WORD_DATA         3
107
107
#define I2C_SMBUS_PROC_CALL         4
108
108
#define I2C_SMBUS_BLOCK_DATA        5
109
 
#define I2C_SMBUS_I2C_BLOCK_DATA    6
 
109
#define I2C_SMBUS_I2C_BLOCK_BROKEN  6
110
110
#define I2C_SMBUS_BLOCK_PROC_CALL   7           /* SMBus 2.0 */
 
111
#define I2C_SMBUS_I2C_BLOCK_DATA    8
111
112
 
112
113
 
113
114
/* ----- commands for the ioctl like i2c_command call:
271
272
}
272
273
 
273
274
/* Returns the number of read bytes */
 
275
/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you
 
276
   ask for less than 32 bytes, your code will only work with kernels
 
277
   2.6.23 and later. */
274
278
static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command,
275
 
                                                  __u8 *values)
 
279
                                                  __u8 length, __u8 *values)
276
280
{
277
281
        union i2c_smbus_data data;
278
282
        int i;
 
283
 
 
284
        if (length > 32)
 
285
                length = 32;
 
286
        data.block[0] = length;
279
287
        if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
 
288
                             length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN :
280
289
                              I2C_SMBUS_I2C_BLOCK_DATA,&data))
281
290
                return -1;
282
291
        else {
297
306
                data.block[i] = values[i-1];
298
307
        data.block[0] = length;
299
308
        return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
300
 
                                I2C_SMBUS_I2C_BLOCK_DATA, &data);
 
309
                                I2C_SMBUS_I2C_BLOCK_BROKEN, &data);
301
310
}
302
311
 
303
312
/* Returns the number of read bytes */