Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_I2C_ALGO_PCA_H |
| 2 | #define _LINUX_I2C_ALGO_PCA_H |
| 3 | |
Wolfram Sang | c01b083 | 2008-04-22 22:16:46 +0200 | [diff] [blame] | 4 | /* Clock speeds for the bus */ |
| 5 | #define I2C_PCA_CON_330kHz 0x00 |
| 6 | #define I2C_PCA_CON_288kHz 0x01 |
| 7 | #define I2C_PCA_CON_217kHz 0x02 |
| 8 | #define I2C_PCA_CON_146kHz 0x03 |
| 9 | #define I2C_PCA_CON_88kHz 0x04 |
| 10 | #define I2C_PCA_CON_59kHz 0x05 |
| 11 | #define I2C_PCA_CON_44kHz 0x06 |
| 12 | #define I2C_PCA_CON_36kHz 0x07 |
| 13 | |
| 14 | /* PCA9564 registers */ |
| 15 | #define I2C_PCA_STA 0x00 /* STATUS Read Only */ |
| 16 | #define I2C_PCA_TO 0x00 /* TIMEOUT Write Only */ |
| 17 | #define I2C_PCA_DAT 0x01 /* DATA Read/Write */ |
| 18 | #define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */ |
| 19 | #define I2C_PCA_CON 0x03 /* CONTROL Read/Write */ |
| 20 | |
| 21 | #define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */ |
| 22 | #define I2C_PCA_CON_ENSIO 0x40 /* Enable */ |
| 23 | #define I2C_PCA_CON_STA 0x20 /* Start */ |
| 24 | #define I2C_PCA_CON_STO 0x10 /* Stop */ |
| 25 | #define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */ |
| 26 | #define I2C_PCA_CON_CR 0x07 /* Clock Rate (MASK) */ |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | struct i2c_algo_pca_data { |
Wolfram Sang | c01b083 | 2008-04-22 22:16:46 +0200 | [diff] [blame] | 29 | void *data; /* private low level data */ |
| 30 | void (*write_byte) (void *data, int reg, int val); |
| 31 | int (*read_byte) (void *data, int reg); |
| 32 | int (*wait_for_completion) (void *data); |
| 33 | void (*reset_chip) (void *data); |
| 34 | /* i2c_clock values are defined in linux/i2c-algo-pca.h */ |
| 35 | unsigned int i2c_clock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | int i2c_pca_add_bus(struct i2c_adapter *); |
Wolfram Sang | c01b083 | 2008-04-22 22:16:46 +0200 | [diff] [blame] | 39 | int i2c_pca_add_numbered_bus(struct i2c_adapter *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | #endif /* _LINUX_I2C_ALGO_PCA_H */ |