History log of /linux-master/sound/pci/hda/hda_auto_parser.c
Revision Date Author Comments
# 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>


# 0444f827 27-Jan-2022 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Fix signedness of sscanf() arguments

The %x format of sscanf() takes an unsigned int pointer, while we pass
a signed int pointer. Practically it's OK, but this may result in a
compile warning. Let's fix it.

Fixes: a235d5b8e550 ("ALSA: hda: Allow model option to specify PCI SSID alias")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20220127135717.31751-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5dcdc460 17-Dec-2021 Yang Guang <yang.guang5@zte.com.cn>

ALSA: hda: use swap() to make code cleaner

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Link: https://lore.kernel.org/r/ebc9db44b802dfc88e1538629b517e000acb27b3.1639790796.git.yang.guang5@zte.com.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a235d5b8 23-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Allow model option to specify PCI SSID alias

There are tons of quirks for HD-audio and many of them are without
model string, hence it's not trivial to apply the same quirk for a new
device. This patch makes it easier: namely, the model string accepts
a form as "XXXX:YYYY" (a pair of hex numbers of the subsystem-vendor
and subsystem-device IDs), to specify the alias of PCI (or codec)
SSID. e.g. passing model=1234:abcd would apply the quirk that matches
with the given SSID 1234:abcd instead of the actual SSID.

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


# 73355ddd 23-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Code refactoring snd_hda_pick_fixup()

This contains a slight code refactoring of snd_hda_pick_fixup():
- Unify the ID setup
- Unify the debug print message
- Use snd_pci_quirk_lookup_id() for the codec SSID matching

Mostly for simplifying the code flow but also it makes easier to add
the codec alias handling in the upcoming patch.

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


# 75b1a8f9 04-Jan-2021 Joe Perches <joe@perches.com>

ALSA: Convert strlcpy to strscpy when return value is unused

strlcpy is deprecated. see: Documentation/process/deprecated.rst

Change the calls that do not use the strlcpy return value to the
preferred strscpy.

Done with cocci script:

@@
expression e1, e2, e3;
@@

- strlcpy(
+ strscpy(
e1, e2, e3);

This cocci script leaves the instances where the return value is
used unchanged.

After this patch, sound/ has 3 uses of strlcpy() that need to be
manually inspected for conversion and changed one day.

$ git grep -w strlcpy sound/
sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname));
sound/usb/mixer.c: return strlcpy(buf, p->name, buflen);
sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen);

Miscellenea:

o Remove trailing whitespace in conversion of sound/core/hwdep.c

Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: hda: auto_parser: remove shadowed variable declaration

Fix cppcheck warning:

sound/pci/hda/hda_auto_parser.c:353:7: style: Local variable 'i'
shadows outer variable [shadowVariable]
int i = 0;
^
sound/pci/hda/hda_auto_parser.c:182:6: note: Shadowed declaration
int i;
^
sound/pci/hda/hda_auto_parser.c:353:7: note: Shadow variable
int i = 0;
^

It's not clear why a new declaration was added, remove and reuse
variable declared with larger scope.

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


# 6a6ca788 25-Jun-2020 Hui Wang <hui.wang@canonical.com>

ALSA: hda - let hs_mic be picked ahead of hp_mic

We have a Dell AIO, there is neither internal speaker nor internal
mic, only a multi-function audio jack on it.

Users reported that after freshly installing the OS and plug
a headset to the audio jack, the headset can't output sound. I
reproduced this bug, at that moment, the Input Source is as below:
Simple mixer control 'Input Source',0
Capabilities: cenum
Items: 'Headphone Mic' 'Headset Mic'
Item0: 'Headphone Mic'

That is because the patch_realtek will set this audio jack as mic_in
mode if Input Source's value is hp_mic.

If it is not fresh installing, this issue will not happen since the
systemd will run alsactl restore -f /var/lib/alsa/asound.state, this
will set the 'Input Source' according to history value.

If there is internal speaker or internal mic, this issue will not
happen since there is valid sink/source in the pulseaudio, the PA will
set the 'Input Source' according to active_port.

To fix this issue, change the parser function to let the hs_mic be
stored ahead of hp_mic.

Cc: stable@vger.kernel.org
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20200625083833.11264-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 333f3143 29-Aug-2019 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix potential endless loop at applying quirks

Since the chained quirks via chained_before flag is applied before the
depth check, it may lead to the endless recursive calls, when the
chain were set up incorrectly. Fix it by moving the depth check at
the beginning of the loop.

Fixes: 1f57825077dc ("ALSA: hda - Add chained_before flag to the fixup entry")
Cc: <stable@vger.kernel.org>
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>


# 62810dbd 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 1 normalized pattern(s):

this driver 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

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

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

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


# 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>


# 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>


# a9c2dfc8 23-Apr-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use a macro for snd_array iteration loops

Introduce a new helper macro, snd_array_for_each(), to iterate for
each snd_array element. It slightly improves the readability than
lengthy open codes at each place.

Along with it, add const prefix to some obvious places.

There should be no functional changes by this.

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


# 9f3dadb1 10-Apr-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hda - A new flag to enforce prefix to each pin

This is a preliminary patch for a smooth multi-codec support, and it
introduces a new flag, force_pin_prefix, to struct hda_codec.
This flag is used to force to add the pin location prefix to each
input pin. For example, when there is only one microphone pin,
usually the auto-parser assigns the string "Mic". With this flag on,
it'll be like "Front Mic". Also, the creation of "Master" or "PCM"
playback volume for a single pin is suppressed, too.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195305
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5e0ad0d8 06-Dec-2016 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: hda: when comparing pin configurations, ignore assoc in addition to seq

Commit [64047d7f4912 ALSA: hda - ignore the assoc and seq when comparing
pin configurations] intented to ignore both seq and assoc at pin
comparing, but it only ignored seq. So that commit may still fail to
match pins on some machines.
Change the bitmask to also ignore assoc.

v2: Use macro to do bit masking.

Thanks to Hui Wang for the analysis.

Fixes: 64047d7f4912 ("ALSA: hda - ignore the assoc and seq when comparing...")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 64047d7f 23-Nov-2016 Hui Wang <hui.wang@canonical.com>

ALSA: hda - ignore the assoc and seq when comparing pin configurations

More and more pin configurations have been adding to the pin quirk
table, lots of them are only different from assoc and seq, but they
all apply to the same QUIRK_FIXUP, if we don't compare assoc and seq
when matching pin configurations, it will greatly reduce the pin
quirk table size.

We have tested this change on a couple of Dell laptops, it worked
well.

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


# 11580297 02-Aug-2015 Hui Wang <hui.wang@canonical.com>

ALSA: hda - remove no physical connection pins from pin_quirk table

To cleanup the pin_quirk table:
- rewrite the pin_config_match(), comparing all pins on the machine
with the corresponding pins in the quirk table.
- remove all 0x4xxxxxxx pin configurations from pin_quirk table
- after removing the 0x4xxxxxxx pin configurations, some pin tables
are exactly same, so removing the redudant pin tables.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
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>


# 4f7946ec 07-Jan-2015 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Debug output which type of fixup was selected

Our fixup system is becoming increasingly complex, so it's becoming
time consuming to figure out which way the fix was applied.
This patch adds a few debug prints to aid when debugging why a specific
fixup was selected.

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


# 322b8af1 07-Jan-2015 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Print codec->chip_name in autoconfig

This will help end users figure out what HDA codec they have.

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


# 95a962c3 29-Oct-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - More kerneldoc comments

Put more kerneldoc comments to the exported functions.
Still the generic parser code and the HD-audio controller code aren't
covered yet, though.

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


# a11e9b16 29-Oct-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Correct kerneldoc comments

Complete the missing parameters and fix anything wrong there.
Just comment changes.

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


# 95f72cf2 23-Sep-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Sort input pins depending on amp caps

If one input has a boost and another one has not, and they're equal
otherwise, it's more likely you want to use the input with the boost
as your primary input.

See hda-emu.git/codecs/canonical/cx20590-lenovo-20b2z00bus-ccert-201305-13496
for an example.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
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>


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

ALSA: hda - Remove obsoleted SFX definitions

It's no longer referred by anyone after standardizing with dev_*()
macros.

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


# 8fffe7d1 19-Jun-2014 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Fix usage of "model" module parameter

A recent refactoring broke the possibility to manually specify
model name as a module parameter. This patch restores the desired
functionality.

Fixes: c21c8cf77f47 ('ALSA: hda - Add fixup_forced flag')
Reported-by: Kent Baxley <kent.baxley@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 37df0949 29-May-2014 Hui Wang <hui.wang@canonical.com>

Revert "ALSA: hda - drop def association and sequence from pinconf comparing"

This reverts commit c687200b9d4ef60042a50f7d942cfef120cc7bf1.

Dropping the def association and sequence from pinconf comparing is a
bit risky, It will introduce a greater risk of catching unwanted
machines.

And in addition, so far no BIOS experts give us an explicit answer
whether it makes senses to compare these two fields or not.

For safety reason, we revert this commit.

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


# c687200b 26-May-2014 Hui Wang <hui.wang@canonical.com>

ALSA: hda - drop def association and sequence from pinconf comparing

A lot a machine have the same codec, but they have different default
pinconf setting just because the def association and sequence is
different, as a result they can't share a hda_pintbl[], to overcome
it, we don't compare def association and sequence in the pinconf
matching.

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


# 621b5a04 26-May-2014 Hui Wang <hui.wang@canonical.com>

ALSA: hda - get subvendor from codec rather than pci_dev

It is safer for non-pci situation.

Signed-off-by: Hui Wang <hui.wang@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>


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

ALSA: hda - Add fixup_forced flag

The "fixup_forced" flag will indicate whether a specific fixup
(or nofixup) has been set by the user, to override the driver's
default.
This flag will help future patches.

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


# 9b7564a6 25-Mar-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Inform the unexpectedly ignored pins by auto-parser

The auto-parser may ignore some pins that could be valid when they
don't match with the assumption or if there are way too many pins
assigned to the same output type. So far, such a pin has been
silently ignored, but it's better to leave a message, which would help
for debugging and understanding the problem.

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>


# 2698ea98 17-Dec-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Kill EXPORT_SYMBOL_HDA()

Replace all with the standard EXPORT_SYMBOL_GPL().

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


# 728deecd 28-Oct-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix possible NULL dereference in snd_hda_get_pin_label()

Fix a possible NULL access of indexp in fill_audio_out_name() called
from snd_hda_get_pin_label().

Spotted by coverity CID 402035.

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


# 697aebab 01-Aug-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix missing fixup for Mac Mini with STAC9221

A fixup for Apple Mac Mini was lost during the adaption to the generic
parser because the fallback for the generic ID 8384:7680 was dropped,
and it resulted in the silence output (and maybe other problems).

Unfortunately, just adding the missing subsystem ID wasn't enough, in
this case. The subsystem ID of this machine is 0000:0100 (what Apple
thought...?), and since snd_hda_pick_fixup() doesn't take the vendor
id zero into account, the driver ignored this entry. Now it's fixed
to regard the vendor id zero as a valid value.

Reported-and-tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org> [v3.9+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cb420b11 11-Apr-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - allow "Headphone Mic" parser flag

This allows a specific mic to get the "Headphone Mic" name, in addition
to the existing "Headset Mic" name.

Also, it allows for a special mark: if the sequence number is set
to 0xc, that's an indication to prefer it for headset mic, and if it's
set to 0xd, that's an indication to prefer it for headphone mic.

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


# a385d97b 20-Mar-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Introduce "Headset Mic" name

Headset mic jacks, i e TRRS style jacks with Headphone Left,
Headphone Right, Mic and GND signals, are becoming increasingly
common and are now being shipped by several manufacturers.

Unfortunately, the HDA specification does not give us any hint
of whether a Mic pin belongs to such a jack or not, but it would
still be helpful for the user to know (especially if there is one
TRS Mic jack and one TRRS headset jack).

This new fixup causes the first (non-dock, non-internal) mic to
be a headset mic jack. The algorithm can be later refined if needed.

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


# 86b27237 25-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: Make snd_printd() and snd_printdd() inline

Because currently snd_printd() and snd_printdd() macros are expanded
to empty when CONFIG_SND_DEBUG=n, a compile warning like below
appears sometimes, and we had to covert it by ugly ifdefs:
sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]

For "fixing" these issues better, this patch replaces snd_printd() and
snd_printdd() definitions with empty inline functions instead of
macros. This should have the same effect but shut up warnings like
above.

But since we had already put ifdefs, changing to inline functions
would trigger compile errors. So, such ifdefs is removed in this
patch.

In addition, snd_pci_quirk name field is defined only when
CONFIG_SND_DEBUG_VERBOSE is set, and the reference to it in
snd_printdd() argument triggers the build errors, too. For avoiding
these errors, introduce a new macro snd_pci_quirk_name() that is
defined no matter how the debug option is set.

Reported-by: Stratos Karafotis <stratosk@semaphore.gr>
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>


# 3f25dcf6 18-Jan-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

If there's one each of HDMI and SPDIF, we should not add an index
on the one that comes second.

[slight code refactoring by tiwai]

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


# 52fd5cbc 15-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Check pincap while parsing the configuration

Sometimes (or rather often) BIOS sets the pin default configurations
obviously wrongly. Looking through these failures, one common pattern
is to enable some dead pins that are usually marked as speaker pins.
In such a case, we can skip them if the pins don't have the output
capability.

In this patch, add a check for the valid pin cap bit for each parsed
pin, and filter out when it's invalid.

The fix was originally suggested by Raymond Yau.

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


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

ALSA: hda - Allow user to give hints for codec parser behavior

Through the hints via sysfs or patch, user can set specific behavior
flags for the generic parser now.

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>


# 54d778b3 09-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Return "Headphone Mic" from hda_get_autocfg_input_label()

Instead of handling special cases in the caller side, give a proper
name string "Headphone Mic" from hda_get_autocfg_input_label() when
the headhpone jack pin is specified as an input.

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


# fb690cf5 07-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Handle BOTH jack port as a fixed output

When the default config value shows the connection AC_JACK_PORT_BOTH,
it's better to handle it as a speaker pin. This makes the behavior
consistent in snd_hda_get_pin_label() and snd_hda_parse_pin_defcfg().

There are only few old machines showing this attribute, and all of
them are actually fixed speaker pins, as far as I know.

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


# 5ec16d12 28-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Rearrange INPUT_PIN_ATTR_*

Put INPUT_PIN_ATTR_FRONT after INPUT_PIN_ATTR_REAR, and define
INPUT_PIN_ATTR_LAST to point to the last element.

This is a preliminary work for cleaning up Realtek auto-mic parser.
In the auto-mic implementation, the front panel is preferred over the
rear panel. By arranging the attr definitions like in this commit, we
can simply use sort() for figuring out the priority order.

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>


# b9030a00 29-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Use standard sort function in hda_auto_parser.c

Just refactoring, no functional changes.

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


# eee3ed43 03-Oct-2012 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - avoid unneccesary indices on "Headphone Jack" controls

In case there is one "Headphone Jack" and one "Dock Headphone Jack",
one of them will get an index, even though that is not needed.
This patch fixes that issue.

BugLink: https://bugs.launchpad.net/bugs/1060729
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a33b7b0a 11-Sep-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Check bit mask for codec SSID in snd_hda_pick_fixup()

snd_hda_pick_fixup() didn't check the case where the device mask bits
are set, typically used for SND_PCI_QUIRK_VENDOR() entries. Fix this.

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


# 5fe8e1e6 06-Sep-2012 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - Remove ignore_misc_bit

The purpose of this flag is unclear. If the problem is that some machines
have broken misc/NO_PRESENCE bits, they should be fixed by pin fixups.

In addition, this causes jack detection functionality to be flawed on
the M31EI, where there are two jacks without jack detection (which is
properly marked as NO_PRESENCE), but due to ignore_misc_bit, these
jacks are instead being reported as being present but always unplugged.

BugLink: https://bugs.launchpad.net/bugs/939161
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 709aea6b 07-Aug-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix ugly debug prints with CONFIG_SND_VERBOSE_PRINTK=y

When CONFIG_SND_VERBOSE_PRINTK=y is set, the debug print in
hda_auto_parser.c looks really ugly like:

ALSA sound/pci/hda/hda_auto_parser.c:331 mono: mono_out=0x0
ALSA sound/pci/hda/hda_auto_parser.c:334 dig-out=0x12/0x0
ALSA sound/pci/hda/hda_auto_parser.c:335 inputs:
ALSA sound/pci/hda/hda_auto_parser.c:339 Mic=0x11ALSA sound/pci/hda/hda_auto_parser.c:339 Line=0x10
ALSA sound/pci/hda/hda_auto_parser.c:341
ALSA sound/pci/hda/hda_auto_parser.c:343 dig-in=0x13

Better to put one item at each line.

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


# 639aa4bd 18-Jul-2012 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - make sure alc268 does not OOPS on codec parse

A recent commit made patch_alc268 call snd_hda_pick_fixup with
NULL quirk pointer. Make sure we do not reference that NULL pointer.

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


# ee48df57 26-Jun-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix memory leaks in Realtek & Conexant codec parsers

When moved to the helper code, forgot to release the verb arrays.

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>


# 23d30f28 07-May-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move up the fixup helper functions to the library module

Move the fixup helper functions in patch_realtek.c to hda_auto_parser.c
so that they can be used in other codec drivers like patch_conexant.c.

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