There are a couple of places setting cap_sync_hook in the codec
drivers, and they just overwrite the value. Add a sanity check via
WARN_ON() in case if an old non-NULL value is overridden and
forgotten.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To simplify the code and to get the mic-mute LED behavior control, use
the new helper function for controlling the mic mute LED instead of
open-codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of refusing, allow the configuration with the multiple ADCs
(thus multiple capture switches) for enabling the mic mute LED.
This has been done for Sigmatel/IDT codecs, and we treat the OR-ed
values from all capture switches as the boolean condition.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Convert to use the common helper for controlling the mic mute LED for
HP laptops, just as we've done for Realtek codecs. This will give the
mic mute LED enum as gratis.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Similar as the previous commit, convert to use the common helper for
controlling the mic mute LED for HP and other machines in the Realtek
codec driver, too. This will give the mic mute LED enum as gratis.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the new common helper for setting up and controlling the mic mute
LED over thinkpad_acpi. This also provides a new mixer enum "Mic
Mute-LED Mode" (that was present only for Dell models), which allows
user to choose the mic mute LED behavior. For example, if you want
the mic mute LED turned on only while mic is on, choose "Follow
Capture" there.
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the code for setting up and controlling the mic mute LED hook
from dell-wmi helper to the generic parser, so that it can be referred
from the multiple driver codes.
No functional change.
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The commentary says to use various parameters, and lays out what
the mapping is... The code used a 32KHz rate when the comment
says that it needs to use a 48KHz rate. And this has been the
case since day one.
On the Alienware M17x R4, the DMic used to have exceptionally quiet
pickup and a lot of noise. Changing the data rate fixes both of
these issues.
Searching the kernel bug tracker for ca0132-related issues shows no
mention of this being an issue for other hardware, and I have no
other hardware to test with, so a quirk is used to limit the effect
to just the M17x R4.
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit 009b8f979b conditionalized
adding the "CA0132 Analog Mic-In2" PCM with a comment to the
effect that, "desktops don't use this ADC", but the test was set
up such that the ADC was only created for desktops. Invert the
test.
Fixes: 009b8f979b ("ALSA: hda/ca0132: update core functions for sbz + r3di")
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
QUIRK_NONE is, quite explicitly, the default case. The entire
point of a quirks system is to allow "programming by difference"
from a given base case, which requires that merely defining a new
quirk for some piece of hardware should not change the behavior of
the driver for that hardware. In turn, this means that testing
for QUIRK_NONE explicitly is a violation of that implicit contract.
Change a test for QUIRK_NONE and QUIRK_ALIENWARE to default, and
add a test for QUIRK_SBZ to disable the default behavior in that
instance.
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit e93ac30a32 (ALSA: HDA/ca0132:
add extra init functions for r3di + sbz) introduced an extra
initialization function that was improperly guarded, taking effect
on systems with QUIRK_ALIENWARE, even though such systems were
supposedly not affected.
It may be that this piece of initialization should be done for all
systems, but that's not a call that I can make.
Fixes: e93ac30a32 ("ALSA: HDA/ca0132: add extra init functions for r3di + sbz")
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
During ca0132_init(), ca0132_init_unsol() is run before the
spec->spec_init_verbs are written. ca0132_init_unsol() calls
snd_hda_jack_detect_enable_callback(), which requests UNSOL events
for three or four nodes, two of which were also (redundantly)
requested by spec_init_verbs.
Kill the redundant AC_VERB_SET_UNSOLICITED_ENABLE verbs.
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ca0132_config() was setting some values in the auto_pin_cfg for
the codec... but it is called prior to snd_hda_parse_pin_defcfg(),
which does a memset() to clear the entire structure as one of its
first actions, making the entire exercise pointless.
Kill all use of struct auto_pin_cfg from ca0132_config().
Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some Lenovo laptops, e.g. Lenovo P50, showed the pop noise at resume
or runtime resume. It turned out to be reduced by applying
alc_no_shutup() just like TPT440 quirk does.
Since there are many Lenovo models showing the same behavior, put this
workaround in ALC269_FIXUP_THINKPAD_ACPI entry so that it's applied
commonly to all such Lenovo machines.
Reported-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Berg <bberg@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Here is a collection of small fixes on top of the previous update.
All small and obvious fixes. Mostly for usual suspects, USB-audio and
HD-audio, but a few trivial error handling fixes for misc drivers as
well.
-----BEGIN PGP SIGNATURE-----
iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlsizZwOHHRpd2FpQHN1
c2UuZGUACgkQLtJE4w1nLE/eOQ/9Gmpmt5HtrfesubzjUgkNxAJ9rEIVI8YaNnzv
okk8X9q3BWfW6s/QThMQoTglB+wdvxl96SvhAqsyZcfcdE9rdMm5A0N5P+uz+EWV
VmJf1bslKGn/EcPPIt4rSAF/YtR7UXHOQ59ZngYVtUDQWXcE48sTPOn84OR0acSI
z/tx5RXUCDmsC+uFn4okUNpnDBttK+G4+2beLb3NJtAqVsT/x0pJOcWzmFmh3UZW
7pzCQ6rvJpN8oK8Q5rI8282OG3MU0qTFP7o25ncimQr2kSSnUmdxUwIfXLUa4UCv
y+ZSYpBhGBhm8JV154OiXpdbolUDFEGBlUjHgFKB9qdiBGVy8bndAIrEHVv4Hql+
cTC5xR3GQ2clJYUSPDAORgXG3f/lnD9i4rQ8eRXqyz+8XkiTGfQ27u6eis2nccy3
Wf3Pa7j7knnlfBIw4Fnw7OpcyXUyC+KZ+IQFEmERAIfmLrmQh10oO8o91+hivMFB
e/1MCg+pvk1QGR/iT/WbUeOp0ifg3pv2W16vPv/KlrOlimxEbsYbegCzt19OZ4D8
XY+d8Wwf64awwpynoYXkPUMt6T1hFvJpucdlKOkj52DtnDenio4TNf0AyKDAZSHm
9B7NSikEgsxLO8NtPjSVKR4LB3NOhxJVP1OEAjOHTK02jy4pq+HjapYfVy8x9NZn
9mslHp0=
=XDCD
-----END PGP SIGNATURE-----
Merge tag 'sound-fix-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Here is a collection of small fixes on top of the previous update.
All small and obvious fixes. Mostly for usual suspects, USB-audio and
HD-audio, but a few trivial error handling fixes for misc drivers as
well"
* tag 'sound-fix-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: usb-audio: Always create the interrupt pipe for the mixer
ALSA: usb-audio: Add insertion control for UAC3 BADD
ALSA: usb-audio: Change in connectors control creation interface
ALSA: usb-audio: Add bi-directional terminal types
ALSA: lx6464es: add error handling for pci_ioremap_bar
ALSA: sonicvibes: add error handling for snd_ctl_add
ALSA: usb-audio: Remove explicitly listed Mytek devices
ALSA: usb-audio: Generic DSD detection for XMOS-based implementations
ALSA: usb-audio: Add native DSD support for Mytek DACs
ALSA: hda/realtek - Add shutup hint
ALSA: usb-audio: Disable the quirk for Nura headset
ALSA: hda: add dock and led support for HP ProBook 640 G4
ALSA: hda: add dock and led support for HP EliteBook 830 G5
ALSA: emu10k1: add error handling for snd_ctl_add
ALSA: fm801: add error handling for snd_ctl_add
The pin shutup callback seems working well on some devices while it
does harm on some other devices; e.g. Lenovo laptops show often the
noises at (runtime) PM with the pin shutup enabled.
Currently, the only way to disable the pin shutup is to hard-code
spec->shutup = alc_no_shutup;
in the fixup, and this makes the debugging harder for normal users.
For allowing users to test the similar effect without recompiling the
kernel, this patch adds a new hint string "shutup". It's a boolean
value, and by passing false to this, user can turn off the pin shutup
call.
For example, to turn off the shutup on Lenovo P50, create a "firmware
patch" file (e.g. /lib/firmware/alsa/lenovo-p50) containing the
following lines:
[codec]
0x10ec0298 0x17aa222e 0
[hint]
shutup = no
and pass the file via patch option of snd-hda-intel module
(e.g. patch=alsa/lenovo-p50).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds missing initialisation for HP 2013 UltraSlim Dock
Line-In/Out PINs and activates keyboard mute/micmute leds
for HP ProBook 640 G4
Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds missing initialisation for HP 2013 UltraSlim Dock
Line-In/Out PINs and activates keyboard mute/micmute leds
for HP EliteBook 830 G5
Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/local.h seems to be an earlier version of
sound/hda/local.h; it was added at the same time but doesn't seem to
have ever been used (within the git history). Most of its macros
depend on a hdac_read_parm() function which is not defined anywhere.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When 'kzalloc()' fails in 'snd_hda_attach_pcm_stream()', a new pcm instance is
created without setting its operators via 'snd_pcm_set_ops()'. Following
operations on the new pcm instance can trigger kernel null pointer dereferences
and cause kernel oops.
This bug was found with my work on building a gray-box fault-injection tool for
linux-kernel-module binaries. A kernel null pointer dereference was confirmed
from line 'substream->ops->open()' in function 'snd_pcm_open_substream()' in
file 'sound/core/pcm_native.c'.
This patch fixes the bug by calling 'snd_device_free()' in the error handling
path of 'kzalloc()', which removes the new pcm instance from the snd card before
returns with an error code.
Signed-off-by: Bo Chen <chenbo@pdx.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We have several Lenovo AIOs like M810z, M820z and M920z, they have
the same design for mic-mute hotkey and led and they use the same
codec with the same pin configuration, so use the pin conf table to
apply fix to all of them.
Fixes: 29693efcea ("ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added a new helper file for these fixups due to requiring a huge number
of coefs being set to get the top speakers to work, as well as
setting pin 0x17 for the top speakers and the correct input source
of 0x17 for volume control
[ Note: this is a revised work based on Tom's fixup patch with the
replacement of the full COEF tables provided by Realtek.
Also, the fixup function has a proper HDA_FIXUP_ACT_* handling now.
The credit for the new COEF table goes to Kailang -- tiwai ]
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
Cc: Kailang Yang <kailang@realtek.com>
Signed-off-by: Tom Briden <tom@decompile.me.uk>
Tested-by: Tom Briden <tom@decompile.me.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds the mute LED control for HP Spectre x360 Kabylake
model. The mute LED is controlled via VREF bits on NID 0x1b, so we
need a new fixup function.
Note that this doesn't fix the other issues like the missing speaker
output on the machine. They will be addressed by later patches.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
Signed-off-by: Tom Briden <tom@decompile.me.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Power-saving is causing a humming sound when active on the Intel
NUC5i7RY, add it to the blacklist.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199607
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Convert the S_<FOO> symbolic permissions to their octal equivalents as
using octal and not symbolic permissions is preferred by many as more
readable.
see: https://lkml.org/lkml/2016/8/2/1945
Done with automated conversion via:
$ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...>
Miscellanea:
o Wrapped one multi-line call to a single line
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Before commit 3b5b899ca6 ("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 3b5b899ca6, 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: 3b5b899ca6 ("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>
Power-saving is causing plops on audio start/stop on ASRock H81M-HDS
machines, add these to the power_save blacklist.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Power-saving is causing plops on audio start/stop on Gigabyte
P55A-UD3 and Gigabyte Z87-D3HP machines, add these to the power_save
blacklist.
Note these 2 boards both use 1458:a002 as subsystem ids, so they share
a single entry.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Power-saving is causing a plop and silences the first 2 seconds
(give or take) of audio, silencing notifications sounds on Medion /
Clevo W35xSS_370SS laptops.
Add the Clevo W35xSS_370SS to the power_save blacklist.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1581607
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Power-saving is causing a humming sound when active on the Intel
NUC7i3BNB, add it to the blacklist.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520902
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
HP Z2 G4 requires the same workaround as other HP machines that have
no mic-pin detection.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This module has a table for parameters of each effects. This table is
read-only and can have 'const' qualifier.
This commit adds this optimization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This module has some function-local strings just for printk therefore
it can be merged into format string.
This commit applies this optimization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This module has some strings just for printk therefore they can be
read-only.
This commit applies this optimization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
An array of templates for control element set is passed as an
argument for snd_hda_add_new_ctls(). This argument has 'const'
qualifier therefore the passed array can have the qualifier.
This commit adds this optimization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE
sound/pci/hda/patch_ca0132.c:5092:50-51: WARNING: Use ARRAY_SIZE
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
Semantic patch information:
This makes an effort to find cases where ARRAY_SIZE can be used such as
where there is a division of sizeof the array by the sizeof its first
element or by any indexed element or the element type. It replaces the
division of the two sizeofs by ARRAY_SIZE.
Generated by: scripts/coccinelle/misc/array_size.cocci
Fixes: 47cdf76e44 ("ALSA: hda/ca0132: Add new control changes for SBZ + R3Di")
CC: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This adds support for the P950ER, which has the same required fixup as
the P950HR, but has a different PCI ID.
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Power-saving is causing loud plops on the Lenovo C50 All in one, add it
to the blacklist.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1572975
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds new controls to set the effect levels on the R3Di and
SBZ. It also adds vmaster controls to control all surround sound
channels. So that Surround effect switch doesn't conflict with Surround
volume, FX: prefix added to all effect related switches.
Tested-by: Mariusz Ceier <mceier+kernel@gmail.com>
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add function to set vipsource on cards that use_alt_controls. Different
sequence. Also, add cvoice_switch_set at end of ca0132_select_in so that
when switching between inputs cvoice state is maintained.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adds lookup table for floating point decibel volume, and new functions
to allow for setting the decibel level on the DSP.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>