summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_codec.c
AgeCommit message (Collapse)Author
2012-08-10ALSA : hda - bug fix on checking the supported power states of a codecMengdong Lin
The return value of snd_hda_param_read() is -1 for an error, otherwise it's the supported power states of a codec. The supported power states is a 32-bit value. Bit 31 will be set to 1 if the codec supports EPSS, thus making "sup" negative. And the bit 28:5 is reserved as "0". So a negative value other than -1 shall be further checked. Please refer to High-Definition spec 7.3.4.12 "Supported Power States", thanks! Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-19Merge branch 'topic/pm-convert' into for-nextTakashi Iwai
This merges the changes for converting to new PM ops for platform and some other drivers. Also move some header files to local places from the public include/sound.
2012-07-04Merge branch 'topic/hda-beep' into topic/hdaTakashi Iwai
2012-07-03ALSA: hda - Move beep helper functions to hda_beep.cTakashi Iwai
Move snd_hda_mixer_amp_switch_put_beep() to hda_beep.c as a clean up to remove one more ifdef. Also add the corresponding get callback to return consistently the digital beep state independently from the mixer amp value. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-03ALSA: Convert to new pm_ops for PCI driversTakashi Iwai
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>
2012-06-26Merge branch 'fix/hda' into topic/hdaTakashi Iwai
2012-06-26ALSA: hda - Initialize caches at codec reconfigurationTakashi Iwai
Better to clean up the caches for avoiding inconsistent codec state after the reconfiguration. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-26ALSA: hda - Fix memory leaks at module unloadTakashi Iwai
Some caches aren't released properly at module unloading time. Cc: <stable@vger.kernel.org> [v3.4+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-22ALSA: hda - Don't power up when not powered down.Dylan Reid
After cancel_delayed_work_sync returns, the power down work either never started (power_on == 1) or finished (power_on == 0). In the former case there is no need to power up again. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-20Merge branch 'fix/hda' into topic/hdaTakashi Iwai
The fix for power sequence needs to be merged back to topic branch.
2012-06-18ALSA: hda - Handle open while transitioning to D3.Dylan Reid
This addresses an issue encountered when a pcm is opened while transitioning to low power state (codec->power_on == 1 && codec->power_transition == -1). Add snd_pcm_power_up_d3wait to hda_codec. This function is used to power up from azx_open as opposed to snd_hda_power_up used from codec_exec_verb. When powering up from azx_open, wait for pending power downs to complete, avoiding the power up continuing in parallel with the power down on the work queue. The specific issue seen was with the CS4210 codec, it powers off the ADC and DAC nid in its suspend handler. If it is re-opened before the ~100ms power down process completes, the ADC and DAC nid are initialized while powered down and audio is lost until another suspend/resume cycle. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-08ALSA: hda - power setting error checkWang Xingchao
codec may reject power state transition requests(reporting PS-ERROR set), in that case we re-issue a power state setting and check error bit again. Signed-off-by: Wang Xingchao <xingchao.wang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-07ALSA: hda - reduce msleep time if EPSS power states supportedWang Xingchao
if EPSS supported, transition from D3 state to D0 state in less than 10ms Signed-off-by: Wang Xingchao <xingchao.wang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-07ALSA: hda - check supported power statesWang Xingchao
Add function to check whether power states supported by specific codec node. Signed-off-by: Wang Xingchao <xingchao.wang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-25Merge tag 'hda-switcheroo' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull VGA-switcheroo audio client support for HD-audio from Takashi Iwai. This depended on the recent drm pull. * tag 'hda-switcheroo' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - unlock on error in azx_interrupt() ALSA: hda - Support VGA-switcheroo ALSA: hda - Export snd_hda_lock_devices() ALSA: hda - Check the dead HDMI audio controller by vga-switcheroo
2012-05-19ALSA: hda - Fix possible races of accesses to connection list arrayTakashi Iwai
Like the previous fixes for cache hash accesses, a protection over accesses to the widget connection list array must be provided. Together with this action, remove snd_hda_get_conn_list() which can be always race, and replace it with either snd_hda_get_num_conns() or snd_hda_get_connections() calls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-14ALSA: hda - Export snd_hda_lock_devices()Takashi Iwai
It's a preliminary work for the vga-switcher support. Export the function to do pseudo-lock for the sound card to be used in other places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-12ALSA: hda - Disable FLOAT format supportTakashi Iwai
It turned out that the FLOAT format on CS4206 results in simple noises, which implies that this is no right format as is. Since CS4206 is the only codec supporting the float, let's disable it until we find the correct format. Reported-and-tested-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-10ALSA: hda - Fix concurrent hash accessesTakashi Iwai
The amp and caps hashes aren't protected properly for concurrent accesses. Protect them via a new mutex now. But it can't be so simple as originally thought: since the update of a hash table entry itself might trigger the power-up sequence which again accesses the hash table, we can't cover the whole function simply via mutex. Thus the update part has to be split from the mutex and revalidated. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-10ALSA: hda - Protect SPDIF-related stuff via spdif_mutexTakashi Iwai
Add the missing mutex protection or move into the protected part for SPDIF access codes for codecs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-09ALSA: hda - More robustify the power-up/down sequenceTakashi Iwai
Check the power_transition up/down state instead of boolean bit, so that the power-up sequence can cancel the pending power-down work properly. Also, by moving cancel_delayed_work_sync() before the actual power-up sequence, make sure that the delayed power-down is completed. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-09ALSA: hda - Remove pre_resume and post_suspend opsTakashi Iwai
Since the recent commit, the resume procedure is always performed at the resume time. This makes the pre_resume hack for VREF mute LED on some HP laptops superfluous. As this is the only user of pre_resume (and there is no user of post_suspend) ops, let's kill them again. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.cTakashi Iwai
Just code shuffles. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08ALSA: hda - Protect the power-saving count with spinlockTakashi Iwai
To avoid some races. Still not perfect, but now a bit safer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08ALSA: hda - Clear the power-saving states properly at resetTakashi Iwai
Some power-saving states have been left unchanged in snd_hda_codec_reset(), and this is a potential danger because the function may be called in various situations including the continuous operation after that call. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08ALSA: hda - Always resume the codec immediatelyTakashi Iwai
This is a fix for the problem in commit 785f857d1c, the pop noise issue on some machines with ALC269. The problem was the uninitialized state after the resume due to the delayed resume of the codec chips. In that commit, we tried to fix by forcibly putting the codec to D3 at suspend. But, this still also leaves the uninitialized state after resume, and it _might_ be still problematic with some BIOS. Since the commit turned out to regress another issues, we reverted it in the end. Now, in this fix, try to fix by turning on the codec immediately at the resume path. We need to take care of the power-saving in this case. When the device is woken up at the power-saved state, it should go power-saving again after the resume. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08ALSA: hda - Fix possible access to uninitialized work structTakashi Iwai
The work struct must be initialized before the possible call in the destructor. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08Merge branch 'fix/hda' into topic/hdaTakashi Iwai
2012-05-08Revert "ALSA: hda - Set codec to D3 forcibly even if not used"Takashi Iwai
This reverts commit 785f857d1cb0856b612b46a0545b74aa2596e44a. The commit causes a problem with the wrong D3 state after suspend because the call of hda_set_power_state() involves with the power-up sequence, which changes the power_count, and this confuses the resume sequence that checks the power_count as well. Originally, this go-to-D3 sequence should be a simple task without the power-up sequence. But, it'd need some proper sanity checks in the case of power-saved state, so it's not too easy to write now in the 3.4-rc cycle. In short, the safest option now is to revert this affecting commit. Of course, we need to clean up and robustify the power-saving code better for 3.5 kernel. Reported-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-20ALSA: hda - Skip pin capability sanity check for bogus valuesTakashi Iwai
Some old codecs like ALC880 seem to give a bogus pin capability value 0 occasionally. This breaks the new sanity check in snd_hda_set_pin_ctl(). Skip the sanity checks in such a case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-20ALSA: hda - Add snd_hda_get_default_vref() helper functionTakashi Iwai
Add a new helper function to guess the default VREF pin control bits for mic in. This can be used to set the pin control value safely matching with the actual pin capabilities. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-20ALSA: hda - Introduce snd_hda_set_pin_ctl*() helper functionsTakashi Iwai
For setting the pin-control values more safely to match with the actual pin capability bits, a copule of new helper functions, snd_hda_set_pin_ctl() and snd_hda_set_pin_ctl_cache(), are introduced. These are simple replacement of the codec verb write with AC_VERB_SET_PIN_WIDGET but do more sanity checks and filter out superfluous pin-control bits if they don't fit with the corresponding pin capabilities. Some codecs are screwed up or ignore the command when such a wrong bit is set. These helpers will avoid such secret errors. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-13ALSA: hda - Add expose_enum_ctl flag to snd_hda_add_vmaster_hook()Takashi Iwai
Since it's not always safe to assume that the vmaster hook is purely the mute-LED control, add the flag indicating whether to expose the mute-LED enum control or not. Currently, conexant codec sets this off for non-HP laptops where EAPD may be used really as EAPD. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-13ALSA: hda - Add "Mute-LED Mode" enum controlTakashi Iwai
Create snd_hda_add_vmaster_hook() and snd_hda_sync_vmaster_hook() helper functions to handle the mute-LED in vmaster hook more commonly. In the former function, a new enum control "Mute-LED Mode" is added. This provides user to choose whether the mute-LED should be turned on/off explicitly or to follow the master-mute status. Reviewed-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-12ALSA: hda - Return the created kcontrol in __snd_hda_add_vmaster()Takashi Iwai
It'll be used for adding hooks in later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-09ALSA: hda - Initialize vmaster slave volumesTakashi Iwai
When the driver is changed to use vmaster or a new slave element is added by the improvement of the parser code, user may face often the silent output because of the muted slave mixer although Master volume is properly set. And they complain. And I get upset. Although such a mixer element should be initialized via "alsactl init", it'd be more user-friendly if the known output slaves are unmuted and set to 0dB so that user can control the volume only with Master as default. Since Master is still set muted as default even with this change, no risk of the speaker blow up, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-07ALSA: hda - Set codec to D3 forcibly even if not usedTakashi Iwai
We've seen a problem with a pop-noise at suspend/resume on a HP machine with ALC269, and it turned out to be an issue that the controller going to D3 while the codec is unused. When the device is once suspended and resumed and kept unused, the driver doesn't initialize the codecs. Instead, the codec chips are set up dynamically at the first usage. Now, suppose the device going to suspend again before the codec is set up. The controller is turned off to D3 while the codec chips are untouched. This caused a pop noise because the codec chip might have been turned on implicitly by the hardware. As a workaround, the codec chip needs to be set to D3 when going to suspend no matter whether it was used or not. Also, for making it happening, the controller has to be always set up in the resume path. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-03-02Merge branch 'fix/hda' into topic/hdaTakashi Iwai
Speaker-Out renames are merged. Conflicts: sound/pci/hda/patch_realtek.c
2012-03-02ALSA: hda - Kill hyphenated namesTakashi Iwai
Kill hyphens from "Line-Out" name strings, as suggested by Mark Brown. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-29ALSA: hda - Add a fake mute featureTakashi Iwai
Some codecs don't supply the mute amp-capabilities although the lowest volume gives the mute. It'd be handy if the parser provides the mute mixers in such a case. This patch adds an extension amp-cap bit (which is used only in the driver) to represent the min volume = mute state. Also modified the amp cache code to support the fake mute feature when this bit is set but the real mute bit is unset. In addition, conexant cx5051 parser uses this new feature to implement the missing mute controls. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42825 Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-06ALSA: hda - Remove a debug print in vmaster codeTakashi Iwai
Wrongly slipped in from the commit 9322ca54. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-03ALSA: hda - Add suffix argument to snd_hda_add_vmaster()Takashi Iwai
In most cases, the slave strings for vmaster are identical between volumes and switches except for "xxx Volume" and "xxx Switch" suffix. Now snd_hda_add_vmaster() takes the optional suffix argument so that each string can be composed with the given suffix, and we can share the slave name strings in both volume and switch calls nicely. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-01ALSA: HDA: Fix duplicated output to more than one codecDavid Henningsson
This typo caused the wrong codec's nid to be checked for wcaps type. As a result, sometimes speakers would duplicate the output sent to HDMI output. Cc: stable@kernel.org BugLink: https://bugs.launchpad.net/bugs/924320 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-20Merge branch 'test/hda-jack' into topic/hdaTakashi Iwai
Conflicts: sound/pci/hda/patch_hdmi.c sound/pci/hda/patch_via.c
2011-11-26ALSA: hda - Supports more audio streamsTakashi Iwai
So far, the driver supports up to 10 streams. This is a restriction in hda_intel.c and hda_codec.c: in the former, the fixed array size limits the amount, and in the latter, the fixed device-number assignment table (in get_empty_pcm_device()) limits the possibility. This patch reduces the restriction by - using linked list for managing PCM instances in hda_intel.c, and - assigning non-fixed device numbers for the extra devices Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-23ALSA: hda - Check subdevice mask in snd_hda_check_board_codec_sid_config()Takashi Iwai
In snd_hda_check_board_codec_sid_config(), not only comparing with the exact value but allow the bit-mask comparison for vendor-only, etc. Tested-by: Linus Torvalds <torvalds@linux-foundation.org> Tested-by: Dirk Hohndel <hohndel@infradead.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-21ALSA: hda - Don't add channel suffix for headphone pin labelsTakashi Iwai
The multiple headphone pins are usually handled as copied from the same source, not as individual channels like front and surround. Thus it'd be more correct to avoid the channel suffix for "Headphone" pin labels in snd_hda_get_pin_label() but give an index number instead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-21ALSA: hda - Fix a typoTakashi Iwai
Reported-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16ALSA: hda - Give more unique names by snd_hda_get_pin_label()Takashi Iwai
The function now gives more unique names for the output pins by adding some prefix and suffix for the location and the channels. Otherwise, it can pass the index number. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16ALSA: hda - Merge input-jack helpers to hda_jack.cTakashi Iwai
We can use the very same table in hda_jack.c for managing the list for input-jack elements, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>