input: remotectl: rockchip-pwm: prefer dedicated channel-3 IRQ#503
input: remotectl: rockchip-pwm: prefer dedicated channel-3 IRQ#503rpardini wants to merge 1 commit into
Conversation
On PWM v4 (RK3588), channel 3 of each PWM controller block exposes two interrupts: a group IRQ at index 0 shared with channels 0/1/2 of the same block, and a dedicated capture IRQ at index 1 intended for IR receive / power-key wakeup use of channel 3. The driver always grabbed index 0 and requested it without IRQF_SHARED, which collides with pwm-rockchip when another channel in the same block is enabled (e.g. pwm1 for a fan on the FriendlyElec CM3588-NAS). The in-tree v4 path in pwm-rockchip.c also omits IRQF_SHARED, so probe fails with -EBUSY: remotectl-pwm fd8b0030.pwm: cannot claim IRQ 28 remotectl-pwm: probe of fd8b0030.pwm failed with error -16 Prefer index 1 when present and fall back to index 0 for PWM v1-v3 nodes that only expose a single interrupt. The capture-mode handler (rockchip_pwm_irq_v4) is unchanged and remains correct for the dedicated IRQ. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
WalkthroughThe Rockchip PWM remote control driver probe function modifies IRQ selection to support platform-specific dedicated capture IRQs. Instead of unconditionally acquiring IRQ at index 0, the code now attempts to retrieve IRQ at index 1 (available on PWM v4 / RK3588 hardware) and falls back to index 0 when the dedicated index is unavailable. This change enables efficient IRQ handling on newer hardware while maintaining backward compatibility. Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@drivers/input/remotectl/rockchip_pwm_remotectl.c`:
- Around line 943-945: In rk_pwm_probe(), don't overwrite an initial
-EPROBE_DEFER from the first platform_get_irq(pdev, 1) call: only attempt the
fallback platform_get_irq(pdev, 0) when irq is negative and not -EPROBE_DEFER.
After the (possible) fallback, if irq < 0 set ret = irq (so the function returns
the IRQ error) and goto error_pclk; in particular special-case irq ==
-EPROBE_DEFER after the fallback by setting ret = irq and jumping to error_pclk.
This uses the existing irq and ret variables, the two platform_get_irq(...)
calls, and the error_pclk label in rk_pwm_probe().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c37ae91c-bc84-43ea-832b-2f2d23427c18
📒 Files selected for processing (1)
drivers/input/remotectl/rockchip_pwm_remotectl.c
On PWM v4 (RK3588), channel 3 of each PWM controller block exposes two interrupts: a group IRQ at index 0 shared with channels 0/1/2 of the same block, and a dedicated capture IRQ at index 1 intended for IR receive / power-key wakeup use of channel 3.
The driver always grabbed index 0 and requested it without IRQF_SHARED, which collides with pwm-rockchip when another channel in the same block is enabled (e.g. pwm1 for a fan on the FriendlyElec CM3588-NAS). The in-tree v4 path in pwm-rockchip.c also omits IRQF_SHARED, so probe fails with -EBUSY:
remotectl-pwm fd8b0030.pwm: cannot claim IRQ 28
remotectl-pwm: probe of fd8b0030.pwm failed with error -16
Prefer index 1 when present and fall back to index 0 for PWM v1-v3 nodes that only expose a single interrupt. The capture-mode handler (rockchip_pwm_irq_v4) is unchanged and remains correct for the dedicated IRQ.