summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: hda - Fix possible races of accesses to connection list arrayTakashi Iwai2012-05-191-45/+37
| | | | | | | | | | 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>
* ALSA: hda - Disable FLOAT format supportTakashi Iwai2012-05-121-0/+2
| | | | | | | | | | 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>
* ALSA: hda - Fix concurrent hash accessesTakashi Iwai2012-05-101-81/+120
| | | | | | | | | | | | | 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>
* ALSA: hda - Protect SPDIF-related stuff via spdif_mutexTakashi Iwai2012-05-101-10/+25
| | | | | | | 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>
* ALSA: hda - More robustify the power-up/down sequenceTakashi Iwai2012-05-091-7/+15
| | | | | | | | | | 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>
* ALSA: hda - Remove pre_resume and post_suspend opsTakashi Iwai2012-05-091-4/+0
| | | | | | | | | 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>
* ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.cTakashi Iwai2012-05-081-596/+0
| | | | | | Just code shuffles. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Protect the power-saving count with spinlockTakashi Iwai2012-05-081-2/+21
| | | | | | To avoid some races. Still not perfect, but now a bit safer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Clear the power-saving states properly at resetTakashi Iwai2012-05-081-0/+3
| | | | | | | | | 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>
* ALSA: hda - Always resume the codec immediatelyTakashi Iwai2012-05-081-2/+7
| | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Fix possible access to uninitialized work structTakashi Iwai2012-05-081-7/+8
| | | | | | | The work struct must be initialized before the possible call in the destructor. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'fix/hda' into topic/hdaTakashi Iwai2012-05-081-4/+0
|\
| * Revert "ALSA: hda - Set codec to D3 forcibly even if not used"Takashi Iwai2012-05-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Skip pin capability sanity check for bogus valuesTakashi Iwai2012-04-201-2/+2
| | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Add snd_hda_get_default_vref() helper functionTakashi Iwai2012-04-201-0/+27
| | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Introduce snd_hda_set_pin_ctl*() helper functionsTakashi Iwai2012-04-201-0/+26
|/ | | | | | | | | | | | | | | 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>
* ALSA: hda - Add expose_enum_ctl flag to snd_hda_add_vmaster_hook()Takashi Iwai2012-03-131-1/+4
| | | | | | | | | 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>
* ALSA: hda - Add "Mute-LED Mode" enum controlTakashi Iwai2012-03-131-0/+94
| | | | | | | | | | | 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>
* ALSA: hda - Return the created kcontrol in __snd_hda_add_vmaster()Takashi Iwai2012-03-121-1/+8
| | | | | | It'll be used for adding hooks in later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Initialize vmaster slave volumesTakashi Iwai2012-03-091-3/+62
| | | | | | | | | | | | | | | 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>
* ALSA: hda - Set codec to D3 forcibly even if not usedTakashi Iwai2012-03-071-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'fix/hda' into topic/hdaTakashi Iwai2012-03-021-4/+8
|\ | | | | | | | | | | | | Speaker-Out renames are merged. Conflicts: sound/pci/hda/patch_realtek.c
| * ALSA: hda - Kill hyphenated namesTakashi Iwai2012-03-021-2/+2
| | | | | | | | | | | | Kill hyphens from "Line-Out" name strings, as suggested by Mark Brown. Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: hda - Add a fake mute featureTakashi Iwai2012-02-291-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Remove a debug print in vmaster codeTakashi Iwai2012-02-061-1/+0
| | | | | | | | | | | | Wrongly slipped in from the commit 9322ca54. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add suffix argument to snd_hda_add_vmaster()Takashi Iwai2012-02-031-6/+16
|/ | | | | | | | | | 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>
* ALSA: HDA: Fix duplicated output to more than one codecDavid Henningsson2012-02-011-1/+1
| | | | | | | | | | | 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>
* Merge branch 'test/hda-jack' into topic/hdaTakashi Iwai2011-12-201-148/+148
|\ | | | | | | | | | | Conflicts: sound/pci/hda/patch_hdmi.c sound/pci/hda/patch_via.c
| * ALSA: hda - Don't add channel suffix for headphone pin labelsTakashi Iwai2011-11-211-21/+31
| | | | | | | | | | | | | | | | | | 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>
| * ALSA: hda - Fix a typoTakashi Iwai2011-11-211-1/+1
| | | | | | | | | | Reported-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: hda - Give more unique names by snd_hda_get_pin_label()Takashi Iwai2011-11-161-33/+108
| | | | | | | | | | | | | | | | 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>
| * ALSA: hda - Merge input-jack helpers to hda_jack.cTakashi Iwai2011-11-161-108/+0
| | | | | | | | | | | | | | 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>
| * ALSA: hda - Cache the jack-detection valueTakashi Iwai2011-11-161-37/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a table containing the pins and their jack-detection states for avoiding the unnecessary verbs to check the pin status at each time. When the unsol event is enabled via snd_hda_jack_detect_enable(), it automatically adds the given NID to the table. Then the driver supposes that the codec driver will set the dirty flag appropariately when an unsolicited event is invoked for that pin. The behavior for reading other pins that aren't registered in the table doesn't change. Only the pins assigned to the table are cached, so far. In near futre, this table can be extended to use the central place for the unsolicited events of all pins, etc, and eventually include the jack-detect kcontrols that replace the current input-jack stuff. Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: hda - Introduce snd_hda_get_pin_label()Takashi Iwai2011-11-161-3/+60
| | | | | | | | | | | | | | | | | | Create a new helper function snd_hda_get_pin_label() for getting a label string for both input and output pins. hda_get_input_pin_label() is obsoleted by this function, and the callers are replaced appropriately now by this patch. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Supports more audio streamsTakashi Iwai2011-11-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Check subdevice mask in snd_hda_check_board_codec_sid_config()Takashi Iwai2011-11-231-3/+3
|/ | | | | | | | | 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>
* ALSA: hda - Re-enable the check NO_PRESENCE misc bitTakashi Iwai2011-11-101-0/+4
| | | | | | | | | | | | | | We disabled the check of NO_PRESENCE bit of the default pin-config in commit f4419172 temporarily. One problem was that the first implementation was wrong -- the bit after the shift must be checked. However, this would still give many regressions on machines with broken BIOS. They set this bit wrongly even on active pins. A workaround is to check whether all pins contain this bit. As far as I've checked, broken BIOSen set this bit on all pins, no matter whether active or not. In such a case, the driver should ignore this bit check. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Don't add elements of other codecs to vmaster slaveTakashi Iwai2011-11-101-21/+39
| | | | | | | | | | | | | | | When a virtual mater control is created, the driver looks for slave elements from the assigned card instance. But this may include the elements of other codecs when multiple codecs are on the same HD-audio bus. This works at the first time, but it'll give Oops when it's once freed and re-created via reconfig sysfs. This patch changes the element-look-up strategy to limit only to the mixer elements of the same codec. Reported-by: David Henningsson <david.henningsson@canonical.com> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* sound: Add module.h to the previously silent sound usersPaul Gortmaker2011-10-311-0/+1
| | | | | | | | Lots of sound drivers were getting module.h via the implicit presence of it in <linux/device.h> but we are going to clean that up. So fix up those users now. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* ALSA: hda - Fix surround/CLFE headphone and speaker pins orderTakashi Iwai2011-10-261-15/+24
| | | | | | | | | | | When 5.1 or more headphone or speaker pins are provided, the parser still takes as is without fixing the order of channel mapping, which leads in the unexpected strange channel order by surround outputs. This patch fixes the issue by applying the same fix-up not only to line_out_pins[] but also hp_pins[] and speaker_pins[]. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Moved snd_print_pcm_rates() back into hda_proc.cTakashi Iwai2011-10-061-24/+0
| | | | | | | Since hda_proc.c is now the only user of snd_print_pcm_rates(), better to put it back locally to hda_proc.c and revert to the old style. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hdmi: fix printout of SAD sampling ratesPierre-Louis Bossart2011-10-061-1/+1
| | | | | | | | | | SAD sampling rate information reported in /proc/asound/cardX/eldX is incorrect due to a mismatch between HDA and HDMI frequencies. Add new routine to provide relevant values. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: jack - Add "Line In" input jack constantsDavid Henningsson2011-10-051-0/+2
| | | | | | | | | Similar to Line Out, these constants form the base for future patches enabling input jack reporting for Line in jacks. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Avoid unnecessary verbs to clear PCM formatsTakashi Iwai2011-09-271-2/+5
| | | | | | | | | | Since really_cleanup_stream() is called from both purity_inactive_streams() and hda_cleanup_all_streams(), the verbs to clear the PCM channel and format may be called multiple times unnecessarily. This patch adds checks to skip these unneeded verbs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'fix/hda' into topic/hdaTakashi Iwai2011-09-201-1/+5
|\
| * ALSA: hda - Terminate the recursive connection search properlyTakashi Iwai2011-09-131-1/+5
| | | | | | | | | | | | | | | | | | The recursive search of widget connections in snd_hda_get_conn_index() must be terminated at the pin and the audio-out widgets. Otherwise you'll get "too deep connection" warnings unnecessarily. Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add multi-headphone NIDs in multiout structTakashi Iwai2011-08-231-0/+9
| | | | | | | | | | | | | | | | For supporting both the multiple headphones and the multiple speakers, add the new field in struct hda_multi_out, and evaluate in the standard setup functions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Rename to snd_hda_parse_pin_defcfg()Takashi Iwai2011-08-231-6/+9
| | | | | | | | | | | | | | ... and add a new bit-flags argument to specify the behavior of the function. The older function is kept as is (as a wrapper). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Allow different assoc numbers for multiple speakersTakashi Iwai2011-08-191-9/+3
| | | | | | | | | | | | | | | | | | | | In snd_hda_parse_pin_def_config(), we checked the associated number of speaker pins and accepts only one number exclusively. But many BIOS seem to give different assoc number for surround speakers, thus we'd better to accept all speaker pins no matter which assoc number, and sort like done for the headphone pins. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add snd_hda_override_pin_caps() helper functionTakashi Iwai2011-08-151-0/+23
| | | | | | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
OpenPOWER on IntegriCloud