Commit graph

151 commits

Author SHA1 Message Date
Takashi Iwai
0640f84fac Merge branch 'topic/hda-modularize' into topic/hda 2008-12-03 14:43:14 +01:00
Takashi Iwai
ff7a326736 ALSA: hda - Don't export symbols when built-in kernel
The global functions in hda_codec.c and other core parts are only
for HD-audio codec and controller drivers.  When the HD-audio driver
is built in kernel, all stuff have to be statically linked, thus
we don't need any exports.

This patch introduces a conditional macro to do export only
when needed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 15:22:02 +01:00
Takashi Iwai
645f10c1ac ALSA: hda - Check MODULE instead of CONFIG_SND_HDA_INTEL_MODULE
Checking MODULE is more generic.
Also a cosmetic comment change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 15:07:37 +01:00
Takashi Iwai
56d17712d5 ALSA: hda - Clear codec->proc_widget_hook at reset
Clear the remaining pointer at snd_hda_codec_reset() to avoid Oops.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 14:41:09 +01:00
Takashi Iwai
1289e9e8b4 ALSA: hda - Modularize HD-audio driver
Split the monolithc HD-audio driver into several pieces:
 - snd-hda-intel   HD-audio PCI controller driver; loaded via udev
 - snd-hda-codec   HD-audio codec bus driver
 - snd-hda-codec-* Specific HD-audio codec drivers

When built as modules, snd-hda-codec (that is invoked by snd-hda-intel)
looks up the codec vendor ID and loads the corresponding codec module
automatically via request_module().

When built in a kernel, each codec drivers are statically hooked up
before probing the PCI.

This patch adds appropriate EXPORT_SYMBOL_GPL()'s and the module
information for each driver, and driver-linking codes between
codec-bus and codec drivers.

TODO:
  - Avoid EXPORT_SYMBOL*() when built-in kernel
  - Restore __devinit appropriately depending on the condition

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-27 15:47:11 +01:00
Takashi Iwai
529bd6c4a6 ALSA: hda - Fix PCM reconfigure
The reconfiguration of PCM affected all PCM streams on the bus, but
this this should be done rather only for the target codec.

This patch does the following:
- introduce bitmap indicating the PCM device usages on a hda_bus
- refactor the PCM build functions
- fix __devinit prefix in some fucntions
- add a proper ifdef around HDA-reconfig-specific functions

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-27 14:17:01 +01:00
Takashi Iwai
fee2fba358 ALSA: hda - Move power_save option to hda_intel.c
Move power_save option into hda_intel.c, and make a field in hda_bus,
instead of keeping module parameters in separate files.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-27 12:43:28 +01:00
Takashi Iwai
986862bdf1 ALSA: hda - make some functions static
Minor clean ups: move snd_hda_codecs_inuse() into hda_intel.c and
make static.  Also, make snd_hda_query_supported_pcm() static
as it's used only in hda_codec.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-27 12:40:13 +01:00
Qinghuang Feng
4f199629b0 ALSA: sound/pci/hda/hda_codec.c: cleanup kernel-doc
There is no argument named @state in snd_hda_resume,
remove its' comment.

Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-26 08:14:41 +01:00
Takashi Iwai
0e19e7d2bf Merge branch 'topic/fix/hda' into topic/hda
Conflicts:
	sound/pci/hda/patch_sigmatel.c
2008-11-25 11:56:25 +01:00
Takashi Iwai
9e97697666 ALSA: hda - Fix caching of SPDIF status bits
SPDIF status bits controls are written via snd_hda_codec_write()
without caching.  This causes a regression at resume that the bits
are lost.

Simply replacing it with the cached version fixes the problem.

Reference:
	http://lkml.org/lkml/2008/11/24/324

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-25 10:31:44 +01:00
Takashi Iwai
b20222667d ALSA: hda - Fix build without CONFIG_PROC_FS
snd_print_pcm_rates() and snd_print_pcm_bits() are used by both
hda_proc.c and hda_eld.c, thus they have to be defined in the common
place.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-21 21:24:03 +01:00
Takashi Iwai
b94d3539de ALSA: hda - Fix double free of jack instances
The jack instances created in patch_sigmatel.c may be double-freed.
The device management code checks the invalid element, and thus there
is no real breakage, but it spews annoying warning messages.
But, we can't simply remove the release calls of these jack instances
because they have to be freed when the codec is re-configured.

Now, a new flag, bus->shutdown is introduced to indicate that the bus
is really being unloaded, i.e. the objects managed by the device
manager will be automatically deleted.  We release these objects only
when this flag isn't set.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-21 09:08:06 +01:00
Takashi Iwai
f43aa025b7 ALSA: hda - Fix another cache list management
Fix another silly bug in the amp cache list management.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-10 16:24:26 +01:00
Takashi Iwai
ea2da6e898 ALSA: hda - Fix broken hash chain allocation
The chaining for amp hash got broken due to the rewrite with
snd_array.  Fixed now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-07 00:51:36 +01:00
Takashi Iwai
b910d9ae5b ALSA: hda - Add max allocation check in array allocator
Added a check for max allocation size in snd_array_new() for a
debugging purpose.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-07 00:26:52 +01:00
Takashi Iwai
c217429b14 ALSA: hda - Add missing NULL check in amp hash allocation
Added the missing NULL check from allocator in get_alloc_hash().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-07 00:23:30 +01:00
Takashi Iwai
33fa35ed0d ALSA: hda - simplify hda_bus ops callbacks
The hda_bus ops callback take struct hda_bus pointer.
Also, the command callback takes the composed command word, instead of
each small bits in arguments.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-06 16:50:40 +01:00
Wu, Fengguang
91504877c5 ALSA: hda - Intel HDMI audio support
Add support for Intel G45 integrated HDMI audio codecs.

This initial release supports:
	- 2 channel stereo sound output
	- report monitor's ELD information

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-05 07:54:03 +01:00
Takashi Iwai
bfc5c26fb6 ALSA: hda - Don't create empty PCM streams
Due to the hda-reconfiguration patches, the check of empty stream
is gone, and this results in an error with the codec setup with empty
streams.

This patch adds the check again to avoid the error at probing.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-04 17:48:39 +01:00
Takashi Iwai
b91f080f51 ALSA: hda - Fix possible NULL dereference
Add NULL-check of the return value of snd_kctl_new1() before
accessing it.  Also, make a sanity NULL check to snd_BUG_ON()
for debugging only.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-04 08:43:08 +01:00
Takashi Iwai
1b063c3d09 Merge branch 'topic/fix/hda' into topic/hda 2008-10-29 08:17:05 +01:00
Mark Brown
8199de3b29 ALSA: hda: Add HDA vendor ID for Wolfson Microelectronics
Add Wolfson Microelectronics to the HDA vendor ID table.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-28 16:15:42 +01:00
Matthew Ranostay
50a9f7905f ALSA: hda: add snd_hda_get_jack* functions
This patch adds snd_hda_get_jack* functions for reporting jack location,
device, and connectivity type.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-27 08:15:15 +01:00
Takashi Iwai
11aeff082a ALSA: hda - Add init_verbs entries
This patch enables the additional init verbs for each codec.  The verbs
can be entered via hwdep sysfs file.  These verbs are executed at
reconfiguring the codec for non-standard setups like overriding
the pin-defcfg.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:03 +02:00
Takashi Iwai
d7ffba19ce ALSA: hda - Add sysfs entries to hwdep devices
Added the sysfs entries to hwdep devices so that the new features
like reconfiguration can be done via sysfs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:02 +02:00
Takashi Iwai
6c1f45ea89 ALSA: hda - Add codec reconfiguration feature
Added the reconfiguration feature of any individual codec.
Via the reconfiguration, the old resources are released and
the patch is called again to recreate the PCM and mixers in
addition to the re-initialization.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:02 +02:00
Takashi Iwai
d13bd412dc ALSA: hda - Manage kcontrol lists
Manage all kcontrol elements created in the hda-intel driver.
This makes it possible to remove and reconfigure the controls
of each codec.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:01 +02:00
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