diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-07-07 09:28:47 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-07 09:28:47 +0200 |
commit | 8e89995c58644682302fe9e298a9e30ff38d01a1 (patch) | |
tree | efebb038c81d80c930fc1f52a398797ce8e20539 /sound/pci/hda | |
parent | b68785714b67079385188323631b05a8f9093675 (diff) | |
parent | 9c7a083d94656ad6d6f2e03ba90194f2cc5bced5 (diff) |
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 33 |
2 files changed, 24 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 473cfa13a30..28ce17d09c3 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -294,7 +294,7 @@ static int hdmi_update_eld(struct hdmi_eld *e, snd_printd(KERN_INFO "HDMI: out of range MNL %d\n", mnl); goto out_fail; } else - strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl); + strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1); for (i = 0; i < e->sad_count; i++) { if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) { diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 575ffc9fedb..49f39699ea1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2707,17 +2707,30 @@ typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol, - getput_call_t func) + getput_call_t func, bool check_adc_switch) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct alc_spec *spec = codec->spec; - unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - int err; + int i, err; mutex_lock(&codec->control_mutex); - kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], - 3, 0, HDA_INPUT); - err = func(kcontrol, ucontrol); + if (check_adc_switch && spec->dual_adc_switch) { + for (i = 0; i < spec->num_adc_nids; i++) { + kcontrol->private_value = + HDA_COMPOSE_AMP_VAL(spec->adc_nids[i], + 3, 0, HDA_INPUT); + err = func(kcontrol, ucontrol); + if (err < 0) + goto error; + } + } else { + i = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + kcontrol->private_value = + HDA_COMPOSE_AMP_VAL(spec->adc_nids[i], + 3, 0, HDA_INPUT); + err = func(kcontrol, ucontrol); + } + error: mutex_unlock(&codec->control_mutex); return err; } @@ -2726,14 +2739,14 @@ static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { return alc_cap_getput_caller(kcontrol, ucontrol, - snd_hda_mixer_amp_volume_get); + snd_hda_mixer_amp_volume_get, false); } static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { return alc_cap_getput_caller(kcontrol, ucontrol, - snd_hda_mixer_amp_volume_put); + snd_hda_mixer_amp_volume_put, true); } /* capture mixer elements */ @@ -2743,14 +2756,14 @@ static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { return alc_cap_getput_caller(kcontrol, ucontrol, - snd_hda_mixer_amp_switch_get); + snd_hda_mixer_amp_switch_get, false); } static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { return alc_cap_getput_caller(kcontrol, ucontrol, - snd_hda_mixer_amp_switch_put); + snd_hda_mixer_amp_switch_put, true); } #define _DEFINE_CAPMIX(num) \ |