Skip to content

Commit b938feb

Browse files
quic-bjorandelinusw
authored andcommitted
pinctrl: qcom: tlmm-test: Validate irq_enable delivers edge irqs
In commit 'cf9d052aa600 ("pinctrl: qcom: Don't clear pending interrupts when enabling")' Doug establishes an expectation that edge interrupts occurring while an interrupt is disabled should be delivered once the interrupt is enabled again. Implement a test to validate that this is the case. Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> Link: https://lore.kernel.org/20250313-tlmm-test-disabled-irq-delivered-v1-1-f0be903732ac@oss.qualcomm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent e225128 commit b938feb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

drivers/pinctrl/qcom/tlmm-test.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,42 @@ static void tlmm_test_thread_falling_in_handler(struct kunit *test)
506506
KUNIT_ASSERT_EQ(test, atomic_read(&priv->thread_count), 10);
507507
}
508508

509+
/*
510+
* Validate that edge interrupts occurring while irq is disabled is delivered
511+
* once the interrupt is reenabled.
512+
*/
513+
static void tlmm_test_rising_while_disabled(struct kunit *test)
514+
{
515+
struct tlmm_test_priv *priv = test->priv;
516+
unsigned int after_edge;
517+
unsigned int before_edge;
518+
519+
priv->intr_op = TLMM_TEST_COUNT;
520+
atomic_set(&priv->thread_op_remain, 10);
521+
522+
tlmm_output_low();
523+
524+
tlmm_test_request_hard_irq(test, IRQF_TRIGGER_RISING);
525+
msleep(20);
526+
527+
disable_irq(tlmm_suite.irq);
528+
before_edge = atomic_read(&priv->intr_count);
529+
530+
tlmm_output_high();
531+
msleep(20);
532+
after_edge = atomic_read(&priv->intr_count);
533+
534+
msleep(20);
535+
enable_irq(tlmm_suite.irq);
536+
msleep(20);
537+
538+
free_irq(tlmm_suite.irq, priv);
539+
540+
KUNIT_ASSERT_EQ(test, before_edge, 0);
541+
KUNIT_ASSERT_EQ(test, after_edge, 0);
542+
KUNIT_ASSERT_EQ(test, atomic_read(&priv->intr_count), 1);
543+
}
544+
509545
static int tlmm_test_init(struct kunit *test)
510546
{
511547
struct tlmm_test_priv *priv;
@@ -609,6 +645,7 @@ static struct kunit_case tlmm_test_cases[] = {
609645
KUNIT_CASE(tlmm_test_thread_low),
610646
KUNIT_CASE(tlmm_test_thread_rising_in_handler),
611647
KUNIT_CASE(tlmm_test_thread_falling_in_handler),
648+
KUNIT_CASE(tlmm_test_rising_while_disabled),
612649
{}
613650
};
614651

0 commit comments

Comments
 (0)