Lines Matching refs:max8998

95 irq_to_max8998_irq(struct max8998_dev *max8998, struct irq_data *data)  in irq_to_max8998_irq()  argument
102 struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); in max8998_irq_lock() local
104 mutex_lock(&max8998->irqlock); in max8998_irq_lock()
109 struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); in max8998_irq_sync_unlock() local
112 for (i = 0; i < ARRAY_SIZE(max8998->irq_masks_cur); i++) { in max8998_irq_sync_unlock()
117 if (max8998->irq_masks_cur[i] != max8998->irq_masks_cache[i]) { in max8998_irq_sync_unlock()
118 max8998->irq_masks_cache[i] = max8998->irq_masks_cur[i]; in max8998_irq_sync_unlock()
119 max8998_write_reg(max8998->i2c, MAX8998_REG_IRQM1 + i, in max8998_irq_sync_unlock()
120 max8998->irq_masks_cur[i]); in max8998_irq_sync_unlock()
124 mutex_unlock(&max8998->irqlock); in max8998_irq_sync_unlock()
129 struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); in max8998_irq_unmask() local
130 struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, data); in max8998_irq_unmask()
132 max8998->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; in max8998_irq_unmask()
137 struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); in max8998_irq_mask() local
138 struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, data); in max8998_irq_mask()
140 max8998->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; in max8998_irq_mask()
153 struct max8998_dev *max8998 = data; in max8998_irq_thread() local
158 ret = max8998_bulk_read(max8998->i2c, MAX8998_REG_IRQ1, in max8998_irq_thread()
161 dev_err(max8998->dev, "Failed to read interrupt register: %d\n", in max8998_irq_thread()
168 irq_reg[i] &= ~max8998->irq_masks_cur[i]; in max8998_irq_thread()
173 irq = irq_find_mapping(max8998->irq_domain, i); in max8998_irq_thread()
175 disable_irq_nosync(max8998->irq); in max8998_irq_thread()
185 int max8998_irq_resume(struct max8998_dev *max8998) in max8998_irq_resume() argument
187 if (max8998->irq && max8998->irq_domain) in max8998_irq_resume()
188 max8998_irq_thread(max8998->irq, max8998); in max8998_irq_resume()
195 struct max8997_dev *max8998 = d->host_data; in max8998_irq_domain_map() local
197 irq_set_chip_data(irq, max8998); in max8998_irq_domain_map()
209 int max8998_irq_init(struct max8998_dev *max8998) in max8998_irq_init() argument
215 if (!max8998->irq) { in max8998_irq_init()
216 dev_warn(max8998->dev, in max8998_irq_init()
221 mutex_init(&max8998->irqlock); in max8998_irq_init()
225 max8998->irq_masks_cur[i] = 0xff; in max8998_irq_init()
226 max8998->irq_masks_cache[i] = 0xff; in max8998_irq_init()
227 max8998_write_reg(max8998->i2c, MAX8998_REG_IRQM1 + i, 0xff); in max8998_irq_init()
230 max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM1, 0xff); in max8998_irq_init()
231 max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM2, 0xff); in max8998_irq_init()
234 max8998->irq_base, &max8998_irq_domain_ops, max8998); in max8998_irq_init()
236 dev_err(max8998->dev, "could not create irq domain\n"); in max8998_irq_init()
239 max8998->irq_domain = domain; in max8998_irq_init()
241 ret = request_threaded_irq(max8998->irq, NULL, max8998_irq_thread, in max8998_irq_init()
243 "max8998-irq", max8998); in max8998_irq_init()
245 dev_err(max8998->dev, "Failed to request IRQ %d: %d\n", in max8998_irq_init()
246 max8998->irq, ret); in max8998_irq_init()
250 if (!max8998->ono) in max8998_irq_init()
253 ret = request_threaded_irq(max8998->ono, NULL, max8998_irq_thread, in max8998_irq_init()
255 IRQF_ONESHOT, "max8998-ono", max8998); in max8998_irq_init()
257 dev_err(max8998->dev, "Failed to request IRQ %d: %d\n", in max8998_irq_init()
258 max8998->ono, ret); in max8998_irq_init()
263 void max8998_irq_exit(struct max8998_dev *max8998) in max8998_irq_exit() argument
265 if (max8998->ono) in max8998_irq_exit()
266 free_irq(max8998->ono, max8998); in max8998_irq_exit()
268 if (max8998->irq) in max8998_irq_exit()
269 free_irq(max8998->irq, max8998); in max8998_irq_exit()