1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __TCA642X_H_
24#define __TCA642X_H_
25
26#ifdef CONFIG_CMD_TCA642X
27enum {
28 TCA642X_CMD_INFO,
29 TCA642X_CMD_DEVICE,
30 TCA642X_CMD_OUTPUT,
31 TCA642X_CMD_INPUT,
32 TCA642X_CMD_INVERT,
33};
34#endif
35
36#define TCA642X_OUT_LOW 0
37#define TCA642X_OUT_HIGH 1
38#define TCA642X_POL_NORMAL 0
39#define TCA642X_POL_INVERT 1
40#define TCA642X_DIR_OUT 0
41#define TCA642X_DIR_IN 1
42
43
44#ifndef CFG_SYS_I2C_TCA642X_ADDR
45#define CFG_SYS_I2C_TCA642X_ADDR (~0)
46#endif
47
48
49#ifndef CFG_SYS_I2C_TCA642X_BUS_NUM
50#define CFG_SYS_I2C_TCA642X_BUS_NUM (0)
51#endif
52
53struct tca642x_bank_info {
54 uint8_t input_reg;
55 uint8_t output_reg;
56 uint8_t polarity_reg;
57 uint8_t configuration_reg;
58};
59
60int tca642x_set_val(uchar chip, uint8_t gpio_bank,
61 uint8_t reg_bit, uint8_t data);
62int tca642x_set_pol(uchar chip, uint8_t gpio_bank,
63 uint8_t reg_bit, uint8_t data);
64int tca642x_set_dir(uchar chip, uint8_t gpio_bank,
65 uint8_t reg_bit, uint8_t data);
66int tca642x_get_val(uchar chip, uint8_t gpio_bank);
67int tca642x_set_inital_state(uchar chip, struct tca642x_bank_info init_data[]);
68
69#endif
70