aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-10-11 15:16:20 +0200
committerTakashi Iwai <tiwai@suse.de>2010-10-11 15:16:20 +0200
commit6a92934d9e987b6363db3e6a08e17bc0f2078c5d (patch)
tree3a296a8607fdcae4ddb400a408f4f811b77c6c30 /sound
parentf46119b73425df9d1e05c5d5e909a993d95b0218 (diff)
downloadkernel_samsung_aries-6a92934d9e987b6363db3e6a08e17bc0f2078c5d.zip
kernel_samsung_aries-6a92934d9e987b6363db3e6a08e17bc0f2078c5d.tar.gz
kernel_samsung_aries-6a92934d9e987b6363db3e6a08e17bc0f2078c5d.tar.bz2
ALSA: hda - Add input volume control for each mic/line-in pin
The input pins on cirrus codecs have also input amps. Let's make control elemetns for them. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-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 d9a3dbc..460fb2e 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,
return bind;
}
+/* add a (input-boost) volume control to the given input pin */
+static int add_input_volume_control(struct hda_codec *codec,
+ struct auto_pin_cfg *cfg,
+ int item)
+{
+ hda_nid_t pin = cfg->inputs[item].pin;
+ u32 caps;
+ const char *label;
+ struct snd_kcontrol *kctl;
+
+ if (!(get_wcaps(codec, pin) & AC_WCAP_IN_AMP))
+ return 0;
+ caps = query_amp_caps(codec, pin, HDA_INPUT);
+ caps = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;
+ if (caps <= 1)
+ return 0;
+ label = hda_get_autocfg_input_label(codec, cfg, item);
+ return add_volume(codec, label, 0,
+ HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_INPUT), 1, &kctl);
+}
+
static int build_input(struct hda_codec *codec)
{
struct cs_spec *spec = codec->spec;
@@ -781,6 +802,12 @@ static int build_input(struct hda_codec *codec)
return err;
}
+ for (i = 0; i < spec->num_inputs; i++) {
+ err = add_input_volume_control(codec, &spec->autocfg, i);
+ if (err < 0)
+ return err;
+ }
+
return 0;
}