39 static int debug_mask = 0;
41 MODULE_PARM_DESC(debug_mask,
"Set debug_mask : 0x0=off 0x1=IRQ_INFO 0x2=IRQ_MASK 0x4=IRQ_INI)");
43 static const u8 max77686_mask_reg[] = {
67 #define DECLARE_IRQ(idx, _group, _mask) \
68 [(idx)] = { .group = (_group), .mask = (_mask) }
98 static void max77686_irq_sync_unlock(
struct irq_data *data)
104 u8 mask_reg = max77686_mask_reg[
i];
105 struct regmap *
map = max77686_get_regmap(max77686, i);
108 pr_debug(
"%s: mask_reg[%d]=0x%x, cur=0x%x\n",
127 return &max77686_irqs[data->
hwirq];
130 static void max77686_irq_mask(
struct irq_data *data)
137 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
138 pr_info(
"%s: group=%d, cur=0x%x\n",
139 __func__, irq_data->
group,
143 static void max77686_irq_unmask(
struct irq_data *data)
150 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
151 pr_info(
"%s: group=%d, cur=0x%x\n",
152 __func__, irq_data->
group,
156 static struct irq_chip max77686_irq_chip = {
158 .irq_bus_lock = max77686_irq_lock,
159 .irq_bus_sync_unlock = max77686_irq_sync_unlock,
160 .irq_mask = max77686_irq_mask,
161 .irq_unmask = max77686_irq_unmask,
164 static irqreturn_t max77686_irq_thread(
int irq,
void *data)
168 unsigned int irq_src;
174 dev_err(max77686->
dev,
"Failed to read interrupt source: %d\n",
180 pr_info(
"%s: irq_src=0x%x\n", __func__, irq_src);
186 dev_err(max77686->
dev,
"Failed to read interrupt source: %d\n",
191 if (debug_mask & MAX77686_DEBUG_IRQ_INT)
192 pr_info(
"%s: int1=0x%x, int2=0x%x\n", __func__,
200 dev_err(max77686->
dev,
"Failed to read interrupt source: %d\n",
205 if (debug_mask & MAX77686_DEBUG_IRQ_INT)
206 pr_info(
"%s: rtc int=0x%x\n", __func__,
215 if (irq_reg[max77686_irqs[i].
group] & max77686_irqs[i].
mask) {
225 static int max77686_irq_domain_map(
struct irq_domain *
d,
unsigned int irq,
232 irq_set_nested_thread(irq, 1);
236 irq_set_noprobe(irq);
242 .map = max77686_irq_domain_map,
258 if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
262 "Failed to request gpio %d with ret:"
270 pr_info(
"%s: gpio_irq=%x\n", __func__, val);
274 if (!max77686->
irq) {
275 dev_err(max77686->
dev,
"irq is not specified\n");
283 map = max77686_get_regmap(max77686, i);
285 if (IS_ERR_OR_NULL(map))
293 &max77686_irq_domain_ops, max77686);
295 dev_err(max77686->
dev,
"could not create irq domain\n");
302 "max77686-irq", max77686);
305 dev_err(max77686->
dev,
"Failed to request IRQ %d: %d\n",