0

My Driver Code :

static irqreturn_t pwm_cnt_interrupt(int irq, void *data)
{

    printk("==> %s\r\n", __func__);

    return IRQ_HANDLED;

}

static int ecap_cnt_probe(struct platform_device *pdev)
{

    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;
    }

    /* 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;
    }
    enable_irq(ecapirq);
    return 0;
}

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

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.

Need help on this.

CimCim
  • 48
  • 5
  • waiting for someone response. – Karthikeyan Raju Jun 07 '18 at 06:12
  • There mght be several issues. First, the hardware itself does nothing with the pin in question (use oscilloscope). Next, pin itself is configured wrongly (check pin control configuration for your board). And only then, check the code here, from which I see nothing related to the question. Also, check in sysfs IRQ properties and GPIO / pinctrl status. – 0andriy Jun 07 '18 at 19:52

0 Answers0