Commit Graph

275 Commits

Author SHA1 Message Date
Takashi Iwai b3f6008f2d 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>
2013-01-12 08:45:02 +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 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
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 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 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
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 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
Takashi Iwai 7819d1c70e ALSA: hda - Add missing hda_gen_spec to struct via_spec
The commit [4b527b65 ALSA: hda - limit internal mic boost for Asus
X202E] introduced the use of auto-parser code, but it forgot to add
struct hda_gen_spec at the head of codec->spec which the auto-parser
assumes silently.  Without this record, it may result in memory
corruption.

This patch adds the missing piece.

Cc: <stable@vger.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-10 09:23:10 +02:00
David Henningsson 4e2d16d326 ALSA: hda - make VIA codec use generic unsol event handler
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-08 15:48:02 +02:00
David Henningsson 67aeda1f34 ALSA: hda - Remove dead GPIO code for VIA codec
From what I can conclude all GPIO handling was removed in 2009.
Remove dead code remnants.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-08 15:47:54 +02:00
Herton Ronaldo Krzesinski cf55e90451 ALSA: hda/via - don't report presence on HPs with no presence support
If headphone jack can't detect plug presence, and we have the jack in
the jack table, snd_hda_jack_detect will return the plug as always
present (as it'll be considered as a phantom jack). The problem is that
when this happens, line out pins will always be disabled, resulting in
no sound if there are no headphones connected.

This was reported as a no sound problem after suspend on
http://bugs.launchpad.net/bugs/1052499, since the bug doesn't manifests
on first initialization before the phantom jack is added, but on resume
we reexecute the initialization code, and via_hp_automute starts
reporting HP always present with the jack now on the table.

BugLink: https://bugs.launchpad.net/bugs/1052499
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Cc: <stable@vger.kernel.org> [v3.6+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-22 09:24:54 +02:00
David Henningsson 4b527b6516 ALSA: hda - limit internal mic boost for Asus X202E
When the input gain for the internal mic is set to its maximum level,
the background noise becomes so high - and any relevant signal clipped -
that the setting becomes unusable. It is better to limit the amplification.

BugLink: https://bugs.launchpad.net/bugs/1052460
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Cc: <stable@vger.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-18 14:32:42 +02:00
Takashi Iwai 83012a7ccb ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE
CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its
behavior can be well controlled via the default value and module
parameter.  Let's just replace it with the standard CONFIG_PM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 07:50:13 -07:00
Takashi Iwai 8a5354140a ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.c
Instead of calling the jack sync in the init callback of each codec,
call it generically at initialization and resume.  By calling it at
the last of resume sequence, a possible race between the jack sync and
the unsol event enablement in the current code will be closed, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-22 16:48:17 +02:00
David Henningsson 94c142a160 ALSA: hda - Fix pop noise in headphones on S3 for Asus X55A, X55V
To turn off pin control for the pin was tested, and helped against
this issue.

BugLink: https://bugs.launchpad.net/bugs/1034779
Tested-by: Chih-Hsyuan Ho <chih.ho@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-09 11:00:40 +02:00
Takashi Iwai 6162552b0d ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs
We've got a bug report about the silent output from the headphone on a
mobo with VT2021, and spotted out that this was because of the wrong
D3 state on the DAC for the headphone output.  The bug is triggered by
the incomplete check for this DAC in set_widgets_power_state_vt1718S().
It checks only the connectivity of the primary output (0x27) but
doesn't consider the path from the headphone pin (0x28).

Now this patch fixes the problem by checking both pins for DAC 0x0b.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-25 13:55:49 +02:00
Takashi Iwai 68cb2b5592 ALSA: Convert to new pm_ops for PCI drivers
Straightforward conversion to the new pm_ops from the legacy
suspend/resume ops.

Since we change vx222, vx_core and vxpocket have to be converted,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-03 08:23:03 +02:00
Takashi Iwai 09cf03b80c ALSA: hda - Fix possible races of accesses to connection list array
Like the previous fixes for cache hash accesses, a protection over
accesses to the widget connection list array must be provided.
Together with this action, remove snd_hda_get_conn_list() which can be
always race, and replace it with either snd_hda_get_num_conns() or
snd_hda_get_connections() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-19 17:25:23 +02:00
Takashi Iwai 128bc4ba8c ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.c
Just code shuffles.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-08 18:01:33 +02:00
Takashi Iwai 4740860b53 ALSA: hda - Add snd_hda_get_default_vref() helper function
Add a new helper function to guess the default VREF pin control bits
for mic in.  This can be used to set the pin control value safely
matching with the actual pin capabilities.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-20 13:06:53 +02:00
Takashi Iwai cdd03cedc5 ALSA: hda - Introduce snd_hda_set_pin_ctl*() helper functions
For setting the pin-control values more safely to match with the
actual pin capability bits, a copule of new helper functions,
snd_hda_set_pin_ctl() and snd_hda_set_pin_ctl_cache(), are
introduced.  These are simple replacement of the codec verb write with
AC_VERB_SET_PIN_WIDGET but do more sanity checks and filter out
superfluous pin-control bits if they don't fit with the corresponding
pin capabilities.

Some codecs are screwed up or ignore the command when such a wrong bit
is set.  These helpers will avoid such secret errors.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-20 12:38:48 +02:00
Takashi Iwai 77e314f722 ALSA: hda/via - Add a few sanity checks
Added sanity checks in a few places not to assume the pins having the
certain amp caps or the input-source being always assigned to a mux.

No actual bugs have been triggered by these, but surely better to be a
bit more robust.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-22 12:36:06 +01:00
Takashi Iwai 8d8bbc6f17 ALSA: hda/via - Don't create duplicated boost controls
The driver may create duplicated mic boost controls when there are
multiple mics with the very same type / location, and this leads to
the error at actual kcontrol creation.  It needs to check the validity
of the created control and add a proper index if it's duplicated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-22 12:28:44 +01:00
Takashi Iwai 00bc0ce913 Merge branch 'fix/hda' into topic/hda
The fix for bitmap-overflow in Realtek codec driver is needed for the
further development of the auto-parser with badness evaluation.
2012-02-16 16:43:09 +01:00
Takashi Iwai fc1156c0b0 ALSA: hda - Fix initialization of secondary capture source on VT1705
VT1705 codec has two ADCs where the secondary ADC has no MUX but only
a fixed connection to the mic pin.  This confused the driver and it
tries always overriding the input-source selection by assumption of
the existing MUX for the secondary ADC, resulted in resetting the
input-source at each time PM (including power-saving) occurs.

The fix is simply to check the existence of MUX for secondary ADCs in
the initialization code.

Tested-by: Anisse Astier <anisse@astier.eu>
Cc: <stable@kernel.org> [v3.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-13 15:04:06 +01:00
Takashi Iwai 9322ca5497 ALSA: hda - Add suffix argument to snd_hda_add_vmaster()
In most cases, the slave strings for vmaster are identical between
volumes and switches except for "xxx Volume" and "xxx Switch" suffix.
Now snd_hda_add_vmaster() takes the optional suffix argument so that
each string can be composed with the given suffix, and we can share the
slave name strings in both volume and switch calls nicely.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-03 14:28:01 +01:00
Takashi Iwai b5bcc18940 ALSA: hda - Disable dynamic-power control for VIA as default
Since the dynamic pin power-control and the analog low-current mode
may lead to pop-noise, it's safer to set it off as default.

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

Cc: <stable@kernel.org> [v3.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-02 10:34:06 +01:00
Takashi Iwai e9d010c2e8 ALSA: hda - Allow analog low-current mode when dynamic power-control is on
VIA codecs have several different power-saving features, and one of
them is the analog low-current mode.  But it turned out that the ALC
mode causes pop-noises at each on/off time on some machines.  As a
quick workaround, disable the ALC when another power-saving feature,
the dynamic pin power-control, is turned off, too, since the dynamic
power-control is already exposed as a mixer enum element so that user
can turn it on/off freely.

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

Cc: <stable@kernel.org> [v3.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-02 10:18:09 +01:00
Takashi Iwai 924339239f ALSA: hda - Fix the logic to detect VIA analog low-current mode
The analog low-current mode must be enabled when the no stream is
running but the current detection checks it in a wrong way.

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

Cc: <stable@kernel.org> [v3.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-02 10:16:32 +01:00
Takashi Iwai 054d867e03 ALSA: hda - Check power-state before changing in patch_via.c
Instead of always writing AC_VERB_SET_POWER_STATE, check the current
power-state and don't write again if the value is already set.
This may reduce the click noise upon the dynamic power-state change
(e.g. in analog-input mixer).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-02-02 10:15:16 +01:00
Takashi Iwai 4808d12d1d ALSA: hda - Fix the detection of "Loopback Mixing" control for VIA codecs
Currently the driver checks only the out_mix_path[] for the primary
output route for judging whether to create the loopback-mixing control
or not.  But, there are cases where aamix-routing is available only on
headphone or speaker paths but not on the primary output path.  So, the
driver ignores such cases inappropriately.

This patch fixes the check of the loopback-mixing control by testing
all mix-routing paths.

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-10 15:16:02 +01:00
Takashi Iwai 78c058df6a Merge branch 'test/hda-jack' into topic/hda
Conflicts:
	sound/pci/hda/patch_hdmi.c
	sound/pci/hda/patch_via.c
2011-12-20 15:42:57 +01:00
Takashi Iwai 187d333edc ALSA: hda - Fix jack-detection control of VT1708
VT1708 has no support for unsolicited events per jack-plug, the driver
implements the workq for polling the jack-detection.  The mixer element
"Jack Detect" was supposed to control this behavior on/off, but this
doesn't work properly as is now.  The workq is always started and the
HP automute is always enabled.

This patch fixes the jack-detect control behavior by triggering / stopping
the work appropriately at the state change.  Also the work checks the
internal state to continue scheduling or not.

Cc: <stable@kernel.org> [v3.1]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-27 17:56:17 +01:00
Takashi Iwai 3a93897ea3 ALSA: hda - Manage unsol tags in hda_jack.c
Manage the tags assigned for unsolicited events dynamically together
with the jack-detection routines.  Basically this is almost same as what
we've done in patch_sigmatel.c.  Assign the new tag number for each new
unsol event, associate with the given NID and the action type, etc.

With this change, now all pins looked over in snd_hda_jack_add_kctls()
are actually enabled for detection now even if the pins aren't used for
jack-retasking by the driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16 11:14:03 +01:00
Takashi Iwai 01a61e12b4 ALSA: hda - Create jack-detection kcontrols
Create kcontrols for pin jack-detections, which work similarly like
jack-input layer.  Each control will notify when the jack is plugged or
unplugged, and also user can read the value at any time via the normal
control API.

The control elements are created with iface=CARD, so that they won't
appear in the mixer apps.

So far, only the pins that enabled the jack-detection are registered.
For covering all pins, the transition of the common unsol-tag handling
would be needed.  Stay tuned.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16 11:12:17 +01:00
Takashi Iwai 1835a0f9a2 ALSA: hda - Cache the jack-detection value
Introduce a table containing the pins and their jack-detection states
for avoiding the unnecessary verbs to check the pin status at each time.

When the unsol event is enabled via snd_hda_jack_detect_enable(), it
automatically adds the given NID to the table.  Then the driver supposes
that the codec driver will set the dirty flag appropariately when an
unsolicited event is invoked for that pin.

The behavior for reading other pins that aren't registered in the table
doesn't change.  Only the pins assigned to the table are cached, so far.

In near futre, this table can be extended to use the central place for
the unsolicited events of all pins, etc, and eventually include the
jack-detect kcontrols that replace the current input-jack stuff.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16 11:11:15 +01:00
Linus Torvalds 32aaeffbd4 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
  Revert "tracing: Include module.h in define_trace.h"
  irq: don't put module.h into irq.h for tracking irqgen modules.
  bluetooth: macroize two small inlines to avoid module.h
  ip_vs.h: fix implicit use of module_get/module_put from module.h
  nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
  include: replace linux/module.h with "struct module" wherever possible
  include: convert various register fcns to macros to avoid include chaining
  crypto.h: remove unused crypto_tfm_alg_modname() inline
  uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
  pm_runtime.h: explicitly requires notifier.h
  linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
  miscdevice.h: fix up implicit use of lists and types
  stop_machine.h: fix implicit use of smp.h for smp_processor_id
  of: fix implicit use of errno.h in include/linux/of.h
  of_platform.h: delete needless include <linux/module.h>
  acpi: remove module.h include from platform/aclinux.h
  miscdevice.h: delete unnecessary inclusion of module.h
  device_cgroup.h: delete needless include <linux/module.h>
  net: sch_generic remove redundant use of <linux/module.h>
  net: inet_timewait_sock doesnt need <linux/module.h>
  ...

Fix up trivial conflicts (other header files, and  removal of the ab3550 mfd driver) in
 - drivers/media/dvb/frontends/dibx000_common.c
 - drivers/media/video/{mt9m111.c,ov6650.c}
 - drivers/mfd/ab3550-core.c
 - include/linux/dmaengine.h
2011-11-06 19:44:47 -08:00
Takashi Iwai 112daa7a4c ALSA: hda - Remove unused variables
Just clean-up what GCC caught.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-02 21:40:06 +01:00
Paul Gortmaker da155d5b40 sound: Add module.h to the previously silent sound users
Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up.  So
fix up those users now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:21 -04:00
Takashi Iwai a597310331 ALSA: hda:via - Skip creations of empty PCM streams
If no analog I/O is defined, skip creating the corresponding PCM stream.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-28 16:43:36 +02:00
Wang Shaoyan 81c0a78b64 ALSA: hda - Fix a complile warning in patch_via.c
sound/pci/hda/patch_via.c:2087: warning: 'dac' may be used uninitialized in this function

Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-08-05 12:51:01 +02:00
Takashi Iwai 2a43952a99 ALSA: hda - Make CONFIG_SND_HDA_POWER_SAVE depending on CONFIG_PM
It makes little sense to enable power-saving without PM.
This removes SND_HDA_NEEDS_RESUME define so that we can use CONFIG_PM
in all places.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26 17:21:18 +02:00
Takashi Iwai a353fbb179 ALSA: hda - Remove a superfluous argument of via_auto_init_output()
"force" argument is always true, so let's strip it off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-21 14:24:25 +02:00
Takashi Iwai 020066d1ec ALSA: hda - Fix indep-HP path (de-)activation for VT1708* codecs
This patch fixes non-working indep-HP control on VT1708* codecs.
The problems are that via_independent_hp_put() wasn't fixed to follow
the recent change of three HP paths, and hp_indep_path didn't contain
the amp nids of mixer elements.

Together with the fixes, a few code clean-ups are done.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-21 13:55:10 +02:00
Takashi Iwai 3b607e3d3a ALSA: hda - Switch HP DAC dynamically with indep-HP switch for VIA
This patch changes the behavior of independent-HP enum switch.  Now
instead of returning a busy error, the driver switches dynamically the
stream of the HP (and shared) DACs according to the current mode.
The logic is similar like the dual-mic ADC switch, but a bit more
complicated because of the presence of shared DAC.

Together with the change, a mutex is introduced to protect against the
possible races for the indep-HP mode setting.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-18 16:54:40 +02:00
Takashi Iwai 3214b9665c ALSA: hda - Implement dynamic loopback control for VIA codecs
This patch adds the dynamic control of analog-loopback for VIA codecs.

When the loopback is enabled, the inputs from line-ins and mics are
mixed with the front DAC, and sent to the front outputs.  The very same
input is routed to the headhpones and speakers in loopback mode.
However, since the loopback mix can't take other than the front DAC,
there is no longer individual volume controls for headphones and
speakers.  Once when the loopback control is off, these volumes take
effect.

Since the individual volumes are more desired in general use caess, the
loopback mode is set to off as default for now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-18 16:47:33 +02:00
Takashi Iwai 30b4503378 ALSA: hda - Expose secret DAC-AA connection of some VIA codecs
VT1718S and co have a secret connection from DAC to AA-mix, which
doesn't appear in the connection list obtained from the h/w.
Currently the driver fixes the connection index locally at init, but
now we can expose it statically via snd_hda_override_connections()
so that this conection can be checked better by the parser in future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-12 07:45:02 +02:00
Takashi Iwai 9499473463 ALSA: hda - Preserve input pin-ctl bits in HP-automute for VIA codec
For smart51 pins, we need to preserve the input pin-control bits at
auto-mute controls instead of overwriting zero or pin-out-only.
Otherwise the VREF won't be set properly when smart51 is disabled
again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-11 11:36:44 +02:00
Takashi Iwai 6e969d9155 ALSA: hda - Set line-out pin-ctls properly when indep-HP mode changes
When Independent-HP mode is changed for VIA, the driver needs to
re-issue the auto-mute check so that the line-out pins are set properly
without influence of HP pin state.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-11 11:28:13 +02:00
Takashi Iwai 21ce0b6527 ALSA: hda - Via Fix speaker-mute checks in VIA driver
When the line-jack is plugged/unplugged, the driver must check also
the headphone jack state in addition to the line-out jack.  Currently
it checks only the line-out state and ignores the headphone.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-11 10:33:47 +02:00
Lydia Wang 28dc10a5f1 ALSA: hda - Fix output-path of VT1812 codec
For VT1812, add dac_mixer_idx for initialization.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-08 12:37:19 +02:00
Takashi Iwai 21d45d2ba9 ALSA: hda - Fix Oops in smart51 parsing in VIA codec
Typical off-by-one thinko.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-08 11:35:11 +02:00
Lydia Wang a2a870c827 ALSA: hda - Fix Independent-HP detection on VT2002P/1802/1812 codecs
For VT2002P, VT1802 and VT1812 codecs, to create Independent HP
control.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-08 08:20:05 +02:00
Lydia Wang 5c9a5615de ALSA: hda - Fix DAC checks for VT2002P/1802/1812 codecs
For VT2002P, VT1802 and VT1812 codecs, there're only two DACs. So smart51
control shouldn't be created.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-08 08:19:28 +02:00
Lydia Wang d69607b3c3 ALSA: hda - Fix VIA output-path init for VT2002P/1802/1812
For VT2002P, VT1802 and VT1812 codecs, the original activate_output_path()
function can't initialize output and hp path correctly, since mixers connected to
output pin widgets are not considered. So modify the activate_output_path()
function to satisify this kind of codec.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-08 08:18:29 +02:00
Takashi Iwai bac4b92cf7 ALSA: hda - Don't add aa-mix for VIA surrounds
Since we now route the front DAC via aa-mix widget, adding the aa-mix
to surrounds will result in a mix-up of both front and surround PCM
signals.  For avoiding this, the aa-mix routes have to be disabled
for surround paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-04 17:37:57 +02:00
Takashi Iwai 18bd2c44b9 ALSA: hda - Create HP-vol control properly for VIA codecs
When the individual DAC is available for the headphone output, the driver
should create the DAC for its volume control.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-04 15:55:44 +02:00
Takashi Iwai de6c74f3e3 ALSA: hda - Define some constants in patch_via.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-04 14:53:30 +02:00
Lydia Wang b89596a160 ALSA: hda - Fix invalid multi-channel amplifiers for VT1718S
For VT1718S, the multi-channel path should be like following:
DAC 0-->Mixer 9(index 5)-->Mixer 0(index 1)-->Front Pin;
DAC 1-->Mixer 1(index 0)-->Surround Pin;
DAC 2-->C/LFE Pin;
DAC 3-->Mixer 2(index 0)-->Side Pin;

But current code built Surround and Side path through index 1 of
Mixer 1 and 2. So Adjusting Surround and Side channel amplifier is
invalid. This patch fixes the issue.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-04 14:53:25 +02:00
Lydia Wang c4394f5b80 ALSA: hda - Fix issue that front can't output sound for VT1718S
For VT1718S, Mixer 9 doesn't expose the connection to DAC 0. So when
building up a 'PCM Playback' amplifier control, it will fail since
getting DAC 0 index of Mixer 9 returned -1. So I added a dac_mixer_idx
to indicated the actual index of DAC 0 to Mixer 9. Following is the
patch and next mail is another.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-04 14:33:23 +02:00
Lydia Wang e5e1468140 ALSA: hda - Fix the silent front with independent-HP for VIA codecs
Unmute DAC on front speaker path when Independent HP is enabled.

When to enable Independent HP, the front speaker won't output any sound
for VT1708, VT1708B, VT1708S and VT1702.
I find the via_independent_hp_put() routine will mute DAC 0 path in Mixer 0.
For these codecs, when using Independent HP, there could have two
independent streams, one is from DAC0-->Mixer0-->Front Pin, the other is
from DAC3-->GainSW3-->Side Pin.
So I added a check for DAC-->Mixer path in activate_output_path().

If current path is DAC-->Mixer, no need to mute DAC index in Mixer.
In fact, to change connection of Headphone pin or Mux connected with HP
is enough.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-01 08:33:06 +02:00
Takashi Iwai 2525050518 ALSA: hda - Re-implementation of VIA Independent-HP sharing with side stream
This patch adds the re-implementation of Independent-HP mode in the
case where the DAC is shared between HP and side-channel streams.
Now the driver tries to parse the output-path using the pre-parsed
side-channel DAC for the independent HP output, too.

When a playback PCM stream is opened with this shared mode, the
Independent-HP mixer switch can't be changed for avoiding the conflict,
thus it returns -EBUSY error.

One remaining unintuitive issue is that the DAC volume is still
controlled as "Side" volume although it's shared by both independent-HP
and side streams.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-30 17:24:47 +02:00
Lydia Wang e322a36d39 ALSA: hda - Fix jack-detection on non-VT1708 VIA codecs
Move codec init verb which is only applicatable for VT1708.

I've found the root cause that jack plugged in can't be detected.
The verb in vt1708_init_verbs is used to power down jack detect circuit.
This verb is only applicable to VT1708. vt1708 didn't implement jack
detect function in hardware, so we should shut down this function to
avoid noise. But for other codecs, hardware implement jack detect
function. If sending this verb during initialization, jack detect will
be invalid. So I move this verb from via_parse_auto_config() to
patch_vt1708().

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-29 08:02:46 +02:00
Takashi Iwai 8d087c7600 ALSA: hda - Create snd_hda_get_conn_index() helper function
Create snd_hda_get_conn_index() helper function for obtaining the
connection index of the widget.  Replaced the similar codes used in
several codec-drivers with this common helper.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-29 08:01:46 +02:00
Lydia Wang 63f10d2ca7 ALSA: hda - Fix unsol event initializations for VIA codecs
Fix a issue to enable unsolicited response to line-out pins.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-29 08:01:23 +02:00
Takashi Iwai a86a88eaf6 ALSA: hda - Implement dynamic-ADC switching for VIA codecs
Some VIA codecs like VT1702 provide the input-route only to specific
ADCs such as digital-mic inputs.  These routes aren't covered by the
normal primary ADC, and for now, user had to open the capture stream
assigned to that special ADC manually for using such inputs.

This patch implements a way to switch the current ADC dynamically per
the input-source selection in such a case.  When this workaround is
activated, the driver provides only one capture stream and one input-
source control but with the full possible inputs.  The driver switches
the ADC to be used (or being used) according to the input-source on the
fly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-22 15:23:25 +02:00
Takashi Iwai f2b1c9f031 ALSA: hda - Auto-mute smart51 surround pins for VIA codecs
When smart51 mode is enabled, auto-mute these surround outputs
as well as the primary line-out.  Also this patch includes minor
clean-ups.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 16:52:39 +02:00
Takashi Iwai ddd304d8be ALSA: hda - Remove redundant VT1709 and VT1708B codes
Unify the VT1709 10ch and 6ch parsers, as well as VT1708B 8ch and 4ch
parsers.  They have no difference now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 16:33:55 +02:00
Takashi Iwai 09a9ad69a5 ALSA: hda - VT1708 independent HP routing fix
The codecs like VT1708 needs more complicated routing using the mixer
widget rather than the simple selector widgets.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 16:02:32 +02:00
Takashi Iwai a934d5a983 ALSA: hda - Fix surround-volume parsing for VT1708B codecs
The surround/CLFE/side DACs on VT1708B and co have no amp but the
connected selector widgets have the amp instead.  Fix the parser to
check these selector widgets for the possible mixer controls as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 14:22:14 +02:00
Takashi Iwai 1e11cae143 ALSA: hda - Fix the check of loopback-mixer element index in patch_via.c
Fix the check of the multiple loopback-mixer, which gave sometimes
a wrong index assigned to an element even for different names, e.g.
Mic and Front Mic.  Now check the label properly for avoid duplication.

Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 12:59:24 +02:00
Takashi Iwai 0f98c24b80 ALSA: hda - Assign smart51 only in the same stack for VIA codecs
The input jacks assigned as the smart51 outputs must be in the same
stack, either rear, front or other.  Also, prefer line-in as the surround
to mic-in.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 12:51:33 +02:00
Takashi Iwai 8df2a3129d ALSA: hda - Fix re-routing of HP-independent mode in patch_via.c
Re-route the whole output path when HP-independent mode is changed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 12:20:13 +02:00
Lydia Wang a00a5fad9d ALSA: hda - Fix creations of playback volume controls in patch_via.c
Fix a issue to create playback volume control if pin has amplifier capability
but not DAC.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 10:24:18 +02:00
Takashi Iwai 8e3679dca2 ALSA: hda - Revisit output_path parsing in patch_via.c
Change the order of the output-path list in a way from the DAC to the
target pin.  Also now the list include the target pin, too.

Together with this format change, simplify the arguments of
parse_output_path() function, and fix the initialization in
via_auto_init_output().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 09:01:36 +02:00
Takashi Iwai 30f7c5d491 ALSA: hda - Use xxx Boost Volume for VIA
Drop "Capture" prefix from the mic-boost names.
Otherwise some control names can overflow the max name length.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-21 08:37:41 +02:00
Takashi Iwai ada509ec00 ALSA: hda - Simplify analog-low-current mode check for VIA codecs
Use the existing aa-loop list for simplifying the check for analog
low-current mode.  Also fix the stream count test for playback streams.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:16 +02:00
Takashi Iwai 47be05ce0a ALSA: hda - Remove NID_MAPPING hacks in patch_via.c
There is no longer virtual kmixer element for NID mapping.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:16 +02:00
Takashi Iwai c619160787 ALSA: hda - Remove unused defines and struct fields in patch_via.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:15 +02:00
Takashi Iwai 6aadf41d6b ALSA: hda - Name the primary out as Speaker when needed for VIA codecs
When the primary output is the speaker output, rather name it as
"Speaker".  This will be more intuitive.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:14 +02:00
Takashi Iwai 13af8e77ea ALSA: hda - Create loopback-list dynamically in patch_via.c
Create loopback list dynamically from the parsed input pins for VIA
codecs instead of the fixed arrays.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:13 +02:00
Takashi Iwai e3d7a1431f ALSA: hda - Fix smart51 handling again
Fix the broken detection of smart51 and its handling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:12 +02:00
Takashi Iwai 370bafbdae ALSA: hda - Create virtual-master control for VIA codecs
Now let's add the missing Master control to VIA codecs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:12 +02:00
Takashi Iwai 4a918ffeaa ALSA: hda - Initialize unsol events dynamically in patch_via.c
Issue the init verbs of unsolicited events dynamically from the parsed
results for VIA codecs.  Also, consolidate the unsol handlers for HP
and line-out mutes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:11 +02:00
Takashi Iwai 096a885494 ALSA: hda - Initialize input-path dynamically in patch_via.c
Similarly like the previous commit, initialize the input-paths dynamically
from the parsed results instead of the fixed array for VIA codecs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:10 +02:00
Takashi Iwai 5d41762a21 ALSA: hda - Initialize output path dynamically in patch_via.c
Instead of fixed array for each codec type, initialize the output path
dynamically from the parsed results.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:09 +02:00
Takashi Iwai 0fe0adf82f ALSA: hda - Replace with standard consts in patch_via.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:09 +02:00
Takashi Iwai ece8d0431f ALSA: hda - Fix independent-HP handling in patch_via.c
Fix races in handling of HP DAC and independent streams for VIA codecs.
Also, allow the HP output path without front-DAC, and removed
unnecessary activation of HP mixer elements.

This also removes the handling of shared side/HP stream; it's anyway
implemented in a broken way, so we need to re-implement the feature
later...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:08 +02:00
Takashi Iwai 12daef65fd ALSA: hda - Unify auto-parser in patch_via.c
Now all codecs use the same parser-path, so we can reduce into a single
auto-parser function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:07 +02:00
Takashi Iwai 7f0df88ce0 ALSA: hda - Return error for invalid setup for VIA
Instead of ignoring the invalid pin configuration, return the error.
This will avoid unexpected crash, anyway.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:06 +02:00
Takashi Iwai d7a99cce55 ALSA: hda - Unify capture-mixer creations in patch_via.c
Create capture-related mixer elements dynamically from the parsed
ADCs and input-pins instead of fixed values for each codec.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:05 +02:00
Takashi Iwai 7eb56e84e6 ALSA: hda - Assign HP-independent PCM to individual stream
Instead of using the secondary substream, create an individual PCM
stream for HP-independent PCM.  Otherwise it's difficult to handle
different channel numbers with multi-channel stream in the sam PCM
stream structure.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:05 +02:00
Takashi Iwai 9af7421091 ALSA: hda - Unify PCM assignments in patch_via.c
Unify PCM streams for all codecs by assigning the NID dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:04 +02:00
Takashi Iwai 57307bf24a ALSA: hda - Don't create secondary substream when no independent-hp is used
For VIA codecs, we shouldn't create a substream for independent HP mode,
when no individual HP DAC is found.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-20 16:24:03 +02:00