mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dzmitry Sankouski <dsankouski@gmail.com>
To: broonie@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: regmap-irq.c: correct way to unmask interrupt in driver?
Date: Thu, 13 Mar 2025 16:28:30 +0300	[thread overview]
Message-ID: <20250313132830.2514224-1-dsankouski@gmail.com> (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

                 reply	other threads:[~2025-03-13 13:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250313132830.2514224-1-dsankouski@gmail.com \
    --to=dsankouski@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®