Lines Matching refs:max8997
30 static struct i2c_client *get_i2c(struct max8997_dev *max8997, in get_i2c() argument
35 return max8997->i2c; in get_i2c()
39 return max8997->muic; in get_i2c()
41 return max8997->i2c; in get_i2c()
43 return max8997->i2c; in get_i2c()
102 struct max8997_dev *max8997 = irq_data_get_irq_chip_data(data); in max8997_irq_lock() local
104 mutex_lock(&max8997->irqlock); in max8997_irq_lock()
109 struct max8997_dev *max8997 = irq_data_get_irq_chip_data(data); in max8997_irq_sync_unlock() local
114 struct i2c_client *i2c = get_i2c(max8997, i); in max8997_irq_sync_unlock()
119 max8997->irq_masks_cache[i] = max8997->irq_masks_cur[i]; in max8997_irq_sync_unlock()
122 max8997->irq_masks_cur[i]); in max8997_irq_sync_unlock()
125 mutex_unlock(&max8997->irqlock); in max8997_irq_sync_unlock()
129 irq_to_max8997_irq(struct max8997_dev *max8997, struct irq_data *data) in irq_to_max8997_irq() argument
136 struct max8997_dev *max8997 = irq_data_get_irq_chip_data(data); in max8997_irq_mask() local
137 const struct max8997_irq_data *irq_data = irq_to_max8997_irq(max8997, in max8997_irq_mask()
140 max8997->irq_masks_cur[irq_data->group] |= irq_data->mask; in max8997_irq_mask()
145 struct max8997_dev *max8997 = irq_data_get_irq_chip_data(data); in max8997_irq_unmask() local
146 const struct max8997_irq_data *irq_data = irq_to_max8997_irq(max8997, in max8997_irq_unmask()
149 max8997->irq_masks_cur[irq_data->group] &= ~irq_data->mask; in max8997_irq_unmask()
167 struct max8997_dev *max8997 = data; in max8997_irq_thread() local
173 ret = max8997_read_reg(max8997->i2c, MAX8997_REG_INTSRC, &irq_src); in max8997_irq_thread()
175 dev_err(max8997->dev, "Failed to read interrupt source: %d\n", in max8997_irq_thread()
182 max8997_bulk_read(max8997->i2c, MAX8997_REG_INT1, 4, in max8997_irq_thread()
203 max8997_bulk_read(max8997->muic, MAX8997_MUIC_REG_INT1, 3, in max8997_irq_thread()
213 max8997_bulk_read(max8997->i2c, MAX8997_REG_GPIOCNTL1, in max8997_irq_thread()
220 if (max8997->gpio_status[i] != gpio_info[i]) in max8997_irq_thread()
224 if ((max8997->gpio_status[i] != gpio_info[i]) && in max8997_irq_thread()
229 if ((max8997->gpio_status[i] != gpio_info[i]) && in max8997_irq_thread()
248 ret = max8997_read_reg(max8997->i2c, MAX8997_REG_FLASHSTATUS, in max8997_irq_thread()
254 irq_reg[i] &= ~max8997->irq_masks_cur[i]; in max8997_irq_thread()
259 cur_irq = irq_find_mapping(max8997->irq_domain, i); in max8997_irq_thread()
268 int max8997_irq_resume(struct max8997_dev *max8997) in max8997_irq_resume() argument
270 if (max8997->irq && max8997->irq_domain) in max8997_irq_resume()
271 max8997_irq_thread(0, max8997); in max8997_irq_resume()
278 struct max8997_dev *max8997 = d->host_data; in max8997_irq_domain_map() local
280 irq_set_chip_data(irq, max8997); in max8997_irq_domain_map()
292 int max8997_irq_init(struct max8997_dev *max8997) in max8997_irq_init() argument
299 if (!max8997->irq) { in max8997_irq_init()
300 dev_warn(max8997->dev, "No interrupt specified.\n"); in max8997_irq_init()
304 mutex_init(&max8997->irqlock); in max8997_irq_init()
310 max8997->irq_masks_cur[i] = 0xff; in max8997_irq_init()
311 max8997->irq_masks_cache[i] = 0xff; in max8997_irq_init()
312 i2c = get_i2c(max8997, i); in max8997_irq_init()
323 max8997->gpio_status[i] = (max8997_read_reg(max8997->i2c, in max8997_irq_init()
331 &max8997_irq_domain_ops, max8997); in max8997_irq_init()
333 dev_err(max8997->dev, "could not create irq domain\n"); in max8997_irq_init()
336 max8997->irq_domain = domain; in max8997_irq_init()
338 ret = request_threaded_irq(max8997->irq, NULL, max8997_irq_thread, in max8997_irq_init()
340 "max8997-irq", max8997); in max8997_irq_init()
343 dev_err(max8997->dev, "Failed to request IRQ %d: %d\n", in max8997_irq_init()
344 max8997->irq, ret); in max8997_irq_init()
348 if (!max8997->ono) in max8997_irq_init()
351 ret = request_threaded_irq(max8997->ono, NULL, max8997_irq_thread, in max8997_irq_init()
353 IRQF_ONESHOT, "max8997-ono", max8997); in max8997_irq_init()
356 dev_err(max8997->dev, "Failed to request ono-IRQ %d: %d\n", in max8997_irq_init()
357 max8997->ono, ret); in max8997_irq_init()
362 void max8997_irq_exit(struct max8997_dev *max8997) in max8997_irq_exit() argument
364 if (max8997->ono) in max8997_irq_exit()
365 free_irq(max8997->ono, max8997); in max8997_irq_exit()
367 if (max8997->irq) in max8997_irq_exit()
368 free_irq(max8997->irq, max8997); in max8997_irq_exit()