diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-03 17:50:45 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-03 17:50:45 -0400 |
commit | 854ace9c40d2b121191e1644aa4b0b68c4a226d3 (patch) | |
tree | fdc43a62eacc95a1276003a4d7d46287312407ab /sound/pci | |
parent | dbe45d0ce394732cc06187e929697fc0fb16aa53 (diff) | |
parent | c470331e69bd54d11a9ea3c27a0e4ad783d02d6b (diff) |
Merge branch 'fix/hda' into for-linus
* fix/hda:
ALSA: hda - Add sanity check in PCM open callback
ALSA: hda - Call snd_pcm_lib_hw_rates() again after codec open callback
ALSA: hda - Avoid invalid formats and rates with shared SPDIF
ALSA: hda - Improve ASUS eeePC 1000 mixer
ALSA: hda - Add GPIO1 control at muting with HP laptops
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 14 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 7 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 27 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 24 |
4 files changed, 48 insertions, 24 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 462e2cedaa6a..26d255de6beb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3470,10 +3470,16 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec, | |||
3470 | } | 3470 | } |
3471 | mutex_lock(&codec->spdif_mutex); | 3471 | mutex_lock(&codec->spdif_mutex); |
3472 | if (mout->share_spdif) { | 3472 | if (mout->share_spdif) { |
3473 | runtime->hw.rates &= mout->spdif_rates; | 3473 | if ((runtime->hw.rates & mout->spdif_rates) && |
3474 | runtime->hw.formats &= mout->spdif_formats; | 3474 | (runtime->hw.formats & mout->spdif_formats)) { |
3475 | if (mout->spdif_maxbps < hinfo->maxbps) | 3475 | runtime->hw.rates &= mout->spdif_rates; |
3476 | hinfo->maxbps = mout->spdif_maxbps; | 3476 | runtime->hw.formats &= mout->spdif_formats; |
3477 | if (mout->spdif_maxbps < hinfo->maxbps) | ||
3478 | hinfo->maxbps = mout->spdif_maxbps; | ||
3479 | } else { | ||
3480 | mout->share_spdif = 0; | ||
3481 | /* FIXME: need notify? */ | ||
3482 | } | ||
3477 | } | 3483 | } |
3478 | mutex_unlock(&codec->spdif_mutex); | 3484 | mutex_unlock(&codec->spdif_mutex); |
3479 | } | 3485 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4e9ea7080270..1877d95d4aa6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1454,6 +1454,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1454 | mutex_unlock(&chip->open_mutex); | 1454 | mutex_unlock(&chip->open_mutex); |
1455 | return err; | 1455 | return err; |
1456 | } | 1456 | } |
1457 | snd_pcm_limit_hw_rates(runtime); | ||
1457 | spin_lock_irqsave(&chip->reg_lock, flags); | 1458 | spin_lock_irqsave(&chip->reg_lock, flags); |
1458 | azx_dev->substream = substream; | 1459 | azx_dev->substream = substream; |
1459 | azx_dev->running = 0; | 1460 | azx_dev->running = 0; |
@@ -1463,6 +1464,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1463 | snd_pcm_set_sync(substream); | 1464 | snd_pcm_set_sync(substream); |
1464 | mutex_unlock(&chip->open_mutex); | 1465 | mutex_unlock(&chip->open_mutex); |
1465 | 1466 | ||
1467 | if (snd_BUG_ON(!runtime->hw.channels_min || !runtime->hw.channels_max)) | ||
1468 | return -EINVAL; | ||
1469 | if (snd_BUG_ON(!runtime->hw.formats)) | ||
1470 | return -EINVAL; | ||
1471 | if (snd_BUG_ON(!runtime->hw.rates)) | ||
1472 | return -EINVAL; | ||
1466 | return 0; | 1473 | return 0; |
1467 | } | 1474 | } |
1468 | 1475 | ||
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index ad700761a561..be7d25fa7f35 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3746,9 +3746,30 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | |||
3746 | { } /* end */ | 3746 | { } /* end */ |
3747 | }; | 3747 | }; |
3748 | 3748 | ||
3749 | static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, | ||
3750 | struct snd_ctl_elem_value *ucontrol) | ||
3751 | { | ||
3752 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3753 | int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
3754 | int mute = (!ucontrol->value.integer.value[0] && | ||
3755 | !ucontrol->value.integer.value[1]); | ||
3756 | /* toggle GPIO1 according to the mute state */ | ||
3757 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | ||
3758 | mute ? 0x02 : 0x0); | ||
3759 | return ret; | ||
3760 | } | ||
3761 | |||
3749 | static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | 3762 | static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { |
3750 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 3763 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
3751 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 3764 | /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ |
3765 | { | ||
3766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3767 | .name = "Master Playback Switch", | ||
3768 | .info = snd_hda_mixer_amp_switch_info, | ||
3769 | .get = snd_hda_mixer_amp_switch_get, | ||
3770 | .put = ad1884a_mobile_master_sw_put, | ||
3771 | .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
3772 | }, | ||
3752 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | 3773 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), |
3753 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3774 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3754 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), | 3775 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), |
@@ -3869,6 +3890,10 @@ static struct hda_verb ad1884a_mobile_verbs[] = { | |||
3869 | /* unsolicited event for pin-sense */ | 3890 | /* unsolicited event for pin-sense */ |
3870 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | 3891 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, |
3871 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, | 3892 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, |
3893 | /* allow to touch GPIO1 (for mute control) */ | ||
3894 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | ||
3895 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | ||
3896 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */ | ||
3872 | { } /* end */ | 3897 | { } /* end */ |
3873 | }; | 3898 | }; |
3874 | 3899 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3a8e58c483df..e661b21354be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -12876,20 +12876,11 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |||
12876 | { } | 12876 | { } |
12877 | }; | 12877 | }; |
12878 | 12878 | ||
12879 | /* bind volumes of both NID 0x0c and 0x0d */ | ||
12880 | static struct hda_bind_ctls alc269_epc_bind_vol = { | ||
12881 | .ops = &snd_hda_bind_vol, | ||
12882 | .values = { | ||
12883 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
12884 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
12885 | 0 | ||
12886 | }, | ||
12887 | }; | ||
12888 | |||
12889 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | 12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
12890 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
12891 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), | 12881 | HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12892 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), | 12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
12883 | HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
12893 | { } /* end */ | 12884 | { } /* end */ |
12894 | }; | 12885 | }; |
12895 | 12886 | ||
@@ -12902,12 +12893,7 @@ static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |||
12902 | }; | 12893 | }; |
12903 | 12894 | ||
12904 | /* FSC amilo */ | 12895 | /* FSC amilo */ |
12905 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { | 12896 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
12906 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
12907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
12908 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), | ||
12909 | { } /* end */ | ||
12910 | }; | ||
12911 | 12897 | ||
12912 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | 12898 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
12913 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 12899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |