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.
Hi Karthikeyan
issue may be debugged with AN4553 Using Open Source Debugging Tools for Linux on i.MX Processors
https://www.nxp.com/docs/en/application-note/AN4553.pdf
examples of gpt capture can be found in sdk (please check zip on https://community.nxp.com/thread/432859 )
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor,
I think this is not the one i m looking for.
I just want the guidance for PWM IRQ interrupt call.
I have verified with some irq request calls, i didnt find any difference.
Is anything i need to follow specifically for the PWM ?
Please provide the guidance based on this code.