From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
To: <vkoul@kernel.org>
Cc: <broonie@kernel.org>, <alsa-devel@alsa-project.org>,
<yung-chuan.liao@linux.intel.com>,
<pierre-louis.bossart@linux.dev>, <Basavaraj.Hiregoudar@amd.com>,
<Sunil-kumar.Dommati@amd.com>, <venkataprasad.potturu@amd.com>,
<Syed.SabaKareem@amd.com>, <Mario.Limonciello@amd.com>,
<Richard.Gong@amd.com>, <linux-sound@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"Vijendar Mukunda" <Vijendar.Mukunda@amd.com>
Subject: [PATCH 9/9] soundwire: amd: consolidate revision-specific probe setup
Date: Thu, 17 Sep 2026 14:32:57 +0530 [thread overview]
Message-ID: <20260917090407.3828816-10-Vijendar.Mukunda@amd.com> (raw)
In-Reply-To: <20260917090407.3828816-1-Vijendar.Mukunda@amd.com>
Determine port counts first via a switch on acp_rev, compute max_ports,
then consolidate all remaining revision-specific assignments
(mmio offset, bus ops, port ops, compute_params, and port_offset_map
allocation) into a single second switch. Both switches reject unknown
revisions with dev_err() and -EINVAL, keeping each switch
self-contained so an incomplete addition of a new revision is caught
at whichever switch it is missing from.
cols_index and rows_index are no longer initialised at probe time;
acp_sdw_clk_init_ctrl() sets them from the actual bus clock and frame
shape before amd_acp63_sdw_set_frameshape() is ever called, so no
early initialisation is needed.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
drivers/soundwire/amd_manager.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 834e943b040b..c660f4c8d0e6 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -1462,16 +1462,9 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
}
amd_manager->ping_slave_stat = U32_MAX;
amd_manager->instance = pdata->instance;
- amd_manager->mmio = amd_manager->acp_mmio +
- (amd_manager->instance * ACP63_SDW_MANAGER_REG_OFFSET);
amd_manager->acp_sdw_lock = pdata->acp_sdw_lock;
amd_manager->acp_rev = pdata->acp_rev;
- amd_manager->cols_index = sdw_find_col_index(AMD_SDW_DEFAULT_COLUMNS);
- amd_manager->rows_index = sdw_find_row_index(AMD_SDW_DEFAULT_ROWS);
amd_manager->dev = dev;
- amd_manager->bus.ops = &amd_acp63_sdw_ops;
- amd_manager->bus.port_ops = &amd_acp63_sdw_port_ops;
- amd_manager->bus.compute_params = &amd_acp63_sdw_compute_params;
amd_manager->bus.clk_stop_timeout = 200;
amd_manager->bus.link_id = amd_manager->instance;
ret = amd_sdw_hw_init_ops(amd_manager);
@@ -1510,13 +1503,30 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
amd_manager->num_din_ports = AMD_ACP70_SDW_MAX_RX_PORTS;
break;
default:
+ dev_err(dev, "unsupported ACP revision: 0x%x\n", amd_manager->acp_rev);
return -EINVAL;
}
amd_manager->max_ports = amd_manager->num_dout_ports + amd_manager->num_din_ports;
- amd_manager->port_offset_map = devm_kcalloc(dev, amd_manager->max_ports,
- sizeof(int), GFP_KERNEL);
- if (!amd_manager->port_offset_map)
- return -ENOMEM;
+
+ switch (amd_manager->acp_rev) {
+ case ACP63_PCI_REV_ID:
+ case ACP70_PCI_REV_ID:
+ case ACP71_PCI_REV_ID:
+ case ACP72_PCI_REV_ID:
+ amd_manager->mmio = amd_manager->acp_mmio +
+ (amd_manager->instance * ACP63_SDW_MANAGER_REG_OFFSET);
+ amd_manager->bus.ops = &amd_acp63_sdw_ops;
+ amd_manager->bus.port_ops = &amd_acp63_sdw_port_ops;
+ amd_manager->bus.compute_params = &amd_acp63_sdw_compute_params;
+ amd_manager->port_offset_map = devm_kcalloc(dev, amd_manager->max_ports,
+ sizeof(int), GFP_KERNEL);
+ if (!amd_manager->port_offset_map)
+ return -ENOMEM;
+ break;
+ default:
+ dev_err(dev, "unsupported ACP revision: 0x%x\n", amd_manager->acp_rev);
+ return -EINVAL;
+ }
prop = &amd_manager->bus.prop;
prop->mclk_freq = AMD_SDW_BUS_BASE_FREQ;
--
2.48.1
prev parent reply other threads:[~2026-09-17 9:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 9:02 [PATCH 0/9] soundwire: amd: introduce hw_ops dispatch and consolidate " Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 1/9] soundwire: amd: rename AMD_SDW_MAX_MANAGER_COUNT macro Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 2/9] soundwire: amd: allocate pdevinfo and sdw_pdata by ACP revision in probe Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 3/9] soundwire: amd: allocate sdw_amd_ctx pdev array dynamically Vijendar Mukunda
2026-10-03 7:52 ` Vinod Koul
2026-09-17 9:02 ` [PATCH 4/9] soundwire: amd: rename hardware backend functions to amd_acp63_*() prefix Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 5/9] soundwire: amd: remove unused AMD_SDW_MAX_FREQ_NUM define Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 6/9] soundwire: amd: introduce struct amd_sdw_hw_ops dispatch framework Vijendar Mukunda
2026-10-03 7:56 ` Vinod Koul
2026-09-17 9:02 ` [PATCH 7/9] soundwire: amd: convert irq/work handlers to hw_ops callbacks Vijendar Mukunda
2026-09-17 9:02 ` [PATCH 8/9] soundwire: amd: wire amd_acp63_*() call sites through acp_*() helpers Vijendar Mukunda
2026-09-17 9:02 ` Vijendar Mukunda [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917090407.3828816-10-Vijendar.Mukunda@amd.com \
--to=vijendar.mukunda@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Richard.Gong@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=Syed.SabaKareem@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=venkataprasad.potturu@amd.com \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®