mailman.alsa-project.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Sound-open-firmware

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
sound-open-firmware@alsa-project.org

  • 6 participants
  • 1605 discussions
[Sound-open-firmware] [PATCH AUTOSEL 5.19 23/36] ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
by Sasha Levin 10 Oct '22

10 Oct '22
From: Jairaj Arava <jairaj.arava(a)intel.com> [ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ] In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path. Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms. Reviewed-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> Reviewed-by: Chao Song <chao.song(a)intel.com> Reviewed-by: Curtis Malainey <curtis(a)malainey.com> Signed-off-by: Jairaj Arava <jairaj.arava(a)intel.com> Signed-off-by: Curtis Malainey <cujomalainey(a)chromium.org> Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella(a)intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> Link: https://lore.kernel.org/r/20220919114429.42700-1-pierre-louis.bossart@linux… Signed-off-by: Mark Brown <broonie(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> --- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index d627092b399d..643fd1036d60 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, -- 2.35.1
1 0
0 0
[Sound-open-firmware] [PATCH AUTOSEL 6.0 28/44] ASoC: SOF: add quirk to override topology mclk_id
by Sasha Levin 10 Oct '22

10 Oct '22
From: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> [ Upstream commit d136949dd8e2e309dc2f186507486b71cbe9acdb ] Some Intel-based platforms rely on a topology file that hard-codes the use of MCLK0. This is incorrect in 10% of the cases. Rather than generating yet another set of topology files, this patch adds a kernel module parameter to override the topology value. In hindsight, we should never have allowed mclks to be specified in topology, this is a hardware-level information that should not have been visible in the topology. Future patches will try to set this value automagically, e.g. by parsing the NHLT content. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao(a)linux.intel.com> Link: https://lore.kernel.org/r/20220919115350.43104-3-pierre-louis.bossart@linux… Signed-off-by: Mark Brown <broonie(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> --- sound/soc/sof/intel/hda.c | 11 +++++++++++ sound/soc/sof/ipc3-topology.c | 7 +++++++ sound/soc/sof/sof-priv.h | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 6d4ecbe14adf..ada2e6775749 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -376,6 +376,10 @@ static int dmic_num_override = -1; module_param_named(dmic_num, dmic_num_override, int, 0444); MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number"); +static int mclk_id_override = -1; +module_param_named(mclk_id, mclk_id_override, int, 0444); +MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); @@ -1565,6 +1569,13 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) sof_pdata->tplg_filename = tplg_filename; } + + /* check if mclk_id should be modified from topology defaults */ + if (mclk_id_override >= 0) { + dev_info(sdev->dev, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } } /* diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 65923e7a5976..a39b43850f0e 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1249,6 +1249,7 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_dai static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) { + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs; struct sof_dai_private_data *private = dai->private; u32 size = sizeof(*config); @@ -1273,6 +1274,12 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai config[i].hdr.size = size; + if (sdev->mclk_id_override) { + dev_dbg(scomp->dev, "tplg: overriding topology mclk_id %d by quirk %d\n", + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } + /* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate = le32_to_cpu(hw_config[i].mclk_rate); config[i].ssp.bclk_rate = le32_to_cpu(hw_config[i].bclk_rate); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 823583086279..828c74bb75f8 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -594,6 +594,10 @@ struct snd_sof_dev { /* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; + /* quirks to override topology values */ + bool mclk_id_override; + u16 mclk_id_quirk; /* same size as in IPC3 definitions */ + void *private; /* core does not touch this */ }; -- 2.35.1
1 0
0 0
[Sound-open-firmware] [PATCH AUTOSEL 6.0 26/44] ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
by Sasha Levin 10 Oct '22

10 Oct '22
From: Jairaj Arava <jairaj.arava(a)intel.com> [ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ] In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path. Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms. Reviewed-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> Reviewed-by: Chao Song <chao.song(a)intel.com> Reviewed-by: Curtis Malainey <curtis(a)malainey.com> Signed-off-by: Jairaj Arava <jairaj.arava(a)intel.com> Signed-off-by: Curtis Malainey <cujomalainey(a)chromium.org> Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella(a)intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> Link: https://lore.kernel.org/r/20220919114429.42700-1-pierre-louis.bossart@linux… Signed-off-by: Mark Brown <broonie(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> --- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index d627092b399d..643fd1036d60 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, -- 2.35.1
1 0
0 0
[Sound-open-firmware] [PATCH 0/2] ASoC: SOF: mediatek: mt8195: Add dsp_ops callback
by Chunxu Li 27 Sep '22

27 Sep '22
ASoC: SOF: mediatek: mt8195: Add pcm_{hw_params,pointer} callback Chunxu Li (2): ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback sound/soc/sof/mediatek/mt8195/mt8195.c | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) -- 2.25.1
3 5
0 0
[Sound-open-firmware] [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
by Chunxu Li 22 Sep '22

22 Sep '22
add pcm_pointer callback for mt8186 to support read host position from DSP Signed-off-by: Chunxu Li <chunxu.li(a)mediatek.com> --- sound/soc/sof/mediatek/mt8186/mt8186.c | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index 9ec89fc7fec0..181189e00e02 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -470,6 +470,38 @@ static int mt8186_pcm_hw_params(struct snd_sof_dev *sdev, return 0; } +static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream) +{ + int ret; + snd_pcm_uframes_t pos; + struct snd_sof_pcm *spcm; + struct sof_ipc_stream_posn posn; + struct snd_sof_pcm_stream *stream; + struct snd_soc_component *scomp = sdev->component; + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + + spcm = snd_sof_find_spcm_dai(scomp, rtd); + if (!spcm) { + dev_warn_ratelimited(sdev->dev, "warn: can't find PCM with DAI ID %d\n", + rtd->dai_link->id); + return 0; + } + + stream = &spcm->stream[substream->stream]; + ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn)); + if (ret < 0) { + dev_warn(sdev->dev, "failed to read stream position: %d\n", ret); + return 0; + } + + memcpy(&stream->posn, &posn, sizeof(posn)); + pos = spcm->stream[substream->stream].posn.host_posn; + pos = bytes_to_frames(substream->runtime, pos); + + return pos; +} + static struct snd_soc_dai_driver mt8186_dai[] = { { .name = "SOF_DL1", @@ -537,6 +569,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { /* stream callbacks */ .pcm_open = sof_stream_pcm_open, .pcm_hw_params = mt8186_pcm_hw_params, + .pcm_pointer = mt8186_pcm_pointer, .pcm_close = sof_stream_pcm_close, /* firmware loading */ -- 2.25.1
4 3
0 0
[Sound-open-firmware] [PATCH] ASoC: SOF: mediatek: add pcm_hw_params callback for mt8186
by Chunxu Li 20 Sep '22

20 Sep '22
add pcm_hw_params callback for mt8186 to support continue update dma host position Signed-off-by: Chunxu Li <chunxu.li(a)mediatek.com> --- sound/soc/sof/mediatek/mt8186/mt8186.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index a1be5d74f40b..9ec89fc7fec0 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -460,6 +460,16 @@ static int mt8186_get_bar_index(struct snd_sof_dev *sdev, u32 type) return type; } +static int mt8186_pcm_hw_params(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_sof_platform_stream_params *platform_params) +{ + platform_params->cont_update_posn = 1; + + return 0; +} + static struct snd_soc_dai_driver mt8186_dai[] = { { .name = "SOF_DL1", @@ -526,6 +536,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { /* stream callbacks */ .pcm_open = sof_stream_pcm_open, + .pcm_hw_params = mt8186_pcm_hw_params, .pcm_close = sof_stream_pcm_close, /* firmware loading */ -- 2.25.1
2 1
0 0
[Sound-open-firmware] [PATCH linux-next] ASOC: SOF: use devm_kcalloc() instead of devm_kzalloc()
by cgel.zte@gmail.com 20 Sep '22

20 Sep '22
From: ye xingchen <ye.xingchen(a)zte.com.cn> Use 2-factor multiplication argument form devm_kcalloc() instead of devm_kzalloc(). Reported-by: Zeal Robot <zealci(a)zte.com.cn> Signed-off-by: ye xingchen <ye.xingchen(a)zte.com.cn> --- sound/soc/sof/nocodec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c index 356497fe4f4c..3537805070ad 100644 --- a/sound/soc/sof/nocodec.c +++ b/sound/soc/sof/nocodec.c @@ -32,7 +32,7 @@ static int sof_nocodec_bes_setup(struct device *dev, /* set up BE dai_links */ for (i = 0; i < link_num; i++) { - dlc = devm_kzalloc(dev, 3 * sizeof(*dlc), GFP_KERNEL); + dlc = devm_kcalloc(dev, 3, sizeof(*dlc), GFP_KERNEL); if (!dlc) return -ENOMEM; @@ -78,7 +78,7 @@ static int sof_nocodec_setup(struct device *dev, struct snd_soc_dai_link *links; /* create dummy BE dai_links */ - links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) * num_dai_drivers, GFP_KERNEL); + links = devm_kcalloc(dev, num_dai_drivers, sizeof(struct snd_soc_dai_link), GFP_KERNEL); if (!links) return -ENOMEM; -- 2.25.1
3 2
0 0
Re: [Sound-open-firmware] [PATCH 1/4] ASoC: SOF: amd: Make ACP core code generic for newer SOC transition
by Daniel Baluta 13 Sep '22

13 Sep '22
Hello, Care to add the Reviewed-by tags received on SOF github? https://github.com/thesofproject/linux/pull/3749 From time to time someone at intel runs a script and does a rebase which picks the reviewed-by tags into topic/sof-dev-rebase branch. thanks, Daniel. On 13.09.2022 17:43, V sujith kumar Reddy wrote: > From: Ajit Kumar Pandey <AjitKumar.Pandey(a)amd.com> > > Newer AMD SOC differs slightly in terms of few registers offset and > configuration. Add offsets into chip_info struct to make core ACP > code more generic and resusable on newer SOC. > > Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey(a)amd.com> > Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> > --- > sound/soc/sof/amd/Makefile | 2 +- > sound/soc/sof/amd/acp-common.c | 110 +++++++++++++++++++++++++++++ > sound/soc/sof/amd/acp-dsp-offset.h | 25 +++---- > sound/soc/sof/amd/acp-ipc.c | 16 +++-- > sound/soc/sof/amd/acp-loader.c | 13 ++-- > sound/soc/sof/amd/acp-stream.c | 3 +- > sound/soc/sof/amd/acp.c | 37 ++++++---- > sound/soc/sof/amd/acp.h | 26 +++++-- > sound/soc/sof/amd/pci-rn.c | 11 +++ > sound/soc/sof/amd/renoir.c | 101 ++++---------------------- > 10 files changed, 210 insertions(+), 134 deletions(-) > create mode 100644 sound/soc/sof/amd/acp-common.c > > diff --git a/sound/soc/sof/amd/Makefile b/sound/soc/sof/amd/Makefile > index 7b9f1a0af3c8..efea92f62a86 100644 > --- a/sound/soc/sof/amd/Makefile > +++ b/sound/soc/sof/amd/Makefile > @@ -4,7 +4,7 @@ > # > # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. > > -snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o acp-trace.o > +snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o acp-trace.o acp-common.o > snd-sof-amd-renoir-objs := pci-rn.o renoir.o > > obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o > diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c > new file mode 100644 > index 000000000000..12bdd97c1aae > --- /dev/null > +++ b/sound/soc/sof/amd/acp-common.c > @@ -0,0 +1,110 @@ > +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) > +// > +// This file is provided under a dual BSD/GPLv2 license. When using or > +// redistributing this file, you may do so under either license. > +// > +// Copyright(c) 2022 Advanced Micro Devices, Inc. > +// > +// Authors: Ajit Kumar Pandey <AjitKumar.Pandey(a)amd.com> > +// V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> > + > +/* ACP-specific Common code */ > + > +#include "../sof-priv.h" > +#include "../sof-audio.h" > +#include "../ops.h" > +#include "../sof-audio.h" > +#include "acp.h" > +#include "acp-dsp-offset.h" > + > +int acp_dai_probe(struct snd_soc_dai *dai) > +{ > + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(dai->component); > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > + unsigned int val; > + > + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->i2s_pin_config_offset); > + if (val != desc->i2s_mode) { > + dev_err(sdev->dev, "I2S Mode is not supported (I2S_PIN_CONFIG: %#x)\n", val); > + return -EINVAL; > + } > + > + return 0; > +} > +EXPORT_SYMBOL_NS(acp_dai_probe, SND_SOC_SOF_AMD_COMMON); > + > +struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev) > +{ > + struct snd_sof_pdata *sof_pdata = sdev->pdata; > + const struct sof_dev_desc *desc = sof_pdata->desc; > + struct snd_soc_acpi_mach *mach; > + > + mach = snd_soc_acpi_find_machine(desc->machines); > + if (!mach) { > + dev_warn(sdev->dev, "No matching ASoC machine driver found\n"); > + return NULL; > + } > + > + sof_pdata->tplg_filename = mach->sof_tplg_filename; > + sof_pdata->fw_filename = mach->fw_filename; > + > + return mach; > +} > + > +/* AMD Common DSP ops */ > +struct snd_sof_dsp_ops sof_acp_common_ops = { > + /* probe and remove */ > + .probe = amd_sof_acp_probe, > + .remove = amd_sof_acp_remove, > + > + /* Register IO */ > + .write = sof_io_write, > + .read = sof_io_read, > + > + /* Block IO */ > + .block_read = acp_dsp_block_read, > + .block_write = acp_dsp_block_write, > + > + /*Firmware loading */ > + .load_firmware = snd_sof_load_firmware_memcpy, > + .pre_fw_run = acp_dsp_pre_fw_run, > + .get_bar_index = acp_get_bar_index, > + > + /* DSP core boot */ > + .run = acp_sof_dsp_run, > + > + /*IPC */ > + .send_msg = acp_sof_ipc_send_msg, > + .ipc_msg_data = acp_sof_ipc_msg_data, > + .get_mailbox_offset = acp_sof_ipc_get_mailbox_offset, > + .irq_thread = acp_sof_ipc_irq_thread, > + > + /* stream callbacks */ > + .pcm_open = acp_pcm_open, > + .pcm_close = acp_pcm_close, > + .pcm_hw_params = acp_pcm_hw_params, > + > + .hw_info = SNDRV_PCM_INFO_MMAP | > + SNDRV_PCM_INFO_MMAP_VALID | > + SNDRV_PCM_INFO_INTERLEAVED | > + SNDRV_PCM_INFO_PAUSE | > + SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, > + > + /* Machine driver callbacks */ > + .machine_select = amd_sof_machine_select, > + .machine_register = sof_machine_register, > + .machine_unregister = sof_machine_unregister, > + > + /* Trace Logger */ > + .trace_init = acp_sof_trace_init, > + .trace_release = acp_sof_trace_release, > + > + /* PM */ > + .suspend = amd_sof_acp_suspend, > + .resume = amd_sof_acp_resume, > +}; > +EXPORT_SYMBOL_NS(sof_acp_common_ops, SND_SOC_SOF_AMD_COMMON); > + > +MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); > +MODULE_DESCRIPTION("ACP SOF COMMON Driver"); > +MODULE_LICENSE("Dual BSD/GPL"); > diff --git a/sound/soc/sof/amd/acp-dsp-offset.h b/sound/soc/sof/amd/acp-dsp-offset.h > index 56cefd4a84fc..47151a84f90b 100644 > --- a/sound/soc/sof/amd/acp-dsp-offset.h > +++ b/sound/soc/sof/amd/acp-dsp-offset.h > @@ -48,22 +48,23 @@ > #define ACP_SOFT_RESET 0x1000 > #define ACP_CONTROL 0x1004 > > -#define ACP_I2S_PIN_CONFIG 0x1400 > +#define ACP3X_I2S_PIN_CONFIG 0x1400 > > -/* Registers from ACP_PGFSM block */ > -#define ACP_PGFSM_CONTROL 0x141C > -#define ACP_PGFSM_STATUS 0x1420 > -#define ACP_CLKMUX_SEL 0x1424 > +/* Registers offsets from ACP_PGFSM block */ > +#define ACP3X_PGFSM_BASE 0x141C > +#define PGFSM_CONTROL_OFFSET 0x0 > +#define PGFSM_STATUS_OFFSET 0x4 > +#define ACP3X_CLKMUX_SEL 0x1424 > > /* Registers from ACP_INTR block */ > -#define ACP_EXTERNAL_INTR_ENB 0x1800 > -#define ACP_EXTERNAL_INTR_CNTL 0x1804 > -#define ACP_EXTERNAL_INTR_STAT 0x1808 > -#define ACP_DSP_SW_INTR_CNTL 0x1814 > -#define ACP_DSP_SW_INTR_STAT 0x1818 > -#define ACP_SW_INTR_TRIG 0x181C > +#define ACP3X_EXT_INTR_STAT 0x1808 > + > +#define ACP3X_DSP_SW_INTR_BASE 0x1814 > +#define DSP_SW_INTR_CNTL_OFFSET 0x0 > +#define DSP_SW_INTR_STAT_OFFSET 0x4 > +#define DSP_SW_INTR_TRIG_OFFSET 0x8 > #define ACP_ERROR_STATUS 0x18C4 > -#define ACP_AXI2DAGB_SEM_0 0x1880 > +#define ACP3X_AXI2DAGB_SEM_0 0x1880 > > /* Registers from ACP_SHA block */ > #define ACP_SHA_DSP_FW_QUALIFIER 0x1C70 > diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c > index e1842f037083..e09392498f4c 100644 > --- a/sound/soc/sof/amd/acp-ipc.c > +++ b/sound/soc/sof/amd/acp-ipc.c > @@ -30,11 +30,14 @@ EXPORT_SYMBOL_NS(acp_mailbox_read, SND_SOC_SOF_AMD_COMMON); > static void acpbus_trigger_host_to_dsp_swintr(struct acp_dev_data *adata) > { > struct snd_sof_dev *sdev = adata->dev; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > u32 swintr_trigger; > > - swintr_trigger = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SW_INTR_TRIG); > + swintr_trigger = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->dsp_intr_base + > + DSP_SW_INTR_TRIG_OFFSET); > swintr_trigger |= 0x01; > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SW_INTR_TRIG, swintr_trigger); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->dsp_intr_base + DSP_SW_INTR_TRIG_OFFSET, > + swintr_trigger); > } > > static void acp_ipc_host_msg_set(struct snd_sof_dev *sdev) > @@ -61,10 +64,11 @@ static void acp_dsp_ipc_dsp_done(struct snd_sof_dev *sdev) > int acp_sof_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) > { > struct acp_dev_data *adata = sdev->pdata->hw_pdata; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > unsigned int offset = offsetof(struct scratch_ipc_conf, sof_in_box); > unsigned int count = ACP_HW_SEM_RETRY_COUNT; > > - while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_AXI2DAGB_SEM_0)) { > + while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset)) { > /* Wait until acquired HW Semaphore Lock or timeout*/ > count--; > if (!count) { > @@ -80,7 +84,7 @@ int acp_sof_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) > acpbus_trigger_host_to_dsp_swintr(adata); > > /* Unlock or Release HW Semaphore */ > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_AXI2DAGB_SEM_0, 0x0); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0); > > return 0; > } > @@ -186,7 +190,9 @@ EXPORT_SYMBOL_NS(acp_sof_ipc_msg_data, SND_SOC_SOF_AMD_COMMON); > > int acp_sof_ipc_get_mailbox_offset(struct snd_sof_dev *sdev) > { > - return ACP_SCRATCH_MEMORY_ADDRESS; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > + > + return desc->sram_pte_offset; > } > EXPORT_SYMBOL_NS(acp_sof_ipc_get_mailbox_offset, SND_SOC_SOF_AMD_COMMON); > > diff --git a/sound/soc/sof/amd/acp-loader.c b/sound/soc/sof/amd/acp-loader.c > index 7ca51e0f3b1b..f372f93094f3 100644 > --- a/sound/soc/sof/amd/acp-loader.c > +++ b/sound/soc/sof/amd/acp-loader.c > @@ -30,9 +30,10 @@ > int acp_dsp_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type, > u32 offset, void *dest, size_t size) > { > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > switch (blk_type) { > case SOF_FW_BLK_TYPE_SRAM: > - offset = offset - ACP_SCRATCH_MEMORY_ADDRESS; > + offset = offset - desc->sram_pte_offset; > memcpy_from_scratch(sdev, offset, dest, size); > break; > default: > @@ -49,6 +50,7 @@ int acp_dsp_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_t > { > struct snd_sof_pdata *plat_data = sdev->pdata; > struct pci_dev *pci = to_pci_dev(sdev->dev); > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > struct acp_dev_data *adata; > void *dest; > u32 dma_size, page_count; > @@ -84,7 +86,7 @@ int acp_dsp_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_t > adata->fw_data_bin_size = size + offset; > break; > case SOF_FW_BLK_TYPE_SRAM: > - offset = offset - ACP_SCRATCH_MEMORY_ADDRESS; > + offset = offset - desc->sram_pte_offset; > memcpy_to_scratch(sdev, offset, src, size); > return 0; > default: > @@ -105,14 +107,13 @@ EXPORT_SYMBOL_NS(acp_get_bar_index, SND_SOC_SOF_AMD_COMMON); > > static void configure_pte_for_fw_loading(int type, int num_pages, struct acp_dev_data *adata) > { > - struct snd_sof_dev *sdev; > + struct snd_sof_dev *sdev = adata->dev; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > unsigned int low, high; > dma_addr_t addr; > u16 page_idx; > u32 offset; > > - sdev = adata->dev; > - > switch (type) { > case FW_BIN: > offset = FW_BIN_PTE_OFFSET; > @@ -129,7 +130,7 @@ static void configure_pte_for_fw_loading(int type, int num_pages, struct acp_dev > > /* Group Enable */ > snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACPAXI2AXI_ATU_BASE_ADDR_GRP_1, > - ACP_SRAM_PTE_OFFSET | BIT(31)); > + desc->sram_pte_offset | BIT(31)); > snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1, > PAGE_SIZE_4K_ENABLE); > > diff --git a/sound/soc/sof/amd/acp-stream.c b/sound/soc/sof/amd/acp-stream.c > index b3ca4a90dbf8..f71b4e660b14 100644 > --- a/sound/soc/sof/amd/acp-stream.c > +++ b/sound/soc/sof/amd/acp-stream.c > @@ -26,6 +26,7 @@ > > int acp_dsp_stream_config(struct snd_sof_dev *sdev, struct acp_dsp_stream *stream) > { > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > unsigned int pte_reg, pte_size, phy_addr_offset, index; > int stream_tag = stream->stream_tag; > u32 low, high, offset, reg_val; > @@ -96,7 +97,7 @@ int acp_dsp_stream_config(struct snd_sof_dev *sdev, struct acp_dsp_stream *strea > phy_addr_offset, stream->reg_offset); > > /* Group Enable */ > - reg_val = ACP_SRAM_PTE_OFFSET + offset; > + reg_val = desc->sram_pte_offset + offset; > snd_sof_dsp_write(sdev, ACP_DSP_BAR, pte_reg, reg_val | BIT(31)); > snd_sof_dsp_write(sdev, ACP_DSP_BAR, pte_size, PAGE_SIZE_4K_ENABLE); > > diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c > index c40d2900dd36..47eaabc95aa5 100644 > --- a/sound/soc/sof/amd/acp.c > +++ b/sound/soc/sof/amd/acp.c > @@ -39,9 +39,10 @@ static int smn_read(struct pci_dev *dev, u32 smn_addr, u32 *data) > static void init_dma_descriptor(struct acp_dev_data *adata) > { > struct snd_sof_dev *sdev = adata->dev; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > unsigned int addr; > > - addr = ACP_SRAM_PTE_OFFSET + offsetof(struct scratch_reg_conf, dma_desc); > + addr = desc->sram_pte_offset + offsetof(struct scratch_reg_conf, dma_desc); > > snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_DMA_DESC_BASE_ADDR, addr); > snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_DMA_DESC_MAX_NUM_DSCR, ACP_MAX_DESC_CNT); > @@ -300,8 +301,9 @@ void memcpy_to_scratch(struct snd_sof_dev *sdev, u32 offset, unsigned int *src, > static int acp_memory_init(struct snd_sof_dev *sdev) > { > struct acp_dev_data *adata = sdev->pdata->hw_pdata; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > > - snd_sof_dsp_update_bits(sdev, ACP_DSP_BAR, ACP_DSP_SW_INTR_CNTL, > + snd_sof_dsp_update_bits(sdev, ACP_DSP_BAR, desc->dsp_intr_base + DSP_SW_INTR_CNTL_OFFSET, > ACP_DSP_INTR_EN_MASK, ACP_DSP_INTR_EN_MASK); > init_dma_descriptor(adata); > > @@ -311,18 +313,20 @@ static int acp_memory_init(struct snd_sof_dev *sdev) > static irqreturn_t acp_irq_thread(int irq, void *context) > { > struct snd_sof_dev *sdev = context; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > + unsigned int base = desc->dsp_intr_base; > unsigned int val, count = ACP_HW_SEM_RETRY_COUNT; > > - val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_EXTERNAL_INTR_STAT); > + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat); > if (val & ACP_SHA_STAT) { > /* Clear SHA interrupt raised by PSP */ > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_EXTERNAL_INTR_STAT, val); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat, val); > return IRQ_HANDLED; > } > > - val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_DSP_SW_INTR_STAT); > + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET); > if (val & ACP_DSP_TO_HOST_IRQ) { > - while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_AXI2DAGB_SEM_0)) { > + while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset)) { > /* Wait until acquired HW Semaphore lock or timeout */ > count--; > if (!count) { > @@ -333,10 +337,10 @@ static irqreturn_t acp_irq_thread(int irq, void *context) > > sof_ops(sdev)->irq_thread(irq, sdev); > val |= ACP_DSP_TO_HOST_IRQ; > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_DSP_SW_INTR_STAT, val); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET, val); > > /* Unlock or Release HW Semaphore */ > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_AXI2DAGB_SEM_0, 0x0); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0); > > return IRQ_HANDLED; > } > @@ -347,9 +351,11 @@ static irqreturn_t acp_irq_thread(int irq, void *context) > static irqreturn_t acp_irq_handler(int irq, void *dev_id) > { > struct snd_sof_dev *sdev = dev_id; > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > + unsigned int base = desc->dsp_intr_base; > unsigned int val; > > - val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_DSP_SW_INTR_STAT); > + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET); > if (val) > return IRQ_WAKE_THREAD; > > @@ -358,20 +364,22 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id) > > static int acp_power_on(struct snd_sof_dev *sdev) > { > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > + unsigned int base = desc->pgfsm_base; > unsigned int val; > int ret; > > - val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_PGFSM_STATUS); > + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET); > > if (val == ACP_POWERED_ON) > return 0; > > if (val & ACP_PGFSM_STATUS_MASK) > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_PGFSM_CONTROL, > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + PGFSM_CONTROL_OFFSET, > ACP_PGFSM_CNTL_POWER_ON_MASK); > > - ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_PGFSM_STATUS, val, !val, > - ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); > + ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET, val, > + !val, ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); > if (ret < 0) > dev_err(sdev->dev, "timeout in ACP_PGFSM_STATUS read\n"); > > @@ -437,6 +445,7 @@ EXPORT_SYMBOL_NS(amd_sof_acp_suspend, SND_SOC_SOF_AMD_COMMON); > > int amd_sof_acp_resume(struct snd_sof_dev *sdev) > { > + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); > int ret; > > ret = acp_init(sdev); > @@ -445,7 +454,7 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev) > return ret; > } > > - snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_CLKMUX_SEL, 0x03); > + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->acp_clkmux_sel, 0x03); > > ret = acp_memory_init(sdev); > > diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h > index 4c42b8fd6abf..bc024be76e09 100644 > --- a/sound/soc/sof/amd/acp.h > +++ b/sound/soc/sof/amd/acp.h > @@ -30,7 +30,7 @@ > #define ACP_SOFT_RESET_DONE_MASK 0x00010001 > > #define ACP_DSP_INTR_EN_MASK 0x00000001 > -#define ACP_SRAM_PTE_OFFSET 0x02050000 > +#define ACP3X_SRAM_PTE_OFFSET 0x02050000 > #define PAGE_SIZE_4K_ENABLE 0x2 > #define ACP_PAGE_SIZE 0x1000 > #define ACP_DMA_CH_RUN 0x02 > @@ -45,7 +45,7 @@ > #define ACPBUS_REG_BASE_OFFSET ACP_DMA_CNTL_0 > > #define ACP_DEFAULT_DRAM_LENGTH 0x00080000 > -#define ACP_SCRATCH_MEMORY_ADDRESS 0x02050000 > +#define ACP3X_SCRATCH_MEMORY_ADDRESS 0x02050000 > #define ACP_SYSTEM_MEMORY_WINDOW 0x4000000 > #define ACP_IRAM_BASE_ADDRESS 0x000000 > #define ACP_DATA_RAM_BASE_ADDRESS 0x01000000 > @@ -139,6 +139,19 @@ struct acp_dsp_stream { > unsigned int reg_offset; > }; > > +struct sof_amd_acp_desc { > + unsigned int rev; > + unsigned int host_bridge_id; > + unsigned int i2s_mode; > + u32 pgfsm_base; > + u32 ext_intr_stat; > + u32 dsp_intr_base; > + u32 sram_pte_offset; > + u32 i2s_pin_config_offset; > + u32 hw_semaphore_offset; > + u32 acp_clkmux_sel; > +}; > + > /* Common device data struct for ACP devices */ > struct acp_dev_data { > struct snd_sof_dev *dev; > @@ -206,8 +219,13 @@ int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substr > struct snd_pcm_hw_params *params, > struct snd_sof_platform_stream_params *platform_params); > > +extern struct snd_sof_dsp_ops sof_acp_common_ops; > + > extern struct snd_sof_dsp_ops sof_renoir_ops; > +int sof_renoir_ops_init(struct snd_sof_dev *sdev); > > +int acp_dai_probe(struct snd_soc_dai *dai); > +struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev); > /* Machine configuration */ > int snd_amd_acp_find_config(struct pci_dev *pci); > > @@ -220,10 +238,6 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev); > int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state); > int amd_sof_acp_resume(struct snd_sof_dev *sdev); > > -struct sof_amd_acp_desc { > - unsigned int host_bridge_id; > -}; > - > static inline const struct sof_amd_acp_desc *get_chip_info(struct snd_sof_pdata *pdata) > { > const struct sof_dev_desc *desc = pdata->desc; > diff --git a/sound/soc/sof/amd/pci-rn.c b/sound/soc/sof/amd/pci-rn.c > index 3a7fed25a226..fca40b261671 100644 > --- a/sound/soc/sof/amd/pci-rn.c > +++ b/sound/soc/sof/amd/pci-rn.c > @@ -21,6 +21,7 @@ > #include "../sof-pci-dev.h" > #include "../../amd/mach-config.h" > #include "acp.h" > +#include "acp-dsp-offset.h" > > #define ACP3x_REG_START 0x1240000 > #define ACP3x_REG_END 0x125C000 > @@ -44,7 +45,16 @@ static const struct resource renoir_res[] = { > }; > > static const struct sof_amd_acp_desc renoir_chip_info = { > + .rev = 3, > .host_bridge_id = HOST_BRIDGE_CZN, > + .i2s_mode = 0x04, > + .pgfsm_base = ACP3X_PGFSM_BASE, > + .ext_intr_stat = ACP3X_EXT_INTR_STAT, > + .dsp_intr_base = ACP3X_DSP_SW_INTR_BASE, > + .sram_pte_offset = ACP3X_SRAM_PTE_OFFSET, > + .i2s_pin_config_offset = ACP3X_I2S_PIN_CONFIG, > + .hw_semaphore_offset = ACP3X_AXI2DAGB_SEM_0, > + .acp_clkmux_sel = ACP3X_CLKMUX_SEL, > }; > > static const struct sof_dev_desc renoir_desc = { > @@ -68,6 +78,7 @@ static const struct sof_dev_desc renoir_desc = { > }, > .nocodec_tplg_filename = "sof-acp.tplg", > .ops = &sof_renoir_ops, > + .ops_init = sof_renoir_ops_init, > }; > > static int acp_pci_rn_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) > diff --git a/sound/soc/sof/amd/renoir.c b/sound/soc/sof/amd/renoir.c > index 9261c8bc2236..6ea8727f977e 100644 > --- a/sound/soc/sof/amd/renoir.c > +++ b/sound/soc/sof/amd/renoir.c > @@ -23,22 +23,6 @@ > #define I2S_SP_INSTANCE 1 > #define PDM_DMIC_INSTANCE 2 > > -#define I2S_MODE 0x04 > - > -static int renoir_dai_probe(struct snd_soc_dai *dai) > -{ > - struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(dai->component); > - unsigned int val; > - > - val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_I2S_PIN_CONFIG); > - if (val != I2S_MODE) { > - dev_err(sdev->dev, "I2S Mode is not supported (I2S_PIN_CONFIG: %#x)\n", val); > - return -EINVAL; > - } > - > - return 0; > -} > - > static struct snd_soc_dai_driver renoir_sof_dai[] = { > [I2S_BT_INSTANCE] = { > .id = I2S_BT_INSTANCE, > @@ -62,7 +46,7 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { > .rate_min = 8000, > .rate_max = 48000, > }, > - .probe = &renoir_dai_probe, > + .probe = &acp_dai_probe, > }, > > [I2S_SP_INSTANCE] = { > @@ -87,7 +71,7 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { > .rate_min = 8000, > .rate_max = 48000, > }, > - .probe = &renoir_dai_probe, > + .probe = &acp_dai_probe, > }, > > [PDM_DMIC_INSTANCE] = { > @@ -104,82 +88,21 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { > }, > }; > > -static struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev) > -{ > - struct snd_sof_pdata *sof_pdata = sdev->pdata; > - const struct sof_dev_desc *desc = sof_pdata->desc; > - struct snd_soc_acpi_mach *mach; > +/* Renoir ops */ > +struct snd_sof_dsp_ops sof_renoir_ops; > +EXPORT_SYMBOL_NS(sof_renoir_ops, SND_SOC_SOF_AMD_COMMON); > > - mach = snd_soc_acpi_find_machine(desc->machines); > - if (!mach) { > - dev_warn(sdev->dev, "No matching ASoC machine driver found\n"); > - return NULL; > - } > +int sof_renoir_ops_init(struct snd_sof_dev *sdev) > +{ > + /* common defaults */ > + memcpy(&sof_renoir_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); > > - sof_pdata->tplg_filename = mach->sof_tplg_filename; > - sof_pdata->fw_filename = mach->fw_filename; > + sof_renoir_ops.drv = renoir_sof_dai; > + sof_renoir_ops.num_drv = ARRAY_SIZE(renoir_sof_dai); > > - return mach; > + return 0; > } > > -/* AMD Renoir DSP ops */ > -struct snd_sof_dsp_ops sof_renoir_ops = { > - /* probe and remove */ > - .probe = amd_sof_acp_probe, > - .remove = amd_sof_acp_remove, > - > - /* Register IO */ > - .write = sof_io_write, > - .read = sof_io_read, > - > - /* Block IO */ > - .block_read = acp_dsp_block_read, > - .block_write = acp_dsp_block_write, > - > - /*Firmware loading */ > - .load_firmware = snd_sof_load_firmware_memcpy, > - .pre_fw_run = acp_dsp_pre_fw_run, > - .get_bar_index = acp_get_bar_index, > - > - /* DSP core boot */ > - .run = acp_sof_dsp_run, > - > - /*IPC */ > - .send_msg = acp_sof_ipc_send_msg, > - .ipc_msg_data = acp_sof_ipc_msg_data, > - .get_mailbox_offset = acp_sof_ipc_get_mailbox_offset, > - .irq_thread = acp_sof_ipc_irq_thread, > - > - /* DAI drivers */ > - .drv = renoir_sof_dai, > - .num_drv = ARRAY_SIZE(renoir_sof_dai), > - > - /* stream callbacks */ > - .pcm_open = acp_pcm_open, > - .pcm_close = acp_pcm_close, > - .pcm_hw_params = acp_pcm_hw_params, > - > - .hw_info = SNDRV_PCM_INFO_MMAP | > - SNDRV_PCM_INFO_MMAP_VALID | > - SNDRV_PCM_INFO_INTERLEAVED | > - SNDRV_PCM_INFO_PAUSE | > - SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, > - > - /* Machine driver callbacks */ > - .machine_select = amd_sof_machine_select, > - .machine_register = sof_machine_register, > - .machine_unregister = sof_machine_unregister, > - > - /* Trace Logger */ > - .trace_init = acp_sof_trace_init, > - .trace_release = acp_sof_trace_release, > - > - /* PM */ > - .suspend = amd_sof_acp_suspend, > - .resume = amd_sof_acp_resume, > -}; > -EXPORT_SYMBOL(sof_renoir_ops); > - > MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); > MODULE_DESCRIPTION("RENOIR SOF Driver"); > MODULE_LICENSE("Dual BSD/GPL");
1 0
0 0
Re: [Sound-open-firmware] [PATCH 5/7] soundwire: intel: Don't disable interrupt until children are removed
by Pierre-Louis Bossart 13 Sep '22

13 Sep '22
On 9/7/22 12:14, Richard Fitzgerald wrote: > The cadence_master code needs the interrupt to complete message transfers. > When the bus driver is being removed child drivers are removed, and their > remove actions might need bus transactions. > > Use the sdw_master_ops.remove callback to disable the interrupt handling > only after the child drivers have been removed. > > Signed-off-by: Richard Fitzgerald <rf(a)opensource.cirrus.com> > --- > drivers/soundwire/intel.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c > index 01be62fa6c83..d5e723a9c80b 100644 > --- a/drivers/soundwire/intel.c > +++ b/drivers/soundwire/intel.c > @@ -1255,6 +1255,13 @@ static int intel_prop_read(struct sdw_bus *bus) > return 0; > } > > +static void intel_bus_remove(struct sdw_bus *bus) > +{ > + struct sdw_cdns *cdns = bus_to_cdns(bus); > + > + sdw_cdns_enable_interrupt(cdns, false); don't you need to check for any on-going transactions on the bus? I wonder if there could be a corner case where there are no child devices but still a device physically attached to the bus. I am not sure if the 'no devices left' is a good-enough indication of no activity on the bus. > +} > + > static struct sdw_master_ops sdw_intel_ops = { > .read_prop = sdw_master_read_prop, > .override_adr = sdw_dmi_override_adr, > @@ -1264,6 +1271,7 @@ static struct sdw_master_ops sdw_intel_ops = { > .set_bus_conf = cdns_bus_conf, > .pre_bank_switch = intel_pre_bank_switch, > .post_bank_switch = intel_post_bank_switch, > + .remove = intel_bus_remove, > }; > > static int intel_init(struct sdw_intel *sdw) > @@ -1502,7 +1510,6 @@ static void intel_link_remove(struct auxiliary_device *auxdev) > */ > if (!bus->prop.hw_disabled) { > intel_debugfs_exit(sdw); > - sdw_cdns_enable_interrupt(cdns, false); > snd_soc_unregister_component(dev); > } > sdw_bus_master_delete(bus);
2 3
0 0
Re: [Sound-open-firmware] [PATCH 7/7] soundwire: bus: Fix premature removal of sdw_slave objects
by Pierre-Louis Bossart 12 Sep '22

12 Sep '22
On 9/7/22 12:14, Richard Fitzgerald wrote: > When the bus manager is removed sdw_bus_master_delete() should not > be deleting the struct sdw_slave objects until the bus manager has > been stopped. The first step of removing child drivers should only > be calling device_unregister() on the child. The counterpart to > sdw_drv_probe() is sdw_drv_remove(), not sdw_delete_slave(). > > The sdw_slave objects are created by the bus manager probe() from > ACPI/DT information. They are not created when a child driver probes > so should not be deleted by a child driver remove. > > Change-Id: I25cc145df12fdc7c126f8f594a5f76eedce25488 spurious Change-Id > Signed-off-by: Richard Fitzgerald <rf(a)opensource.cirrus.com> > --- > drivers/soundwire/bus.c | 30 ++++++++++++++++++++++++++---- > drivers/soundwire/slave.c | 21 +++++++++++++++++---- > 2 files changed, 43 insertions(+), 8 deletions(-) > > diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c > index 1327a312be86..5533eb589286 100644 > --- a/drivers/soundwire/bus.c > +++ b/drivers/soundwire/bus.c > @@ -146,9 +146,8 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, > } > EXPORT_SYMBOL(sdw_bus_master_add); > > -static int sdw_delete_slave(struct device *dev, void *data) > +static int sdw_delete_slave(struct sdw_slave *slave) > { > - struct sdw_slave *slave = dev_to_sdw_dev(dev); > struct sdw_bus *bus = slave->bus; > > sdw_slave_debugfs_exit(slave); > @@ -163,7 +162,24 @@ static int sdw_delete_slave(struct device *dev, void *data) > list_del_init(&slave->node); > mutex_unlock(&bus->bus_lock); > > + mutex_destroy(&slave->sdw_dev_lock); > + kfree(slave); > + > + return 0; > +} > + > +static int sdw_remove_child(struct device *dev, void *data) > +{ > + /* > + * Do not remove the struct sdw_slave yet. This is created by > + * the bus manager probe() from ACPI information and used by the > + * bus manager to hold status of each peripheral. Its lifetime > + * is that of the bus manager. > + */ > + > + /* This will call sdw_drv_remove() */ > device_unregister(dev); > + > return 0; > } > > @@ -171,16 +187,22 @@ static int sdw_delete_slave(struct device *dev, void *data) > * sdw_bus_master_delete() - delete the bus master instance > * @bus: bus to be deleted > * > - * Remove the instance, delete the child devices. > + * Remove the child devices, remove the master instance. > */ > void sdw_bus_master_delete(struct sdw_bus *bus) > { > - device_for_each_child(bus->dev, NULL, sdw_delete_slave); > + struct sdw_slave *slave, *tmp; > + > + device_for_each_child(bus->dev, NULL, sdw_remove_child); > > /* Children have been removed so it is now safe for the bus to stop */ > if (bus->ops->remove) > bus->ops->remove(bus); > > + /* Now the bus is stopped it is safe to free things */ > + list_for_each_entry_safe(slave, tmp, &bus->slaves, node) > + sdw_delete_slave(slave); > + > sdw_master_device_del(bus); > > sdw_bus_debugfs_exit(bus); > diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c > index c1c1a2ac293a..b6161d002b97 100644 > --- a/drivers/soundwire/slave.c > +++ b/drivers/soundwire/slave.c > @@ -10,10 +10,23 @@ > > static void sdw_slave_release(struct device *dev) > { > - struct sdw_slave *slave = dev_to_sdw_dev(dev); > - > - mutex_destroy(&slave->sdw_dev_lock); > - kfree(slave); > + /* > + * The release() callback should not be empty > + * (see Documentation/core-api/kobject.rst) but the ownership > + * of struct sdw_slave is muddled. It is used for two separate > + * purposes: > + * 1) by the bus driver to track its own state information for > + * physical devices on the bus and found in ACPI/DT, whether > + * or not there is a child driver for it; > + * 2) to hold the child driver object. > + * > + * The struct sdw_slave cannot be freed when the child driver > + * is released because it is holding info used by the bus > + * driver. It is freed when the bus driver is removed. > + * > + * Until the ownership issue is untangled this cannot free > + * the struct sdw_slave object containing the child dev. > + */ > } > > struct device_type sdw_slave_type = {
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • ...
  • 161
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.