mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 00/11] soundwire: amd: introduce hw_ops dispatch and split driver into revision-specific files
@ 2026-11-17  7:18 Vijendar Mukunda
  2026-11-17  7:18 ` [PATCH v4 01/11] soundwire: amd: rename AMD_SDW_MAX_MANAGER_COUNT macro Vijendar Mukunda
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Vijendar Mukunda @ 2026-11-17  7:18 UTC (permalink / raw)
  To: vkoul
  Cc: yung-chuan.liao, pierre-louis.bossart, Basavaraj.Hiregoudar,
	Sunil-kumar.Dommati, venkataprasad.potturu, Syed.SabaKareem,
	Mario.Limonciello, Richard.Gong, Poojitha.N, linux-sound,
	linux-kernel, Vijendar Mukunda

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/20261107161345.3411491-1-Vijendar.Mukunda@amd.com

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/20261013100306.2921771-2-Vijendar.Mukunda@amd.com/

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/20261117070906.803139-1-Vijendar.Mukunda@amd.com

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.c

-- 
2.53.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-17  7:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  7:18 [PATCH v4 00/11] soundwire: amd: introduce hw_ops dispatch and split driver into revision-specific files Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 01/11] soundwire: amd: rename AMD_SDW_MAX_MANAGER_COUNT macro Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 02/11] soundwire: amd: allocate pdevinfo and sdw_pdata by ACP revision in probe Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 03/11] soundwire: amd: allocate sdw_amd_ctx pdev array dynamically Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 04/11] soundwire: amd: rename hardware backend symbols to amd_acp63_*() prefix Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 05/11] soundwire: amd: remove unused AMD_SDW_MAX_FREQ_NUM define Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 06/11] soundwire: amd: introduce struct amd_sdw_hw_ops dispatch framework Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 07/11] soundwire: amd: dispatch irq/work handlers to per-revision functions Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 08/11] soundwire: amd: populate hw_ops and wire all call sites through acp_*() helpers Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 09/11] soundwire: amd: extract shared functions into amd_manager_common.c Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 10/11] soundwire: amd: guard DAI PCM caps by acp_rev in register_dais() Vijendar Mukunda
2026-11-17  7:18 ` [PATCH v4 11/11] soundwire: amd: guard clock-stop register access by acp_rev Vijendar Mukunda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®