platform/kernel/linux-stable.git
11 years agoALSA: hda - Revive SPDIF mux for IDT/STAC codecs
Takashi Iwai [Tue, 22 Jan 2013 08:34:48 +0000 (09:34 +0100)]
ALSA: hda - Revive SPDIF mux for IDT/STAC codecs

The stuff that was dropped while transition to the generic parser is
now recovered.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Disable HP auto-mute during independent HP mode
Takashi Iwai [Tue, 22 Jan 2013 06:46:31 +0000 (07:46 +0100)]
ALSA: hda - Disable HP auto-mute during independent HP mode

Both the HP auto-mute and the independent HP mode conflict with each
other.  Make HP auto-mute disabled (only for the affected HP jack)
during the driver is in HP independent mode.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Set individual name to secondary analog PCM stream
Takashi Iwai [Mon, 21 Jan 2013 15:50:09 +0000 (16:50 +0100)]
ALSA: hda - Set individual name to secondary analog PCM stream

It'd be better to give another name to the secondary (alt) analog PCM
stream, which is dedicated for the independent HP out and extra
inputs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add aamix NID to AD codecs
Takashi Iwai [Mon, 21 Jan 2013 15:40:16 +0000 (16:40 +0100)]
ALSA: hda - Add aamix NID to AD codecs

The aamix NIDs are also missing for AD codecs.  All AD codecs seem to
have a (more or less) working aamix widget.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add aamix NID to IDT 92HD codecs
Takashi Iwai [Mon, 21 Jan 2013 15:25:18 +0000 (16:25 +0100)]
ALSA: hda - Add aamix NID to IDT 92HD codecs

IDT codecs have analog-loopback mixer widgets, but we haven't cared
about it, so far.  Let's set them.  This will avoid also possible
wrong routes for the input paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Remove superfluous header inclusions
Takashi Iwai [Mon, 21 Jan 2013 15:10:56 +0000 (16:10 +0100)]
ALSA: hda - Remove superfluous header inclusions

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Enable parsing the independent HP mode as default for VIA codecs
Takashi Iwai [Mon, 21 Jan 2013 14:15:55 +0000 (15:15 +0100)]
ALSA: hda - Enable parsing the independent HP mode as default for VIA codecs

The original VIA codec parser enabled it as default, so let's keep the
behavior as it was.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix conflicts between Loopback Mixing and Independent HP
Takashi Iwai [Mon, 21 Jan 2013 14:11:25 +0000 (15:11 +0100)]
ALSA: hda - Fix conflicts between Loopback Mixing and Independent HP

This patch eventually fixes two issues:
- Handle the case where the primary output is a headphone and can have
  independent HP mode;
  so far we checked only the case where the headphone is the secondary
  output.

- Fix the conflict of HP independent mode and aamix mode;
  when switched to aamix mode, the DAC might be also switched to
  another widget shared with other outputs.  Then even if we disable
  the DAC for the original output, it doesn't change -- because the
  active route is from another (shared) DAC to HP pin through aamix.
  So, in such a case, we have to prohibit the switch to aamix for HP
  routes.

This fixes issues appearing on VT codecs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Check aamix-output paths from other DACs, too
Takashi Iwai [Mon, 21 Jan 2013 13:24:31 +0000 (14:24 +0100)]
ALSA: hda - Check aamix-output paths from other DACs, too

Many codecs provide routes to multiple output pins through an aamix
widget, but most of them do it only from a single DAC.  However, the
current generic parser checks only the aamix paths from the original
(directly bound) DACs through aamix NID, and miss the path:
  primary DAC -> aamix -> target out pin

This patch adds a more check for the routes like the above.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add missing badness evaluation for unresolved paths
Takashi Iwai [Mon, 21 Jan 2013 10:43:19 +0000 (11:43 +0100)]
ALSA: hda - Add missing badness evaluation for unresolved paths

When a patch couldn't be resolved in try_assign_dacs() although the
target DAC is expected, we forgot to add a proper badness value but
continued.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Set the pin targets after deciding output config
Takashi Iwai [Mon, 21 Jan 2013 09:49:05 +0000 (10:49 +0100)]
ALSA: hda - Set the pin targets after deciding output config

Since fill_and_eval_dacs() may be called repeatedly with different
configurations, setting pinctls at each time there isn't optimal.
We can set it better only once after deciding the output configuration
in parse_output_paths().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Improve debug prints for output paths
Takashi Iwai [Mon, 21 Jan 2013 09:43:18 +0000 (10:43 +0100)]
ALSA: hda - Improve debug prints for output paths

Print the information of outputs in a bit more details and concisely
in a single place instead of printing the path at each time when
detected.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/conexant - Set mixer NID 0x19 for CX20551 codec
Takashi Iwai [Fri, 18 Jan 2013 17:25:45 +0000 (18:25 +0100)]
ALSA: hda/conexant - Set mixer NID 0x19 for CX20551 codec

Conexant CX20551 codec has a mixer in NID 0x19 and a few outputs have
to take the input through this widget.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Correct more array rooms in hda_gen_spec
Takashi Iwai [Fri, 18 Jan 2013 15:38:08 +0000 (16:38 +0100)]
ALSA: hda - Correct more array rooms in hda_gen_spec

Looking through the whole definitions, some fields have inappropriate
array sizes, especially about the capture.  The array assigned to each
input (pin) should have HDA_MAX_NUM_INPUTS entries while the array
assigned to each ADC should have AUTO_CFG_MAX_INS entries.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix the wrong adc_idx for capture source
Takashi Iwai [Fri, 18 Jan 2013 15:23:25 +0000 (16:23 +0100)]
ALSA: hda - Fix the wrong adc_idx for capture source

The patch "ALSA: hda - fix wrong adc_idx in generic parser" fixed the
adc_idx for the capture volume and capture switch controls.  But also
modified the adc_idx retrieval for the capture source controls
wrongly.  As multiple capture source controls are created in a single
shot with counts > 1, the id.index doesn't contain the real value.
The real index has to be taken via snd_ctl_get_ioffidx() as in the
original code.

This patch reverts the fixes partially to recover from the
regression.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Don't add unnecessary indices on HDMI and SPDIF
David Henningsson [Fri, 18 Jan 2013 14:43:03 +0000 (15:43 +0100)]
ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

If there's one each of HDMI and SPDIF, we should not add an index
on the one that comes second.

[slight code refactoring by tiwai]

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - don't compare with yourself in fill_input_pin_labels
David Henningsson [Fri, 18 Jan 2013 14:43:02 +0000 (15:43 +0100)]
ALSA: hda - don't compare with yourself in fill_input_pin_labels

Just stumbled over this one while reading the code.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - make sure there are enough input labels and paths
David Henningsson [Fri, 18 Jan 2013 14:43:01 +0000 (15:43 +0100)]
ALSA: hda - make sure there are enough input labels and paths

I found a codec configuration which had six inputs, so the max of
five was not appropriate.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix speaker pin of FSC Lifebook S7110 laptop
Takashi Iwai [Fri, 18 Jan 2013 14:41:34 +0000 (15:41 +0100)]
ALSA: hda - Fix speaker pin of FSC Lifebook S7110 laptop

Some BIOS version of FSC Lifebook S7110 laptop seems to give a wrong
default pin config for NID 0x15, which confuses the parser.  Give a
fixup to correct the value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add boost to line inputs, too
Takashi Iwai [Fri, 18 Jan 2013 13:37:16 +0000 (14:37 +0100)]
ALSA: hda - Add boost to line inputs, too

Although I commented that boost volumes would be added only for
line-in and mic pins in the source code, the actual code excludes but
for mic-in.  Fix it to accept the line-ins, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/sigmatel - Add bass speaker support for HP ENVY Spectre XT
Takashi Iwai [Fri, 18 Jan 2013 13:28:07 +0000 (14:28 +0100)]
ALSA: hda/sigmatel - Add bass speaker support for HP ENVY Spectre XT

The pin configuration for the bass speaker needs to be corrected in a
fixup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Consolidate cap_sync_hook and capture_switch_hook
Takashi Iwai [Fri, 18 Jan 2013 13:10:00 +0000 (14:10 +0100)]
ALSA: hda - Consolidate cap_sync_hook and capture_switch_hook

Two hooks in hda_gen_spec, cap_sync_hook and capture_switch_hook, play
very similar roles.  The only differences are that the former is
called more often (e.g. at init or switching capsrc) while the latter
can take an on/off argument.

As a more generic implementation, consolidate these two hooks, and
pass snd_ctl_elem_value pointer as the second argument.  If the
secondary argument is non-NULL, it can take the on/off value, so the
caller handles it like the former capture_switch_hook.  If it's NULL,
it's called in the init or capsrc switch case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix missing call of capture_switch_hook
Takashi Iwai [Fri, 18 Jan 2013 13:01:14 +0000 (14:01 +0100)]
ALSA: hda - Fix missing call of capture_switch_hook

When a standard capture switch without multiple binding is used, the
call for capture_switch_hook isn't called properly.  Replace the put
ops to add the hook call in that case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Look for boost controls more deeply
Takashi Iwai [Fri, 18 Jan 2013 10:07:15 +0000 (11:07 +0100)]
ALSA: hda - Look for boost controls more deeply

In the current generic parser code, we look for the (mic) boost
controls only on input pins.  But many codecs assign the boost volume
to a widget connected to each input pin instead of the input amp of
the pin itself.

In this patch, the parser tries to look through more widgets connected
to the pin and find a boost amp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix invalid mute in path activation
Takashi Iwai [Fri, 18 Jan 2013 10:01:33 +0000 (11:01 +0100)]
ALSA: hda - Fix invalid mute in path activation

When an amp in the activation path is associated with mixer controls,
activate_amp() tries to skip the initialization.  It's good, but only
if the mixer really initializes both mute and volume.  Otherwise,
either the mute of the volume is left uninitialized.

This patch adds this missing check and properly initialize the
partially controlled amps in an activation path.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Unify input label creations in generic parser
Takashi Iwai [Fri, 18 Jan 2013 09:17:30 +0000 (10:17 +0100)]
ALSA: hda - Unify input label creations in generic parser

There are a few places creating the labels and indices of kctls for
each input pin in the current generic parser code.  This is redundant
and makes harder to maintain.  Let's create the labels and indices at
once and keep them in hda_gen_spec.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Keep autocfg.input idx value in imux table
Takashi Iwai [Fri, 18 Jan 2013 09:01:15 +0000 (10:01 +0100)]
ALSA: hda - Keep autocfg.input idx value in imux table

Since the imux table entries can be a subset of autocfg.input table,
the indices of these aren't always same.  For passing the proper index
value of autocfg.input at creating input ctl labels (via
snd_hda_autocfg_input_label()), keep the corresponding autocfg.input
idx value in the index field of each imux item, which isn't used in
the generic driver.

Also, this makes easier to check the invalid imux pin for stereo mix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix missing unsol event handler in some codec drivers
Takashi Iwai [Fri, 18 Jan 2013 06:51:17 +0000 (07:51 +0100)]
ALSA: hda - Fix missing unsol event handler in some codec drivers

This resulted in non-working auto-mute behavior, of course...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic parser for STAC/IDT codec driver
Takashi Iwai [Thu, 17 Jan 2013 16:07:59 +0000 (17:07 +0100)]
ALSA: hda - Use generic parser for STAC/IDT codec driver

Finally we reached here.  All codecs driver (except for CA0132, which
has really device-specific requirements) have been converted to use
the generic parser.

This patch appears bigger than others since it also involves with the
code shuffling, but mostly the cut-off of parser codes and adapt to
the generic parser flags.  Most of fixup codecs haven't been changed
but just removed a few unnecessary codes.

The only missing stuff is the SPDIF mux control.  It'll be added again
later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'test/hda-gen-parser' into test/hda-migrate
Takashi Iwai [Thu, 17 Jan 2013 15:20:14 +0000 (16:20 +0100)]
Merge branch 'test/hda-gen-parser' into test/hda-migrate

* test/hda-gen-parser:
  ALSA: hda - Improve naming rule for primary output
  ALSA: hda - Add PCM capture hook to hda_gen_spec
  ALSA: hda - Record all detected ADCs in hda_gen_spec
  ALSA: hda - Move vmaster TLV parsing to snd_hda_gen_parse_auto_config()
  ALSA: hda - Add input jack mode enum controls to generic parser
  ALSA: hda - Give more comments to hda_gen_spec flags
  ALSA: hda - Add suppress_auto_mute flag to hda_gen_spec
  ALSA: hda - Record the current speaker / LO mute status in hda_gen_spec
  ALSA: hda - Properly call automute/switch hooks at init

11 years agoALSA: hda - Improve naming rule for primary output
Takashi Iwai [Thu, 17 Jan 2013 15:18:11 +0000 (16:18 +0100)]
ALSA: hda - Improve naming rule for primary output

When the volume or mute control of the primary output is shared with
other (headphone or speaker) outputs, we shouldn't name it as a
specific output type but rather name it with the channel name or a
generic name like "PCM".

Also, this check should be performed individually for the volume and
the mute controls because some codecs may have shared volumes but
separate mute controls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add PCM capture hook to hda_gen_spec
Takashi Iwai [Thu, 17 Jan 2013 14:57:10 +0000 (15:57 +0100)]
ALSA: hda - Add PCM capture hook to hda_gen_spec

Not only PCM playback, a hook for PCM capture would be required for
power controls in codec drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Record all detected ADCs in hda_gen_spec
Takashi Iwai [Thu, 17 Jan 2013 14:53:29 +0000 (15:53 +0100)]
ALSA: hda - Record all detected ADCs in hda_gen_spec

Since the generic parser reduces the ADC list, copy the list of the
all detected ADCs and keep it.

This list can be later referred by the codec driver for finer power
controls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Move vmaster TLV parsing to snd_hda_gen_parse_auto_config()
Takashi Iwai [Thu, 17 Jan 2013 09:25:15 +0000 (10:25 +0100)]
ALSA: hda - Move vmaster TLV parsing to snd_hda_gen_parse_auto_config()

Add vmaster_tlv[] to hda_gen_spec and store the suggested TLV data
in snd_hda_gen_parse_auto_config().  This allows the codec driver to
correct the TLV data (e.g. mute capability) before actually creating
vmaster instance.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add input jack mode enum controls to generic parser
Takashi Iwai [Thu, 17 Jan 2013 08:52:11 +0000 (09:52 +0100)]
ALSA: hda - Add input jack mode enum controls to generic parser

Just like the jack mode enum ctls for output jacks, add the support
for similar enum ctls for input pins to control the bias Vref.
The new controls will be added when spec->add_in_jack_modes is set
either by the codec driver or by a hint string.

Note that ground and 100% vrefs are excluded from the list for
simplicity, currently.  We may add a new flag to allow them, too.
But I guess it's easier to put a value override in the pinfix in such
a case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Minor cleanup/fixes for patch_sigmatel.c fixup transition
Takashi Iwai [Thu, 17 Jan 2013 07:49:01 +0000 (08:49 +0100)]
ALSA: hda - Minor cleanup/fixes for patch_sigmatel.c fixup transition

- spec->hp_detect has to be overridden in HDA_FIXUP_ACT_PARSE, not in
  PRE_PARSE.
- Remove err == 0 check but return directly -EINVAL from
  stac92xx_parse_auto_config()
- Set spec->default_polarity for 92HD71bxx
- Some code shuffles

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Give more comments to hda_gen_spec flags
Takashi Iwai [Wed, 16 Jan 2013 17:28:38 +0000 (18:28 +0100)]
ALSA: hda - Give more comments to hda_gen_spec flags

Since we have many bit flags in hda_gen_spec, rearrange in sections
and give more comments there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add suppress_auto_mute flag to hda_gen_spec
Takashi Iwai [Wed, 16 Jan 2013 17:20:07 +0000 (18:20 +0100)]
ALSA: hda - Add suppress_auto_mute flag to hda_gen_spec

A new flag to skip the auto-mute handling in the generic parser, just
like suppress_auto_mic flag.  It has to be set before calling
snd_hda_gen_parse_auto_config().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Record the current speaker / LO mute status in hda_gen_spec
Takashi Iwai [Wed, 16 Jan 2013 17:18:00 +0000 (18:18 +0100)]
ALSA: hda - Record the current speaker / LO mute status in hda_gen_spec

... to be referred by the codec driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Properly call automute/switch hooks at init
Takashi Iwai [Wed, 16 Jan 2013 17:08:55 +0000 (18:08 +0100)]
ALSA: hda - Properly call automute/switch hooks at init

... and a little bit of code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'test/hda-gen-parser' into test/hda-migrate
Takashi Iwai [Wed, 16 Jan 2013 15:25:24 +0000 (16:25 +0100)]
Merge branch 'test/hda-gen-parser' into test/hda-migrate

* test/hda-gen-parser:
  ALSA: hda - Make sure fill_all_dac_nids is called for digital only codecs
  ALSA: hda - force different capture controls if amp caps differ
  ALSA: hda - do not add non-existing Mic boost controls
  ALSA: hda - initialize channel counts correctly
  ALSA: hda - fix wrong adc_idx in generic parser
  ALSA: hda - Check array bounds in get_input_path
  ALSA: hda - Add prefer_hp_amp flag to hda_gen_spec
  ALSA: hda - fix OOPS in hda_mark_cmd_cache_dirty
  ALSA: hda - Check pincap while parsing the configuration

11 years agoALSA: hda - Make sure fill_all_dac_nids is called for digital only codecs
David Henningsson [Wed, 16 Jan 2013 14:58:45 +0000 (15:58 +0100)]
ALSA: hda - Make sure fill_all_dac_nids is called for digital only codecs

Otherwise no PCM will be built for codecs without analog I/O.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - force different capture controls if amp caps differ
David Henningsson [Wed, 16 Jan 2013 14:58:44 +0000 (15:58 +0100)]
ALSA: hda - force different capture controls if amp caps differ

Otherwise setting the capture volume for amps will be weird and
inconsistent (it will try to set values outside the range of the
second amp based on capabilities of the first amp).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - do not add non-existing Mic boost controls
David Henningsson [Wed, 16 Jan 2013 14:58:43 +0000 (15:58 +0100)]
ALSA: hda - do not add non-existing Mic boost controls

If the input node does not have any volume capable input amp,
don't add such a control.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - initialize channel counts correctly
David Henningsson [Wed, 16 Jan 2013 10:45:37 +0000 (11:45 +0100)]
ALSA: hda - initialize channel counts correctly

Even a single DAC can output two channels, so the channel count
is twice the number of DACs.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - fix wrong adc_idx in generic parser
David Henningsson [Wed, 16 Jan 2013 10:45:36 +0000 (11:45 +0100)]
ALSA: hda - fix wrong adc_idx in generic parser

We use knew->index for adc_idx when we create "Capture Volume" and
"Capture Switch", so use the same to retrieve adc_idx.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Check array bounds in get_input_path
David Henningsson [Wed, 16 Jan 2013 10:45:35 +0000 (11:45 +0100)]
ALSA: hda - Check array bounds in get_input_path

This gives us some additional safety.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add prefer_hp_amp flag to hda_gen_spec
Takashi Iwai [Tue, 15 Jan 2013 17:45:53 +0000 (18:45 +0100)]
ALSA: hda - Add prefer_hp_amp flag to hda_gen_spec

Add a new flag to indicate whether HP amp is turned on as default for
speaker or line-outs, and enable this for ALC260 codec, as many
machines with this codec require the HP amp even for speakers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - fix OOPS in hda_mark_cmd_cache_dirty
David Henningsson [Tue, 15 Jan 2013 14:27:19 +0000 (15:27 +0100)]
ALSA: hda - fix OOPS in hda_mark_cmd_cache_dirty

Obvious copy-paste error.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/sigmatel - Remove superfluous fields from sigmatel_spec
Takashi Iwai [Tue, 15 Jan 2013 10:22:01 +0000 (11:22 +0100)]
ALSA: hda/sigmatel - Remove superfluous fields from sigmatel_spec

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/sigmatel - Move w/a for HP Mini 110 LED to fixup table
Takashi Iwai [Tue, 15 Jan 2013 10:20:50 +0000 (11:20 +0100)]
ALSA: hda/sigmatel - Move w/a for HP Mini 110 LED to fixup table

Instead of checking the codec SSID in find_mute_led_cfg() for HP Mini
110, set the proper spec->default_polairty in the fixup table.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/sigmatel - Remove PCI id check in find_mute_led_cfg()
Takashi Iwai [Tue, 15 Jan 2013 10:12:18 +0000 (11:12 +0100)]
ALSA: hda/sigmatel - Remove PCI id check in find_mute_led_cfg()

The PCI vendor ID check in find_mute_led_cfg() is now superfluous
because the function is called in the fixup table entries of HP
machines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for IDT92HD83xxx
Takashi Iwai [Mon, 14 Jan 2013 17:06:34 +0000 (18:06 +0100)]
ALSA: hda - Use standard fixup table for IDT92HD83xxx

Finally all codecs in patch_sigmatel.c have been converted to use the
standard fixup helpers.  This change also includes trivial cleanups
like the call of common setup for GPIO LED or the removal of unused
function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for IDT92HD73xx
Takashi Iwai [Mon, 14 Jan 2013 16:30:04 +0000 (17:30 +0100)]
ALSA: hda - Use standard fixup table for IDT92HD73xx

This one is rather a simple conversion.  The fixups for Dell machines
are implemented by fixup functions in the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for IDT92HD71Bxx
Takashi Iwai [Mon, 14 Jan 2013 16:05:25 +0000 (17:05 +0100)]
ALSA: hda - Use standard fixup table for IDT92HD71Bxx

This time, the only intrusive changes are for HP machines.
As the mute LED fixup and the bass speaker switch are required only
for HP machines, we can move these checks into the fixup entries; the
former is applied generically to all HP machines while the latter for
only certain models.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Check pincap while parsing the configuration
Takashi Iwai [Tue, 15 Jan 2013 07:45:33 +0000 (08:45 +0100)]
ALSA: hda - Check pincap while parsing the configuration

Sometimes (or rather often) BIOS sets the pin default configurations
obviously wrongly.  Looking through these failures, one common pattern
is to enable some dead pins that are usually marked as speaker pins.
In such a case, we can skip them if the pins don't have the output
capability.

In this patch, add a check for the valid pin cap bit for each parsed
pin, and filter out when it's invalid.

The fix was originally suggested by Raymond Yau.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC927x
Takashi Iwai [Mon, 14 Jan 2013 15:03:38 +0000 (16:03 +0100)]
ALSA: hda - Use standard fixup table for STAC927x

This conversion is a bit tricky.  Since STAC927x may take two
different volume-knob initialization values depending on the model, a
new flag, spec->volknob_init, is introduced to indicate whether it's
the standard volume-knob initialization or not.

Also, Dell BIOS model is now directly mapped onto the fixup table
instead of parsing in the function.  This resulted in a new model ref,
STAC_927X_DELL_BIOS_SPDIF, which is a chained entry.

Also, for reducing the fixups, virtual entries like
STAC_927X_DELL_DMIC and STAC_D965_VERBS are introduced.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC922x
Takashi Iwai [Mon, 14 Jan 2013 14:20:13 +0000 (15:20 +0100)]
ALSA: hda - Use standard fixup table for STAC922x

Rather straightforward conversion, except for ones for Intel Mac.
As Intel Mac have only unique codec SSIDs, we need to remap the fixup
again for the codec SSID and call the new fixup there.

Also, we can reduce model enums like STAC_MACMINI, which are model
aliases for backward compatibility, since they can be pointed directly
via hda_model_fixup table.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC9205
Takashi Iwai [Mon, 14 Jan 2013 13:46:51 +0000 (14:46 +0100)]
ALSA: hda - Use standard fixup table for STAC9205

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC9872
Takashi Iwai [Mon, 14 Jan 2013 13:29:36 +0000 (14:29 +0100)]
ALSA: hda - Use standard fixup table for STAC9872

Now for STAC9872.  It has a small fixup table, fortunately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC925x
Takashi Iwai [Mon, 14 Jan 2013 13:20:16 +0000 (14:20 +0100)]
ALSA: hda - Use standard fixup table for STAC925x

Similar like the previous commit, convert patch_stac925x() to use the
standard fixup table.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use standard fixup table for STAC9200
Takashi Iwai [Mon, 14 Jan 2013 13:06:26 +0000 (14:06 +0100)]
ALSA: hda - Use standard fixup table for STAC9200

Convert patch_stac9200() to use the standard fixup table instead of
manual switch-case with board_config.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'test/hda-gen-parser' into test/hda-migrate
Takashi Iwai [Mon, 14 Jan 2013 11:36:18 +0000 (12:36 +0100)]
Merge branch 'test/hda-gen-parser' into test/hda-migrate

* test/hda-gen-parser:
  ALSA: hda - Add capture_switch_hook to generic parser

11 years agoALSA: hda - Add capture_switch_hook to generic parser
Takashi Iwai [Mon, 14 Jan 2013 11:13:06 +0000 (12:13 +0100)]
ALSA: hda - Add capture_switch_hook to generic parser

Add a hook for the capture mixer switch.  This will be used by IDT
codecs for controlling the mic-mute LED.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic parser for VIA codec driver
Takashi Iwai [Mon, 7 Jan 2013 11:27:36 +0000 (12:27 +0100)]
ALSA: hda - Use generic parser for VIA codec driver

Yet another step forward.  As all features for VIA codecs have been
implemented in the generic driver, we can move on to migrate the VIA
codec parser, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add generic parser support to Analog Device codec driver
Takashi Iwai [Fri, 21 Dec 2012 14:17:06 +0000 (15:17 +0100)]
ALSA: hda - Add generic parser support to Analog Device codec driver

This patch adds the support for the generic auto-parser to AD codec
driver.  For AD1988, the old code is replaced simply with the new
generic parser.  For other codecs, new model "auto" is added and
directed to use the generic parser.

No fixup codes have been implemented yet as of now.  Eventually we'd
replace each static quirk with the generic parser + fixup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Rearrange for dropping static quirk codes in Coexant driver
Takashi Iwai [Thu, 20 Dec 2012 15:38:19 +0000 (16:38 +0100)]
ALSA: hda - Rearrange for dropping static quirk codes in Coexant driver

Just shuffle the codes and add ifdefs for testing to drop the static
quirk codes from patch_conexant.c.

By commenting out ENABLE_CXT_STATIC_QUIRKS define at the beginning of
the file, you can disable the whole static codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic parser in Conexant codec driver
Takashi Iwai [Thu, 20 Dec 2012 15:34:12 +0000 (16:34 +0100)]
ALSA: hda - Use generic parser in Conexant codec driver

... and drop most of own parser code.

It doesn't replace any present static quirks, though.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic parser for Cirrus codec driver
Takashi Iwai [Wed, 19 Dec 2012 15:39:18 +0000 (16:39 +0100)]
ALSA: hda - Use generic parser for Cirrus codec driver

This time, the target is Cirrus codec.  Its parser is a subset of
generic parser, so we can migrate fully with it now.

The only tricky part is the handling of SPDIF automute.
Cirrus driver sets the SPDIF out plug over the headphone.  As a
workaround, set spec->gen.master_mute for toggling the headphone (and
other) mute.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic parser for CA0110 codec
Takashi Iwai [Wed, 19 Dec 2012 17:04:37 +0000 (18:04 +0100)]
ALSA: hda - Use generic parser for CA0110 codec

CA0110 codec is a fairly straightforward hardware implementation,
and we can use the generic parser almost as is.
Just set spec->multi_cap_vol flag to follow the current behavior.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use generic codec parser for C-Media codecs
Takashi Iwai [Wed, 19 Dec 2012 16:35:47 +0000 (17:35 +0100)]
ALSA: hda - Use generic codec parser for C-Media codecs

Replace the old parser code for C-Media auto-parser with the latest
generic parser.  For compatibility reason, the static bindings are
still left, but they could be cleaned up in future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Remove superfluous kconfig depends
Takashi Iwai [Wed, 19 Dec 2012 16:37:12 +0000 (17:37 +0100)]
ALSA: hda - Remove superfluous kconfig depends

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Allow user to give hints for codec parser behavior
Takashi Iwai [Fri, 11 Jan 2013 16:48:22 +0000 (17:48 +0100)]
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>
11 years agoALSA: hda - Add snd_hda_get_int_hint() helper function
Takashi Iwai [Fri, 11 Jan 2013 16:40:31 +0000 (17:40 +0100)]
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>
11 years agoALSA: hda - Protect user-defined arrays via mutex
Takashi Iwai [Thu, 10 Jan 2013 17:21:56 +0000 (18:21 +0100)]
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>
11 years agoALSA: hda/realtek - Generic mute LED implementation for HP laptops
Takashi Iwai [Thu, 10 Jan 2013 16:33:58 +0000 (17:33 +0100)]
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>
11 years agoALSA: hda/realtek - Fix the timing for some fixups
Takashi Iwai [Thu, 10 Jan 2013 16:14:29 +0000 (17:14 +0100)]
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>
11 years agoALSA: hda/realtek - Add a fixup for FSC S7020 laptop
Takashi Iwai [Thu, 10 Jan 2013 16:10:40 +0000 (17:10 +0100)]
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>
11 years agoALSA: hda - Add output jack mode enum controls
Takashi Iwai [Thu, 10 Jan 2013 15:57:58 +0000 (16:57 +0100)]
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>
11 years agoALSA: hda - Update automute / automic upon jack retasking
Takashi Iwai [Thu, 10 Jan 2013 15:10:06 +0000 (16:10 +0100)]
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>
11 years agoALSA: hda - Add a new fixup type to override pinctl values
Takashi Iwai [Thu, 10 Jan 2013 09:18:14 +0000 (10:18 +0100)]
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>
11 years agoALSA: hda/realtek - Read the cached pinctl value in fixups
Takashi Iwai [Thu, 10 Jan 2013 09:12:22 +0000 (10:12 +0100)]
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>
11 years agoALSA: hda/realtek - Drop aliases for old fixups
Takashi Iwai [Thu, 10 Jan 2013 08:52:52 +0000 (09:52 +0100)]
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>
11 years agoALSA: hda - Avoid auto-mute or auto-mic of retasked jacks
Takashi Iwai [Thu, 10 Jan 2013 08:45:13 +0000 (09:45 +0100)]
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>
11 years agoALSA: hda - Manage current pinctl values in generic parser
Takashi Iwai [Thu, 10 Jan 2013 08:33:29 +0000 (09:33 +0100)]
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>
11 years agoALSA: hda - More strict correction of invalid pinctl bits
Takashi Iwai [Thu, 10 Jan 2013 07:56:46 +0000 (08:56 +0100)]
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>
11 years agoALSA: hda - Add helper functions to cache the current pinctl target
Takashi Iwai [Thu, 10 Jan 2013 07:38:04 +0000 (08:38 +0100)]
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>
11 years agoALSA: hda - Clear the dropped paths properly
Takashi Iwai [Wed, 9 Jan 2013 08:28:20 +0000 (09:28 +0100)]
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>
11 years agoALSA: hda - Allow aamix as a capture source
Takashi Iwai [Wed, 9 Jan 2013 08:14:23 +0000 (09:14 +0100)]
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>
11 years agoALSA: hda - Fix inconsistent input_paths after ADC reduction
Takashi Iwai [Wed, 9 Jan 2013 08:06:18 +0000 (09:06 +0100)]
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>
11 years agoALSA: hda - Return "Headphone Mic" from hda_get_autocfg_input_label()
Takashi Iwai [Wed, 9 Jan 2013 07:46:34 +0000 (08:46 +0100)]
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>
11 years agoALSA: hda - Exclude aamix from capture paths
Takashi Iwai [Wed, 9 Jan 2013 07:41:41 +0000 (08:41 +0100)]
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>
11 years agoALSA: hda - Add a flag to suppress mic auto-switch
Takashi Iwai [Mon, 7 Jan 2013 15:32:11 +0000 (16:32 +0100)]
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>
11 years agoALSA: hda - Handle BOTH jack port as a fixed output
Takashi Iwai [Mon, 7 Jan 2013 17:21:47 +0000 (18:21 +0100)]
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>
11 years agoALSA: hda - Re-define snd_hda_parse_nid_path()
Takashi Iwai [Mon, 7 Jan 2013 16:25:08 +0000 (17:25 +0100)]
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>
11 years agoALSA: hda - Manage input paths via path indices
Takashi Iwai [Mon, 7 Jan 2013 16:09:26 +0000 (17:09 +0100)]
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>
11 years agoALSA: hda - Fix multi-io channel mode management
Takashi Iwai [Mon, 7 Jan 2013 15:44:06 +0000 (16:44 +0100)]
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>
11 years agoALSA: hda - Don't set up active streams twice
Takashi Iwai [Mon, 7 Jan 2013 14:36:45 +0000 (15:36 +0100)]
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>
11 years agoALSA: hda - Remove unused dac reference in create_multi_out_ctls()
Takashi Iwai [Mon, 7 Jan 2013 14:14:00 +0000 (15:14 +0100)]
ALSA: hda - Remove unused dac reference in create_multi_out_ctls()

Remove useless code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use direct path reference in assign_out_path_ctls()
Takashi Iwai [Mon, 7 Jan 2013 14:11:44 +0000 (15:11 +0100)]
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>