aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_codec.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-10-21ALSA: ac97: Use snd_ctl_rename() to rename a controlMaciej S. Szmigiero1-8/+24
With the recent addition of hashed controls lookup it's not enough to just update the control name field, the hash entries for the modified control have to be updated too. snd_ctl_rename() takes care of that, so use it instead of directly modifying the control name. While we are at it, check also that the new control name doesn't accidentally overwrite the available buffer space. Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups") Cc: stable@vger.kernel.org Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Link: https://lore.kernel.org/r/adb68bfa0885ba4a2583794b828f8e20d23f67c7.1666296963.git.maciej.szmigiero@oracle.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-10-20ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()Yang Yingliang1-0/+1
If device_register() fails in snd_ac97_dev_register(), it should call put_device() to give up reference, or the name allocated in dev_set_name() is leaked. Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-22ALSA: pci: fix reading of swapped values from pcmreg in AC97 codecGiacomo Guiduzzi1-2/+2
Tests 72 and 78 for ALSA in kselftest fail due to reading inconsistent values from some devices on a VirtualBox Virtual Machine using the snd_intel8x0 driver for the AC'97 Audio Controller device. Taking for example test number 72, this is what the test reports: "Surround Playback Volume.0 expected 1 but read 0, is_volatile 0" "Surround Playback Volume.1 expected 0 but read 1, is_volatile 0" These errors repeat for each value from 0 to 31. Taking a look at these error messages it is possible to notice that the written values are read back swapped. When the write is performed, these values are initially stored in an array used to sanity-check them and write them in the pcmreg array. To write them, the two one-byte values are packed together in a two-byte variable through bitwise operations: the first value is shifted left by one byte and the second value is stored in the right byte through a bitwise OR. When reading the values back, right shifts are performed to retrieve the previously stored bytes. These shifts are executed in the wrong order, thus reporting the values swapped as shown above. This patch fixes this mistake by reversing the read operations' order. Signed-off-by: Giacomo Guiduzzi <guiduzzi.giacomo@gmail.com> Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220322200653.15862-1-guiduzzi.giacomo@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-09ALSA: ac97: Fix assignment in if conditionTakashi Iwai1-69/+136
AC97 codec driver code contains a lot of assignments in if condition, which is a bad coding style that may confuse readers and occasionally lead to bugs. This patch is merely for coding-style fixes, no functional changes. Link: https://lore.kernel.org/r/20210608140540.17885-35-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-07-09ALSA: Use fallthrough pseudo-keywordGustavo A. R. Silva1-2/+2
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200708203236.GA5112@embeddedor Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05ALSA: ac97: More constificationsTakashi Iwai1-5/+5
Apply const prefix to each possible place: the static tables for registers and bits, the quirk tables, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03ALSA: ac97: Treat snd_ac97_bus_ops as constTakashi Iwai1-1/+2
This is a preliminary patch to allow const for snd_ac97_bus_ops definitions in each driver's code. The ops reference is read-only, hence it can be declared as const for further optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-23-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03ALSA: pci: Constify snd_device_ops definitionsTakashi Iwai1-2/+2
Now we may declare const for snd_device_ops definitions, so let's do it for optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-09ALSA: ac97: remove unused variable 'snd_ac97_controls_master_mono'YueHaibing1-5/+0
sound/pci/ac97/ac97_codec.c:599:38: warning: snd_ac97_controls_master_mono defined but not used [-Wunused-const-variable=] It is never used, so can be removed. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner1-16/+1
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>
2018-11-23ALSA: ac97: Fix incorrect bit shift at AC97-SPSA control writeTakashi Iwai1-1/+1
The function snd_ac97_put_spsa() gets the bit shift value from the associated private_value, but it extracts too much; the current code extracts 8 bit values in bits 8-15, but this is a combination of two nibbles (bits 8-11 and bits 12-15) for left and right shifts. Due to the incorrect bits extraction, the actual shift may go beyond the 32bit value, as spotted recently by UBSAN check: UBSAN: Undefined behaviour in sound/pci/ac97/ac97_codec.c:836:7 shift exponent 68 is too large for 32-bit type 'int' This patch fixes the shift value extraction by masking the properly with 0x0f instead of 0xff. Reported-and-tested-by: Meelis Roos <mroos@linux.ee> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-03ALSA: pci: Remove empty init and exitTakashi Iwai1-16/+0
For a sake of code simplification, remove the init and the exit entries that do nothing. Notes for readers: actually it's OK to remove *both* init and exit, but not OK to remove the exit entry. By removing only the exit while keeping init, the module becomes permanently loaded; i.e. you cannot unload it any longer! Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-15ALSA: ac97: Fix kernel-doc error with sphinx formatterTakashi Iwai1-1/+1
Sphinx takes a word like (*foo)->bar in the kernel-doc comments as a part of the emphasized marker, and complains like ./sound/pci/ac97/ac97_codec.c:1908: WARNING: Inline emphasis start-string without end-string. For avoiding this, wrap it with the quotes (``) in the comment. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-05ALSA: Use const struct ac97_quirkJoe Perches1-1/+2
Use const to reduce data by ~3Kb. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-06ALSA: ac97: Add VT1613 AC97 codec supportMaciej S. Szmigiero1-0/+1
Patch to add an VT1613 AC97 codec support. This codec has additional DC offset removal control, headphone output and no video input. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-10-21ALSA: ac97: Use snd_ctl_enum_info()Takashi Iwai1-8/+2
... and reduce the open codes. Also add missing const to text arrays. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26ALSA: ac97: Use standard printk helpersTakashi Iwai1-12/+33
Convert with dev_err() and co from snd_printk(), etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-30ALSA: ac97: Add ID for TI TLV320AIC27 codecOndrej Zary1-0/+1
Add 0x54584e03 ID for TI TLV320AIC27 AC'97 codec according to datasheet: http://www.ti.com/lit/ds/slas253a/slas253a.pdf The weird thing is that the chip is physically marked 320AD91. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-28ALSA: Replace the magic number 44 with constTakashi Iwai1-1/+1
The char arrays with size 44 are for the name string of snd_ctl_elem_id. Define the constant and replace the raw numbers with it for clarifying better. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-12ALSA: add/change some comments describing function return valuesYacine Belkadi1-7/+9
script/kernel-doc reports the following type of warnings (when run in verbose mode): Warning(sound/core/init.c:152): No description found for return value of 'snd_card_create' To fix that: - add missing descriptions of function return values - use "Return:" sections to describe those return values Along the way: - complete some descriptions - fix some typos Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-15ALSA: ac97 - Fix missing NULL check in snd_ac97_cvol_new()Takashi Iwai1-0/+2
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44721 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-19ALSA: module_param: make bool parameters really boolRusty Russell1-1/+1
module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-10-31sound: fix drivers needing module.h not moduleparam.hPaul Gortmaker1-1/+1
The implicit presence of module.h lured several users into incorrectly thinking that they only needed/used modparam.h but once we clean up the module.h presence, these will show up as build failures, so fix 'em now. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-02-19ALSA: azt3328: hook up new emulated AC97 on AC97 patch sideAndreas Mohr1-0/+7
Make newly created AC97 emulation of azt3328 known to the AC97 layer side. - relocate common functions to the top (due to definition after use) - rename control names - adjust 3D settings to the card's custom layout of this register Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-17ALSA: ac97: replace open-coded, error-prone stuff with AC97 bit definesAndreas Mohr1-34/+49
Use AC97 macros (sometimes already existing, or newly added) instead of error-prone repetition of open-coded values. Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-14ALSA: constify functions in ac97Hanno Boeck1-1/+1
Signed-off-by: Hanno Boeck <hanno@hboeck.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-12-13sound: don't use flush_scheduled_work()Tejun Heo1-4/+2
flush_scheduled_work() is deprecated and scheduled to be removed. * cancel[_delayed]_work() + flush_scheduled_work() -> cancel[_delayed]_work_sync(). * wm8350, wm8753 and soc-core use custom code to cancel a delayed work, execute it immediately if it was pending and wait for its completion. This is equivalent to flush_delayed_work_sync(). Use it instead. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-01-10ALSA: ac97: add AC97 STMicroelectronics' codecsKrzysztof Helt1-0/+10
Add the STMicroelectronics ST7597 codec and an unknown codec from the same manufacturer found on the Creative SB 128 card (CT4810). Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-12-15ALSA: ac97_codec - increase timeout for analog sections to 5 secondSteve Soule1-1/+1
I have a Soundblaster 16PCI. For many years, alsa has had a bug where not all of the card's controls are detected (many alsa versions, many kernel versions). In particular, Master Playback Volume is usually not detected, and so I get no sound or extremely faint sound. The problem has always been inconsistent: sometimes all of the controls are detected correctly, and sometimes a partial set is detected. It works correctly about 10% of the time. Finally, I got around to tracking down the problem. When the driver fails, it prints the kernel message "AC'97 0 analog subsections not ready". This message is generated from the function snd_ac97_mixer() in ac97_codec.c. The message indicates that the card failed to come back after reset within the time limit. The time limit is 120 milliseconds. I tried increasing the time limit to 1 second, and found that this made the driver work about 70% of the time. I tried increasing it to 5 seconds, and it now seems to work 100% of the time. I expect that this change would be completely harmless for existing cards that work, and would only introduce additional delay for cards that do not work. ALSA bug#4032. Signed-off-by: Steve Soule <sts11dbxr@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-11-05ALSA: rename "PC Speaker" and "PC Beep" controls to "Beep"Jaroslav Kysela1-3/+3
To avoid confusion in control names for the standard analog PC Beep generator using a small Internal PC Speaker, rename all related "PC Speaker" and "PC Beep" controls to "Beep" only. This name is more universal and can be also used on more platforms without confusion. Introduce also "Internal Speaker" in ControlNames.txt for systems with full-featured build-in internal speaker. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-21[ALSA] ac97_codec: increase timeout for analog subsectionsJaroslav Kysela1-1/+1
On some hardware platforms, the AC97 codec requires more time to wake up. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-03-24Merge branch 'topic/intel8x0' into for-linusTakashi Iwai1-1/+1
2009-03-06ALSA: ac97 - Add patch entry for Conexant CX20468-31 chipTakashi Iwai1-0/+1
Added the patch entry for Conexant CX20468-31 chip (4358:5430). Reference: Novell bnc#471265 https://bugzilla.novell.com/show_bug.cgi?id=471265 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-05ALSA: Fix missing KERN_* prefix to printk in sound/pciTakashi Iwai1-1/+4
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-29ALSA: AC97: Fix function name type in comment s/updat/update/Thadeu Lima de Souza Cascardo1-1/+1
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-01ALSA: ac97 - Add WM9715 to AC97 IDsMark Brown1-1/+1
The WM9715 is software compatible with the WM9711 and WM9712. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-30sound: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers1-3/+3
Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-By: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-08-29ALSA: ac97 - vt1618 7.1 Audio SupportJohn L. Utz III1-1/+1
1. Implement 7.1 Output for vt1618 codec. 2. Fix typos in comments from my previous 1617a patch. Signed-off-by: John L. Utz III <john.utz@dmx.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13ALSA: Kill snd_assert() in sound/pci/*Takashi Iwai1-7/+12
Kill snd_assert() in sound/pci/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-06ALSA: ac97 - Enable mono-out on ALC203 codec as defaultTakashi Iwai1-1/+1
Use pin 37 for mono-out as default on ALC203. Reported-by: george pee <georgepee@gmail.com> Tested-by: george pee <georgepee@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-20ALSA: re-order AC97 codec ID table.Rene Herman1-10/+10
Signed-off-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-15ALSA: add TriTech 28023 AC97 codec ID and Wolfson 9701 name.Rene Herman1-1/+2
Signed-off-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-10ALSA: Fix AC97 power downTakashi Iwai1-1/+3
Some laptops don't like PR3 powerdown. Do PR3 powerdown only for the real power-saving. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-13[ALSA] ac97 - Fix power_save option value as time-outTakashi Iwai1-3/+4
The power_save option was set as boot although it was meant to be a timeout value like the same option of snd-hda-intel originally. Now fixed to the same style. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31[ALSA] Remove sound/driver.hTakashi Iwai1-1/+0
This header file exists only for some hacks to adapt alsa-driver tree. It's useless for building in the kernel. Let's move a few lines in it to sound/core.h and remove it. With this patch, sound/driver.h isn't removed but has just a single compile warning to include it. This should be really killed in future. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.czJaroslav Kysela1-2/+2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16[ALSA] ac97: YMF743 missing controls support (2/2)Keita Maehara1-2/+9
These patches enable a few YMF743 controls (Tone/3D/IEC958) that won't be detected with the current version of ALSA. The second one contains following changes: - A chip-specific SPDIF support for YMF743 (It doesn't have AC97 standard SPDIF registers seen on YMF753). - The implementation for 'IEC958 Playback Source' and 'IEC958 Mute' are identical to the ones for YMF753. But there is no 'IEC958 Output Pin' for YMF743. Signed-off-by: Keita Maehara <maehara@debian.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16[ALSA] Add default values for power-saving as Kconfig optionsTakashi Iwai1-1/+1
Added CONFIG_SND_AC97_POWER_SAVE_DEFAULT and CONFIG_SND_HDA_POWER_SAVE_DEFAULT Kconfig options as the default values for power-saving mode of AC97 and HD-audio drivers, respectively. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16[ALSA] ac97 - Suppress the reset of audio-codec from modem-codec at resumeTakashi Iwai1-1/+4
On codec chips with both audio and modem functions (e.g. Conexant one), performing AC97_RESET resets the whole registers. When both audio and modem drivers are resumed at the same time, the modem one often is resumed after the audio, and it results in the reset of audio registers (ALSA bug#3333). This patch fixes such a problem. Since the modem codec basically doesn't need AC97_RESET, skip this initialization unless specified as audio. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16[ALSA] Use msecs_to_jiffies() in ac97_codec.cTakashi Iwai1-6/+8
Replace the direct calculation of jiffies with msecs_to_jiffies(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>