30 static const u8 max8997_mask_reg[] = {
68 #define DECLARE_IRQ(idx, _group, _mask) \
69 [(idx)] = { .group = (_group), .mask = (_mask) }
121 static void max8997_irq_sync_unlock(
struct irq_data *
data)
127 u8 mask_reg = max8997_mask_reg[
i];
143 irq_to_max8997_irq(
struct max8997_dev *max8997,
int irq)
146 return &max8997_irqs[data->
hwirq];
149 static void max8997_irq_mask(
struct irq_data *data)
158 static void max8997_irq_unmask(
struct irq_data *data)
167 static struct irq_chip max8997_irq_chip = {
169 .irq_bus_lock = max8997_irq_lock,
170 .irq_bus_sync_unlock = max8997_irq_sync_unlock,
171 .irq_mask = max8997_irq_mask,
172 .irq_unmask = max8997_irq_unmask,
175 #define MAX8997_IRQSRC_PMIC (1 << 1)
176 #define MAX8997_IRQSRC_FUELGAUGE (1 << 2)
177 #define MAX8997_IRQSRC_MUIC (1 << 3)
178 #define MAX8997_IRQSRC_GPIO (1 << 4)
179 #define MAX8997_IRQSRC_FLASH (1 << 5)
180 static irqreturn_t max8997_irq_thread(
int irq,
void *data)
190 dev_err(max8997->
dev,
"Failed to read interrupt source: %d\n",
245 !(gpio_info[i] & MAX8997_GPIO_DATA_MASK))
256 irq_reg[
GPIO_HI] |= (1 << (i - 8));
273 if (irq_reg[max8997_irqs[i].
group] & max8997_irqs[i].
mask) {
286 max8997_irq_thread(0, max8997);
290 static int max8997_irq_domain_map(
struct irq_domain *
d,
unsigned int irq,
297 irq_set_nested_thread(irq, 1);
301 irq_set_noprobe(irq);
307 .map = max8997_irq_domain_map,
318 dev_warn(max8997->
dev,
"No interrupt specified.\n");
330 i2c = get_i2c(max8997, i);
332 if (IS_ERR_OR_NULL(i2c))
349 &max8997_irq_domain_ops, max8997);
351 dev_err(max8997->
dev,
"could not create irq domain\n");
358 "max8997-irq", max8997);
361 dev_err(max8997->
dev,
"Failed to request IRQ %d: %d\n",
374 dev_err(max8997->
dev,
"Failed to request ono-IRQ %d: %d\n",