Lines Matching refs:tps6586x
122 struct tps6586x { struct
137 static inline struct tps6586x *dev_to_tps6586x(struct device *dev) in dev_to_tps6586x() argument
144 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_write() local
146 return regmap_write(tps6586x->regmap, reg, val); in tps6586x_write()
152 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_writes() local
154 return regmap_bulk_write(tps6586x->regmap, reg, val, len); in tps6586x_writes()
160 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_read() local
164 ret = regmap_read(tps6586x->regmap, reg, &rval); in tps6586x_read()
173 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_reads() local
175 return regmap_bulk_read(tps6586x->regmap, reg, val, len); in tps6586x_reads()
181 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_set_bits() local
183 return regmap_update_bits(tps6586x->regmap, reg, bit_mask, bit_mask); in tps6586x_set_bits()
189 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_clr_bits() local
191 return regmap_update_bits(tps6586x->regmap, reg, bit_mask, 0); in tps6586x_clr_bits()
197 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_update() local
199 return regmap_update_bits(tps6586x->regmap, reg, mask, val); in tps6586x_update()
205 struct tps6586x *tps6586x = dev_to_tps6586x(dev); in tps6586x_irq_get_virq() local
207 return irq_create_mapping(tps6586x->irq_domain, irq); in tps6586x_irq_get_virq()
213 struct tps6586x *tps6586x = dev_get_drvdata(dev); in tps6586x_get_version() local
215 return tps6586x->version; in tps6586x_get_version()
225 static int tps6586x_remove_subdevs(struct tps6586x *tps6586x) in tps6586x_remove_subdevs() argument
227 return device_for_each_child(tps6586x->dev, NULL, __remove_subdev); in tps6586x_remove_subdevs()
232 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data); in tps6586x_irq_lock() local
234 mutex_lock(&tps6586x->irq_lock); in tps6586x_irq_lock()
239 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); in tps6586x_irq_enable() local
243 tps6586x->mask_reg[data->mask_reg] &= ~data->mask_mask; in tps6586x_irq_enable()
244 tps6586x->irq_en |= (1 << __irq); in tps6586x_irq_enable()
249 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); in tps6586x_irq_disable() local
254 tps6586x->mask_reg[data->mask_reg] |= data->mask_mask; in tps6586x_irq_disable()
255 tps6586x->irq_en &= ~(1 << __irq); in tps6586x_irq_disable()
260 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data); in tps6586x_irq_sync_unlock() local
263 for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) { in tps6586x_irq_sync_unlock()
265 ret = tps6586x_write(tps6586x->dev, in tps6586x_irq_sync_unlock()
267 tps6586x->mask_reg[i]); in tps6586x_irq_sync_unlock()
271 mutex_unlock(&tps6586x->irq_lock); in tps6586x_irq_sync_unlock()
276 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); in tps6586x_irq_set_wake() local
277 return irq_set_irq_wake(tps6586x->irq, on); in tps6586x_irq_set_wake()
292 struct tps6586x *tps6586x = h->host_data; in tps6586x_irq_map() local
294 irq_set_chip_data(virq, tps6586x); in tps6586x_irq_map()
309 struct tps6586x *tps6586x = data; in tps6586x_irq() local
314 ret = tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1, in tps6586x_irq()
318 dev_err(tps6586x->dev, "failed to read interrupt status\n"); in tps6586x_irq()
327 if (tps6586x->irq_en & (1 << i)) in tps6586x_irq()
329 irq_find_mapping(tps6586x->irq_domain, i)); in tps6586x_irq()
337 static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq, in tps6586x_irq_init() argument
345 tps6586x->irq = irq; in tps6586x_irq_init()
347 mutex_init(&tps6586x->irq_lock); in tps6586x_irq_init()
349 tps6586x->mask_reg[i] = 0xff; in tps6586x_irq_init()
350 tps6586x_write(tps6586x->dev, TPS6586X_INT_MASK1 + i, 0xff); in tps6586x_irq_init()
353 tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1, sizeof(tmp), tmp); in tps6586x_irq_init()
358 dev_err(tps6586x->dev, in tps6586x_irq_init()
366 tps6586x->irq_domain = irq_domain_add_simple(tps6586x->dev->of_node, in tps6586x_irq_init()
368 tps6586x); in tps6586x_irq_init()
369 if (!tps6586x->irq_domain) { in tps6586x_irq_init()
370 dev_err(tps6586x->dev, "Failed to create IRQ domain\n"); in tps6586x_irq_init()
374 "tps6586x", tps6586x); in tps6586x_irq_init()
377 device_init_wakeup(tps6586x->dev, 1); in tps6586x_irq_init()
382 static int tps6586x_add_subdevs(struct tps6586x *tps6586x, in tps6586x_add_subdevs() argument
398 pdev->dev.parent = tps6586x->dev; in tps6586x_add_subdevs()
411 tps6586x_remove_subdevs(tps6586x); in tps6586x_add_subdevs()
524 struct tps6586x *tps6586x; in tps6586x_i2c_probe() local
542 tps6586x = devm_kzalloc(&client->dev, sizeof(*tps6586x), GFP_KERNEL); in tps6586x_i2c_probe()
543 if (!tps6586x) in tps6586x_i2c_probe()
546 tps6586x->version = version; in tps6586x_i2c_probe()
547 tps6586x_print_version(client, tps6586x->version); in tps6586x_i2c_probe()
549 tps6586x->client = client; in tps6586x_i2c_probe()
550 tps6586x->dev = &client->dev; in tps6586x_i2c_probe()
551 i2c_set_clientdata(client, tps6586x); in tps6586x_i2c_probe()
553 tps6586x->regmap = devm_regmap_init_i2c(client, in tps6586x_i2c_probe()
555 if (IS_ERR(tps6586x->regmap)) { in tps6586x_i2c_probe()
556 ret = PTR_ERR(tps6586x->regmap); in tps6586x_i2c_probe()
563 ret = tps6586x_irq_init(tps6586x, client->irq, in tps6586x_i2c_probe()
571 ret = mfd_add_devices(tps6586x->dev, -1, in tps6586x_i2c_probe()
573 NULL, 0, tps6586x->irq_domain); in tps6586x_i2c_probe()
579 ret = tps6586x_add_subdevs(tps6586x, pdata); in tps6586x_i2c_probe()
604 mfd_remove_devices(tps6586x->dev); in tps6586x_i2c_probe()
607 free_irq(client->irq, tps6586x); in tps6586x_i2c_probe()
613 struct tps6586x *tps6586x = i2c_get_clientdata(client); in tps6586x_i2c_remove() local
615 tps6586x_remove_subdevs(tps6586x); in tps6586x_i2c_remove()
616 mfd_remove_devices(tps6586x->dev); in tps6586x_i2c_remove()
618 free_irq(client->irq, tps6586x); in tps6586x_i2c_remove()
623 struct tps6586x *tps6586x = dev_get_drvdata(dev); in tps6586x_i2c_suspend() local
625 if (tps6586x->client->irq) in tps6586x_i2c_suspend()
626 disable_irq(tps6586x->client->irq); in tps6586x_i2c_suspend()
633 struct tps6586x *tps6586x = dev_get_drvdata(dev); in tps6586x_i2c_resume() local
635 if (tps6586x->client->irq) in tps6586x_i2c_resume()
636 enable_irq(tps6586x->client->irq); in tps6586x_i2c_resume()