diff options
| -rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 742b9c8b25e7..c878dfa369b7 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -3580,21 +3580,30 @@ static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | |||
| 3580 | } | 3580 | } |
| 3581 | 3581 | ||
| 3582 | /* create a volume assigned to the given pin (only if supported) */ | 3582 | /* create a volume assigned to the given pin (only if supported) */ |
| 3583 | /* return 1 if the volume control is created */ | ||
| 3583 | static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid, | 3584 | static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid, |
| 3584 | const char *label) | 3585 | const char *label, int direction) |
| 3585 | { | 3586 | { |
| 3586 | unsigned int caps, nums; | 3587 | unsigned int caps, nums; |
| 3587 | char name[32]; | 3588 | char name[32]; |
| 3589 | int err; | ||
| 3588 | 3590 | ||
| 3589 | if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) | 3591 | if (direction == HDA_OUTPUT) |
| 3592 | caps = AC_WCAP_OUT_AMP; | ||
| 3593 | else | ||
| 3594 | caps = AC_WCAP_IN_AMP; | ||
| 3595 | if (!(get_wcaps(codec, nid) & caps)) | ||
| 3590 | return 0; | 3596 | return 0; |
| 3591 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | 3597 | caps = query_amp_caps(codec, nid, direction); |
| 3592 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; | 3598 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3593 | if (!nums) | 3599 | if (!nums) |
| 3594 | return 0; | 3600 | return 0; |
| 3595 | snprintf(name, sizeof(name), "%s Capture Volume", label); | 3601 | snprintf(name, sizeof(name), "%s Capture Volume", label); |
| 3596 | return stac92xx_add_control(codec->spec, STAC_CTL_WIDGET_VOL, name, | 3602 | err = stac92xx_add_control(codec->spec, STAC_CTL_WIDGET_VOL, name, |
| 3597 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | 3603 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction)); |
| 3604 | if (err < 0) | ||
| 3605 | return err; | ||
| 3606 | return 1; | ||
| 3598 | } | 3607 | } |
| 3599 | 3608 | ||
| 3600 | /* create playback/capture controls for input pins on dmic capable codecs */ | 3609 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| @@ -3643,9 +3652,15 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
| 3643 | else | 3652 | else |
| 3644 | label = stac92xx_dmic_labels[dimux->num_items]; | 3653 | label = stac92xx_dmic_labels[dimux->num_items]; |
| 3645 | 3654 | ||
| 3646 | err = create_elem_capture_vol(codec, nid, label); | 3655 | err = create_elem_capture_vol(codec, nid, label, HDA_INPUT); |
| 3647 | if (err < 0) | 3656 | if (err < 0) |
| 3648 | return err; | 3657 | return err; |
| 3658 | if (!err) { | ||
| 3659 | err = create_elem_capture_vol(codec, nid, label, | ||
| 3660 | HDA_OUTPUT); | ||
| 3661 | if (err < 0) | ||
| 3662 | return err; | ||
| 3663 | } | ||
| 3649 | 3664 | ||
| 3650 | dimux->items[dimux->num_items].label = label; | 3665 | dimux->items[dimux->num_items].label = label; |
| 3651 | dimux->items[dimux->num_items].index = index; | 3666 | dimux->items[dimux->num_items].index = index; |
| @@ -3766,7 +3781,8 @@ static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const | |||
| 3766 | continue; | 3781 | continue; |
| 3767 | 3782 | ||
| 3768 | err = create_elem_capture_vol(codec, nid, | 3783 | err = create_elem_capture_vol(codec, nid, |
| 3769 | auto_pin_cfg_labels[i]); | 3784 | auto_pin_cfg_labels[i], |
| 3785 | HDA_INPUT); | ||
| 3770 | if (err < 0) | 3786 | if (err < 0) |
| 3771 | return err; | 3787 | return err; |
| 3772 | 3788 | ||
