Lines Matching refs:chip

47 static int tca642x_reg_write(uchar chip, uint8_t addr,  in tca642x_reg_write()  argument
57 if (i2c_read(chip, addr, 1, (uint8_t *)&valw, 1)) { in tca642x_reg_write()
65 ret = i2c_write(chip, addr, 1, (u8 *)&valw, 1); in tca642x_reg_write()
72 static int tca642x_reg_read(uchar chip, uint8_t addr, uint8_t *data) in tca642x_reg_read() argument
80 if (i2c_read(chip, addr, 1, (u8 *)&valw, 1)) { in tca642x_reg_read()
96 int tca642x_set_val(uchar chip, uint8_t gpio_bank, in tca642x_set_val() argument
101 return tca642x_reg_write(chip, out_reg, reg_bit, data); in tca642x_set_val()
108 int tca642x_set_pol(uchar chip, uint8_t gpio_bank, in tca642x_set_pol() argument
113 return tca642x_reg_write(chip, pol_reg, reg_bit, data); in tca642x_set_pol()
120 int tca642x_set_dir(uchar chip, uint8_t gpio_bank, in tca642x_set_dir() argument
125 return tca642x_reg_write(chip, config_reg, reg_bit, data); in tca642x_set_dir()
131 int tca642x_get_val(uchar chip, uint8_t gpio_bank) in tca642x_get_val() argument
136 if (tca642x_reg_read(chip, in_reg, &val) < 0) in tca642x_get_val()
145 int tca642x_set_inital_state(uchar chip, struct tca642x_bank_info init_data[]) in tca642x_set_inital_state() argument
154 ret = tca642x_reg_write(chip, config_reg, 0xff, in tca642x_set_inital_state()
157 ret = tca642x_reg_write(chip, polarity_reg, 0xff, in tca642x_set_inital_state()
160 ret = tca642x_reg_write(chip, output_reg, 0xff, in tca642x_set_inital_state()
171 static int tca642x_info(uchar chip) in tca642x_info() argument
176 printf("tca642x@ 0x%x (%d pins):\n", chip, 24); in tca642x_info()
179 if (tca642x_reg_read(chip, in tca642x_info()
188 if (tca642x_reg_read(chip, in tca642x_info()
196 if (tca642x_reg_read(chip, in tca642x_info()
204 if (tca642x_reg_read(chip, in tca642x_info()
245 static uchar chip = CONFIG_SYS_I2C_TCA642X_ADDR; in do_tca642x() local
273 ret = tca642x_info(chip); in do_tca642x()
280 chip = (uint8_t)ul_arg2; in do_tca642x()
281 printf("Current device address: 0x%x\n", chip); in do_tca642x()
292 ret = tca642x_set_dir(chip, gpio_bank, (1 << bank_shift), in do_tca642x()
294 val = (tca642x_get_val(chip, gpio_bank) & in do_tca642x()
300 printf("chip 0x%02x, pin 0x%lx = %d\n", chip, in do_tca642x()
311 ret = tca642x_set_dir(chip, gpio_bank, (1 << bank_shift), in do_tca642x()
314 ret = tca642x_set_val(chip, in do_tca642x()
328 ret = tca642x_set_pol(chip, gpio_bank, (1 << bank_shift), in do_tca642x()
336 eprintf("Error talking to chip at 0x%x\n", chip); in do_tca642x()