aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-11-08 11:12:10 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-08 11:13:59 -0500
commitee81abb623cb5e03c182d16871bb4fb34fdc9b4f (patch)
tree74499d19b6cc75343da95899e93a69ad56541323 /sound/pci/hda/hda_codec.c
parentf37bc7a88d374448a1f4bba9267d308606d78bf2 (diff)
ALSA: hda - Apply a proper chmap for built-in 2.1 speakers
When 2.1 speakers are detected, use the corresponding channel map instead of the standard map with front+rear surrounds. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 569bc05aad6c..a8e7b00fe90d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3747,13 +3747,14 @@ static int add_std_chmaps(struct hda_codec *codec)
3747 struct hda_pcm_stream *hinfo = 3747 struct hda_pcm_stream *hinfo =
3748 &codec->pcm_info[i].stream[str]; 3748 &codec->pcm_info[i].stream[str];
3749 struct snd_pcm_chmap *chmap; 3749 struct snd_pcm_chmap *chmap;
3750 const struct snd_pcm_chmap_elem *elem;
3750 3751
3751 if (codec->pcm_info[i].own_chmap) 3752 if (codec->pcm_info[i].own_chmap)
3752 continue; 3753 continue;
3753 if (!pcm || !hinfo->substreams) 3754 if (!pcm || !hinfo->substreams)
3754 continue; 3755 continue;
3755 err = snd_pcm_add_chmap_ctls(pcm, str, 3756 elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
3756 snd_pcm_std_chmaps, 3757 err = snd_pcm_add_chmap_ctls(pcm, str, elem,
3757 hinfo->channels_max, 3758 hinfo->channels_max,
3758 0, &chmap); 3759 0, &chmap);
3759 if (err < 0) 3760 if (err < 0)
@@ -3764,6 +3765,19 @@ static int add_std_chmaps(struct hda_codec *codec)
3764 return 0; 3765 return 0;
3765} 3766}
3766 3767
3768/* default channel maps for 2.1 speakers;
3769 * since HD-audio supports only stereo, odd number channels are omitted
3770 */
3771const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[] = {
3772 { .channels = 2,
3773 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
3774 { .channels = 4,
3775 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
3776 SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
3777 { }
3778};
3779EXPORT_SYMBOL_GPL(snd_pcm_2_1_chmaps);
3780
3767int snd_hda_codec_build_controls(struct hda_codec *codec) 3781int snd_hda_codec_build_controls(struct hda_codec *codec)
3768{ 3782{
3769 int err = 0; 3783 int err = 0;