Dear community!
I would like to ask you a question whether is possible to use PWM interrupt on i.MX8mp. I wanted to create a custom driver and be notified when PWM output is going down (FALLING_EDGE). Is it even possible to be achieve it, or not just by design?
In the DTB
// imx8mp.dtsi
pwm1: pwm@30660000 {
compatible = "fsl,imx8mp-pwm", "fsl,imx27-pwm";
reg = <0x30660000 0x10000>;
interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MP_CLK_PWM1_ROOT>,
<&clk IMX8MP_CLK_PWM1_ROOT>;
clock-names = "ipg", "per";
#pwm-cells = <3>;
status = "disabled";
};
// imx8mp-my-device.dts
cam_trigger: cam-trigger {
compatible = "company,cam-trigger";
pwms = <&pwm1 0 8333333 0>;
interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
};
&iomuxc {
pinctrl-names = "default";
pinctrl_pwm1: pwm1grp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO01__PWM1_OUT 0x116
>;
};
};
&pwm1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm1>;
status = "okay";
};
is a <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH> entry. So I registered to this interrupt via devm_request_irq and verified it in /proc/interrupt, that registration was successful. (Even if I wanted to have a falling edge, I used just something.) But the interrupt didn't happen.
After deeper analysis I realized, that i.MX8 has an PWMIR register, but the handling is missing in pwm-imx27 driver. I guess that would be the reason why... .
Now the questions are:
- Is my meaning true?
- How hard is to implement such a mechanism into driver.
- According to DS, just a capture should be enough
- What the GIC_SPI 81 is meaning then? Does it mean that is it there just "for fun" ?
- Is there an another way how to be notified when interrupt happens?
- HW modifications like routing the output pin to other input GPIO are not possible
Many thanks for any inputs.
Andy