Lines Matching +full:multi +full:- +full:pmic
1 // SPDX-License-Identifier: GPL-2.0-only
5 * TPS65217 chip family multi-function driver
7 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
40 mutex_lock(&tps->irq_lock); in tps65217_irq_lock()
49 tps->irq_mask, TPS65217_PROTECT_NONE); in tps65217_irq_sync_unlock()
51 dev_err(tps->dev, "Failed to sync IRQ masks\n"); in tps65217_irq_sync_unlock()
53 mutex_unlock(&tps->irq_lock); in tps65217_irq_sync_unlock()
59 u8 mask = BIT(data->hwirq) << TPS65217_INT_SHIFT; in tps65217_irq_enable()
61 tps->irq_mask &= ~mask; in tps65217_irq_enable()
67 u8 mask = BIT(data->hwirq) << TPS65217_INT_SHIFT; in tps65217_irq_disable()
69 tps->irq_mask |= mask; in tps65217_irq_disable()
82 .name = "tps65217-pmic",
83 .of_compatible = "ti,tps65217-pmic",
86 .name = "tps65217-bl",
87 .of_compatible = "ti,tps65217-bl",
90 .name = "tps65217-charger",
93 .of_compatible = "ti,tps65217-charger",
96 .name = "tps65217-pwrbutton",
99 .of_compatible = "ti,tps65217-pwrbutton",
113 dev_err(tps->dev, "Failed to read IRQ status: %d\n", in tps65217_irq_thread()
120 handle_nested_irq(irq_find_mapping(tps->irq_domain, i)); in tps65217_irq_thread()
134 struct tps65217 *tps = h->host_data; in tps65217_irq_map()
139 irq_set_parent(virq, tps->irq); in tps65217_irq_map()
153 mutex_init(&tps->irq_lock); in tps65217_irq_init()
154 tps->irq = irq; in tps65217_irq_init()
157 tps->irq_mask = TPS65217_INT_MASK; in tps65217_irq_init()
161 tps->irq_domain = irq_domain_add_linear(tps->dev->of_node, in tps65217_irq_init()
163 if (!tps->irq_domain) { in tps65217_irq_init()
164 dev_err(tps->dev, "Could not create IRQ domain\n"); in tps65217_irq_init()
165 return -ENOMEM; in tps65217_irq_init()
168 ret = devm_request_threaded_irq(tps->dev, irq, NULL, in tps65217_irq_init()
170 "tps65217-irq", tps); in tps65217_irq_init()
172 dev_err(tps->dev, "Failed to request IRQ %d: %d\n", in tps65217_irq_init()
192 return regmap_read(tps->regmap, reg, val); in tps65217_reg_read()
212 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
215 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
220 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
223 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
227 ret = regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
230 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
234 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
236 return -EINVAL; in tps65217_reg_write()
245 * @reg: Register to read-write to.
258 dev_err(tps->dev, "Read from reg 0x%x failed\n", reg); in tps65217_update_bits()
267 dev_err(tps->dev, "Write for reg 0x%x failed\n", reg); in tps65217_update_bits()
317 status_off = of_property_read_bool(client->dev.of_node, in tps65217_probe()
318 "ti,pmic-shutdown-controller"); in tps65217_probe()
320 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); in tps65217_probe()
322 return -ENOMEM; in tps65217_probe()
325 tps->dev = &client->dev; in tps65217_probe()
327 tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); in tps65217_probe()
328 if (IS_ERR(tps->regmap)) { in tps65217_probe()
329 ret = PTR_ERR(tps->regmap); in tps65217_probe()
330 dev_err(tps->dev, "Failed to allocate register map: %d\n", in tps65217_probe()
335 if (client->irq) { in tps65217_probe()
336 tps65217_irq_init(tps, client->irq); in tps65217_probe()
345 ret = devm_mfd_add_devices(tps->dev, -1, tps65217s, in tps65217_probe()
347 tps->irq_domain); in tps65217_probe()
349 dev_err(tps->dev, "mfd_add_devices failed: %d\n", ret); in tps65217_probe()
355 dev_err(tps->dev, "Failed to read revision register: %d\n", in tps65217_probe()
360 /* Set the PMIC to shutdown on PWR_EN toggle */ in tps65217_probe()
366 dev_warn(tps->dev, "unable to set the status OFF\n"); in tps65217_probe()
369 dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n", in tps65217_probe()
383 virq = irq_find_mapping(tps->irq_domain, i); in tps65217_remove()
388 irq_domain_remove(tps->irq_domain); in tps65217_remove()
389 tps->irq_domain = NULL; in tps65217_remove()
421 MODULE_DESCRIPTION("TPS65217 chip family multi-function driver");