History log of /linux-master/sound/pci/hda/hda_local.h
Revision Date Author Comments
# 2fa22c3c 21-Sep-2022 Jaroslav Kysela <perex@perex.cz>

ALSA: hda/hdmi: ELD procfs - print the codec NIDs

It is useful for the debugging to print also the used HDA codec NIDs
used for the given HDMI device. With the dynamic converter assignment
the converter NID is changed dynamically.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20220921093349.82680-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 56ec3e75 13-Jun-2022 Takashi Iwai <tiwai@suse.de>

ALSA: hda/realtek: Apply fixup for Lenovo Yoga Duet 7 properly

It turned out that Lenovo shipped two completely different products
with the very same PCI SSID, where both require different quirks;
namely, Lenovo C940 has already the fixup for its speaker
(ALC298_FIXUP_LENOVO_SPK_VOLUME) with the PCI SSID 17aa:3818, while
Yoga Duet 7 has also the very same PCI SSID but requires a different
quirk, ALC287_FIXUP_YOGA7_14TIL_SPEAKERS.

Fortunately, both are with different codecs (C940 with ALC298 and Duet
7 with ALC287), hence we can apply different fixes by checking the
codec ID. This patch implements that special fixup function.

For easier handling, the internal function for applying a specific
fixup entry is exported as __snd_hda_apply_fixup(), so that it can be
called from the codec driver. The rest is simply calling it with a
different fixup ID depending on the codec ID.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: nikitashvets@flyium.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/5ca147d1-3a2d-60c6-c491-8aa844183222@redhat.com
Link: https://lore.kernel.org/r/20220614054831.14648-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bb682f7a 14-Feb-2022 Cezary Rojewski <cezary.rojewski@intel.com>

ALSA: hda: Expose codec cleanup and power-save functions

With few changes, snd_hda_codec_set_power_save() and
snd_hda_codec_cleanup_for_unbind() can be re-used by ASoC drivers.
While at it, provide kernel doc for the exposed functions.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220214101404.4074026-5-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17e0c4cb 14-Feb-2022 Cezary Rojewski <cezary.rojewski@intel.com>

ALSA: hda: Update and expose codec register procedures

With few changes, snd_hda_codec_register() and its
unregister-counterpart can be re-used by ASoC drivers. While at it,
provide kernel doc for the exposed functions.

Due to ALSA-device vs ASoC-component organization differences, new
'snddev_managed' argument is specified allowing for better control over
codec registration process.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220214101404.4074026-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7206998f 16-Nov-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Fix potential deadlock at codec unbinding

When a codec is unbound dynamically via sysfs while its stream is in
use, we may face a potential deadlock at the proc remove or a UAF.
This happens since the hda_pcm is managed by a linked list, as it
handles the hda_pcm object release via kref.

When a PCM is opened at the unbinding time, the release of hda_pcm
gets delayed and it ends up with the close of the PCM stream releasing
the associated hda_pcm object of its own. The hda_pcm destructor
contains the PCM device release that includes the removal of procfs
entries. And, this removal has the sync of the close of all in-use
files -- which would never finish because it's called from the PCM
file descriptor itself, i.e. it's trying to shoot its foot.

For addressing the deadlock above, this patch changes the way to
manage and release the hda_pcm object. The kref of hda_pcm is
dropped, and instead a simple refcount is introduced in hda_codec for
keeping the track of the active PCM streams, and at each PCM open and
close, this refcount is adjusted accordingly. At unbinding, the
driver calls snd_device_disconnect() for each PCM stream, then
synchronizes with the refcount finish, and finally releases the object
resources.

Fixes: bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically")
Link: https://lore.kernel.org/r/20211116072459.18930-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 65cc4ad6 28-Nov-2021 Stefan Binding <sbinding@opensource.cirrus.com>

ALSA: hda/cs8409: Set PMSG_ON earlier inside cs8409 driver

For cs8409, it is required to run Jack Detect on resume.
Jack Detect on cs8409+cs42l42 requires an interrupt from
cs42l42 to be sent to cs8409 which is propogated to the driver
via an unsolicited event.
However, the hda_codec drops unsolicited events if the power_state
is not set to PMSG_ON. Which is set at the end of the resume call.
This means there is a race condition between setting power_state
to PMSG_ON and receiving the interrupt.
To solve this, we can add an API to set the power_state earlier
and call that before we start Jack Detect.
This does not cause issues, since we know inside our driver that
we are already initialized, and ready to handle the unsolicited
events.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Cc: <stable@vger.kernel.org> # v5.15+
Link: https://lore.kernel.org/r/20211128115558.71683-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b98444ed 13-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Suspend codec at shutdown

So far we have a few workarounds at shutdown for each codec,
e.g. turning off the display power and setting the codec to D3.
But all those are basically a part of the suspend procedure.
Moreover, the streams are still active after that call, hence it might
hit the update on the codec that has been already put to D3.

In this patch, instead of calling each reboot_notify callback, simply
put the codec into the runtime-suspended state after the manual
suspend of all PCM streams. It makes the code and the behavior more
consistent.

The reboot_notify callback is no longer used after this patch, and
will be cleaned up later.

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


# 3099406e 23-Jun-2021 Imre Deak <imre.deak@intel.com>

ALSA: hda: Release codec display power during shutdown/reboot

Similarly to the previous patch for the HDA controller make sure here
that codecs also drop the display power reference during shutdown and
reboot.

This fixes a power ref leaked WARN in i915 during shutdown if the HDA
driver is built with CONFIG_PM=n.

Suggested-by: Takashi Iwai <tiwai@suse.de>
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3618
References: https://lore.kernel.org/intel-gfx/s5hzgvhngw6.wl-tiwai@suse.de
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20210623134601.2128663-2-imre.deak@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e65bf997 17-Mar-2021 Jaroslav Kysela <perex@perex.cz>

ALSA: HDA - remove the custom implementation for the audio LED trigger

With the new snd-ctl-led module, we have a generic way
to trigger audio LEDs based on the sound control changes.

Remove the custom implementation from the HDA driver.

Move the LED initialization before snd_hda_gen_parse_auto_config()
call in all drivers to create marked controls there.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210317172945.842280-5-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b95a913c 06-Mar-2021 Vitaly Rodionov <vitalyr@opensource.cirrus.com>

ALSA: hda/cirrus: Increase AUTO_CFG_MAX_INS from 8 to 18

In preparation to support Cirrus Logic CS8409 HDA bridge on new Dell platforms
it is nessasary to increase AUTO_CFG_MAX_INS and AUTO_CFG_NUM_INPUTS values.
Currently AUTO_CFG_MAX_INS is limited to 8, but Cirrus Logic HDA bridge CS8409
has 18 input pins, 16 ASP receivers and 2 DMIC inputs. We have to increase this
value to 18, so generic code can handle this correctly.

Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210306111934.4832-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 74610eaf 02-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: (cosmetic) align function parameters

Fix cppcheck warnings and use same names in headers and C code.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200902212133.30964-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9ab0cb30 17-Jul-2020 Takashi Iwai <tiwai@suse.de>

ALSA: Replace the word "slave" in vmaster API

Follow the recent inclusive terminology guidelines and replace the
word "slave" in vmaster API. I chose the word "follower" at this time
since it seems fitting for the purpose.

Note that the word "master" is kept in API, since it refers rather to
audio master volume control.

Also, while we're at it, a typo in comments is corrected, too.

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


# 1a462be5 09-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Manage concurrent reg access more properly

In the commit 8e85def5723e ("ALSA: hda: enable regmap internal
locking"), we re-enabled the regmap lock due to the reported
regression that showed the possible concurrent accesses. It was a
temporary workaround, and there are still a few opened races even
after the revert. In this patch, we cover those still opened windows
with a proper mutex lock and disable the regmap internal lock again.

First off, the patch introduces a new snd_hdac_device.regmap_lock
mutex that is applied for each snd_hdac_regmap_*() call, including
read, write and update helpers. The mutex is applied carefully so
that it won't block the self-power-up procedure in the helper
function. Also, this assures the protection for the accesses without
regmap, too.

The snd_hdac_regmap_update_raw() is refactored to use the standard
regmap_update_bits_check() function instead of the open-code. The
non-regmap case is still open-coded but it's an easy part. The all
read and write operations are in the single mutex protection, so it's
now race-free.

In addition, a couple of new helper functions are added:
snd_hdac_regmap_update_raw_once() and snd_hdac_regmap_sync(). Both
are called from HD-audio legacy driver. The former is to initialize
the given verb bits but only once when it's not initialized yet. Due
to this condition, the function invokes regcache_cache_only(), and
it's now performed inside the regmap_lock (formerly it was racy) too.
The latter function is for simply invoking regcache_sync() inside the
regmap_lock, which is called from the codec resume call path.
Along with that, the HD-audio codec driver code is slightly modified /
simplified to adapt those new functions.

And finally, snd_hdac_regmap_read_raw(), *_write_raw(), etc are
rewritten with the helper macro. It's just for simplification because
the code logic is identical among all those functions.

Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200109090104.26073-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0fc1e447 16-Aug-2019 Hui Wang <hui.wang@canonical.com>

ALSA: hda - Expand pin_match function to match upcoming new tbls

With the existing pintbl, we already have many entries in it. it is
better to figure out a new way to reduce the size of the pintbl.

We plan to define a new tbl which will match more machines with a
single tbl, To do that, this function doesn't need to match all valid
pins between machine and tbl, it just needs to match all pins defined
in the tbl with the machine.

And the plan is to move some tbls from pin_fixup_tbl to
fallback_pin_fixup_tbl gradually.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

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

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 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 you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

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

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


# 009f8c90 24-May-2018 Lukas Wunner <lukas@wunner.de>

ALSA: hda - Fix runtime PM

Before commit 3b5b899ca67d ("ALSA: hda: Make use of core codec functions
to sync power state"), hda_set_power_state() returned the response to
the Get Power State verb, a 32-bit unsigned integer whose expected value
is 0x233 after transitioning a codec to D3, and 0x0 after transitioning
it to D0.

The response value is significant because hda_codec_runtime_suspend()
does not clear the codec's bit in the codec_powered bitmask unless the
AC_PWRST_CLK_STOP_OK bit (0x200) is set in the response value. That in
turn prevents the HDA controller from runtime suspending because
azx_runtime_idle() checks that the codec_powered bitmask is zero.

Since commit 3b5b899ca67d, hda_set_power_state() only returns 0x0 or
0x1, thereby breaking runtime PM for any HDA controller. That's because
an inline function introduced by the commit returns a bool instead of a
32-bit unsigned int. The change was likely erroneous and resulted from
copying and pasting snd_hda_check_power_state(), which is immediately
preceding the newly introduced inline function. Fix it.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=106597
Fixes: 3b5b899ca67d ("ALSA: hda: Make use of core codec functions to sync power state")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Abhijeet Kumar <abhijeet.kumar@intel.com>
Reported-and-tested-by: Gunnar Krüger <taijian@posteo.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3b5b899c 23-Jan-2018 Abhijeet Kumar <abhijeet.kumar@intel.com>

ALSA: hda: Make use of core codec functions to sync power state

Since sync_power_state is moved to core it's better to use the helper
function to ensure the actual power state reaches target instead of
using the local helper functions already exsisting in hda code.

Signed-off-by: Abhijeet Kumar <abhijeet.kumar@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3db9e970 09-May-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Remove the generic bind ctl helpers

Now all the users of this workaround code is gone, and we can finally
remove the legacy codes from the core HD-audio module.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 698f5ee3 09-May-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move bind-mixer switch codes to generic parser

The generic parser is the only user of the bind-mixer controls, so we
can move the code there and clean up the core helper.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 70b4891c 08-Oct-2015 Vinod Koul <vkoul@kernel.org>

ALSA: hda: make use of core codec fns

Now that we have introduced the core fns we should make hda use these
helpers

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


# a686ec4c 11-Jun-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Re-add the lost fake mute support

Yet another regression by the transition to regmap cache; for better
usability, we had the fake mute control using the zero amp value for
Conexant codecs, and this was forgotten in the new hda core code.

Since the bits 4-7 are unused for the amp registers (as we follow the
syntax of AMP_GET verb), the bit 4 is now used to indicate the fake
mute. For setting this flag, snd_hda_codec_amp_update() becomes a
function from a simple macro. The bonus is that it gained a proper
function description.

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


# cd6a6503 27-May-2015 Jie Yang <yang.jie@intel.com>

ALSA: replace CONFIG_PROC_FS with CONFIG_SND_PROC_FS

We may disable proc fs only for sound part, to reduce ALSA
memory footprint. So add CONFIG_SND_PROC_FS and replace the
old CONFIG_PROC_FSs in alsa code.

With sound proc fs disabled, we can save about 9KB memory
size on X86_64 platform.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# faa75f8a 26-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use regmap for parameter caches, too

The amp hash table was used for recording the cached reads of some
capability values like pin caps or amp caps. Now all these are moved
to regmap as well.

One addition to the regmap helper is codec->caps_overwriting flag.
This is set in snd_hdac_override_parm(), and the regmap helper accepts
any register while this flag is set, so that it can overwrite even the
read-only verb like AC_VERB_PARAMETERS. The flag is cleared
immediately in snd_hdac_override_parm(), as it's a once-off flag.

Along with these changes, the no longer needed amp hash and relevant
fields are removed from hda_codec struct now.

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


# eeecd9d1 25-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use regmap for amp accesses

This patch converts the amp access functions to the regmap helpers.
The amp values were formerly cached in the own hash table. Now it's
dropped by the regmap's cache.

The only tricky conversion is snd_hda_codec_amp_init(). This function
shouldn't do anything if the amp was already initialized. For
achieving this behavior, a value is read once at first temporarily in
the cache-only mode. Only if it returns an error, i.e. the item
still doesn't exist in the cache, it proceeds to the update.

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


# c4c2533f 03-Mar-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix possible runtime PM refcount unbalance

When the driver is unloaded before the codec is bound, it still keeps
the runtime PM refcount up, and results in the unbalance. This patch
covers these cases by introducing a flag indicating the runtime PM
initialization and handling the codec registration procedure more
properly. It also fixes the missing input beep device as a gratis,
too.

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


# 7639a06c 03-Mar-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move a part of hda_codec stuff into hdac_device

Now some codes and functionalities of hda_codec struct are moved to
hdac_device struct. A few basic attributes like the codec address,
vendor ID number, FG numbers, etc are moved to hdac_device, and they
are accessed like codec->core.addr. The basic verb exec functions are
moved, too.

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


# 9a6246ff 27-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Implement unbind more safely

Now we have all pieces ready, and put them into places:
- add the hda_pcm refcount to azx_pcm_open() and azx_pcm_close(),
- call the most of cleanup code in hda_codec_reset() from the codec
driver remove,
- call the same code also from the hda_codec object free.

Then the codec driver can be unbound more safely now.

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


# 7e40b80d 26-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Remove channel mode helper functions

They are no longer used, let's kill them.

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


# d8a766a1 17-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Bind codecs via standard bus

Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind
the codec driver with the codec device over there. This is the first
step of the whole transition so that the changes to each codec driver
are kept as minimal as possible.

Each codec driver needs to register hda_codec_driver struct containing
the currently existing preset via the new helper macro
module_hda_codec_driver(). The old hda_codec_preset_list is replaced
with this infrastructure. The generic parsers (for HDMI and other)
are also included in the preset with the special IDs to bind
uniquely.

In HD-audio core side, the device binding code is split to
hda_bind.c. It provides the snd_hda_bus_type implementation to match
the codec driver with the given codec vendor ID. It also manages the
module auto-loading by itself like before: when the matching isn't
found, it tries to probe the corresponding codec modules, and finally
falls back to the generic drivers. (The special ID mentioned above is
set at this stage.)

The only visible change to outside is that the hdaudio sysfs entry now
appears in /sys/bus/devices, not as a sound class device.

More works to move the suspend/resume and remove ops will be
(hopefully) done in later patches.

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


# 922c88a8 17-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Embed struct hda_bus_unsolicited into struct hda_bus

There is no big merit to handle hda_bus_unsolicited object
individually, as it's tightly coupled with the hda_bus object itself.
Embedding it makes the code simpler in the end.

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


# fb54a645 24-Oct-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Add missing terminating entry to SND_HDA_PIN_QUIRK macro

Without this terminating entry, the pin matching would continue
across random memory until a zero or a non-matching entry was found.

The result being that in some cases, the pin quirk would not be
applied correctly.

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


# 861a04ed 23-Sep-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Move the function "check_amp_caps" to hda_codec.c

The next patch will use it, so make it visible across modules.

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


# e9bd0224 12-Aug-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Remove obsoleted snd_hda_check_board_config() & co

The helper functions snd_hda_check_board_config() and
snd_hda_check_board_codec_sid_config() are no longer used since the
transition to the generic parser and all quirks have been replaced
with fixups. Let's kill these dead codes.

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


# f5662e1c 22-Jul-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Refactor quirk picking and change quirk priority

Previously, calling one quirk function first and another later
would make the latter one take priority, this is now changed
to make the former take priority.

By adding two special values for fixup_id we can also get rid of the
fixup_forced flag.

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


# 6194b99d 06-Jun-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Kill the rest of snd_print*() usages

Pass the codec object so that we can replace all the rest of
snd_print*() usages with the proper device-specific print helpers.

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


# 79514d47 06-Jun-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Kill snd_printd*() in HDMI debug / info prints

Pass codec instance to each function that still prints info and debug
outputs via snd_printd*().

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


# a2d2fa02 24-Jun-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Make a SND_HDA_PIN_QUIRK macro

This is cosmetical - it makes the new pin quirk table look better.

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


# 20531415 26-May-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Add a new quirk match based on default pin configuration

Normally, we match on pci ssid only. This works but needs new code
for every machine. To catch more machines in the same quirk, let's add
a new type of quirk, where we match on
1) PCI Subvendor ID (i e, not device, just vendor)
2) Codec ID
3) Pin configuration default

If all these three match, we could be reasonably certain that the
quirk should apply to the machine even though it might not be the
exact same device.

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


# 4e76a883 24-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Replace with standard printk

Use dev_err() and co for messages from HD-audio controller and codec
drivers. The codec drivers are mostly bound with codec objects, so
some helper macros, codec_err(), codec_info(), etc, are provided.
They merely wrap the corresponding dev_xxx().

There are a few places still calling snd_printk() and its variants
as they are called without the codec or device context.

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


# 648a8d27 25-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add sysfs to codec object, too

We have currently sysfs attributes for each hwdep, but basically these
should belong to the codec itself, per se. Let's add them to the
codec object while keeping them for hwdep as is for compatibility.

While we are at it, split the sysfs-related stuff into a separate
source file, hda_sysfs.c, and keep only the stuff necessary for hwdep
in hda_hwdep.c.

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


# caa751ba 25-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Create sysfs attribute files via groups

Instead of calling each time device_create_file(), create the groups
of sysfs attribute files at once in a normal way. Add a new helper
function, snd_get_device(), to return the associated device object,
so that we can handle the sysfs addition locally.

Since the sysfs file addition is done differently now,
snd_add_device_sysfs_file() helper function is removed.

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


# f0639272 17-Nov-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Bind with HDMI codec parser automatically

If a codec contains only the digital outputs, it's very likely a
HDMI/DP codec, which isn't supported by the generic parser but via
HDMI codec parser code. Detect such a case and bind with the proper
parser object if available.

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


# b21bdd0d 17-Nov-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Split the generic parser as an individual module

Drop the hard dependency on the generic parser code and load / unload
the generic parser code dynamically if built as a module. This allows
us to avoid the generic parser if only HDMI/DP codecs are found.

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


# 89250f84 24-Oct-2013 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs

ATI/AMD HDMI/DP codecs do not include standard HDA ELD (EDID-like data)
support.

In place of providing access to an ELD buffer, various vendor-specific
verbs are provided to provide the relevant information. Revision ID 3
and later (0x100300 as reported by procfs codec#X) have support for
providing more information than the previous revisions (but only if
supported by the display driver).

Generate ELD from the information provided by the vendor-specific verbs
on ATI/AMD codecs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: moved code to hda_eld.c and cleaned it up
v3: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a4e9a38b 17-Oct-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move mutex from hda_eld to per_pin in HDMI codec driver

Since the lock is used primarily in patch_hdmi.c, it's better to move
it in the local struct instead of exporting in hda_eld. The only
functions requiring the lock in hda_eld.c are proc accessors. So in
this patch, the proc entry and its creation/deletion/accessors are
moved into patch_hdmi.c, together with the mutex lock to pin_spec
struct.

The former proc info functions are exported so that they can be called
from patch_hdmi.c.

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


# 360fec28 16-Oct-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - add HDA_FIXUP_ACT_FREE action

A fixup which should be called before codec being freed will come
to use in the next patch.

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


# d045c5dc 18-Jun-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix missing Mic Boost controls for VIA codecs

Some VIA codecs like VT1708S have Mic boost amps in the mic pins but
they aren't exposed in the capability bits. In the past driver code,
we override the pin caps and create mic boost controls forcibly.
While transition to the generic parser, we lost the mic boost controls
although the pin caps are still overridden, because the generic parser
code checks the widget caps, too.

So this patch adds a new helper function to allow the override of the
given widget capability bits, and makes VIA codecs driver to add the
missing input-amp capability bit.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59861
Cc: <stable@vger.kernel.org> [v3.9+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 06ec56d3 17-Jun-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix return value of snd_hda_check_power_state()

The refactoring by commit 9040d102 introduced the new function
snd_hda_check_power_state(). This function is supposed to return true
if the state already reached to the target state, but it actually
returns false for that. An utterly stupid typo while copy & paste.

Fortunately this didn't influence on much behavior because powering up
AFG usually powers up the child widgets, too. But the finer power
control must have been broken by this bug.

Cc: <stable@vger.kernel.org> [v3.9+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ba615b86 13-Mar-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Don't apply EAPD power filter as default

So far, the driver doesn't power down the widget at going down to D3
when the widget node has an EAPD capability and EAPD is actually set
on all codecs unless codec->power_filter is set explicitly.
This caused a problem on some Conexant codecs, leading to click
noises, and we set it as NULL there. But it is very unlikely that the
problem hits only these codecs.

Looking back at the development history, this workaround for EAPD was
introduced just for some laptops with STAC9200 codec, then we applied
it blindly for all. Now, since it's revealed to have an ill effect,
we should disable this workaround per default and apply only for the
known requiring systems.

The EAPD workaround is implemented now as snd_hda_codec_eapd_power_filter(),
and this has to be set explicitly by the codec driver when needed.
As of now, only patch_stac9200() sets this one.

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


# 4bd038f9 19-Feb-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - hdmi: Protect ELD buffer

Because the eld buffer can be simultaneously accessed from both
workqueue context (updating) and process context (kcontrol read),
we need to protect it with a mutex to guarantee consistency.

To avoid holding the mutex while reading the ELD info from the
codec, we introduce a temporary eld buffer.

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


# 1613d6b4 19-Feb-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - hdmi: Refactor hdmi_eld into parsed_hdmi_eld

For better readability, the information that is parsed out of the
ELD data is now put into a separate parsed_hdmi_eld struct.

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


# 9040d102 24-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_check_power_state() helper function

... for small refactoring.

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


# 1f578250 23-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add chained_before flag to the fixup entry

Sometimes we want to call a fixup after applying other existing
fixups, but currently the fixup chain mechanism allows only the call
the others after the target fixup. This patch adds a new flag,
chained_before, to struct hda_fixup, for allowing the chained call
before the current execution.

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


# dc870f38 22-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Combine snd_hda_codec_flush_*_cache() to a single function

Since both snd_hda_codec_flush_amp_cache() and
snd_hda_codec_flush_cmd_cache() are called usually at the same time,
we can simply combine them to a single function,
snd_hda_codec_flush_cache().

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


# bc759721 11-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_get_int_hint() helper function

It'll be used in hda_generic.c, too.

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


# fd108215 10-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add a new fixup type to override pinctl values

Add a new fixup type, HDA_FIXUP_PINCTLS, for overriding the pinctl
values of the given pins. It takes the same array of struct pintbl
like HDA_FIXUP_PINS, but each entry contains the pinctl value instead
of the pin default config value.

This patch also replaces the corresponding codes in patch_realtek.c.
Without this change, the direct call of verbs may be overridden again
by the later call of pinctl restoration by the driver.

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


# 62f3a2f7 10-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - More strict correction of invalid pinctl bits

Check more strictly about the validity of pinctl values in
snd_hda_set_pin_ctl() and correct the wrong bits automatically.
Also provide the helper function to correct pinctl bits to codec
drivers.

This automatically fixes the invalid pinctl writes that are found in
a few Realtek fixups for NID 0x0f amp like ASUS A6Rp.

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


# d7fdc00a 10-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add helper functions to cache the current pinctl target

We already have the list of whole pin widgets and there is an unused
space in the list; let's use it for caching the current pinctl value.

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


# 0c3d47b0 20-Dec-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_codec_flush_*_cache() aliases

It makes easier to understand although these are identical with
snd_hda_codec_resume_*() functions.

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


# c9ce6b26 18-Dec-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move fixup code into struct hda_codec

Since the fixup code is used commonly, it's worth to move it to the
common place, struct hda_codec, instead of keeping in hda_gen_spec.

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


# 130e5f06 14-Dec-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda/realtek - Add path active flag

... and rewrite the initialization of output paths as a generic
function that is applicable for both i/o directions.

The new flag, active, is introduced to each nid_path entry. This
indicates whether the given path is active, and it's used for checking
whether a certain widget can be turned off or changed when a path is
no longer used or newly enabled.

It's still used only in the output paths. More wider adaption for
input and loopback paths will be achieved in the later patch.

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


# 280e57d5 14-Dec-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Introduce snd_hda_codec_amp_init*()

The new function snd_hda_codec_amp_init() (and the stereo variant)
initializes the amp value only once at the first access. If the amp
was already initialized or updated, this won't do anything more.

It's useful for initializing the input amps that are in the part of
the path but never used.

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


# c370dd6e 13-Dec-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Introduce cache & flush cmd / amp writes

For optimizing the verb executions, a new mechanism to cache the verbs
and amp update commands is introduced. With the new "write to cache
and flush" way, you can reduce the same verbs that have been written
multiple times.

When codec->cached_write flag is set, the further
snd_hda_codec_write_cache() and snd_hda_codec_amp_stereo() calls will
be performed only on the command or amp cache table, but not sent to
the hardware yet. Once after you call all commands and update amps,
call snd_hda_codec_resume_amp() and snd_hda_codec_resume_cache().
Then all cached writes and amp updates will be written to the
hardware, and the dirty flags are cleared.

In this implementation, the existing cache table is reused, so
actually no big code change is seen here. Each cache entry has a new
dirty flag now (so the cache key is now reduced to 31bit).

As a good side-effect by this change, snd_hda_codec_resume_*() will no
longer execute verbs that have been already issued during the resume
phase by checking the dirty flags.

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


# dda415d4 30-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add a helper function for simple enum kcontrols

The same type of code is being used in multiple places in various
codec drivers, so put it as a core library.

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


# dcda5806 12-Oct-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add workaround for conflicting IEC958 controls

When both an SPDIF and an HDMI device are created on the same card
instance, multiple IEC958 controls are created with indices=0, 1, ...
But the alsa-lib configuration can't know which index corresponds
actually to which PCM device, and both the SPDIF and the HDMI
configurations point to the first IEC958 control wrongly.

This patch introduces a (hackish and ugly) workaround: the IEC958
controls for the SPDIF device are re-labeled with device=1 when HDMI
coexists. The device=1 corresponds to the actual PCM device for
SPDIF, so it's anyway a better representation. In future, HDMI
controls should be moved with the corresponding PCM device number,
too.

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


# 83012a7c 24-Aug-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE

CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its
behavior can be well controlled via the default value and module
parameter. Let's just replace it with the standard CONFIG_PM.

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


# 0401e854 03-Jul-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move beep helper functions to hda_beep.c

Move snd_hda_mixer_amp_switch_put_beep() to hda_beep.c as a clean up
to remove one more ifdef.

Also add the corresponding get callback to return consistently the
digital beep state independently from the mixer amp value.

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


# 128bc4ba 07-May-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.c

Just code shuffles.

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


# 4740860b 20-Apr-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_get_default_vref() helper function

Add a new helper function to guess the default VREF pin control bits
for mic in. This can be used to set the pin control value safely
matching with the actual pin capabilities.

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


# cdd03ced 19-Apr-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Introduce snd_hda_set_pin_ctl*() helper functions

For setting the pin-control values more safely to match with the
actual pin capability bits, a copule of new helper functions,
snd_hda_set_pin_ctl() and snd_hda_set_pin_ctl_cache(), are
introduced. These are simple replacement of the codec verb write with
AC_VERB_SET_PIN_WIDGET but do more sanity checks and filter out
superfluous pin-control bits if they don't fit with the corresponding
pin capabilities.

Some codecs are screwed up or ignore the command when such a wrong bit
is set. These helpers will avoid such secret errors.

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


# f29735cb 13-Mar-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add expose_enum_ctl flag to snd_hda_add_vmaster_hook()

Since it's not always safe to assume that the vmaster hook is purely the
mute-LED control, add the flag indicating whether to expose the mute-LED
enum control or not. Currently, conexant codec sets this off for non-HP
laptops where EAPD may be used really as EAPD.

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


# d2f344b5 12-Mar-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add "Mute-LED Mode" enum control

Create snd_hda_add_vmaster_hook() and snd_hda_sync_vmaster_hook()
helper functions to handle the mute-LED in vmaster hook more
commonly. In the former function, a new enum control "Mute-LED Mode"
is added. This provides user to choose whether the mute-LED should be
turned on/off explicitly or to follow the master-mute status.

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


# 29e5853d 11-Mar-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Return the created kcontrol in __snd_hda_add_vmaster()

It'll be used for adding hooks in later patches.

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


# 18478e8b 09-Mar-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Initialize vmaster slave volumes

When the driver is changed to use vmaster or a new slave element is
added by the improvement of the parser code, user may face often the
silent output because of the muted slave mixer although Master volume
is properly set. And they complain. And I get upset.

Although such a mixer element should be initialized via "alsactl init",
it'd be more user-friendly if the known output slaves are unmuted and
set to 0dB so that user can control the volume only with Master as
default. Since Master is still set muted as default even with this
change, no risk of the speaker blow up, too.

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


# 9322ca54 03-Feb-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add suffix argument to snd_hda_add_vmaster()

In most cases, the slave strings for vmaster are identical between
volumes and switches except for "xxx Volume" and "xxx Switch" suffix.
Now snd_hda_add_vmaster() takes the optional suffix argument so that
each string can be composed with the given suffix, and we can share the
slave name strings in both volume and switch calls nicely.

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


# 3a90274d 09-Jan-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs

When an invalid NID is given, get_wcaps() returns zero as the error,
but get_wcaps_type() takes it as the normal value and returns a bogus
AC_WID_AUD_OUT value. This confuses the parser.

With this patch, get_wcaps_type() returns -1 when value 0 is given,
i.e. an invalid NID is passed to get_wcaps().

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740118

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 31ef2257 01-Dec-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Integrate input-jack stuff into kctl-jack

Instead of managing input-jack stuff separately, call all stuff inside
the kctl-jack creation, deletion and report. The caller no longer needs
to care about input-jack.

The better integration between input-jack and kctl-jack should be done
in the upper layer in near future, but for now, it's implemented locally
for more tests.

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


# 201e06ff 16-Nov-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Give more unique names by snd_hda_get_pin_label()

The function now gives more unique names for the output pins by adding
some prefix and suffix for the location and the channels. Otherwise, it
can pass the index number.

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


# aad37dbd 02-Nov-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Merge input-jack helpers to hda_jack.c

We can use the very same table in hda_jack.c for managing the list for
input-jack elements, too.

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


# 1835a0f9 27-Oct-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Cache the jack-detection value

Introduce a table containing the pins and their jack-detection states
for avoiding the unnecessary verbs to check the pin status at each time.

When the unsol event is enabled via snd_hda_jack_detect_enable(), it
automatically adds the given NID to the table. Then the driver supposes
that the codec driver will set the dirty flag appropariately when an
unsolicited event is invoked for that pin.

The behavior for reading other pins that aren't registered in the table
doesn't change. Only the pins assigned to the table are cached, so far.

In near futre, this table can be extended to use the central place for
the unsolicited events of all pins, etc, and eventually include the
jack-detect kcontrols that replace the current input-jack stuff.

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


# 04f5ade6 27-Oct-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Introduce snd_hda_get_pin_label()

Create a new helper function snd_hda_get_pin_label() for getting a label
string for both input and output pins. hda_get_input_pin_label() is
obsoleted by this function, and the callers are replaced appropriately
now by this patch.

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


# b95d68b8 16-Nov-2011 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - fix ELD memory leak

memset(eld) clears eld->proc_entry which will leak the struct
snd_info_entry when unloading module.

Fix it by
- memset only the fields before eld->eld_buffer
- set eld->eld_valid to true _after_ all eld fields have been filled

Cc: <stable@kernel.org>
Cc: Pierre-louis Bossart <pierre-louis.bossart@intel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2f451d2a 09-Nov-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Re-enable the check NO_PRESENCE misc bit

We disabled the check of NO_PRESENCE bit of the default pin-config
in commit f4419172 temporarily. One problem was that the first
implementation was wrong -- the bit after the shift must be checked.
However, this would still give many regressions on machines with broken
BIOS. They set this bit wrongly even on active pins.

A workaround is to check whether all pins contain this bit. As far as
I've checked, broken BIOSen set this bit on all pins, no matter whether
active or not. In such a case, the driver should ignore this bit check.

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


# f4419172 06-Nov-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Revert the check of NO_PRESENCE pincfg default bit

The implementation on commit [08a1f5eb: ALSA: hda - Check NO_PRESENCE
pincfg default bit] seems like a mis-interpretation of specification.
The spec gives the reversed bit definition. But, following the spec
also causes to change so many existing device configurations, thus we
can't change it so easily for now. For 3.2-rc1, it's safer to revert
this check (actually this patch comments out the code).

We may re-introduced the fixed version once after the wider test-case
coverages are done.

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


# 08a1f5eb 02-Nov-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Check NO_PRESENCE pincfg default bit

HD-audio spec defines a bit in pin default configuration for indicating
that the pin isn't used for jack-detection although the codec is capable
of it. Better to check this bit as well in jack_is_detectable() helper
function.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 527e4d73 27-Oct-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda/realtek - Fix missing volume controls with ALC260

ALC260 has multiple mixer widgets connected to the shared DAC, but the
driver currently doesn't check this possibility and ignores when the DAC
is shared with others. This resulted in the silent output from some
routes because of lack of the amp setup.

This patch adds the workaround for it by checking the route even with the
shared DAC, but also checking the conflict with the existing control for
the very same widget NID.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=726812

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


# f71ff0d7 06-Oct-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Moved snd_print_pcm_rates() back into hda_proc.c

Since hda_proc.c is now the only user of snd_print_pcm_rates(), better to
put it back locally to hda_proc.c and revert to the old style.

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


# 14bc52b8 30-Sep-2011 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda/hdmi: expose ELD control

Applications may want to read ELD information to
understand what codecs are supported on the HDMI
receiver and handle the a-v delay for better lip-sync.

ELD information is exposed in a device-specific
IFACE_PCM kcontrol. Tested both with amixer and
PulseAudio; with a corresponding patch passthrough modes
are enabled automagically.

ELD control size is set to zero in case of errors or
wrong configurations. No notifications are implemented
for now, it is expected that jack detection is used to
reconfigure the audio outputs.

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


# a06dbfc2 23-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add multi-headphone NIDs in multiout struct

For supporting both the multiple headphones and the multiple speakers,
add the new field in struct hda_multi_out, and evaluate in the standard
setup functions.

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


# d025febc 23-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Rename to snd_hda_parse_pin_defcfg()

... and add a new bit-flags argument to specify the behavior of the
function. The older function is kept as is (as a wrapper).

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


# f57c2565 14-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_override_pin_caps() helper function

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


# 2a43952a 26-Jul-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make CONFIG_SND_HDA_POWER_SAVE depending on CONFIG_PM

It makes little sense to enable power-saving without PM.
This removes SND_HDA_NEEDS_RESUME define so that we can use CONFIG_PM
in all places.

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


# 880a050f 28-Jun-2011 Stephen Rothwell <sfr@canb.auug.org.au>

ALSA: hda - remove SND_HDA_POWER_SAVE protection of struct hda_loopback_check

to fix build problems when it is disabled.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2def8172 01-Jun-2011 Stephen Warren <swarren@nvidia.com>

ALSA: hda: hdmi_eld_update_pcm_info: update a stream in place

A future change won't store an entire hda_pcm_stream just to represent
the capabilities of a codec; a custom data-structure will be used. To
ease that transition, modify hdmi_eld_update_pcm_info to expect the
hda_pcm_stream to be pre-initialized with the codec's capabilities, and
to update those capabilities in-place based on the ELD.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 74b654c9 01-Jun-2011 Stephen Warren <swarren@nvidia.com>

ALSA: hda: Virtualize SPDIF out controls

The SPDIF output controls apply to converter widgets. A future change
will create a PCM device per pin widget, and hence a set of SPDIF output
controls per pin widget, for certain HDMI codecs. To support this, we
need the ability to virtualize the SPDIF output controls. Specifically:

* Controls can be "unassigned" from real hardware when a converter is
not used for the PCM the control was created for.
* Control puts only write to hardware when they are assigned.
* Controls can be "assigned" to real hardware when a converter is picked
to support output for a particular PCM.
* When a converter is assigned, the hardware is updated to the cached
configuration.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e35d9d6a 17-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Check unsol-cap in is_jack_detectalbe()

Also replace more open-codes with this function.

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


# 03697e2a 17-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add automute-mode enum to Conexant auto-parser

Implement the same functionality as Realtek's auto-mute mode control.
Now Conexant auto-parser can also mutes line-out and provide the enum
control for different automute behavior.

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


# dda14410 02-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Constify some API function arguments

Also fixed the assignment of multiout.dac_nids to satisfy const.

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


# 031024ee 02-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Constify some API function arguments

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


# cd372fb3 03-Mar-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make common input-jack helper functions

Since multiple codec drivers already use the input-jack stuff, let's
make common helper functions to reduce the duplicated codes.

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


# ea734963 17-Jan-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - consitify string arrays

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


# de8c85f7 15-Oct-2010 Clemens Ladisch <clemens@ladisch.de>

ALSA: HDA: Sigmatel: work around incorrect master muting

The HDA specification does not allow for a codec to mute itself just
because the volume is reduced, so _of course_ somebody had to go and do
it. This wouldn'\''t hurt too much when the volume is adjusted by hand,
but programs like PA that try to set the volume automatically could
inadvertently mute the output.

To work around this, change the TLV dB information for the Master volume
on all Sigmatel HDA codecs to indicate the the minimal volume setting
actually mutes.

Reported-by: Colin Guthrie <gmane@colin.guthr.ie>
Reported-by: "Alexander E. Patrakov" <patrakov@gmail.com>
Tested-by: Colin Guthrie <cguthrie@mandriva.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 99ae28be 17-Sep-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make snd_hda_get_input_pin_attr() helper

Make the helper function to give the input-pin attribute for jack
connectivity and location. This simplifies checks of input-pin jacks
a bit in some places.

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


# 10a20af7 09-Sep-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Improve the input source name labels

This patch improves the input-source label strings to be generated from
the pin information instead of fixed strings per AUTO_PIN_* type.
This gives more suitable labels, especially for mic and line-in pins.

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


# 86e2959a 09-Sep-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Remove AUTO_PIN_FRONT_{MIC|LINE}

We can assign multiple pins to a single role now, let's reduce the
redundant FRONT_MIC and FRONT_LINE. Also, autocfg->input_pins[] is
no longer used, so this is removed as well.

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


# b5786e85 09-Sep-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Keep char arrays in input_mux items

Keep char array in the input_mux item itself instead of pointing to
an external string. This is a preliminary work for improving the
input-mux name based on the pin role.

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


# d7b1ae9d 30-Aug-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_get_input_pin_label() helper function

Added snd_hda_get_input_pin_label() helper function to return the
string that can be used for control or capture-source ids.

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


# 75e0eb24 29-Aug-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add inputs[] to auto_pin_cfg struct

Added the new fields to contain all input-pins to struct auto_pin_cfg.
Unlike the existing input_pins[], this array contains all input pins
even if the multiple pins are assigned for a single role (i.e. two
front mics). The former input_pins[] still remains for a while, but
will be removed in near future.

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


# bbbe3390 13-Aug-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Restrict PCM parameters per ELD information over HDMI

When a device is plugged over HDMI, it passes some information in ELD
including the supported PCM parameters like formats, rates, channels.
This patch adds the check to PCM open callback of HDMI streams so that
only valid parameters the device supports are used.

When no device is plugged, the parameters the codec supports are used;
it's mostly all parameters the hardware can work. This is for apps
that are started before device plugging and do probing (e.g. a sound
daemon), so that at least, probing would work even before the device
plugging.

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


# b7a5633a 18-Mar-2010 Justin P. Mattock <justinmattock@gmail.com>

fix comment typo in sound/pci/hda/hda_local.h

I think this should be automatic pin instead of ping.
(but could be wrong).

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 21949f00 23-Dec-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix NID association for capture mixers

Fix the wrong implementation of NID <-> kctl mapping for capture mixers
introduced by the ocmmit 5b0cb1d850c26893b1468b3a519433a1b7a176be.
So far, the driver returns an error at probe.

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


# 5e26dfd0 10-Dec-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - simplify usage of HDA_SUBDEV_AMP_FLAG

The HDA_SUBDEV_NID_FLAG is duplicate for amplifier control elements. Move
get_amp_nid_() call to the snd_hda_ctl_add() function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 9e3fd871 08-Dec-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - introduce HDA_SUBDEV_AMP_FLAG (ControlAmp in proc)

The purpose of this changeset is to show information about amplifier
setting in the codec proc file. Something like:

Control: name="Front Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Control: name="Front Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=In, idx=2, ofs=0

Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 5b0cb1d8 08-Dec-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - add more NID->Control mapping

This set of changes add missing NID values to some static control
elemenents. Also, it handles all "Capture Source" or "Input Source"
controls.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 864f92be 17-Nov-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - introduce snd_hda_jack_detect() and snd_hda_pin_sense()

This helps merge duplicate code.

v2: add snd_hda_jack_detect() and comments recommended by Takashi.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 23ccc2bd 17-Nov-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: intelhdmi - export monitor-presence and ELD-valid status

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 67d634c0 16-Nov-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix build errors with CONFIG_SND_HDA_INPUT_BEEP=n

Disable beep-related codes when CONFIG_SND_HDA_INPUT_BEEP isn't set.

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


# 85dd662f 11-Nov-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - move snd_hda_pcm_type_name from hda_codec.h to hda_local.h

The snd_hda_pcm_type_name array is local only.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9c96fa59 16-Nov-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Get rid of magic digits for subdev hack

Define a proper const for a magic 31bit flag for subdev / NID setup
with a brief comment.

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


# 4d02d1b6 12-Nov-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - proc - add support for dynamic controls to mixer<->NID mapping

This patch adds support for dynamically created controls to proc codec file
(Control: lines).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3911a4c1 11-Nov-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda - proc - introduce Control: lines to show mixer<->NID assignment

This is an initial patch to show universal control<->NID assigment in
proc codec file. The change helps to debug codec related problems.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 123c07ae 21-Oct-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: hda_intel: Digital PC Beep - change behaviour for input layer

Original implementation was keeping registered input device for SND_BEEP
and SND_TONE events all time. This patch changes this behaviour:
If digital PC Beep is turned off using universal control switch,
the input device is unregistered.

Explanation: The kd_mksound() send SND_BEEP and SND_TONE only to last
registered device acceping those events. It means that the HDA Intel
audio driver blocks also the internal PC Speaker device (pcspkr.c
driver) even if the HDA Beep is muted. The user can easy disable
all beeps using 'setterm -blength 0' or 'xset b off' command.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7288561a 12-Nov-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix build error without CONFIG_SND_HDA_HWDEP=y

CONFIG_SND_HDA_POWER_SAVE is independent from CONFIG_SND_HDA_HWDEP.
Thus snd_hda_hwdep_add_power_sysfs() needs the check of both kconfigs.

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


# a2f6309e 11-Nov-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add power on/off counter

Added the power on/off counter and expose via sysfs files.
The sysfs files, power_on_acct and power_off_acct, are created under
each codec hwdep sysfs directory (e.g. /sys/class/sound/hwC0D0).
The files show the msec length of the codec power-on and power-off,
respectively.

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


# 54a25f87 30-Oct-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - vectorize intelhdmi

The Intel IbexPeak HDMI codec supports 2 converters and 3 pins,
which requires converting the cvt_nid/pin_nid to arrays.

The active pin number (the one connected with a live HDMI monitor/sink)
will be dynamically identified on hotplug events.

It exports two HDMI devices, so that user space can choose the A/V pipe
for sending the audio samples.

It's still undefined behavior when there are two active monitors
connected and routed to the same audio converter.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fd72d008 23-Aug-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda: move open coded tricks into get_wcaps_channels()

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a22d543a 26-Jul-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Introduce get_wcaps_type() macro

Add a helper macro to retrieve the widget type from wiget cap bits.

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


# a1e21c90 17-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Don't call snd_hda_codec_configure in snd_hda_codec_new()

The codec setup call via snd_hda_codec_configure() isn't necessarily
called in snd_hda_codec_new(). For the later added feature, it's better
to change the code flow like:
- create all codec instances
- configure each codec

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


# 1327a32b 23-Mar-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Cache pin-cap values

Added snd_hda_query_pin_caps() to read and cache pin-cap values
to avoid too frequently issuing the same verbs.

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


# 43b62713 02-Mar-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add hint string helper functions

Added snd_hda_get_hint() and snd_hda_get_bool_hint() helper functions
to retrieve a hint value.

Internally, the hint is stored in a pair of two strings, key and val.

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


# 5d9b6c07 25-Feb-2009 Hannes Eder <hannes@hanneseder.net>

ALSA: sound/pci/hda: fix sparse warning: different signedness

Fix this sparse warning:
sound/pci/hda/hda_codec.c:1544:19: warning: incorrect type in assignment (different signedness)
sound/pci/hda/hda_codec.c:1544:19: expected unsigned long *vals
sound/pci/hda/hda_codec.c:1544:19: got long *<noident>

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a65d629c 23-Feb-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add pseudo device-locking for clear/reconfig

Added the pseudo device-locking using card->shutdown flag to avoid
the crash via clear/reconfig during operations.

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


# 9411e21c 13-Feb-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add snd_hda_multi_out_dig_cleanup()

Added the helper function snd_hda_multi_out_dig_cleanup() to clean up
the digital outputs with multi setup. This call is needed in cases
the codec supports multiple digital outputs as slaves. Otherwise the
slave widgets aren't properly cleaned up.

For a single digital output (e.g. in patch_conexant.c), this call isn't
needed.

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


# 0852d7a6 11-Feb-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Detect multiple digital-out pins

Detect multiple digital-out pins in snd_hda_parse_pin_defconfig().
The dig_out_pin and dig_out_type fields become arrays.

The codec parser still doesn't use this multiple pins detection, though.

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


# b25c9da1 06-Feb-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: enable concurrent digital outputs for ALC1200

Add the SPDIF pin as slave digital out to enable concurrent
HDMI/SPDIF outputs for ASUS M3A-H/HDMI with ALC1200 codec.

Tested-by: Thomas Schneider <nailstudio@gmx.net>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2297bd6e 20-Jan-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Check HDMI jack types in the auto configuration

Add dig_out_type and dig_in_type fields to autocfg struct.
A proper HDA_PCM_TYPE_* value is assigned to these fields according
to the pin-jack location type value.

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


# 29fdbec2 20-Jan-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add extra volume offset to standard volume amp macros

Added the volume offset to base for the standard volume controls
to handle elements with too big volume scales like -96dB..0dB.
For such elements, you can set the base volume to reduce the range.

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


# 2eda3445 11-Aug-2008 Mauro Carvalho Chehab <mchehab@kernel.org>

ALSA: hda - Add a new function to seek for a codec ID

Gateway notebooks have their ID inside codec vendor ID, not at PCI ID. Due to
that, model auto-detection were not possible with the standard seek method.

This is what is found at lspci -vnn:

00:14.2 Audio device [0403]: ATI Technologies Inc SB450 HDA Audio [1002:437b] (rev 01)
Subsystem: ATI Technologies Inc SB450 HDA Audio [1002:437b]

Yet, autodetection is possible, since the codec properly reflects the vendor at
the Subsystem ID:

$ cat /proc/asound/card0/codec#0 |head -4

Codec: SigmaTel STAC9250
Address: 0
Vendor Id: 0x83847634
Subsystem Id: 0x107b0367

This patch adds a new autodetection function that seeks for codec subsystem ID.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e7ee058c 21-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Make CONFIG_SND_HDA_RECONFIG for codec reconfiguration

Make the codec re-configuration feature selectable via Kconfig,
CONFIG_SND_HDA_RECONFIG.
Also mark it as experimental (as it really is).

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


# f208dba9 21-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Release ELD proc file

Release ELD proc file when reconfigured so that no leak occurs.

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


# 0623536c 21-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add missing static for snd_hda_eld_proc_new() inline funciton

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


# d39b4352 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: make global snd_print_pcm_bits()

Introduce a global function snd_print_pcm_bits() and use it in the ELD code.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5b87ebb7 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: rename sink_eld to hdmi_eld

Rename struct sink_eld to hdmi_eld.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 903b21d8 18-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: make global snd_print_channel_allocation()

code refactor: make a global function snd_print_channel_allocation().

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5f1e71b1 17-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: ELD proc interface for HDMI sinks

Create /proc/asound/card<card_no>/eld#<codec_no> to reflect the audio
configurations and capabilities of the attached HDMI sink.

Some notes:

- Shall we show an empty file if the ELD content is not valid?
Well it's not that simple. There could be partially populated ELD,
and there may be malformed ELD provided by buggy drivers/monitors.
So expose ELD as it is.

- The ELD retrieval routines rely on the Intel HDA interface,
others are/could be universal and independent ones.

- How do we name the proc file?
If there are going to be two HDMI pins per codec, then the current naming
scheme (eld#<codec no>) will fail. Luckily the user space dependencies should
be minimal, so it would be trivial to do the rename if that happens.

- The ELD proc file content is designed to be easy for scripts and human reading.
Its lines all have the pattern:
<item_name>\t[\t]*<item_value>
where <item_name> is a keyword in c language, while <item_value> could be any
contents, including white spaces. <item_value> could also be a null value.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f4a9f43 17-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: create hda_eld.c for ELD routines and proc interface

ELD handling routines can be shared by all HDMI codecs,
and they are large enough to make a standalone source file.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 33deeca3 17-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: introduce snd_print_pcm_rates()

We want to share some code with print_pcm_rates(),
so extract a common routine snd_print_pcm_rates() from it.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d301fc32 29-Oct-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix indentation in hda_local.h

Just cosmetic fixes of spacing that annoyed me.

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


# d7ffba19 30-Jul-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add sysfs entries to hwdep devices

Added the sysfs entries to hwdep devices so that the new features
like reconfiguration can be done via sysfs.

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


# 6c1f45ea 30-Jul-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Add codec reconfiguration feature

Added the reconfiguration feature of any individual codec.
Via the reconfiguration, the old resources are released and
the patch is called again to recreate the PCM and mixers in
addition to the re-initialization.

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


# d13bd412 30-Jul-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Manage kcontrol lists

Manage all kcontrol elements created in the hda-intel driver.
This makes it possible to remove and reconfigure the controls
of each codec.

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


# 35e8901e 13-Sep-2008 Robin H. Johnson <robbat2@gentoo.org>

ALSA: HDA: hda_local: Less magic numbers.

Explain some of the magic numbers I saw while trying to fix the AD1989 SPDIF
issue. Maybe should just use the expanded form directly in the verbs?

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 89385035 11-Sep-2008 Matt Ranostay <mranostay@gmail.com>

ALSA: hda: Input port AMP controls

Added support for controlling hardware gain amps on input ports
using a volume control mixer with a mux selecting the port being controlled.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# e922b002 18-Feb-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Move vmaster code to sound core

Move the codes for virtual master controls to sound core part so that
not only hda-intel drivers can use it.

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


# 9a08160b 12-Feb-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Add "IEC958 Default PCM" switch

Added a new mixer switch to enable/disable the sharing of the default
PCM stream with analog and SPDIF outputs. When "IEC958 Default PCM"
switch is on, the PCM stream is routed both to analog and SPDIF outputs.
This is the behavior in the earlier version.

Turning this switch off has a merit for some codecs, though. Some codec
chips don't support 24bit formats for SPDIF but only for analog outputs.
In this case, you can use 24bit format by disabling this switch.

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


# 09a99959 24-Jan-2008 Matt Ranostay <mranostay@gmail.com>

[ALSA] hda: Add dynamic mono mixer support for STAC92xx codecs

Allows for dynamically creating mono out mixer controls and well
as mono mux controls.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 90da78bf 24-Jan-2008 Matt Ranostay <mranostay@gmail.com>

[ALSA] hda: Added mono_out_pin to autoconfig

Added a mono_out_pin field to autocfg struct, and code to parse
for the mono_out_line.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# dca008f3 22-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Don't query widget parameter for invalid NID

Don't query a widget parameter for an invalid NID in get_wcaps() but
rather returns zero (i.e. no attribute).
The read to an non-existing widget may result in a fatal codec
communication error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 2134ea4f 10-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Add virtual master controls

Add master controls using vmaster to codecs that have no real hardware
master volume registers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 3b0a5f22 10-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Add virtual master control helpers

Added helper functions to implement virtual master volume controls.
The virtual master control is a control element that has multiple
slave controls. The value of master element is equally added to
slave elements.
The functions are written for general purpose, but it's put in the
HD-audio directory as now, since HD-audio driver is the only user.
It should be moved to the common place once after other drivers use
vmaster.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# d29240ce 25-Oct-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Disable shared stream on AD1986A

AD1986A has a hardware problem that it cannot share a stream with
multiple pins properly. The problem occurs e.g. when a volume is changed
during playback.
So far, hda-intel driver unconditionally assigns the stream to multiple
output pins in copy-front mode, and this should be avoided for AD1986A
codec.
The original fix patch was by zhejiang <zhe.jiang@intel.com>.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 41923e44 22-Oct-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix possible array overflow

dac_nids arrays in each codec support code may have up to 5 items
when assigned from the auto-configurator. Some codec codes have
less numbers than the possible max. This patch defines the constant
and fixes the array definitions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 35a1e0cc 19-Oct-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix build without CONFIG_SND_HDA_GENERIC

Fixed the build error from patch_sigmatel.c when built without
CONFIG_SND_HDA_GENERIC by defining a dummy function to return error.
Also, clean up hda_codec.c by removing unneeded ifdefs (the compiler
will optimize out).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# cb53c626 10-Aug-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-intel - Add POWER_SAVE option

Added CONFIG_SND_HDA_POWER_SAVE kconfig. It's an experimental option
to achieve an aggressive power-saving. With this option, the driver
will turn on/off the power of each codec and controller chip dynamically
on demand.
The patch introduces a new module option 'power_save'. It specifies
the second of time-out for automatic power-down. As default, it's
10 seconds. Setting 0 means to suppress the power-saving feature.
The codec may have analog-input loopbacks, which are usually represented
by mixer elements such as 'Mic Playback Switch' or 'CD Playback Switch'.
When these are on, we cannot turn off the mixer and the codec chip has
to be kept on. For bookkeeping these states, a new codec-callback is
introduced.
For the bus-controller side, a new callback pm_notify is introduced,
which can be used to turn on/off the contoller appropriately.
Note that this power-saving might cause slight click-noise at
power-on/off. Also, it might take some time to wake up the codec, and
might even drop some tones at the very beginning. This seems to be the
side-effect of turning off the controller chip.
This turn-off of the controller can be disabled by undefining
HDA_POWER_SAVE_RESET_CONTOLLER in hda_intel.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 47fd830a 10-Aug-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - add snd_hda_codec_stereo() function

Added snd_hda_codec_amp_stereo() function that changes both of stereo
channels with the same mask and value bits. It simplifies most of
amp-handling codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 82beb8fd 10-Aug-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - optimize resume using caches

So far, the driver looked the table of snd_kcontrol_new used for creating
mixer elements and forces to call each of its put callbacks in PM resume
code. This is too ugly and hackish.
Now, the resume is simplified using the codec amp and command register
caches. The driver simply restores the values that have been written
in the cache table. With this simplification, most codec support codes
don't require any special resume callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# b3ac5636 10-Aug-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - introduce command register cache

This patch adds the cache for codec command registers.
snd_hda_codec_write_cache() and snd_hda_sequence_write_cache() do
the write operations with caching, which values can be resumed via
snd_hda_codec_resume_cache().
The patch introduces only the framework, and no codec code is using
this cache yet. It'll be implemented in the following patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 532d5381 27-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Add a generic bind-control helper

Added callbacks for a generic bind-control of mixer elements.
This can be used for creating a mixer element controlling multiple
widgets at the same time. Two macros, HDA_BIND_VOL() and HDA_BIND_SW(),
are introduced for creating bind-volume and bind-switch, respectively.
It taks the mixer element name and struct hda_bind_ctls pointer, which
contains the real control callbacks in ops field and long array for
private_value of each bound widget.
All widgets have to be the same type (i.e. the same amp capability).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 2807314d 27-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-intel - Add hwdep interface

Added a hwdep interface for each codec (enabled per kconfig).
This interface can be used for reading/writing HD-audio verbs
and other purposes as future extensions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# d01ce99f 27-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-intel - Coding style fixes

Fix codes to follow more to the standard kernel coding style.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 897cc188 29-May-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix STAC922x capture boost level

STAC922x provides the capture boost level up to 4, but actually it
works only up to 2. Since the range of the mixer is automatically
defined from amp-capability bits, we need to override the value
beforehand. snd_hda_override_amp_caps() is introduced for this
purpose.
The function patch_stac922x() calls this for NID 0x12 (Mux Capture
Volume). This should fix another recording problem on Intel Macs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# d258e24a 23-Apr-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Add line_out_type to auto_pin_cfg struct

Added line_out_type field to auto_pin_cfg struct to provide the
pin type of default line_outs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 6b97eb45 05-Apr-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix SPDIF output

Fix SPDIF output (at least on Realtek codecs). The DIGI_CONVERT verbs
have to be reset before the PCM stream is set up. Otherwise the digital
setup is screwed up.
Also, check the AMP capability before setting AMP of the digital out
widget.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# e250af29 19-Dec-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Use global workqueue

Use global workqueue for simplicity.
The unsolicited event frequency isn't so high to have own queue.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# f5fcc13c 24-Nov-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Use snd_pci_quirk_lookup() for board config lookup

Use snd_pci_quirk_lookup() for looking up a board config table.
The config table is sorted in numerical order of PCI SSIDs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# c4028958 22-Nov-2006 David Howells <dhowells@redhat.com>

WorkStruct: make allyesconfig

Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>


# eb06ed8f 20-Sep-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Support multiple headphone pins

Some machines have multiple headpohne pins (usually on the lpatop
and on the docking station) while the current hda-codec driver
assumes a single headphone pin. Now it supports multiple hp pins
(at least for detection).
The sigmatel 92xx code supports this new multiple hp pins.
It detects all hp pins for auto-muting, too.
Also, the driver checks speaker pins in addition. In some cases,
all line-out, speaker and hp-pins coexist.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 7cf0a953 17-Aug-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Fix compile errors with older gcc

Fixed compile errors with older gcc for initialization of a union.
sound/pci/ca0106/ca0106_mixer.c: At top level:
sound/pci/ca0106/ca0106_mixer.c:499: unknown field 'p' specified in initializer
sound/pci/ca0106/ca0106_mixer.c:499: warning: missing braces around initializer
sound/pci/ca0106/ca0106_mixer.c:499: warning: (near initialization for 'snd_ca0106_volume_ctls[0].tlv')

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 302e9c5a 05-Jul-2006 Jaroslav Kysela <perex@suse.cz>

[ALSA] HDA codec & CA0106 - add/fix TLV support


Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 82bc955f 21-Mar-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix BIOS auto-configuration

Modules: HDA Codec driver,HDA generic driver

- Fix autoconfig speaker/hp detection
Now it allows multiple speaker pins (e.g. Dell laptops have such config)

- Use speaker or hp pins if no line-outs are available
This fixes the silence output on recent Dell laptops with STAC9200
(ALSA bug#1843)

- Fix analog/realtek/sigmatel autoconfig parser

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


# 834be88d 01-Mar-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix ALC262 for Fujitsu laptop

Modules: HDA Codec driver,HDA generic driver

Add 'fujitsu' model for ALC262 patch to support a FSC laptop.
The internal speaker is turned on/off with jack sensing.

Also fixed alc262 'basic' model.

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


# 4a471b7d 07-Dec-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Small clean up and fixes

Modules: HDA Codec driver,HDA generic driver

- Common labels for input pins
- Fix and clean up of Realtek codec parsers

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


# df694daa 05-Dec-2005 Kailang Yang <kailang@realtek.com.tw>

[ALSA] hda-codec - Add the support of ALC262,ALC883,ALC885,ALC861

Modules: HDA Codec driver,HDA generic driver

This patch adds the support of ALC262,ALC883,ALC885,ALC861 to driver
More models and improvements for ALC880, ALC260 and ALC882 codecs, too.

Signed-off-by: Kailang Yang <kailang@realtek.com.tw>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 54d17403 21-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix connection list parsing

Modules: HDA Codec driver,HDA generic driver

- Fix connection list parsing (with ranged flag).
- Increase the max number of connections
- Introduce widget capabilities cache
- Power up/down widgets at init, suspend and resume

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


# c8b6bf9b 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove xxx_t typedefs: HD-Audio codec

Modules: HDA Codec driver,HDA generic driver

Remove xxx_t typedefs from the HD-Audio codec support codes.

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


# 8d88bc3d 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Fix assignment of speaker pin

Modules: HDA Codec driver,HDA generic driver

Fix the auto-assignment of speaker pin. Handle it independently from
line-out pins.

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


# d2a6d7dc 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Add channel-mode helper

Modules: HDA Codec driver,HDA generic driver

Add common channel-mode helper functions for all codec patches.

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


# 985be54b 02-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - Minor rewrites

Modules: HDA Codec driver,HDA generic driver

- Make bound controls global to all patches
- Clean up analog patches (for the upcoming extension to AD1988)

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


# e9edcee0 13-Jun-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hda-codec - More fix of ALC880 codec support

Documentation,HDA Codec driver,HDA generic driver,HDA Intel driver
- Fix some invalid configurations, typos in the last patch
- Make init_verbs chainable, so that different configs can share the same
init_verbs
- Reorder and clean up the source codes in patch_realtek.c
- Add the pin default configuration parser, used commonly in cmedia
and realtek patch codes.
- Add 'auto' model to ALC880 for auto-configuration from BIOS
Use this model as default, and 3-stack as fallback

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


# 7291548d 12-May-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Rename pci_vendor/pci_device to pci_subvendor/pci_subdevice

HDA Codec driver,HDA generic driver
Renamed pci_vendor/pci_device fields to pci_subvendor/pci_subdevice.
They are really PCI subsystem IDs.

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


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!