From: Vijendar Mukunda Date: Fri, 2 May 2025 15:42:45 +0000 (+0530) Subject: ASoC: SOF: amd: refactor acp reset sequence X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=169c5e444bb9cd4ae770f54157a04fdd8569508a;p=users%2Fdwmw2%2Flinux.git ASoC: SOF: amd: refactor acp reset sequence Below mentioned register sequence should be part of acp init sequence. 1) Set ACP clock mux selection register to ACP_ACLK clock source. 2) Enable ACP global interrupt enable register 3) Enable ACP error interrupt mask. ACP reset sequence should contain code related to asserting acp soft reset and release the soft reset. Move the rest of the registers programming to acp init sequence. Signed-off-by: Vijendar Mukunda Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Link: https://patch.msgid.link/20250502154445.3008598-7-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 615ed7ff38463..2ad5fbf43c8a3 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -511,7 +511,6 @@ static int acp_power_on(struct snd_sof_dev *sdev) static int acp_reset(struct snd_sof_dev *sdev) { - const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); unsigned int val; int ret; @@ -532,14 +531,6 @@ static int acp_reset(struct snd_sof_dev *sdev) if (ret < 0) dev_err(sdev->dev, "timeout in releasing reset\n"); - if (desc->acp_clkmux_sel) - snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->acp_clkmux_sel, ACP_CLOCK_ACLK); - - if (desc->ext_intr_enb) - snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_enb, 0x01); - - if (desc->ext_intr_cntl) - snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_cntl, ACP_ERROR_IRQ_MASK); return ret; } @@ -570,6 +561,7 @@ static int acp_dsp_reset(struct snd_sof_dev *sdev) static int acp_init(struct snd_sof_dev *sdev) { + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); struct acp_dev_data *acp_data; int ret; @@ -586,6 +578,16 @@ static int acp_init(struct snd_sof_dev *sdev) ret = acp_reset(sdev); if (ret) return ret; + + if (desc->acp_clkmux_sel) + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->acp_clkmux_sel, ACP_CLOCK_ACLK); + + if (desc->ext_intr_enb) + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_enb, 0x01); + + if (desc->ext_intr_cntl) + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_cntl, ACP_ERROR_IRQ_MASK); + switch (acp_data->pci_rev) { case ACP70_PCI_ID: case ACP71_PCI_ID: