diff options
| author | Linus Torvalds <[email protected]> | 2020-08-06 14:27:31 -0700 | 
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2020-08-06 14:27:31 -0700 | 
| commit | 3f9df56480fc8ce492fc9e988d67bdea884ed15c (patch) | |
| tree | 6e1c5ed1e28b72435995b8bcd191daa7dfdf770e /sound/soc/sof/intel/hda-dsp.c | |
| parent | 921d2597abfc05e303f08baa6ead8f9ab8a723e1 (diff) | |
| parent | c7fabbc51352f50cc58242a6dc3b9c1a3599849b (diff) | |
Merge tag 'sound-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
 "This became wide and scattered updates all over the sound tree as
  diffstat shows: lots of (still ongoing) refactoring works in ASoC,
  fixes and cleanups caught by static analysis, inclusive term
  conversions as well as lots of new drivers. Below are highlights:
  ASoC core:
   - API cleanups and conversions to the unified mute_stream() call
   - Simplify I/O helper functions
   - Use helper macros to retrieve RTD from substreams
  ASoC drivers:
   - Lots of fixes and cleanups in Intel ASoC drivers
   - Lots of new stuff: Freescale MQS and i.MX6sx, Intel KeemBay I2S,
     Maxim MAX98360A and MAX98373 SoundWire, various Mediatek boards,
     nVidia Tegra 186 and 210, RealTek RL6231, Samsung Midas and Aries
     boards, TI J721e EVM
  ALSA core:
   - Minor code refacotring for SG-buffer handling
  HD-audio:
   - Generalization of mute-LED handling with LED classdev
   - Intel silent stream support for HDMI
   - Device-specific fixes: CA0132, Loongson-3
  Others:
   - Usual USB- and HD-audio quirks for various devices
   - Fixes for echoaudio DMA position handling
   - Various documents and trivial fixes for sparse warnings
   - Conversion to adopt inclusive terms"
* tag 'sound-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (479 commits)
  ALSA: pci: delete repeated words in comments
  ALSA: isa: delete repeated words in comments
  ALSA: hda/tegra: Add 100us dma stop delay
  ALSA: hda: Add dma stop delay variable
  ASoC: hda/tegra: Set buffer alignment to 128 bytes
  ALSA: seq: oss: Serialize ioctls
  ALSA: hda/hdmi: Add quirk to force connectivity
  ALSA: usb-audio: add startech usb audio dock name
  ALSA: usb-audio: Add support for Lenovo ThinkStation P620
  Revert "ALSA: hda: call runtime_allow() for all hda controllers"
  ALSA: hda/ca0132 - Fix AE-5 microphone selection commands.
  ALSA: hda/ca0132 - Add new quirk ID for Recon3D.
  ALSA: hda/ca0132 - Fix ZxR Headphone gain control get value.
  ALSA: hda/realtek: Add alc269/alc662 pin-tables for Loongson-3 laptops
  ALSA: docs: fix typo
  ALSA: doc: use correct config variable name
  ASoC: core: Two step component registration
  ASoC: core: Simplify snd_soc_component_initialize declaration
  ASoC: core: Relocate and expose snd_soc_component_initialize
  ASoC: sh: Replace 'select' DMADEVICES 'with depends on'
  ...
Diffstat (limited to 'sound/soc/sof/intel/hda-dsp.c')
| -rw-r--r-- | sound/soc/sof/intel/hda-dsp.c | 50 | 
1 files changed, 45 insertions, 5 deletions
| diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 9e5ff8c18f99..ed4d65a29d3a 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -408,11 +408,13 @@ static int hda_dsp_set_D0_state(struct snd_sof_dev *sdev,  		value = SOF_HDA_VS_D0I3C_I3;  		/* -		 * Trace DMA is disabled by default when the DSP enters D0I3. -		 * But it can be kept enabled when the DSP enters D0I3 while the -		 * system is in S0 for debug. +		 * Trace DMA need to be disabled when the DSP enters +		 * D0I3 for S0Ix suspend, but it can be kept enabled +		 * when the DSP enters D0I3 while the system is in S0 +		 * for debug purpose.  		 */ -		if (hda_enable_trace_D0I3_S0 && +		if (!sdev->dtrace_is_supported || +		    !hda_enable_trace_D0I3_S0 ||  		    sdev->system_suspend_target != SOF_SUSPEND_NONE)  			flags = HDA_PM_NO_DMA_TRACE;  	} else { @@ -696,12 +698,35 @@ int hda_dsp_resume(struct snd_sof_dev *sdev)  		.state = SOF_DSP_PM_D0,  		.substate = SOF_HDA_DSP_PM_D0I0,  	}; +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) +	struct hdac_bus *bus = sof_to_bus(sdev); +	struct hdac_ext_link *hlink = NULL; +#endif  	int ret;  	/* resume from D0I3 */  	if (sdev->dsp_power_state.state == SOF_DSP_PM_D0) {  		hda_codec_i915_display_power(sdev, true); +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) +		/* power up links that were active before suspend */ +		list_for_each_entry(hlink, &bus->hlink_list, list) { +			if (hlink->ref_count) { +				ret = snd_hdac_ext_bus_link_power_up(hlink); +				if (ret < 0) { +					dev_dbg(sdev->dev, +						"error %x in %s: failed to power up links", +						ret, __func__); +					return ret; +				} +			} +		} + +		/* set up CORB/RIRB buffers if was on before suspend */ +		if (bus->cmd_dma_state) +			snd_hdac_bus_init_cmd_io(bus); +#endif +  		/* Set DSP power state */  		ret = snd_sof_dsp_set_power_state(sdev, &target_state);  		if (ret < 0) { @@ -808,6 +833,21 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)  						HDA_VS_INTEL_EM2_L1SEN,  						HDA_VS_INTEL_EM2_L1SEN); +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) +		/* stop the CORB/RIRB DMA if it is On */ +		if (bus->cmd_dma_state) +			snd_hdac_bus_stop_cmd_io(bus); + +		/* no link can be powered in s0ix state */ +		ret = snd_hdac_ext_bus_link_power_down_all(bus); +		if (ret < 0) { +			dev_dbg(sdev->dev, +				"error %d in %s: failed to power down links", +				ret, __func__); +			return ret; +		} +#endif +  		/* enable the system waking up via IPC IRQ */  		enable_irq_wake(pci->irq);  		pci_save_state(pci); @@ -846,7 +886,7 @@ int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev)  		 * explicitly during suspend.  		 */  		if (stream->link_substream) { -			rtd = snd_pcm_substream_chip(stream->link_substream); +			rtd = asoc_substream_to_rtd(stream->link_substream);  			name = asoc_rtd_to_codec(rtd, 0)->component->name;  			link = snd_hdac_ext_bus_get_link(bus, name);  			if (!link) |