Skip to content

input: remotectl: rockchip-pwm: prefer dedicated channel-3 IRQ#503

Open
rpardini wants to merge 1 commit into
armbian:rk-6.1-rkr5.1from
rpardini:input-remotectl-rockchip-pwm-irq-fix
Open

input: remotectl: rockchip-pwm: prefer dedicated channel-3 IRQ#503
rpardini wants to merge 1 commit into
armbian:rk-6.1-rkr5.1from
rpardini:input-remotectl-rockchip-pwm-irq-fix

Conversation

@rpardini

Copy link
Copy Markdown
Member

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.

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>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preferring the dedicated channel-3 IRQ (index 1) over the shared group IRQ (index 0) in the rockchip PWM remotectl driver.
Description check ✅ Passed The description clearly explains the problem (IRQ conflict on PWM v4), the root cause (incorrect IRQ index selection), and the solution (prefer index 1 with fallback to index 0).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 64a8171 and 9623a2e.

📒 Files selected for processing (1)
  • drivers/input/remotectl/rockchip_pwm_remotectl.c

Comment thread drivers/input/remotectl/rockchip_pwm_remotectl.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant