Commit graph

123 commits

Author SHA1 Message Date
Takashi Iwai f44ac8378d ALSA: hda - Allocate name string of each codec
Allocate dynamically the name string of each codec instead of
pointing to a static string.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:00 +02:00
Takashi Iwai 603c401992 ALSA: hda - Use generic array helpers
Use generic array helpers to simplify array handling in snd-hda-intel.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:42:59 +02:00
Takashi Iwai b2e1859745 ALSA: hda - Add generic arrays
Added helper functions to handle generic arrays.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:42:58 +02:00
Takashi Iwai 176d5335fe ALSA: hda - Add infrastructure for dynamic stream allocation
Added the infrastructure for dynamic stream allocation on HD-audio.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:42:58 +02:00
Wu Fengguang 6b34500c1c ALSA: hda: comment typo fix
fix a typo in comment for is_in_nid_list().

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:51 +02:00
Wu Fengguang 5c1d1a98c5 ALSA: hda: comment typo fix
fix a typo in comment for process_unsol_events().

Signed-off-by: Wu Fengguang<wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:50 +02:00
Wei Ni 9a10eb21e1 ALSA: Support NVIDIA MCP78/7A HDMI audio
Add NVIDIA HDMI HD-audio codec support in snd-hda-intel driver,
include NVIDIA MCP78/7A HDMI.

Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:35 +02:00
Takashi Iwai 2f72853ca1 ALSA: hda - Fix / clean-up slave digital out codes
The recent slave_dig_out addition has some rooms to clean up.
Also it doesn't call snd_hda_cleanup_stream() properly for slaves
at closing.  The patch fixes both issues.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:34 +02:00
Matthew Ranostay ddc0f38a62 ALSA: hda: slave_dig_outs code block in wrong location
Removed invalid references to slave_dig_outs inside the S/PDIF IN capture switch
control. Beforehand this was basically a mute switch for the S/PDIF outs as well.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:33 +02:00
Matthew Ranostay 89385035fa ALSA: hda: Input port AMP controls
Added support for controlling hardware gain amps on input ports
using a volume control mixer with a mux selecting the port being controlled.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-23 08:17:56 +02:00
Herton Ronaldo Krzesinski 9932fbb0b3 ALSA: hda: fix oopses in snd-hda-intel after digital slave support additions
Many places fail to check if codec has slave_dig_outs entries (the most common
case is not having any entry), leading to various possible oopses in hda_codec
code.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-23 08:17:54 +02:00
Matthew Ranostay de51ca1267 ALSA: hda: slave digital out support
Added support for playing a stream on multiple digital outs. This is done
by defining codec->slave_dig_outs as array of hda_nid_t with a null-terminated entry to set the
slave SPDIF outs, in which the slave outs have cloned settings of the master out (e.g. dig_out_nid).

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-09 09:11:55 +02:00
Jaroslav Kysela ba443687f2 ALSA: hda - put all HDA codec IDs to components for precise hw detection
Export HDA codec subvendor ID and revision ID to user space via the
components variable. Our alsactl utility requires these values for
the perfect hardware identification.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 20:55:32 +02:00
Takashi Iwai 963f803fb1 ALSA: hda - Don't reset SPDIF in each status change
The SPDIF output is toggled at each time any SPDIF status bits are changed
because of the known problems on some codecs.  But, this also results in
loosing the sync, and the problem is more obvious on HDMI output over
SPDIF.  Since the toggle is necessary only for some codecs, we should
check whether this workaround is needed and skip if unnecessary.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 11:46:59 +02:00
Takashi Iwai da3cec35dd ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 11:46:38 +02:00
Takashi Iwai 62cf872a8e [ALSA] Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE
Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE to
represent its meaning more better.  This config isn't provided only
for the detection but for more verbose debug prints in general.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-27 15:56:21 +02:00
Frederik Deweerdt eaa9985b4e [ALSA] hda-codec - Fix unbalanced mutex
On Wed, Apr 02, 2008 at 08:19:29AM -0400, Miles Lane wrote:
> [   48.765906] [ BUG: bad unlock balance detected! ]
> [   48.765912] -------------------------------------
> [   48.765918] pulseaudio/4277 is trying to release lock
> (&codec->spdif_mutex) at:
> [   48.765930] [<c03031b7>] mutex_unlock+0x8/0xa
> [   48.765945] but there are no more locks to release!
> [   48.765950]
> [   48.765952] other info that might help us debug this:
> [   48.765959] 2 locks held by pulseaudio/4277:
> [   48.765965]  #0:  (&pcm->open_mutex){--..}, at: [<f89f134b>]
> snd_pcm_open+0xc1/0x1ba [snd_pcm]
> [   48.766003]  #1:  (&chip->open_mutex){--..}, at: [<f8b4f13d>]
> azx_pcm_open+0x36/0x184 [snd_hda_intel]
> [   48.766057]
> [   48.766059] stack backtrace:
> [   48.766066] Pid: 4277, comm: pulseaudio Not tainted 2.6.25-rc8-mm1 #12
> [   48.766086]  [<c013afc6>] print_unlock_inbalance_bug+0xce/0xd8
> [   48.766107]  [<c0109e1c>] ? save_stack_trace+0x1d/0x3b
> [   48.766130]  [<c012f54e>] ? __kernel_text_address+0x1b/0x27
> [   48.766146]  [<c0104533>] ? dump_trace+0xcd/0xd9
> [   48.766160]  [<c0109d9e>] ? save_stack_address+0x0/0x2c
> [   48.766176]  [<c013b80a>] ? find_usage_backwards+0xa4/0xc3
> [   48.766193]  [<c013cfb5>] lock_release_non_nested+0x84/0x120
> [   48.766209]  [<c03031b7>] ? mutex_unlock+0x8/0xa
> [   48.766222]  [<c013d1bb>] lock_release+0x16a/0x199
> [   48.766238]  [<c0303137>] __mutex_unlock_slowpath+0xa9/0x121
> [   48.766252]  [<c03031b7>] mutex_unlock+0x8/0xa
> [   48.766263]  [<f8b4ffd8>] snd_hda_multi_out_analog_open+0xd3/0xef
> [snd_hda_intel]

The following patch should fix it.

Cc: "Miles Lane" <miles.lane@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:33 +02:00
Takashi Iwai 888afa1541 [ALSA] hda-codec - keep the format verb at closing PCM streams
Keep the format verb at closing PCM streams.
Introduced snd_hda_codec_cleanup_stream() for the parcicular purpose.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:26 +02:00
Harvey Harrison 3c9a3203ff [ALSA] sound: hda: missing includes of hda_patch.h
Move the array declaration to hda_codec.c where it is used and add includes
where the individual presets are declared.

Fixes the following sparse warnings:
sound/pci/hda/patch_realtek.c:13744:25: warning: symbol 'snd_hda_preset_realtek' was not declared. Should it be static?
sound/pci/hda/patch_cmedia.c:729:25: warning: symbol 'snd_hda_preset_cmedia' was not declared. Should it be static?
sound/pci/hda/patch_analog.c:3656:25: warning: symbol 'snd_hda_preset_analog' was not declared. Should it be static?
sound/pci/hda/patch_sigmatel.c:3995:25: warning: symbol 'snd_hda_preset_sigmatel' was not declared. Should it be static?
sound/pci/hda/patch_si3054.c:286:25: warning: symbol 'snd_hda_preset_si3054' was not declared. Should it be static?
sound/pci/hda/patch_atihdmi.c:156:25: warning: symbol 'snd_hda_preset_atihdmi' was not declared. Should it be static?
sound/pci/hda/patch_conexant.c:1721:25: warning: symbol 'snd_hda_preset_conexant' was not declared. Should it be static?
sound/pci/hda/patch_via.c:1962:25: warning: symbol 'snd_hda_preset_via' was not declared. Should it be static?

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:19 +02:00
Takashi Iwai c8cd128117 [ALSA] hda-codec - Add more names to vendor list
Added more known names to the vendor id list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:10 +02:00
Takashi Iwai 9a08160bdb [ALSA] hda-codec - Add "IEC958 Default PCM" switch
Added a new mixer switch to enable/disable the sharing of the default
PCM stream with analog and SPDIF outputs.  When "IEC958 Default PCM"
switch is on, the PCM stream is routed both to analog and SPDIF outputs.
This is the behavior in the earlier version.

Turning this switch off has a merit for some codecs, though.  Some codec
chips don't support 24bit formats for SPDIF but only for analog outputs.
In this case, you can use 24bit format by disabling this switch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:10 +02:00
Takashi Iwai 5832fcf8b5 [ALSA] hda-codec - More fix-up for auto-configuration
In some cases, the BIOS sets up only the HP pins with different assoc
and sequence numbers, e.g. on FSC Esprimo with ALC262.

This patch adds a fix-up for such a case.  When multiple HPs are defined
and no line-outs is found, the configurator tries to re-assign some pins
from HP list to line-out, judging from the sequence number.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:10 +02:00
Takashi Iwai 09f9970139 [ALSA] hda-codec - Allow multiple SPDIF devices
The current code doesn't allow multiple SPDIF devices, and causes
errors when multiple SPDIF devices are found (e.g. SPDIF out and HDMI).
This patch allows multiple SPDIF devices by incrementing the index
automatically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:06 +02:00
Takashi Iwai 2f08554977 [ALSA] hda-codec - Don't create vmaster if no slaves found
Don't create vmaster controls if no slaves are found in the given list.
This prevents the error due to an empty vmaster control.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-22 14:20:09 -08:00
Serge A. Suchkov 14c65f98bf [ALSA] hda-codec - Fix race condition in generic bound volume/swtich controls
Attached patch fix race condition in hd_codec generic bound volume/swtich
controls

oops on this bug can be easy reproduced by two mixer apps on SMP system with
PREEMPT kernel

dmesg:

 ALSA /home/ss/ALSA/alsa-driver-1.0.16/pci/hda/../../alsa-kernel/pci/hda/hda_intel.c:596:
 hda_intel: azx_get_response timeout, switching to polling mode: las
 t cmd=0x014f0900
 BUG: unable to handle kernel paging request at virtual address 00070006
 printing eip: f8f43e95 *pde = 00000000
 Oops: 0000 [#1] PREEMPT SMP
 Modules linked in: i915 drm snd_seq_dummy snd_seq_oss snd_seq_midi_event
 snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss bnep rfcomm hidp l2cap
 bluetooth w
 lan_wep acpi_cpufreq coretemp hwmon mmc_block pcspkr psmouse wlan_scan_sta
 ath_rate_sample snd_hda_intel ath_pci serio_raw wlan tg3 sdhci snd_pcm
 firewire_o
 hci mmc_core i2c_i801 snd_timer firewire_core snd_page_alloc ath_hal(P)
 snd_hwdep snd iTCO_wdt crc_itu_t iTCO_vendor_support shpchp video output
 acer_acpi b
 acklight led_class wmi_acer

 Pid: 3969, comm: gkrellm Tainted: P        (2.6.24-jm #4)
 EIP: 0060:[<f8f43e95>] EFLAGS: 00010292 CPU: 0
 EIP is at snd_hda_mixer_bind_ctls_info+0x20/0x43 [snd_hda_intel]
 EAX: 00000000 EBX: f7478e00 ECX: f763e000 EDX: f764f788
 ESI: 00070002 EDI: edce5e00 EBP: edc3fe64 ESP: edc3fe54
  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
 Process gkrellm (pid: 3969, ti=edc3e000 task=f1e4e000 task.ti=edc3e000)
 Stack: f764f77c f7478e00 edce5e00 f6dd6000 edc3fe84 f8e590e8 edc7a239 f6d14034
       f764f34c f6c0f7e0 edc3ff30 f6d14034 edc3fea8 f8e591b7 edc3ff30 edc3ff2c
       00000000 f70aa668 f6d14034 f8e59165 bfbfadb0 edc3ff40 f8e587aa edc3ff2c
 Call Trace:
 [<c0104fbb>] show_trace_log_lvl+0x1a/0x2f
 [<c010506d>] show_stack_log_lvl+0x9d/0xa5
 [<c0105119>] show_registers+0xa4/0x1bd
 [<c0105354>] die+0x122/0x206
 [<c03daccc>] do_page_fault+0x535/0x623
 [<c03d940a>] error_code+0x72/0x78
 [<f8e590e8>] snd_mixer_oss_get_volume1_vol+0x74/0xf1 [snd_mixer_oss]
 [<f8e591b7>] snd_mixer_oss_get_volume1+0x52/0xa5 [snd_mixer_oss]
 [<f8e587aa>] snd_mixer_oss_ioctl1+0x673/0x71e [snd_mixer_oss]
 [<f8e588af>] snd_mixer_oss_ioctl+0xb/0xd [snd_mixer_oss]
 [<c017af0a>] do_ioctl+0x22/0x67
 [<c017b186>] vfs_ioctl+0x237/0x24a
 [<c017b1ca>] sys_ioctl+0x31/0x4b
 [<c010402e>] syscall_call+0x7/0xb
 =======================
 Code: 3f 49 c7 89 f8 59 5b 5e 5f 5d c3 55 89 e5 57 89 d7 56 53 89 c3 83 ec 04
 8b 70 5c 8b 40 60 05 7c 01 00 00 89 45 f0 e8 c0 3f 49 c7 <8b> 46 04 89 fa 89
 4
 3 5c 89 d8 8b 0e ff 11 89 73 5c 89 c7 8b 45
 EIP: [<f8f43e95>] snd_hda_mixer_bind_ctls_info+0x20/0x43 [snd_hda_intel]
 SS:ESP 0068:edc3fe54
 ---[ end trace 0a20bc209e9397cc ]---

similar issue report present in ALSA bugtracking system
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3652

Signed-off-by: Serge A. Suchkov <Serge.A.S@tochka.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-22 14:20:09 -08:00
Matthew Ranostay 09a9995918 [ALSA] hda: Add dynamic mono mixer support for STAC92xx codecs
Allows for dynamically creating mono out mixer controls and well
as mono mux controls.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:13 +01:00
Matthew Ranostay 90da78bf6a [ALSA] hda: Added mono_out_pin to autoconfig
Added a mono_out_pin field to autocfg struct, and code to parse
for the mono_out_line.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:13 +01:00
Takashi Iwai 0ef6ce7b6a [ALSA] hda-codec - Optimize snd_hda_pser_pin_def_config()
Don't read the widget list again as we already have it at the beginning.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:10 +01:00
Marc Boucher ca7cfae9eb [ALSA] hda-codec - Add afg and mfg preset mask
Added afg and mfg preset masks for more finer codec-preset selection.

Signed-off-by: Marc Boucher <marc@linuxant.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:10 +01:00
Marc Boucher d2595d86e5 [ALSA] hda-codec - Add a delay after power state change
Added a delay after the power state change as a partial workaround
for 'hda_intel: azx_get_response timeout' problem on Cxt codecs.

Signed-off-by: Marc Boucher <marc@linuxant.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:10 +01:00
Takashi Iwai 9c8f2abdc5 [ALSA] hda-codec - print control name in error messages
Print the name of the defect controls in error messages in amp info
callback.  This will make debugging easier.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:55 +01:00
Takashi Iwai 2134ea4f37 [ALSA] hda-codec - Add virtual master controls
Add master controls using vmaster to codecs that have no real hardware
master volume registers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:54 +01:00
Takashi Iwai 9004acc70e [ALSA] Remove sound/driver.h
This header file exists only for some hacks to adapt alsa-driver
tree.  It's useless for building in the kernel.  Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it.  This should be really killed in
future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:48 +01:00
Andrew Paprocki 3982d17e3d [ALSA] hda-codec - Add missing #defines (and 1 rename) in hda_codec.h
Added AC_VERB_GET_DIGI_CONVERT_2 and renamed AC_VERB_GET_DIGI_CONVERT to
AC_VERB_GET_DIGI_CONVERT_1 to stay consistent with the SET variants. Added
AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK,
and AC_PINCAP_LR_SWAP. The missing fields were listed in the ALC883 datasheet
rev 1.3.

Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:42 +01:00
Takashi Iwai 68ea7b2f2d [ALSA] hda-codec - Check value range in ctl callbacks
Check the value ranges in ctl put callbacks properly so that
invalid values won't be stored or written to registers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:24 +01:00
Takashi Iwai f889fa91ad [ALSA] hda-codec - Improve the auto-configuration
Some small improvements on autocfg stuff:
- sort HP pins by sequence number, too
- move sole mic pin to AUTO_PIN_MIC instead of AUTO_PIN_FRONT_MIC
- ditto for line-in pin

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:15 +01:00
Matthew Ranostay 7f16859a83 [ALSA] hda-codec - Add STAC9228 DMIC support
Added the missing STAC9228 DMIC support.
Also added a new vendor id tag for IDT.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:06 +01:00
Takashi Iwai 7eba5c9dc3 [ALSA] hda-codec - Check PINCAP only for PIN widgets
The recent addition of checking PINCAP for EAPD seems to break some
systems due to unexpected response from the codec chip.  We shouldn't
issue GET_PINCAP verb to non-PIN widgets.  Now checks the widget type
before checking EAPD bit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-11-19 18:38:32 +01:00
Takashi Iwai d29240ce57 [ALSA] hda-codec - Disable shared stream on AD1986A
AD1986A has a hardware problem that it cannot share a stream with
multiple pins properly.  The problem occurs e.g. when a volume is changed
during playback.
So far, hda-intel driver unconditionally assigns the stream to multiple
output pins in copy-front mode, and this should be avoided for AD1986A
codec.
The original fix patch was by zhejiang <zhe.jiang@intel.com>.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-11-19 18:38:32 +01:00
Takashi Iwai 35a1e0cce6 [ALSA] hda-codec - Fix build without CONFIG_SND_HDA_GENERIC
Fixed the build error from patch_sigmatel.c when built without
CONFIG_SND_HDA_GENERIC by defining a dummy function to return error.
Also, clean up hda_codec.c by removing unneeded ifdefs (the compiler
will optimize out).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-23 08:04:35 +02:00
Takashi Iwai 1194b5b70a [ALSA] hda-codec - Fix Gateway laptops with STAC9200
Fix the output of Gateway laptops with STAC9200 codec chip.
They require the EAPD control for some pins.  These pins shouldn't be
powered down.
To enable EAPD control, a new model 'gateway' was added to STAC9200.
The known PCI SSIDs are included in the quirk list.
The fix was originally suggested by Brian Hinz, in ALSA bug#2948.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:51:08 +02:00
Takashi Iwai 5513b0c582 [ALSA] hda-codec - Add zero checks in input-mux helper functions
Added zero checks in input-mux helper functions to avoid Oops.
Some devices may have no input pins while the driver registers
control elements calling these functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:51:07 +02:00
Takashi Iwai 7a5a27cfae [ALSA] Add default values for power-saving as Kconfig options
Added CONFIG_SND_AC97_POWER_SAVE_DEFAULT and CONFIG_SND_HDA_POWER_SAVE_DEFAULT
Kconfig options as the default values for power-saving mode of AC97 and
HD-audio drivers, respectively.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:51 +02:00
Danny Tholen e8a7f136f5 [ALSA] hda-intel - Improve HD-audio codec probing robustness
When modem is disabled in the BIOS, detection of the number of codecs
always fails after booting if STATESTS is not cleared first.
This patch fixes this problem and also adds an error check in a place
where a read error would lead to a very large number of pointless loops.

Signed-off-by: Danny Tholen <obiwan@mailmij.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:20 +02:00
Maxim Levitsky d804ad9258 [ALSA] hda-intel - Fix resume logic, when dynamic power managment is on
Comment in hda_intel.c states that 'the explicit resume is needed only
when POWER_SAVE isn't set', but this is not true.
There is no code that will automaticly power up the codec on resume,
but only code that powers it up when user accesses it. So if user
leaves a sound playing, codec will not be powered
To fix that I check if there are any codecs that should be powered
codec->power_count, and if so I power them up together with main
controller.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:47 +02:00
Maxim Levitsky 2e4924628a [ALSA] hda-intel - fix a race in dynamic power managment
codec->power_transition is supposed to be true while codec is going
to be shut off if in the mean time somebody calls snd_hda_power_up,
hda_power_work will not shut down the codec, but nether will clear
codec->power_transition, thus it stays on forever. Fix this.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:46 +02:00
Takashi Iwai 1fcaee6ee2 [ALSA] hda-intel - Fix compile with gcc-3.x
gcc-3.x doesn't like forward inlining:
  CC [M]  sound/pci/hda/hda_codec.o
sound/pci/hda/hda_codec.c: In function 'snd_hda_codec_free':
sound/pci/hda/hda_codec.c:517: sorry, unimplemented: inlining failed in call to 'free_hda_cache': function body not available
sound/pci/hda/hda_codec.c:534: sorry, unimplemented: called from here
sound/pci/hda/hda_codec.c:517: sorry, unimplemented: inlining failed in call to 'free_hda_cache': function body not available
sound/pci/hda/hda_codec.c:535: sorry, unimplemented: called from here

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:24 +02:00
Takashi Iwai a221e287ab [ALSA] hda-intel - Avoid unnecessary work scheduling
Avoid unnecessary work scheduling for power-off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:07 +02:00
Takashi Iwai 2525fdc42f [ALSA] hda-intel - Add flush_scheduled_work() in snd_hda_codec_free()
Added flush_scheduled_work() in snd_hda_codec_free() to make sure that
the all work is gone.  Also, optimized the condition to schedule the
delayed work in snd_hda_power_down().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:59 +02:00
Takashi Iwai 0b7a2e9cef [ALSA] hda-intel - Don't do suspend if already powered down
In the power-saving mode, the suspend is done dynamically at power-down.
So we don't have to call suspend stuff explicitly if it's already
powered down.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:55 +02:00