aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cirrus.c
AgeCommit message (Collapse)Author
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32Thomas Gleixner
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 this driver 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 18 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/20190520170857.186505395@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-30ALSA: hda: move hda_codec.h to include/soundPierre-Louis Bossart
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>
2018-06-25ALSA: hda/cirrus - Simplify creation of new controlsTakashi Iwai
This patch moves the mixer creation code in Cirrus codec driver from its own build_controls callback to snd_hda_gen_add_kctl() for simplification. As a bonus, this allows us to remove the cs421x_build_controls as it becomes identical with snd_hda_gen_build_controls(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-10ALSA: hda - Apply the existing quirk to iMac 14,1Takashi Iwai
iMac 14,1 requires the same quirk as iMac 12,2, using GPIO 2 and 3 for headphone and speaker output amps. Add the codec SSID quirk entry (106b:0600) accordingly. BugLink: http://lkml.kernel.org/r/CAEw6Zyteav09VGHRfD5QwsfuWv5a43r0tFBNbfcHXoNrxVz7ew@mail.gmail.com Reported-by: Freaky <freaky2000@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-19ALSA: hda - Keep powering up ADCs on Cirrus codecsTakashi Iwai
Although one weird behavior about the input path (inconsistent D0/D3 switch) on Cirrus CS420x codecs was fixed in the previous commit, there is still an issue on some Mac machines: the capture stream stalls when switching the ADCs on the fly. More badly, this keeps stuck until the next reboot. The dynamic ADC switching is already a bit fragile and assuming optimistically that the chip accepts the frequent power changes. On Cirrus codecs, this doesn't seem applicable. As a quick workaround, we pin down the ADCs to keep up in D0 when spec->dyn_adc_switch is set. In this way, the ADCs are kept up only for the system that were confirmed to be broken. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116171 Cc: <stable@vger.kernel.org> # v4.4+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-15ALSA: hda - Fix unconditional GPIO toggle via automuteTakashi Iwai
Cirrus HD-audio driver may adjust GPIO pins for EAPD dynamically depending on the jack plug state. This works fine for the auto-mute mode where the speaker gets muted upon the HP jack plug. OTOH, when the auto-mute mode is off, this turns off the EAPD unexpectedly depending on the jack state, which results in the silent speaker output. This patch fixes the silent speaker output issue by setting GPIO bits constantly when the auto-mute mode is off. Reported-and-tested-by: moosotc@gmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-03ALSA: hda - Add fixup for Mac Mini 7,1 modelTakashi Iwai
Mac Mini 7,1 model with CS4208 codec reports the headphone jack detection wrongly in an inverted way. Moreover, the advertised pins for the audio input and SPDIF output have actually no jack detection. This patch addresses these issues. The inv_jack_detect flag is set for fixing the headphone jack detection, and the pin configs for audio input and SPDIF output are marked as non-detectable. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105161 Report-and-tested-by: moosotc@gmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - convert to hda_device_idTakashi Iwai
Finally we have a proper infrastructure to generate the modaliases automatically, let's move to hda_device_id from the legacy hda_codec_preset that contains basically the same information. The patch function hook is stored in driver_data field, which is long, and we need an explicit cast. Other than that, the conversion is mostly straightforward. Each entry is even simplified using a macro, and the lengthy (and error-prone) manual modaliases got removed. As a result, we achieved a quite good diet: 14 files changed, 407 insertions(+), 595 deletions(-) Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hda - Enable widget power saving for Cirrus codecsTakashi Iwai
Cirrus codecs have also fine power controls on each widget, thus it gets benefit from the recent widget power-saving feature. As we haven't seen any obvious regressions with tests on some MacBooks, let's try to enable it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-03ALSA: hda - Apply SPDIF pin ctl to MacBookPro 12,1John Flatness
The MacBookPro 12,1 has the same setup as the 11 for controlling the status of the optical audio light. Simply apply the existing workaround to the subsystem ID for the 12,1. [sorted the fixup entry by tiwai] Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105401 Signed-off-by: John Flatness <john@zerocrates.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-25ALSA: hda - fix cs4210_spdif_automute()Dan Carpenter
Smatch complains that we have nested checks for "spdif_present". It turns out the current behavior isn't correct, we should remove the first check and keep the second. Fixes: 1077a024812d ('ALSA: hda - Use generic parser for Cirrus codec driver') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-29ALSA: hda - Set patch_ops before calling auto-parserTakashi Iwai
... so that the parser code can overwrite some optional ops. For Realtek and others, it can be set solely in the spec allocator, so it results in a good code cleanup, too. With this change, we can finally remove the local stream_pm setup and rely on the generic parser's automatic setting. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16Merge branch 'topic/hda-bus' into for-nextTakashi Iwai
2015-03-12ALSA: hda - Add workaround for MacBook Air 5,2 built-in micTakashi Iwai
MacBook Air 5,2 has the same problem as MacBook Pro 8,1 where the built-in mic records only the right channel. Apply the same workaround as MBP8,1 to spread the mono channel via a Cirrus codec vendor-specific COEF setup. Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com> Cc: <stable@vger.kernel.org> # 3.9+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12ALSA: hda - Set single_adc_amp flag for CS420x codecsTakashi Iwai
CS420x codecs seem to deal only the single amps of ADC nodes even though the nodes receive multiple inputs. This leads to the inconsistent amp value after S3/S4 resume, for example. The fix is just to set codec->single_adc_amp flag. Then the driver handles these ADC amps as if single connections. Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com> Cc: <stable@vger.kernel.org> # 3.9+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23ALSA: hda - Bind codecs via standard busTakashi Iwai
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>
2014-09-16ALSA: hda - Allow multiple callbacks for jackTakashi Iwai
So far, hda_jack infrastructure allows only one callback per jack, and this makes things slightly complicated when a driver wants to assign multiple tasks to a jack, e.g. the standard auto-mute with a power up/down sequence. This can be simplified if the hda_jack accepts multiple callbacks. This patch is such an extension: the callback-specific part (the function and private_data) is split to another struct from hda_jack_tbl, and multiple such objects can be assigned to a single hda_jack_tbl entry. The new struct hda_jack_callback is passed to each callback function now, thus the patch became bigger than expected. But these changes are mostly trivial. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-11ALSA: hda - Get rid of action field from struct hda_jack_tblTakashi Iwai
The action value assigned to each hda_jack_tbl entry is mostly superfluous. The actually used values are either the widget NID or a value specific to the callback. The former case can be simply replaced by a reference to widget NID itself. The only place doing the latter is STAC/IDT codec driver for the powermap handling. But, the code doesn't need to check the action field at all -- the function jack_update_power() is called either with a specific pin or with NULL. So the check of jack->action can be removed completely there, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-22ALSA: hda - Refactor quirk picking and change quirk priorityDavid Henningsson
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>
2014-02-15ALSA: hda - Remove superfluous inclusion of linux/pci.hTakashi Iwai
Some codec drivers still have it since using PCI_VENDOR_ID_*. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-11ALSA: hda - Control SPDIF out pin on MacBookPro 11,2Takashi Iwai
The SPDIF output MBP11,2 requires the pin control to be set/cleared for turning on/off the optical SPDIF. The red light turns off only when the corresponding pin control is cleared (or powered to D3). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64401 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-08ALSA: hda - Apply MacBook fixups for CS4208 correctlyTakashi Iwai
The commit [8fe7b65ab465: ALSA: hda - Apply GPIO setup for MacBooks with CS4208] added a fixup entry matching with the vendor id 0x106b. This broke the fixups for previous MBA6,1 and 6,2, since the PCI SSID vendor id matches before evaluating the codec SSIDs. We had a similar issue on Mac with Sigmatel codecs, and solve this problem again similarly, by introducing a skeleton entry matching with the all MacBooks, then remap to the right one. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64401 Fixes: 8fe7b65ab465 ('ALSA: hda - Apply GPIO setup for MacBooks with CS4208') Cc: <stable@vger.kernel.org> [v3.12+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-06ALSA: hda - Apply GPIO setup for MacBooks with CS4208Takashi Iwai
Apply the existing GPIO0 fixup as default for MacBooks with CS4208 codec. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64401 Cc: <stable@vger.kernel.org> [v3.12+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-05ALSA: hda - Introduce the bitmask for excluding output volumeTakashi Iwai
Add a bitmask to hda_gen_spec indicating NIDs to exclude from the possible volume controls. That is, when the bit is set, the NID corresponding to the bit won't be picked as an output volume control any longer. Basically this is just a band-aid for working around the issue found with CS4208 codec, where only the headphone pin has a volume AMP with different dB steps. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811 Cc: <stable@vger.kernel.org> [v3.12+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-27ALSA: hda - Add fixup for MacBook Air 6,1 and 6,2 with CS4208 codecBen Whitten
This patch adds the default pin configuration and some init verbs for setting COEFs, in addition to the correction of input pin AMP caps for MacBook Air 6,1 and 6,2. With these changes, the headphone jack detection starts working properly. [trivial space fixes by tiwai] Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811 Signed-off-by: Ben Whitten <benwhitten@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-09ALSA: hda - Add CS4208 codec support for MacBook 6,1 and 6,2Takashi Iwai
MacBook 6,1 and 6,2 have a CS4208 codec instead of CS4206/CS4207 on the former models. Most of functions work fine as is, except for the silent speaker output. After debugging sessions, it turned out that the machine needs to set GPIO 0 for the speaker amp. This patch adds the basic support for CS4208 and the fixup for these MacBooks. Basically the codec works just with the generic parser. For re-using the existing GPIO amp code and init/free callbacks, a few places have been changed so that CS4206/4207-specific codes (errata, etc) won't hit with CS4208. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811 Reported-and-tested-by: Imre Kaloz <kaloz@openwrt.org> Reported-and-tested-by: Ian Munsie <darkstarsword@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-17ALSA: hda - Fix pin configurations for MacBook Air 4,2Takashi Iwai
MacBook Air 4,2 requires the whole default pin configuration table to be overridden by the driver, as usual, as Apple's machines don't set up properly after boot. Otherwise mic won't work, and other ill effect may happen. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59381 Reported-and-tested-by: Peter John Hartman <peterjohnhartman@gmail.com> Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-05ALSA: hda/cirrus - Add a quirk for Stumpy ChromeBox.Dylan Reid
The Stumpy ChromeBox needs its pin configs fixed up. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-18ALSA: hda - Fix yet missing GPIO/EAPD setup in cirrus driverTakashi Iwai
I forgot to update spec->gpio_data in the automute hook, so it will be overridden at the init sequence, thus the machine is still silent when no headphone jack is plugged at boot time. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-15ALSA: hda - Fix missing EAPD/GPIO setup for Cirrus codecsTakashi Iwai
During the transition to the generic parser, the hook to the codec specific automute function was forgotten. This resulted in the silent output on some MacBooks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Remove superfluous header inclusionsTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Use generic parser for Cirrus codec driverTakashi Iwai
This time, the target is Cirrus codec. Its parser is a subset of generic parser, so we can migrate fully with it now. The only tricky part is the handling of SPDIF automute. Cirrus driver sets the SPDIF out plug over the headphone. As a workaround, set spec->gen.master_mute for toggling the headphone (and other) mute. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Move fixup code into struct hda_codecTakashi Iwai
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>
2012-11-23ALSA: hda - Add a fixup for internal mic on MacBook Pro 8,1Takashi Iwai
The internal mic on MBP81 gives only the right channel, and the left channel is static. Add a verb to fix the ADC2 channel mode to expand mono right to stereo. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50781 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-23ALSA: hda - Add missing verb applications in patch_cirrus.cTakashi Iwai
We forgot to apply the fixup verbs in cs_init(). But adding the fixup verbs will break mbp101 fixup that has been fixed recently again, since the mbp101 fixup contains the wrong verbs to override. So these bogus verbs must be removed, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-23ALSA: hda - Move static ADC setup for CS4206 to init verbsTakashi Iwai
It's constant, so better to be put in the static init array. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22Merge branch 'for-linus' into for-nextTakashi Iwai
2012-11-21ALSA: hda - Cirrus: Correctly clear line_out_pins when moving to speakerDavid Henningsson
If this array is not cleared, the jack related code later might fail to create "Internal Speaker Phantom Jack" on Dell Inspiron 3420 and Dell Vostro 2420. BugLink: https://bugs.launchpad.net/bugs/1076840 Cc: stable@vger.kernel.org (3.6+) Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08ALSA: hda - Apply a proper chmap for built-in 2.1 speakersTakashi Iwai
When 2.1 speakers are detected, use the corresponding channel map instead of the standard map with front+rear surrounds. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08ALSA: hda - Give standard "Bass Speaker" mixer for 2.1 speakersTakashi Iwai
When two built-in speakers are found on the machine, we can suppose it's rather a 2.1 speaker system with a bass output instead of front/surround channels. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08Merge branch 'for-linus' into for-nextTakashi Iwai
2012-11-05ALSA: HDA: Mark CS260x immutable structures constDaniel J Blueman
Mark structures that won't change const. Signed-off-by: Daniel J Blueman <daniel@quora.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05ALSA: HDA: Fix digital microphone on CS420xDaniel J Blueman
Correctly enable the digital microphones with the right bits in the right coeffecient registers on Cirrus CS4206/7 codecs. It also prevents misconfiguring ADC1/2. This fixes the digital mic on the Macbook Pro 10,1/Retina. Based-on-patch-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Daniel J Blueman <daniel@quora.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05ALSA: hda: Cirrus: Fix coefficient index for beep configurationAlexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-17ALSA: hda - Add workaround for conflicting IEC958 controlsTakashi Iwai
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>
2012-10-10ALSA: hda/cirrus - Add missing init/free of hda_gen_specTakashi Iwai
In the transition to the generic fixup code, the call of snd_hda_gen_init() and snd_hda_gen_free() was missing. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-10ALSA: hda - Fix memory leaks at error path in patch_cirrus.cTakashi Iwai
The proper destructor should be called at the error path. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-08ALSA: hda - make Cirrus codec use generic unsol event handlerDavid Henningsson
Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13ALSA: hda - Fix disordered enum definitions in patch_cirrus.cTakashi Iwai
Due to the definitions of CS420X_IMAC27_122 and CS420X_APPLE as aliases, the rest enums are set to duplicated values unexpectedly. Move the alias definitions at the end so that the enum values are defined in the proper order. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-11ALSA: hda - Add support for MacBook Pro 10,1Takashi Iwai
MacBook Pro 10,1 needs a few adjustments to make it working: - more COEF verbs - some pin config overrides to disable the unused pin (0x0d, 0x12), and fix the internal mic (0x0e) In addition, it uses GPIO 1 and 3 like other MacBooks. The internal digital mic on the machine is still problematic: it seems that only the right channel is used and the left is always static. This looks like a hardware design, so we need to cope in the software side somehow... The primary information and test were brought from Daniel J Blueman. Signed-off-by: Takashi Iwai <tiwai@suse.de>