Lines Matching +full:tps6593 +full:- +full:q1
1 // SPDX-License-Identifier: GPL-2.0
3 * I2C access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
5 * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
32 return -EIO; in tps6594_i2c_transfer()
40 const u8 addr = client->addr + page; in tps6594_i2c_reg_read_with_crc()
44 * - B0: (I2C_addr_7bits << 1) | WR_bit, with WR_bit = 0 in tps6594_i2c_reg_read_with_crc()
45 * - B1: reg in tps6594_i2c_reg_read_with_crc()
46 * - B2: (I2C_addr_7bits << 1) | RD_bit, with RD_bit = 1 in tps6594_i2c_reg_read_with_crc()
47 * - B3: val in tps6594_i2c_reg_read_with_crc()
48 * - B4: CRC from B0-B1-B2-B3 in tps6594_i2c_reg_read_with_crc()
65 ret = tps6594_i2c_transfer(client->adapter, msgs, 2); in tps6594_i2c_reg_read_with_crc()
69 crc_data[sizeof(crc_data) - 1] = *val = buf_rx[0]; in tps6594_i2c_reg_read_with_crc()
71 return -EIO; in tps6594_i2c_reg_read_with_crc()
81 const u8 addr = client->addr + page; in tps6594_i2c_reg_write_with_crc()
85 * - B0: (I2C_addr_7bits << 1) | WR_bit, with WR_bit = 0 in tps6594_i2c_reg_write_with_crc()
86 * - B1: reg in tps6594_i2c_reg_write_with_crc()
87 * - B2: val in tps6594_i2c_reg_write_with_crc()
88 * - B3: CRC from B0-B1-B2 in tps6594_i2c_reg_write_with_crc()
94 msg.flags = client->flags & I2C_M_TEN; in tps6594_i2c_reg_write_with_crc()
98 buf[msg.len - 1] = crc8(tps6594_i2c_crc_table, crc_data, sizeof(crc_data), CRC8_INIT_VALUE); in tps6594_i2c_reg_write_with_crc()
100 return tps6594_i2c_transfer(client->adapter, &msg, 1); in tps6594_i2c_reg_write_with_crc()
116 if (tps->use_crc) { in tps6594_i2c_read()
118 * Auto-increment feature does not support CRC protocol. in tps6594_i2c_read()
128 msgs[0].addr = client->addr + page; in tps6594_i2c_read()
139 return tps6594_i2c_transfer(client->adapter, msgs, 2); in tps6594_i2c_read()
154 if (tps->use_crc) { in tps6594_i2c_write()
156 * Auto-increment feature does not support CRC protocol. in tps6594_i2c_write()
159 for (i = 0 ; ret == 0 && i < count - 2 ; i++) in tps6594_i2c_write()
166 buf = kzalloc(--count, GFP_KERNEL); in tps6594_i2c_write()
168 return -ENOMEM; in tps6594_i2c_write()
171 for (i = 0 ; i < count - 1 ; i++) in tps6594_i2c_write()
175 msg.addr = client->addr + page; in tps6594_i2c_write()
176 msg.flags = client->flags & I2C_M_TEN; in tps6594_i2c_write()
180 ret = tps6594_i2c_transfer(client->adapter, &msg, 1); in tps6594_i2c_write()
196 { .compatible = "ti,tps6594-q1", .data = (void *)TPS6594, },
197 { .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, },
198 { .compatible = "ti,lp8764-q1", .data = (void *)LP8764, },
199 { .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, },
206 struct device *dev = &client->dev; in tps6594_i2c_probe()
212 return -ENOMEM; in tps6594_i2c_probe()
216 tps->dev = dev; in tps6594_i2c_probe()
217 tps->reg = client->addr; in tps6594_i2c_probe()
218 tps->irq = client->irq; in tps6594_i2c_probe()
222 return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n"); in tps6594_i2c_probe()
223 tps->chip_id = (unsigned long)match->data; in tps6594_i2c_probe()
225 if (tps->chip_id == TPS65224) in tps6594_i2c_probe()
228 tps->regmap = devm_regmap_init(dev, NULL, client, &tps6594_i2c_regmap_config); in tps6594_i2c_probe()
229 if (IS_ERR(tps->regmap)) in tps6594_i2c_probe()
230 return dev_err_probe(dev, PTR_ERR(tps->regmap), "Failed to init regmap\n"); in tps6594_i2c_probe()