Lines Matching refs:tps
39 struct tps65217 *tps = irq_data_get_irq_chip_data(data); in tps65217_irq_lock() local
41 mutex_lock(&tps->irq_lock); in tps65217_irq_lock()
46 struct tps65217 *tps = irq_data_get_irq_chip_data(data); in tps65217_irq_sync_unlock() local
49 ret = tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK, in tps65217_irq_sync_unlock()
50 tps->irq_mask, TPS65217_PROTECT_NONE); in tps65217_irq_sync_unlock()
52 dev_err(tps->dev, "Failed to sync IRQ masks\n"); in tps65217_irq_sync_unlock()
54 mutex_unlock(&tps->irq_lock); in tps65217_irq_sync_unlock()
59 struct tps65217 *tps = irq_data_get_irq_chip_data(data); in tps65217_irq_enable() local
62 tps->irq_mask &= ~mask; in tps65217_irq_enable()
67 struct tps65217 *tps = irq_data_get_irq_chip_data(data); in tps65217_irq_disable() local
70 tps->irq_mask |= mask; in tps65217_irq_disable()
106 struct tps65217 *tps = data; in tps65217_irq_thread() local
112 ret = tps65217_reg_read(tps, TPS65217_REG_INT, &status); in tps65217_irq_thread()
114 dev_err(tps->dev, "Failed to read IRQ status: %d\n", in tps65217_irq_thread()
121 handle_nested_irq(irq_find_mapping(tps->irq_domain, i)); in tps65217_irq_thread()
135 struct tps65217 *tps = h->host_data; in tps65217_irq_map() local
137 irq_set_chip_data(virq, tps); in tps65217_irq_map()
140 irq_set_parent(virq, tps->irq); in tps65217_irq_map()
150 static int tps65217_irq_init(struct tps65217 *tps, int irq) in tps65217_irq_init() argument
154 mutex_init(&tps->irq_lock); in tps65217_irq_init()
155 tps->irq = irq; in tps65217_irq_init()
158 tps->irq_mask = TPS65217_INT_MASK; in tps65217_irq_init()
159 tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK, in tps65217_irq_init()
162 tps->irq_domain = irq_domain_add_linear(tps->dev->of_node, in tps65217_irq_init()
163 TPS65217_NUM_IRQ, &tps65217_irq_domain_ops, tps); in tps65217_irq_init()
164 if (!tps->irq_domain) { in tps65217_irq_init()
165 dev_err(tps->dev, "Could not create IRQ domain\n"); in tps65217_irq_init()
169 ret = devm_request_threaded_irq(tps->dev, irq, NULL, in tps65217_irq_init()
171 "tps65217-irq", tps); in tps65217_irq_init()
173 dev_err(tps->dev, "Failed to request IRQ %d: %d\n", in tps65217_irq_init()
190 int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, in tps65217_reg_read() argument
193 return regmap_read(tps->regmap, reg, val); in tps65217_reg_read()
205 int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, in tps65217_reg_write() argument
213 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
216 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
221 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
224 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
228 ret = regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
231 ret = regmap_write(tps->regmap, TPS65217_REG_PASSWORD, in tps65217_reg_write()
235 return regmap_write(tps->regmap, reg, val); in tps65217_reg_write()
251 static int tps65217_update_bits(struct tps65217 *tps, unsigned int reg, in tps65217_update_bits() argument
257 ret = tps65217_reg_read(tps, reg, &data); in tps65217_update_bits()
259 dev_err(tps->dev, "Read from reg 0x%x failed\n", reg); in tps65217_update_bits()
266 ret = tps65217_reg_write(tps, reg, data, level); in tps65217_update_bits()
268 dev_err(tps->dev, "Write for reg 0x%x failed\n", reg); in tps65217_update_bits()
273 int tps65217_set_bits(struct tps65217 *tps, unsigned int reg, in tps65217_set_bits() argument
276 return tps65217_update_bits(tps, reg, mask, val, level); in tps65217_set_bits()
280 int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg, in tps65217_clear_bits() argument
283 return tps65217_update_bits(tps, reg, mask, 0, level); in tps65217_clear_bits()
313 struct tps65217 *tps; in tps65217_probe() local
321 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); in tps65217_probe()
322 if (!tps) in tps65217_probe()
325 i2c_set_clientdata(client, tps); in tps65217_probe()
326 tps->dev = &client->dev; in tps65217_probe()
328 tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); in tps65217_probe()
329 if (IS_ERR(tps->regmap)) { in tps65217_probe()
330 ret = PTR_ERR(tps->regmap); in tps65217_probe()
331 dev_err(tps->dev, "Failed to allocate register map: %d\n", in tps65217_probe()
337 tps65217_irq_init(tps, client->irq); in tps65217_probe()
346 ret = devm_mfd_add_devices(tps->dev, -1, tps65217s, in tps65217_probe()
348 tps->irq_domain); in tps65217_probe()
350 dev_err(tps->dev, "mfd_add_devices failed: %d\n", ret); in tps65217_probe()
354 ret = tps65217_reg_read(tps, TPS65217_REG_CHIPID, &version); in tps65217_probe()
356 dev_err(tps->dev, "Failed to read revision register: %d\n", in tps65217_probe()
363 ret = tps65217_set_bits(tps, TPS65217_REG_STATUS, in tps65217_probe()
367 dev_warn(tps->dev, "unable to set the status OFF\n"); in tps65217_probe()
370 dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n", in tps65217_probe()
379 struct tps65217 *tps = i2c_get_clientdata(client); in tps65217_remove() local
384 virq = irq_find_mapping(tps->irq_domain, i); in tps65217_remove()
389 irq_domain_remove(tps->irq_domain); in tps65217_remove()
390 tps->irq_domain = NULL; in tps65217_remove()