rockchip64: rk3588: add I2S MCLK output gate clocks for audio codec support#9548
Conversation
Replace the single combined MCLK gate patch with three separate patches matching the upstream series submitted to LKML: 1. dt-bindings: add I2S MCLK output to IO clock IDs (722-725) 2. clk: rockchip: allow grf_type_sys lookup in aux_grf_table 3. clk: rockchip: rk3588: add GATE_GRF clocks for I2S MCLK output Key changes from the previous combined patch: - Use grf_type_sys instead of grf_type_ioc - Add all four I2S MCLK output gates (not just I2S0) - Use GFLAGS macro for consistency - Place each GATE_GRF after its parent MCLKOUT - No subscope in init function 6.18 uses kzalloc(sizeof(...)) as kzalloc_obj is not available. 7.0 uses kzalloc_obj as recommended by upstream reviewer. Upstream: https://lore.kernel.org/linux-rockchip/20260316-rk3588-mclk-gate-grf-v1-0-66fb9a246718@superkali.me/
📝 WalkthroughWalkthroughThis PR introduces kernel patches for RK3588 I2S MCLK output-to-IO gating control across kernel versions 6.18 and 7.0. Each version includes three feature patches (bindings, clock registration, and GRF gates) followed by a removal patch that retracts all additions, resulting in no net functional changes to the kernel code. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@patch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate-3-gate-grf-clocks.patch`:
- Around line 101-109: The current SYS_GRF registration can fail
(syscon_regmap_lookup_by_compatible or kzalloc) but the code still leaves the
four _TO_IO gates using ctx->grf as a fallback; change the logic so SYS_GRF is
treated as an all-or-nothing dependency: allocate and add sys_grf_e (with fields
grf and type = grf_type_sys) to ctx->aux_grf_table only on full success, and
ensure the four _TO_IO gate registrations are not added/registered anywhere
unless that sys_grf registration succeeded — implement this by moving those
_TO_IO gate entries into a small temporary array or deferred registration path
and only register/attach that array after sys_grf_e was successfully created and
hash_add-ed, otherwise skip/leave those gates unregistered so they cannot fall
back to ctx->grf.
In
`@patch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate-3-gate-grf-clocks.patch`:
- Around line 101-109: The current SYS_GRF setup
(syscon_regmap_lookup_by_compatible -> sys_grf, allocation into sys_grf_e via
kzalloc_obj, and hash_add into ctx->aux_grf_table) can fail and leave the _TO_IO
gates falling back to ctx->grf; instead, ensure the _TO_IO gate registrations
only happen after both lookup and allocation succeed: perform
syscon_regmap_lookup_by_compatible("rockchip,rk3588-sys-grf"), allocate
sys_grf_e, populate sys_grf_e->grf and ->type, and only then register the
related _TO_IO gates (e.g., by adding them into a mini-array and calling the
existing registration path or hash_add into ctx->aux_grf_table); if either
lookup or kzalloc_obj fails, do not register those gates and do not touch
ctx->grf so no fallback occurs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0b3b0ec7-94a0-426a-ae5e-0a07fb4b535f
📒 Files selected for processing (8)
patch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate-1-bindings.patchpatch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate-2-allow-grf-type-sys.patchpatch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate-3-gate-grf-clocks.patchpatch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate.patchpatch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate-1-bindings.patchpatch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate-2-allow-grf-type-sys.patchpatch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate-3-gate-grf-clocks.patchpatch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate.patch
💤 Files with no reviewable changes (2)
- patch/kernel/archive/rockchip64-6.18/general-rk3588-i2s-mclk-output-gate.patch
- patch/kernel/archive/rockchip64-7.0/general-rk3588-i2s-mclk-output-gate.patch
|
✅ This PR has been reviewed and approved — all set for merge! |
Description
Follow-up to #9534. Replaces the single combined MCLK gate patch with three separate patches matching the upstream series submitted to LKML:
Key changes from #9534:
Upstream: https://lore.kernel.org/linux-rockchip/20260316-rk3588-mclk-gate-grf-v1-0-66fb9a246718@superkali.me/
How Has This Been Tested?
Checklist:
Summary by CodeRabbit
Release Notes