From 53775b0d0cb91ab217c9853efddc51597b58bbff Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 1 Aug 2012 12:17:41 +0200 Subject: ALSA: hda - Fix channel maps for Nvidia 7x 8ch HDMI codecs Some old Nvidia HDMI codecs with 8ch support only 2/8 or 2/6/8 channels and with the fixed CLFE-first map. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'sound/pci/hda') diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 4a5d24fe8ad..2c53ea889da 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2155,6 +2155,43 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) return 0; } +static int nvhdmi_7x_8ch_build_pcms(struct hda_codec *codec) +{ + struct hdmi_spec *spec = codec->spec; + int err = simple_playback_build_pcms(codec); + spec->pcm_rec[0].own_chmap = true; + return err; +} + +static int nvhdmi_7x_8ch_build_controls(struct hda_codec *codec) +{ + struct hdmi_spec *spec = codec->spec; + struct snd_pcm_chmap *chmap; + int err; + + err = simple_playback_build_controls(codec); + if (err < 0) + return err; + + /* add channel maps */ + err = snd_pcm_add_chmap_ctls(spec->pcm_rec[0].pcm, + SNDRV_PCM_STREAM_PLAYBACK, + snd_pcm_alt_chmaps, 8, 0, &chmap); + if (err < 0) + return err; + switch (codec->preset->id) { + case 0x10de0002: + case 0x10de0003: + case 0x10de0005: + case 0x10de0006: + chmap->channel_mask = (1U << 2) | (1U << 8); + break; + case 0x10de0007: + chmap->channel_mask = (1U << 2) | (1U << 6) | (1U << 8); + } + return 0; +} + static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) { struct hdmi_spec *spec; @@ -2165,6 +2202,8 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) spec->multiout.max_channels = 8; spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x; codec->patch_ops.init = nvhdmi_7x_init_8ch; + codec->patch_ops.build_pcms = nvhdmi_7x_8ch_build_pcms; + codec->patch_ops.build_controls = nvhdmi_7x_8ch_build_controls; /* Initialize the audio infoframe channel mask and checksum to something * valid */ -- cgit v1.2.3-18-g5258