blob: adcb3dc7ac26dcb647aee61c9dd2f3f22ab91f6c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_I2C_ALGO_PCA_H
2#define _LINUX_I2C_ALGO_PCA_H
3
Wolfram Sangc01b0832008-04-22 22:16:46 +02004/* 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 Torvalds1da177e2005-04-16 15:20:36 -070028struct i2c_algo_pca_data {
Wolfram Sangc01b0832008-04-22 22:16:46 +020029 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 Torvalds1da177e2005-04-16 15:20:36 -070036};
37
Linus Torvalds1da177e2005-04-16 15:20:36 -070038int i2c_pca_add_bus(struct i2c_adapter *);
Wolfram Sangc01b0832008-04-22 22:16:46 +020039int i2c_pca_add_numbered_bus(struct i2c_adapter *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41#endif /* _LINUX_I2C_ALGO_PCA_H */