diff options
author | Lydia Wang <lydiawang@viatech.com.cn> | 2009-10-10 07:07:43 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-10-11 11:56:33 -0400 |
commit | 0713efebfa1a1878feeeb17cbadc3d2d2c9e9ed2 (patch) | |
tree | ed10c1151651548641fd8ec57e4a7ef221d24f39 /sound/pci/hda/patch_via.c | |
parent | 9510e8dd9cb4469d146953270364af6dd86a39be (diff) |
ALSA: HDA VIA: Change VT1708S & VT1702 hp mode controls
For VT1708S and VT1702, deactivate "Headphone Playback Volume" and
"Headphone Playback Mute" control if "Independent HP" mode is OFF.
and rename VT1702 "Independent HP" text.
Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Signed-off-by: Logan Li <loganli@viatech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r-- | sound/pci/hda/patch_via.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 0da57db3a691..9e8dd57e8d5c 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -572,6 +572,18 @@ static int via_independent_hp_get(struct snd_kcontrol *kcontrol, | |||
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
574 | 574 | ||
575 | static void activate_ctl(struct hda_codec *codec, const char *name, int active) | ||
576 | { | ||
577 | struct snd_kcontrol *ctl = snd_hda_find_mixer_ctl(codec, name); | ||
578 | if (ctl) { | ||
579 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
580 | ctl->vd[0].access |= active | ||
581 | ? 0 : SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
582 | snd_ctl_notify(codec->bus->card, | ||
583 | SNDRV_CTL_EVENT_MASK_VALUE, &ctl->id); | ||
584 | } | ||
585 | } | ||
586 | |||
575 | static int via_independent_hp_put(struct snd_kcontrol *kcontrol, | 587 | static int via_independent_hp_put(struct snd_kcontrol *kcontrol, |
576 | struct snd_ctl_elem_value *ucontrol) | 588 | struct snd_ctl_elem_value *ucontrol) |
577 | { | 589 | { |
@@ -620,6 +632,14 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol, | |||
620 | spec->multiout.hp_nid, | 632 | spec->multiout.hp_nid, |
621 | 0, 0, 0); | 633 | 0, 0, 0); |
622 | 634 | ||
635 | /* update HP volume/swtich active state */ | ||
636 | if (spec->codec_type == VT1708S | ||
637 | || spec->codec_type == VT1702) { | ||
638 | activate_ctl(codec, "Headphone Playback Volume", | ||
639 | spec->hp_independent_mode); | ||
640 | activate_ctl(codec, "Headphone Playback Switch", | ||
641 | spec->hp_independent_mode); | ||
642 | } | ||
623 | return 0; | 643 | return 0; |
624 | } | 644 | } |
625 | 645 | ||
@@ -3342,11 +3362,11 @@ static int vt1702_auto_create_line_out_ctls(struct via_spec *spec, | |||
3342 | 3362 | ||
3343 | static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | 3363 | static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) |
3344 | { | 3364 | { |
3345 | int err; | 3365 | int err, i; |
3346 | 3366 | struct hda_input_mux *imux; | |
3367 | static const char *texts[] = { "ON", "OFF", NULL}; | ||
3347 | if (!pin) | 3368 | if (!pin) |
3348 | return 0; | 3369 | return 0; |
3349 | |||
3350 | spec->multiout.hp_nid = 0x1D; | 3370 | spec->multiout.hp_nid = 0x1D; |
3351 | 3371 | ||
3352 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | 3372 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, |
@@ -3361,8 +3381,18 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | |||
3361 | if (err < 0) | 3381 | if (err < 0) |
3362 | return err; | 3382 | return err; |
3363 | 3383 | ||
3364 | create_hp_imux(spec); | 3384 | imux = &spec->private_imux[1]; |
3365 | 3385 | ||
3386 | /* for hp mode select */ | ||
3387 | i = 0; | ||
3388 | while (texts[i] != NULL) { | ||
3389 | imux->items[imux->num_items].label = texts[i]; | ||
3390 | imux->items[imux->num_items].index = i; | ||
3391 | imux->num_items++; | ||
3392 | i++; | ||
3393 | } | ||
3394 | |||
3395 | spec->hp_mux = &spec->private_imux[1]; | ||
3366 | return 0; | 3396 | return 0; |
3367 | } | 3397 | } |
3368 | 3398 | ||