summaryrefslogtreecommitdiff
path: root/sound/soc/sof/intel/hda-dsp.c
AgeCommit message (Collapse)Author
2024-05-07ALSA/ASoC: Intel: clarify Copyright informationMark Brown
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: This patchset does not change any functionality. It only clarifies the Copyright information in ASoC/HDAudio contributions, where an "All rights reserved" notice was mistakenly added in a number of files over the years, likely due to copy/paste. The Intel template never included this statement.
2024-05-06ASoC: SOF: Intel: clarify Copyright informationPierre-Louis Bossart
For some reason a number of files included the "All rights reserved" statement. Good old copy-paste made sure this mistake proliferated. Remove the "All rights reserved" in all Intel-copyright to align with internal guidance. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20240503140359.259762-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-05ASoC: SOF: Intel: move hda.c to different modulePierre-Louis Bossart
Now that most of the code moves are done, we can add a new module and the required EXPORT_SYMBOL definitions. No functionality change, just a new module added. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20240503135221.229202-8-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-05ASoC: SOF: Intel: remove circular dependency on hda_sdw_process_wakeen()Pierre-Louis Bossart
hda_sdw_process_wakeen() is used in hda-loader.c, but defined in hda.c. This code split will create a circular dependency when hda.c is moved to a different module. Rather than an invasive code change, this patch follows the model used for sdw_check_wakeen_irq() with an abstraction. For now all abstractions point to the same common routine, which is arguably not great, but this also provides us with a future-proof way of addressing platform-specific wake processing. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20240503135221.229202-7-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-05ASoC: SOF: Intel: move common code from hda.cPierre-Louis Bossart
To avoid circular dependencies when moving hda.c to a separate module, we need to move the common code to hda-ipc.c and hda-dsp.c No functionality change, just code move. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20240503135221.229202-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-05ASoC: SOF: Intel: start splitting top-level from common partsPierre-Louis Bossart
The existing code relies on the 'HDA_COMMON' module and namespace. We need to start splitting top-level parts from the low-level ones, otherwise we will not be able to reuse the low-level parts DMA support for SoundWire/BPT. In the end the dependencies will be: +----------------------------------------------+ | | | v sof-pci-intel-xxx --> sof-intel-hda ------------> sof-hda-common | ^ | | +-> soundwire_intel --> sof_hda_sdw_bpt This patch adds the initial split between the sof-pci-intel-xxx modules and the common parts, in a follow-up patch we will further split the HDA_COMMON parts Since the PCI modules are not all independent, i.e. the CNL parts are also used in JSL and TGL, additional Kconfig and namespace modules were added. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20240503135221.229202-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25ASoC: SOF: Intel: hda-dsp: Skip IMR boot on ACE platforms in case of S3 suspendPeter Ujfalusi
SoCs with ACE architecture are tailored to use s2idle instead deep (S3) suspend state and the IMR content is lost when the system is forced to enter even to S3. When waking up from S3 state the IMR boot will fail as the content is lost. Set the skip_imr_boot flag to make sure that we don't try IMR in this case. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://msgid.link/r/20240322112504.4192-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13ASoC: SOF: Intel: start SoundWire links earlier for LNL+ devicesPierre-Louis Bossart
The SoundWire integration is different from previous platforms, with no dependencies on the DSP enablement. We can start the SoundWire links in the probe instead of waiting for the post_fw_run stage. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://msgid.link/r/20240213101247.28887-11-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-12ASoC: SOF: Intel: hda-dsp: Make sure that no irq handler is pending before ↵Peter Ujfalusi
suspend In the existing IPC support, the reply to each IPC message is handled in an IRQ thread. The assumption is that the IRQ thread is scheduled without significant delays. On an experimental (iow, buggy) kernel, the IRQ thread dealing with the reply to the last IPC message before powering-down the DSP can be delayed by several seconds. The IRQ thread will proceed with register accesses after the DSP is powered-down which results in a kernel crash. While the bug which causes the delay is not in the audio stack, we must handle such cases with defensive programming to avoid such crashes. Call synchronize_irq() before proceeding to power down the DSP to make sure that no irq thread is pending execution. Closes: https://github.com/thesofproject/linux/issues/4608 Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20231012191850.147140-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-20ASoC: SOF: Intel: Split the set_power_op for IPC3 and IPC4Ranjani Sridharan
Suspending to S0iX with IPC3 requires the PM_GATE IPC to be sent again to stop the DMA trace. But with IPC4, this is not needed as the trace is stopped with the LARGE_CONFIG_SET IPC. Also, sending the MOD_D0IX IPC to set the D0I3 state again when the DSP is in D0I3 already results in an imbalance in PM runtime states in the firmware. So split the set_power_state ops for IPC3 and IPC4 to avoid sending the MOD_D0IX IPC when the DSP is already in D0I3 with IPC4. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230420104714.29573-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-06ASoC: SOF: Intel: hda-mlink: move to a dedicated modulePierre-Louis Bossart
Some of the functions will be used for SoundWire enumeration and power management, to avoid cycles in module dependencies and simplify integration all the HDaudio multi-link needs to move to a dedicated module. Drop no longer needed headers at the same time. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20230404104127.5629-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-04-04ASoC: SOF: Intel: hda: make DSPless mode work with DSP disabled in BIOSPierre-Louis Bossart
When the DSP is disabled in the BIOS, the DSP_BAR and PP_BAR cannot be accessed. One possible objection noted in initial reviews is that this patch adds a number of branches. However the number of branches is actually limited in probe/suspend/resume routines mostly, so there isn't really a degradation in terms of readability and maintainability. Adding yet another level of abstraction/ops/callbacks would increase complexity and not really help in terms of code reuse or readability and maintainability. A split between controller and DSP driver would be even more invasive. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230404092115.27949-7-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-13ASoC: Merge up fixes as a dependency for future SOF workMark Brown
New SOF changes require the current set of fixes.
2023-03-07ASoC: SOF: Intel: hda-dsp: harden D0i3 programming sequenceRander Wang
Add delay between set and wait command according to hardware programming sequence. Also add debug log to detect error. Signed-off-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230307095453.3719-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-05ASoC: SOF: Intel: hda: Do not re-enable L1 if disabled before suspendRanjani Sridharan
We have a workaround in place to address a known issue with host DMA running into xruns when capture streams are running. But when resuming from Sx, we unconditionally re-enable DMI L1 without taking the workaround into account and this could lead to xruns when a suspended capture stream is restarted. To fix this rename the flag l1_support_enabled to l1_disabled in struct sof_intel_hda_dev to save the L1 disabled status which can be set/cleared when we get/put a stream and use the flag to determine if DMI L1 should enabled or not during the post_fw_run op. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230220075804.4829-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-14ASoC: SOF: Intel: hda-dsp: Set streaming flag for d0i3Rander Wang
Enable d0i3 streaming if all the active streams can work in d0i3 state and playback is enabled. Signed-off-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230214103345.30669-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-14ASoC: SOF: Intel: hda-dsp: use set_pm_gate according to ipc versionRander Wang
Use set_pm_gate to unify pm gate setting for different ipc version. Signed-off-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230214103345.30669-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-12-12ASoC: SOF: Intel: pci-tgl: unblock S5 entry if DMA stop has failed"Kai Vehmanen
If system shutdown has not been completed cleanly, it is possible the DMA stream shutdown has not been done, or was not clean. If this is the case, Intel TGL/ADL HDA platforms may fail to shutdown cleanly due to pending HDA DMA transactions. To avoid this, detect this scenario in the shutdown callback, and perform an additional controller reset. This has been tested to unblock S5 entry if this condition is hit. Co-developed-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20221209114529.3909192-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-07ASoC: SOF: Intel: set d0i3 register with d0i3_offsetRander Wang
Set the d0i3 with d0i3_offset for different platforms Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20221107164154.21925-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-31ASoC: SOF: fix compilation issue with readb/writeb helpersPierre-Louis Bossart
Replace them with read8/write8 to avoid compilation issue on ARM. In hindsight this is more consistent with the read64/write64 helpers already used in SOF. Reported-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/alsa-devel/Y1rTFrohLqaiZAy%2F@dev-arch.thelio-3990X/ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20221031195340.249868-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-28ASoC: SOF: Intel: hda-mlink: add helpers to suspend/resume linksPierre-Louis Bossart
No functionality change, just move the code in hda-mlink. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20221027193540.259520-18-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-28ASoC: SOF: Intel: hda-codec: add helpers to suspend and resume cmd_ioPierre-Louis Bossart
No functionality change, code move to have better split between HDaudio codec management and core parts. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20221027193540.259520-16-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-28ASoC: SOF: Intel: hda-dsp: clarify dependencies on SND_SOC_SOF_HDAPierre-Louis Bossart
IS_ENABLED is not always in the right places, the codec parts depend on SND_SOC_SOF_HDAUDIO_CODEC Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20221027193540.259520-15-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-26ASoC: SOF: Intel: hda: always do a full resetPierre-Louis Bossart
There's no point in checking for a full-reset condition that is always-true in the callers. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20221024165310.246183-11-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-26ASoC: SOF: Intel: hda-dsp: use SOF helpers for consistencyPierre-Louis Bossart
No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20221024165310.246183-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18ASoC: SOF: Intel: hda-dsp: simplify S3 resume flowsPierre-Louis Bossart
The flow contains surprising parts that seem to have been inspired by the Skylake driver. During a resume from S3, the state of the links prior to suspend should not matter. One would have to assume that the links are powered down anyways prior to suspend, and there is also no specific code that turns links on unconditionally on resume. Likewise, the snd_hdac_init_chip() routine will start the cmd_io handling, and it's not clear why we should care about the state of the DMA prior to suspend. This patch removes these two sequences to simplify the flow. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221017204946.207986-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-23ASoC: SOF: Intel: HDA: use IPC version-specific opsRanjani Sridharan
Use the IP-specific ops for disabling interrupts and powering down the DSP in hda_suspend. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220922213644.666315-9-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-23ASoC: SOF: Intel: define and set the disable_interrupts op for cavs platformsRanjani Sridharan
Disable the IPC and SDW nterrupts in the disable_interrupts op for cavs platforms. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220922213644.666315-7-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-20ASoC: SOF: Intel: hda-dsp: expose functions for SKL supportPierre-Louis Bossart
In preparation of the IPCv4 IPC support, this patch adds exposes two functions required by the SKL/KBL boot and code loader. Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20220920131700.133103-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-19ASoC: SOF: Intel: replace dev_vdbg with tracepointsBard Liao
This patch replaces all dev_vdbg calls with tracepoints to reduce overhead and enable use of trace collection and analysis tools. Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Noah Klayman <noah.klayman@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220919122108.43764-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-23ASoC: SOF: Intel: hda: Skip IMR boot after a firmware crash or boot failurePeter Ujfalusi
To make sure that we start from a clean state next time when the DSP is powered up after a firmware crash or boot failure we must skip the IMR booting attempt. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220823124359.24865-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-12ASoC: SOF: Intel: hda: Introduce skip_imr_boot flagPeter Ujfalusi
Use a dedicated flag instead of directly checking the sdev->system_suspend_target to decide if we need to skip IMR boot due to too deep sleep state where the memory used for IMR booting will not retain its content. The skip_imr_boot flag will be set true during suspend if the target state is deeper than S3 and reset back to false on successful boot to re-enable IMR booting in shallower sleep states. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220712120936.28072-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-17ASoC: SOF: Intel: hda-dsp: report error on power-up/downPierre-Louis Bossart
dev_dbg() is not good-enough since the flow returns an error. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220616215351.135643-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-14ASoC: Merge fixesMark Brown
Required for more changes for the ops.
2022-06-10ASoC: SOF: Intel: Switch to use the generic pm_ops.set_core_statePeter Ujfalusi
Instead of craft and send an IPC(3) message in hda_dsp_core_get(), tgl_dsp_core_get() and tgl_dsp_core_put(), use the generic ops for handling the IPC dependent implementation of core power on/off. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220610083549.16773-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-09ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up()Peter Ujfalusi
The hda_dsp_core_power_up() needs to be exposed so that it can be used in hda-loader.c to correct the boot flow. The first step must not unstall the core, it should only power up the core(s). Add sanity check for the core_mask while exposing it to be safe. Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220609085949.29062-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19ASoC: SOF: Rename dtrace_is_supported flag to fw_trace_is_supportedPeter Ujfalusi
Rename the internal flag to not limit it's use for dma-trace, but to be used for generic firmware tracing functionality. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220516104711.26115-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-25ASoC: SOF: Intel: hda-dai: move code to deal with hda dai/dailink suspendPierre-Louis Bossart
The location of the code was not optimal and prevents us from using helpers, let's move it to hda-dai.c. No functionality change in this patch. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220421203201.1550328-11-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-04ASoC: SOF: Drop 'header' parameter from tx_message() APIPeter Ujfalusi
The header parameter is not used anymore and now it can be dropped from the parameter list of tx_message(). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220330201926.1330402-10-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-10ASoC: SOF: Drop unused DSP power states: D3_HOT and D3_COLDPeter Ujfalusi
The only reference to D3_HOT and D3_COLD DSP power state is in intel/hda-dsp.c in form of a dev_dbg() print. Remove them as they are not used and even if they are they could be re-added via the substate. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220210150525.30756-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-09ASoC: SOF: Intel: hdac_ext_stream: consistent prefixes for variables/membersPierre-Louis Bossart
The existing code maximizes confusion by using 'stream' and 'hstream' variables of different types, e.g: struct hdac_stream *stream; struct hdac_ext_stream *stream; struct hdac_stream *hstream; struct hdac_ext_stream *hstream; This confusion is partly inherited from legacy code but SOF contributors added their own creative spin, e.g. struct hdac_ext_stream *link_dev; struct hdac_ext_stream *dsp_stream; struct hdac_ext_stream hda_stream; and my personal favorite: stream = &hda_stream->hda_stream; This patch suggests a consistent naming across all Intel code related to HDAudio stream management. The convention is - by hierarchical order: struct sof_intel_hda_stream *hda_stream; struct hdac_ext_stream *hext_stream; struct hdac_stream *hstream; No functionality change - just renaming of variables/members. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20220209063104.9971-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-22ASoC: SOF: hda: don't use the core op for power up/power downRanjani Sridharan
The core_power_up/down() ops will be deprecated. Use the HDA platform-specific functions for powering up/down the cores during probe/suspend/remove. The enabled_cores_mask and the core ref_count's are manually updated in each of these functions. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20211119192621.4096077-9-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-22ASoC: SOF: Intel: CNL/ICL/APL: set core_get/core_put opsRanjani Sridharan
Set core_get/put ops for CNL/ICL platforms. These platforms do not support enabling/disabling secondary cores dynamically. So skip sending the IPC to power off the cores in the core_put op. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20211119192621.4096077-6-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-05ASoC: SOF: Intel: hda: fix hotplug when only codec is suspendedKai Vehmanen
If codec is in runtime suspend, but controller is not, hotplug events are missed as the codec has no way to alert the controller. Problem does not occur if both controller and codec are active, or when both are suspended. An easy way to reproduce is to play an audio stream on one codec (e.g. to HDMI/DP display codec), wait for other HDA codec to go to runtime suspend, and then plug in a headset to the suspended codec. The jack event is not reported correctly in this case. Another way to reproduce is to force controller to stay active with "snd_sof_pci.sof_pci_debug=0x1" Fix the issue by reconfiguring the WAKEEN register when powering up/down individual links, and handling control events in the interrupt handler. Fixes: 87fc20e4a0cb ("ASoC: SOF: Intel: hda: use hdac_ext fine-grained link management") Reported-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20211105111655.668777-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-15ASoC: SOF: Intel: hda-dsp: Declare locally used functions as staticPeter Ujfalusi
The following functions can be made static as they are only used locally: hda_dsp_core_reset_enter hda_dsp_core_reset_leave hda_dsp_core_stall_reset hda_dsp_core_power_up hda_dsp_core_power_down hda_dsp_core_is_enabled The hda_dsp_ipc_int_disable is also only used within hda-dsp.c, but for symmetry for hda_dsp_ipc_int_enable (used by hda-loader.c) leave it as it is. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20210915071805.5704-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23Merge remote-tracking branch 'asoc/for-5.13' into asoc-nextMark Brown
2021-03-23ASoC: SOF: Intel: hda: drop display power on/off in D0i3 flowsKai Vehmanen
Controller needs to ensure display power is enabled only for HDA controller reset. Drop the display power-up/down calls from D0i3 entry/exit paths. This was previously not possible as codec drivers could not resume the links, and instead controller kept the reference to display power. The state of display power had be maintained in the D0i3 entry/exit code. With commit 87fc20e4a0cb ("ASoC: SOF: Intel: hda: use hdac_ext fine-grained link management"), this is no longer needed and the code can be cleaned up. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Keyon Jie <yang.jie@intel.com> Link: https://lore.kernel.org/r/20210322143830.3880293-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-23ASoC: SOF: Intel: TGL: set shutdown callback to hda_dsp_shutdownLibin Yang
According to hardware spec and PMC FW requirement, the DSP must be in D3 state before entering S5. Define the shutdown function to use snd_sof_suspend as shutdown callback to make sure DSP is in D3 state. Fixes: 44a4cfad8d78 ("ASoC: SOF: Intel: tgl: do thorough remove at .shutdown() callback") Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com> Signed-off-by: Libin Yang <libin.yang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210322163728.16616-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-23ASoC: SOF: Intel: HDA: fix core status verificationGuennadi Liakhovetski
When checking for enabled cores it isn't enough to check that some of the requested cores are running, we have to check that all of them are. Fixes: 747503b1813a ("ASoC: SOF: Intel: Add Intel specific HDA DSP HW operations") Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210322163728.16616-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: SOF: Intel: hda: turn off display power in resumeKai Vehmanen
Turn off display power at the end of controller resume flow. This is now possible with the changes done in commit 87fc20e4a0cb ("ASoC: SOF: Intel: hda: use hdac_ext fine-grained link management"). As codec driver is able to request the HDA link to be brought back up, the controller no longer needs to blindly keep display power enabled. Co-developed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Keyon Jie <yang.jie@intel.com> Link: https://lore.kernel.org/r/20210224141541.3331254-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>