diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-11-08 17:12:10 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-08 17:13:59 +0100 |
commit | ee81abb623cb5e03c182d16871bb4fb34fdc9b4f (patch) | |
tree | 74499d19b6cc75343da95899e93a69ad56541323 /sound/pci/hda/hda_codec.c | |
parent | f37bc7a88d374448a1f4bba9267d308606d78bf2 (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.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 569bc05aad6..a8e7b00fe90 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) struct hda_pcm_stream *hinfo = &codec->pcm_info[i].stream[str]; struct snd_pcm_chmap *chmap; + const struct snd_pcm_chmap_elem *elem; if (codec->pcm_info[i].own_chmap) continue; if (!pcm || !hinfo->substreams) continue; - err = snd_pcm_add_chmap_ctls(pcm, str, - snd_pcm_std_chmaps, + elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps; + err = snd_pcm_add_chmap_ctls(pcm, str, elem, hinfo->channels_max, 0, &chmap); if (err < 0) @@ -3764,6 +3765,19 @@ static int add_std_chmaps(struct hda_codec *codec) return 0; } +/* default channel maps for 2.1 speakers; + * since HD-audio supports only stereo, odd number channels are omitted + */ +const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[] = { + { .channels = 2, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, + { .channels = 4, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, + SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } }, + { } +}; +EXPORT_SYMBOL_GPL(snd_pcm_2_1_chmaps); + int snd_hda_codec_build_controls(struct hda_codec *codec) { int err = 0; |