aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cirrus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_cirrus.c')
-rw-r--r--sound/pci/hda/patch_cirrus.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index d9a3dbcc9ba0..460fb2ef7e39 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -742,6 +742,27 @@ static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
742 return bind; 742 return bind;
743} 743}
744 744
745/* add a (input-boost) volume control to the given input pin */
746static int add_input_volume_control(struct hda_codec *codec,
747 struct auto_pin_cfg *cfg,
748 int item)
749{
750 hda_nid_t pin = cfg->inputs[item].pin;
751 u32 caps;
752 const char *label;
753 struct snd_kcontrol *kctl;
754
755 if (!(get_wcaps(codec, pin) & AC_WCAP_IN_AMP))
756 return 0;
757 caps = query_amp_caps(codec, pin, HDA_INPUT);
758 caps = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;
759 if (caps <= 1)
760 return 0;
761 label = hda_get_autocfg_input_label(codec, cfg, item);
762 return add_volume(codec, label, 0,
763 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_INPUT), 1, &kctl);
764}
765
745static int build_input(struct hda_codec *codec) 766static int build_input(struct hda_codec *codec)
746{ 767{
747 struct cs_spec *spec = codec->spec; 768 struct cs_spec *spec = codec->spec;
@@ -781,6 +802,12 @@ static int build_input(struct hda_codec *codec)
781 return err; 802 return err;
782 } 803 }
783 804
805 for (i = 0; i < spec->num_inputs; i++) {
806 err = add_input_volume_control(codec, &spec->autocfg, i);
807 if (err < 0)
808 return err;
809 }
810
784 return 0; 811 return 0;
785} 812}
786 813