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 -----
  • 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

  • 1572 discussions
Re: [Sound-open-firmware] [PATCH v8 2/3] freezer: refactor pm_freezing into a function.
by Ricardo Ribalda 05 Dec '22

05 Dec '22
Hi Rafael On Fri, 2 Dec 2022 at 18:48, Rafael J. Wysocki <rafael(a)kernel.org> wrote: > > On Thu, Dec 1, 2022 at 12:08 PM Ricardo Ribalda <ribalda(a)chromium.org> wrote: > > > > Add a way to let the drivers know if the processes are frozen. > > > > This is needed by drivers that are waiting for processes to end on their > > shutdown path. > > > > Convert pm_freezing into a function and export it, so it can be used by > > drivers that are either built-in or modules. > > > > Cc: stable(a)vger.kernel.org > > Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") > > Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> > > Why can't you export the original pm_freezing variable and why is this > fixing anything? Because then any module will be able to modify the content of the variable. The Fixes: is because the last patch on the set is doing a real fix. If you only cherry-pick the last patch on a stable branch, the build will fail. (Also, the zero-day builder complains) Anyway, I think we can hold this patch for a bit. The snd people are discussing if this the way to handle it, or if we should handle .shutdown in a different way. Thanks! > > > --- > > include/linux/freezer.h | 3 ++- > > kernel/freezer.c | 3 +-- > > kernel/power/process.c | 24 ++++++++++++++++++++---- > > 3 files changed, 23 insertions(+), 7 deletions(-) > > > > diff --git a/include/linux/freezer.h b/include/linux/freezer.h > > index b303472255be..3413c869d68b 100644 > > --- a/include/linux/freezer.h > > +++ b/include/linux/freezer.h > > @@ -13,7 +13,7 @@ > > #ifdef CONFIG_FREEZER > > DECLARE_STATIC_KEY_FALSE(freezer_active); > > > > -extern bool pm_freezing; /* PM freezing in effect */ > > +bool pm_freezing(void); > > extern bool pm_nosig_freezing; /* PM nosig freezing in effect */ > > > > /* > > @@ -80,6 +80,7 @@ static inline int freeze_processes(void) { return -ENOSYS; } > > static inline int freeze_kernel_threads(void) { return -ENOSYS; } > > static inline void thaw_processes(void) {} > > static inline void thaw_kernel_threads(void) {} > > +static inline bool pm_freezing(void) { return false; } > > > > static inline bool try_to_freeze(void) { return false; } > > > > diff --git a/kernel/freezer.c b/kernel/freezer.c > > index 4fad0e6fca64..2d3530ebdb7e 100644 > > --- a/kernel/freezer.c > > +++ b/kernel/freezer.c > > @@ -20,7 +20,6 @@ EXPORT_SYMBOL(freezer_active); > > * indicate whether PM freezing is in effect, protected by > > * system_transition_mutex > > */ > > -bool pm_freezing; > > bool pm_nosig_freezing; > > > > /* protects freezing and frozen transitions */ > > @@ -46,7 +45,7 @@ bool freezing_slow_path(struct task_struct *p) > > if (pm_nosig_freezing || cgroup_freezing(p)) > > return true; > > > > - if (pm_freezing && !(p->flags & PF_KTHREAD)) > > + if (pm_freezing() && !(p->flags & PF_KTHREAD)) > > return true; > > > > return false; > > diff --git a/kernel/power/process.c b/kernel/power/process.c > > index ddd9988327fe..8a4d0e2c8c20 100644 > > --- a/kernel/power/process.c > > +++ b/kernel/power/process.c > > @@ -108,6 +108,22 @@ static int try_to_freeze_tasks(bool user_only) > > return todo ? -EBUSY : 0; > > } > > > > +/* > > + * Indicate whether PM freezing is in effect, protected by > > + * system_transition_mutex. > > + */ > > +static bool pm_freezing_internal; > > + > > +/** > > + * pm_freezing - indicate whether PM freezing is in effect. > > + * > > + */ > > +bool pm_freezing(void) > > +{ > > + return pm_freezing_internal; > > +} > > +EXPORT_SYMBOL(pm_freezing); > > Use EXPORT_SYMBOL_GPL() instead, please. > > > + > > /** > > * freeze_processes - Signal user space processes to enter the refrigerator. > > * The current thread will not be frozen. The same process that calls > > @@ -126,12 +142,12 @@ int freeze_processes(void) > > /* Make sure this task doesn't get frozen */ > > current->flags |= PF_SUSPEND_TASK; > > > > - if (!pm_freezing) > > + if (!pm_freezing()) > > static_branch_inc(&freezer_active); > > > > pm_wakeup_clear(0); > > pr_info("Freezing user space processes ... "); > > - pm_freezing = true; > > + pm_freezing_internal = true; > > error = try_to_freeze_tasks(true); > > if (!error) { > > __usermodehelper_set_disable_depth(UMH_DISABLED); > > @@ -187,9 +203,9 @@ void thaw_processes(void) > > struct task_struct *curr = current; > > > > trace_suspend_resume(TPS("thaw_processes"), 0, true); > > - if (pm_freezing) > > + if (pm_freezing()) > > static_branch_dec(&freezer_active); > > - pm_freezing = false; > > + pm_freezing_internal = false; > > pm_nosig_freezing = false; > > > > oom_killer_enable(); > > > > -- > > -- > You received this message because you are subscribed to the Google Groups "Chromeos Kdump" group. > To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-kdump+unsubscribe(a)google.com. > To view this discussion on the web, visit https://groups.google.com/a/google.com/d/msgid/chromeos-kdump/CAJZ5v0jbKSTQ…. -- Ricardo Ribalda
1 0
0 0
[Sound-open-firmware] [PATCH v7 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 01 Dec '22

01 Dec '22
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> To: Eric Biederman <ebiederm(a)xmission.com> To: Chromeos Kdump <chromeos-kdump(a)google.com> To: Steven Rostedt <rostedt(a)goodmis.org> Cc: stable(a)vger.kernel.org Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org Cc: kexec(a)lists.infradead.org Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- Changes in v7: - Fix commit message (Thanks Pierre-Louis). - Link to v6: https://lore.kernel.org/r/20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08ba0@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 +++++ sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
3 5
0 0
[Sound-open-firmware] [PATCH v6 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 30 Nov '22

30 Nov '22
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> To: Eric Biederman <ebiederm(a)xmission.com> To: Chromeos Kdump <chromeos-kdump(a)google.com> To: Steven Rostedt <rostedt(a)goodmis.org> Cc: stable(a)vger.kernel.org Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org Cc: kexec(a)lists.infradead.org Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08ba0@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 +++++ sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
2 3
0 0
[Sound-open-firmware] [PATCH v4] ALSA: core: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 30 Nov '22

30 Nov '22
During kexec(), the userspace is frozen. Therefore we cannot wait for it to complete. Avoid running snd_sof_machine_unregister during shutdown. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] <TASK> [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] <TASK> [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: stable(a)vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org --- Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- sound/soc/sof/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..9616ba607ded 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -475,19 +475,16 @@ EXPORT_SYMBOL(snd_sof_device_remove); int snd_sof_device_shutdown(struct device *dev) { struct snd_sof_dev *sdev = dev_get_drvdata(dev); - struct snd_sof_pdata *pdata = sdev->pdata; if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) cancel_work_sync(&sdev->probe_work); /* - * make sure clients and machine driver(s) are unregistered to force - * all userspace devices to be closed prior to the DSP shutdown sequence + * make sure clients are unregistered prior to the DSP shutdown + * sequence. */ sof_unregister_clients(sdev); - snd_sof_machine_unregister(sdev, pdata); - if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) return snd_sof_shutdown(sdev); --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
4 7
0 0
[Sound-open-firmware] [PATCH] ASoC: SOF: mediatek: add shutdown callback
by Ricardo Ribalda 30 Nov '22

30 Nov '22
If we do not shutdown the peripheral properly at shutdown, the whole system crashes after kexec() on the first io access. Let's implement the appropriate callback. Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> To: Matthias Brugger <matthias.bgg(a)gmail.com> Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-arm-kernel(a)lists.infradead.org Cc: linux-mediatek(a)lists.infradead.org Cc: linux-kernel(a)vger.kernel.org --- sound/soc/sof/mediatek/mt8186/mt8186.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index 181189e00e02..79da25725987 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -430,6 +430,11 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev) return 0; } +static int mt8186_dsp_shutdown(struct snd_sof_dev *sdev) +{ + return snd_sof_suspend(sdev->dev); +} + static int mt8186_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) { mt8186_sof_hifixdsp_shutdown(sdev); @@ -538,6 +543,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { /* probe and remove */ .probe = mt8186_dsp_probe, .remove = mt8186_dsp_remove, + .shutdown = mt8186_dsp_shutdown, /* DSP core boot */ .run = mt8186_run, @@ -629,6 +635,7 @@ MODULE_DEVICE_TABLE(of, sof_of_mt8186_ids); static struct platform_driver snd_sof_of_mt8186_driver = { .probe = sof_of_probe, .remove = sof_of_remove, + .shutdown = sof_of_shutdown, .driver = { .name = "sof-audio-of-mt8186", .pm = &sof_of_pm, --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-mtk-snd-e0abf36be4c0 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
3 2
0 0
[Sound-open-firmware] [PATCH v2 1/1] ASoC: SOF: Add DAI configuration support for AMD platforms.
by V sujith kumar Reddy 29 Nov '22

29 Nov '22
From: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> Add support for configuring sp and hs DAI from topology. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> Changes since v1 -- Apply on latest broonie-git for-next --- include/sound/sof/dai-amd.h | 1 + include/sound/sof/dai.h | 2 ++ include/uapi/sound/sof/tokens.h | 5 +++++ sound/soc/sof/ipc3-pcm.c | 2 ++ sound/soc/sof/ipc3-topology.c | 36 +++++++++++++++++++++++++-------- sound/soc/sof/sof-audio.h | 1 + sound/soc/sof/topology.c | 10 +++++++++ 7 files changed, 49 insertions(+), 8 deletions(-) diff --git a/include/sound/sof/dai-amd.h b/include/sound/sof/dai-amd.h index 92f45c180b7c..9df7ac824efe 100644 --- a/include/sound/sof/dai-amd.h +++ b/include/sound/sof/dai-amd.h @@ -17,6 +17,7 @@ struct sof_ipc_dai_acp_params { uint32_t fsync_rate; /* FSYNC frequency in Hz */ uint32_t tdm_slots; + uint32_t tdm_mode; } __packed; /* ACPDMIC Configuration Request - SOF_IPC_DAI_AMD_CONFIG */ diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h index 9fbd3832bcdc..3041f5805b7b 100644 --- a/include/sound/sof/dai.h +++ b/include/sound/sof/dai.h @@ -86,6 +86,8 @@ enum sof_ipc_dai_type { SOF_DAI_AMD_DMIC, /**< AMD ACP DMIC */ SOF_DAI_MEDIATEK_AFE, /**< Mediatek AFE */ SOF_DAI_AMD_HS, /**< Amd HS */ + SOF_DAI_AMD_SP_VIRTUAL, /**< AMD ACP SP VIRTUAL */ + SOF_DAI_AMD_HS_VIRTUAL, /**< AMD ACP HS VIRTUAL */ }; /* general purpose DAI configuration */ diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index f187dfbd9325..bacaf8a6317e 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -198,4 +198,9 @@ /* COPIER */ #define SOF_TKN_INTEL_COPIER_NODE_TYPE 1980 +/* ACP I2S */ +#define SOF_TKN_AMD_ACPI2S_RATE 1700 +#define SOF_TKN_AMD_ACPI2S_CH 1701 +#define SOF_TKN_AMD_ACPI2S_TDM_MODE 1702 + #endif diff --git a/sound/soc/sof/ipc3-pcm.c b/sound/soc/sof/ipc3-pcm.c index dad57bef38f6..f10bfc9bd5cb 100644 --- a/sound/soc/sof/ipc3-pcm.c +++ b/sound/soc/sof/ipc3-pcm.c @@ -336,6 +336,7 @@ static int sof_ipc3_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, channels->min, channels->max); break; case SOF_DAI_AMD_SP: + case SOF_DAI_AMD_SP_VIRTUAL: rate->min = private->dai_config->acpsp.fsync_rate; rate->max = private->dai_config->acpsp.fsync_rate; channels->min = private->dai_config->acpsp.tdm_slots; @@ -347,6 +348,7 @@ static int sof_ipc3_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, channels->min, channels->max); break; case SOF_DAI_AMD_HS: + case SOF_DAI_AMD_HS_VIRTUAL: rate->min = private->dai_config->acphs.fsync_rate; rate->max = private->dai_config->acphs.fsync_rate; channels->min = private->dai_config->acphs.tdm_slots; diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 0720e1eae084..b94cc40485ed 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -276,6 +276,16 @@ static const struct sof_topology_token acpdmic_tokens[] = { offsetof(struct sof_ipc_dai_acpdmic_params, pdm_ch)}, }; +/* ACPI2S */ +static const struct sof_topology_token acpi2s_tokens[] = { + {SOF_TKN_AMD_ACPI2S_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_acp_params, fsync_rate)}, + {SOF_TKN_AMD_ACPI2S_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_acp_params, tdm_slots)}, + {SOF_TKN_AMD_ACPI2S_TDM_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_acp_params, tdm_mode)}, +}; + /* Core tokens */ static const struct sof_topology_token core_tokens[] = { {SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, @@ -311,6 +321,7 @@ static const struct sof_token_info ipc3_token_list[SOF_TOKEN_COUNT] = { [SOF_SAI_TOKENS] = {"SAI tokens", sai_tokens, ARRAY_SIZE(sai_tokens)}, [SOF_AFE_TOKENS] = {"AFE tokens", afe_tokens, ARRAY_SIZE(afe_tokens)}, [SOF_ACPDMIC_TOKENS] = {"ACPDMIC tokens", acpdmic_tokens, ARRAY_SIZE(acpdmic_tokens)}, + [SOF_ACPI2S_TOKENS] = {"ACPI2S tokens", acpi2s_tokens, ARRAY_SIZE(acpi2s_tokens)}, }; /** @@ -1193,6 +1204,7 @@ static int sof_link_acp_sp_load(struct snd_soc_component *scomp, struct snd_sof_ 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); @@ -1201,12 +1213,15 @@ static int sof_link_acp_sp_load(struct snd_soc_component *scomp, struct snd_sof_ memset(&config->acpsp, 0, sizeof(config->acpsp)); config->hdr.size = size; - config->acpsp.fsync_rate = le32_to_cpu(hw_config->fsync_rate); - config->acpsp.tdm_slots = le32_to_cpu(hw_config->tdm_slots); + ret = sof_update_ipc_object(scomp, &config->acpsp, SOF_ACPI2S_TOKENS, slink->tuples, + slink->num_tuples, size, slink->num_hw_configs); + if (ret < 0) + return ret; - dev_info(scomp->dev, "ACP_SP config ACP%d channel %d rate %d\n", + + dev_info(scomp->dev, "ACP_SP config ACP%d channel %d rate %d tdm_mode %d\n", config->dai_index, config->acpsp.tdm_slots, - config->acpsp.fsync_rate); + config->acpsp.fsync_rate, config->acpsp.tdm_mode); dai->number_configs = 1; dai->current_config = 0; @@ -1223,6 +1238,7 @@ static int sof_link_acp_hs_load(struct snd_soc_component *scomp, struct snd_sof_ 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; /* Configures the DAI hardware format and inverted clocks */ sof_dai_set_format(hw_config, config); @@ -1231,12 +1247,14 @@ static int sof_link_acp_hs_load(struct snd_soc_component *scomp, struct snd_sof_ memset(&config->acphs, 0, sizeof(config->acphs)); config->hdr.size = size; - config->acphs.fsync_rate = le32_to_cpu(hw_config->fsync_rate); - config->acphs.tdm_slots = le32_to_cpu(hw_config->tdm_slots); + ret = sof_update_ipc_object(scomp, &config->acphs, SOF_ACPI2S_TOKENS, slink->tuples, + slink->num_tuples, size, slink->num_hw_configs); + if (ret < 0) + return ret; - dev_info(scomp->dev, "ACP_HS config ACP%d channel %d rate %d\n", + dev_info(scomp->dev, "ACP_HS config ACP%d channel %d rate %d tdm_mode %d\n", config->dai_index, config->acphs.tdm_slots, - config->acphs.fsync_rate); + config->acphs.fsync_rate, config->acphs.tdm_mode); dai->number_configs = 1; dai->current_config = 0; @@ -1545,9 +1563,11 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget) ret = sof_link_acp_bt_load(scomp, slink, config, dai); break; case SOF_DAI_AMD_SP: + case SOF_DAI_AMD_SP_VIRTUAL: ret = sof_link_acp_sp_load(scomp, slink, config, dai); break; case SOF_DAI_AMD_HS: + case SOF_DAI_AMD_HS_VIRTUAL: ret = sof_link_acp_hs_load(scomp, slink, config, dai); break; case SOF_DAI_AMD_DMIC: diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 1b5b3ea53a6e..29cf951e3526 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -248,6 +248,7 @@ enum sof_tokens { SOF_COPIER_FORMAT_TOKENS, SOF_GAIN_TOKENS, SOF_ACPDMIC_TOKENS, + SOF_ACPI2S_TOKENS, /* this should be the last */ SOF_TOKEN_COUNT, diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 9d9fcaa2a948..c668bd9d21ec 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -289,6 +289,9 @@ static const struct sof_dai_types sof_dais[] = { {"ACPDMIC", SOF_DAI_AMD_DMIC}, {"ACPHS", SOF_DAI_AMD_HS}, {"AFE", SOF_DAI_MEDIATEK_AFE}, + {"ACPSP_VIRTUAL", SOF_DAI_AMD_SP_VIRTUAL}, + {"ACPHS_VIRTUAL", SOF_DAI_AMD_HS_VIRTUAL}, + }; static enum sof_ipc_dai_type find_dai(const char *name) @@ -1895,6 +1898,13 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_ token_id = SOF_ACPDMIC_TOKENS; num_tuples += token_list[SOF_ACPDMIC_TOKENS].count; break; + case SOF_DAI_AMD_SP: + case SOF_DAI_AMD_HS: + case SOF_DAI_AMD_SP_VIRTUAL: + case SOF_DAI_AMD_HS_VIRTUAL: + token_id = SOF_ACPI2S_TOKENS; + num_tuples += token_list[SOF_ACPI2S_TOKENS].count; + break; default: break; } -- 2.25.1
2 1
0 0
[Sound-open-firmware] [PATCH v5] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
by Ricardo Ribalda 28 Nov '22

28 Nov '22
During kexec(), the userspace is frozen. Therefore we cannot wait for it to complete. Avoid running snd_sof_machine_unregister during shutdown. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] <TASK> [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] <TASK> [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: stable(a)vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda <ribalda(a)chromium.org> --- To: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> To: Liam Girdwood <lgirdwood(a)gmail.com> To: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com> To: Bard Liao <yung-chuan.liao(a)linux.intel.com> To: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> To: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> To: Daniel Baluta <daniel.baluta(a)nxp.com> To: Mark Brown <broonie(a)kernel.org> To: Jaroslav Kysela <perex(a)perex.cz> To: Takashi Iwai <tiwai(a)suse.com> Cc: sound-open-firmware(a)alsa-project.org Cc: alsa-devel(a)alsa-project.org Cc: linux-kernel(a)vger.kernel.org --- Changes in v5: - Edit subject prefix - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@chromium.org Changes in v3: - Wrap pm_freezing in a function - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org --- sound/soc/sof/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..9616ba607ded 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -475,19 +475,16 @@ EXPORT_SYMBOL(snd_sof_device_remove); int snd_sof_device_shutdown(struct device *dev) { struct snd_sof_dev *sdev = dev_get_drvdata(dev); - struct snd_sof_pdata *pdata = sdev->pdata; if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) cancel_work_sync(&sdev->probe_work); /* - * make sure clients and machine driver(s) are unregistered to force - * all userspace devices to be closed prior to the DSP shutdown sequence + * make sure clients are unregistered prior to the DSP shutdown + * sequence. */ sof_unregister_clients(sdev); - snd_sof_machine_unregister(sdev, pdata); - if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) return snd_sof_shutdown(sdev); --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda <ribalda(a)chromium.org>
2 2
0 0
Re: [Sound-open-firmware] [PATCH v1 1/4] ASoC: SOF: amd: Fix for reading position updates from stream box.
by Mark Brown 28 Nov '22

28 Nov '22
On Wed, 23 Nov 2022 17:49:08 +0530, V sujith kumar Reddy wrote: > From: V sujith kumar Reddy <Vsujithkumar.Reddy(a)amd.com> > > By default the position updates are read from dsp box when streambox > size is not defined.if the streambox size is defined to some value > then position updates can be read from the streambox. > > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/4] ASoC: SOF: amd: Fix for reading position updates from stream box. commit: aae7e412b0ec0378e392b18c50b612dae09cdb74 [2/4] ASoC: SOF: amd: Fix for selecting clock source as external clock. commit: f9ced7dbbb551885c63632f1594997bdaf2177ee [3/4] ASoC: SOF: amd: ADD HS and SP virtual DAI. commit: 9fd3b5b11db2fbbf0438324696de8233c0a78dad [4/4] ASoC: SOF: Add DAI configuration support for AMD platforms. (no commit info) All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
1 0
0 0
[Sound-open-firmware] [PATCH AUTOSEL 6.0 08/44] ASoC: SOF: ipc3-topology: use old pipeline teardown flow with SOF2.1 and older
by Sasha Levin 23 Nov '22

23 Nov '22
From: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> [ Upstream commit 003b786b678919e072c2b12ffa73901ef840963e ] Originally in commit b2ebcf42a48f ("ASoC: SOF: free widgets in sof_tear_down_pipelines() for static pipelines"), freeing of pipeline components at suspend was only done with recent FW as there were known limitations in older firmware versions. Tests show that if static pipelines are used, i.e. all pipelines are setup whenever firmware is powered up, the reverse action of freeing all components at power down, leads to firmware failures with also SOF2.0 and SOF2.1 based firmware. The problems can be specific to certain topologies with e.g. components not prepared to be freed at suspend (as this did not happen with older SOF kernels). To avoid hitting these problems when kernel is upgraded and used with an older firmware, bump the firmware requirement to SOF2.2 or newer. If an older firmware is used, and pipeline is a static one, do not free the components at suspend. This ensures the suspend flow remains backwards compatible with older firmware versions. This limitation does not apply if the product configuration is updated to dynamic pipelines. The limitation is not linked to firmware ABI, as the interface to free pipeline components has been available already before ABI3.19. The problem is in the implementation, so firmware version should be used to decide whether it is safe to use the newer flow or not. This patch adds a new SOF_FW_VER() macro to compare SOF firmware release versions. Link: https://github.com/thesofproject/sof/issues/6475 Signed-off-by: Kai Vehmanen <kai.vehmanen(a)linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi(a)linux.intel.com> Link: https://lore.kernel.org/r/20221101114913.1292671-1-kai.vehmanen@linux.intel… Signed-off-by: Mark Brown <broonie(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> --- include/sound/sof/info.h | 4 ++++ sound/soc/sof/ipc3-topology.c | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/sound/sof/info.h b/include/sound/sof/info.h index 65e86e4e9fd8..75193850ead0 100644 --- a/include/sound/sof/info.h +++ b/include/sound/sof/info.h @@ -36,6 +36,10 @@ enum sof_ipc_ext_data { SOF_IPC_EXT_USER_ABI_INFO = 4, }; +/* Build u32 number in format MMmmmppp */ +#define SOF_FW_VER(MAJOR, MINOR, PATCH) ((uint32_t)( \ + ((MAJOR) << 24) | ((MINOR) << 12) | (PATCH))) + /* FW version - SOF_IPC_GLB_VERSION */ struct sof_ipc_fw_version { struct sof_ipc_hdr hdr; diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index a39b43850f0e..bf8a46463cec 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -2242,6 +2242,7 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif struct sof_ipc_fw_version *v = &sdev->fw_ready.version; struct snd_sof_widget *swidget; struct snd_sof_route *sroute; + bool dyn_widgets = false; int ret; /* @@ -2251,12 +2252,14 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif * topology loading the sound card unavailable to open PCMs. */ list_for_each_entry(swidget, &sdev->widget_list, list) { - if (swidget->dynamic_pipeline_widget) + if (swidget->dynamic_pipeline_widget) { + dyn_widgets = true; continue; + } - /* Do not free widgets for static pipelines with FW ABI older than 3.19 */ + /* Do not free widgets for static pipelines with FW older than SOF2.2 */ if (!verify && !swidget->dynamic_pipeline_widget && - v->abi_version < SOF_ABI_VER(3, 19, 0)) { + SOF_FW_VER(v->major, v->minor, v->micro) < SOF_FW_VER(2, 2, 0)) { swidget->use_count = 0; swidget->complete = 0; continue; @@ -2270,9 +2273,11 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif /* * Tear down all pipelines associated with PCMs that did not get suspended * and unset the prepare flag so that they can be set up again during resume. - * Skip this step for older firmware. + * Skip this step for older firmware unless topology has any + * dynamic pipeline (in which case the step is mandatory). */ - if (!verify && v->abi_version >= SOF_ABI_VER(3, 19, 0)) { + if (!verify && (dyn_widgets || SOF_FW_VER(v->major, v->minor, v->micro) >= + SOF_FW_VER(2, 2, 0))) { ret = sof_tear_down_left_over_pipelines(sdev); if (ret < 0) { dev_err(sdev->dev, "failed to tear down paused pipelines\n"); -- 2.35.1
1 0
0 0
[Sound-open-firmware] [PATCH v1 1/1] ASoC: SOF: probes: Check ops before memory allocation
by Andy Shevchenko 18 Nov '22

18 Nov '22
We may check ops before spending resources on memory allocation. While at it, utilize dev_get_platdata() helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko(a)linux.intel.com> --- sound/soc/sof/sof-client-probes.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c index d08395182b1a..fff126808bc0 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -399,23 +399,21 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, if (!sof_probes_enabled) return -ENXIO; - if (!dev->platform_data) { + ops = dev_get_platdata(dev); + if (!ops) { dev_err(dev, "missing platform data\n"); return -ENODEV; } - - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - ops = dev->platform_data; - if (!ops->startup || !ops->shutdown || !ops->set_params || !ops->trigger || !ops->pointer) { dev_err(dev, "missing platform callback(s)\n"); return -ENODEV; } + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + priv->host_ops = ops; switch (sof_client_get_ipc_type(cdev)) { -- 2.35.1
3 2
0 0
  • ← Newer
  • 1
  • ...
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • ...
  • 158
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.