| 1 | /* ------------------------------------------------------------------------- */ |
|---|
| 2 | /* */ |
|---|
| 3 | /* i2c.h - definitions for the i2c-bus interface */ |
|---|
| 4 | /* */ |
|---|
| 5 | /* ------------------------------------------------------------------------- */ |
|---|
| 6 | /* Copyright (C) 1995-1999 Simon G. Vogl |
|---|
| 7 | |
|---|
| 8 | This program is free software; you can redistribute it and/or modify |
|---|
| 9 | it under the terms of the GNU General Public License as published by |
|---|
| 10 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | (at your option) any later version. |
|---|
| 12 | |
|---|
| 13 | This program is distributed in the hope that it will be useful, |
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | GNU General Public License for more details. |
|---|
| 17 | |
|---|
| 18 | You should have received a copy of the GNU General Public License |
|---|
| 19 | along with this program; if not, write to the Free Software |
|---|
| 20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
|---|
| 21 | /* ------------------------------------------------------------------------- */ |
|---|
| 22 | /* $Revision$ $Date$*/ |
|---|
| 23 | /* ------------------------------------------------------------------------- */ |
|---|
| 24 | |
|---|
| 25 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and |
|---|
| 26 | Frodo Looijaard <frodol@dds.nl> */ |
|---|
| 27 | |
|---|
| 28 | #ifndef I2C_H |
|---|
| 29 | #define I2C_H |
|---|
| 30 | |
|---|
| 31 | #ifdef __KERNEL__ |
|---|
| 32 | |
|---|
| 33 | #include <asm/page.h> /* for 2.2.xx */ |
|---|
| 34 | #if LINUX_VERSION_CODE < 0x020019 |
|---|
| 35 | #include <linux/sched.h> |
|---|
| 36 | #else |
|---|
| 37 | #include <asm/semaphore.h> |
|---|
| 38 | #endif |
|---|
| 39 | |
|---|
| 40 | /* --- General options ------------------------------------------------ */ |
|---|
| 41 | |
|---|
| 42 | #define I2C_ALGO_MAX 4 /* control memory consumption */ |
|---|
| 43 | #define I2C_ADAP_MAX 16 |
|---|
| 44 | #define I2C_DRIVER_MAX 16 |
|---|
| 45 | #define I2C_CLIENT_MAX 32 |
|---|
| 46 | |
|---|
| 47 | struct i2c_msg; |
|---|
| 48 | struct i2c_algorithm; |
|---|
| 49 | struct i2c_adapter; |
|---|
| 50 | struct i2c_client; |
|---|
| 51 | struct i2c_driver; |
|---|
| 52 | union i2c_smbus_data; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | /* |
|---|
| 56 | * The master routines are the ones normally used to transmit data to devices |
|---|
| 57 | * on a bus (or read from them). Apart from two basic transfer functions to |
|---|
| 58 | * transmit one message at a time, a more complex version can be used to |
|---|
| 59 | * transmit an arbitrary number of messages without interruption. |
|---|
| 60 | */ |
|---|
| 61 | extern int i2c_master_send(struct i2c_client *,const char* ,int); |
|---|
| 62 | extern int i2c_master_recv(struct i2c_client *,char* ,int); |
|---|
| 63 | |
|---|
| 64 | /* Transfer num messages. |
|---|
| 65 | */ |
|---|
| 66 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num); |
|---|
| 67 | |
|---|
| 68 | /* Two convenience functions: send bytes to/recv from a chip with |
|---|
| 69 | * sending one byte of data first, normally a register address. |
|---|
| 70 | */ |
|---|
| 71 | extern int i2c_master_send_subadress(struct i2c_client *client, |
|---|
| 72 | const char *buf ,int count, int subadress); |
|---|
| 73 | extern int i2c_master_recv_subadress(struct i2c_client *client,const char *buf, |
|---|
| 74 | int count, int subadress); |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | /* |
|---|
| 78 | * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor. |
|---|
| 79 | * This is not tested/implemented yet and will change in the future. |
|---|
| 80 | */ |
|---|
| 81 | extern int i2c_slave_send(struct i2c_client *,char*,int); |
|---|
| 82 | extern int i2c_slave_recv(struct i2c_client *,char*,int); |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | /* |
|---|
| 86 | * I2C Message - could be used in the current interface to |
|---|
| 87 | */ |
|---|
| 88 | struct i2c_msg { |
|---|
| 89 | unsigned char addr; /* slave address */ |
|---|
| 90 | unsigned short flags; |
|---|
| 91 | #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ |
|---|
| 92 | #define I2C_M_TEN0 0x10 /* herein lie the first 2 bits */ |
|---|
| 93 | #define I2C_M_TEN1 0x12 |
|---|
| 94 | #define I2C_M_TEN2 0x14 |
|---|
| 95 | #define I2C_M_TEN3 0x16 |
|---|
| 96 | #define I2C_M_TENMASK 0x06 |
|---|
| 97 | #define I2C_M_RD 0x01 |
|---|
| 98 | short len; /* msg length */ |
|---|
| 99 | char *buf; /* pointer to msg data */ |
|---|
| 100 | }; |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | /* This is the very generalized SMBus access routine. You probably do not |
|---|
| 104 | want to use this, though; one of the functions below may be much easier, |
|---|
| 105 | and probably just as fast. |
|---|
| 106 | Note that we use i2c_adapter here, because you do not need a specific |
|---|
| 107 | smbus adapter to call this function. */ |
|---|
| 108 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u8 addr, |
|---|
| 109 | char read_write, u8 command, int size, |
|---|
| 110 | union i2c_smbus_data * data); |
|---|
| 111 | |
|---|
| 112 | /* Now follow the 'nice' access routines. These also document the calling |
|---|
| 113 | conventions of smbus_access. */ |
|---|
| 114 | |
|---|
| 115 | extern s32 i2c_smbus_write_quick(struct i2c_adapter * adapter, u8 addr, |
|---|
| 116 | u8 value); |
|---|
| 117 | extern s32 i2c_smbus_read_byte(struct i2c_adapter * adapter,u8 addr); |
|---|
| 118 | extern s32 i2c_smbus_write_byte(struct i2c_adapter * adapter, u8 addr, |
|---|
| 119 | u8 value); |
|---|
| 120 | extern s32 i2c_smbus_read_byte_data(struct i2c_adapter * adapter, |
|---|
| 121 | u8 addr, u8 command); |
|---|
| 122 | extern s32 i2c_smbus_write_byte_data(struct i2c_adapter * adapter, |
|---|
| 123 | u8 addr, u8 command, u8 value); |
|---|
| 124 | extern s32 i2c_smbus_read_word_data(struct i2c_adapter * adapter, |
|---|
| 125 | u8 addr, u8 command); |
|---|
| 126 | extern s32 i2c_smbus_write_word_data(struct i2c_adapter * adapter, |
|---|
| 127 | u8 addr, u8 command, u16 value); |
|---|
| 128 | extern s32 i2c_smbus_process_call(struct i2c_adapter * adapter, |
|---|
| 129 | u8 addr, u8 command, u16 value); |
|---|
| 130 | /* Returns the number of read bytes */ |
|---|
| 131 | extern s32 i2c_smbus_read_block_data(struct i2c_adapter * adapter, |
|---|
| 132 | u8 addr, u8 command, u8 *values); |
|---|
| 133 | extern s32 i2c_smbus_write_block_data(struct i2c_adapter * adapter, |
|---|
| 134 | u8 addr, u8 command, u8 length, |
|---|
| 135 | u8 *values); |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | /* |
|---|
| 139 | * A driver is capable of handling one or more physical devices present on |
|---|
| 140 | * I2C adapters. This information is used to inform the driver of adapter |
|---|
| 141 | * events. |
|---|
| 142 | */ |
|---|
| 143 | |
|---|
| 144 | struct i2c_driver { |
|---|
| 145 | char name[32]; |
|---|
| 146 | int id; |
|---|
| 147 | unsigned int flags; /* div., see below */ |
|---|
| 148 | |
|---|
| 149 | /* Notifies the driver that a new bus has appeared. This routine |
|---|
| 150 | * can be used by the driver to test if the bus meets its conditions |
|---|
| 151 | * & seek for the presence of the chip(s) it supports. If found, it |
|---|
| 152 | * registers the client(s) that are on the bus to the i2c admin. via |
|---|
| 153 | * i2c_attach_client. |
|---|
| 154 | */ |
|---|
| 155 | int (*attach_adapter)(struct i2c_adapter *); |
|---|
| 156 | |
|---|
| 157 | /* tells the driver that a client is about to be deleted & gives it |
|---|
| 158 | * the chance to remove its private data. Also, if the client struct |
|---|
| 159 | * has been dynamically allocated by the driver in the function above, |
|---|
| 160 | * it must be freed here. |
|---|
| 161 | */ |
|---|
| 162 | int (*detach_client)(struct i2c_client *); |
|---|
| 163 | |
|---|
| 164 | /* a ioctl like command that can be used to perform specific functions |
|---|
| 165 | * with the device. |
|---|
| 166 | */ |
|---|
| 167 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); |
|---|
| 168 | |
|---|
| 169 | /* These two are mainly used for bookkeeping & dynamic unloading of |
|---|
| 170 | * kernel modules. inc_use tells the driver that a client is being |
|---|
| 171 | * used by another module & that it should increase its ref. counter. |
|---|
| 172 | * dec_use is the inverse operation. |
|---|
| 173 | * NB: Make sure you have no circular dependencies, or else you get a |
|---|
| 174 | * deadlock when trying to unload the modules. |
|---|
| 175 | * You should use the i2c_{inc,dec}_use_client functions instead of |
|---|
| 176 | * calling this function directly. |
|---|
| 177 | */ |
|---|
| 178 | void (*inc_use)(struct i2c_client *client); |
|---|
| 179 | void (*dec_use)(struct i2c_client *client); |
|---|
| 180 | }; |
|---|
| 181 | |
|---|
| 182 | /* |
|---|
| 183 | * i2c_client identifies a single device (i.e. chip) that is connected to an |
|---|
| 184 | * i2c bus. The behaviour is defined by the routines of the driver. This |
|---|
| 185 | * function is mainly used for lookup & other admin. functions. |
|---|
| 186 | */ |
|---|
| 187 | struct i2c_client { |
|---|
| 188 | char name[32]; |
|---|
| 189 | int id; |
|---|
| 190 | unsigned int flags; /* div., see below */ |
|---|
| 191 | unsigned char addr; /* chip address - NOTE: 7bit */ |
|---|
| 192 | /* addresses are stored in the */ |
|---|
| 193 | /* _LOWER_ 7 bits of this char */ |
|---|
| 194 | /* 10 bit addresses use the full*/ |
|---|
| 195 | /* 8 bits & the flags like in */ |
|---|
| 196 | /* i2c_msg */ |
|---|
| 197 | struct i2c_adapter *adapter; /* the adapter we sit on */ |
|---|
| 198 | struct i2c_driver *driver; /* and our access routines */ |
|---|
| 199 | void *data; /* for the clients */ |
|---|
| 200 | }; |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | /* |
|---|
| 204 | * The following structs are for those who like to implement new bus drivers: |
|---|
| 205 | * i2c_algorithm is the interface to a class of hardware solutions which can |
|---|
| 206 | * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584 |
|---|
| 207 | * to name two of the most common. |
|---|
| 208 | */ |
|---|
| 209 | struct i2c_algorithm { |
|---|
| 210 | char name[32]; /* textual description */ |
|---|
| 211 | unsigned int id; |
|---|
| 212 | |
|---|
| 213 | /* If a adapter algorithm can't to I2C-level access, set master_xfer |
|---|
| 214 | to NULL. If an adapter algorithm can do SMBus access, set |
|---|
| 215 | smbus_xfer. If set to NULL, the SMBus protocol is simulated |
|---|
| 216 | using common I2C messages */ |
|---|
| 217 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], |
|---|
| 218 | int num); |
|---|
| 219 | int (*smbus_xfer) (struct i2c_adapter *adap, u8 addr, char read_write, |
|---|
| 220 | u8 command, int size, union i2c_smbus_data * data); |
|---|
| 221 | |
|---|
| 222 | /* --- these optional/future use for some adapter types.*/ |
|---|
| 223 | int (*slave_send)(struct i2c_adapter *,char*,int); |
|---|
| 224 | int (*slave_recv)(struct i2c_adapter *,char*,int); |
|---|
| 225 | |
|---|
| 226 | /* --- ioctl like call to set div. parameters. */ |
|---|
| 227 | int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); |
|---|
| 228 | |
|---|
| 229 | }; |
|---|
| 230 | |
|---|
| 231 | #if LINUX_VERSION_CODE < 0x02011d |
|---|
| 232 | struct proc_dir_entry; |
|---|
| 233 | #endif |
|---|
| 234 | |
|---|
| 235 | /* |
|---|
| 236 | * i2c_adapter is the structure used to identify a physical i2c bus along |
|---|
| 237 | * with the access algorithms necessary to access it. |
|---|
| 238 | */ |
|---|
| 239 | struct i2c_adapter { |
|---|
| 240 | char name[32]; /* some useful name to identify the adapter */ |
|---|
| 241 | unsigned int id;/* == is algo->id | hwdep.struct->id, */ |
|---|
| 242 | /* for registered values see below */ |
|---|
| 243 | struct i2c_algorithm *algo;/* the algorithm to access the bus */ |
|---|
| 244 | void *algo_data; |
|---|
| 245 | |
|---|
| 246 | /* --- These may be NULL, but should increase the module use count */ |
|---|
| 247 | void (*inc_use)(struct i2c_adapter *); |
|---|
| 248 | void (*dec_use)(struct i2c_adapter *); |
|---|
| 249 | |
|---|
| 250 | /* --- administration stuff. */ |
|---|
| 251 | int (*client_register)(struct i2c_client *); |
|---|
| 252 | int (*client_unregister)(struct i2c_client *); |
|---|
| 253 | |
|---|
| 254 | void *data; /* private data for the adapter */ |
|---|
| 255 | /* some data fields that are used by all types */ |
|---|
| 256 | /* these data fields are readonly to the public */ |
|---|
| 257 | /* and can be set via the i2c_ioctl call */ |
|---|
| 258 | |
|---|
| 259 | /* data fields that are valid for all devices */ |
|---|
| 260 | struct semaphore lock; |
|---|
| 261 | unsigned int flags;/* flags specifying div. data */ |
|---|
| 262 | |
|---|
| 263 | struct i2c_client *clients[I2C_CLIENT_MAX]; |
|---|
| 264 | int client_count; |
|---|
| 265 | |
|---|
| 266 | int timeout; |
|---|
| 267 | int retries; |
|---|
| 268 | |
|---|
| 269 | /* No need to set this when you initialize the adapter */ |
|---|
| 270 | int inode; |
|---|
| 271 | #if LINUX_VERSION_CODE < 0x02011d |
|---|
| 272 | struct proc_dir_entry *proc_entry; |
|---|
| 273 | #endif |
|---|
| 274 | }; |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | /*flags for the driver struct: */ |
|---|
| 278 | #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ |
|---|
| 279 | |
|---|
| 280 | /* ----- functions exported by i2c.o */ |
|---|
| 281 | |
|---|
| 282 | /* administration... |
|---|
| 283 | */ |
|---|
| 284 | extern int i2c_add_algorithm(struct i2c_algorithm *); |
|---|
| 285 | extern int i2c_del_algorithm(struct i2c_algorithm *); |
|---|
| 286 | |
|---|
| 287 | extern int i2c_add_adapter(struct i2c_adapter *); |
|---|
| 288 | extern int i2c_del_adapter(struct i2c_adapter *); |
|---|
| 289 | |
|---|
| 290 | extern int i2c_add_driver(struct i2c_driver *); |
|---|
| 291 | extern int i2c_del_driver(struct i2c_driver *); |
|---|
| 292 | |
|---|
| 293 | extern int i2c_attach_client(struct i2c_client *); |
|---|
| 294 | extern int i2c_detach_client(struct i2c_client *); |
|---|
| 295 | |
|---|
| 296 | /* Only call these if you grab a resource that makes unloading the |
|---|
| 297 | client and the adapter it is on completely impossible. Like when a |
|---|
| 298 | /proc directory is entered. */ |
|---|
| 299 | extern void i2c_inc_use_client(struct i2c_client *); |
|---|
| 300 | extern void i2c_dec_use_client(struct i2c_client *); |
|---|
| 301 | |
|---|
| 302 | |
|---|
| 303 | /* |
|---|
| 304 | * A utility function used in the attach-phase of drivers. Returns at the |
|---|
| 305 | * first address that acks in the given range. |
|---|
| 306 | */ |
|---|
| 307 | extern int i2c_probe(struct i2c_client *client, int low_addr, int hi_addr); |
|---|
| 308 | |
|---|
| 309 | /* An ioctl like call to set div. parameters of the adapter. |
|---|
| 310 | */ |
|---|
| 311 | extern int i2c_control(struct i2c_client *,unsigned int, unsigned long); |
|---|
| 312 | |
|---|
| 313 | /* This call returns a unique low identifier for each registered adapter, |
|---|
| 314 | * or -1 if the adapter was not regisitered. |
|---|
| 315 | */ |
|---|
| 316 | extern int i2c_adapter_id(struct i2c_adapter *adap); |
|---|
| 317 | |
|---|
| 318 | #endif /* __KERNEL__ */ |
|---|
| 319 | |
|---|
| 320 | /* |
|---|
| 321 | * Data for SMBus Messages |
|---|
| 322 | */ |
|---|
| 323 | union i2c_smbus_data { |
|---|
| 324 | __u8 byte; |
|---|
| 325 | __u16 word; |
|---|
| 326 | __u8 block[33]; /* block[0] is used for length */ |
|---|
| 327 | }; |
|---|
| 328 | |
|---|
| 329 | /* smbus_access read or write markers */ |
|---|
| 330 | #define I2C_SMBUS_READ 1 |
|---|
| 331 | #define I2C_SMBUS_WRITE 0 |
|---|
| 332 | |
|---|
| 333 | /* SMBus transaction types (size parameter in the above functions) |
|---|
| 334 | Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ |
|---|
| 335 | #define I2C_SMBUS_QUICK 0 |
|---|
| 336 | #define I2C_SMBUS_BYTE 1 |
|---|
| 337 | #define I2C_SMBUS_BYTE_DATA 2 |
|---|
| 338 | #define I2C_SMBUS_WORD_DATA 3 |
|---|
| 339 | #define I2C_SMBUS_PROC_CALL 4 |
|---|
| 340 | #define I2C_SMBUS_BLOCK_DATA 5 |
|---|
| 341 | |
|---|
| 342 | |
|---|
| 343 | /* ----- commands for the ioctl like i2c_command call: |
|---|
| 344 | * note that additional calls are defined in the algorithm and hw |
|---|
| 345 | * dependent layers - these can be listed here, or see the |
|---|
| 346 | * corresponding header files. |
|---|
| 347 | */ |
|---|
| 348 | /* -> bit-adapter specific ioctls */ |
|---|
| 349 | #define I2C_RETRIES 0x0701 /* number times a device adress should */ |
|---|
| 350 | /* be polled when not acknowledging */ |
|---|
| 351 | #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | /* this is for i2c-dev.c */ |
|---|
| 355 | #define I2C_SLAVE 0x0703 /* Change slave address */ |
|---|
| 356 | /* Attn.: Slave address is 7 bits long, */ |
|---|
| 357 | /* these are to be passed as the */ |
|---|
| 358 | /* lowest 7 bits in the arg. */ |
|---|
| 359 | /* for 10-bit addresses pass lower 8bits*/ |
|---|
| 360 | #define I2C_TENBIT 0x0704 /* with 0-3 as arg to this call */ |
|---|
| 361 | /* a value <0 resets to 7 bits */ |
|---|
| 362 | |
|---|
| 363 | #define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific adress */ |
|---|
| 364 | |
|---|
| 365 | #define I2C_SMBUS 0x0720 /* SMBus-level access */ |
|---|
| 366 | |
|---|
| 367 | /* ... algo-bit.c recognizes */ |
|---|
| 368 | #define I2C_UDELAY 0x0705 /* set delay in microsecs between each */ |
|---|
| 369 | /* written byte (except address) */ |
|---|
| 370 | #define I2C_MDELAY 0x0706 /* millisec delay between written bytes */ |
|---|
| 371 | |
|---|
| 372 | |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | /* |
|---|
| 378 | * ---- Driver types ----------------------------------------------------- |
|---|
| 379 | * device id name + number function description, i2c address(es) |
|---|
| 380 | */ |
|---|
| 381 | |
|---|
| 382 | #define I2C_DRIVERID_MSP3400 1 |
|---|
| 383 | #define I2C_DRIVERID_TUNER 2 |
|---|
| 384 | #define I2C_DRIVERID_VIDEOTEXT 3 |
|---|
| 385 | #define I2C_DRIVERID_GL518SM 4 /* hardware monitor cpu temp. */ |
|---|
| 386 | #define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ |
|---|
| 387 | #define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ |
|---|
| 388 | #define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ |
|---|
| 389 | #define I2C_DRIVERID_SAA7111A 8 /* video input processor */ |
|---|
| 390 | #define I2C_DRIVERID_SAA5281 9 /* videotext decoder */ |
|---|
| 391 | #define I2C_DRIVERID_SAA7112 10 /* video decoder, image scaler */ |
|---|
| 392 | #define I2C_DRIVERID_SAA7120 11 /* video encoder */ |
|---|
| 393 | #define I2C_DRIVERID_SAA7121 12 /* video encoder */ |
|---|
| 394 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ |
|---|
| 395 | #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ |
|---|
| 396 | #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ |
|---|
| 397 | #define I2C_DRIVERID_PCF8582C 16 /* eeprom */ |
|---|
| 398 | #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ |
|---|
| 399 | |
|---|
| 400 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ |
|---|
| 401 | #define I2C_DRIVERID_EXP1 0xF1 |
|---|
| 402 | #define I2C_DRIVERID_EXP2 0xF2 |
|---|
| 403 | #define I2C_DRIVERID_EXP3 0xF3 |
|---|
| 404 | |
|---|
| 405 | /* the 1000-1999 range is used by |
|---|
| 406 | the lm_sensor developers */ |
|---|
| 407 | #define I2C_DRIVERID_I2CDEV 1000 |
|---|
| 408 | #define I2C_DRIVERID_I2CPROC 1001 |
|---|
| 409 | #define I2C_DRIVERID_LM78 1002 |
|---|
| 410 | #define I2C_DRIVERID_LM75 1003 |
|---|
| 411 | #define I2C_DRIVERID_GL518 1004 |
|---|
| 412 | #define I2C_DRIVERID_EEPROM 1005 |
|---|
| 413 | #define I2C_DRIVERID_W83781D 1006 |
|---|
| 414 | #define I2C_DRIVERID_LM80 1007 |
|---|
| 415 | #define I2C_DRIVERID_ADM1021 1008 |
|---|
| 416 | #define I2C_DRIVERID_ADM9240 1009 |
|---|
| 417 | #define I2C_DRIVERID_LTC1710 1010 |
|---|
| 418 | #define I2C_DRIVERID_BT848 1200 |
|---|
| 419 | |
|---|
| 420 | /* |
|---|
| 421 | * ---- Adapter types ---------------------------------------------------- |
|---|
| 422 | * |
|---|
| 423 | * First, we distinguish between several algorithms to access the hardware |
|---|
| 424 | * interface types, as a PCF 8584 needs other care than a bit adapter. |
|---|
| 425 | */ |
|---|
| 426 | |
|---|
| 427 | #define I2C_ALGO_NONE 0x000000 |
|---|
| 428 | #define I2C_ALGO_BIT 0x010000 /* bit style adapters */ |
|---|
| 429 | #define I2C_ALGO_PCF 0x020000 /* PCF 8584 style adapters */ |
|---|
| 430 | #define I2C_ALGO_SMBUS 0x040000 |
|---|
| 431 | #define I2C_ALGO_ISA 0x050000 |
|---|
| 432 | #define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */ |
|---|
| 433 | #define I2C_ALGO_SAA7146A 0x060001 /* SAA 7146A - enhanced version */ |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | #define I2C_ALGO_EXP 0x800000 /* experimental */ |
|---|
| 437 | |
|---|
| 438 | #define I2C_ALGO_MASK 0xff0000 /* Mask for algorithms */ |
|---|
| 439 | #define I2C_ALGO_SHIFT 0x10 /* right shift to get index values */ |
|---|
| 440 | |
|---|
| 441 | #define I2C_HW_ADAPS 0x10000 /* # adapter types */ |
|---|
| 442 | #define I2C_HW_MASK 0xffff |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | /* hw specific modules that are defined per algorithm layer |
|---|
| 446 | */ |
|---|
| 447 | |
|---|
| 448 | /* --- Bit algorithm adapters */ |
|---|
| 449 | #define I2C_HW_B_LP 0x00 /* Parallel port Philips style adapter */ |
|---|
| 450 | #define I2C_HW_B_LPC 0x01 /* Parallel port, over control reg. */ |
|---|
| 451 | #define I2C_HW_B_SER 0x02 /* Serial line interface */ |
|---|
| 452 | #define I2C_HW_B_ELV 0x03 /* ELV Card */ |
|---|
| 453 | #define I2C_HW_B_VELLE 0x04 /* Vellemann K8000 */ |
|---|
| 454 | #define I2C_HW_B_BT848 0x05 /* BT848 video boards */ |
|---|
| 455 | #define I2C_HW_B_WNV 0x06 /* Winnov Videums */ |
|---|
| 456 | #define I2C_HW_B_VIA 0x07 /* Via vt82c586b */ |
|---|
| 457 | #define I2C_HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */ |
|---|
| 458 | |
|---|
| 459 | /* --- PCF 8584 based algorithms */ |
|---|
| 460 | #define I2C_HW_P_LP 0x00 /* Parallel port interface */ |
|---|
| 461 | #define I2C_HW_P_ISA 0x01 /* generic ISA Bus inteface card */ |
|---|
| 462 | #define I2C_HW_P_ELEK 0x02 /* Elektor ISA Bus inteface card */ |
|---|
| 463 | |
|---|
| 464 | /* --- SMBus only adapters */ |
|---|
| 465 | #define I2C_HW_SMBUS_PIIX4 0x00 |
|---|
| 466 | #define I2C_HW_SMBUS_ALI15X3 0x01 |
|---|
| 467 | #define I2C_HW_SMBUS_VIA2 0x02 |
|---|
| 468 | #define I2C_HW_SMBUS_VOODOO3 0x03 |
|---|
| 469 | |
|---|
| 470 | /* ----- I2C-DEV: char device interface stuff ------------------------- */ |
|---|
| 471 | |
|---|
| 472 | #define I2C_MAJOR 89 /* Device major number */ |
|---|
| 473 | |
|---|
| 474 | |
|---|
| 475 | # if LINUX_VERSION_CODE < 0x020100 |
|---|
| 476 | /* Hack to make this thing compile under 2.0.xx kernels |
|---|
| 477 | */ |
|---|
| 478 | |
|---|
| 479 | # ifdef MODULE |
|---|
| 480 | # define MODULE_AUTHOR(noone) |
|---|
| 481 | # define MODULE_DESCRIPTION(none) |
|---|
| 482 | # define MODULE_PARM(no,param) |
|---|
| 483 | # define MODULE_PARM_DESC(no,description) |
|---|
| 484 | # define EXPORT_SYMBOL(noexport) |
|---|
| 485 | # define EXPORT_NO_SYMBOLS |
|---|
| 486 | # endif |
|---|
| 487 | |
|---|
| 488 | # ifndef NULL |
|---|
| 489 | # define NULL ( (void *) 0 ) |
|---|
| 490 | # endif |
|---|
| 491 | #endif |
|---|
| 492 | |
|---|
| 493 | # ifndef ENODEV |
|---|
| 494 | # include <asm/errno.h> |
|---|
| 495 | # endif |
|---|
| 496 | #endif /* I2C_H */ |
|---|