29 #include <linux/module.h>
34 static const u8 max77693_mask_reg[] = {
61 #define DECLARE_IRQ(idx, _group, _mask) \
62 [(idx)] = { .group = (_group), .mask = (_mask) }
107 static void max77693_irq_sync_unlock(
struct irq_data *
data)
113 u8 mask_reg = max77693_mask_reg[
i];
114 struct regmap *
map = max77693_get_regmap(max77693, i);
129 irq_to_max77693_irq(
struct max77693_dev *max77693,
int irq)
131 return &max77693_irqs[irq];
134 static void max77693_irq_mask(
struct irq_data *data)
138 irq_to_max77693_irq(max77693, data->
irq);
140 if (irq_data->
group >= MAX77693_IRQ_GROUP_NR)
149 static void max77693_irq_unmask(
struct irq_data *data)
153 irq_to_max77693_irq(max77693, data->
irq);
155 if (irq_data->
group >= MAX77693_IRQ_GROUP_NR)
164 static struct irq_chip max77693_irq_chip = {
166 .irq_bus_lock = max77693_irq_lock,
167 .irq_bus_sync_unlock = max77693_irq_sync_unlock,
168 .irq_mask = max77693_irq_mask,
169 .irq_unmask = max77693_irq_unmask,
172 #define MAX77693_IRQSRC_CHG (1 << 0)
173 #define MAX77693_IRQSRC_TOP (1 << 1)
174 #define MAX77693_IRQSRC_FLASH (1 << 2)
175 #define MAX77693_IRQSRC_MUIC (1 << 3)
176 static irqreturn_t max77693_irq_thread(
int irq,
void *data)
187 dev_err(max77693->
dev,
"Failed to read interrupt source: %d\n",
222 if (irq_reg[max77693_irqs[i].
group] & max77693_irqs[i].
mask) {
235 max77693_irq_thread(0, max77693);
240 static int max77693_irq_domain_map(
struct irq_domain *
d,
unsigned int irq,
247 irq_set_nested_thread(irq, 1);
251 irq_set_noprobe(irq);
257 .map = max77693_irq_domain_map,
281 map = max77693_get_regmap(max77693, i);
283 if (IS_ERR_OR_NULL(map))
294 &max77693_irq_domain_ops, max77693);
296 dev_err(max77693->
dev,
"could not create irq domain\n");
306 dev_err(max77693->
dev,
"fail to read PMIC register\n");
316 dev_err(max77693->
dev,
"fail to write PMIC register\n");
322 "max77693-irq", max77693);
324 dev_err(max77693->
dev,
"Failed to request IRQ %d: %d\n",