soundwire: amd: introduce hw_ops dispatch and split driver into revision-specific files
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest11 patches 0 repliesNew
- v311 patches 0 repliesSuperseded
- v29 patches 0 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 9 patches | 4 replies | Superseded |
Changes in v4 from the cover letter
- Rebase on AMD SoundWire fix series v6 (23 patches) in place of v5 (25 patches); all context lines and base commit SHAs updated throughout.
- Patch 6: expand @suspend_runtime comment in struct amd_sdw_hw_ops to describe how it differs from @suspend: runtime suspend arms host-wake interrupts so the hardware can wake the host, whereas system suspend disarms them.
- Patch 8: drop dev_err_ratelimited() from amd_acp63_sdw_read_and_process_ping_status() and amd_acp63_sdw_read_ping_status() for ping-status timeout; timeouts are already tracked by the cache introduced in the fix series.
- Patch 9: keep amd_sdw_fill_slave_status() static in amd_manager_common.c; remove the declaration from amd_manager.h (the function is called only within amd_manager_common.c).
- Patch 10: use local dev variable in dev_err() call consistently with the rest of the function.
- Patch 11: drop the second switch/case block from amd_sdw_clock_stop(); ACP_SW_WAKE_EN is valid for all supported revisions so the wake_en_mask write does not need per-revision dispatch.
- Link to v3:
https://lore.kernel.org/linux-sound/[email protected]
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/11 | soundwire: amd: rename AMD_SDW_MAX_MANAGER_COUNT macrodrivers/ drivers/ include/ | +5 | 0 replies | |
| 2/11 | soundwire: amd: allocate pdevinfo and sdw_pdata by ACP revision in probedrivers/ | +33 | 0 replies | |
| 3/11 | soundwire: amd: allocate sdw_amd_ctx pdev array dynamicallydrivers/ include/ | +14 | 0 replies | |
| 4/11 | soundwire: amd: rename hardware backend symbols to amd_acp63_*() prefixdrivers/ drivers/ | +112 | 0 replies | |
| 5/11 | soundwire: amd: remove unused AMD_SDW_MAX_FREQ_NUM definedrivers/ | +0 | 0 replies | |
| 6/11 | soundwire: amd: introduce struct amd_sdw_hw_ops dispatch frameworkdrivers/ include/ | +181 | 0 replies | |
| 7/11 | soundwire: amd: dispatch irq/work handlers to per-revision functionsdrivers/ | +38 | 0 replies | |
| 8/11 | soundwire: amd: populate hw_ops and wire all call sites through acp_*() helpersdrivers/ drivers/ | +208 | 0 replies | |
| 9/11 | soundwire: amd: extract shared functions into amd_manager_common.cdrivers/ drivers/ drivers/ +1 more | +880 | 0 replies | |
| 10/11 | soundwire: amd: guard DAI PCM caps by acp_rev in register_dais()drivers/ | +12 | 0 replies | |
| 11/11 | soundwire: amd: guard clock-stop register access by acp_revdrivers/ | +16 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 00/11] soundwire: amd: introduce hw_ops dispatch and split driver into revision-specific files
This series refactors the AMD SoundWire manager driver to replace direct calls to ACP6.3-specific hardware functions with a function-pointer dispatch table (struct amd_sdw_hw_ops). The goal is to make adding support for new ACP revisions a matter of registering a revision-specific ops table rather than scattering switch/case statements across the driver.
The series also consolidates probe-time revision-specific assignments into explicit switch blocks, replaces fixed-size arrays in sdw_amd_ctx with dynamically-allocated ones sized from the ACP revision, and cleans up a few stale symbols and redundant initialisations.
Background:
The AMD SoundWire IP block was introduced on ACP6.3 and is shared by ACP7.0, ACP7.1 and ACP7.2 with minor register-level differences. The driver previously used a flat, hardcoded naming scheme (amd_sdw_*) with no mechanism to swap hardware implementations per revision. The amd_acp63_* prefix and the hw_ops dispatch table introduced here make the per-revision nature explicit and provide a clean extension point for future platforms.
Changes since v3:
- Rebase on AMD SoundWire fix series v6 (23 patches) in place of v5 (25 patches); all context lines and base commit SHAs updated throughout.
- Patch 6: expand @suspend_runtime comment in struct amd_sdw_hw_ops to describe how it differs from @suspend: runtime suspend arms host-wake interrupts so the hardware can wake the host, whereas system suspend disarms them.
- Patch 8: drop dev_err_ratelimited() from amd_acp63_sdw_read_and_process_ping_status() and amd_acp63_sdw_read_ping_status() for ping-status timeout; timeouts are already tracked by the cache introduced in the fix series.
- Patch 9: keep amd_sdw_fill_slave_status() static in amd_manager_common.c; remove the declaration from amd_manager.h (the function is called only within amd_manager_common.c).
- Patch 10: use local dev variable in dev_err() call consistently with the rest of the function.
- Patch 11: drop the second switch/case block from amd_sdw_clock_stop(); ACP_SW_WAKE_EN is valid for all supported revisions so the wake_en_mask write does not need per-revision dispatch.
- Link to v3:
https://lore.kernel.org/linux-sound/[email protected]
Changes since v2:
- Add patch 10: guard DAI PCM caps by acp_rev in register_dais(); replaces bare stream->rates and stream->formats assignments with an explicit switch/case returning -EINVAL for unrecognised revisions.
- Add patch 11: guard clock-stop register access by acp_rev in amd_sdw_clock_stop(); replaces open-coded accesses with an explicit switch/case returning -EINVAL for unrecognised revisions.
- Patch 4 extended: also rename pad control helpers introduced by the fix series (amd_sdw_pad_ctrl_supported to amd_acp63_sdw_pad_ctrl_supported, __amd_sdw_oe_update to __amd_acp63_sdw_oe_update) to the amd_acp63_* prefix.
- Patch 8 updated: rename amd_enable_sdw_pads() to amd_acp63_enable_sdw_pads() in amd_init.c; the CLK_STOP_MODE path in amd_acp63_sdw_suspend() now gains the same interrupt-gate and work-drain sequence present in the POWER_OFF_MODE paths; amd_sdw_host_wake_enable_by_rev() is called in CLK_STOP_MODE to disable wake signalling before clock stop.
- Patch 9: commit message reformatted as a bullet list for clarity; amd_sdw_hw_init_ops() dispatch wrapper documented explicitly.
- Rebased on top of the AMD SoundWire fix series v5 (25 patches).
- Link to v2:
https://lore.kernel.org/all/[email protected]/
Changes since v1:
- Patch 4 subject updated: "rename hardware backend symbols" (covers functions, op-table instances, and the register-offset constant)
- Patch 6: removed the forward reference to "subsequent patches" from the commit message; dropped WARN_ONCE guards from dispatch helpers
- Patch 7: commit message corrected; #include <linux/workqueue.h> addition dropped (available transitively)
- Patch 8: amd_sdw_hw_init_ops() now uses a static const struct amd_sdw_hw_ops instead of devm_kzalloc; amd_sdw_hw_init_ops() moved after amd_sdw_manager_remove() with a forward declaration before probe to resolve ordering
- Patch 9 (new): splits amd_manager.c into amd_manager_common.c (shared revision-independent functions, analogous to cadence_master.c) and renames what remains to amd_acp63_manager.c (ACP6.3/7.x register- level backend, analogous to intel_auxdevice.c)
Dependencies:
This series applies on top of the AMD SoundWire fix series (v6, 23 patches) posted at:
https://lore.kernel.org/linux-sound/[email protected]
Vijendar Mukunda (11):
soundwire: amd: rename AMD_SDW_MAX_MANAGER_COUNT macro
soundwire: amd: allocate pdevinfo and sdw_pdata by ACP revision in
probe
soundwire: amd: allocate sdw_amd_ctx pdev array dynamically
soundwire: amd: rename hardware backend symbols to amd_acp63_*()
prefix
soundwire: amd: remove unused AMD_SDW_MAX_FREQ_NUM define
soundwire: amd: introduce struct amd_sdw_hw_ops dispatch framework
soundwire: amd: dispatch irq/work handlers to per-revision functions
soundwire: amd: populate hw_ops and wire all call sites through
acp_*() helpers
soundwire: amd: extract shared functions into amd_manager_common.c
soundwire: amd: guard DAI PCM caps by acp_rev in register_dais()
soundwire: amd: guard clock-stop register access by acp_rev
drivers/soundwire/Makefile | 2 +-
.../{amd_manager.c => amd_acp63_manager.c} | 934 ++++--------------
drivers/soundwire/amd_init.c | 54 +-
drivers/soundwire/amd_manager.h | 258 +++--
drivers/soundwire/amd_manager_common.c | 809 +++++++++++++++
include/linux/soundwire/sdw_amd.h | 11 +-
6 files changed, 1236 insertions(+), 832 deletions(-)
rename drivers/soundwire/{amd_manager.c => amd_acp63_manager.c} (52%)
create mode 100644 drivers/soundwire/amd_manager_common.cSignature · 1 line
2.53.0