1
0
Fork 0
Commit Graph

52 Commits (769e155c5395100fc468aa87703c486f276c16cd)

Author SHA1 Message Date
Pan Xiuli fd82991819
ASoC: SOF: intel: fix wrong poll bits in dsp power down
The ADSPCS_SPA is Set Power Active bit. To check if DSP is powered
down, we need to check ADSPCS_CPA, the Current Power Active bit.

Fixes: 747503b181 ("ASoC: SOF: Intel: Add Intel specific HDA DSP HW operations")
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210309004127.4940-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:53:24 +00:00
Guennadi Liakhovetski f1bb023525
ASoC: SOF: HDA: (cosmetic) simplify hda_dsp_d0i3_work()
Simplify hda_dsp_d0i3_work() by returning immediately from it
if D0i3 cannot be set.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Libin Yang <libin.yang@intel.com>
Reviewed-by: Keyon Jie <yang.jie@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/20210208232149.58899-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-10 17:17:12 +00:00
Curtis Malainey ce1f55bac5
ASoC: SOF: fix string format for errors
These are negative error return values, printing them as hex is annoying
and not beneficial. Switch back to signed type to make error lookup
simpler.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210208232149.58899-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-10 17:17:11 +00:00
Mark Brown 2927e6d398
Merge branch 'asoc-5.11' into asoc-5.12 2021-02-05 15:01:21 +00:00
Bard Liao f6c246eacb
ASoC: SOF: Intel: hda: use snd_sof_dsp_core_power_up/down API
To implement common logic in SOF core, core power up/down flows should
use common SOF API and not directly use low-level platform specific
helper functions.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210128093850.1041387-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-28 17:11:34 +00:00
Ranjani Sridharan 0084364d96
ASoC: SOF: Intel: hda: cancel D0i3 work during runtime suspend
Cancel the D0i3 work during runtime suspend as no streams are
active at this point anyway.

Fixes: 63e51fd33f ("ASoC: SOF: Intel: cnl: Implement feature to support DSP D0i3 in S0")
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@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/20210128092345.1033085-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-28 17:11:31 +00:00
Kai-Heng Feng ef4d764c99
ASoC: SOF: Intel: hda: Avoid checking jack on system suspend
System takes a very long time to suspend after commit 215a22ed31
("ALSA: hda: Refactor codec PM to use direct-complete optimization"):
[   90.065964] PM: suspend entry (s2idle)
[   90.067337] Filesystems sync: 0.001 seconds
[   90.185758] Freezing user space processes ... (elapsed 0.002 seconds) done.
[   90.188713] OOM killer disabled.
[   90.188714] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[   90.190024] printk: Suspending console(s) (use no_console_suspend to debug)
[   90.904912] intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [49C], continue to suspend
[  321.262505] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5
[  328.426919] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5
[  329.490933] ACPI: EC: interrupt blocked

That commit keeps the codec suspended during the system suspend. However,
mute/micmute LED will clear codec's direct-complete flag by
dpm_clear_superiors_direct_complete().

This doesn't play well with SOF driver. When its runtime resume is
called for system suspend, hda_codec_jack_check() schedules
jackpoll_work which uses snd_hdac_is_power_on() to check whether codec
is suspended. Because the direct-complete path isn't taken,
pm_runtime_disable() isn't called so snd_hdac_is_power_on() returns
false and jackpoll continues to run, and snd_hda_power_up_pm() cannot
power up an already suspended codec in multiple attempts, causes the
long delay on system suspend:

if (dev->power.direct_complete) {
	if (pm_runtime_status_suspended(dev)) {
		pm_runtime_disable(dev);
		if (pm_runtime_status_suspended(dev)) {
			pm_dev_dbg(dev, state, "direct-complete ");
			goto Complete;
		}

		pm_runtime_enable(dev);
	}
	dev->power.direct_complete = false;
}

When direct-complete path is taken, snd_hdac_is_power_on() returns true
and hda_jackpoll_work() is skipped by accident. So this is still not
correct.

If we were to use snd_hdac_is_power_on() in system PM path,
pm_runtime_status_suspended() should be used instead of
pm_runtime_suspended(), otherwise pm_runtime_{enable,disable}() may
change the outcome of snd_hdac_is_power_on().

Because devices suspend in reverse order (i.e. child first), it doesn't
make much sense to resume an already suspended codec from audio
controller. So avoid the issue by making sure jackpoll isn't used in
system PM process.

Fixes: 215a22ed31 ("ALSA: hda: Refactor codec PM to use direct-complete optimization")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210112181128.1229827-3-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-13 15:24:07 +00:00
Kai-Heng Feng 31ba0c0776
ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN
Modify hda_codec_jack_wake_enable() to also support disable WAKEEN.
In addition, this patch also moves the WAKEEN disablement call out of
hda_codec_jack_check() into hda_codec_jack_wake_enable().

This is a preparation for next patch.

No functional change intended.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20210112181128.1229827-2-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-13 15:24:06 +00:00
Julia Lawall bed5ed644c
ASoC: SOF: Intel: hda: use semicolons rather than commas to separate statements
Replace commas with semicolons.  What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

// <smpl>
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1602407979-29038-6-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-26 15:28:07 +00:00
Ranjani Sridharan 914fab3b43
ASoC: SOF: Intel: hda: modify core_power_up/down op
Modify the core_power_up/down ops for HDA platforms to restrict
the core_mask to the ones allowed by chip->cores_mask. This is needed
because on some HDA platforms not all cores can be powered up/down
by the host and this must be handled internally in the FW.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Keyon Jie <yang.jie@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/20200910164125.2033062-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-11 15:29:30 +01:00
Ranjani Sridharan 64b969177c
ASoC: SOF: rename cores_mask to host_managed_cores_mask
Rename the cores_mask in struct sof_intel_dsp_desc to
host_managed_cores_mask to be more indicative of the fact that
only these cores can be powered up/down by the host.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Keyon Jie <yang.jie@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/20200910164125.2033062-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-11 15:29:29 +01:00
Marcin Rajwa 79560b8aeb
ASoC: SOF: Intel: disable traces when switching to S0Ix D0I3
We should always disable DMA trace on S0Ix. When staying at S0-D0I3,
we should enable DMA trace while both DMA Trace debug is enabled and
hda_enable_trace_D0I3_S0 is set. This commit corrects the existed
logic errors about that.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200727183613.1419005-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-28 16:22:35 +01:00
Marcin Rajwa 195f101980
ASoC: SOF: Intel: fix the suspend procedure to support s0ix entry
This patch fixes the suspend & resume procedure to allow entry into the
low power states with some streams being active as a wake source - wake on
voice is a perfect example. The current implementation does not stop
the CORB/RIRB DMA and does not power down the HDA links. With firmware's
help, the platform has been able to still enter s0ix state on older
platforms, but the sequence is still incorrect, and the additional
driver actions are needed to ensure correct s0ix behaviour.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200727183613.1419005-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-28 16:22:34 +01:00
Kuninori Morimoto 1205300af9
ASoC: sof: use asoc_substream_to_rtd()
Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87o8ob0yun.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-23 19:07:24 +01:00
Pierre-Louis Bossart e149ca29f3
ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only
Remove the ambiguity with GPL-2.0 and use an explicit GPL-2.0-only
tag.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200501145850.15178-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-01 17:45:24 +01:00
Payal Kshirsagar 805a23de26
ASoC: SOF: Intel: hda: remove unnecessary parentheses
Remove unnecessary parentheses around the right hand side of an assignment
and align the code.

Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20200409184853.15896-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14 13:20:50 +01:00
Mark Brown a23d7f4a7c
Merge series "ASoC: remove rtd->cpu/codec_dai{s}" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

Now, CPU/Codec DAI(s) were replaced by rtd->dais.
Thus, We don't need rtd->cpu/codec_dai{s} anymore.
This pathset replaces it by new macro.

Kuninori Morimoto (36):
  ASoC: soc-core: add asoc_rtd_to_cpu/codec() macro
  ASoC: amd: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: atmel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: au1x: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: bcm: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: cirrus: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: dwc: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: fsl: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: generic: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: img: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: kirkwood: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: mediatek: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: meson: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: mxs: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: pxa: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: qcom: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: rockchip: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: samsung: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: sh: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: sof: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: sprd: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: stm: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: sunxi: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: tegra: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: ti: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: txx9: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: uniphier: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: ux500: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: xtensa: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: arm: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: codecs: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: soc: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: soc-core: set rtd->num_cpu/codec at soc_new_pcm_runtime()
  ASoC: soc-core: tidyup soc_new_pcm_runtime() rtd setups
  ASoC: soc-core: remove cpu_dai/codec_dai/cpu_dais/codec_dais

 include/sound/soc.h                           | 30 +++++++------
 sound/arm/pxa2xx-pcm-lib.c                    |  8 ++--
 sound/soc/amd/acp-da7219-max98357a.c          |  2 +-
 sound/soc/amd/acp-rt5645.c                    |  4 +-
 sound/soc/amd/acp3x-rt5682-max9836.c          |  6 +--
 sound/soc/atmel/atmel-pcm-dma.c               |  4 +-
 sound/soc/atmel/atmel-pcm-pdc.c               |  2 +-
 sound/soc/atmel/atmel_wm8904.c                |  2 +-
 sound/soc/atmel/mikroe-proto.c                |  2 +-
 sound/soc/atmel/sam9g20_wm8731.c              |  2 +-
 sound/soc/atmel/sam9x5_wm8731.c               |  2 +-
 sound/soc/au1x/db1200.c                       |  2 +-
 sound/soc/au1x/dbdma2.c                       |  2 +-
 sound/soc/au1x/dma.c                          |  2 +-
 sound/soc/au1x/psc-ac97.c                     |  2 +-
 sound/soc/bcm/bcm63xx-pcm-whistler.c          | 16 +++----
 sound/soc/bcm/cygnus-pcm.c                    | 22 +++++-----
 sound/soc/cirrus/edb93xx.c                    |  4 +-
 sound/soc/cirrus/snappercl15.c                |  4 +-
 sound/soc/codecs/cs47l15.c                    |  4 +-
 sound/soc/codecs/cs47l24.c                    |  6 +--
 sound/soc/codecs/cs47l35.c                    |  6 +--
 sound/soc/codecs/cs47l85.c                    |  6 +--
 sound/soc/codecs/cs47l90.c                    |  6 +--
 sound/soc/codecs/cs47l92.c                    |  4 +-
 sound/soc/codecs/wm5110.c                     |  6 +--
 sound/soc/codecs/wm_adsp.c                    | 10 ++---
 sound/soc/dwc/dwc-pcm.c                       |  2 +-
 sound/soc/fsl/eukrea-tlv320.c                 |  4 +-
 sound/soc/fsl/fsl-asoc-card.c                 | 10 ++---
 sound/soc/fsl/fsl_asrc_dma.c                  |  6 +--
 sound/soc/fsl/fsl_spdif.c                     | 10 ++---
 sound/soc/fsl/fsl_ssi.c                       |  8 ++--
 sound/soc/fsl/imx-audmix.c                    |  8 ++--
 sound/soc/fsl/imx-mc13783.c                   |  4 +-
 sound/soc/fsl/imx-sgtl5000.c                  |  2 +-
 sound/soc/fsl/mpc5200_dma.c                   | 10 ++---
 sound/soc/fsl/mpc5200_psc_i2s.c               |  2 +-
 sound/soc/fsl/mpc8610_hpcd.c                  |  4 +-
 sound/soc/fsl/mx27vis-aic32x4.c               |  4 +-
 sound/soc/fsl/p1022_ds.c                      |  4 +-
 sound/soc/fsl/p1022_rdk.c                     |  4 +-
 sound/soc/fsl/wm1133-ev1.c                    |  6 +--
 sound/soc/generic/simple-card-utils.c         | 12 +++---
 sound/soc/img/img-i2s-in.c                    |  2 +-
 sound/soc/img/img-i2s-out.c                   |  2 +-
 sound/soc/intel/atom/sst-mfld-platform-pcm.c  |  6 +--
 sound/soc/intel/boards/bdw-rt5650.c           |  6 +--
 sound/soc/intel/boards/bdw-rt5677.c           |  6 +--
 sound/soc/intel/boards/broadwell.c            |  4 +-
 sound/soc/intel/boards/bxt_da7219_max98357a.c |  8 ++--
 sound/soc/intel/boards/bxt_rt298.c            |  8 ++--
 sound/soc/intel/boards/byt-max98090.c         |  2 +-
 sound/soc/intel/boards/byt-rt5640.c           |  4 +-
 sound/soc/intel/boards/bytcht_cx2072x.c       | 10 ++---
 sound/soc/intel/boards/bytcht_da7213.c        |  8 ++--
 sound/soc/intel/boards/bytcht_es8316.c        |  8 ++--
 sound/soc/intel/boards/bytcht_nocodec.c       |  4 +-
 sound/soc/intel/boards/bytcr_rt5640.c         |  8 ++--
 sound/soc/intel/boards/bytcr_rt5651.c         |  8 ++--
 sound/soc/intel/boards/cht_bsw_max98090_ti.c  |  6 +--
 sound/soc/intel/boards/cht_bsw_nau8824.c      |  4 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c       | 14 +++----
 sound/soc/intel/boards/cht_bsw_rt5672.c       |  8 ++--
 sound/soc/intel/boards/cml_rt1011_rt5682.c    |  6 +--
 sound/soc/intel/boards/glk_rt5682_max98357a.c | 10 ++---
 sound/soc/intel/boards/haswell.c              |  2 +-
 sound/soc/intel/boards/kbl_da7219_max98357a.c |  8 ++--
 sound/soc/intel/boards/kbl_da7219_max98927.c  |  6 +--
 sound/soc/intel/boards/kbl_rt5660.c           |  6 +--
 sound/soc/intel/boards/kbl_rt5663_max98927.c  |  8 ++--
 .../intel/boards/kbl_rt5663_rt5514_max98927.c |  8 ++--
 .../soc/intel/boards/skl_nau88l25_max98357a.c | 12 +++---
 sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 16 +++----
 sound/soc/intel/boards/skl_rt286.c            |  8 ++--
 sound/soc/intel/boards/sof_da7219_max98373.c  |  8 ++--
 sound/soc/intel/boards/sof_pcm512x.c          |  8 ++--
 sound/soc/intel/boards/sof_rt5682.c           |  6 +--
 sound/soc/intel/haswell/sst-haswell-pcm.c     | 26 ++++++------
 sound/soc/intel/skylake/skl-pcm.c             | 10 ++---
 sound/soc/kirkwood/armada-370-db.c            |  2 +-
 sound/soc/kirkwood/kirkwood-dma.c             |  2 +-
 sound/soc/mediatek/common/mtk-afe-fe-dai.c    | 10 ++---
 .../mediatek/common/mtk-afe-platform-driver.c |  2 +-
 sound/soc/mediatek/mt2701/mt2701-afe-pcm.c    |  2 +-
 sound/soc/mediatek/mt2701/mt2701-cs42448.c    |  4 +-
 sound/soc/mediatek/mt2701/mt2701-wm8960.c     |  4 +-
 sound/soc/mediatek/mt6797/mt6797-afe-pcm.c    |  2 +-
 sound/soc/mediatek/mt8173/mt8173-afe-pcm.c    |  2 +-
 sound/soc/mediatek/mt8173/mt8173-max98090.c   |  4 +-
 .../mediatek/mt8173/mt8173-rt5650-rt5514.c    |  2 +-
 .../mediatek/mt8173/mt8173-rt5650-rt5676.c    |  4 +-
 sound/soc/mediatek/mt8173/mt8173-rt5650.c     |  6 +--
 sound/soc/mediatek/mt8183/mt8183-afe-pcm.c    |  2 +-
 .../mediatek/mt8183/mt8183-da7219-max98357.c  |  4 +-
 .../mt8183/mt8183-mt6358-ts3a227-max98357.c   |  2 +-
 sound/soc/meson/aiu-fifo.c                    |  2 +-
 sound/soc/meson/axg-card.c                    |  8 ++--
 sound/soc/meson/axg-fifo.c                    |  2 +-
 sound/soc/meson/meson-card-utils.c            |  2 +-
 sound/soc/mxs/mxs-sgtl5000.c                  |  4 +-
 sound/soc/pxa/brownstone.c                    |  4 +-
 sound/soc/pxa/corgi.c                         |  4 +-
 sound/soc/pxa/hx4700.c                        |  4 +-
 sound/soc/pxa/imote2.c                        |  4 +-
 sound/soc/pxa/magician.c                      |  8 ++--
 sound/soc/pxa/mioa701_wm9713.c                |  4 +-
 sound/soc/pxa/mmp-pcm.c                       |  2 +-
 sound/soc/pxa/mmp-sspa.c                      |  2 +-
 sound/soc/pxa/poodle.c                        |  4 +-
 sound/soc/pxa/pxa2xx-i2s.c                    |  2 +-
 sound/soc/pxa/spitz.c                         |  4 +-
 sound/soc/pxa/ttc-dkb.c                       |  2 +-
 sound/soc/pxa/z2.c                            |  4 +-
 sound/soc/pxa/zylonite.c                      |  6 +--
 sound/soc/qcom/apq8016_sbc.c                  |  2 +-
 sound/soc/qcom/apq8096.c                      |  6 +--
 sound/soc/qcom/lpass-platform.c               |  2 +-
 sound/soc/qcom/qdsp6/q6asm-dai.c              |  4 +-
 sound/soc/qcom/qdsp6/q6routing.c              |  2 +-
 sound/soc/qcom/sdm845.c                       | 22 +++++-----
 sound/soc/qcom/storm.c                        |  2 +-
 sound/soc/rockchip/rk3288_hdmi_analog.c       |  4 +-
 sound/soc/rockchip/rk3399_gru_sound.c         | 16 +++----
 sound/soc/rockchip/rockchip_max98090.c        |  6 +--
 sound/soc/rockchip/rockchip_rt5645.c          |  6 +--
 sound/soc/samsung/arndale.c                   |  6 +--
 sound/soc/samsung/bells.c                     | 16 +++----
 sound/soc/samsung/h1940_uda1380.c             |  2 +-
 sound/soc/samsung/i2s.c                       |  2 +-
 sound/soc/samsung/jive_wm8750.c               |  4 +-
 sound/soc/samsung/littlemill.c                | 14 +++----
 sound/soc/samsung/lowland.c                   |  4 +-
 sound/soc/samsung/neo1973_wm8753.c            | 10 ++---
 sound/soc/samsung/odroid.c                    |  2 +-
 sound/soc/samsung/pcm.c                       |  4 +-
 sound/soc/samsung/rx1950_uda1380.c            |  2 +-
 sound/soc/samsung/s3c-i2s-v2.c                |  2 +-
 sound/soc/samsung/s3c24xx_simtec.c            |  4 +-
 sound/soc/samsung/s3c24xx_uda134x.c           |  6 +--
 sound/soc/samsung/smartq_wm8987.c             |  4 +-
 sound/soc/samsung/smdk_spdif.c                |  2 +-
 sound/soc/samsung/smdk_wm8580.c               |  2 +-
 sound/soc/samsung/smdk_wm8994.c               |  2 +-
 sound/soc/samsung/smdk_wm8994pcm.c            |  4 +-
 sound/soc/samsung/snow.c                      |  4 +-
 sound/soc/samsung/spdif.c                     |  8 ++--
 sound/soc/samsung/speyside.c                  |  8 ++--
 sound/soc/samsung/tm2_wm5110.c                | 16 +++----
 sound/soc/samsung/tobermory.c                 |  8 ++--
 sound/soc/sh/dma-sh7760.c                     | 16 +++----
 sound/soc/sh/fsi.c                            |  2 +-
 sound/soc/sh/migor.c                          |  6 +--
 sound/soc/sh/rcar/core.c                      |  2 +-
 sound/soc/soc-compress.c                      | 36 ++++++++--------
 sound/soc/soc-core.c                          | 42 +++++++------------
 sound/soc/soc-dapm.c                          |  4 +-
 sound/soc/soc-generic-dmaengine-pcm.c         |  6 +--
 sound/soc/soc-pcm.c                           | 30 ++++++-------
 sound/soc/sof/intel/hda-dai.c                 |  6 +--
 sound/soc/sof/intel/hda-dsp.c                 |  2 +-
 sound/soc/sprd/sprd-pcm-compress.c            |  4 +-
 sound/soc/sprd/sprd-pcm-dma.c                 |  2 +-
 sound/soc/stm/stm32_adfsdm.c                  | 12 +++---
 sound/soc/stm/stm32_sai_sub.c                 |  2 +-
 sound/soc/sunxi/sun4i-spdif.c                 |  2 +-
 sound/soc/tegra/tegra_alc5632.c               |  2 +-
 sound/soc/tegra/tegra_max98090.c              |  2 +-
 sound/soc/tegra/tegra_rt5640.c                |  2 +-
 sound/soc/tegra/tegra_rt5677.c                |  2 +-
 sound/soc/tegra/tegra_sgtl5000.c              |  2 +-
 sound/soc/tegra/tegra_wm8753.c                |  2 +-
 sound/soc/tegra/tegra_wm8903.c                |  6 +--
 sound/soc/tegra/trimslice.c                   |  2 +-
 sound/soc/ti/ams-delta.c                      |  4 +-
 sound/soc/ti/davinci-evm.c                    |  4 +-
 sound/soc/ti/davinci-vcif.c                   |  4 +-
 sound/soc/ti/n810.c                           |  2 +-
 sound/soc/ti/omap-abe-twl6040.c               |  6 +--
 sound/soc/ti/omap-mcbsp-st.c                  |  2 +-
 sound/soc/ti/omap-mcbsp.c                     |  4 +-
 sound/soc/ti/omap-mcpdm.c                     |  2 +-
 sound/soc/ti/omap3pandora.c                   |  4 +-
 sound/soc/ti/osk5912.c                        |  2 +-
 sound/soc/ti/rx51.c                           |  2 +-
 sound/soc/txx9/txx9aclc.c                     |  2 +-
 sound/soc/uniphier/aio-compress.c             | 22 +++++-----
 sound/soc/uniphier/aio-dma.c                  |  6 +--
 sound/soc/ux500/mop500_ab8500.c               |  6 +--
 sound/soc/ux500/ux500_pcm.c                   |  8 ++--
 sound/soc/xtensa/xtfpga-i2s.c                 |  2 +-
 191 files changed, 573 insertions(+), 577 deletions(-)

--
2.17.1
2020-03-27 15:33:10 +00:00
Pierre-Louis Bossart 3eadff5639
ASoC: SOF: Intel: hda: disable SoundWire interrupts on suspend
Doing this avoid conflicts and errors reported on the bus.

The interrupts are only re-enabled on resume after the firmware is
downloaded, so the behavior is not fully symmetric

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200325215027.28716-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-27 15:16:33 +00:00
Kuninori Morimoto be3e8de706
ASoC: sof: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87d093ir4q.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-27 14:44:47 +00:00
Ranjani Sridharan 66de6beb93
ASoC: SOF: Intel: hda: Improve DSP state logging
Improve the DSP power state logs with the state names
instead of values.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200325211233.27394-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-26 18:31:13 +00:00
Ranjani Sridharan 787c5214ea
ASoC: SOF: Intel: hda: use snd_sof_dsp_set_power_state() op
Replace the calls to hda_dsp_set_power_state() with the
top-level SOF op snd_sof_set_power_state().
Along with this, modify the hda_dsp_resume() function to return
the value of snd_sof_set_power_state() directly.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200228234225.6963-1-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-02 14:31:43 +00:00
Mark Brown 7b94ace7ec
Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.7 2020-02-11 16:18:04 +00:00
Ranjani Sridharan 851fd87324
ASoC: SOF: Intel: hda: Allow trace DMA in S0 when DSP is in D0I3 for debug
Trace DMA is disabled by default when the DSP is in D0I3.
Add a debug option to keep trace DMA enabled when the DSP
is in D0I3 during S0.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200129220726.31792-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-11 11:48:08 +00:00
Ranjani Sridharan 63e51fd33f
ASoC: SOF: Intel: cnl: Implement feature to support DSP D0i3 in S0
This patch implements support for DSP D0i3 when the system
is in S0. The basic idea is to schedule a delayed work after
every successful IPC TX that checks if there are only
D0I3-compatible streams active and if so transition
the DSP to D0I3.

With the introduction of DSP D0I3 in S0, we need to
ensure that the DSP is in D0I0 before sending any new
IPCs. The exception for this would be the
compact IPCs that are used to set the DSP in
D0I3/D0I0 states.

Signed-off-by: Keyon Jie <yang.jie@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>
Link: https://lore.kernel.org/r/20200129220726.31792-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-11 11:48:07 +00:00
Ranjani Sridharan 207bf12f64
ASoC: SOF: Intel: hda: Amend the DSP state transition diagram
Amend the DSP state transition diagram in preparation
for introducing the feature to support opportunistic
DSP D0I3 state when the system is in S0.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200129220726.31792-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-11 11:48:06 +00:00
Ranjani Sridharan 61e285caf4
ASoC: SOF: Move DSP power state transitions to platform-specific ops
The DSP device substates such as D0I0/D0I3
are platform-specific. Therefore, the d0_substate
field of struct snd_sof_dev is replaced
with the dsp_power_state field which represents the current
state of the DSP. This field holds both the device state
and the platform-specific substate values.

With the DSP device substates being platform-specific,
the DSP power state transitions need to be performed in
the platform-specific suspend/resume ops as well.

In order to achieve this, the ops signature has to be
modified to pass the target device state as an
argument. The target substate will be determined by
the platform-specific ops before performing the transition.
For example, in the case of the system suspending to S0IX,
the top-level SOF device suspend callback needs to
only determine if the DSP will be entering
D3 or remain in D0. The target substate in case the device
needs to remain in D0 (D0I0 or D0I3) will be determined
by the platform-specific suspend op.

With the addition of the extended set of power states for the DSP,
the set_power_state op for HDA platforms has to be extended
to handle only the appropriate state transitions. So, the
implementation for the Intel HDA platforms is also modified.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200129220726.31792-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-11 11:48:05 +00:00
Ranjani Sridharan 043ae13bbd
ASoC: SOF: Add system_suspend_target field to struct snd_sof_dev
Add the system_suspend_target field to struct snd_sof_dev
to track the intended system suspend power target. This will
be used as one of the criteria for determining the
final DSP power state.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200129220726.31792-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-11 11:48:03 +00:00
Kai Vehmanen 816938b272
ASoC: SOF: Intel: hda: fix ordering bug in resume flow
When HDA controller is resumed from suspend, i915 HDMI/DP
codec requires that following order of actions is kept:

 - i915 display power up and configuration of link params
 - hda link reset and setup

Current SOF HDA code delegates display codec power control
to the codec driver. This works most of the time, but in
runtime PM sequences, the above constraint may be violated.
On platforms where BIOS values for HDA link parameters do
not match hardware reset defaults, this may lead to errors
in HDA verb transactions after resume.

Fix the issue by explicitly powering the display codec
in the HDA controller resume/suspend calls, thus ensuring
correct ordering. Special handling is needed for the D0i3
flow, where display power must be turned off even though
DSP is left powered.

Now that we have more invocations of the display power helper
functions, the conditional checks surrounding each call have
been moved inside hda_codec_i915_display_power(). The two
special cases of display powering at initial probe are handled
separately. The intent is to avoid powering the display whenever
no display codecs are used.

Note that early powering of display was removed in
commit 687ae9e287 ("ASoC: intel: skl: Fix display power regression").
This change was also copied to the SOF driver. No failures
have resulted as hardware default values for link parameters
have worked out of the box. However with recent i915 driver
changes like done in commit 87c1694533 ("drm/i915: save
AUD_FREQ_CNTRL state at audio domain suspend"), this does not
hold anymore and errors are hit.

Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200206200223.7715-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-10 14:06:04 +00:00
Keyon Jie 16299326a0
ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
Set L1SEN to make sure the system can enter S0ix, and restore it on
resume.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-08 12:10:08 +00:00
Ranjani Sridharan 65c56f5dcc
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.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-04 13:23:04 +00:00
Keyon Jie 66e40876dd
ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition
Enable system wake up via IPC interrupt from DSP when the system is
suspending to the S0ix state, and disable it in the corresponding
resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-28 14:46:12 +00:00
Keyon Jie 534037fddd
ASoC: SOF: configure D0ix IPC flags in set_power_state
The configuration for D0ix in FW is platform specific, let's do this and
send IPC in the platform set_power_state() ops.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-28 14:44:07 +00:00
Keyon Jie 92f4beb718
ASoC: SOF: Intel: HDA: use macro for register polling retry count
Define macro and use it for the register polling retry count.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-28 14:42:53 +00:00
Keyon Jie aae7c82d01
ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update
Align the logs for CIP timeout at D0I3C.I3 updating.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-28 14:42:45 +00:00
Keyon Jie 62f8f76604
ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
be needed for driver D0ix support.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-28 14:41:11 +00:00
Pierre-Louis Bossart 6a414489e0
ASoC: SOF: Intel: hda: add dev_err() traces for snd_sof_dsp_read_poll_timeout()
Such traces should be extremely rare but extremely useful for debug.

Report errors for all calls to sdn_sof_dsp_read_poll_timeout(), but
only on negative values for consistency.

Add traces that enable each timeout to be uniquely identified.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191022192844.21022-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-23 17:45:55 +01:00
Pierre-Louis Bossart 9c6c417d95
ASoC: SOF: fix HDA direct MMIO access
The recent change to remove the bus->io_ops callbacks used an older
version of the SOF code base, and when merged into Mark's for-next it
invalidated changes, resulting in broken compilation identified by
kbuild and reproduced during the weekly SOF rebase.

Restore SOF code overridden by git merge and apply Takashi's intended
change in the 'right' location.

Fixes: c2f16a94a8 ("Merge branch 'topic/hda-bus-ops-cleanup'")
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190812190502.30729-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-13 12:41:04 +01:00
Mark Brown c2f16a94a8
Merge branch 'topic/hda-bus-ops-cleanup' of https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-5.4 2019-08-08 23:20:45 +01:00
Takashi Iwai 19abfefd4c ALSA: hda: Direct MMIO accesses
HD-audio drivers access to the mmio registers indirectly via the
corresponding bus->io_ops callbacks.  This is because some platform
(notably Tegra SoC) requires the word-aligned access.  But it's rather
a rare case, and other platforms suffer from the penalties by indirect
calls unnecessarily.

This patch is an attempt to optimize and cleanup for this situation.
Now the special aligned access is used only when a new kconfig
CONFIG_SND_HDA_ALIGNED_MMIO is set.  And the HD-audio core itself
provides the aligned MMIO access helpers instead of the driver side.
If Kconfig isn't set (as default), the standard helpers like readl()
or writel() are used directly.

A couple of places in ASoC Intel drivers have the access via io_ops
reg_writel(), and they are replaced with the direct writel() calls.

And now with this patch, the whole bus->io_ops becomes empty, so it's
dropped completely.  The bus initialization functions are changed
accordingly as well to drop the whole bus->io_ops.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-08 16:36:18 +02:00
Rander Wang 810dbea365
ASoC: SOF: Intel: hda: fix stream id setting
snd_hdac_ext_link_clear_stream_id maps stream id to
link output, which is for playback, not capture.

Tested on Whiskey Lake platform.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:25:31 +01:00
Rander Wang 934bf82203
ASoC: SOF: Intel: hda: fix link DMA config
For this bug, there are two capture pcm streams active, with one
stream and its related stream tag released before suspend. Later
when system suspend is done, the stream tag for the remaining
active stream is released by SOF driver. After system resume, hda
codec driver restores the stream tag for the active pcm stream,
but SOF goes to assign a new one, which now doesn't match with the
stream tag used by codec driver, and this causes DMA to fail
receiving data, leading to unrecoverable XRUN condition in FW.

For stream tag is stored in both hda codec and SOF driver, it
shouldn't be released only in SOF driver. This patch just keeps the
stream information in dma data and checks whether there is a stored
DMA data for stream resuming from S3 and restores it. And it also
removes DMA data when the stream is released.

Tested on Whiskey Lake platform.

GitHub issue: https://github.com/thesofproject/sof/issues/1594
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:25:22 +01:00
Kai Vehmanen a3ebccb52e
ASoC: SOF: Intel: hda: reset link DMA state in prepare
When application goes through SUSPEND/STOP->PREPARE->START
cycle, we should always reprogram the DAI link DMA to ensure
it is in sync with the host PCM DMA.

Use same state tracking logic to handle both restart and
system resume flows. Use link_prepared field of
'struct hdac_ext_stream' to store the state, instead of
adding redundant fields to SOF specific structs.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:22:02 +01:00
Zhu Yingjiang d06973515f
ASoC: SOF: Intel: hda: use SOF defined init chip in resume
Unify resume code by using SOF common function hda_dsp_ctrl_init_chip()
which can handle both HDA and non-HDA cases. Move code to reset
stream-to-link mapping into hda_dsp_ctrl_init_chip().

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:21:29 +01:00
Rander Wang fd15f2f5e2
ASoC: SOF: Intel: hda: Enable jack detection
In commit 7d4f606c50 ("ALSA: hda - WAKEEN feature enabling for
runtime pm"), legacy HD-A driver sets hda controller in reset mode after
entering runtime-suspend. And when resuming from suspend mode, it checks
hda controller & codec status to detect headphone hotplug event. Now
this patch does the same job in SOF runtime pm functions.

And we need to check all the non-hdmi codecs for some cases like playback
with HDMI or capture with DMIC connected to dsp. In these cases, only
controller is active and codecs are suspended, so codecs can't send
unsolicited event to controller. The jack polling operation will activate
codecs and unsolicited event can work even codecs become suspended later.

Tested on whiskylake with hda codecs.

Signed-off-by: Rander Wang <rander.wang@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/20190722141402.7194-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:21:03 +01:00
Rander Wang 6aa232e1cc
ASoC: SOF: Intel: hda: reduce ifdef usage for hda
Move the code for hda to one point

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:20:55 +01:00
Fred Oh 1c38c9223d
ASoC: SOF: remove unused state variable in suspend function
Remove unused and no plan to use variable from suspend function.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23 12:20:21 +01:00
Kai Vehmanen 87a6fe80d5
ASoC: SOF: Intel: implement runtime idle for CNL/APL
Implement runtime idle for CNL/APL devices using similar runtime
PM idle logic as the Intel AZX HDA driver. If any HDA codecs are
powered when runtime suspend request comes, return -EBUSY. By doing
this, strict ordering is enforced between HDA codec and the HDA
controller.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20190702132428.13129-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-06 12:23:47 +01:00
Zhu Yingjiang 9a50ee58b8
ASoC: SOF: Intel: hda: use the defined stop chip in suspend
Unify suspend code by using SOF common function
hda_dsp_ctrl_stop_chip() which can handle both HDA
and non-HDA cases.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-17 13:45:39 +01:00
Zhu Yingjiang 24b6ff686f
ASoC: SOF: Intel: hda: use the SOF defined ppcap functions
Unify ppcap function setup by using SOF common functions
for both HDA and non-HDA cases.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-17 13:45:02 +01:00
Ranjani Sridharan 7077a07a72
ASoC: SOF: Intel: hda: release link DMA for paused streams during suspend
Paused streams do not get suspended when the system enters S3.
So, clear and release link DMA channel for such streams in the
hda_dsp_set_hw_params_upon_resume() callback. Also, invalidate
the link DMA channel in the DAI config before restoring the
dai config upon resume. Also, modify the signature for the
set_hw_params_upon_resume() op to return an int.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-17 13:43:48 +01:00