Hi,
I am working on reading PWM-Fan speed. With PWM-CAPTURE , we are not able to implement interrupt for the PWM module -- in dts file -- am33cx.dtsi also not given any interrupt reference --
epwmss0: epwmss@48300000 {
compatible = "ti,am33xx-pwmss";
reg = <0x48300000 0x10>;
ti,hwmods = "epwmss0";
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
ranges = <0x48300100 0x48300100 0x80 /* ECAP */
0x48300180 0x48300180 0x80 /* EQEP */
0x48300200 0x48300200 0x80>; /* EHRPWM */
ecap0: ecap@48300100 {
compatible = "ti,am33xx-ecap";
#pwm-cells = <3>;
reg = <0x48300100 0x80>;
ti,hwmods = "ecap0";
status = "disabled";
};
ehrpwm0: ehrpwm@48300200 {
compatible = "ti,am33xx-ehrpwm";
#pwm-cells = <3>;
reg = <0x48300200 0x80>;
ti,hwmods = "ehrpwm0";
status = "disabled";
};
};
So we like to use timer : timer 5: in dts file :
timer5: timer@48046000 {
compatible = "ti,am335x-timer";
reg = <0x48046000 0x400>;
interrupts = <93>;
ti,hwmods = "timer5";
ti,timer-pwm; //1. why "ti,timer-pwm" is given for timer5,6 ..??? //1. can we able to load the timer with this parameter.??
};
timer6: timer@48048000 {
compatible = "ti,am335x-timer";
reg = <0x48048000 0x400>;
interrupts = <94>;
ti,hwmods = "timer6";
ti,timer-pwm;
};
------ so i implemented the the timer interrupt in driver/pwm/pwm-tiecap.c -- this is in pwm-ecap probe function --
irq = platform_get_irq(pdev, 93);
irq = 93; -- we are getting -6 as error so we manually given to register the interrupt
printk(KERN_INFO "timer 5 irq:%d \n",irq);
ret = devm_request_irq(&pdev->dev, irq,timer5_irq_handler,
__IRQF_TIMER | IRQF_TRIGGER_RISING, "timer5", pc);
if (ret) {
dev_err(&pdev->dev, "Timer 5 for pwm cap IRQ request failed\n");
goto err;
}
irq = platform_get_irq(pdev, 94);
irq = 94;
printk(KERN_INFO "timer 6 irq:%d \n",irq);
ret = devm_request_irq(&pdev->dev, irq, timer6_irq_handler,
__IRQF_TIMER | IRQF_TRIGGER_RISING, "timer6", pc);
if (ret) {
dev_err(&pdev->dev, "Timer 5 for pwm cap IRQ request failed\n");
goto err;
}
and also we are using another timer for 1sec time counter --
/* setup your timer to call my_timer_callback */
setup_timer(&my_timer, ecap_timer_callback, 0);
/* setup timer interval to 200 msecs changed to 1 sec s0 1000 */
mod_timer(&my_timer, jiffies + msecs_to_jiffies(1000));
but i am getting error in the kernel bootlog--
pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[ 0.927537] timer 5 irq:93
[ 0.927637] timer 6 irq:94
[ 0.932215] timer 5 irq:93
[ 0.932275] genirq: Flags mismatch irq 93. 00000201 (timer5) vs. 00000201 (timer5)
[ 0.932315] ecap 48304100.ecap: Timer 5 for pwm cap IRQ request failed
[ 0.932430] ecap: probe of 48304100.ecap failed with error -16
and with both timers we are getting kernel panic also:
//interrupt 94 is given to the timer6 in the dts file -- might the same interrupt is using to wakeup CPU for remoteproc0
[ 6.619412] genirq: Flags mismatch irq 94. 00000020 (wkup_m3_txev) vs. 00000201 (timer6)
[ 6.628036] wkup_m3 44d00000.wkup_m3: request_irq failed
[ 6.633666] remoteproc0: releasing wkup_m3
[ 6.640190] wkup_m3: probe of 44d00000.wkup_m3 failed with error -16
[ 6.647054] ------------[ cut here ]------------
[ 6.651970] WARNING: CPU: 0 PID: 50 at arch/arm/mach-omap2/omap_hwmod.c:2270 _idle+0x1cc/0x218()
[ 6.661189] omap_hwmod: wkup_m3: idle state can only be entered from enabled state
[ 6.669128] Modules linked in:
[ 6.672366] CPU: 0 PID: 50 Comm: kworker/0:1 Not tainted 3.14.26-g2489c02-dirty #249
[ 6.680518] Workqueue: pm pm_runtime_work
[ 6.684733] Backtrace:
[ 6.687355] [<c0011268>] (dump_backtrace) from [<c0011404>] (show_stack+0x18/0x1c)
[ 6.695302] r6:000008de r5:00000009 r4:cf0c3dc0 r3:c082f100
[ 6.701322] [<c00113ec>] (show_stack) from [<c05b01b4>] (dump_stack+0x20/0x28)
[ 6.708938] [<c05b0194>] (dump_stack) from [<c00381f8>] (warn_slowpath_common+0x6c/0x8c)
[ 6.717449] [<c003818c>] (warn_slowpath_common) from [<c00382bc>] (warn_slowpath_fmt+0x38/0x40)
[ 6.726574] r8:c082dc08 r7:00000008 r6:00000000 r5:cf0cd140 r4:c0827630
[ 6.733674] [<c0038288>] (warn_slowpath_fmt) from [<c0024594>] (_idle+0x1cc/0x218)
[ 6.741616] r3:c07208cc r2:c071e9b8
[ 6.745407] [<c00243c8>] (_idle) from [<c0024ae8>] (omap_hwmod_idle+0x20/0x34)
[ 6.752984] r5:cf0cd140 r4:a0000113
[ 6.756776] [<c0024ac8>] (omap_hwmod_idle) from [<c0026100>] (omap_device_idle+0x44/0x80)
[ 6.765354] r4:00000001 r3:cf0cd100
[ 6.769140] [<c00260bc>] (omap_device_idle) from [<c0026160>] (_od_runtime_suspend+0x24/0x2c)
[ 6.778081] r5:cf0cea10 r4:00000000
[ 6.781868] [<c002613c>] (_od_runtime_suspend) from [<c0367000>] (rpm_callback+0xa4/0xc0)
[ 6.790445] r5:0000000a r4:cf0cea10
[ 6.794229] [<c0366f5c>] (rpm_callback) from [<c0367474>] (rpm_suspend+0xf0/0x494)
[ 6.802174] r6:00000000 r5:0000000a r4:00000000 r3:c08240e8
[ 6.808168] [<c0367384>] (rpm_suspend) from [<c03678f8>] (rpm_idle+0x84/0x1b8)
[ 6.815744] r10:00000000 r9:cf0c2000 r8:00000000 r7:cfbd4a00 r6:00000002 r5:cf0cea10
[ 6.824008] r4:00000000
[ 6.826691] [<c0367874>] (rpm_idle) from [<c0368670>] (pm_runtime_work+0x88/0xa4)
[ 6.834541] r6:c082dfe4 r5:cf0ceaa0 r4:cf0ba380 r3:00000080
[ 6.840547] [<c03685e8>] (pm_runtime_work) from [<c004ae0c>] (process_one_work+0xfc/0x338)
[ 6.849239] [<c004ad10>] (process_one_work) from [<c004b1a0>] (worker_thread+0x11c/0x364)
[ 6.857819] r10:c0865f9f r9:c082dfe4 r8:00000001 r7:cf0c2000 r6:cf0ba398 r5:c082dff4
[ 6.866080] r4:cf0ba380
[ 6.868771] [<c004b084>] (worker_thread) from [<c0050d14>] (kthread+0xc4/0xe0)
[ 6.876351] r10:00000000 r9:00000000 r8:00000000 r7:c004b084 r6:cf0ba380 r5:cf0b7100
[ 6.884612] r4:00000000
[ 6.887300] [<c0050c50>] (kthread) from [<c000e878>] (ret_from_fork+0x14/0x3c)
[ 6.894878] r7:00000000 r6:00000000 r5:c0050c50 r4:cf0b7100
[ 6.900858] ---[ end trace d66f6f2f3b0a457e ]---
doubts:
1. pwm-ecap has no interrupt -- node information for the timer interrupt for registration is pwm-node information -- here i am not getting how to register the timer interrupt with timer node information which is to get from dts time ---- this timer 5 and 6 are required for capturing
please help us in this issue.
regards,
Viswanath K