summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cirrus.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: hda - Keep powering up ADCs on Cirrus codecsTakashi Iwai2016-04-191-0/+14
| | | | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Fix unconditional GPIO toggle via automuteTakashi Iwai2016-03-151-2/+6
| | | | | | | | | | | | | | | | 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>
* ALSA: hda - Add fixup for Mac Mini 7,1 modelTakashi Iwai2016-02-031-0/+27
| | | | | | | | | | | | | | | 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>
* ALSA: hda - convert to hda_device_idTakashi Iwai2015-10-201-13/+8
| | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Enable widget power saving for Cirrus codecsTakashi Iwai2015-10-151-0/+1
| | | | | | | | | 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>
* ALSA: hda - Apply SPDIF pin ctl to MacBookPro 12,1John Flatness2015-10-031-0/+1
| | | | | | | | | | | | | 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>
* ALSA: hda - fix cs4210_spdif_automute()Dan Carpenter2015-07-251-3/+1
| | | | | | | | | | 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>
* ALSA: hda - Set patch_ops before calling auto-parserTakashi Iwai2015-05-291-7/+5
| | | | | | | | | | | ... 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>
* Merge branch 'topic/hda-bus' into for-nextTakashi Iwai2015-03-161-14/+2
|\
| * ALSA: hda - Bind codecs via standard busTakashi Iwai2015-02-231-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Add workaround for MacBook Air 5,2 built-in micTakashi Iwai2015-03-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Set single_adc_amp flag for CS420x codecsTakashi Iwai2015-03-121-0/+1
|/ | | | | | | | | | | | | 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>
* ALSA: hda - Allow multiple callbacks for jackTakashi Iwai2014-09-161-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Get rid of action field from struct hda_jack_tblTakashi Iwai2014-09-111-3/+0
| | | | | | | | | | | | | | | 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>
* ALSA: hda - Refactor quirk picking and change quirk priorityDavid Henningsson2014-07-221-1/+3
| | | | | | | | | | | | 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>
* ALSA: hda - Remove superfluous inclusion of linux/pci.hTakashi Iwai2014-02-151-1/+0
| | | | | | Some codec drivers still have it since using PCI_VENDOR_ID_*. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Control SPDIF out pin on MacBookPro 11,2Takashi Iwai2013-11-111-1/+55
| | | | | | | | | 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>
* ALSA: hda - Apply MacBook fixups for CS4208 correctlyTakashi Iwai2013-11-081-2/+25
| | | | | | | | | | | | | | | | 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>
* ALSA: hda - Apply GPIO setup for MacBooks with CS4208Takashi Iwai2013-11-061-0/+1
| | | | | | | | | 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>
* ALSA: hda - Introduce the bitmask for excluding output volumeTakashi Iwai2013-11-051-0/+2
| | | | | | | | | | | | | | | 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>
* ALSA: hda - Add fixup for MacBook Air 6,1 and 6,2 with CS4208 codecBen Whitten2013-09-271-5/+67
| | | | | | | | | | | | | 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>
* ALSA: hda - Add CS4208 codec support for MacBook 6,1 and 6,2Takashi Iwai2013-09-091-7/+82
| | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Fix pin configurations for MacBook Air 4,2Takashi Iwai2013-06-171-0/+23
| | | | | | | | | | | | 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>
* ALSA: hda/cirrus - Add a quirk for Stumpy ChromeBox.Dylan Reid2013-04-051-1/+18
| | | | | | | 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>
* ALSA: hda - Fix yet missing GPIO/EAPD setup in cirrus driverTakashi Iwai2013-03-181-2/+2
| | | | | | | | 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>
* ALSA: hda - Fix missing EAPD/GPIO setup for Cirrus codecsTakashi Iwai2013-03-151-0/+4
| | | | | | | | 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>
* ALSA: hda - Remove superfluous header inclusionsTakashi Iwai2013-01-211-1/+0
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use generic parser for Cirrus codec driverTakashi Iwai2013-01-121-1189/+98
| | | | | | | | | | | | 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>
* ALSA: hda - Move fixup code into struct hda_codecTakashi Iwai2013-01-121-7/+1
| | | | | | | 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>
* ALSA: hda - Add a fixup for internal mic on MacBook Pro 8,1Takashi Iwai2012-11-231-0/+14
| | | | | | | | | 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>
* ALSA: hda - Add missing verb applications in patch_cirrus.cTakashi Iwai2012-11-231-15/+2
| | | | | | | | | | 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>
* ALSA: hda - Move static ADC setup for CS4206 to init verbsTakashi Iwai2012-11-231-3/+3
| | | | | | It's constant, so better to be put in the static init array. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'for-linus' into for-nextTakashi Iwai2012-11-221-0/+1
|\
| * ALSA: hda - Cirrus: Correctly clear line_out_pins when moving to speakerDavid Henningsson2012-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Apply a proper chmap for built-in 2.1 speakersTakashi Iwai2012-11-081-0/+3
| | | | | | | | | | | | | | 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>
* | ALSA: hda - Give standard "Bass Speaker" mixer for 2.1 speakersTakashi Iwai2012-11-081-1/+7
| | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-linus' into for-nextTakashi Iwai2012-11-081-9/+12
|\|
| * ALSA: HDA: Mark CS260x immutable structures constDaniel J Blueman2012-11-051-3/+2
| | | | | | | | | | | | | | Mark structures that won't change const. Signed-off-by: Daniel J Blueman <daniel@quora.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: HDA: Fix digital microphone on CS420xDaniel J Blueman2012-11-051-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ALSA: hda: Cirrus: Fix coefficient index for beep configurationAlexander Stein2012-11-051-1/+1
| | | | | | | | | | | | Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add workaround for conflicting IEC958 controlsTakashi Iwai2012-10-171-2/+3
|/ | | | | | | | | | | | | | | | | 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>
* ALSA: hda/cirrus - Add missing init/free of hda_gen_specTakashi Iwai2012-10-101-0/+4
| | | | | | | 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>
* ALSA: hda - Fix memory leaks at error path in patch_cirrus.cTakashi Iwai2012-10-101-3/+3
| | | | | | | The proper destructor should be called at the error path. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - make Cirrus codec use generic unsol event handlerDavid Henningsson2012-10-081-38/+10
| | | | | Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix disordered enum definitions in patch_cirrus.cTakashi Iwai2012-09-131-2/+3
| | | | | | | | | | 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>
* ALSA: hda - Add support for MacBook Pro 10,1Takashi Iwai2012-09-111-0/+31
| | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Replace with the generic fixup codes in patch_cirrus.cTakashi Iwai2012-09-111-90/+103
| | | | | | | ... to make easier to integrate into the common generic parser in near future. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.cTakashi Iwai2012-08-221-2/+0
| | | | | | | | | Instead of calling the jack sync in the init callback of each codec, call it generically at initialization and resume. By calling it at the last of resume sequence, a possible race between the jack sync and the unsol event enablement in the current code will be closed, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: Convert to new pm_ops for PCI driversTakashi Iwai2012-07-031-1/+1
| | | | | | | | | | Straightforward conversion to the new pm_ops from the legacy suspend/resume ops. Since we change vx222, vx_core and vxpocket have to be converted, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.cTakashi Iwai2012-05-081-0/+1
| | | | | | Just code shuffles. Signed-off-by: Takashi Iwai <tiwai@suse.de>