History log of /linux-master/sound/soc/intel/skylake/skl.c
Revision Date Author Comments
# e6d0c13e 09-Oct-2023 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init

Now that all drivers have moved from modprobe loading to
handling -EPROBE_DEFER, we can remove the argument again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-14-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e46f1377 09-Oct-2023 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

ASoC: Intel: Skylake: Move snd_hdac_i915_init to before probe_work.

Now that we can use -EPROBE_DEFER, it's no longer required to spin off
the snd_hdac_i915_init into a workqueue. It's likely the whole workqueue
can be destroyed, but I don't have the means to test this.

Removing the workqueue would simplify init even further, but is left
as exercise for the reviewer.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-12-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 32f4e921 09-Oct-2023 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init

Xe is a new GPU driver that re-uses the display (and sound) code from
i915. It's no longer possible to load i915, as the GPU can be driven
by the xe driver instead.

The new behavior will return -EPROBE_DEFER, and wait for a compatible
driver to be loaded instead of modprobing i915.

Converting all drivers at the same time is a lot of work, instead we
will convert each user one by one.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-8-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 842a62a7 19-Sep-2023 Bard Liao <yung-chuan.liao@linux.intel.com>

ASoC: hdac_hda: add HDA patch loader support

HDA patch loader is supported by legacy HDA driver. Implement it on
ASoC HDA driver, too.

Signed-off-by: Bard Liao <yung-chuan.liao@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: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230919083209.1919921-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a2db8743 17-Jul-2023 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Intel: Skylake: Convert to PCI device IDs defines

Use PCI device IDs from pci_ids.h header and while at it change to using
PCI_DEVICE_DATA() macro, to simplify declarations. As Apollolake is
Broxton-P successor that made it to the market, be precise and use APL
shortcut.

Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230717114511.484999-14-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17110723 05-Dec-2022 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Fix driver hang during shutdown

AudioDSP cores and HDAudio links need to be turned off on shutdown to
ensure no communication or data transfer occurs during the procedure.

Fixes: c5a76a246989 ("ASoC: Intel: Skylake: Add shutdown callback")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Tested-by: Lukasz Majczak <lma@semihlaf.com>
Link: https://lore.kernel.org/r/20221205085330.857665-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0aa60ddc 21-Oct-2022 Yang Yingliang <yangyingliang@huawei.com>

ASoC: Intel: Skylake: fix possible memory leak in skl_codec_device_init()

If snd_hdac_device_register() fails, 'codec' and name allocated in
dev_set_name() called in snd_hdac_device_init() are leaked. Fix this
by calling put_device(), so they can be freed in snd_hda_codec_dev_release()
and kobject_cleanup().

Fixes: e4746d94d00c ("ASoC: Intel: Skylake: Introduce HDA codec init and exit routines")
Fixes: dfe66a18780d ("ALSA: hdac_ext: add extended HDA bus")
Suggested-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221021123849.456857-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7f05ca9a 19-Oct-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all

No functionality change, just prefix addition to clearly identify that
the helper only applies to the 'ext' part for Intel platforms.

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/20221019162115.185917-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fac33cb5 17-Oct-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: simplify S3 resume flows

Commit cce6c149eba3a ("ASoC: Intel: Skylake: add link management")
added a perfectly logical/symmetrical link handling for
'suspend_active' aka S0ix

However that commit also added a less obvious part, where during S3
resume the code will "turn off the links which are off before suspend"
as well as stop the cmd_io which is not started.

This sequence looks completely unnecessary and possibly wrong, remove it.

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-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0e213813 20-Oct-2022 Yang Yingliang <yangyingliang@huawei.com>

ASoC: Intel: Skylake: fix possible memory leak in skl_codec_device_init()

If snd_hdac_device_register() fails, 'codec' and name allocated in
dev_set_name() called in snd_hdac_device_init() are leaked. Fix this
by calling put_device(), so they can be freed in snd_hda_codec_dev_release()
and kobject_cleanup().

Fixes: e4746d94d00c ("ASoC: Intel: Skylake: Introduce HDA codec init and exit routines")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Suggested-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221020105937.1448951-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d508260e 16-Sep-2022 Yang Yingliang <yangyingliang@huawei.com>

ASoC: Intel: skylake: remove unnecessary dev_set_drvdata()

Remove unnecessary dev_set_drvdata() in skl_remove(), the driver_data
will be set to NULL in device_unbind_cleanup() after calling ->remove().

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220916140757.681414-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0839a04e 19-Sep-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: Use hdac_ext prefix in snd_hdac_stream_free_all() for clarity

Make sure there's no ambiguity on layering with the appropriate prefix
added.

Pure rename, no functionality changed.

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20220919121041.43463-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 515626a3 21-Aug-2022 Gaosheng Cui <cuigaosheng1@huawei.com>

ASoC: Intel: fix unused-variable warning in probe_codec

In configurations with CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=n,
gcc warns about an unused variable:

sound/soc/intel/skylake/skl.c: In function ‘probe_codec’:
sound/soc/intel/skylake/skl.c:729:18: error: unused variable ‘skl’ [-Werror=unused-variable]
struct skl_dev *skl = bus_to_skl(bus);
^~~
cc1: all warnings being treated as errors

Fixes: 3fd63658caed9 ("ASoC: Intel: Drop hdac_ext usage for codec device creation")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220822035133.2147381-1-cuigaosheng1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a74bfc9e 21-Aug-2022 Gaosheng Cui <cuigaosheng1@huawei.com>

ASoC: Intel: fix unused-variable warning in probe_codec

In configurations with CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=n,
gcc warns about an unused variable:

sound/soc/intel/skylake/skl.c: In function ‘probe_codec’:
sound/soc/intel/skylake/skl.c:729:18: error: unused variable ‘skl’ [-Werror=unused-variable]
struct skl_dev *skl = bus_to_skl(bus);
^~~
cc1: all warnings being treated as errors

Fixes: 3fd63658caed9 ("ASoC: Intel: Drop hdac_ext usage for codec device creation")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220822035133.2147381-1-cuigaosheng1@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3fd63658 16-Aug-2022 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Drop hdac_ext usage for codec device creation

To make snd_hda_codec_device_init() the only constructor for struct
hda_codec instances remaining tasks are:

1) no struct may wrap struct hda_codec as its base type
2) bus drivers (skylake and sof) which are the current hdac_ext users
need to be adjusted to make use of newly added codec init and exit
routines instead
3) as bus drivers (skylake and sof) are to be responsible for creating
codec device and assigning it to hdac_hda_priv->codec,
hdac_hda_dev_probe() has to be freed of that job

To keep git bisect happy, all of these in made in one-go.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220816111727.3218543-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e4746d94 16-Aug-2022 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Introduce HDA codec init and exit routines

Preliminary step in making snd_hda_codec_device_init() the only
constructor for struct hda_codec instances. To do that, existing usage
of hdac_ext equivalents has to be dropped.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220816111727.3218543-2-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c22a8086 15-Feb-2022 Takashi Iwai <tiwai@suse.de>

ASoC: intel: skylake: Set max DMA segment size

The recent code refactoring to use the standard DMA helper requires
the max DMA segment size setup for SG list management. Without it,
the kernel may spew warnings when a large buffer is allocated.

This patch sets up dma_set_max_seg_size() for avoiding spurious
warnings.

Fixes: 2c95b92ecd92 ("ALSA: memalloc: Unify x86 SG-buffer handling (take#3)")
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
BugLink: https://github.com/thesofproject/linux/issues/3430
Link: https://lore.kernel.org/r/20220215132756.31236-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 12054f0c 16-Dec-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA/ASoC: hda: move/rename snd_hdac_ext_stop_streams to hdac_stream.c

snd_hdac_ext_stop_streams() has really nothing to do with the
extension, it just loops over the bus streams.

Move it to the hdac_stream layer and rename to remove the 'ext'
prefix and add the precision that the chip will also be stopped.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216231128.344321-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d3afb002 14-Jan-2021 Takashi Iwai <tiwai@suse.de>

ASoC: intel: skl: Simplify with dma_set_mask_and_coherent()

ASoC Intel Skylake driver still has explicit calls of dma_set_mask()
and dma_set_coherent_mask().

Let's simplify with dma_set_mask_and_coherent().

Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210114133337.1039-2-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 163cd105 21-Sep-2020 Kai Vehmanen <kai.vehmanen@linux.intel.com>

ASoC: hdac: make SOF HDA codec driver probe deterministic

To provide backward compatibility to older systems, the SOF HDA driver
allows user to specify which HDMI codec driver to use at runtime via
kernel parameter. This mechanism has a subtle flaw in that it assumes
the codec drivers not to be loaded when the SOF PCI driver is loaded.

The problem is rooted in use of the hdev->type field.
snd_hdac_ext_bus_device_init() initializes this field to HDA_DEV_ASOC.
This signals the HDA core that ASoC drivers should be considered in
driver matching (hda_bus_match()). The SOF and SST drivers continue by
overriding this field to HDA_DEV_LEGACY and proceeding to load driver
modules with request_module(). Correct drivers will get loaded and
attached.

If however the codec drivers are already loaded when
snd_hdac_ext_bus_device_init() is called, the matching will not work as
expected as device type is still set to HDA_DEV_ASOC. Specifically if
hdac-hdmi is attached when machine driver is configured to use hdac-hda,
this leads to out-of-bounds memory access in
hda_dsp_hdmi_build_controls().

Fix the issue by adding codec type as a parameter to
snd_hdac_ext_bus_device_init() and ensuring type is set correctly from
the start.

Fixes: 139c7febad1a ("ASoC: SOF: Intel: add support for snd-hda-codec-hdmi")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921100841.2882662-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 135ab457 24-Aug-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: use consistent HDAudio spelling in comments/docs

We use HDaudio and HDAudio, pick one to make searches easier.
No functionality change

Reported-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-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/20200824200912.46852-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ca841843 12-Mar-2020 Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

ASoC: Intel: skylake: (cosmetic) remove redundant variable initialisations

Variables, used as loop iterators, don't need to be initialised.

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/20200312194859.4051-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9e6c382f 05-Mar-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Shield against no-NHLT configurations

Some configurations expose no NHLT table at all within their
/sys/firmware/acpi/tables. To prevent NULL-dereference errors from
occurring, adjust probe flow and append additional safety checks in
functions involved in NHLT lifecycle.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e603f11d 05-Mar-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Enable codec wakeup during chip init

Follow the recommendation set by hda_intel.c and enable HDMI/DP codec
wakeup during bus initialization procedure. Disable wakeup once init
completes.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a66f8839 05-Mar-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Select hda configuration permissively

With _reset_link removed from the probe sequence, codec_mask at the time
skl_find_hda_machine() is invoked will always be 0, so hda machine will
never be chosen. Rather than reorganizing boot flow, be permissive about
invalid mask. codec_mask will be set to proper value during probe_work -
before skl_codec_create() ever gets called.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2ef81057 05-Mar-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Remove superfluous chip initialization

Skylake driver does the controller init operation twice:
- first during probe (only to stop it just before scheduling probe_work)
- and during said probe_work where the actual correct sequence is
executed

To properly complete boot sequence when iDisp codec is present, bus
initialization has to be called only after _i915_init() finishes.
With additional _reset_list preceding _i915_init(), iDisp codec never
gets the chance to enumerate on the link. Remove the superfluous
initialization to address the issue.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ae91a189 12-Dec-2019 Takashi Iwai <tiwai@suse.de>

ASoC: intel: skylake: Remove superfluous bus ops

The bus_core_ops values set in skl driver are same as the default
values, so we can drop it and pass NULL to snd_hdac_ext_bus_init()
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191212191747.19995-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 82d9d54a 22-Oct-2019 Jaroslav Kysela <perex@perex.cz>

ALSA: hda: add Intel DSP configuration / probe code

For distributions, we need one place where we can decide
which driver will be activated for the auto-configation of the
Intel's HDA hardware with DSP. Actually, we cover three drivers:

* Legacy HDA
* Intel SST
* Intel Sound Open Firmware (SOF)

All those drivers registers similar PCI IDs, so the first
driver probed from the PCI stack can win. But... it is not
guaranteed that the correct driver wins.

This commit changes Intel's NHLT ACPI module to a common
DSP probe module for the Intel's hardware. All above sound
drivers calls this code. The user can force another behaviour
using the module parameter 'dsp_driver' located in
the 'snd-intel-dspcfg' module.

This change allows to add specific dmi checks for the specific
systems. The examples are taken from the pull request:

https://github.com/thesofproject/linux/pull/927

Tested on Lenovo Carbon X1 7th gen.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191022174313.29087-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 19abfefd 07-Aug-2019 Takashi Iwai <tiwai@suse.de>

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>


# 1169cbf6 29-Jul-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: use common NHLT module

No functionality change, only use common functions now.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bcc2a2dc 23-Jul-2019 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Merge skl_sst and skl into skl_dev struct

Skylake driver is divided into two modules:
- snd_soc_skl
- snd_soc_skl_ipc

and nothing would be wrong if not for the fact that both cannot exist
without one another. IPC module is not some kind of extension, as it is
the case for snd_hda_ext_core which is separated from snd_hda_core -
legacy hda interface. It's as much core Skylake module as snd_soc_skl
is.

Statement backed up by existence of circular dependency between this
two. To eliminate said problem, struct skl_sst has been created. From
that very momment, Skylake has been plagued by header errors (incomplete
structs, unknown references etc.) whenever something new is to be added
or code is cleaned up.

As this design is being corrected, struct skl_sst is no longer needed,
so combine it with struct skl. To avoid ambiguity when searching for skl
stuff (struct skl *skl) it has also been renamed to skl_dev.

No functional changes.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190723145854.8527-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e79986ce 17-Jun-2019 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Intel: Skylake: Properly cleanup on component removal

When we remove component we need to reverse things which were done on
init, this consists of topology cleanup, lists cleanup and releasing
firmware.

Currently cleanup handlers are put in wrong places or otherwise missing.
So add proper component cleanup function and perform cleanups in it.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 776cb3b8 17-Jun-2019 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Intel: Skylake: Initialize lists before access so they are safe to use

If skl_probe_work() was not run driver ends up dereferencing NULL
pointer when operating on lists in skl_platform_unregister().
To fix this initialize lists in skl_create(). Also run
cancel_work_sync() before all cleanup functions, so we don't end up
unnecessarily running probe work.

Easily reproducible with:
while true; do modprobe snd_soc_skl; rmmod snd_soc_skl; done
(with the assumption that relevant drivers are added to blacklist on
system boot)

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7a1954de 13-Jun-2019 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: Intel: Skylake: Fix incorrect capture position reporting

HW recommends to set DUM bit on device power up, so that DPIB write
request occurs every frame regardless of whether DPIB has changed or
not. This addresses incorrect position reporting for capture streams.

Signed-off-by: Leoni Prodduvaka <leoni.prodduvaka@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e8e69d6 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation version 2 of the license this program
is distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 100 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.918357685@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5f740b24 10-May-2019 Evan Green <evgreen@chromium.org>

ASoC: Intel: Skylake: Add Cometlake PCI IDs

Add PCI IDs for Intel CometLake platforms, which from a software
point of view are extremely similar to Cannonlake platforms.

Signed-off-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 687ae9e2 08-Jan-2019 Takashi Iwai <tiwai@suse.de>

ASoC: intel: skl: Fix display power regression

Since the refactoring of HD-audio display power management, the
display power status is managed per domain. Meanwhile the ASoC
hdac_hdmi driver still keeps and relies (incorrectly) on the
refcounting together with ASoC skl driver, and this leads to the
display state always on.

This patch is an attempt to address the regression by simplifying the
PM code of ASoC skl and hdac_hdmi drivers. Basically, since the
refactoring, we don't have to manage the display power at HD-audio
controller suspend / resume but only at HD-audio HDMI codec suspend /
resume. So the patch drops the superfluous snd_hdac_display_power()
calls in skl driver.

Meanwhile, in hdac_hdmi side, we rewrite the PM call just to re-use
the runtime PM callbacks like other drivers do. Now the logic is
simple: turn off at suspend and turn on at resume.

The patch also fixes the possibly missing display-power off at skl
driver removal as well as some error paths at probe.

Fixes: 029d92c289bd ("ALSA: hda: Refactor display power management")
Reported-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d82b51c8 15-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: HD-Audio: SKL+: force HDaudio legacy or SKL+ driver selection

For HDaudio and Skylake drivers, add module parameter "pci_binding"

When pci_binding == 0 (AUTO), the PCI class/subclass info is used to
select drivers based on the presence of the DSP.

pci_binding == 1 (LEGACY) forces the use of the HDAudio legacy driver,
even if the DSP is present.

pci_binding == 2 (ASOC) forces the use of the ASOC driver. The
information on the DSP presence is bypassed.

The value for the module parameter needs to be identical for both
drivers. This parameter is intended as a back-up solution if the
automatic detection fails or when the DSP usage fails. Such cases
should be reported on the alsa-devel mailing list for analysis.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 35bc99aa 13-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: Add more platform granularity

The current SKYLAKE kconfig is a all-you-can-eat selection that will
support all known plaforms. This is however not necessarily a good
thing: most platforms for SKL and KBL don't support the DSP, but a
number of CNL/WHL ones do. Selecting this driver in all cases isn't
really smart and will require users to muck with blacklists.

Partition the configs to allow distributions to select on which
platform this driver is used. Keep the existing SND_SOC_INTEL_SKYLAKE
config to select everything for backwards compatibility. This patch does
not provide new functionality, only finer-grained choices in supported
platforms.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f231c34c 07-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: add error logs on probe, remove dependency on NHLT

Add error logs to make probe debug easier.

Also remove hard-coded dependency on NHLT. NHLT literally stands for
NonHdaudioLinkTable and is only required for SSP/DMIC interfaces.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7f981bdc 07-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: remove useless tests on HDaudio capabilities

bus->ppcap is now tested upfront, there is no need to re-check if the
hardware is exposed as needed. Remove tests and remove indentation.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fa11ab56 07-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: stop probe if HDaudio capabilities don't exist

Check immediately if required HDaudio capabilities can't be found (no
PPCAP or no streams exposed in GCAP), and move all DMA inits after the
error tests.

PPCAP and GCAP are not reliable indicators of DSP presence, but if
they don't exist then the driver will not work.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c746de8d 07-Dec-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: Harden DSP detection with PCI class/subclass info

The existing PPCAP and GCAP fields cannot be used reliably to
determine if the DSP is enabled by the BIOS. Instead rely on the
class/subclass information to find out if this driver can run or
not. The values in the code don't seem to be documented in publicly
available documents but are part of recommendations made to BIOS
writers and have been verified to be accurate on a number of
platforms.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e6b98db9 07-Dec-2018 Takashi Iwai <tiwai@suse.de>

ASoC: Intel: Skylake: Add CFL-S support

It's with CNP, supposed to be equivalent with CNL entry.

Keep the existing declaration style for now, at a later point we may
transition and use PCI_DEVICE_DATA().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4f799e73 09-Dec-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Make snd_hdac_display_power() void function

After the recent refactoring, snd_hdac_display_power() doesn't return
any error, hence it can be defined to return void.
This makes many error checks redundant and allows us to reduce them
gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 029d92c2 08-Dec-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Refactor display power management

The current HD-audio code manages the DRM audio power via too complex
redirections, and this seems even still unbalanced in a corner case as
Intel DRM CI has been intermittently reporting. This patch is a big
surgery for addressing the complexity and the possible unbalance.

Basically the patch changes the display PM in the following ways:

- Both HD-audio controller and codec drivers call a single helper,
snd_hdac_display_power(). (Formerly, the display power control from
a codec was done indirectly via link_power bus ops.)

- snd_hdac_display_power() receives the codec address index. For
turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.

- snd_hdac_display_power() doesn't manage refcounts any longer, but
keeps the power status in bitmap. If any of controller or codecs is
turned on, the function updates the DRM power state via get_power()
or put_power().

Also this refactor allows us more cleanup:

- The link_power bus ops is dropped, so there is no longer indirect
management, as mentioned in the above.

- hdac_device link_power_control flag is moved to hda_codec
display_power_control flag, as it's only for HDA legacy.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5a619b9e 16-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: use platform_data for machine drivers

For some reason we have different mechanisms for passing data to
machine drivers. Use the solution used by Atom/SST and SOF instead of
using drv_data as done by Skylake.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b92826fa 16-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: fix interface for Chromebook machine drivers

The changes for HDaudio overlooked the fact that the machine drivers
used for Chromebooks rely on the dmic number information passed as
pdata.

Add dmic_num field to standard interface and use standard interface
instead of SKL-specific one.

Also clean-up pdata definition to remove fields that are no longer
used.

Fixes: 842bb5135f10 ('ASoC: Intel: use standard interface for Hdaudio machine driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8c4e7c2e 18-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: fix Kconfigs, make HDaudio codec optional

The Skylake driver currently has a set of problems supporting
load/unload modules. We need to make the HDaudio codec support
optional to help narrow down the issues.

Support for HDaudio codecs also leads to a Kconfig issue. We want the
hdac_hda codec to be compilable independently of Skylake (e.g. with
ALL_CODECS) but when Skylake is selected as built-in the hdac_hda
codec needs to use the same option due a a code dependency

Solve both problems by adding a user-selectable boolean Kconfig,
select HDAC_HDA as needed and make the HDaudio codec support in the
Skylake driver optional. Tests on a Chell Chromebook device without
HDaudio show no regression for speaker and HDMI playback.

This is submitted as an RFC to allow for comments and more validation.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4c10473d 09-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Power down links before turning off display audio power

On certain platforms, Display HDMI HDA codec was not going to sleep state
after the use when links are powered down after turning off the display
power. As per the HW recommendation, links are powered down before turning
off the display power to ensure that the codec goes to sleep state.

This patch was updated from an earlier version submitted upstream [1]
which conflicted with the changes merged for HDaudio codec support
with the Intel DSP.

[1] https://patchwork.kernel.org/patch/10540213/

Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com>
Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 842bb513 01-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: use standard interface for Hdaudio machine driver

Don't rely on internal Skylake-specific data structures, use
generic interface to let other drivers use the same machine driver
as is, e.g. SOF to support HDaudio codecs and HDMI outputs.

Tested on LeafHill CRB board, no regression seen with this change.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 75383f8d 11-Sep-2018 Yu Zhao <yuzhao@google.com>

sound: don't call skl_init_chip() to reset intel skl soc

Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
1) sets bus->chip_init to prevent multiple entrances before device
is stopped; 2) enables interrupt.

We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do
so; 2) we are ready to handle interrupt yet, and kernel crashes when
interrupt comes in.

Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset
device properly.

Fixes: 60767abcea3d ("ASoC: Intel: Skylake: Reset the controller in probe")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 542cedec 11-Sep-2018 Yu Zhao <yuzhao@google.com>

Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation"

This reverts commit 12eeeb4f4733bbc4481d01df35933fc15beb8b19.

The patch doesn't fix accessing memory with null pointer in
skl_interrupt().

There are two problems: 1) skl_init_chip() is called twice, before
and after dma buffer is allocate. The first call sets bus->chip_init
which prevents the second from initializing bus->corb.buf and
rirb.buf from bus->rb.area. 2) snd_hdac_bus_init_chip() enables
interrupt before snd_hdac_bus_init_cmd_io() initializing dma buffers.
There is a small window which skl_interrupt() can be called if irq
has been acquired. If so, it crashes when using null dma buffer
pointers.

Will fix the problems in the following patches. Also attaching the
crash for future reference.

[ 16.949148] general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
<snipped>
[ 16.950903] Call Trace:
[ 16.950906] <IRQ>
[ 16.950918] skl_interrupt+0x19e/0x2d6 [snd_soc_skl]
[ 16.950926] ? dma_supported+0xb5/0xb5 [snd_soc_skl]
[ 16.950933] __handle_irq_event_percpu+0x27a/0x6c8
[ 16.950937] ? __irq_wake_thread+0x1d1/0x1d1
[ 16.950942] ? __do_softirq+0x57a/0x69e
[ 16.950944] handle_irq_event_percpu+0x95/0x1ba
[ 16.950948] ? _raw_spin_unlock+0x65/0xdc
[ 16.950951] ? __handle_irq_event_percpu+0x6c8/0x6c8
[ 16.950953] ? _raw_spin_unlock+0x65/0xdc
[ 16.950957] ? time_cpufreq_notifier+0x483/0x483
[ 16.950959] handle_irq_event+0x89/0x123
[ 16.950962] handle_fasteoi_irq+0x16f/0x425
[ 16.950965] handle_irq+0x1fe/0x28e
[ 16.950969] do_IRQ+0x6e/0x12e
[ 16.950972] common_interrupt+0x7a/0x7a
[ 16.950974] </IRQ>
<snipped>
[ 16.951031] RIP: snd_hdac_bus_update_rirb+0x19b/0x4cf [snd_hda_core] RSP: ffff88015c807c08
[ 16.951036] ---[ end trace 58bf9ece1775bc92 ]---

Fixes: 2eeeb4f4733b ("ASoC: Intel: Skylake: Acquire irq after RIRB allocation")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6bae5ea9 22-Aug-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers

This patch adds a kernel module which is used by the legacy HDA
codec drivers as library. This implements hdac_ext_bus_ops to enable
the reuse of legacy HDA codec drivers with ASoC platform drivers.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 00deadb5 22-Aug-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ASoC: Intel: Skylake: use hda_bus instead of hdac_bus

Use hda_bus instead of hdac_bus in the SKL ASoC platform driver to enable
reuse of legacy HDA codec drivers.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9cdae435 22-Aug-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ASoC: Intel: Skylake: use HDAudio if ACPI enumeration fails

When no I2S based codec entries are found in the BIOS, check if there are
any HDA codecs detected on the bus. Based on the number of codecs found
take appropriate action in machine driver. If there are two HDA codecs
i.e. iDisp + HDA found on the bus, register DAIs and DAI links for both.
If only one codec i.e. iDisp is found then load only iDisp machine driver.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 12eeeb4f 13-Aug-2018 Yong Zhi <yong.zhi@intel.com>

ASoC: Intel: Skylake: Acquire irq after RIRB allocation

Cold reboot stress test found that the hda irq could access rirb ring
buffer before its memory gets allocated which resulting in null
pointer dereference inside snd_hdac_bus_update_rirb().

Fix it by moving the skl_acquire_irq after ring buffer allocation.
While here, also change err return from -EBUSY to actual error code.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cb04ba33 01-Jun-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ALSA: hdac: add extended ops in the hdac_bus

Add extended ops in the hdac_bus to allow calling the ASoC HDAC library
ops to reuse the legacy HDA codec drivers with ASoC framework.
Extended ops are used by the legacy codec drivers to call into
hdac_hda library, in the subsequent patches..

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6298542f 01-Jun-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init

Remove memory allocation within snd_hdac_ext_bus_device_init, to make
its behaviour identical to snd_hdac_bus_device_init. So that caller
can allocate the parent data structure containing hdac_device.
This API change helps in reusing the legacy HDA codec drivers with
ASoC platform drivers.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 76f56fae 01-Jun-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead

This patch removes the hdac_ext_bus structure. The legacy and
enhanced HDaudio capabilities can be handled in a backward-compatible
way without separate definitions.

Follow-up patches in this series handle the driver definition.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cbaa7f0b 18-Jun-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: move SKL+ codec ACPI tables to common directory

No functionality change, just move to common tables to make it easier
to deal with SOF and share the same machine drivers - as done
previously for BYT/CHT/HSW/BDW.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5f15f267 18-Jun-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: Skylake: cleanup before moving ACPI tables

There is no need to deal with DMICs if the DSP is not present and
there is no ACPI machine ID found.

Simplify before moving these ACPI tables to sound/soc/intel/common

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95555f58 18-Jun-2018 Naveen Manohar <naveen.m@intel.com>

ASoC: Intel: broxton: reduce machine name for bxt_da7219_max98357a

Use truncated names in bxt id table and bxt_da7219_max98357a machine
as platform device id table expects names to be less then 20chars.

Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 112c60b3 01-Apr-2018 Rakesh Ughreja <rakesh.a.ughreja@intel.com>

ASoC: Intel: Skylake: Reset stream to link mapping

By default all the streams are mapped to all links after controller is
reset which causes stream to be broadcast on all the links.

This patch resets the stream-link mapping after controller reset. The
stream is mapped later to the appropriate link as part of stream setup.

Tested-by: Abhijeet Kumar <abhijeet.kumar@intel.com>
Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fc9fdd61 12-Mar-2018 Sanyog Kale <sanyog.r.kale@intel.com>

ASoC: Intel: Skylake: Disable clock and power gating during FW/LIB download

In order to achieve better DMA performance and reduce download time for
firmware and library, it is recommended to disable dynamic clock and
power gating. In some scenarios, DMA may wait to accumulate more data and
last chunk of data never gets completed if dynamic clock and power
gating is kept enabled.

This patch adds support to disable/enable dynamic clock and power gating
and use it during firmware and library download.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ea954fbc 04-Feb-2018 Naveen Manohar <naveen.m@intel.com>

ASoC: Intel: Add Kabylake Dialog+Maxim machine driver entry

Adds Kabylake kbl_da7219_max98357a_i2s machine driver entry into
machine table

Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 752c93aa 17-Dec-2017 Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>

ASoC: Intel: Skylake: Ensure dai and dailink registration happens in sequence.

Platform registration happens in probe work handler whereas machine
device is registered during skl_probe. This sometimes results in cpu
dais not found if the work handler is sufficiently delayed due to system
load, even with deferred probe of machine driver.

So move machine device registration after registering platform.

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e79ec98 03-Dec-2017 Guneshwor Singh <guneshwor.o.singh@intel.com>

ASoC: Intel: Skylake: Make local functions static

Some functions are local to the source and do not need to be in global
scope, so make them static.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bc2bd45b 22-Nov-2017 Sriram Periyasamy <sriramx.periyasamy@intel.com>

ASoC: Intel: Skylake: Parse nhlt and register clock device

When NHLT endpoint is present for a SSP then we create clock for that SSP.

MCLK is consistent across endpoints and configuration for an SSP, so query
only for first endpoint for an SSP.

For SCLK/SCLKFS, the best fit is queried from the NHLT configurations which
matches the clock rate requested. Best fit is decided based on below:

1. If rate matches with multiple configurations, then the first
configuration is selected.

2. If for a selected fs and bits_per_sample, there are multiple endpoint
configuration match, then the configuration with max number of
channels is selected. So, the user has to set the rate which fits
max number of channels

So we create a platform device and pass clock information parsed as
platform data.

Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com>
Signed-off-by: Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cc20c4df 06-Nov-2017 Arnd Bergmann <arnd@arndb.de>

ASoC: intel: initialize return value properly

When CONFIG_SND_SOC_HDAC_HDMI is disabled, we can run into an
uninitialized variable:

sound/soc/intel/skylake/skl.c: In function 'skl_resume':
sound/soc/intel/skylake/skl.c:326:6: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I have run into this on today's linux-next kernel, but it appears
that this is an older problem that was just hard to trigger
with randconfig builds as CONFIG_SND_SOC_HDAC_HDMI would in
effect be impossible to disable when having SND_SOC_INTEL_SKYLAKE
enabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7feb2f78 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: move ACPI common code out of Intel/sst tree

ACPI support is not specific to the Intel/SST driver. Move the enumeration
and matching code which is not hardware-dependent to sound/soc and rename
relevant sst_acpi_ structures and functions with snd_soc_acpi_ prefix

soc-acpi.h is protected by a #ifndef __LINUX_SND_SOC_ACPI_H for
consistency with all other SoC .h files:

grep -L __LINUX include/sound/soc* | wc -l
0
grep __LINUX include/sound/soc* | wc -l
14

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 364497ac 08-Oct-2017 Guneshwor Singh <guneshwor.o.singh@intel.com>

ASoC: Intel: Skylake: Fix missing sentinel in sst_acpi_mach

To make it consistent, add sentinel for sst_cnl_devdata also.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c3ae22e3 08-Oct-2017 Guneshwor Singh <guneshwor.o.singh@intel.com>

ASoC: Intel: Skylake: Add flag to check to register FE dais from topology

Since FE dais can come from topology, split the FE dais from existing
dai array so that FE dais need not be registered if they come from
topology. Add use_tplg_pcm flag to check whether FE dais will be
registered from topology during dai driver component registration.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c360e0c3 22-Aug-2017 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ASoC: Intel: Skylake: Fix to free correct dev id in free_irq

The dev_id passed by the driver in request_threaded_irq is an ebus pointer,
whereas to free_irq it is hdac_bus. Fix by passing correct dev_id to
free_irq.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 86d7ce3d 02-Aug-2017 Guneshwor Singh <guneshwor.o.singh@intel.com>

ASoC: Intel: cnl: add pci id for cnl

Enable cnl by adding its pci id in skl_ids[].

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d70c4a04 02-Aug-2017 Naveen Manohar <naveen.m@intel.com>

ASoC: Intel: Skylake: Use correct nuvoton codec ID

Correcting the nau88l25 codec ID to match secondary codec
and load the machine driver.

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 693c0fb2 28-Jul-2017 guneshwor.o.singh@intel.com <guneshwor.o.singh@intel.com>

ASoC: Intel: Skylake: Remove return check for skl_codec_create()

Since skl_codec_create() always returns 0, make it return void and remove
return check.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 60767abc 28-Jul-2017 guneshwor.o.singh@intel.com <guneshwor.o.singh@intel.com>

ASoC: Intel: Skylake: Reset the controller in probe

Controller can be in reset state by default. Capability structure
traversal requires the controller to be out of reset else it
results in broken capability parsing. Hence make sure that controller is
out of reset before parsing capabilities by doing a full reset.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0dfa7a04 27-Jul-2017 Kevin Cheng <kevin.cheng@intel.com>

ASoC: Intel: Add Kabylake RT5663 machine driver entry

Adds Kabylake rt5663 machine driver entry into machine table

Signed-off-by: Kevin Cheng <kevin.cheng@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b76e3f93 24-Jul-2017 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Fix missing sentinels in sst_acpi_mach

Couple of instances of sst_acpi_mach were having missing sentinels
so add them up

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7d3d6e06 03-Jul-2017 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Remove driver debugfs exit

For driver debugfs, debugfs_remove_recursive() is called which is not
needed as it is already done in ASoC core debugfs. And a device managed
memory need not be freed explicitly as device core frees it up. So
remove unnecessary skl_debugfs_exit().

Fixes: 5cdf6c09ca9d ASoC: ("Intel: Skylake: Add debugfs support")
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5cdf6c09 29-Jun-2017 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Add debugfs support

For debug, the kernel debugfs mechanism is available. We can add various
debug options for driver like module configuration read, firmware register
read etc.

This patch adds debugfs as a child to asoc plaform component and caller is
added for skylake driver to do init and cleanup of debugfs.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Vunny Sodhi <vunnyx.sodhi@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ad7fb5a3 14-Jun-2017 Harsha Priya N <harshapriya.n@intel.com>

ASoC: Intel: Add Kabylake RT5663+RT5514+MAX98927 machine driver entry

This patch adds Kabylake I2S machine driver which uses codecs
MAX98927 as speakers and RT5514 as dmic on ssp0 and
RT5663 as headset on ssp1.

Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>


# 9a90c972 14-Jun-2017 Harsha Priya N <harshapriya.n@intel.com>

ASoC: Intel: Convert all sst_codecs data definition to c99 style

C99 style struct initialization helps in readability as well as
initialization of variables not specified as NULL. This patch
changes the struct data definitions in skl.c that were not in c99 style.

Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>


# 0809d987 15-May-2017 Naveen M <naveen.m@intel.com>

ASoC: Intel: Add Kabylake RT5663+MAX98927 machine driver entry

Adds kbl_rt5663_max98927_i2s machine driver entry into machine table

Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 54746dab 15-May-2017 Naveen M <naveen.m@intel.com>

ASoC: Improve machine driver selection based on quirk data

Use quirk function to select the correct machine driver
by checking all codecs instead of only one based on quirk data.

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9bf70cd4 15-May-2017 Naveen M <naveen.m@intel.com>

ASoC: Intel: Convert skl machine data to C99 style

C99 style struct initialization helps in readability as well as
initialization of variables not specified as NULL.
Patch modifies all skl machine data.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ab1b732d 04-May-2017 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Move i915 registration to worker thread

The i915 component framework expects the caller to be invoking
snd_hdac_i915_init() from a thread context. Otherwise it results in
lockups on drm side.

So move the registering of component interface and probing of codecs on
this bus to a worker thread.

init_failed in skl structure is not used currently, so renamed to
init_done and used to track the initialization done in worker thread.

Reported-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sodhi, VunnyX <vunnyx.sodhi@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e6a33532 20-Apr-2017 Dan Carpenter <dan.carpenter@oracle.com>

ASoC: Intel: Skylake: Uninitialized variable in probe_codec()

My static checker complains that if snd_hdac_bus_get_response() returns
-EIO then "res" is uninitialized. Fix this by initializing it to -1 so
that the error is handled correctly.

Fixes: d8c2dab8381d ("ASoC: Intel: Add Skylake HDA audio driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 25504863 09-Feb-2017 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Add Geminlake IDs

Geminilake is next gen SoC, so add the IDs for Geminilake.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0cf5a171 11-Jan-2017 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ASoC: Intel: Skylake: Report Platform ID info from NHLT

This patch create entry in sysfs file system to report the
platform_id = "pci-id-oem_id-oem_table_id-oem_revision"
for board identification.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Sodhi, VunnyX <vunnyx.sodhi@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8b4a133c 03-Nov-2016 Jayachandran B <jayachandran.b@intel.com>

ASoC: Intel: Skylake: Flush pending D0i3 request on suspend

While going to suspend, if we have any pending D0i3 work scheduled,
flush that and force the DSP to goto D0i3 mode before going to suspend.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 68d03a3a 03-Nov-2016 Jayachandran B <jayachandran.b@intel.com>

ASoC: Intel: Skylake: remove pci device enabling calls on suspend

We were invoking pci_disable_device() while going to suspend-to-idle and
pci_enable_device() while coming back to active state.

Turns out that we do not need these calls as we only need system to be
wake capable when in suspend-to-idle state. The wake capability is
already done by enable_irq_wake() calls, so remove these unwanted calls
in driver.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a26a3f53 03-Nov-2016 Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>

ASoC: Intel: Skylake: Add support for programming D0i3C

To set the controller in D0i3 mode, the driver needs to set D0i3C
register after DSP is quiesced. Since the D0iX entry/exit is done by IPC,
add this as callback so that it can be invoked from IPC module.

Signed-off-by: Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>
Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7a5857c3 28-Oct-2016 Sodhi, VunnyX <vunnyx.sodhi@intel.com>

ASoC: Intel: Skylake: Fix to turn off hdmi power on probe failure

HDMI codec is required to be powered up before controller initialization
for successful enumeration of codec. If the probe fails it needs to be
powered off to balance the power state of HDMI codec.

This fix balances the reference count in the error path before turning
off the codec.

Reported-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Sodhi, VunnyX <vunnyx.sodhi@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6d13f62d 19-Oct-2016 Lukas Wunner <lukas@wunner.de>

ASoC: Intel: Skylake: Always acquire runtime pm ref on unload

skl_probe() releases a runtime pm ref unconditionally wheras
skl_remove() acquires one only if the device is wakeup capable.
Thus if the device is not wakeup capable, unloading and reloading
the module will result in the refcount being decreased below 0.
Fix it.

Fixes: d8c2dab8381d ("ASoC: Intel: Add Skylake HDA audio driver")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 979cf59a 12-Aug-2016 Wei Yongjun <weiyj.lk@gmail.com>

ASoC: Intel: Skylake: Fix error return code in skl_probe()

Fix to return error code -ENODEV from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 87b2bdf02278 ("ASoC: Intel: Skylake: Initialize NHLT table")
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-By: Vinod Koul <vinod.kou@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ec8ae570 04-Aug-2016 Vinod Koul <vkoul@kernel.org>

ALSA: convert users to core bus_parse_capabilities

Now that we have the bus parse capabilities moved to core, we need to
convert users.

The SKL driver and HDA extended lib needs to converted in single patch,
otherwise we regress on the functionality.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1b00126c 22-Jul-2016 Markus Elfring <elfring@users.sourceforge.net>

ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware"

The release_firmware() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 156a071b 13-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Kbl: add kabylake additional machine entries

Like SKL, we have two more machines for KBL, so add these IDs

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a2f5b8db 13-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: reduce machine name for skl_nau88l25_max98357a

The platform device id table expects names to be less that
20chars, so truncate the name in skl id table and
skl_nau88l25_max98357a machine.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 400ada0c 13-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: reduce machine name for skl_nau88l25_ssm4567

The platform device id table expects names to be less that
20chars, so truncate the name in skl id table and
skl_nau88l25_ssm4567 machine.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 451dfb5f 11-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: add kablake device IDs

Kabylake is next generation Intel platform which has similar
audio controller to Skylake, so add the ID and driver data in
SKL driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 957427d9 22-Jun-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Update comment style

Noticed a style inconsistency in a comment, so update that

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2e9dc2b6 22-Jun-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Disable async suspend

We do not support async suspend due to dependency with rest of
card and require suspend/resume be executed synchronously, mark
the device accordingly.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1665c177 13-Jun-2016 Jayachandran B <jayachandran.b@intel.com>

ASoC: Intel: Skylake: Enable firmware reload in suspend

Broxton DSP needs retains code loaded during runtime_pm cycles.
But it looses that on suspend cycle, so on resume we need to
download the firmware again.

This is done by adding a new flag and based on flag status, we
download the firmware.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fe3f4442 03-Jun-2016 Dharageswari R <dharageswari.r@intel.com>

ASoC: Intel: Skylake: Clean up of driver resources in suspend

On suspend firmware is re-initialized so resources are reset inside
firmware. Driver should also clear the firmware counters at this time.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 51a01b8c 03-Jun-2016 Dharageswari R <dharageswari.r@intel.com>

ASoC: Intel: Skylake: Disable SRAM Retention before D3

SW needs to set the PGCTL.LSRMD = 1 to disable LPSRAM retention
feature,otherwise it may lead to SRAM ECC Errors.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# de15996e 01-Jun-2016 Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>

ASoC: Intel: Add Broxton-P Dialog+Maxim machine driver entry

This patch adds bxt_da7219_max98357a_i2s machine driver
entry into machine table

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f65cf7d6 26-May-2016 Yong Zhi <yong.zhi@intel.com>

ASoC: Intel: Skylake: Add api to retrieve dmic array info from nhlt

Skylake can be configured with either both 2 and 4 channel DMIC
array, or 2 channel DMIC array only, this patch provides an API to
retrieve the DMIC info from nhlt.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cce6c149 11-May-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: add link management

Use shiny new link APIs to manage the links. Also remove old link
configuration logic from driver.

We need to keep link and cmd dma to off during active suspend
to allow system to enter low power state and turn it on if
the link and cmd dma was on before active suspend in active
resume.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c286b3f9 04-May-2016 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Fix memory leak in nhlt init

During skl_nhlt_init(), acpi obj pointer is allocated and never
freed and remap address is not unmapped.

To fix this we should release the ACPI obj and also unmap the
nhlt address during cleanup of driver.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# af037412 01-Apr-2016 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ASoC: Intel: Skylake: Fix to turn OFF codec power when entering S3

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 36e7972c 16-Mar-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: remove call to pci_dev_put

The PCI bus takes pci_dev_get() and pci_dev_put() is also there.
So no need for drivers to invoke these. In SKL driver we were
calling pci_dev_put() only which is not right, so remove this

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5b2fe898 15-Mar-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Call i915 exit last

The Skylake driver uses i915 component APIs to talk to display.
On remove we should free up by invoking snd_hdac_i915_exit() but
that should be last thing in remove routine, so move it to last
in skl_free()

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 077411e5 15-Mar-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Unmap the address last

In Skylake destructor we unmap the hardware address and then free
links and streams. The stream free accesses hardware to write to
registers and predictably causes oops.

So change the order and unmap last in destructor.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7373f481 15-Mar-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: free codec objects on removal

On driver removal we should ask the core to remove the device
objects as well, so invoke snd_hdac_ext_bus_device_remove() in
remove.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b379b1fa 10-Mar-2016 Senthilnathan Veppur <senthilnathanx.veppur@intel.com>

ASoC: Intel: Bxtn: Add Broxton PCI ID

Broxton is an Intel SoC which sports a DSP and system is quite
like Skylake. So add this ID in Skylake driver

Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6980c057 17-Feb-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Add i915 enabling in skl probe

The SKL also supports HDMI output so in probe we need to enable
the HDMI using common i915 APIs to ensure it gets probed on the
bus

After S3 during the controller resequencing the codec domain need
to be kept ON for successful reconfiguration of Codec. Once
configured it will be turned OFF in codec driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4b235c43 18-Feb-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Generate topology name for NHLT table header

NHLT table [1] header has fields like oem_id, oem_table_id and
oem_revision. Use that to load a unique topology binary specific
to that platform

NHLT Table is documented at:
[1]: https://01.org/blogs/2016/intel-smart-sound-technology-audio-dsp

Signed-off-by: Yang A Fang <yang.a.fang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c5a76a24 04-Feb-2016 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Add shutdown callback

While going to shutdown, we need to bring HW to clean state. This
is done by cleaning up stream descriptor registers. This cleanup
is already done by decoupling of stream and stopping the chip, so
invoke these from shutdown handler.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 38c079e2 03-Feb-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Remove autosuspend delay

The driver used autosuspend delay to delay going to D3. But per
HW recommendation we should go to D3 soon, so remove the delay
from driver

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1f4956fd 18-Dec-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: enable interrupt as wake source in active suspend

In active suspend, any HDA interrupt should wake the system. When device
enters active suspend, we need to enable HDA controller interrupt as wake
source. Similarly disable HDA controller interrupt as wake source when
exiting active suspend.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2e20cd8 18-Dec-2015 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: manage link power in active suspend

When device enters active suspend, we should turn off the links
as they are not in use. Similarly we need to bring back links
when we exit active suspend.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0c8ba9d2 18-Dec-2015 Jayachandran B <jayachandran.b@intel.com>

ASoC: Intel: Skylake: fix reset controller sequencing

MISCBDCGE is a new register for Misc Backbone clock gate control
which is useful to control while resetting the link and ensuring
controller is in required state so add API to control it

HW recommends that we reset with CGCTL.MISCBDCGE disabled, so add
that while doing init chip and reset sequence.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d8018361 05-Jan-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Fix the memory leak

This provide the fix for firmware memory by freeing the pointer in driver
remove where it is safe to do so

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 69b7f9c4 11-Dec-2015 Rohit Ainapure <rohit.m.ainapure@intel.com>

ASoC: Intel: Add Nuvoton+Maxim machine driver entry

Add the NAU88L25 + MAX98357A machine driver entry into
the machine table

Signed-off-by: Rohit Ainapure <rohit.m.ainapure@intel.com>
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4557c305 03-Dec-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Add support for active suspend

Some of the usecases can be marked as 'ignore_suspend' by
machine. For these on suspend we should keep audio controller
ON by saving the state and not suspending the device

For this we need to maintain a counter for these streams and be
active on suspend when such a stream is opened.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e03fc82d 13-Nov-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Remove redundant init in resume

Since we call _skl_resume which also initializes the chip we no
need to call these explicitly, so remove the duplication

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a71e2697 13-Nov-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Don't enable WAKEENABLE on suspend

For HDA codecs WAKEENABLE bit is to programmed if codec event
change has to wake the system when suspended.

In skylake I2S systems which are currently supported we have
only HDMI codec, which doesn't use this capability to detect a
HDMI connect/ disconnect event. HDMI HDA codec uses display
interface to detect connect/disconnect event.

This patch removes the WAKEBIT enabling during device D0/D3 as
this seems to cause spurious wakes on the system

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 02cc2355 05-Nov-2015 Fang, Yang A <yang.a.fang@intel.com>

ASoC: Intel: Skylake: add adi + nau8825 machine driver entry

This patch adds skl_nau8825_ssn4567_i2s machine driver into
machine table

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# aecf6fd8 05-Nov-2015 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Use the fw name from ACPI mach table

The firmware name is hard coded which doesnt allow to load
different platforms for various platforms so get this name from
available machine table and pass it to dsp context for loading

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cc18c5fd 05-Nov-2015 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Skylake: Fix skl machine driver creation

Now that we have common match code in place, update the SKL
driver to use the common match routines for driver entry creation
for UEFI BIOS systems

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Omair M Abdullah <omair.m.abdullah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 61722f44 26-Oct-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Fix PM behaviour

The driver runtime behaviour is fine but in suspend, we missed
setting the DSP to suspend and also missed resuming DSP on
resume.

Fix this by having common SKL suspend and resume routines which
power up/down links, suspend/resume DSP and other common
routines, and call these routines from both runtime as well as
system PM handlers

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 029890c6 26-Oct-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Fix to ignore codec_mask check in probe

We have both I2S and hda codec support in the driver. codec_mask
check is relevant only for hda codec and some boards may have
only I2S Codec, so removed probe error in case no hda codec is
found and update the log to info as it may not be error.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 01bb84b5 09-Oct-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: power down all link in suspend

This ensures that the link is not requesting any clock and the
PLL can turn off. The link is powered when controller is brought
out of reset.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 87b2bdf0 07-Oct-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Initialize NHLT table

Load and Initialize Non HDA Link Table in Skylake driver
to get platform configuration.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2a29b200 07-Oct-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Skylake: Add DSP support and enable it

If processing pipe capability is supported, add DSP support.
Adds initialization/free/suspend/resume DSP functionality.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 05057001 09-Jul-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Add support for decoupled mode in skl driver

Decoupled mode is where audio link is broken to frontend HDA and backend
(hda/i2s/dmic/hdmi) links. This patch adds support for decoupled mode and
then adds dais, dai ops for be/fe cpu dais and interrupt handler change to
support decoupled mode

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d8c2dab8 09-Jul-2015 Jeeja KP <jeeja.kp@intel.com>

ASoC: Intel: Add Skylake HDA audio driver

This patch follows up by adding the HDA controller operations. This
code is mostly derived from Intel HDA PCI driver without legacy bits

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>