• Home
  • Raw
  • Download

Lines Matching refs:tc3589x

27 int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg)  in tc3589x_reg_read()  argument
31 ret = i2c_smbus_read_byte_data(tc3589x->i2c, reg); in tc3589x_reg_read()
33 dev_err(tc3589x->dev, "failed to read reg %#x: %d\n", in tc3589x_reg_read()
46 int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data) in tc3589x_reg_write() argument
50 ret = i2c_smbus_write_byte_data(tc3589x->i2c, reg, data); in tc3589x_reg_write()
52 dev_err(tc3589x->dev, "failed to write reg %#x: %d\n", in tc3589x_reg_write()
66 int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length, u8 *values) in tc3589x_block_read() argument
70 ret = i2c_smbus_read_i2c_block_data(tc3589x->i2c, reg, length, values); in tc3589x_block_read()
72 dev_err(tc3589x->dev, "failed to read regs %#x: %d\n", in tc3589x_block_read()
86 int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length, in tc3589x_block_write() argument
91 ret = i2c_smbus_write_i2c_block_data(tc3589x->i2c, reg, length, in tc3589x_block_write()
94 dev_err(tc3589x->dev, "failed to write regs %#x: %d\n", in tc3589x_block_write()
108 int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val) in tc3589x_set_bits() argument
112 mutex_lock(&tc3589x->lock); in tc3589x_set_bits()
114 ret = tc3589x_reg_read(tc3589x, reg); in tc3589x_set_bits()
121 ret = tc3589x_reg_write(tc3589x, reg, ret); in tc3589x_set_bits()
124 mutex_unlock(&tc3589x->lock); in tc3589x_set_bits()
165 struct tc3589x *tc3589x = data; in tc3589x_irq() local
169 status = tc3589x_reg_read(tc3589x, TC3589x_IRQST); in tc3589x_irq()
175 int virq = irq_create_mapping(tc3589x->domain, bit); in tc3589x_irq()
187 status = tc3589x_reg_read(tc3589x, TC3589x_IRQST); in tc3589x_irq()
197 struct tc3589x *tc3589x = d->host_data; in tc3589x_irq_map() local
199 irq_set_chip_data(virq, tc3589x); in tc3589x_irq_map()
227 static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) in tc3589x_irq_init() argument
229 int base = tc3589x->irq_base; in tc3589x_irq_init()
231 tc3589x->domain = irq_domain_add_simple( in tc3589x_irq_init()
233 &tc3589x_irq_ops, tc3589x); in tc3589x_irq_init()
235 if (!tc3589x->domain) { in tc3589x_irq_init()
236 dev_err(tc3589x->dev, "Failed to create irqdomain\n"); in tc3589x_irq_init()
243 static int tc3589x_chip_init(struct tc3589x *tc3589x) in tc3589x_chip_init() argument
247 manf = tc3589x_reg_read(tc3589x, TC3589x_MANFCODE); in tc3589x_chip_init()
251 ver = tc3589x_reg_read(tc3589x, TC3589x_VERSION); in tc3589x_chip_init()
256 dev_err(tc3589x->dev, "unknown manufacturer: %#x\n", manf); in tc3589x_chip_init()
260 dev_info(tc3589x->dev, "manufacturer: %#x, version: %#x\n", manf, ver); in tc3589x_chip_init()
267 ret = tc3589x_reg_write(tc3589x, TC3589x_RSTCTRL, in tc3589x_chip_init()
275 return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1); in tc3589x_chip_init()
278 static int tc3589x_device_init(struct tc3589x *tc3589x) in tc3589x_device_init() argument
281 unsigned int blocks = tc3589x->pdata->block; in tc3589x_device_init()
284 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, in tc3589x_device_init()
286 tc3589x->irq_base, tc3589x->domain); in tc3589x_device_init()
288 dev_err(tc3589x->dev, "failed to add gpio child\n"); in tc3589x_device_init()
291 dev_info(tc3589x->dev, "added gpio block\n"); in tc3589x_device_init()
295 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, in tc3589x_device_init()
297 tc3589x->irq_base, tc3589x->domain); in tc3589x_device_init()
299 dev_err(tc3589x->dev, "failed to keypad child\n"); in tc3589x_device_init()
302 dev_info(tc3589x->dev, "added keypad block\n"); in tc3589x_device_init()
330 struct tc3589x *tc3589x; in tc3589x_probe() local
353 tc3589x = devm_kzalloc(&i2c->dev, sizeof(struct tc3589x), in tc3589x_probe()
355 if (!tc3589x) in tc3589x_probe()
358 mutex_init(&tc3589x->lock); in tc3589x_probe()
360 tc3589x->dev = &i2c->dev; in tc3589x_probe()
361 tc3589x->i2c = i2c; in tc3589x_probe()
362 tc3589x->pdata = pdata; in tc3589x_probe()
363 tc3589x->irq_base = pdata->irq_base; in tc3589x_probe()
364 tc3589x->num_gpio = id->driver_data; in tc3589x_probe()
366 i2c_set_clientdata(i2c, tc3589x); in tc3589x_probe()
368 ret = tc3589x_chip_init(tc3589x); in tc3589x_probe()
372 ret = tc3589x_irq_init(tc3589x, np); in tc3589x_probe()
376 ret = request_threaded_irq(tc3589x->i2c->irq, NULL, tc3589x_irq, in tc3589x_probe()
378 "tc3589x", tc3589x); in tc3589x_probe()
380 dev_err(tc3589x->dev, "failed to request IRQ: %d\n", ret); in tc3589x_probe()
384 ret = tc3589x_device_init(tc3589x); in tc3589x_probe()
386 dev_err(tc3589x->dev, "failed to add child devices\n"); in tc3589x_probe()
395 struct tc3589x *tc3589x = i2c_get_clientdata(client); in tc3589x_remove() local
397 mfd_remove_devices(tc3589x->dev); in tc3589x_remove()
405 struct tc3589x *tc3589x = dev_get_drvdata(dev); in tc3589x_suspend() local
406 struct i2c_client *client = tc3589x->i2c; in tc3589x_suspend()
411 ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE, in tc3589x_suspend()
419 struct tc3589x *tc3589x = dev_get_drvdata(dev); in tc3589x_resume() local
420 struct i2c_client *client = tc3589x->i2c; in tc3589x_resume()
425 ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE, in tc3589x_resume()