ASoC: SOF: Intel: improvements for S0ix support
Subsystems (3)
cover ASoC: SOF: Intel: improvements for S0ix support
Code improvements and missed register setting required to enter S0ix
Keyon Jie (2):
ASoC: SOF: topology: fix missing NULL pointer check
ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
Ranjani Sridharan (1):
ASoC: SOF: Intel: hda: Simplify the hda_dsp_wait_d0i3c_done() function
sound/soc/sof/intel/hda-dsp.c | 22 +++++++++++++++++++--- sound/soc/sof/intel/hda.h | 3 +++ sound/soc/sof/topology.c | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/3 ASoC: SOF: topology: fix missing NULL pointer check
From: Keyon Jie <[email protected]>
Add check to avoid possible NULL pointer dereference issue.
This issue was reported by static analysis tools, we didn't face this issue but we can't rule it out either as a false positive.
--- sound/soc/sof/topology.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/sof/topology.c +5 -0
@@ -150,6 +150,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,/* get runtime PCM params using widget's stream name */ spcm =snd_sof_find_spcm_name (sdev, swidget->widget->sname); +if (!spcm) { +dev_err (sdev->dev,"error: cannot find PCM for %s\n" , + swidget->widget->name); +return -EINVAL ; + }/* process events */ switch (event) {
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: topology: fix missing NULL pointer check" to the asoc tree
The patch
ASoC: SOF: topology: fix missing NULL pointer check
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
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
From 8cd73ce7ba6381feb9df763240dee3a6d4aff1ca Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Fri, 1 Nov 2019 12:09:14 -0500
Subject: [PATCH] ASoC: SOF: topology: fix missing NULL pointer check
Add check to avoid possible NULL pointer dereference issue.
This issue was reported by static analysis tools, we didn't face this issue but we can't rule it out either as a false positive.
--- sound/soc/sof/topology.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/sof/topology.c +5 -0
@@ -150,6 +150,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,/* get runtime PCM params using widget's stream name */ spcm =snd_sof_find_spcm_name (sdev, swidget->widget->sname); +if (!spcm) { +dev_err (sdev->dev,"error: cannot find PCM for %s\n" , + swidget->widget->name); +return -EINVAL ; + }/* process events */ switch (event) {
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/3 ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
In reply to Pierre-Louis BossartFrom: Keyon Jie <[email protected]>
Set L1SEN to make sure the system can enter S0ix, and restore it on resume.
--- sound/soc/sof/intel/hda-dsp.c | 15 +++++++++++++++ sound/soc/sof/intel/hda.h | 3 +++ 2 files changed, 18 insertions(+)
sound/soc/sof/intel/hda-dsp.c +15 -0
@@ -477,9 +477,16 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)int hda_dsp_resume (struct snd_sof_dev *sdev) { +struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct pci_dev *pci =to_pci_dev (sdev->dev);if (sdev->s0_suspend) { +/* restore L1SEN bit */ +if (hda->l1_support_changed) +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR , +HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN ,0 ); +/* restore and disable the system wakeup */ pci_restore_state (pci);disable_irq_wake (pci->irq);
@@ -517,11 +524,19 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev)int hda_dsp_suspend (struct snd_sof_dev *sdev) { +struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct hdac_bus *bus =sof_to_bus (sdev);struct pci_dev *pci =to_pci_dev (sdev->dev);int ret;if (sdev->s0_suspend) { +/* enable L1SEN to make sure the system can enter S0Ix */ + hda->l1_support_changed = +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR , +HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN , +HDA_VS_INTEL_EM2_L1SEN ); +/* enable the system waking up via IPC IRQ */ enable_irq_wake (pci->irq);pci_save_state (pci);
sound/soc/sof/intel/hda.h +3 -0
@@ -408,6 +408,9 @@ struct sof_intel_hda_dev {int irq; +/* PM related */ +bool l1_support_changed;/* during suspend, is L1SEN changed or not */ +/* DMIC device */ struct platform_device *dmic_dev; };
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend" to the asoc tree
The patch
ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
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
From 16299326a0cbbc88d4d6491a8ceebbfca81064c5 Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Fri, 1 Nov 2019 12:09:15 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
Set L1SEN to make sure the system can enter S0ix, and restore it on resume.
--- sound/soc/sof/intel/hda-dsp.c | 15 +++++++++++++++ sound/soc/sof/intel/hda.h | 3 +++ 2 files changed, 18 insertions(+)
sound/soc/sof/intel/hda-dsp.c +15 -0
@@ -478,9 +478,16 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)int hda_dsp_resume (struct snd_sof_dev *sdev) { +struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct pci_dev *pci =to_pci_dev (sdev->dev);if (sdev->s0_suspend) { +/* restore L1SEN bit */ +if (hda->l1_support_changed) +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR , +HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN ,0 ); +/* restore and disable the system wakeup */ pci_restore_state (pci);disable_irq_wake (pci->irq);
@@ -518,11 +525,19 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev)int hda_dsp_suspend (struct snd_sof_dev *sdev) { +struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct hdac_bus *bus =sof_to_bus (sdev);struct pci_dev *pci =to_pci_dev (sdev->dev);int ret;if (sdev->s0_suspend) { +/* enable L1SEN to make sure the system can enter S0Ix */ + hda->l1_support_changed = +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR , +HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN , +HDA_VS_INTEL_EM2_L1SEN ); +/* enable the system waking up via IPC IRQ */ enable_irq_wake (pci->irq);pci_save_state (pci);
sound/soc/sof/intel/hda.h +3 -0
@@ -408,6 +408,9 @@ struct sof_intel_hda_dev {int irq; +/* PM related */ +bool l1_support_changed;/* during suspend, is L1SEN changed or not */ +/* DMIC device */ struct platform_device *dmic_dev; };
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/3 ASoC: SOF: Intel: hda: Simplify the hda_dsp_wait_d0i3c_done() function
In reply to Pierre-Louis BossartFrom: Ranjani Sridharan <[email protected]>
Remove the retry argument for the hda_dsp_wait_d0i3c_done() function and use the HDA_DSP_REG_POLL_RETRY_COUNT macro directly.
--- sound/soc/sof/intel/hda-dsp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda-dsp.c +4 -3
@@ -307,9 +307,10 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev) HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0); } -static int hda_dsp_wait_d0i3c_done (struct snd_sof_dev *sdev,int retry) +static int hda_dsp_wait_d0i3c_done (struct snd_sof_dev *sdev) {struct hdac_bus *bus =sof_to_bus (sdev); +int retry =HDA_DSP_REG_POLL_RETRY_COUNT ;while (snd_hdac_chip_readb (bus,VS_D0I3C ) &SOF_HDA_VS_D0I3C_CIP ) {if (!retry--)
@@ -346,7 +347,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,u8 value;/* Write to D0I3C after Command-In-Progress bit is cleared */ - ret =hda_dsp_wait_d0i3c_done (sdev,HDA_DSP_REG_POLL_RETRY_COUNT ); + ret =hda_dsp_wait_d0i3c_done (sdev);if (ret <0 ) {dev_err (bus->dev,"CIP timeout before D0I3C update!\n" );return ret;
@@ -357,7 +358,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,snd_hdac_chip_updateb (bus,VS_D0I3C ,SOF_HDA_VS_D0I3C_I3 , value);/* Wait for cmd in progress to be cleared before exiting the function */ - ret =hda_dsp_wait_d0i3c_done (sdev,HDA_DSP_REG_POLL_RETRY_COUNT ); + ret =hda_dsp_wait_d0i3c_done (sdev);if (ret <0 ) {dev_err (bus->dev,"CIP timeout after D0I3C update!\n" );return ret;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: hda: Simplify the hda_dsp_wait_d0i3c_done() function" to the asoc tree
The patch
ASoC: SOF: Intel: hda: Simplify the hda_dsp_wait_d0i3c_done() function
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
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
From 65c56f5dccc87ca2993a50672e144c7378189f2c Mon Sep 17 00:00:00 2001
From: Ranjani Sridharan <[email protected]>
Date: Fri, 1 Nov 2019 12:09:16 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda: Simplify the hda_dsp_wait_d0i3c_done()
function
Remove the retry argument for the hda_dsp_wait_d0i3c_done() function and use the HDA_DSP_REG_POLL_RETRY_COUNT macro directly.
--- sound/soc/sof/intel/hda-dsp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda-dsp.c +4 -3
@@ -307,9 +307,10 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev) HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0); } -static int hda_dsp_wait_d0i3c_done (struct snd_sof_dev *sdev,int retry) +static int hda_dsp_wait_d0i3c_done (struct snd_sof_dev *sdev) {struct hdac_bus *bus =sof_to_bus (sdev); +int retry =HDA_DSP_REG_POLL_RETRY_COUNT ;while (snd_hdac_chip_readb (bus,VS_D0I3C ) &SOF_HDA_VS_D0I3C_CIP ) {if (!retry--)
@@ -346,7 +347,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,u8 value;/* Write to D0I3C after Command-In-Progress bit is cleared */ - ret =hda_dsp_wait_d0i3c_done (sdev,HDA_DSP_REG_POLL_RETRY_COUNT ); + ret =hda_dsp_wait_d0i3c_done (sdev);if (ret <0 ) {dev_err (bus->dev,"CIP timeout before D0I3C update!\n" );return ret;
@@ -357,7 +358,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,snd_hdac_chip_updateb (bus,VS_D0I3C ,SOF_HDA_VS_D0I3C_I3 , value);/* Wait for cmd in progress to be cleared before exiting the function */ - ret =hda_dsp_wait_d0i3c_done (sdev,HDA_DSP_REG_POLL_RETRY_COUNT ); + ret =hda_dsp_wait_d0i3c_done (sdev);if (ret <0 ) {dev_err (bus->dev,"CIP timeout after D0I3C update!\n" );return ret;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel