Skip to content

ASoC: SOF: amd: add SOF support for ACP7.B/7.F platforms#5813

Open
vijendarmukunda wants to merge 15 commits into
thesofproject:topic/sof-devfrom
vijendarmukunda:topic/sof-dev
Open

ASoC: SOF: amd: add SOF support for ACP7.B/7.F platforms#5813
vijendarmukunda wants to merge 15 commits into
thesofproject:topic/sof-devfrom
vijendarmukunda:topic/sof-dev

Conversation

@vijendarmukunda

Copy link
Copy Markdown

ASoC: SOF: amd: add SOF support for ACP7.B/7.F platforms

This series adds Sound Open Firmware (SOF) support for the AMD Audio
Co-Processor revisions ACP7.B (PCI rev 0x7B) and ACP7.F (PCI rev 0x7F),
covering machine table registration, base platform infrastructure,
firmware loading, I2S/TDM topology, and power management.

ACP7.B/7.F are new AMD SoC variants that require:

  • A dedicated PCI device entry and ops structure built on top of the
    existing ACP6x/ACP70 SOF infrastructure.
  • Signed firmware loaded via SHA DMA to SRAM (instead of DRAM used by
    earlier revisions).
  • An updated PGFSM tile-status poll mask restricted to tiles P0-P4.
  • A new IRQ handler that reads the DSP SW interrupt status through the
    chip descriptor's dsp_intr_base, with additional error IRQ detection
    and reporting via the chip descriptor's ext_intr_stat and
    acp_error_stat fields.
  • A new SOF_DAI_AMD_I2S DAI type and ACPTDM topology token group for
    the ACP7x I2S/TDM interfaces, including an ACPTDM format field in the
    IPC3 DAI parameters structure.
  • System and runtime PM suspend/resume paths.

The series is structured to minimize changes to shared code paths. Where
existing helpers are extended (configure_and_run_sha_dma, signed firmware
pre-run, SW1 error-reason clear), the extension is additive and guarded
by the pci_rev or ACPI property so that existing platforms are not
affected.

Add snd_soc_acpi_amd_acp7x_sof_machines[] ACPI machine table for ACP7.B
and ACP7.F PCI revision based platforms. Add the extern declaration to
mach-config.h so that it can be referenced from the SOF PCI driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>

Copilot AI 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.

Pull request overview

This PR adds Sound Open Firmware (SOF) enablement for AMD ACP7.B/ACP7.F platforms by introducing a dedicated ACP7x PCI driver/ops layer built on the existing ACP SOF infrastructure, plus required IPC3 topology/token extensions for ACP7x I2S/TDM.

Changes:

  • Add new ACP7x PCI driver + DSP ops, including suspend/resume and IRQ handling paths.
  • Extend AMD ACP firmware loading logic for signed images and SRAM-based data loading on ACP7x.
  • Introduce a new SOF DAI type for AMD I2S/TDM and extend IPC3 topology tokens to carry an ACP TDM/I2S format field.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sound/soc/sof/topology.c Map new ACP TDM/I2S DAI name to the new AMD I2S DAI type and include it in token selection.
sound/soc/sof/ipc3-topology.c Add ACP format token and a new ACP I2S/TDM link loader for IPC3.
sound/soc/sof/ipc3-pcm.c Add hw-params fixup for the new AMD I2S/TDM DAI type.
sound/soc/sof/amd/pci-acp7x.c New ACP7x PCI driver description/probe/remove wiring for SOF.
sound/soc/sof/amd/Makefile Build integration for the new ACP7x objects/module.
sound/soc/sof/amd/Kconfig New Kconfig option to enable ACP7x SOF support.
sound/soc/sof/amd/acp7x.c New ACP7x-specific SOF DAI list and ops init (ACPI property-driven behavior).
sound/soc/sof/amd/acp.h Add ACP7x revision IDs, masks, image header constants, and per-device flags.
sound/soc/sof/amd/acp.c Extend generic ACP code for ACP7x init/power-on/masks, add ACP7x probe/remove/PM hooks and IRQ handler.
sound/soc/sof/amd/acp-loader.c Update pre-run sizing logic for signed firmware and load signed data to SRAM on ACP7x.
sound/soc/sof/amd/acp-ipc.c Adjust host->DSP SW interrupt trigger register offset selection for ACP7x.
sound/soc/sof/amd/acp-dsp-offset.h Add ACP7x register offsets needed for IRQ/status/error handling and PM.
sound/soc/amd/mach-config.h Export declaration for ACP7x SOF machine table.
sound/soc/amd/acp-config.c Add ACP7x SOF machine table entry (ACPI ID → driver/topology/firmware).
include/uapi/sound/sof/tokens.h Add a new UAPI token for ACP I2S/TDM format.
include/sound/sof/dai.h Add new SOF DAI type for AMD I2S/TDM and union storage for ACP I2S params.
include/sound/sof/dai-amd.h Extend ACP DAI params with a format field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sound/soc/sof/amd/acp7x.c
Comment thread sound/soc/sof/amd/acp7x.c
Comment thread sound/soc/sof/amd/acp.c
Comment thread sound/soc/sof/amd/acp-loader.c
Comment thread sound/soc/sof/amd/acp-loader.c
Comment thread sound/soc/sof/amd/pci-acp7x.c
Add SOF support for ACP7.B and ACP7.F PCI revision based platforms.
This covers Kconfig/Makefile entries, register offset definitions,
DMA descriptor/channel/status paths, PGFSM power-on handling,
PCI device driver, I2S/DMIC DAI definitions, and IPC SW interrupt
trigger offset selection for ACP7.B/7.F.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
For ACP7.B/7.F, poll only the PGFSM tile status bits (P0-P4) and
consider the tiles powered on when the masked status becomes 0.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Replace the open-coded pci_rev comparison with a switch statement for
clearing ACP_SW1_I2S_ERROR_REASON. This makes the per-platform control
explicit and easier to extend.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add amd_sof_acp7x_probe() and amd_sof_acp7x_remove() for ACP7.B/7.F.
Wire probe and remove into sof_acp7x_ops_init().

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add acp7x_irq_handler() and register it from amd_sof_acp7x_probe() for
DSP doorbell IPC interrupts on ACP7.B/7.F.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Parse SizeFWSigned from the ACP image header when loading signed
firmware on ACP7.B/7.F platforms. Keep the legacy
ACP_FIRMWARE_SIGNATURE subtraction for pre-7B platforms using quirks.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reject ACP7.B/7.F signed firmware loads when the image is not large
enough to contain the ACP header before reading SizeFWSigned from a
fixed offset.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add sof_acp7x_post_fw_run_delay() to introduce a small delay after
firmware boot completion on resume to avoid DSP entering an
unrecoverable state.

Register it as post_fw_run callback only when the ACPI property
acp-sof-post_fw_run_delay is set, following the same pattern used
by the Vangogh platform.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Check adata->acp_sof_signed_firmware_image alongside the existing quirk
flag so that ACP7.B/7.F platforms configured through ACPI also get the
SHA DMA header included during signed firmware loading.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Read ACPI property acp-sof-signed-firmware-image in sof_acp7x_ops_init()
and register acp_sof_load_signed_firmware as the load_firmware callback
only when the property is set.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
ACP7.B and ACP7.F signed firmware data blocks must be written to SRAM
instead of DRAM. Select SOF_FW_BLK_TYPE_SRAM for PCI revision 0x7B and
above in acp_sof_load_signed_firmware().

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add format field to sof_ipc_dai_acp_params for I2S format selection.
Add SOF_TKN_AMD_ACPI2S_FORMAT token (1703) and wire it into the
acpi2s_tokens[] IPC3 topology parsing array.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add SOF_DAI_AMD_I2S DAI type for ACP7.B/7.F I2S/TDM interfaces.
Register ACPTDM DAI name in topology and SOF_ACPI2S_TOKENS as the
token group. Add sof_link_acp_i2s_load() IPC3 topology loader and
SOF_DAI_AMD_I2S case for PCM dai link fixup.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Add amd_sof_acp7x_suspend() and amd_sof_acp7x_resume() for ACP7.B/7.F
platforms power management.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

sound/soc/sof/ipc3-topology.c:1

  • The PR description mentions a new "ACPTDM topology token group", but the implementation extends and reuses the existing SOF_ACPI2S_TOKENS group via SOF_TKN_AMD_ACPI2S_FORMAT. Please align either the description (if ACPI2S token reuse is intended) or the code (if a distinct ACPTDM token group was intended) to avoid confusion for integrators authoring topology files.
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)

Comment on lines +1371 to +1384
struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs;
struct sof_dai_private_data *private = dai->private;
u32 size = sizeof(*config);
int ret;

/* handle master/slave and inverted clocks */
sof_dai_set_format(hw_config, config);

/* init IPC */
memset(&config->acp_i2s, 0, sizeof(config->acp_i2s));
config->hdr.size = size;

ret = sof_update_ipc_object(scomp, &config->acp_i2s, SOF_ACPI2S_TOKENS, slink->tuples,
slink->num_tuples, size, slink->num_hw_configs);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

code change is not required. Same API as existing loaders: HDA/SAI/ESAI/ACP_BT/ACP_HS/ACP SP/MICFIL/ACP DMIC all pass &config-><dai_union_member> with sizeof(*config) and slink->num_hw_configs where applicable; sof_link_acp_i2s_load() matches that contract.
Stride vs. sub-object size: For token_instance_num > 1, object_size must equal sizeof(struct sof_ipc_dai_config) so offsets advance to the next config[i].… in the kzalloc’d array; using sizeof(config->acp_i2s) would only advance within the first element and mis-parse or corrupt layout for multi-HW-config links.
DMIC precedent: sof_link_dmic_load() passes &config->dmic with sizeof(*config) for SOF_DMIC_TOKENS, and only uses a smaller size where the base object is an array of PDM structs (sizeof(struct sof_ipc_dai_dmic_pdm_ctrl) for &config->dmic.pdm[0]), which is a different layout.

Comment thread sound/soc/sof/amd/acp7x.c
Comment on lines +163 to +165
if (!acpi_dev_get_property(ACPI_COMPANION(&pci->dev), "acp-sof-signed-firmware-image",
ACPI_TYPE_INTEGER, &obj))
acp_sof_signed_firmware_image = obj->integer.value;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will fix it.

Comment thread sound/soc/sof/amd/acp.c
Comment on lines +1092 to +1098
if (!acpi_dev_get_property(ACPI_COMPANION(&pci->dev), "acp-sof-signed-firmware-image",
ACPI_TYPE_INTEGER, &obj))
adata->acp_sof_signed_firmware_image = obj->integer.value;

if (!acpi_dev_get_property(ACPI_COMPANION(&pci->dev), "acp-sof-skip_iram_dram_size_mod",
ACPI_TYPE_INTEGER, &obj))
adata->acp_sof_skip_iram_dram_size_mod = obj->integer.value;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will fix it

Comment on lines +177 to +186
if (adata->pci_rev >= ACP7B_PCI_ID) {
if (adata->acp_sof_signed_firmware_image) {
if (adata->fw_bin_size <= ACP_IMAGE_HEADER_SIZE) {
dev_err(sdev->dev, "Invalid signed firmware size %u\n",
adata->fw_bin_size);
return -EINVAL;
}
size_fw = get_unaligned_le32(adata->bin_buf +
ACP_IMAGE_HDR_SIZE_FW_SIGNED_OFF);
size_fw += ACP_IMAGE_HEADER_SIZE;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will fix it.

Comment on lines +155 to +158
#define ACP7X_DSP0_IDMA_ERROR_MASK 0x4B0
#define ACP7X_IDMA_ERROR_MASK 0x1FF9FF
#define ACP_ZSC_DSP_CTRL 0x001014
#define ACP_PME_EN 0x001400

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will fix it.

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.

2 participants