Commit graph

5710 commits

Author SHA1 Message Date
Takashi Iwai 1c70a58341 ALSA: hda - Allow user to give hints for codec parser behavior
Through the hints via sysfs or patch, user can set specific behavior
flags for the generic parser now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:48 +01:00
Takashi Iwai bc759721fb ALSA: hda - Add snd_hda_get_int_hint() helper function
It'll be used in hda_generic.c, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:47 +01:00
Takashi Iwai 09b70e8509 ALSA: hda - Protect user-defined arrays via mutex
The pincfgs, init_verbs and hints set by sysfs or patch might be
changed dynamically on the fly, thus we need to protect it.
Add a simple protection via a mutex.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:45 +01:00
Takashi Iwai 08fb0d0ee1 ALSA: hda/realtek - Generic mute LED implementation for HP laptops
As David Henningsson recently suggested, some HP laptops use an unused
mic pin for controlling a mute LED, and this information is provided
via DMI string "HP_Mute_LED_X_Y" string.  This patch adds the generic
support for such cases, as we've already done in patch_sigmatel.c.
This is applied generically to all devices with ID 0x103c.

But as we don't know whether the device 103c:1586 really contains
HP_Mute_LED_X_Y DMI string, still keep the static setup for this
device using the mic2 pin 0x19.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:43 +01:00
Takashi Iwai 9bb1f06fe0 ALSA: hda/realtek - Fix the timing for some fixups
Some fixups such as setting the flags influencing on the parser
behavior should be applied before actually parsing the tree.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:42 +01:00
Takashi Iwai 39aedee7a1 ALSA: hda/realtek - Add a fixup for FSC S7020 laptop
Try to recover from the regression: set the HP amp for the speaker and
add the hp jack mode enum as default.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:40 +01:00
Takashi Iwai 978e77e78c ALSA: hda - Add output jack mode enum controls
Add the enum controls for changing the headphone amp bits of output
jacks, such as "Headphone Jack Mode".  This feature isn't enabled as
default, so far, unless spec->add_out_jack_modes flag is set.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:38 +01:00
Takashi Iwai a365fed980 ALSA: hda - Update automute / automic upon jack retasking
When a multi-io jack is switched to another direction, call the
automute and autoswitch update functions, as this jack won't be used
as the headphone or the mic jack that may turn off others.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:37 +01:00
Takashi Iwai fd1082159d ALSA: hda - Add a new fixup type to override pinctl values
Add a new fixup type, HDA_FIXUP_PINCTLS, for overriding the pinctl
values of the given pins.  It takes the same array of struct pintbl
like HDA_FIXUP_PINS, but each entry contains the pinctl value instead
of the pin default config value.

This patch also replaces the corresponding codes in patch_realtek.c.
Without this change, the direct call of verbs may be overridden again
by the later call of pinctl restoration by the driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:35 +01:00
Takashi Iwai d3f02d60ee ALSA: hda/realtek - Read the cached pinctl value in fixups
... instead of reading the value from the codec at each time.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:33 +01:00
Takashi Iwai 1727a771b4 ALSA: hda/realtek - Drop aliases for old fixups
Now the whole codebase has been changed from the earlier kernels, it
makes little sense to keep these aliases.  Simply replace with the
official names.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:32 +01:00
Takashi Iwai 0b4df931ce ALSA: hda - Avoid auto-mute or auto-mic of retasked jacks
When a jack is retasked as a different direction (e.g. a mic jack is
used as a CLFE output), such a jack shouldn't be counted as the target
for the automatic jack switching.  Skip the automute or the autoswitch
when the current pinctl direction is different from what we suppose.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:30 +01:00
Takashi Iwai 2c12c30d3f ALSA: hda - Manage current pinctl values in generic parser
Use the new pin target accessors for managing the current pinctl
values in the generic parser.  The pinctl values of all active pins
are once determined at the initialization phase, and stored via
snd_hda_codec_set_pin_target().  This will be referred again in the
codec init or resume phase to set the actual pinctl.

This value is kept while the auto-mute.  When a line-out or a speaker
pin is muted by auto-mute, the driver simply disables the pin, but it
doesn't touch the cached pinctl target value.  Upon unmute, this value
is used to restore the original pinctl in return.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:28 +01:00
Takashi Iwai 62f3a2f718 ALSA: hda - More strict correction of invalid pinctl bits
Check more strictly about the validity of pinctl values in
snd_hda_set_pin_ctl() and correct the wrong bits automatically.
Also provide the helper function to correct pinctl bits to codec
drivers.

This automatically fixes the invalid pinctl writes that are found in
a few Realtek fixups for NID 0x0f amp like ASUS A6Rp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:27 +01:00
Takashi Iwai d7fdc00ae5 ALSA: hda - Add helper functions to cache the current pinctl target
We already have the list of whole pin widgets and there is an unused
space in the list; let's use it for caching the current pinctl value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:25 +01:00
Takashi Iwai 980428cecc ALSA: hda - Clear the dropped paths properly
When a DAC is reassigned from surrounds to front or ADCs are reduced
due to incomplete imux, we clear the path indices but the path
instances remain as is.  Since the paths might be still referred
through the whole path list parsing (e.g. is_active_nid()), we should
clear these path instances as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:23 +01:00
Takashi Iwai f3fc0b0b1f ALSA: hda - Allow aamix as a capture source
Since some codecs can choose the aamix as a capture source, we should
support it as well.  When spec->add_stereo_mix_input flag is set, the
parser checks the availability of aamix as the input source, and adds
the paths automatically when possible.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:21 +01:00
Takashi Iwai 3a65bcdc57 ALSA: hda - Fix inconsistent input_paths after ADC reduction
In the current parser code, the input_paths[] may become inconsistent
when some of detected ADCs are dropped due to incomplete inputs, since
the driver rearranges only adc_nids[] but doesn't touch input_paths[].

This patch fixes the issue, and also it optimizes the reachability
checks by simply referring to the parsed input_paths[] instead of
calling is_reachable() again for each connection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:20 +01:00
Takashi Iwai 54d778b31c ALSA: hda - Return "Headphone Mic" from hda_get_autocfg_input_label()
Instead of handling special cases in the caller side, give a proper
name string "Headphone Mic" from hda_get_autocfg_input_label() when
the headhpone jack pin is specified as an input.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:18 +01:00
Takashi Iwai ca29683bd6 ALSA: hda - Exclude aamix from capture paths
The capture paths shouldn't contain the analog loopback mixer.
Pass a proper argument to exclude the aamix NID.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:16 +01:00
Takashi Iwai d12daf6f41 ALSA: hda - Add a flag to suppress mic auto-switch
Add a new flag spec->suppress_mic_auto_switch for codecs that don't
support unsol events properly like VT1708.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:15 +01:00
Takashi Iwai fb690cf582 ALSA: hda - Handle BOTH jack port as a fixed output
When the default config value shows the connection AC_JACK_PORT_BOTH,
it's better to handle it as a speaker pin.  This makes the behavior
consistent in snd_hda_get_pin_label() and snd_hda_parse_pin_defcfg().

There are only few old machines showing this attribute, and all of
them are actually fixed speaker pins, as far as I know.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:13 +01:00
Takashi Iwai 3ca529d339 ALSA: hda - Re-define snd_hda_parse_nid_path()
This commit modifies the definition of snd_hda_parse_nid_path()
slightly, now with_aa_mix argument is changed to anchor_nid, so that
it can handle any NID generically as an anchor point to include or
exclude.

The with_aa_mix field in struct nid_path is removed again by this
change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:11 +01:00
Takashi Iwai c697b71685 ALSA: hda - Manage input paths via path indices
... like we did for output and loopback paths.
It makes the code slightly easier.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:09 +01:00
Takashi Iwai a07a949be6 ALSA: hda - Fix multi-io channel mode management
The multi-io channels can vary not only from 1 to 6 but also may vary
from 6 to 8 or such.  At the same time, there are more speaker pins
available than the primary output pins.  So, we need three variables
to check: the minimum channel counts for primary outputs, the current
channel counts for primary outputs, and the minimum channel counts for
all outputs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:08 +01:00
Takashi Iwai affdb62b81 ALSA: hda - Don't set up active streams twice
We don't have to set up a stream that has been already set up
previously.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:06 +01:00
Takashi Iwai 50b1548775 ALSA: hda - Remove unused dac reference in create_multi_out_ctls()
Remove useless code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:04 +01:00
Takashi Iwai 0e614dd058 ALSA: hda - Use direct path reference in assign_out_path_ctls()
Instead of looking through paths with the dac -> pin connection at
each time, just pass the already parsed path index to
assign_out_path_ctls().  This simplifies the code a bit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:03 +01:00
Takashi Iwai cd5be3f9de ALSA: hda - Clear path indices properly at each re-evaluation
The path indices must be reset at each evaluation of DAC assignment.
Otherwise the badness value will be wrongly calculated and mixers may
be inconsistently assigned.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:44:01 +01:00
Takashi Iwai 5187ac168d ALSA: hda - Add brief comments to exported snd_hda_gen_*_() functions
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:59 +01:00
Takashi Iwai dd5e720304 ALSA: hda - Remove dead HDA_CTL_BIND_VOL and HDA_CTL_BIND_SW codes
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:57 +01:00
Takashi Iwai fce52a3bb1 ALSA: hda - Add snd_hda_gen_free() and snd_hda_gen_check_power_status()
Just to remove duplicated codes.
Also fixed EXPORT_SYMBOL() in hda_generic.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:56 +01:00
Takashi Iwai 76a19c69d9 ALSA: hda - Allow jack detection when polling is enabled
Let is_jack_detectable() return true when the jack polling is enabled
for the codec.  VT1708 uses the polling explicitly so we need to allow
it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:54 +01:00
Takashi Iwai e6b85f3c9d ALSA: hda - Add pcm_playback_hook to hda_gen_spec
The new hook which is called at each PCM playback ops.
It can be used to control the codec-specific power-saving feature in
each codec driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:52 +01:00
Takashi Iwai c2c803830a ALSA: hda - Drop bind-volume workaround
The bind-volume workaround was introduced for simplifying the mixer
abstraction in the case where one or more pins of multiple outputs
lack of individual volume controls.  This was essentially the case
like Acer Aspire 5935, which has 5.1 speakers and 5.1 (multi-io)
jacks although there are 5 DACs, so some of them must share a DAC.

However, the recent code rewrite changed the DAC assignment policy to
share with the same channel instead of binding to the front, thus
binding the volumes for all channels makes little sense now, rather
it's confusing.  So in this patch, the ugly workaround is finally
dropped and simply create the volume control corresponding to the
parsed path position.

For dual headphones or 2.1 speakers with a shared volume control, it's
anyway bound to the same DAC if needed, so this change shouldn't bring
any practical difference.

And, as a good bonus, we can cut off the whole code handling the bind
volume elements.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:51 +01:00
Takashi Iwai d4156930b2 ALSA: hda - Drop unneeded pin argument from set_output_and_unmute()
Just a minor refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:49 +01:00
Takashi Iwai ee79c69ac7 ALSA: hda - Add missing slave names for Speaker Surround, etc
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:43:47 +01:00
Takashi Iwai 7385df6134 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>
2013-01-12 08:43:45 +01:00
Takashi Iwai 5abd4888f6 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>
2013-01-12 08:43:44 +01:00
Takashi Iwai c30aa7b242 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>
2013-01-12 08:43:42 +01:00
Takashi Iwai 117688a9c1 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>
2013-01-12 08:43:40 +01:00
Takashi Iwai 2430d7b78b 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>
2013-01-12 08:43:38 +01:00
Takashi Iwai 196c176680 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>
2013-01-12 08:43:37 +01:00
Takashi Iwai 05453b7e97 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>
2013-01-12 08:43:35 +01:00
Takashi Iwai e22aab7dcf 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>
2013-01-12 08:43:33 +01:00
Takashi Iwai f5172a7ed9 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>
2013-01-12 08:43:31 +01:00
Takashi Iwai 1e0b528696 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>
2013-01-12 08:43:30 +01:00
Takashi Iwai e1284af730 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>
2013-01-12 08:43:28 +01:00
Takashi Iwai 985803ca91 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>
2013-01-12 08:43:26 +01:00
Takashi Iwai 2e03e9528d 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>
2013-01-12 08:43:24 +01:00
Takashi Iwai ee8e765b0b 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>
2013-01-12 08:43:23 +01:00
Takashi Iwai 9cc159c664 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>
2013-01-12 08:43:21 +01:00
Takashi Iwai ecac3ed174 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>
2013-01-12 08:43:19 +01:00
Takashi Iwai 38cf6f1a41 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>
2013-01-12 08:42:56 +01:00
Takashi Iwai b3a8c74522 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>
2013-01-12 08:34:30 +01:00
Takashi Iwai 4ac0eefa76 ALSA: hda - Define HDA_PARSE_* for snd_hda_parse_nid_path() argument
... instead of numbers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:34:28 +01:00
Takashi Iwai 708122e836 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>
2013-01-12 08:34:27 +01:00
Takashi Iwai 0c8c0f56e6 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>
2013-01-12 08:34:25 +01:00
Takashi Iwai 545502de54 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>
2013-01-12 08:34:24 +01:00
Takashi Iwai f873e536b6 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>
2013-01-12 08:34:22 +01:00
Takashi Iwai 7594aa3396 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>
2013-01-12 08:34:20 +01:00
Takashi Iwai d5a9f1bb38 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>
2013-01-12 08:34:19 +01:00
Takashi Iwai 64049c81df 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>
2013-01-12 08:34:17 +01:00
Takashi Iwai db23fd193d 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>
2013-01-12 08:34:16 +01:00
Takashi Iwai 973e4972f9 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>
2013-01-12 08:34:14 +01:00
Takashi Iwai fd25a97a97 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>
2013-01-12 08:34:12 +01:00
Takashi Iwai 406b285da3 ALSA: hda - Begin HDA_GEN_* event tag from 1
... to distinguish from the invalid event type.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:34:11 +01:00
Takashi Iwai d94ddd85b1 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>
2013-01-12 08:34:09 +01:00
Takashi Iwai 2ce4886abc 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>
2013-01-12 08:34:07 +01:00
Takashi Iwai 8565f052c5 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>
2013-01-12 08:34:06 +01:00
Takashi Iwai 3bbcd274c2 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>
2013-01-12 08:34:04 +01:00
Takashi Iwai 47d46abba2 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>
2013-01-12 08:34:02 +01:00
Takashi Iwai 84e3908dc8 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>
2013-01-12 08:34:01 +01:00
Takashi Iwai 0c3d47b007 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>
2013-01-12 08:33:59 +01:00
Takashi Iwai c4f3ebed3c 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>
2013-01-12 08:33:57 +01:00
Takashi Iwai 3bcce5c0d9 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>
2013-01-12 08:33:56 +01:00
Takashi Iwai aa88a3553e 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>
2013-01-12 08:33:54 +01:00
Takashi Iwai de1e37b7d0 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>
2013-01-12 08:33:43 +01:00
Takashi Iwai 5fdaecdb0d 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>
2013-01-12 08:31:06 +01:00
Takashi Iwai 624d914d09 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>
2013-01-12 08:31:04 +01:00
Takashi Iwai 08c189f2c5 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>
2013-01-12 08:31:03 +01:00
Takashi Iwai 5d550e15be 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>
2013-01-12 08:31:01 +01:00
Takashi Iwai 36502d0200 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>
2013-01-12 08:30:59 +01:00
Takashi Iwai 9eb413e5e4 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>
2013-01-12 08:30:58 +01:00
Takashi Iwai 12c93df60c 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>
2013-01-12 08:30:56 +01:00
Takashi Iwai 731dc3019c 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>
2013-01-12 08:30:55 +01:00
Takashi Iwai 352f7f914e 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>
2013-01-12 08:30:53 +01:00
Takashi Iwai fdf52cab88 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>
2013-01-12 08:30:51 +01:00
Takashi Iwai ab16c6dd79 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>
2013-01-12 08:30:50 +01:00
Takashi Iwai 5ec16d12c8 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>
2013-01-12 08:30:48 +01:00
Takashi Iwai 7e35dd3d6b 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>
2013-01-12 08:30:46 +01:00
Takashi Iwai c9ce6b260b 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>
2013-01-12 08:30:45 +01:00
Takashi Iwai 81fede89ed 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>
2013-01-12 08:30:43 +01:00
Takashi Iwai 9bf387b612 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>
2013-01-12 08:30:41 +01:00
Takashi Iwai bc54976721 ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new()
This prevents stupid typos.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12 08:30:40 +01:00
Takashi Iwai 2eab694a6c 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>
2013-01-12 08:30:38 +01:00
Takashi Iwai 52a8efab10 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>
2013-01-12 08:30:36 +01:00
Takashi Iwai 3bd7b644d0 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>
2013-01-12 08:30:35 +01:00
Takashi Iwai 20c18f562a 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>
2013-01-12 08:30:33 +01:00
Takashi Iwai 480967db6c 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>
2013-01-12 08:30:32 +01:00
Takashi Iwai 37c0420765 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>
2013-01-12 08:30:30 +01:00
Takashi Iwai df1d1fb09a 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>
2013-01-12 08:30:28 +01:00
Takashi Iwai 965ccebccd 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>
2013-01-12 08:30:27 +01:00
Takashi Iwai 62343997e4 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>
2013-01-12 08:30:25 +01:00
Takashi Iwai 27d3153651 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>
2013-01-12 08:30:23 +01:00
Takashi Iwai 666a70d42b 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>
2013-01-12 08:30:22 +01:00
Takashi Iwai 183a444a6d 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>
2013-01-12 08:30:20 +01:00
Takashi Iwai 829f69ea59 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>
2013-01-12 08:30:18 +01:00
Takashi Iwai 8dd4867858 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>
2013-01-12 08:30:17 +01:00
Takashi Iwai 3ebf1e940a 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>
2013-01-12 08:30:15 +01:00
Takashi Iwai 0250f7cbea 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>
2013-01-12 08:30:14 +01:00
Takashi Iwai 6518f7ac51 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>
2013-01-12 08:30:12 +01:00
Takashi Iwai fef7fbbc5d 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>
2013-01-12 08:30:10 +01:00
Takashi Iwai c9967f1cba 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>
2013-01-12 08:30:09 +01:00
Takashi Iwai 9c64076e54 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>
2013-01-12 08:30:07 +01:00
Takashi Iwai 130e5f0642 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>
2013-01-12 08:30:05 +01:00
Takashi Iwai b8a47c79b2 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>
2013-01-12 08:30:04 +01:00
Takashi Iwai 280e57d544 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>
2013-01-12 08:30:02 +01:00
Takashi Iwai c370dd6e9f 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>
2013-01-12 08:29:17 +01:00
Takashi Iwai 8092e60654 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>
2013-01-10 10:34:30 +01:00
Takashi Iwai 9366ede7fd 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>
2013-01-10 10:34:30 +01:00
Takashi Iwai bd32f782b9 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>
2013-01-10 10:34:29 +01:00
Takashi Iwai c2fd19c2fc 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>
2013-01-10 10:34:29 +01:00
Takashi Iwai 36f0fd540e 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>
2013-01-10 10:34:28 +01:00
Takashi Iwai 95e960cece 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>
2013-01-10 10:34:28 +01:00
Takashi Iwai 78e635c93b 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>
2013-01-10 10:34:28 +01:00
Takashi Iwai 792cf2fa2e 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>
2013-01-10 10:34:27 +01:00
Takashi Iwai 2f179721c4 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>
2013-01-10 10:34:27 +01:00
Takashi Iwai ba8111276f 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>
2013-01-10 10:34:27 +01:00
Takashi Iwai 30dcd3b404 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>
2013-01-10 10:34:26 +01:00
Takashi Iwai 463419de86 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>
2013-01-10 10:34:26 +01:00
Takashi Iwai 6a84c305f0 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>
2013-01-10 10:34:26 +01:00
Kailang Yang 065380f088 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>
2013-01-10 10:27:46 +01:00
Andre Schramm 56bde0f328 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>
2013-01-09 16:59:24 +01:00
Takashi Iwai 6ab317419c ALSA: hda - Allow power_save_controller option override DCAPS
Change the power_save_controller option to bint from bool so that user
can override the runtime PM capability bit and force to enable or
disable the runtime PM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-09 11:15:13 +01:00
David Henningsson 7ed4165e2d Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
This reverts commit 697c373e34.

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>
2013-01-09 11:03:38 +01:00
Takashi Iwai d7dab4dbbb ALSA: hda - Disable runtime D3 for Intel CPT & co
We've got a few bug reports that the runtime D3 results in the dead
HD-audio controller.  It seems that the problem is in a deeper level
than the sound driver itself, so as a temporal solution, disable the
feature for these controllers again.

Reported-and-tested-by: Vincent Blut <vincent.debian@free.fr>
Reported-and-tested-by: Maurizio Avogadro <mavoga@gmail.com>
Cc: <stable@vger.kernel.org> [v3.7]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-09 11:00:08 +01:00
David Henningsson f4f0a8c478 ALSA: hda - print power state for AFG node in proc file
It seems useful, and power states are required for AFG nodes,
so I see no reason not to print it. As a bonus, also print the
AFG nid.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-08 17:02:27 +01:00
David Henningsson 6d3cd5d444 ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)
The mute LED is in this case connected to the Mic1 VREF.

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably
makes sense to try to do something more generic, like for the
IDT codec.

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/bugs/1096789
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-07 17:29:55 +01:00
Nickolai Zeldovich 61ed1dca16 ALSA: au88x0: fix incorrect left shift
vortex_wt_setdsout performs bit-negation on the bit position (wt&0x1f)
rather than on the resulting bitmask.  This code is never actually
invoked (vortex_wt_setdsout is always called with en=1), so this does
not currently cause any problem, and this patch is simply cleanup.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-07 09:33:56 +01:00
David Henningsson c86c2d440c ALSA: hda - Switch "On" and "Off" for "Mute-LED Mode" kcontrol
The vmaster hook sends 1 for enabled/unmuted and 0 for disabled/muted,
but "Mute-LED Mode" being "On" refers to the LED being on, not the
volume being on.
Therefore "On" and "Off" should be switched.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-03 14:22:34 +01:00
Linus Torvalds 03c850ec32 Sound fixes for 3.8-rc1
This update contains overall only driver-specific fixes.
 Slightly large LOC are seen in usb-audio driver for a couple of new
 device quirks and cs42l71 ASoC driver for enhanced features.
 The others are a few small (regression) fixes HD-audio, and yet other
 small / trival ASoC fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJQ0thSAAoJEGwxgFQ9KSmk/i8P+wcdjCcp5FdfZ5YP2h9siEw5
 7KJPwwk9eTa0PVB5olgabxSh6L5P+rM69OGiXnHSKF8RwsuZDRp/5pPcaoUVRzH/
 6uibGozfLApeLBuBAJZ96eJhRIigysoSrm5W4FQeNVAbwK67zpIjP/xGwKa0+qfO
 vsK/BtSn+nVsmFpgOfO6vXZ7gKBlfKGXHYdyFVXzHEhGYSHLdf1IDxnCapIXlh78
 0nXHD2FHgKlSM6y/S6W7wiUwyNqbgmnZHwh29iIyes1CrX0wVyvtos3qgwJHukrU
 WVY87E1TDxD6HLAWTUxqeOIvNyucSarUZ+kvtYg0i31gmRCY8QNXqYVp1wBybqVd
 Uwbwe4qWwSxXhXluodFsizNwcH9T+KA3IM4B5u6yCT1pFY759pCh/KpLoNfD+maL
 6atnBU6lvtTCMxoeSyJFSdAjdOQJUpylQ9TyQaI/PIr6jrEMVC2ki/i3UX+YpQGo
 oWJj5x8Nl58MUv7GhYGTo7vfm3ZqaUbxN/YugbCeVkrcV0McJNycvddotplD4iTd
 pqfep1fVpefW9X4pJnvsys2neo7R8e8a87Qg2CfVGXQ91ijevPCf+YAh4EmHShsT
 vwNcOP/gZ+qQp/bY40SigMj5SZtZ/ZQxT47yPo6OLI4FyhyD+WK4l1AAEK5B1uPA
 odsIcQg2F6/RjzkDSsSl
 =JoY5
 -----END PGP SIGNATURE-----

Merge tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This update contains overall only driver-specific fixes.  Slightly
  large LOC are seen in usb-audio driver for a couple of new device
  quirks and cs42l71 ASoC driver for enhanced features.  The others are
  a few small (regression) fixes HD-audio, and yet other small / trival
  ASoC fixes."

* tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Support for Digidesign Mbox 2 USB sound card:
  ALSA: HDA: Fix sound resume hang
  ALSA: hda - bug fix for invalid connection list of Haswell HDMI codec pins
  ALSA: hda - Fix the wrong pincaps set in ALC861VD dallas/hp fixup
  ALSA: hda - Set codec->single_adc_amp flag for Realtek codecs
  ASoC: atmel-ssc: change disable to disable in dts node
  ASoC: Prevent pop_wait overwrite
  ALSA: usb-audio: ignore-quirk for HP Wireless Audio
  ALSA: hda - Always turn on pins for HDMI/DP
  ALSA: hda - Fix pin configuration of HP Pavilion dv7
  ASoC: core: Fix splitting of log messages
  ASoC: cs42l73: Change VSPIN/VSPOUT to VSPINOUT
  ASoC: cs42l73: Add DAPM events for power down.
  ASoC: cs42l73: Add DMIC's as DAPM inputs.
  ASoC: sigmadsp: Fix endianness conversion issue
  ASoC: tpa6130a2: Use devm_* APIs
2012-12-20 07:52:13 -08:00
Daniel J Blueman 44728e97c3 ALSA: HDA: Fix sound resume hang
Resuming a switcheroo'd HDA controller hangs since the completion
is one-shot (thus works the first time). Fix by using completions
that explictly need rearming, so remain fired before.

Signed-off-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-18 17:07:11 +01:00
Mengdong Lin 6ffe168f82 ALSA: hda - bug fix for invalid connection list of Haswell HDMI codec pins
Haswell HDMI codec pins may report invalid connection list entries, which
will cause failure to play audio via HDMI or Display Port.

So this patch adds fixup for Haswell to workaround this hardware issue:
enable DP1.2 mode and override the pins' connection list entries with proper
value.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-18 11:05:36 +01:00
Takashi Iwai b78562b10f ALSA: hda - Fix the wrong pincaps set in ALC861VD dallas/hp fixup
The workaround to force VREF50 for dallas/hp model with ALC861VD
was introduced in commit 8fdcb6fe42,
but it contained wrong pincap override bits.

This patch fixes to exclude VREF80 pincap bit correctly.

Cc: <stable@vger.kernel.org> [v3.2+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-17 20:10:50 +01:00
Takashi Iwai 1098b7c228 ALSA: hda - Set codec->single_adc_amp flag for Realtek codecs
It turned out that Realtek codecs (ALC260, etc) with input amps in
audio-input widgets don't handle the multiple individual input amps.
Thus we need to set codec->single_adc_amp flag for them in general.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-17 20:03:15 +01:00
Takashi Iwai 6169b67361 ALSA: hda - Always turn on pins for HDMI/DP
We've seen the broken HDMI *video* output on some machines with GM965,
and the debugging session pointed that the culprit is the disabled
audio output pins.  Toggling these pins dynamically on demand caused
flickering of HDMI TV.

This patch changes the behavior to keep the pin ON constantly.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=51421

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-14 10:27:25 +01:00
Linus Torvalds a2013a13e6 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial branch from Jiri Kosina:
 "Usual stuff -- comment/printk typo fixes, documentation updates, dead
  code elimination."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  HOWTO: fix double words typo
  x86 mtrr: fix comment typo in mtrr_bp_init
  propagate name change to comments in kernel source
  doc: Update the name of profiling based on sysfs
  treewide: Fix typos in various drivers
  treewide: Fix typos in various Kconfig
  wireless: mwifiex: Fix typo in wireless/mwifiex driver
  messages: i2o: Fix typo in messages/i2o
  scripts/kernel-doc: check that non-void fcts describe their return value
  Kernel-doc: Convention: Use a "Return" section to describe return values
  radeon: Fix typo and copy/paste error in comments
  doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
  various: Fix spelling of "asynchronous" in comments.
  Fix misspellings of "whether" in comments.
  eisa: Fix spelling of "asynchronous".
  various: Fix spelling of "registered" in comments.
  doc: fix quite a few typos within Documentation
  target: iscsi: fix comment typos in target/iscsi drivers
  treewide: fix typo of "suport" in various comments and Kconfig
  treewide: fix typo of "suppport" in various comments
  ...
2012-12-13 12:00:02 -08:00
Takashi Iwai 8ae5865ec7 ALSA: hda - Fix pin configuration of HP Pavilion dv7
Fix the quirk entry for HP Pavilion dv7 in order to make the bass
speaker working.

Reported-and-tested-by: Tomas Pospisek <tpo2@sourcepole.ch>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-13 14:36:09 +01:00
Takashi Iwai 6eb827d235 ALSA: hda - Move runtime PM check to runtime_idle callback
The runtime_idle callback is the right place to check the suspend
capability, but currently we do it wrongly in the runtime_suspend
callback.  This leads to a kernel error message like:
   pci_pm_runtime_suspend(): azx_runtime_suspend+0x0/0x50 [snd_hda_intel] returns -11
and the runtime PM core would even repeat the attempts.

Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Cc: <stable@vger.kernel.org> [v3.7]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-12 14:22:13 +01:00
Takashi Iwai 63a077e276 ALSA: hda - Add stereo-dmic fixup for Acer Aspire One 522
Acer Aspire One 522 has the infamous digital mic unit that needs the
phase inversion fixup for stereo.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=715737

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-12 12:12:55 +01:00
Takashi Iwai c5c215232d ALSA: hda - Avoid doubly suspend after vga switcheroo
The HD-audio driver artificially calls the suspend and the resume code
path in the VGA switcheroo state changes.  When a machine goes to
suspend, it tries to suspend the device again, and it stalls at
snd_power_wait().

This patch adds checks whether the devices were already in (forced)
suspend in PM callbacks for avoiding the doubly suspend.

Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-12 11:32:56 +01:00
Takashi Iwai cc5ede3efd ALSA: hda - Check validity of CORB/RIRB WP reads
When the HD-audio controller is disabled (e.g. via vga switcheroo) but
the driver is still accessing it, it spews floods of "spurious
response" kernel messages.  It's because CORB/RIRB WP reads 0xff, and
the driver tries to fill up until this number.

This patch changes the CORB/RIRB WP reads to word instead of byte, and
add the check of the read value.  If it's 0xffff, the controller is
supposed to be disabled, so the further action will be skipped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-12 11:32:33 +01:00
Mengdong Lin fa348da53b ALSA: hda - use usleep_range in link reset and change timeout check
Reducing the time on HDA link reset can help to reduce the driver loading
time. So we replace msleep with usleep_range to get more accurate time
control and change the value to a smaller one. And a 100ms timeout is set
for both entering and exiting the link reset.

Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-12 11:03:12 +01:00
Lydia Wang 6121b84af3 ALSA: HDA: VIA: Add support for codec VT1808.
Add support for new codec VT1808, which is similiar with VT1705CF.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-10 12:05:16 +01:00
Lydia Wang 43737e0ae9 ALSA: HDA: VIA Add support for codec VT1705CF.
Add support for new codec VT1705CF.
When power on/off Audio output converter of VT1705CF, the stream tag
will be cleared. But driver caches the value. So when power on Audio
output converter, the update_conv_power_state() will restore the saved
stream tag of it.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-10 11:45:24 +01:00
Takashi Iwai 6a0f56a784 ALSA: Remove the rest of __devinit* in comments
Remove the leftover __devinit* in comments.
They have been commented out because they couldn't fit with __dev*
although they should have matched.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:41:56 +01:00
Takashi Iwai 48c8b0eb6d ALSA: hda - Remove superfluous DELAYED_INIT*_MARK
Since __devinit* have been removed completely, DELAYED_INIT*_MARK in
hda_intel.c became NOP.  Let's rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:40:35 +01:00
Bill Pemberton f120a6fb48 ALSA: oxygen: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:32:02 +01:00
Bill Pemberton 3dd0676335 ALSA: bt87X: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:31:45 +01:00
Bill Pemberton 2f5c130281 ALSA: ad1889: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Thibaut Varene <T-Bone@parisc-linux.org>
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:31:18 +01:00
Bill Pemberton e23e7a1436 ALSA: pci: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:20:55 +01:00
Daniel J Blueman 445a51b353 ALSA: hda: Add PCI device prefix for clarity
When printing, use a prefix of the PCI domain, bus, device and function
as in other drivers, to differentiate multiple devices.

Important for reporting and debugging. A future step is to tidy this up with
dev_printk et al.

v2: Move conversion specifier into call site, preventing build issues
v3: Refactor for Takashi's for-next branch

Signed-off-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-05 16:09:49 +01:00
Takashi Iwai f4c482a4d0 ALSA: hda - Fix yet another race of vga_switcheroo registration
The recent fix for vga switcheroo race in commit 128960a9 opened yet
another race.  At the time the audio driver starts probing, user may
turn off D-GPU off.  But at this moment, the audio driver still
doesn't register the vga switcheroo client, thus the switching isn't
notified.  Then the hardware gets off out of sudden, resulting in
invalid reads and lots of "spurious response" error messages.

For solving this situation, the following changes have been done in
this patch:
- Move again vga switcheroo registration to the very early stage of
  the probing; this also requires to set pci drvdata properly before
  registration
- Introduce the completion to synchronize the driver probe at vga
  switcheroo callbacks; this assures that the whole probing finished
  before executing the callbacks

Reported-by: Daniel J Blueman <daniel@quora.org>
Tested-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-04 16:00:40 +01:00
Adrian Knoth 467b103505 ALSA: hdspm - Remove obsolete settings functions
With HDSPM_TOGGLE_SETTING in place, these functions are no longer
required. Removing them makes the code DRY and considerably shorter.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-03 15:30:01 +01:00
Adrian Knoth c9e1668c68 ALSA: hdspm - Use HDSPM_TOGGLE_SETTING to alter settings
HDSPM_TOGGLE_SETTING and its corresponding functions allow to change
settings in the control register. Instead of using the specialised
functions, use the generic code to make the code DRY.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-03 15:29:54 +01:00
Adrian Knoth bf0ff87bef ALSA: hdspm - Implement generic function to toggle settings
The driver contains at least six similar functions that change only a
single bit in the control register, only the bit position varies.

This patch implements a generic function to toggle a certain bit
position that will be used to replace the old code.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-03 15:29:45 +01:00
Takashi Iwai b6adb57df1 ALSA: hda/realtek - Keep the channel count for multiple speakers
The current Realtek driver reconfigures the max PCM channels
dynamically according to the value of Channel Mode enum if the
multi-io retasking is available.  It works fine for multi-io pins.
But when multiple speaker pins are available, the channels of speakers
also have to obey to the channel mode, which isn't nice.
(That is, when you select "2ch" in Channel Mode so that the line-in
 and mic jack behave as input, you can't play surrounds properly from
 the built-in speaker.)

This patch fixes the problem by taking the channel number for multiple
speakers into account in the channel-mode setup code.
Also it fixes the wrongly set up max_channels value in the case of
multi-io extension.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-03 10:39:36 +01:00
Takashi Iwai eb10149d17 ASoC: Updates for v3.8
Very quiet release for ASoC really:
 
 - Standardisation of the logging.
 - DT and dmaengine support for Atmel.
 - Support for Wolfson ADSP cores.
 - New drivers for Freescale/iVeia P1022 and Maxim MAX98090.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQutrLAAoJELSic+t+oim9NVUP/3Y1YJjUADTy3w1d6L7zKaQb
 dGVg2cdDBNgXCrIuyb3zUA9yNGrR1c7gzDGjTuiBrJKx917/DrF08pmgHAUv5e9B
 +//xoy2lSwYgnPiWY7p6092+pYNI1hs4PDkV3zucrkkgQovIZOlebUM3MOrSf50+
 abe9uPA11EyqPtmy8HrhtL2iJ3kUOq1y6YNbrDQaaWTL/lwBPS+LzxFAIE36LjN6
 fIUOb8jtSE0rjOVo+jmuytdCnlugaEFfQzOebKMVYpB9LNv6hqISai/baaKFO1Fc
 Jtkjv2xGuUuxP0kY6Fkbjabut7mS8oiVZfGmNUKbYoKStsk1t//xjay/2F0HsNgg
 O7PsK6y1HD/iB87YNaO8Go/6lLSszeQ2WU7Fvynv/CTOpjO/8gjaQz3zDi3HsF5O
 gyh/WYnj9jwnUJkaMDeEyjKBbKDxLuBeXBETVhNIWNgCwnj48TSYQwmGhtefNnS1
 AM/CUrfXVsgCxPn8z/ep/hbkat8+PHENuPR9v81mUyQvVX9jTALVIYioTdxkc8Ul
 y0p5UmgM/TsmnINGVUeFp5LkmfdyOhUhBtwovDhzDjR4RC1/otty1/9l4VHqw1ym
 ETwqu7pl7bb9aDNsOEV9Z21kOMuTDbApHIT6crptNBllUvR0jDYfD4xOAs3zQLO5
 JWOX2fPUHzFusINuA6fS
 =2irt
 -----END PGP SIGNATURE-----

Merge tag 'asoc-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v3.8

Very quiet release for ASoC really:

- Standardisation of the logging.
- DT and dmaengine support for Atmel.
- Support for Wolfson ADSP cores.
- New drivers for Freescale/iVeia P1022 and Maxim MAX98090.
2012-12-03 09:55:44 +01:00
Takashi Iwai dda415d418 ALSA: hda - Add a helper function for simple enum kcontrols
The same type of code is being used in multiple places in various
codec drivers, so put it as a core library.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-30 18:34:38 +01:00
Takashi Iwai 475c3d21e8 ALSA: hda - Pass errors properly in alc_auto_check_switches()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-30 11:49:02 +01:00
Takashi Iwai 668d1e9673 ALSA: hda - Refactor alc_kcontrol_new() usages
Allocate the name string and assign the structure in
alc_kcontrol_new() itself to reduce the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-30 10:55:44 +01:00
Takashi Iwai b9030a005d ALSA: hda - Use standard sort function in hda_auto_parser.c
Just refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-30 10:54:45 +01:00
Takashi Iwai 361dab3ec2 ALSA: hda - Call snd_array_init() early and only once
This is a preliminary patch for introducing a protection to access
races of snd_array instances.  Call snd_array_init() appropriately
at the initialization time and don't call it twice.

Also the allocations of codec-spec structs are cleaned up by helper
functions in patch_sigmatel.c and patch_analog.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 09:03:39 +01:00
Takashi Iwai cdc83c59e5 ALSA: hda - Remove superfluous zero-clear memset in patch_ca0132.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:32 +01:00
Takashi Iwai 063bca0968 ALSA: hda - Fix NULL dereference in error path of patch_ca0132.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:29 +01:00
Ian Minett e97249dd6d ALSA: hda - Remove unnecessary struct hda_stream_format from CA0132
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:26 +01:00
Ian Minett 4861af8075 ALSA: hda - Update chipio functions and DSP write wait timeout
Tidy up and condense chipio_write_address|addx() functions.
Improve dspio_write_wait() to use jiffies for timeout calc.

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:23 +01:00
Ian Minett a3af4807fa ALSA: hda - Change return value for load_dsp_prepare() to -ENOSYS
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:21 +01:00
Ian Minett d5c21b88e8 ALSA: hda - Add comments and descriptions to CA0132 functions
Add comments and descriptions to functions.
Bump dsp_free_ports() to below dsp_allocate_ports_format() to group the
alloc functions together for commenting.

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:18 +01:00
Ian Minett c3b4eea262 ALSA: hda - Add firmware caching to CA0132 codec
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:15 +01:00
Ian Minett 01ef7dbffb ALSA: hda - Update CA0132 codec to load DSP firmware binary
This patch adds the code needed to fetch the DSP binary image from the local
firmware install location and transfer it over to the chip using the new DSP
loader bus ops.
Actual DSP effect controls, parameters and mixers are to be included later.

- Add calls to new DSP loader system to transfer firmware to the hardware.
- Add chip read/write routines, DSP I/O, SCP packet format helper functions and
  transfer DMA management.
- Add guard around DSP download to ensure loader config switch is enabled.

The general scheme for downloading the DSP is as follows:
1) If DSP firmware loader is enabled, ca0132_download_dsp() is called
to start the process.
2) Driver requests DSP image using request_firmware().
3) Driver sets up the streaming DMA for DSP image download
with dspload_image() and dspxfr_image(), which in turn calls the DSP loader
op snd_hda_codec_load_dsp_prepare() to ready the system.
4) DSP image will consist of 1 or more segments, each transferred in sequence
by a call to dspxfr_one_seg() and snd_hda_codec_load_dsp_trigger().
5) Once complete, the loader state is cleaned up with
snd_hda_codec_load_dsp_cleanup().

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:12 +01:00
Ian Minett 4aa3bb0c52 ALSA: hda - Add DSP firmware enums and defs to CA0132 codec
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:09 +01:00
Ian Minett bcd109c086 ALSA: hda - Add CA0132 register definitions file
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:06 +01:00
Takashi Iwai 1d1a4564d8 ALSA: hda - Add new DSP loader callback routines
Pass DMA buffer pointers in calls to setup_bdle().
Add DSP loader callback routines to controller.
Add new DSP loader switch to Kconfig to turn off DSP firmware.

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28 08:47:03 +01:00
Takashi Iwai d846b17475 ALSA: hda - Fix build without CONFIG_PM
I forgot this again...  codec->in_pm is in #ifdef CONFIG_PM

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-24 12:00:43 +01:00
Takashi Iwai ffe4d12b15 ALSA: hda - Add a fixup for internal mic on MacBook Pro 8,1
The internal mic on MBP81 gives only the right channel, and the left
channel is static.  Add a verb to fix the ADC2 channel mode to expand
mono right to stereo.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50781
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-23 08:37:32 +01:00
Takashi Iwai 98415eacb3 ALSA: hda - Add missing verb applications in patch_cirrus.c
We forgot to apply the fixup verbs in cs_init().

But adding the fixup verbs will break mbp101 fixup that has been fixed
recently again, since the mbp101 fixup contains the wrong verbs to
override.  So these bogus verbs must be removed, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-23 08:37:32 +01:00
Takashi Iwai 829e87e04c ALSA: hda - Move static ADC setup for CS4206 to init verbs
It's constant, so better to be put in the static init array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-23 08:37:31 +01:00
Takashi Iwai 2ba509a6ba Merge branch 'for-linus' into for-next 2012-11-22 21:22:39 +01:00
Takashi Iwai 2efa1d59fe ALSA: emu10k1: Add missing ifdef for emu->suspend reference
It's defined only for PM.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 21:21:20 +01:00
Takashi Iwai 8232932d32 ALSA: hdsp: Add missing inclusion of linux/vmalloc.h
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 21:19:18 +01:00
Takashi Iwai 4f86f120d9 ALSA: emu10k1: don't update firmware during suspend/resume
Add a flag to suppress the update in emu1010_firmware_thread() during
suspend/resume.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:48:11 +01:00
Takashi Iwai b209c4dfcd ALSA: emu10k1: cache emu1010 firmware
Instead of calling request_firmware() at each time, keep the obtained
firmware internally and reuse it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:48:09 +01:00
Takashi Iwai 90caaef6a1 ALSA: hdsp: improve firmware caching
As the recent firmware code tries to reread and cache the firmware by
itself, it's even better to keep the struct firmware data instead of
keeping a local copy.  Also, it makes little sense to disable the fw
loader for this driver, so added the explicit dependency, too.

Last, but not least, allocate the firmware data loaded via ioctl in
vmalloc'ed buffer instead, as the firmware size isn't that small.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:48:07 +01:00
Takashi Iwai 7009fa568b ALSA: ymfpci: Use kmalloc for register buffer for PM
Th buffer to save registers for PM is enough small for kmalloc(), not
necessary to use vmalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:48:05 +01:00
Takashi Iwai e39ae85644 ALSA: hda - Don't release firmware when CONFIG_PM is set
The new firmware code tries to re-read the formerly read firmware
files before suspend.  Thus it's wiser to keep the "patch" firmware in
the driver for avoiding this unnecessary re-reading.

Of course, this will consume a bit of memory for unused stuff, but
the patch fw is supposed to be fairly small, so it's more benefit in
the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:48:03 +01:00
Takashi Iwai d19144987c ALSA: pcxhr: hard dependency on the standard fw loader
Like the previous commit for mixart, drop the home-baked fw loader
code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:47:59 +01:00
Takashi Iwai cba46f11cb ALSA: mixart: hard dependency on the standard fw loader
It makes no longer sense to keep the old hwdep user-space firmware
loading, which has been deprecated since ages ago.

Just add a hard dependency on CONFIG_FW_LOADER and drop the useless
code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:47:57 +01:00
Takashi Iwai 3fdf1469ee ALSA: hda - Don't overwrite the pin default configs
Since we keep the pin default config values anyway internally, we
don't have to set the values in the codec.  This patch removes the
code writing the pincfg values.

As a gratis bonus, we can remove also the code restoring the original
pincfg values at PM resume or module free.  This will give us more
benefit, as it can reduce the unnecessary power-up of codecs.

This won't change the driver functionality.  The only difference would
be that the codec proc file will show the original pincfg values
instead of the actually referred values.  The actually referred values
can be determined from sysfs *_pin_configs files.
(Also hda-emu was updated to follow this change.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-22 17:45:45 +01:00
Takashi Iwai e15f1b43e1 ALSA: hda - Remove shutup calls in free callbacks
The free callback is called at the state where no extra verbs are
executed, thus calling *_shutup() is useless, as it's checking the
shutdown flag.  Remove such superfluous calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-21 15:06:13 +01:00
Takashi Iwai efc2f8de1d ALSA: hda - Use standard helper functions in patch_hdmi.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-21 15:06:05 +01:00
David Henningsson 34c3d1926b ALSA: hda - Cirrus: Correctly clear line_out_pins when moving to speaker
If this array is not cleared, the jack related code later might
fail to create "Internal Speaker Phantom Jack" on Dell Inspiron 3420 and
Dell Vostro 2420.

BugLink: https://bugs.launchpad.net/bugs/1076840
Cc: stable@vger.kernel.org (3.6+)
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-21 10:09:02 +01:00
David Henningsson af02dde8a6 ALSA: hda - Add support for Realtek ALC292
We found a new codec ID 292, and that just a simple quirk would enable
sound output/input on this ALC292 chip.

BugLink: https://bugs.launchpad.net/bugs/1081466
Cc: stable@vger.kernel.org
Tested-by: Acelan Kao <acelan.kao@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-21 09:06:04 +01:00
Takashi Iwai 87af0b80c9 Merge branch 'for-linus' into for-next
Merge the recent HD-audio codec change for fixing recursive suspend
calls.

Conflicts:
	sound/pci/hda/hda_codec.c
2012-11-19 21:25:27 +01:00
Takashi Iwai 2ea3c6a2c7 ALSA: hda - Limit runtime PM support only to known Intel chips
We've got a report that the runtime PM may make the codec the
unresponsive on AMD platforms.  Since the feature has been tested only
on the recent Intel platforms, it's safer to limit the support to such
devices for now.

This patch adds a new DCAPS bit flag indicating the runtime PM
support, and mark it for Intel controllers.

Reported-and-tested-by: Julian Wollrath <jwollrath@web.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-19 21:23:57 +01:00
Dylan Reid 08a978db51 ALSA: hda - Fix Acer Aspire models with analog mics.
The Acer Aspire AO756 has an analog built-in mic on nid 0x1b and an
external mic on nid 0x19.  The BIOS doesn't set this up.

The mic detect on this Acer Aspire netbook and Acer C7 ChromeBook is
only valid when the headphone is plugged.  The detect circuit relies on
the tip detect switch being closed on the jack.  Tell hda_jack to ignore
the mic sense unless the headphones are plugged.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-19 19:50:34 +01:00
Dylan Reid 0619ba8c17 ALSA: hda - Allow jack state to depend on another jack
Introduce the concept of a "gated" jack.  The gated jack's pin sense
is
only valid when the "gating" jack is plugged.  This requires checking
the gating jack when the gated jack changes and re-checking the gated
jack when the gating jack is plugged/unplugged.

This allows handling of devices where the mic jack detect floats when
the headphone jack is unplugged.

[Rewritten for fixing the possible snd_array reallocation, covering
 the missing callback calls and jack sync operations, as well as some
 code cleanups -- tiwai]

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-19 19:49:58 +01:00
Adam Buchbinder b3834be5c4 various: Fix spelling of "asynchronous" in comments.
"Asynchronous" is misspelled in some comments. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-19 14:32:13 +01:00
Adam Buchbinder 48fc7f7e78 Fix misspellings of "whether" in comments.
"Whether" is misspelled in various comments across the tree; this
fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-19 14:31:35 +01:00
Masanari Iida 02582e9bcc treewide: fix typo of "suport" in various comments and Kconfig
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-19 14:16:09 +01:00
Takashi Iwai 989c318715 ALSA: hda - Fix recursive suspend/resume call
When the bus reset is performed during the suspend/resume (including
the power-saving too), it calls snd_hda_suspend() and
snd_hda_resume() again, and deadlocks eventually.

For avoiding the recursive call, add a new flag indicating that the PM
is being performed, and don't go to the bus reset mode when it's on.

Reported-and-tested-by: Julian Wollrath <jwollrath@web.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-19 14:14:58 +01:00
Masanari Iida d755814808 treewide: fix typo of "suppport" in various comments
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-19 14:13:52 +01:00
Dan Carpenter effded75e2 ALSA: fm801: precedence bug in snd_fm801_tea575x_get_pins()
There is a precedence bug because | has higher precedence than ?:.  This
code was cut and pasted and I fixed a similar bug a few days ago.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-14 09:34:28 +01:00
Dan Carpenter d2153a1595 ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()
I don't think this works as intended.  '|' higher precedence than ?: so
the bitwize OR "0 | (val & STR_MOST)" is a no-op.

I have re-written it to be more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-13 08:51:47 +01:00
Takashi Iwai 063f603c8c ALSA: ice1724: Fix build error without CONFIG_PM_SLEEP
Bah, forgot this again...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-12 11:38:10 +01:00
Ondrej Zary ef8784453d ALSA: ice1724: enable suspend on unknown ICE1724 cards
Assume that unknown ICE1724-based cards are AC97-only that can suspend
without any additional card-specific code.

This fixes suspend on Gainward Hollywood@Home 7.1.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-12 10:47:56 +01:00
Takashi Iwai 05193639ca ALSA: hda - Add a missing quirk entry for iMac 9,1
This is another variant of iMac 9,1 with a different codec SSID.

Reported-and-tested-by: Everaldo Canuto <everaldo.canuto@gmail.com>
Cc: <stable@vger.kernel.org> [v3.3+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-12 10:07:36 +01:00
David Henningsson 34ca8d3399 ALSA: hda - Removed unused non-standard name "C/LFE"
A closer look shows that the name is not even used and can be removed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-09 08:21:20 +01:00
Takashi Iwai ee81abb623 ALSA: hda - Apply a proper chmap for built-in 2.1 speakers
When 2.1 speakers are detected, use the corresponding channel map
instead of the standard map with front+rear surrounds.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08 17:13:59 +01:00
Takashi Iwai f37bc7a88d ALSA: hda - Give standard "Bass Speaker" mixer for 2.1 speakers
When two built-in speakers are found on the machine, we can suppose
it's rather a 2.1 speaker system with a bass output instead of
front/surround channels.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08 17:00:37 +01:00
Takashi Iwai 17a4adbe68 Merge branch 'for-linus' into for-next 2012-11-08 15:58:25 +01:00
Kailang Yang 19a62823ea ALSA: hda - Add new codec ALC668 and ALC900 (default name ALC1150)
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08 10:29:22 +01:00
Kailang Yang 1387e2d127 ALSA: hda - Improve HP depop when system enter to S3
alc269_toggle_power_output() was only use in ALC269VB.  I rename it to
alc269vb_toggle_power_output().

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08 10:29:20 +01:00
Adrian Knoth d1a3c98d50 ALSA: hdspm - Fix sync check reporting on RME RayDAT
The RayDAT reports the sync status of its inputs in consecutive bit
positions, so all we do in hdspm_s1_sync_check is to iterate over idx:

    status = hdspm_read(hdspm, HDSPM_RD_STATUS_1);

    lock = (status & (0x1<<idx)) ? 1 : 0;
    sync = (status & (0x100<<idx)) ? 1 : 0;

The index is given in kcontrol->private_value:

    HDSPM_SYNC_CHECK("WC SyncCheck", 0),
    HDSPM_SYNC_CHECK("AES SyncCheck", 1),
    HDSPM_SYNC_CHECK("SPDIF SyncCheck", 2),
    HDSPM_SYNC_CHECK("ADAT1 SyncCheck", 3),
    HDSPM_SYNC_CHECK("ADAT2 SyncCheck", 4),
    HDSPM_SYNC_CHECK("ADAT3 SyncCheck", 5),
    HDSPM_SYNC_CHECK("ADAT4 SyncCheck", 6),
    HDSPM_SYNC_CHECK("TCO SyncCheck", 7),
    HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 8),

The patch corrects the indicated sync flags by passing the proper index
value to hdspm_s1_sync_check().

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-07 19:55:22 +01:00
Takashi Iwai d5266125fb ALSA: hda - Add pin fixups for ASUS G75
To parse properly the subwoofer outputs on ASUS G75 laptop with VT1802
codec, correct the default configurations of speaker pins 0x24 and
0x33.

Reported-by: Massimo Del Fedele <max@veneto.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-07 14:42:05 +01:00
Takashi Iwai ef4da45828 ALSA: hda - Fix invalid connections in VT1802 codec
VT1802 codec provides the invalid connection lists of NID 0x24 and
0x33 containing the routes to a non-exist widget 0x3e.  This confuses
the auto-parser.  Fix it up in the driver by overriding these
connections.

Reported-by: Massimo Del Fedele <max@veneto.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-07 14:42:04 +01:00
Takashi Iwai 5b3761954d ALSA: hda - Fix empty DAC filling in patch_via.c
In via_auto_fill_adc_nids(), the parser tries to fill dac_nids[] at
the point of the current line-out (i).  When no valid path is found
for this output, this results in dac = 0, thus it creates a hole in
dac_nids[].  This confuses is_empty_dac() and trims the detected DAC
in later reference.

This patch fixes the bug by appending DAC properly to dac_nids[] in
via_auto_fill_adc_nids().

Reported-by: Massimo Del Fedele <max@veneto.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-07 14:42:00 +01:00
David Henningsson c9adeefda0 ALSA: hda - Keep power link on for PantherPoint HDMI
On some of the PantherPoint HDMI machines we currently enable, we're seeing
trouble with unsol events, i e detecting monitor presence, especially when
on battery and after suspend/resume.

BugLink: https://bugs.launchpad.net/bugs/1075882
Tested-by: Cyrus Lien <cyrus.lien@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-07 09:35:02 +01:00
Sergiu Giurgiu 4492363251 ALSA: virtuoso: Xonar DSX support
This patch adds support for ASUS - Xonar DSX sound cards. Tested on
openSUSE 12.2 with kernel:
Linux 3.4.6-2.10-desktop #1 SMP PREEMPT Thu Jul 26 09:36:26 UTC 2012 (641c197) x86_64 x86_64 x86_64 GNU/Linux
Works:
 - play sounds
 - adjust volume on master channel.
 - mute .

Since Xonar DS uses the same chip, everything that works for DS should
work for DSX as well.

Signed-off-by: Sergiu Giurgiu <sgiurgiu11@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:53:16 +01:00
Takashi Iwai ae24c3191b ALSA: hda - Force to reset IEC958 status bits for AD codecs
Several bug reports suggest that the forcibly resetting IEC958 status
bits is required for AD codecs to get the SPDIF output working
properly after changing streams.

Original fix credit to Javeed Shaikh.

BugLink: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/359361

Reported-by: Robin Kreis <r.kreis@uni-bremen.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:36:32 +01:00
Ondrej Zary 5c0ee9497b ALSA: es1968: Add ESS vendor ID to pm_whitelist
Add generic ESS vendor ID to pm_whitelist. This should fix suspend on
all Maestro-2 and Maestro-2E based PCI cards.
Tested on Terratec DMX and SF64-PCE2.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:32:35 +01:00
Daniel J Blueman 00e17f767e ALSA: HDA: Mark CS260x immutable structures const
Mark structures that won't change const.

Signed-off-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:29:00 +01:00
Daniel J Blueman 16337e028a ALSA: HDA: Fix digital microphone on CS420x
Correctly enable the digital microphones with the right bits in the
right coeffecient registers on Cirrus CS4206/7 codecs. It also
prevents misconfiguring ADC1/2.

This fixes the digital mic on the Macbook Pro 10,1/Retina.

Based-on-patch-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Daniel J Blueman <daniel@quora.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:28:30 +01:00
Alexander Stein 5a83b4b5a3 ALSA: hda: Cirrus: Fix coefficient index for beep configuration
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-05 12:27:38 +01:00
Lars R. Damerow f0b3da9843 ALSA: hda - support Teradici 2200 host card audio
The audio chipset used in Teradici's Tera2 host cards is the same as that in
the 1200 host cards. This patch allows ALSA to recognize the Tera2 cards.

Signed-off-by: Lars R. Damerow <lars@pixar.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-04 09:24:08 +01:00
Masanari Iida ec8f53fb69 ALSA: Fix typo in drivers sound
Correct spelling typo in debug messages within drivers/sound

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-04 09:20:58 +01:00
Laurence Darby 3bef1c377d ALSA: hda - stop setup_dig_out_stream() causing clicks
Starting audio or seeking in various music players causes
setup_dig_out_stream() to be called, which resets the SPDIF stream,
which caused one DAC (but not another) to make a clicking noise every
time.

This patch ensures the reset only happens when it needs to, which is
when the format changes, and makes the code a little more readable.

Signed-off-by: Laurence Darby <ldarby@tuffmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-04 09:17:28 +01:00
Takashi Iwai 16c2e1fae8 ALSA: ice1724: Fix rate setup after resume
The rate isn't restored properly after resume since it's only set up
in hw_params, and not in prepare callback.  For fixing it, put the
corresponding call to resume callback as well.

Reported-and-tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-31 07:41:42 +01:00
Takashi Iwai a5d00dc3a4 Merge branch 'for-linus' into for-next
... for migrating the core changes for USB-audio disconnection fixes
2012-10-30 11:08:25 +01:00
Takashi Iwai 1a8506d440 ALSA: hda - Add tracepoints to HD-audio controller driver
Add a couple of tracepoints to snd-hda-intel for tracing the position
and the trigger timings.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-30 10:39:59 +01:00
Joe Perches 4ee3bffca4 ALSA: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
dev_<level> calls take less code than dev_printk(KERN_<LEVEL>
and reducing object size is good.
Coalesce multiline formats for easier grep.
Coalesce segmented single line formats too.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-28 09:56:20 +01:00
Gustavo Maciel Dias Vieira 5afc13af36 ALSA: hda - Fix mute-LED setup for HP dv5 laptop
The BIOS on HP dv5 doesn't have the DMI string to guide the setup of
mute led GPIO and polarity. Associate this laptop with the hp-inv-led
model.

Signed-off-by: Gustavo Maciel Dias Vieira <gustavo@sagui.org>
Tested-by: Vinícius Angiolucci <angiolucci@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-26 16:57:28 +02:00
Takashi Iwai 7dd7a2fd7e ALSA: au88x0: Give comment for vortex_wtdma_bufshift() issue
The check of the return value from vortex_wtdma_bufshft() in
vortex_interrupt() is useless as it executes no code.  Actually the
return value is intentionally ignored because the delta calculation
for wavetable doesn't work always correctly.  For avoiding the
confusion, a comment is added and the superfluous if () is removed.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-25 13:55:51 +02:00
Kees Cook 0b1714ad36 ALSA: sound/pci/hda: remove CONFIG_EXPERIMENTAL
This config item has not carried much meaning for a while now and is
almost always enabled by default. As agreed during the Linux kernel
summit, remove it.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-25 00:17:20 +02:00
Randy Dunlap 9e13db806e ALSA: ice1712: Fix build errors
Fix build errors by using correct kconfig symbol name:

sound/pci/ice1712/psc724.c:417:5: error: 'struct snd_ice1712' has no member named 'pm_resume'
sound/pci/ice1712/psc724.c:418:5: error: 'struct snd_ice1712' has no member named 'pm_suspend_enabled'

[Fixed another #ifdef CONFIG_PM in the same file, too, by tiwai]

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-23 20:32:41 +02:00
Pierre-Louis Bossart 5d890f591d ALSA: hda: support for wallclock timestamps
Reuse code from clocksource to handle wall clock counter.
Since wrapparound occurs, the audio timestamp is reinitialized
to zero on a trigger. Synchronized linked devices will
start counting from same reference to avoid any drift.

Max buffer time is limited to 178 seconds to make sure
wall clock counter does not overflow

Wallclock timestamps are disabled on capture streams
until we figure out how to handle digital inputs.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-23 16:13:52 +02:00
Denis Kirjanov 21b3de881b ALSA: als3000: check for the kzalloc return value
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-22 16:31:40 +02:00
Wei Yongjun 86a778a78d ALSA: hda - remove unused variable in azx_position_ok()
The variable stream is initialized but never used
otherwise, so remove the unused variable.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-22 10:47:48 +02:00
Takashi Iwai cb766404e6 ALSA: hda - Fix silent headphone output from Toshiba P200
By some reason, Toshiba laptop doesn't like the EAPD turned up for the
headphone pin.  Add a fix up code to force to turn down EAPD for NID
0x15.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=569991

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-20 18:20:55 +02:00