Takashi Iwai [Mon, 7 Jan 2013 08:57:42 +0000 (09:57 +0100)]
ALSA: hda - Add missing slave names for Speaker Surround, etc
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 7 Jan 2013 08:50:52 +0000 (09:50 +0100)]
ALSA: hda - Prefer binding the primary CLFE output
When 5.1 or more multiple speakers with found but not enough DACs are
available, it's better to bind such pins to the DACs of the primary
outputs with the same channels rather than binding to the first DAC
(i.e. the front channel). For the cases with two speaker pins, it's
rather regarded as front + bass combination, thus it's more practical
to still bind to the front, though.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 7 Jan 2013 08:43:18 +0000 (09:43 +0100)]
ALSA: hda - Fix truncated control names
... like "Speaker Surround Playback Switch".
This fix had been already applied to patch_conexant.c but was
forgotten in other places, then migrated to hda_generic.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 15:42:48 +0000 (16:42 +0100)]
ALSA: hda - Add Loopback Mixing control
For codecs that have individual routes going through a loopback mixer
(like VIA codecs), we need to provide an explicit switch to choose
whether the output goes through mixer or directly from DAC.
This patch adds the check for such paths and creates "Loopback Mixing"
enum control when available.
It won't influence on codecs like Realtek or others where the loopback
mixer is connected independently from the primary output routes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 14:41:41 +0000 (15:41 +0100)]
ALSA: hda - Correct aamix output paths
The output paths including aamix should be parsed only for the first
output. The surround paths including aamix must be wrong, since it
would mix all streams, i.e. all channels would be mixed into a single
and multiplexed again.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 14:09:42 +0000 (15:09 +0100)]
ALSA: hda - Initialize digital-input path properly
Call the path activation for the digital input pin properly, not only
setting the pin control. Also add spec->digin_path for keeping the
path index.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 14:01:40 +0000 (15:01 +0100)]
ALSA: hda - Manage using output/loopback path indices
Instead of search for the path with the certain route at each time,
keep the path index for each output and loopback, and just use it when
referred.
In this implementation, the path index number begins with one, not
zero (although I've been writing in C over decades). It's just to
make the check for uninitialized values easier.
So far, the input paths aren't handled with indices yet, but still
picked up via snd_hda_get_nid_path() at each time.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 14:00:02 +0000 (15:00 +0100)]
ALSA: hda - Fix multi-io pin assignment in create_multi_out_ctls()
The multi-io pins are calculated with a blind assumption of
cfg->line_outs = 1. This isn't always true.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 13:50:04 +0000 (14:50 +0100)]
ALSA: hda - Simplify the multi-io assignment with multi speakers
When speakers are chosen as the the primary output during evaluation,
we did some tricks to assign the possible multi-io jacks with a
certain offset value to multi_out dacs. This was a workaround for the
case with multiple speakers like Acer Aspire. But this is quite ugly
at the same time and the resultant code is hard to understand. More
badly, it works wrongly for 2.1 speakers like Apple iMac91.
In this patch, instead of fiddling with the offset to multi_out dacs,
simply add a certain badness number if headphone(s) + multi-ios are
possible. This simplify the code a bit, and it's more robust.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 12:19:55 +0000 (13:19 +0100)]
ALSA: hda - Check the existing path in snd_hda_add_new_path()
If the requested path has been already added, return the existing path
instance instead of adding a duplicated instance.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 4 Jan 2013 11:56:52 +0000 (12:56 +0100)]
ALSA: hda - Avoid duplicated path creations
When the paths are created in map_singles(), we don't have to
re-create new paths in try_assign_dacs(). Just evaluate the badness
and skip to the next item.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 3 Jan 2013 15:33:02 +0000 (16:33 +0100)]
ALSA: hda - Initialize output paths with current active states
Set path->active flag at the path creation time and let the paths
initialized according to the current path->active state in
set_output_and_unmute(). This allows to modify the active flag of
some output paths dynamically, e.g. switching the front output route
with or without aamix like patch_via.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 3 Jan 2013 15:30:04 +0000 (16:30 +0100)]
ALSA: hda - Don't skip amp init for activated paths
activate_amp() in the generic parser checks whether the given NID is
included in any active paths and skips it if found. This was a
workaround for avoiding disabling the widgets in the active paths when
one path is disabled, thus it shouldn't be applied to the case for
path activation. Due to this wrong check, some analog loopback paths
haven't been initialized correctly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 3 Jan 2013 14:55:06 +0000 (15:55 +0100)]
ALSA: hda - Add hooks for HP/line/mic auto switching
... as a preliminary work for migrating patch_sigmatel.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 3 Jan 2013 14:25:11 +0000 (15:25 +0100)]
ALSA: hda - Revive snd_hda_get_conn_list()
Manage the connection list cache using linked lists instead of
snd_array, and revive snd_hda_get_conn_list() again, so that we don't
have to keep the expanded values locally.
This will reduce the stack usage by recursive call of
snd_hda_get_conn_index() or parse_nid_path() of the generic parser.
The list management doesn't include any mutex protection, thus the
caller needs to take care of race appropriately.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 21 Dec 2012 14:31:41 +0000 (15:31 +0100)]
ALSA: hda - Add codec->inv_jack_detect flag
Yet another broken hardware workaround: there are hardware indicating
the inverted jack detection bit result.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 21 Dec 2012 14:23:01 +0000 (15:23 +0100)]
ALSA: hda - Add inv_eapd flag to struct hda_codec
Add the new flag, codec->inv_eapd, indicating that the EAPD
implementation is inverted.
There are always broken hardware in the world.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 21 Dec 2012 13:09:42 +0000 (14:09 +0100)]
ALSA: hda - Implement independent HP control
Similar like the implementation in patch_analog.c and patch_via.c,
the generic parser can provide the independent HP PCM stream now.
It's enabled when spec->indep_hp is set by the caller while parsing.
Currently no dynamic PCM switching as in patch_via.c is implemented
yet. The control returns -EBUSY when the value is changed during PCM
operations.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 17:29:16 +0000 (18:29 +0100)]
ALSA: hda - Allow aamix in the primary output path
Allow the path including the loopback mixer widget in the primary
output channel as an alternative in the generic codec parser.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 17:10:51 +0000 (18:10 +0100)]
ALSA: hda - Define HDA_PARSE_* for snd_hda_parse_nid_path() argument
... instead of numbers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 16:56:57 +0000 (17:56 +0100)]
ALSA: hda - Fix typos in debug_show_configs()
It never showed the 4th line out and headphone pins since quite ago.
Oh well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 16:54:22 +0000 (17:54 +0100)]
ALSA: hda - Add more debug prints about new paths
Add a better debug print code to show the new assigned paths in
generic parser. It appears only with CONFIG_SND_DEBUG_VERBOSE=y.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 16:05:20 +0000 (17:05 +0100)]
ALSA: hda - Drop spec->channel_mode field from hda_gen_spec
It's never used in the generic parser. It was there from the old
Realtek code, which has been dropped quite ago, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 15:58:39 +0000 (16:58 +0100)]
ALSA: hda - Fix PCM name string for generic parser
When a PCM name string is generated from the chip name, it might
become strange like "CX20549 (Venice) Analog". In this patch, the
parser tries to drop the invalid words like "(Venice)" in the PCM name
string. Also, when the name string is given beforehand by the caller,
respect it and use it as is.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 14:38:40 +0000 (15:38 +0100)]
ALSA: hda - Use cached version for changing pins in hda_generic.c
There is no reason to avoid snd_hda_set_pin_ctl_cache() there.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 14:36:30 +0000 (15:36 +0100)]
ALSA: hda - Dynamically turn on/off EAPD in generic codec driver
When spec->own_eapd_ctl isn't set, try to turn on/off EAPD on demand
for each pin.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 14:29:21 +0000 (15:29 +0100)]
ALSA: hda - Fix initialization of primary outputs in hda_generic.c
There were some old codes that look not stable enough, which was
derived from the old Realtek code. The initialization for primary
output in init_multi_out() needs to consider the case of shared DAC.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 14:27:24 +0000 (15:27 +0100)]
ALSA: hda - Refactor init_extra_out() in hda_generic.c
Just a small clean up by splitting a function.
No functional changes at all.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 14:16:09 +0000 (15:16 +0100)]
ALSA: hda - Clear unsol enable bits on unused pins in generic parser
For preliminary works to migrate the generic parser for Conexant
codecs: the same function is ported to hda_generic.c.
But now it looks through the jack detect table so that it can cover
better.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 13:57:18 +0000 (14:57 +0100)]
ALSA: hda - Add spec->vmaster_mute_enum flag to generic parser
Add a flag to indicate whether the vmaster mute hook enum is exposed
or not. Conexant codecs may want not to expose the control depending
on the model.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 13:46:57 +0000 (14:46 +0100)]
ALSA: hda - Begin HDA_GEN_* event tag from 1
... to distinguish from the invalid event type.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 13:42:42 +0000 (14:42 +0100)]
ALSA: hda - Increase the max depth of widget connections
Old codecs like
AD1986A tend to have long paths as they were just made
to be the way like AC97. The current max depth 5 can be too short for
such devices.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 11:58:12 +0000 (12:58 +0100)]
ALSA: hda - Avoid access of amp cache element outside mutex
The access to a cache array element could be invalid outside the
mutex, so copy locally for the later references.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 11:54:18 +0000 (12:54 +0100)]
ALSA: hda - Fix wrong dirty check in snd_hda_codec_resume_amp()
The dirty entry has to be checked at the beginning in the loop, not in
the inner loop for channels. This caused a regression that the right
channel isn't properly written.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:50:58 +0000 (11:50 +0100)]
ALSA: hda - Do sequential writes in snd_hda_gen_init()
This would reduce the number of actually executed verbs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:48:54 +0000 (11:48 +0100)]
ALSA: hda - Add / fix comments about capture vol/sw controls in hda_generic.c
A bit of details won't hurt.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:43:47 +0000 (11:43 +0100)]
ALSA: hda - Add missing amp cache flush for bound capture vol/sw ctls
The bound capture volume and switch controls use the cached amp
updates, but it's missing the flushing at the end.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:41:54 +0000 (11:41 +0100)]
ALSA: hda - Add snd_hda_codec_flush_*_cache() aliases
It makes easier to understand although these are identical with
snd_hda_codec_resume_*() functions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:33:20 +0000 (11:33 +0100)]
ALSA: hda - Flush dirty amp caches before writing inv_dmic fix
The inverted dmic fix overwrites the right channel amp value, but it
would work only when the amp values have been already actually
written. Put snd_hda_codec_resume_amp() before the amp write for
flushing caches.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:17:17 +0000 (11:17 +0100)]
ALSA: hda - Check CORB overflow
Add an overflow check of CORB in HD-audio controller and codec drivers
so that flood of sequential writes would work properly.
In the controller side, add a check of CORB read-pointer to make
returning -EAGAIN when it's full. Meanwhile in the codec side, when
-EAGAIN error is received, it retries the write after flushing the
pending verbs (calling get_response() essentially does it).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:02:00 +0000 (11:02 +0100)]
ALSA: hda - Clear cached_write flag in snd_hda_codec_resume_*()
These functions are supposed to be called at finishing the cached
sequential writes, so clear the flag properly for lazy developers who
often forget details.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 10:00:21 +0000 (11:00 +0100)]
ALSA: hda - Clear dirty flag upon cache write
When verbs or amps are actually written to the hardware, we can clear
dirty flag so that the later snd_hda_codec_resume_*() calls can skip
these verbs / amps.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 20 Dec 2012 09:45:55 +0000 (10:45 +0100)]
ALSA: hda - Allow one chance for zero NID in connection list
The commit [
2e9bf24: ALSA: hda_codec: Check for invalid zero
connections] trims the whole connection list when an invalid value is
reported by the hardware. But some codecs (at least
AD1986A) may give
a zero NID in the middle of the connection list, so dropping the whole
list isn't good for such cases.
In this patch, as a workaround, allow a single zero NID in the read
connection list. If it hits zero twice, it's handled as an error, so
that we can avoid "too many connections" errors.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 16:41:52 +0000 (17:41 +0100)]
ALSA: hda - Use "Capture Source" for single sources
In general we prefer "Capture Source" to "Input Source".
The latter was chosen in many places just because "Capture Source"
label doesn't work well with the current alsa-lib mixer abstraction
when multiple instances are present. But when we know that there is a
single input-source element, we can safely choose "Capture Source"
label.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 14:22:24 +0000 (15:22 +0100)]
ALSA: hda - Use generic parser codes for Realtek driver
The next migration step is to use the common code in generic driver
for Realtek driver. This is no drastic change and there should be no
real functional changes, as the generic parser code comes from Realtek
driver originally.
As Realtek driver requires the generic parser code, it needs a
reverse-selection of CONFIG_SND_HDA_GENERIC kconfig.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 14:16:44 +0000 (15:16 +0100)]
ALSA: hda - Export standard jack event handlers for generic parser
These handlers are supposed to be called externally from the codec
drivers once when they need to handle own jack events.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 14:15:10 +0000 (15:15 +0100)]
ALSA: hda - Fix NULL dereference in snd_hda_gen_build_controls()
When no controls are assigned in the parser (e.g. no analog path),
spec->kctls.list is still NULL. We need to check it before passing to
snd_hda_add_new_ctls().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 13:41:21 +0000 (14:41 +0100)]
ALSA: hda - Move the call of snd_hda_parse_pin_defcfg() from snd_hda_gen_parse_auto_config()
In some cases, we want to manipulate the auto_pin_cfg table before
passing to snd_hda_gen_parse_auto_config() (e.g. Realtek SSID check
code fiddles with the headphone pin). Also passing ignore_pins just
for snd_hda_parse_pin_defcfg() isn't good.
In this patch, snd_hda_gen_parse_auto_config() is changed to receive
the auto_pin_cfg table to be parsed. The passed auto_pin_cfg table
must have been initialized (typically by calling
snd_hda_gen_parse_auto_config()) beforehand by the caller.
Also together with this change, spec->parse_flags is also removed.
Since this was referred only at the place calling
snd_hda_parse_pin_defcfg(), no longer needed to be kept in spec.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 13:38:33 +0000 (14:38 +0100)]
ALSA: hda - Export snd_hda_gen_add_kctl()
It may be used in other codec drivers, so let it free.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 12:01:54 +0000 (13:01 +0100)]
ALSA: hda - Add EAPD control to generic parser
Enable EAPD in output path initializations automatically unless the
new flag spec->own_eapd_ctl is set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 11:52:06 +0000 (12:52 +0100)]
ALSA: hda - Merge Realtek parser code to generic parser
Finally the whole generic parser code in Realtek driver is moved into
hda_generic.c so that it can be used for generic codec driver.
The old dumb generic driver is replaced. Yay.
The future plan is to adapt this generic parser for other codecs,
i.e. the codec driver calls the exported functions in generic driver
but adds some codec-specific fixes and setups.
As of this commit, the complete driver code is still duplicated in
Realtek codec driver. The big code reduction will come from now on.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 11:24:03 +0000 (12:24 +0100)]
ALSA: hda/realtek - Remove redundant argument from alc_mux_select()
The argument "force" is always false in the recent code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Nov 2012 08:56:50 +0000 (09:56 +0100)]
ALSA: hda - More generic auto-mic switching for Realtek codecs
This patch extends the capability of the auto-mic feature.
Instead of limiting the automatic input-source selection only to the
mics (internal, external and dock mics), allow it for generic inputs,
e.g. switching between the rear line-in and the front mic.
The logic is to check the attribute and location of input pins, and
enable the automatic selection feature only if all such pins are in
different locations (e.g. internal, front, rear, etc) and line-in or
mic pins. That is, if multiple input pins are assigned to a single
location, the feature isn't enabled because we don't know the
priority.
(You may wonder why this restriction doesn't exist for the headphone
automute. The reason is that the output case is different from the
input: the input source is an exclusive selection while the output
can be multiplexed.)
Note that, for avoiding regressions, the line-in auto switching
feature isn't activated as default. It has to be set explicitly via
spec->line_in_auto_switch flag in a fixup code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 28 Nov 2012 17:11:59 +0000 (18:11 +0100)]
ALSA: hda - Rearrange INPUT_PIN_ATTR_*
Put INPUT_PIN_ATTR_FRONT after INPUT_PIN_ATTR_REAR, and define
INPUT_PIN_ATTR_LAST to point to the last element.
This is a preliminary work for cleaning up Realtek auto-mic parser.
In the auto-mic implementation, the front panel is preferred over the
rear panel. By arranging the attr definitions like in this commit, we
can simply use sort() for figuring out the priority order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 10:39:00 +0000 (11:39 +0100)]
ALSA: hda/realtek - Fix split stereo dmic code
The previous commit passed an utterly wrong value for checking the
split inv dmic pin. This patch fixes it and also tries to remove
inv_dmic_split_idx field.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 17:12:44 +0000 (18:12 +0100)]
ALSA: hda - Move fixup code into struct hda_codec
Since the fixup code is used commonly, it's worth to move it to the
common place, struct hda_codec, instead of keeping in hda_gen_spec.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:24:25 +0000 (17:24 +0100)]
ALSA: hda/realtek - Add conexant-style inverted dmic handling
To make the parser more generic, a few codes to handle the inverted
stereo dmic in a way Conexant parser does is added in this patch.
The caller should set spec->inv_dmic_split flag appropriately.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:18:21 +0000 (17:18 +0100)]
ALSA: hda/realtek - Allow multiple individual capture volume/switch controls
So far we create only "Capture Volume" and "Capture Switch" controls
for binding all possible amps, but we'd prefer creating individual
capture volume and switch controls per input in some cases
(e.g. conexant parser does it).
Add a new flag, spec->multi_cap_vol, to follow that policy.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 14:35:11 +0000 (15:35 +0100)]
ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new()
This prevents stupid typos.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 14:30:41 +0000 (15:30 +0100)]
ALSA: hda/realtek - Merge a few split functions
Merge a few functions that have been split due to historical reasons
to single functions. Splitting too much (and placing too far away)
actually worsens the readability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:33:04 +0000 (17:33 +0100)]
ALSA: hda/realtek - Assign Master mixer when possible
There are a few more cases where we can assign "Master" mixer element
safely, e.g. when a single DAC is used in the whole output paths.
Also, when vmaster hook is present, avoid "Master" but assign "PCM"
instead. Otherwise vmaster hook won't work properly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:57:09 +0000 (14:57 +0100)]
ALSA: hda/realtek - Handle vmaster hook in the parser side
... so that the fixup just needs to set the hook function in
FIXUP_ACT_PROBE. This will make easier to port for other codecs,
too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:33:21 +0000 (14:33 +0100)]
ALSA: hda/realtek - Remove unused fields and macro definitions
Also arranged alc_spec definitions to optimize bit fields.
Use a bit field for spec->need_dac_fix, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:29:52 +0000 (14:29 +0100)]
ALSA: hda/realtek - Drop auto_mic_valid_imux flag
This flag is superfluous now and it's always as same as
spec->auto_mic. Let's drop.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:22:45 +0000 (14:22 +0100)]
ALSA: hda/realtek - Allow different pins for shared hp/mic vref check
Add a new field to indicate the possible pin NID for alternative vref
setup for the shared hp/mic. Although 0x18 is valid for all Realtek
codecs, it'll be different on other vendor's codecs.
Also, drop the sanity check in update_shared_mic_hp() since the
reference pin is set explicitly in the caller side.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 10:55:53 +0000 (11:55 +0100)]
ALSA: hda/realtek - Parse digital input path
This was the last forgotten path. Now it's parsed via the same path
parser.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 10:46:37 +0000 (11:46 +0100)]
ALSA: hda/realtek - Rename add_new_out_path() with add_new_nid_path()
Make the function more generic for both input and output directions,
and returns the assigned path pointer. The argument order is changed
to follow the standard (from, to) way.
Now this new function is used for analog input and loopback path
parser codes, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 08:06:01 +0000 (09:06 +0100)]
ALSA: hda/realtek - Remove superfluous input amp init
The amps will be initialized via activate_path(), thus it's
superfluous to set in alc_auto_init_analog_input().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 07:57:05 +0000 (08:57 +0100)]
ALSA: hda/realtek - Clean up some spec fields
Remove some fields from struct alc_spec, and clean up the usage.
Namely,
- spec->input_mux becomes a single element, private_imux[] is removed
- spec->adc_nids becomes an array by itself, and private_adc_nids[]
gets removed, too
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 17 Dec 2012 19:29:29 +0000 (20:29 +0100)]
ALSA: hda/realtek - Make input path parser more generic
Now we reached to the final big piece of parser rewrite: the input
paths. While the old parser code assumes the more-or-less direct and
similar connections from input pin to ADC, the new code handles the
complete input paths. The capture source is switched by simple calls
of activate_path() function.
The parsing of capture volume and capture switches is, however, not
fully generalized. It assumes that amps are available in the vicinity
of ADCs (in three depth). This isn't perfect but it should cover all
codecs I know of.
Also, this commit removes some NID mapping of capture-related controls
temporarily for simplicity. It'll be restored in later commits.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 17 Dec 2012 17:00:02 +0000 (18:00 +0100)]
ALSA: hda/realtek - Don't change connection at path deactivation
The widget connection selection must be changed only when the path is
enabled.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:26:02 +0000 (18:26 +0100)]
ALSA: hda/realtek - Initialize loopback paths properly
Now we have a complete list of loopback paths, thus we can initialize
the paths more completely based on it, instead of assuming a direct
connection from pin to mixer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:19:04 +0000 (18:19 +0100)]
ALSA: hda/realtek - Add boost volumes to path list
Don't forget to take boost volumes into account in the managed path
list. Since it's an additional volume, we need to extend the ctls[]
array.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:04:37 +0000 (18:04 +0100)]
ALSA: hda/realtek - Add missing initialization of multi-io routes
The paths used for multi-io haven't been initialized properly, so
far. It's usually no big matter because the pins are set to input as
default, but it's still cleaner to initialize the paths properly.
Now with the path active/inactive check, we can do it easily.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 16:53:29 +0000 (17:53 +0100)]
ALSA: hda/realtek - Fix the initialization of pin amp-in
The pin widget has only a single amp value for the input even if it
has multiple "sources". Handle the situation in activate_path().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 16:34:51 +0000 (17:34 +0100)]
ALSA: hda/realtek - Rename get_out_path() to get_nid_path()
The function can be used not only for output paths but generically.
Also swap the argument order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:54:44 +0000 (16:54 +0100)]
ALSA: hda/realtek - Use path-based parser for digital outputs
Similar like analog output paths, use the path list for parsing and
initializing digital outputs as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:39:22 +0000 (16:39 +0100)]
ALSA: hda/realtek - Consolidate to a single path list
We don't have to keep three individual path lists for input, output
and loopback.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:15:56 +0000 (16:15 +0100)]
ALSA: hda/realtek - Consolidate is_reachable_path()
alc_auto_is_dac_reachable() can be replaced fully with
is_reachable_path(). The only difference is the order of arguments.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:09:29 +0000 (16:09 +0100)]
ALSA: hda/realtek - Add path active flag
... and rewrite the initialization of output paths as a generic
function that is applicable for both i/o directions.
The new flag, active, is introduced to each nid_path entry. This
indicates whether the given path is active, and it's used for checking
whether a certain widget can be turned off or changed when a path is
no longer used or newly enabled.
It's still used only in the output paths. More wider adaption for
input and loopback paths will be achieved in the later patch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 13:20:34 +0000 (14:20 +0100)]
ALSA: hda/realtek - Remove non-standard automute mode
We are using only AUTOMUTE_MODE_PIN in patch_realtek.c and all others
have been already dropped. Let's remove the old superfluous codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 09:32:21 +0000 (10:32 +0100)]
ALSA: hda - Introduce snd_hda_codec_amp_init*()
The new function snd_hda_codec_amp_init() (and the stereo variant)
initializes the amp value only once at the first access. If the amp
was already initialized or updated, this won't do anything more.
It's useful for initializing the input amps that are in the part of
the path but never used.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 17:30:04 +0000 (18:30 +0100)]
ALSA: hda - Introduce cache & flush cmd / amp writes
For optimizing the verb executions, a new mechanism to cache the verbs
and amp update commands is introduced. With the new "write to cache
and flush" way, you can reduce the same verbs that have been written
multiple times.
When codec->cached_write flag is set, the further
snd_hda_codec_write_cache() and snd_hda_codec_amp_stereo() calls will
be performed only on the command or amp cache table, but not sent to
the hardware yet. Once after you call all commands and update amps,
call snd_hda_codec_resume_amp() and snd_hda_codec_resume_cache().
Then all cached writes and amp updates will be written to the
hardware, and the dirty flags are cleared.
In this implementation, the existing cache table is reused, so
actually no big code change is seen here. Each cache entry has a new
dirty flag now (so the cache key is now reduced to 31bit).
As a good side-effect by this change, snd_hda_codec_resume_*() will no
longer execute verbs that have been already issued during the resume
phase by checking the dirty flags.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 16:03:30 +0000 (17:03 +0100)]
ALSA: hda - Remove snd_hda_codec_amp_update() call from patch_*.c
It's used only in one place in patch_analog.c, and it can be replaced
with others better.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 15:43:52 +0000 (16:43 +0100)]
ALSA: hda/realtek - Fix initialization of input amps in output paths
When initializing the output paths, we assumed the input amps have
almost two inputs blindly. It's not only generic but even incorrect
for some codecs like ALC268 & co. Also, the same assumption (two
sources) exists for the bind input-amp controls.
This patch changes the codes in these places to handle the input
connections in a more generic way.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 17:08:52 +0000 (18:08 +0100)]
ALSA: hda/realtek - Check amp capabilities of aa-mixer widget
For handling the analog-loopback paths more generically, check the amp
capabilities of the aa-mixer widget, and create only the appropriate
mixer elements.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 17:02:41 +0000 (18:02 +0100)]
ALSA: hda/realtek - Parse analog loopback paths more generically
Improve the parser of analog loopback paths and handle in a more
generic way. The following changes are included in this patch:
- Instead of assuming direct connections between pins and
the mixer widget, track the whole path between them. This fixes
some missing connections like ALC660.
- Introduce the path list for loopback paths like input and output
path lists. Currently it's not used for any real purposes, yet.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 16:25:00 +0000 (17:25 +0100)]
ALSA: hda/realtek - Parse input paths
Just like the output paths, parse the whole paths for inputs as well
and store in a path list. For that purpose, rewrite the output parser
code to be generically usable.
The input path list is not referred at all in this patch. It'll be
used to replace the fixed adc/capsrc array in later patches for more
flexible input path selections.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 16:27:57 +0000 (17:27 +0100)]
ALSA: hda/realtek - Make path->idx[] and path->multi[] consistent
So far, idx[i] and multi[i] indicate the attribute of the widget
path[i - 1]. This was just for simplifying the code in
__parse_output_path(), but this is rather confusing for later use.
It's more natural if both idx[i] and multi[i] point to the same widget
of path[i]. This patch changes to that way.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 16:07:16 +0000 (17:07 +0100)]
ALSA: hda/realtek - Simplify the output volume initialization
Simplify the output path initialization using the existing path
information instead of assuming the topology specific to Realtek
codecs. This is also implicitly a fix for some amp values on output
pins where the old parser missed (e.g. ALC260 output pins).
The same function alc_auto_set_output_and_unmute() can be used now for
the multi-io activation, since the output selection means nothing but
activating the given output path.
And, finally at this stage, we can get rid of alc_go_down_to_selector()
and other functions that are codec really specifically to Realtek
codecs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 15:04:30 +0000 (16:04 +0100)]
ALSA: hda/realtek - Reduce vol/mute ctl lookups at parsing codec
So far, Realtek codec driver evaluates the NIDs for volume and mute
controls twice, once while parsing the DACs and evaluating the
assignment, and another while creating the mixer elements. This is
utterly redundant and even fragile, as it's assuming that the ctl
element evaluation is identical between both parsing DACs and creating
mixer elements.
This patch simplifies the code flow by doing the volume / mute
controls evaluation only once while parsing the DACs. The patch ended
up in larger changes than expected because of some cleanups became
mandatory.
As a gratis bonus, this patch also fixes some cases where the stereo
channels are used wrongly for mono amps.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 14:58:34 +0000 (15:58 +0100)]
ALSA: hda - Fix mono amp values in proc output
The mono widget is always connected to the left channel, thus the left
channel amp value also should be referred for mono widgets instead of
the right channel.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 6 Dec 2012 17:06:23 +0000 (18:06 +0100)]
ALSA: hda/realtek - Manage mixer controls in out_path list
As we parse the output paths more precisely now, we can use this path
list for parsing the widgets for volume and mute mixer controls.
The spec->vol_ctls[] and sw_ctls[] bitmasks are replaced with the
ctls[] in each output path instance.
Interestingly, this move alone automagically fixes some bugs that the
conflicting volume or mute NIDs weren't properly detected.
Also, by parsing the whole path, there are more chances to get a free
widget for volume/mute controls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 6 Dec 2012 14:45:38 +0000 (15:45 +0100)]
ALSA: hda/realtek - Add output path parser
Add the output path parser to Realtek codec driver as we already have
in patch_via.c. The nid_path struct represents the complete output
path from a DAC to a pin. The alc_spec contains an array of these
paths, and a new path is added at each time when a new DAC is
assigned.
So far, this path list is used only in limited codes: namely in this
patch, only alc_is_dac_already_used() checks the list instead of dac
arrays in all possible outputs. In the later development, the path
list will be referred from more places, such as the mixer control
assignment / check, the mute/unmute of active routes, etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 5 Dec 2012 13:17:37 +0000 (14:17 +0100)]
ALSA: hda/realtek - List up all available DACs
In the probing phase, create a list of all available DACs in the codec
and use it for checking the single DAC connections.
This list will be used in more other places in the later commits, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 5 Dec 2012 13:08:45 +0000 (14:08 +0100)]
ALSA: hda/realtek - Simplify alc_auto_is_dac_reachable()
Use the helper function snd_hda_get_conn_index() instead of open
codes. This also improves the detection of some routes to DAC on
ALC260 (although the difference doesn't influence on the end
results of the mapping).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Kailang Yang [Thu, 10 Jan 2013 09:25:48 +0000 (10:25 +0100)]
ALSA: hda - Add support of new codec ALC284
Added the support for a new codec ALC284, which is compatible with
ALC269. Also add more codec variants to handle the SSID check
properly.
Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sachin Kamat [Thu, 10 Jan 2013 05:49:14 +0000 (11:19 +0530)]
ALSA: usb-audio: Make ebox44_table static
Fixes the following sparse warning:
sound/usb/mixer_quirks.c:1209:23: warning:
symbol 'ebox44_table' was not declared. Should it be static?
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andre Schramm [Wed, 9 Jan 2013 13:40:18 +0000 (14:40 +0100)]
ALSA: hdspm - Fix wordclock status on AES32
Use correct bitmask for AES32 cards to determine wordclock lock state,
add missing bitmask for sync check and make output of the corresponding
control and /proc coherent.
Signed-off-by: Andre Schramm <andre.schramm@iosono-sound.com>
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Wed, 19 Dec 2012 08:44:47 +0000 (09:44 +0100)]
Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
This reverts commit
697c373e34613609cb5450f98b91fefb6e910588.
The original patch was meant to remove clicking, but in fact caused even
more clicking instead.
Thanks to c4pp4 for doing most of the work with this bug.
BugLink: https://bugs.launchpad.net/bugs/886975
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>