summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | ALSA: hda - Don't overwrite the pin default configsTakashi Iwai2012-11-221-42/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we keep the pin default config values anyway internally, we don't have to set the values in the codec. This patch removes the code writing the pincfg values. As a gratis bonus, we can remove also the code restoring the original pincfg values at PM resume or module free. This will give us more benefit, as it can reduce the unnecessary power-up of codecs. This won't change the driver functionality. The only difference would be that the codec proc file will show the original pincfg values instead of the actually referred values. The actually referred values can be determined from sysfs *_pin_configs files. (Also hda-emu was updated to follow this change.) Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge branch 'for-linus' into for-nextTakashi Iwai2012-11-191-2/+9
|\ \ | |/ | | | | | | | | | | | | Merge the recent HD-audio codec change for fixing recursive suspend calls. Conflicts: sound/pci/hda/hda_codec.c
| * ALSA: hda - Fix recursive suspend/resume callTakashi Iwai2012-11-191-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | When the bus reset is performed during the suspend/resume (including the power-saving too), it calls snd_hda_suspend() and snd_hda_resume() again, and deadlocks eventually. For avoiding the recursive call, add a new flag indicating that the PM is being performed, and don't go to the bus reset mode when it's on. Reported-and-tested-by: Julian Wollrath <jwollrath@web.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Apply a proper chmap for built-in 2.1 speakersTakashi Iwai2012-11-081-2/+16
| | | | | | | | | | | | | | 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 - stop setup_dig_out_stream() causing clicksLaurence Darby2012-11-041-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Starting audio or seeking in various music players causes setup_dig_out_stream() to be called, which resets the SPDIF stream, which caused one DAC (but not another) to make a clicking noise every time. This patch ensures the reset only happens when it needs to, which is when the format changes, and makes the code a little more readable. Signed-off-by: Laurence Darby <ldarby@tuffmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add workaround for conflicting IEC958 controlsTakashi Iwai2012-10-171-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 - Implement a poll loop for jacks as a module parameterDavid Henningsson2012-10-151-4/+28
|/ | | | | | | | | Now that we have a generic unsol mechanism, we can implement a generic poll loop, which can be used for debugging, or if a codec's unsol mechanism is broken. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Warn an allocation for an uninitialized arrayTakashi Iwai2012-10-101-0/+2
| | | | | | | Better to add a sanity check as I tend to forget something (especially during crazy midsummer nights). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix hang caused by race during suspend.Dylan Reid2012-10-061-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | There was a race condition when the system suspends while hda_power_work is running in the work queue. If system suspend (snd_hda_suspend) happens after the work queue releases power_lock but before it calls hda_call_codec_suspend, codec_suspend runs with power_on=0, causing the codec to power up for register reads, and hanging when it calls cancel_delayed_work_sync from the running work queue. The call chain from the work queue will look like this: hda_power_work <<- power_on = 1, unlock, then power_on cleard by suspend hda_call_codec_suspend hda_set_power_state snd_hda_codec_read codec_exec_verb snd_hda_power_up snd_hda_power_save __snd_hda_power_up cancel_delayed_work_sync <<-- cancelling executing wq Fix this by waiting for the work queue to finish before starting suspend if suspend is not happening on the work queue. Signed-off-by: Dylan Reid <dgreid@chromium.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'topic/tlv-chmap' into for-nextTakashi Iwai2012-09-151-0/+36
|\ | | | | | | | | This is a merge of a topic branch containing the support for the new channel map API using control elements.
| * ALSA: hda - Add standard channel mapsTakashi Iwai2012-09-061-0/+36
| | | | | | | | | | | | | | | | Although HD-audio allows pair-wise channel configurations, only the fixed channel positions are used in this version. In future, this can be changed and allow user to modify the channel positions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge branch 'for-linus' into for-nextTakashi Iwai2012-09-111-1/+1
|\ \ | |/ |/| | | To merge HD-audio fixes back to 3.7 development line
| * ALSA: hda - Fix Oops at codec reset/reconfigTakashi Iwai2012-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | snd_hda_codec_reset() calls restore_pincfgs() where the codec is powered up again, which eventually tries to resume and initialize via the callbacks of the codec. However, it's the place just after codec free callback, thus no codec callbacks should be called after that. On a codec like CS4206, it results in Oops due to the access in init callback. This patch fixes the issue by clearing the codec callbacks properly after freeing codec. Reported-by: Daniel J Blueman <daniel@quora.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Clean up redundant FG checksTakashi Iwai2012-08-311-18/+12
| | | | | | | | | | | | Just refactoring, no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Yet another fix for D3 stop-clock refcountingTakashi Iwai2012-08-311-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | The call of pm_notify callback in snd_hda_codec_free() should be with the check of the current state whether pm_notify(false) is called or not, instead of codec->power_on check. For improving the code readability and fixing this inconsistency, codec->d3_stop_clk_ok is renamed to codec->pm_down_notified, and this flag is set only when runtime PM down is called. The new name reflects to a more direct purpose of the flag. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVETakashi Iwai2012-08-301-14/+9
| | | | | | | | | | | | | | | | CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its behavior can be well controlled via the default value and module parameter. Let's just replace it with the standard CONFIG_PM. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Fix D3 clock stop check for codecs with own set_power_state opTakashi Iwai2012-08-301-24/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a codec provides its own set_power_state op, the D3-clock-stop isn't checked correctly. And the recent changes for repeating the state-setting operation isn't applied to such a codec, too. This patch fixes these issues by moving the call of codec's own op to the place where the generic power-set operation is done, and move the power-state synchronization code out of snd_hda_set_power_state_to_all() so that it can be called always at the end of power-up/down sequence, and updates the D3 clock-stop flag properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Fix runtime PM leftover refcountsTakashi Iwai2012-08-301-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | When the HD-audio is removed, it leaves the refcounts when codecs are powered up (usually yes) in the destructor. For fixing the unbalance, and cleaning up the code mess, this patch changes the following: - change pm_notify callback to take the explicit power on/off state, - check of D3 stop-clock and keep_link_on flags is moved to the caller side, - call pm_notify callback in snd_hda_codec_new() and snd_hda_codec_free() so that the refcounts are proprely updated. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge branch 'for-linus' into for-nextTakashi Iwai2012-08-281-2/+4
|\ \ | |/ | | | | | | | | | | Need to merge the fixes regarding EPSS. Conflicts: sound/pci/hda/hda_codec.c
| * ALSA: hda - Avoid unnecessary parameter read for EPSSTakashi Iwai2012-08-281-2/+8
| | | | | | | | | | | | | | | | | | EPSS parameter should be static, so we can read it once and remember. This also allows more easily to override the wrong EPSS capability reported from a codec by changing the flag in the codec initialization step. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Make clear built-in driver optimizationTakashi Iwai2012-08-281-1/+1
| | | | | | | | | | | | | | Use unsigned int to make clear that the codes required only for modules will be reduced by the compiler optimization. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - bug fix on references without checking CONFIG_SND_HDA_POWER_SAVEMengdong Lin2012-08-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | The patch to support runtime PM introduced a bug: Module parameter 'power_save_controller', and the codec flag 'd3_stop_clk' 'd3_stop_clk_ok' are defined only when HDA power save is enabled in config. But there are references to them without checking macro CONFIG_SND_HDA_POWER_SAVE. This patch is to fix the bug. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - add runtime PM supportMengdong Lin2012-08-231-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Runtime PM can bring more power saving: - When the controller is suspended, its parent device will also have a chance to suspend. - PCI subsystem can choose the lowest power state the controller can signal wake up from. This state can be D3cold on platforms with ACPI PM support. And runtime PM can provide a gerneral sysfs interface for a system policy manager. Runtime PM support is based on current HDA power saving implementation. The user can enable runtime PM on platfroms that provide acceptable latency on transition from D3 to D0. Details: - When both power saving and runtime PM are enabled: -- If a codec supports 'stop-clock' in D3, it will request suspending the controller after it enters D3 and request resuming the controller before back to D0. Thus the controller will be suspended only when all codecs are suspended and support stop-clock in D3. -- User IO operations and HW wakeup signal can resume the controller back to D0. - If runtime PM is disabled, power saving just works as before. - If power saving is disabled, the controller won't be suspended because the power usage counter can never be 0. More about 'stop-clock' feature: If a codec can support targeted pass-through operations in D3 state when there is no BCLK present on the link, it will set CLKSTOP flag in the supported power states and report PS-ClkStopOk when entering D3 state. Please refer to HDA spec section 7.3.3.10 Power state and 7.3.4.12 Supported Power State. [Fixed CONFIG_PM_RUNTIME dependency in hda_intel.c by tiwai] Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.cTakashi Iwai2012-08-221-0/+2
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-linus' into for-nextTakashi Iwai2012-08-201-26/+50
|\ \ | |/ | | | | | | | | | | Conflicts: sound/pci/hda/hda_codec.c Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: hda - Fix leftover codec->power_transitionTakashi Iwai2012-08-201-0/+2
| | | | | | | | | | | | | | | | | | When the codec turn-on operation is canceled by the immediate power-on, the driver left the power_transition flag as is. This caused the persistent avoidance of power-save behavior. Cc: <stable@vger.kernel.org> [v3.5+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * Merge branch 'topic/ca0132-fix' into for-linusTakashi Iwai2012-08-201-24/+45
| |\ | | | | | | | | | | | | This is a series of fixes for CA0132, especially the missing SPDIF I/O and the mixer build errors.
| | * ALSA: hda - Add codec->pcm_format_first flagTakashi Iwai2012-08-081-24/+45
| | | | | | | | | | | | | | | | | | | | | | | | Introduced a new flag to set up the PCM stream format at first before the stream_id and channel tag. Some codecs (e.g. CA0132) seem preferring this over stream_id -> format order. Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * | ALSA : hda - bug fix on checking the supported power states of a codecMengdong Lin2012-08-101-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - Implement snd_hda_power_sync() helper functionTakashi Iwai2012-08-201-54/+28
| | | | | | | | | | | | | | | | | | | | | | | | Added a new helper function snd_hda_power_sync() to trigger the power-saving manually. It's an inline function call to snd_hda_power_save() helper function. Together with this addition, snd_hda_power_up*() and snd_hda_power_down() functions are inlined to a call of the same snd_hda_power_save() helper function. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Add tracepoints at snd_hda_power_up/down entrances.Takashi Iwai2012-08-201-0/+2
| | | | | | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Deferred probing with request_firmware_nowait()Takashi Iwai2012-08-091-1/+1
|/ | | | | | | | | | | For processing the firmware handling properly for built-in kernels, implement an asynchronous firmware loading with request_firmware_nowait(). This means that the codec probing is deferred when the patch option is specified. Tested-by: Thierry Reding <thierry.reding@avionic-design.de> Reviewed-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'topic/pm-convert' into for-nextTakashi Iwai2012-07-191-1/+1
|\ | | | | | | | | | | | | 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.
| * 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>
* | Merge branch 'topic/hda-beep' into topic/hdaTakashi Iwai2012-07-041-19/+0
|\ \
| * | ALSA: hda - Move beep helper functions to hda_beep.cTakashi Iwai2012-07-031-19/+0
| |/ | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'fix/hda' into topic/hdaTakashi Iwai2012-06-261-0/+4
|\ \ | |/
| * ALSA: hda - Initialize caches at codec reconfigurationTakashi Iwai2012-06-261-0/+2
| | | | | | | | | | | | | | Better to clean up the caches for avoiding inconsistent codec state after the reconfiguration. Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: hda - Fix memory leaks at module unloadTakashi Iwai2012-06-261-0/+2
| | | | | | | | | | | | | | 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>
* | ALSA: hda - Don't power up when not powered down.Dylan Reid2012-06-221-0/+7
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'fix/hda' into topic/hdaTakashi Iwai2012-06-201-9/+37
|\ \ | |/ | | | | The fix for power sequence needs to be merged back to topic branch.
| * ALSA: hda - Handle open while transitioning to D3.Dylan Reid2012-06-181-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ALSA: hda - power setting error checkWang Xingchao2012-06-081-3/+14
| | | | | | | | | | | | | | | | 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>
* | ALSA: hda - reduce msleep time if EPSS power states supportedWang Xingchao2012-06-071-2/+5
| | | | | | | | | | | | | | | | 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>
* | ALSA: hda - check supported power statesWang Xingchao2012-06-071-0/+16
|/ | | | | | | | 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>
* Merge tag 'hda-switcheroo' of ↵Linus Torvalds2012-05-251-27/+39
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * ALSA: hda - Export snd_hda_lock_devices()Takashi Iwai2012-05-141-27/+39
| | | | | | | | | | | | | | | | 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>
* | 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>
OpenPOWER on IntegriCloud