History log of /linux-master/sound/pci/hda/hda_controller.h
Revision Date Author Comments
# d045bcef 02-Feb-2023 Jaroslav Kysela <perex@perex.cz>

ALSA: hda: Fix the control element identification for multiple codecs

Some motherboards have multiple HDA codecs connected to the serial bus.
The current code may create multiple mixer controls with the almost
identical identification.

The current code use id.device field from the control element structure
to store the codec address to avoid such clashes for multiple codecs.
Unfortunately, the user space do not handle this correctly. For mixer
controls, only name and index are used for the identifiers.

This patch fixes this problem to compose the index using the codec
address as an offset in case, when the control already exists. It is
really unlikely that one codec will create 10 similar controls.

This patch adds new kernel module parameter 'ctl_dev_id' to allow
select the old behaviour, too. The CONFIG_SND_HDA_CTL_DEV_ID Kconfig
option sets the default value.

BugLink: https://github.com/alsa-project/alsa-lib/issues/294
BugLink: https://github.com/alsa-project/alsa-lib/issues/205
Fixes: 54d174031576 ("[ALSA] hda-codec - Fix connection list parsing")
Fixes: 1afe206ab699 ("ALSA: hda - Try to find an empty control index when it's occupied")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230202092013.4066998-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c0f1886d 06-Oct-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: intel: Allow repeatedly probing on codec configuration errors

It seems that a few recent AMD systems show the codec configuration
errors at the early boot, while loading the driver at a later stage
works magically. Although the root cause of the error isn't clear,
it's certainly not bad to allow retrying the codec probe in such a
case if that helps.

This patch adds the capability for retrying the probe upon codec probe
errors on the certain AMD platforms. The probe_work is changed to a
delayed work, and at the secondary call, it'll jump to the codec
probing.

Note that, not only adding the re-probing, this includes the behavior
changes in the codec configuration function. Namely,
snd_hda_codec_configure() won't unregister the codec at errors any
longer. Instead, its caller, azx_codec_configure() unregisters the
codecs with the probe failures *if* any codec has been successfully
configured. If all codec probe failed, it doesn't unregister but let
it re-probed -- which is the most case we're seeing and this patch
tries to improve.

Even if the driver doesn't re-probe or give up, it will go to the
"free-all" error path, hence the leftover codecs shall be disabled /
deleted in anyway.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190801
Link: https://lore.kernel.org/r/20211006141940.2897-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 623c1010 04-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: memalloc: Fix pgprot for WC mmap on x86

We have a special handling of WC pages on x86, and it's currently
specific to HD-audio. The last forgotten piece was the pgprot setup
for the mmap with WC pages.

This patch moves the pgprot setup for WC pages from HD-audio-specific
mmap callback to the common helper code. It allows us to remove the
superfluous mmap callback in HD-audio and its prepare_mmap
redirection.

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


# 3fcaf24e 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Allocate resources with device-managed APIs

This patch is an attempt to slightly simplify the resource management
in HD-audio code, by using some device-managed APIs. Only a few
resources like PCI enablement and PCI resources managed via devres,
but most of the rest code dealing with HD-audio core stuff couldn't be
changed so much, hence the changes in this patch are pretty small in
the end. A special caveat is needed for the card object: we can't
move the card object release into devres, because the driver is
involved with the component stuff and its unregistiration doesn't work
well from devres release at all.

Link: https://lore.kernel.org/r/20210715075941.23332-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f5dac54d 27-Oct-2020 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: hda: Separate runtime and system suspend

Both pm_runtime_force_suspend() and pm_runtime_force_resume() have
some implicit checks, so it can make code flow more straightforward if
we separate runtime and system suspend callbacks.

High Definition Audio Specification, 4.5.9.3 Codec Wake From System S3
states that codec can wake the system up from S3 if WAKEEN is toggled.
Since HDA controller has different wakeup settings for runtime and
system susend, we also need to explicitly disable direct-complete which
can be enabled automatically by PCI core. In addition to that, avoid
waking up codec if runtime resume is for system suspend, to not break
direct-complete for codecs.

While at it, also remove AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP, as the
original bug commit a6630529aecb ("ALSA: hda: Workaround for spurious
wakeups on some Intel platforms") solves doesn't happen with this
patch.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20201027130038.16463-3-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a6630529 27-Jul-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Workaround for spurious wakeups on some Intel platforms

We've received a regression report on Intel HD-audio controller that
wakes up immediately after S3 suspend. The bisection leads to the
commit c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not
needed"). This commit replaces the system-suspend to use
pm_runtime_force_suspend() instead of the direct call of
__azx_runtime_suspend(). However, by some really mysterious reason,
pm_runtime_force_suspend() causes a spurious wakeup (although it calls
the same __azx_runtime_suspend() internally).

As an ugly workaround for now, revert the behavior to call
__azx_runtime_suspend() and __azx_runtime_resume() for those old Intel
platforms that may exhibit such a problem, while keeping the new
standard pm_runtime_force_suspend() and pm_runtime_force_resume()
pair for the remaining chips.

Fixes: c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not needed")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208649
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200727164443.4233-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f34a4c9d 18-Jun-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Enable sync-write operation as default for all controllers

In the end we already enabled the sync-write mode for most of HD-audio
controllers including Intel, and it's no big merit to keep the async
write mode for the rest. Let's make it as default and drop the
superfluous AZX_DCAPS_SYNC_WRITE bit flag.

Also, avoid to set the allow_bus_reset flag, which is a quite unstable
and hackish behavior that was needed only for some early platforms
(decades ago). The straight fallback to the single cmd mode is more
robust.

Link: https://lore.kernel.org/r/20200618144051.7415-1-tiwai@suse.de
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>


# c02f77d3 06-Aug-2019 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Workaround for crackled sound on AMD controller (1022:1457)

A long-time problem on the recent AMD chip (X370, X470, B450, etc with
PCI ID 1022:1457) with Realtek codecs is the crackled or distorted
sound for capture streams, as well as occasional playback hiccups.
After lengthy debugging sessions, the workarounds we've found are like
the following:

- Set up the proper driver caps for this controller, similar as the
other AMD controller.

- Correct the DMA position reporting with the fixed FIFO size, which
is similar like as workaround used for VIA chip set.

- Even after the position correction, PulseAudio still shows
mysterious stalls of playback streams when a capture is triggered in
timer-scheduled mode. Since we have no clear way to eliminate the
stall, pass the BATCH PCM flag for PA to suppress the tsched mode as
a temporary workaround.

This patch implements the workarounds. For the driver caps, it
defines a new preset, AXZ_DCAPS_PRESET_AMD_SB. It enables the FIFO-
corrected position reporting (corresponding to the new position_fix=6)
and enforces the SNDRV_PCM_INFO_BATCH flag.

Note that the current implementation is merely a workaround.
Hopefully we'll find a better alternative in future, especially about
removing the BATCH flag hack again.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195303
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c942fddf 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 3 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 either version 2 of the license or at
your option any later version 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

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 either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] 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

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 either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] 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-or-later

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8af42130 26-May-2019 Bard Liao <yung-chuan.liao@linux.intel.com>

ALSA: hda: move polling_mode flag to struct hdac_bus

polling mode is a useful function in the get_response function. Move
polling_mode flag from struct azx to struct hdac_bus so people can
implement polling mode in their own get_response function without
adding a polling_mode flag in their local chip structure.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3e9ad24b 31-Dec-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Revert DSP detection on legacy HD-audio driver

This essentially reverts the commits
c337104b1a16 ("ALSA: HD-Audio: SKL+: abort probe if DSP is present
and Skylake driver selected")
and
d82b51c855a2 ("ALSA: HD-Audio: SKL+: force HDaudio legacy or SKL+
driver selection")
for the path of legacy HD-audio controller (snd-hda-intel).

The automatic DSP detection and skip of binding with the legacy driver
caused regressions on several machines like Dell XPS13. They give the
PCI class 0x40380 indicating the availability of DSP while they don't
work with ASoC SKL driver (yet).

As the support of ASoC driver for such devices isn't available, it's
better to revert the whole DSP-detection-and-skip behavior of the
legacy driver, so that we can get the old good driver working on such
devices.

The pci_binding option for ASoC SKL driver is still kept so that it
can work without blacklisting.

Fixes: c337104b1a16 ("ALSA: HD-Audio: SKL+: abort probe if DSP is present and Skylake driver selected")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Hans de Goede <hdegoede@redhat.com>
Reported-by: Azat Khuzhin <dohardgopro@gmail.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: HD-Audio: SKL+: abort probe if DSP is present and Skylake driver selected

Now that the SST/Skylake driver supports per platform selectors, we
can add logic to automatically select the right driver.

If the Skylake driver is selected for a specific platform, and the DSP
is detected at run-time based on the PCI class/subclass/prog-if
information, the legacy HDaudio driver aborts the probe. This will
result in a single driver probing and remove the need for modprobe
blacklists.

Follow-up patches will add a module parameter to bypass the logic if
this automatic detection fails, or if the Skylake driver is unable to
actually support the platform (firmware authentication, missing
topology file, hardware issue, etc).

The same mechanism will be used to conflicts generated by the same PCI
ID being registered by both legacy HDAuudio and SOF drivers for Intel
platforms. In other words SOF will not require changes to the HDaudio
legacy.

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


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

ALSA: hda/intel: Drop superfluous AZX_DCAPS_I915_POWERWELL checks

snd_hdac_display_power() can be called even for a HDA controller
without DRM binding. The same is true for other helpers,
snd_hdac_i915_set_bclk() and snd_hdac_set_codec_wakeup().
So all superfluous AZX_DCAPS_I915_POWERWELL checks in hda_intel.c can
be dropped, and the definition of AZX_DCAPS_I915_POWERWELL itself can
be removed as well. This simplifies the code a lot.

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


# 5b03006d 11-Sep-2018 Anders Roxell <anders.roxell@linaro.org>

ALSA: hda: fix unused variable warning

When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
only returns true.

sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
struct azx *chip = bus_to_azx(bus);
^~~~

Create a inline function of azx_snoop.

Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# be57bfff 22-Aug-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: move hda_codec.h to include/sound

As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

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


# 3a182c84 29-Aug-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Clean up jackpoll_ms option handling

Currently the jackpoll_ms option value is passed indirectly by
referring to an array in chip->jackpoll_ms although each card needs to
see only the assigned value. Also, the sanity check is done at each
time in get_jackpoll_interval() although basically jackpoll_ms option
is a read-only, hence we need to evaluate only once at probe time.

This patch is the code simplification about the above points: the jack
polling interval is directly set to chip->jackpoll_interval so that it
can be simply copied to each codec.

No functional change but only code reduction.

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


# b4af16d6 22-Aug-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: move hda_codec.h to include/sound

As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

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


# 193c7e14 08-Aug-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Remove substream allocation/free ops

Since we dropped the memory page fiddling in the own allocators in
hda_intel.c, the substream allocation and free ops in both hda_intel.c
and hda_tegra.c became nothing but the simple calls of the standard
snd_pcm_lib helpers. As both are identical, there is no longer need
for indirect calls via ops; it's a good opportunity for removing ops
and simplifying the codes.

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


# fc478143 08-Aug-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Use new non-cached allocation for non-snoop mode

Now the ALSA memory allocator helper supports the new non-cached
pages, let's use the new type, SNDRV_DMA_TYPE_DEV_UC_SG, for HD-audio
driver. This allows us to reduce lots of codes.

As another positive side-effect by this patch, the long-standing issue
with non-snoop mode playing in the non-mmap mode is fixed. The core
memalloc helper does the proper pgprot setup for non-cached pages for
vmap(), which was missing in the past.

Reported-and-tested-by: Hans Hu <HansHu@zhaoxin.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 78c9be61 11-Aug-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Check the non-cached stream buffers more explicitly

Introduce a new flag, uc_buffer, to indicate that the controller
requires the non-cached pages for stream buffers, either as a
chip-specific requirement or specified via snoop=0 option.
This improves the code-readability.

Also, this patch fixes the incorrect behavior for C-Media chip where
the stream buffers were never handled as non-cached due to the check
of driver_type even if you pass snoop=0 option.

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


# dba9b7b6 29-Jun-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix doubly initialization of i915 component

In the commit fcc88d91cd36 ("ALSA: hda - Bind with i915 component
before codec binding"), the binding with i915 audio component is moved
to be performed always at probing the controller. This fixed the
potential problems on IVB, but now it brought another issue on HSW and
BDW. These two platforms give two individual HD-audio controllers,
one for the analog codec on PCH and another for HDMI over gfx. Since
I decided to take a lazy path to check only AZX_DRIVER_PCH type in the
commit above, now both controllers try to bind with i915, and you see
a kernel WARNING.

This patch tries to address it again properly. Now a new DCAPS bit,
AZX_DCAPS_I915_COMPONENT, is introduced for indicating the binding
with i915 component in addition to the existing I915_POWERWELL bit
flag. Each PCI entry has to give this new flag if it requires the
binding with i915 component. For HSW/BDW PCH (i.e. the ones defined
by AZX_DCAPS_INTEL_PCH) doesn't contain AZX_DCAPS_I915_COMPONENT bit
while others have it.

While we're at it, add parentheses around the bit flag check for
avoiding possible compiler warnings, too.

The bug was spotted by Intel CI tests.

Fixes: fcc88d91cd36 ("ALSA: hda - Bind with i915 component before codec binding")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196219
Reported-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 41438f13 12-Jan-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make single_cmd option to stop the fallback mechanism

HD-audio driver has a mechanism to fall back to the single cmd mode as
a last resort if the CORB/RIRB communication goes wrong even after
switching to the polling mode. The switching has worked in the past
well, but Enrico Mioso reported that his system crashes when this
happens.

Although the actual cause of the crash isn't still fully analyzed yet,
it'd be in anyway good to provide an option to turn off the fallback
mode. Now this patch extends the behavior of the existing single_cmd
option for that. Namely,

- The option is changed from bool to bint.
- As default, it is the mode allowing the fallback to single cmd.
- Once when either true/false value is given to the option, the driver
explicitly turns on/off the single cmd mode, but without the
fallback.

That is, if you want to disable the fallback, just pass single_cmd=0
option. Passing single_cmd=1 will keep working like before.

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


# 50279d9b 04-Aug-2016 Guneshwor Singh <guneshwor.o.singh@intel.com>

ALSA - hda: Add support for parsing new HDA capabilities

Skylake onwards HDA controller supports new capabilities like
Global Time Stamping (GTS) capability. So add support to parse
these new capabilities.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bcb337d1 17-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Drop unused AZX_DCAPS_REVERSE_ASSIGN

AZX_DCAPS_REVERSE_ASSIGN is no longer referred by any code.
Let's drop it.

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


# 26f05717 17-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Drop AZX_DCAPS_POSFIX_VIA bit

AZX_DCAPS_POSFIX_VIA is coupled always with AZX_DRIVER_VIA type, so we
don't have to keep this bit in dcaps. Save one more!

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


# 7d9a1808 17-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Raise AZX_DCAPS_RIRB_DELAY handling into top drivers

AZX_DCAPS_RIRB_DELAY is dedicated only for Nvidia and its purpose is
just to set a flag in bus. So it's better to be set in the toplevel
driver, either hda_intel.c or hda_tegra.c, instead of the common
hda_controller.c. This also allows us to strip this flag from dcaps,
so save one more bit there.

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


# ef85f299 17-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Merge RIRB_PRE_DELAY into CTX_WORKAROUND caps

AZX_DCAPS_RIRB_PRE_DELAY is always tied with AZX_DCAPS_CTX_WORKAROUND,
which is Creative's XFi specific. So, we can replace it and reduce
one more bit free for DCAPS.

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


# 4f0189be 10-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Clean up the code to check bdl_pos_adj option

Just a minor cleanup; instead of passing an array, pass the assigned
bdl_pos_adj option value directory in struct azx. Also split the code
to get the default bdl_pos_adj value for the change that will follow
after this.

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


# fbaf9f9f 08-Dec-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Don't try to bind i915 unless CONFIG_SND_HDA_I915 is set

snd-hda-intel driver tries to bind with i915 audio component always
when AZX_DCAPS_I915_POWERWELL is set in the driver caps. This was
mostly OK in the past, as the flag was applied only to a limited set
of devices, namely, Haswell and Broadwell. On these machines, i915
graphics is almost mandatory as long as HDMI/DP is concerned.

Recently the application of i915 binding was widened to more Intel
chips. On these chips, the chance of a kernel without i915 graphics
is much higher, and such user would hit an error like:

snd_hda_intel 0000:00:1b.0: failed to add i915 component master (-19)

Although the error itself is harmless, it's certainly superfluous even
to try binding with i915, if we already know that there isn't any.

This patch fixes it by simply defining AZX_DCAPS_I915_POWERWELL as 0
in the case without i915. Then all codes referring to this flag will
be optimized out by the compiler.

Fixes: 6603249dcdbb ('ALSA: hda - Enable audio component for old Intel PCH devices')
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2b760d88 04-Sep-2015 Lukas Wunner <lukas@wunner.de>

ALSA: hda - Spell vga_switcheroo consistently

Currently everyone and their dog has their own favourite spelling
for vga_switcheroo. This makes it hard to grep dmesg for log entries
relating to vga_switcheroo. It also makes it hard to find related
source files in the tree.

vga_switcheroo.c uses pr_fmt "vga_switcheroo". Use that everywhere.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/9b0175319ce78d831acfcf11e4c6c760f826b0e3.1444663039.git.lukas@wunner.de
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>


# 17eccb27 29-Apr-2015 Mengdong Lin <mengdong.lin@intel.com>

ALSA: hda - implement link_power ops for i915 display power control

This patch implements the bus link_power ops to request/release i915 display
power well. It can be used by the display codec which shares this power well
with GPU on Intel platforms.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6d23c8f5 17-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move prepared flag into struct hdac_stream

This flag seems used commonly, so deserves to be located there.

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


# 1604eeee 15-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Drop azx_sd_read*/write*() macros

They are no longer used (only one place which can be replaced with a
proper helper function). Let's drop.

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


# 828fa8ce 15-Apr-2015 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - simplify azx_has_pm_runtime

Because AZX_DCAPS_PM_RUNTIME is always defined as non-zero, the
initial part of the expression can be skipped.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a41d1224 14-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Embed bus into controller object

... and replace with the existing hda-core helper codes.
This reduces lots of lines, finally.

Since struct hda_bus is now embedded into struct azx,
snd_hda_bus_new() is moved and expanded from hda_codec.c to
hda_controller.c, accordingly. Also private_free bus ops and
private_data field are removed because we no longer need to point azx
object from bus (we can use container_of())

The spin locks are consolidated into the single one, bus->reg_lock.

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


# 7833c3f8 14-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Migrate hdac_stream into legacy driver

Embed hdac_stream object into azx_dev, and use a few basic helper
functions. The most of helper codes for hdac_stream aren't still used
yet.

Also this commit disables the tracepoints temporarily due to build
problems. It'll be enabled again later.

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


# a43ff5ba 14-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Pass bus io_ops directly from the top-level driver

One less redirection again. This also requires the change of the call
order in the toplevel divers. Namely, the bus has to be created at
first before other initializations since the memory allocation ops are
called through bus object now.

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


# 14752412 13-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add the controller helper codes to hda-core module

This patch adds the controller helper codes to hda-core library.
The I/O access ops are added to the bus ops. The CORB/RIRB, the basic
attributes like irq# and iomap address, some locks and the list of
streams are added to the bus object, together with the stream object
and its helpers.

Currently the codes are just copied from the legacy driver, so you can
find duplicated codes in both directories. Only constants are removed
from the original hda_controller.h. More integration work will follow
in the later patches.

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


# b2a0bafa 05-Mar-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use shutdown driver ops instead of reboot notifier

The driver shutdown ops is simpler than registering reboot notifier
manually. There should be no functional change by this -- the codec
driver calls its own callback while the bus driver just calls
azx_stop() like before.

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


# 820cc6cf 19-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Clear pcm pointer assigned to hda_pcm at device removal

We leave the pcm field of struct hda_pcm at removal of each device, so
far. This hasn't been a problem since unbinding the codec driver
isn't supposed to happen and another route via snd_hda_codec_reset()
clears all the once. However, for a proper unbind implementation, we
need to care about it.

This patch does the thing above properly:

- Include struct hda_pcm pointer instead of struct hda_pcm_stream
pointers in struct azx_dev. This allows us to point the hda_pcm
object at dev_free callback.

- Introduce to_hda_pcm_stream() macro for better readability.

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


# bb573928 20-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Drop power_save value indirection in hda_bus

We used to pass the power_save option value to hda_bus via a given
pointer. This was needed to refer to the value from the HD-audio core
side. However, after the transition to the runtime PM, this is no
longer needed.

This patch drops the power_save value indirection in hda_bus above,
and let the controller driver reprograms the autosuspend value
explicitly by a new helper, snd_hda_set_power_save(). Without this
call, the HD-audio core doesn't set up the autosuspend and flip the
runtime PM. (User may still be able to set up via sysfs, though.)

Along with this change, the pointer argument of azx_bus_create() is
dropped as well.

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


# 96d2bd6e 19-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Split azx_codec_create() to two phases

azx_create_codec() function does actually two things: create a bus and
probe codecs. For the future work, split this to two logical
functions, azx_bus_create() and azx_probe_codecs().

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


# b8f28d53 19-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Drop azx_mixer_create()

It's just an indirection, so let the caller directly calling
snd_hda_build_controls().

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


# 89a93fea 19-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fold hda_priv.h into hda_controller.h

There is no big reason to keep them separately.

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


# 703c759f 26-Jun-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use common reboot notifier

The very same notifier code is used in both hda_intel.c and
hda_tegra.c. Move it to the generic code.

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


# b6050ef6 26-Jun-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make position_fix as generic callback

... and move most parts into hda_intel.c from the generic controller
code. This is a clean up, and there should be no functional change by
this patch.

Now, struct azx obtains the generic callbacks for getting the position
and the delay. As default NULL, posbuf is read. These replace the
old position_fix[], and each is implemented as a callback.

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


# 17c3ad03 08-Apr-2014 Thierry Reding <treding@nvidia.com>

ALSA: hda - Make full_reset boolean

The full_reset argument to azx_init_chip() carries boolean rather than
numerical information, so update the type to reflect that.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 154867cf 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Move codec create to hda_controller

Codec creation and stream initialization can be shared between
hda_intel and hda platform drivers. Move it and the static functions
it depends on to hda_controller.c.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f0b1df88 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Move azx_interrupt to hda_controller

This code will be reused by an hda_platform driver as it has no PCI
dependencies. This allows update_rirb to be static as all users are
now in hda_controller.c.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f43923ff 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Move low level functions to hda_controller

Share more code from hda_intel. This moves the link control and
initialization to hda_controller. The code will also be used by an
hda platform driver.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f19c3ec2 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - move alloc_cmd_io to hda_controller

Combining the call to alloc_cmd_io with the allocate pages function
removes an extra interface between hda_intel and hda_controller.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6e85dddc 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Relocate RIRB/CORB interface to hda_controller

This is done to allow an HDA platform driver to reuse the code.

A few of the interfaces added to hda_controller will disappear in
following commits as their users are also moved to hda_controller.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2b5fd6c2 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Move the dsp loader to hda_controller

Moving the DSP loading functionality to hda_controller.c means that
the dsp lock doesn't need to be shared in hda_intel and
hda_controller. The forthcoming platform driver doesn't need the DSP
loading code, but sharing it doesn't hurt.

Tested on Chromebook Pixel's ca0132 that uses the DSP loader.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 67908994 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Pull pages allocation to hda_controller

Pull allocation from first_init to a new function in hda_controller.c.
Short term this will allow the dsp loader to be moved as well. In
later commits it will allow the same allocation to be used by the
platform hda driver.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 05e84878 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: hda - Add hda_controller.c and move pcm ops from hda_intel

Pull the pcm_ops and the functions they use into a new hda_controller
file. This is done to allow for other hda implementations besides PCI
to use the same ops. The hda_controller file will house functionality
related to HDA but independent of the bus used to talk to the
controller.

This currently shares dsp locking across the two files. This will be
remedied in a following commit.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>