Commit Graph

63 Commits (f67d8176ba9a3dbc33454cd67057184b2ef5ee31)

Author SHA1 Message Date
Takashi Iwai 6acaed38a3 ALSA: hda - Use own workqueue
snd-hda-intel driver used schedule_work() fot the delayed DMA pointer
updates, but this has several potential problems:
- it may block other eventsd works longer
- it may deadlock when probing fails and flush_scheduled_work() is
  called during probe callback (as probe callback itself could be
  invoked from eventd)

This patch adds an own workq for each driver instance to solve these
problems.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-12 10:33:56 +01:00
Wu Fengguang 5a9e02e949 ALSA: hda - create hda_codec.control_mutex for kcontrol->private_value
Fix the following lockdep warning by not reusing the hda_codec.spdif_mutex.

    ALSA sound/pci/hda/hda_codec.c:882: hda_codec_cleanup_stream: NID=0x2

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.28-next-20090102 #33
    -------------------------------------------------------
    mplayer/3151 is trying to acquire lock:
     (&pcm->open_mutex){--..}, at: [<ffffffffa004ced3>] snd_pcm_release+0x43/0xd0 [snd_pcm]

    but task is already holding lock:
     (&mm->mmap_sem){----}, at: [<ffffffff810c0252>] sys_munmap+0x42/0x80

    which lock already depends on the new lock.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-09 09:58:47 +01:00
Takashi Iwai d4d9cd0338 ALSA: hda - Add probe_only option
Added probe_only module option to hd-audio driver.
This option specifies whether the driver creates and initializes the
codec-parser after probing.  When this option is set, the driver skips
the codec parsing and initialization but gives you proc and other
accesses.  It's useful to see the initial codec state for debugging.

The default of this value is off, so the default behavior is as same
as before.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-19 15:19:11 +01:00
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 bb40abe223 ALSA: hda - Remove unused proc entry in hda_bus struct
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 12:57:38 +01:00
Takashi Iwai daead538e9 ALSA: hda - Add codec-specific proc hook
Added a hook for proc outputs of codec-specific stuff.

Moved realtek-specific coeff output into patch_realtek.c as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 12:55:36 +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
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 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
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 1e1be4329f ALSA: hda - Add hints for reconfig
This patch adds the "hints" for reconfiguring codecs.  The hints
are simply string arrays and can be freely used/parsed by the codec
patch.  The hints can be input via hwdep sysfs files.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-13 02:43:04 +02: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 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
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
Takashi Iwai 955d24881e ALSA: hda - Add definitions of HDMI-related verbs
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-25 09:55:50 +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
Matthew Ranostay d0513fc6c3 ALSA: hda: added 92HD81/83 support
Added support for 92HD81/83 family of codecs.
This also includes a pwr_mapping array for pins that have more than
one amp to power down.

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-07-28 12:19:33 +02:00
Matthew Ranostay 1cd2224cd0 ALSA: hda: digital pc-beep support hd-audio codecs
Added digital pc-beep support using linear tone generation for hd-codecs along
with initial support for several IDT codecs.

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-07-20 19:17:49 +02:00
Takashi Iwai a1855d802f ALSA: hda - Fix digital converter proc output
AC_VERB_GET_DIGI_CONVERT_2 isn't actually implemented but reserved.
The whole SIC bits are returned from DIGI_CONVERT_1.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-20 14:16:01 +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
Takashi Iwai 7ba72ba1fe [ALSA] hda-intel - Fix PCM device number assignment
In the current scheme, PCM device numbers are assigned incrementally
in the order of codecs.  This causes problems when the codec number
is irregular, e.g. codec #0 for HDMI and codec #1 for analog.  Then
the HDMI becomes the first PCM, which is picked up as the default
output device.  Unfortuantely this doesn't work well with normal
setups.

This patch introduced the fixed device numbers for the PCM types,
namely, analog, SPDIF, HDMI and modem.  The PCM devices are assigned
according to the corresponding PCM type.  After this patch, HDMI will
be always assigned to PCM #3, SPDIF to PCM #1, and the first analog
to PCM #0, etc.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:07 +02: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
Andrew Paprocki 797760ab14 [ALSA] hda_proc - Add a number of new settings to proc codec output
This patch adds additional output to the /proc codec#X info.
The following pieces of information are added to the output:
-  Balanced, L/R swap, trigger, impedance sense pin capabilities
-  Vref pin capabilities
-  Current Vref pin widget control setting
-  Default configuration association, sequence, and misc bit test
-  EAPD/BTL bits conveying balanced mode, EAPD, and L/R swap
-  Power state modified to show state name as well as setting vs actual value
-  GPIO parameter output on Audio Function Group, including enumeration of IO
   pins which are indicated present (Any I and O pins are not output at this
   time)
-  Stripe and L/R swap widget capabilities
-  All digital converter bits: enable, validity, validity config, preemphasis,
   copyright, non-audio, professional, generation level, and content category
-  Converter stream and channel values for in/out widgets
-  SDI select value for in widgets
-  Unsolicited response widget capability tag and enabled bit
-  Delay widget capability value
-  Processing widget capability benign bit and number of coefficients
-  Realtek Define Registers: processing coefficient, coefficient index
[Also, fixed space/tab issues and make codes a bit more readable
  -- Takashi]

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:30:04 +01:00
Takashi Iwai 52987656fb [ALSA] hda-intel - Add workarounds for STAC codecs
Some machines with STAC codecs seem to have problems (e.g. no audible
playback) when the delay in codec-read routine is too short.
I still don't figure out which command sequence causes this problem
(due to lack of test hardware), but it's known that increasing the
delay fixes.  So, added a stupid workaround here temporarily...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:02 +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
Joe Perches 561de31a23 [ALSA] sound/: Spelling fixes
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:41 +01:00
Andrew Paprocki 38fcaf8efc [ALSA] hda-codec - Fix definition of AC_KNBCAP_DELTA to match spec
AC_KNBCAP_DELTA is incorrectly defined as (1<<8). According to the Intel
HDA spec, this is bit 7 after AC_KNBCAP_NUM_STEPS which is a 0x7f mask.

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:36 +01:00
Takashi Iwai e171613949 [ALSA] hda-intel - Show more volume-knob attributes
Show more attributs of volume-knob widgets.
Also don't put empty lines when no connection list is found.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:26 +01: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
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 cb53c626e1 [ALSA] hda-intel - Add POWER_SAVE option
Added CONFIG_SND_HDA_POWER_SAVE kconfig.  It's an experimental option
to achieve an aggressive power-saving.  With this option, the driver
will turn on/off the power of each codec and controller chip dynamically
on demand.
The patch introduces a new module option 'power_save'.  It specifies
the second of time-out for automatic power-down.  As default, it's
10 seconds.  Setting 0 means to suppress the power-saving feature.
The codec may have analog-input loopbacks, which are usually represented
by mixer elements such as 'Mic Playback Switch' or 'CD Playback Switch'.
When these are on, we cannot turn off the mixer and the codec chip has
to be kept on.  For bookkeeping these states, a new codec-callback is
introduced.
For the bus-controller side, a new callback pm_notify is introduced,
which can be used to turn on/off the contoller appropriately.
Note that this power-saving might cause slight click-noise at
power-on/off.  Also, it might take some time to wake up the codec, and
might even drop some tones at the very beginning.  This seems to be the
side-effect of turning off the controller chip.
This turn-off of the controller can be disabled by undefining
HDA_POWER_SAVE_RESET_CONTOLLER in hda_intel.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:46 +02:00
Takashi Iwai 82beb8fd36 [ALSA] hda-codec - optimize resume using caches
So far, the driver looked the table of snd_kcontrol_new used for creating
mixer elements and forces to call each of its put callbacks in PM resume
code.  This is too ugly and hackish.
Now, the resume is simplified using the codec amp and command register
caches.  The driver simply restores the values that have been written
in the cache table.  With this simplification, most codec support codes
don't require any special resume callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:43 +02:00
Takashi Iwai b3ac563641 [ALSA] hda-codec - introduce command register cache
This patch adds the cache for codec command registers.
snd_hda_codec_write_cache() and snd_hda_sequence_write_cache() do
the write operations with caching, which values can be resumed via
snd_hda_codec_resume_cache().
The patch introduces only the framework, and no codec code is using
this cache yet.  It'll be implemented in the following patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:41 +02:00
Takashi Iwai 01751f54ff [ALSA] hda-codec - rewrite amp cache more generic
Rewrite the code to handle amp cache and hash tables to be more
generic.  This routine will be used by the register caches in the
next patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:41 +02:00
Takashi Iwai 2807314d46 [ALSA] hda-intel - Add hwdep interface
Added a hwdep interface for each codec (enabled per kconfig).
This interface can be used for reading/writing HD-audio verbs
and other purposes as future extensions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:10 +02:00
Takashi Iwai d01ce99fc5 [ALSA] hda-intel - Coding style fixes
Fix codes to follow more to the standard kernel coding style.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:09 +02:00
Takashi Iwai d427c77eb2 [ALSA] hda-codec - Fix a typo
The AMP mute bit is bit 7.  No real influence since no one uses this
definition yet, though...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11 16:56:17 +02:00
Jaroslav Kysela 7f0e2f8bb8 [ALSA] HDA codec - little code & comment cleanup
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-09-23 10:37:31 +02:00
Ingo Molnar 62932df8fb [ALSA] semaphore -> mutex (PCI part)
Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-03-22 10:25:29 +01:00
Takashi Iwai 54d1740315 [ALSA] hda-codec - Fix connection list parsing
Modules: HDA Codec driver,HDA generic driver

- Fix connection list parsing (with ranged flag).
- Increase the max number of connections
- Introduce widget capabilities cache
- Power up/down widgets at init, suspend and resume

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-01-03 12:29:27 +01:00