Skip to contentSkip to conversation

regmap-irq.c: correct way to unmask interrupt in driver?

DISCUSSION Dzmitry Sankouski 1 participant 1 message Mar 13, 2025

lore
Share & tools
lore
#0 lore raw

My device interrupts is described with struct regmap_irq_chip and struct regmap_irq [1]. After driver probe, all interrupts is masked by regmap_add_irq_chip_fwnode function.

I tried to unmask by writing INT_A_ENABLE_L_REG, and interrupt is unmasked and fired, but it is NOT cleared, i.e. INT_A_CLEAR_L_REG is not written. It happens, because regmap_irq_thread still thinks that interrupt is masked.

What is a correct way to unmask?

[1]: device interrupts declarations:

```
static const struct regmap_irq p9320_irqs_a[] = {
	{ .mask = IRQA_H_TRX_DATA_RECEIVED_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_TX_OCP_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_TX_MODE_RX_NOT_DET_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_TX_FOD_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_TX_CON_DISCON_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_AC_MISSING_DET_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_ADT_RECEIVED_MASK, .reg_offset = 1 },
	{ .mask = IRQA_H_ADT_SENT_MASK, .reg_offset = 1 },
	{ .mask = IRQA_L_STAT_VOUT_MASK },
	{ .mask = IRQA_L_STAT_VRECT_MASK },
	{ .mask = IRQA_L_OP_MODE_MASK },
	{ .mask = IRQA_L_OVER_VOL_MASK },
	{ .mask = IRQA_L_OVER_CURR_MASK },
	{ .mask = IRQA_L_OVER_TEMP_MASK },
	{ .mask = IRQA_L_TXCONFLICT_MASK },
	{ .mask = IRQA_L_RESERVED0_MASK },
};

static struct regmap_irq_chip idt_p9320_charger_irq_a_chip = {
	.name			= "wpc-irq-a",
	.status_base		= INT_A_L_REG,
	.unmask_base		= INT_A_ENABLE_L_REG,
	.ack_base		= INT_A_CLEAR_L_REG,
	.handle_pre_irq	=	mfc_wpc_irq_thread,
	.handle_post_irq	= mfc_wpc_post_irq_thread,
	.num_regs		= 2,
	.irqs			= p9320_irqs_a,
	.num_irqs		= ARRAY_SIZE(p9320_irqs_a),
};
```

best regards, Dzmitry