AnsweredAssumed Answered

PWM - IRQ - Handler not get called

Question asked by Karthikeyan Raju on Jun 6, 2018
Latest reply on Jun 6, 2018 by Karthikeyan Raju

My Driver Code :

/*
 * ISR for PWM Counter
 */
static irqreturn_t pwm_cnt_interrupt(int irq, void *data)
{
        printk("==> %s\r\n", __func__);

 

        //ecap_configure(globle_dev);
        //ecap_intr_event(globle_dev);
    return IRQ_HANDLED;
}


static int ecap_cnt_probe(struct platform_device *pdev)
{
     printk("KARTHIK ==> %s\r\n", __func__);
    struct device_node *np = pdev->dev.of_node;
    int ret, ecapirq;
    struct resource *r;
    struct clk *clk;
    struct ecap_device *pc;

 

    pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
    if (!pc)
        return -ENOMEM;

 

    clk = devm_clk_get(&pdev->dev, "fck");
    if (IS_ERR(clk)) {
        if (of_device_is_compatible(np, "ti,counter-ecap")) {
            dev_warn(&pdev->dev, "Binding is obsolete.\n");
            clk = devm_clk_get(pdev->dev.parent, "fck");
        }
    }

 

    if (IS_ERR(clk)) {
        dev_err(&pdev->dev, "failed to get clock\n");
        return PTR_ERR(clk);
    }

 

    pc->clk_rate = clk_get_rate(clk);
    if (!pc->clk_rate) {
        dev_err(&pdev->dev, "failed to get clock rate\n");
        return -EINVAL;
    }

 

     r = platform_get_resource(pdev, IORESOURCE_MEM, 0);

    pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
    if (IS_ERR(pc->mmio_base))
        return PTR_ERR(pc->mmio_base);

 

        globle_dev = pc;
    
        /* Get PWM IRQ number */
        ecapirq = platform_get_irq(pdev, 0);
        if (ecapirq < 0) {
            printk(KERN_ERR "Could not get IRQ");
            return -EINVAL;
        }
        printk(KERN_DEBUG "irq =  %d\n", ecapirq);

 

        oreore_dentry = debugfs_create_file("counter", 0666, NULL, &value, &fops);

 

    if(request_irq(ecapirq, pwm_cnt_interrupt, IRQF_SHARED,
                        "counter", (void *)&counter)) {
                printk(KERN_ERR "pwm counter: Can't allocate irq %d\n",
                ecapirq);
                return -EBUSY;
        }

 

    INIT_DELAYED_WORK(&pc->work, capture_polling);
    mutex_init(&pc->counter);

 

    platform_set_drvdata(pdev, pc);
        printk("TP7 ==> %s\r\n", __func__);

 

    return 0;
}

 

My Interrupt got registed in /proc/interrupts But, Its not get triggered.

 

Kernel Log:

#cat /proc/interrupts

190:          1      INTC  37 Level     SGX ISR
191:          0      INTC   7 Level     txsky button
192:          0      INTC  31 Level     counter
194:          8      INTC  18 Level     musb-hdrc.0
195:          8      INTC  19 Level     musb-hdrc.1

 

I have connected UART with my pwm interrupt pin. I m sending data using uart port. my irq handler is not get called at that time.

 

 

Can anyone help me resolve this issue.

Outcomes