Intel8x0 8 channel sound
For some intel 8x0 cards there is 8 channel sound (such as the ALC850 chip on NFORCE 4 boards), and this has not been patched yet though the patch has been on the bug tracker. Here it is again updated for 1.0.16. There is also a patch for the configuration in alsa-lib for cards/NFORCE.conf. I have been patching my sources every time I update my kernel, I figured it was time for someone to actually submit this somewhere else. The patch was written by Martin Ellis.
alsa-kernel/pci/intel8x0.c renamed from alsa-kernel/pci/intel8x0.c.orig +23 -3
@@ -153,11 +153,12 @@#define ICH_PCM_SPDIF_NONE 0x00000000/* reserved - undefined */ #define ICH_PCM_SPDIF_78 0x40000000/* s/pdif pcm on slots 7&8 */ #define ICH_PCM_SPDIF_69 0x80000000/* s/pdif pcm on slots 6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000/* s/pdif pcm on slots 10&11 */ #define ICH_PCM_20BIT 0x00400000/* 20-bit samples (ICH4) */ -#define ICH_PCM_246_MASK 0x00300000/* 6 channels (not all chips) */ +#define ICH_PCM_246_MASK 0x00300000/* 6/8 channels (not all chips) */ +#define ICH_PCM_8 0x00300000/* 8 channels (not all chips) */ #define ICH_PCM_6 0x00200000/* 6 channels (not all chips) */ #define ICH_PCM_4 0x00100000/* 4 channels (not all chips) */ #define ICH_PCM_2 0x00000000/* 2 channels (stereo) */ #define ICH_SIS_PCM_246_MASK 0x000000c0/* 6 channels (SIS7012) */ #define ICH_SIS_PCM_6 0x00000080/* 6 channels (SIS7012) */
@@ -380,10 +381,11 @@struct snd_pcm *pcm[6 ];struct ichdev ichd[6 ]; unsigned multi4: 1, multi6: 1, + multi8: 1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1, in_sdin_init: 1; unsigned in_measurement: 1; /* during ac97 clock measurement */
@@ -993,10 +995,12 @@ cnt &= ~(ICH_PCM_246_MASK |ICH_PCM_20BIT );if (runtime->channels ==4 || dbl) cnt |=ICH_PCM_4 ;else if (runtime->channels ==6 ) cnt |=ICH_PCM_6 ; +else if (runtime->channels ==8 ) + cnt |=ICH_PCM_8 ;if (chip->device_type ==DEVICE_NFORCE ) {/* reset to 2ch once to keep the 6 channel data in alignment, * to start from Front Left always */ if (cnt &ICH_PCM_246_MASK ) {
@@ -1102,10 +1106,20 @@ .count = ARRAY_SIZE(channels6), .list = channels6, .mask = 0, }; +static unsigned int channels8[] = { +2 ,4 ,6 ,8 , +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count =ARRAY_SIZE (channels8), + .list = channels8, + .mask =0 , +}; +static int snd_intel8x0_pcm_open (struct snd_pcm_substream *substream,struct ichdev *ichdev) {struct intel8x0 *chip =snd_pcm_substream_chip (substream);struct snd_pcm_runtime *runtime = substream->runtime;int err;
@@ -1132,11 +1146,15 @@ err =snd_intel8x0_pcm_open (substream, &chip->ichd[ICHD_PCMOUT ]);if (err <0 )return err; -if (chip->multi6) { +if (chip->multi8) { + runtime->hw.channels_max =8 ; +snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , + &hw_constraints_channels8); + }else if (chip->multi6) { runtime->hw.channels_max =6 ;snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , &hw_constraints_channels6); }else if (chip->multi4) { runtime->hw.channels_max =4 ;
@@ -2193,12 +2211,14 @@ }iputbyte (chip,ICHREG (SDM ), tmp); }if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_PCM_SLEFT )) { chip->multi4 =1 ; -if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) +if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) { chip->multi6 =1 ; + chip->multi8 =1 ;/* MARTIN ELLIS - FIXME - need correct way to check if 8 channels supported */ + } }if (pbus->pcms[0 ].r[1 ].rslots[0 ]) { chip->dra =1 ; }if (chip->device_type ==DEVICE_INTEL_ICH4 ) {
alsa-kernel/pci/ac97/ac97_patch.c renamed from alsa-kernel/pci/ac97/ac97_patch.c.orig +15 -2
@@ -112,14 +112,14 @@return 0 ; }static int ac97_channel_mode_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -static const char *texts[] = {"2ch" ,"4ch" ,"6ch" }; +static const char *texts[] = {"2ch" ,"4ch" ,"6ch" ,"8ch" };if (kcontrol->private_value)return ac97_enum_text_info (kcontrol, uinfo, texts,2 );/* 4ch only */ -return ac97_enum_text_info (kcontrol, uinfo, texts,3 ); +return ac97_enum_text_info (kcontrol, uinfo, texts,4 ); }static int ac97_channel_mode_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) {struct snd_ac97 *ac97 =snd_kcontrol_chip (kcontrol);
@@ -208,10 +208,15 @@static inline int is_shared_micin (struct snd_ac97 *ac97) {return !ac97->indep_surround && !is_clfe_on (ac97); } +static inline int alc850_is_aux_back_surround (struct snd_ac97 *ac97) +{ +return is_surround_on (ac97); +} +/* The following snd_ac97_ymf753_... items added by David Shust ([email protected]) */ /* Modified for YMF743 by Keita Maehara <[email protected]> */ /* It is possible to indicate to the Yamaha YMF7x3 the type of
@@ -2814,14 +2819,16 @@ }#define AC97_ALC850_JACK_SELECT 0x76#define AC97_ALC850_MISC1 0x7a +#define AC97_ALC850_MULTICH 0x6astatic void alc850_update_jacks (struct snd_ac97 *ac97) {int shared; +int aux_is_back_surround;/* shared Line-In / Surround Out */ shared =is_shared_surrout (ac97);/* SURR 1kOhm (bit4), Amp (bit5) */ snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<4)|(1<<5),
@@ -2835,10 +2842,15 @@snd_ac97_update_bits (ac97,AC97_ALC850_MISC1 , (1 <<12 )|(1 <<13 ), shared ? (1 <<12 ) : (1 <<13 ));/* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits (ac97,AC97_ALC850_JACK_SELECT ,7 <<4 , shared ? (5 <<4 ) : (1 <<4 )); + + aux_is_back_surround =alc850_is_aux_back_surround (ac97); +/* Aux is Back Surround */ +snd_ac97_update_bits (ac97,AC97_ALC850_MULTICH ,1 <<10 , + aux_is_back_surround ? (1 <<10 ) : (0 <<10 )); }static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = {AC97_PAGE_SINGLE ("Duplicate Front" ,AC97_ALC650_MULTICH ,0 ,1 ,0 ,0 ),AC97_SINGLE ("Mic Front Input Switch" ,AC97_ALC850_JACK_SELECT ,15 ,1 ,1 ),
@@ -2876,10 +2888,11 @@/* adjust default values */ /* set default: spdif-in enabled, spdif-in monitor off, spdif-in PCM off center on mic off, surround on line-in off duplicate front off +NB default bit 10=0 = Aux is Capture, not Back Surround */ snd_ac97_write_cache (ac97,AC97_ALC650_MULTICH ,1 <<15 );/* SURR_OUT: on, Surr 1kOhm: on, Surr Amp: off, Front 1kOhm: off * Front Amp: on, Vref: enable, Center 1kOhm: on, Mix: on */
src/conf/cards/NFORCE.conf renamed from src/conf/cards/NFORCE.conf.orig +73 -0
83 lines not on this page · raw message
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Thu, 14 Feb 2008 15:02:04 -0500,
Quoted 8 lines · Andrew Boettcher
For some intel 8x0 cards there is 8 channel sound (such as the ALC850 chip on NFORCE 4 boards), and this has not been patched yet though the patch has been on the bug tracker. Here it is again updated for 1.0.16. There is also a patch for the configuration in alsa-lib for
cards/NFORCE.conf. I have been patching my sources every time I update my kernel, I figured it was time for someone to actually submit this somewhere else. The patch was written by Martin Ellis.
Thanks for submitting this. I haven't checked that issue.
The change is almost OK. One thing to be fixed is the enablement of chip->multi8. It's unconditionally enabled together with multi6.
I think we should add a new bitflag in ac97_codec->flags to indicate that the codec supports 8 channels. Also, ac97_channel_mode_info() shouldn't be unconditionally 8-channels, too. It should check the 8-channel capability as well.
Do you know which audio controller model supports 7.1 output? We may need to check the chip model eventualy for 7.1-enablement. Certainly the earlier version of controllers don't support 7.1 output. Well, but these are very unlikely with ALC850 chip, so maybe it doesn't matter... :)
The below is a quick-fixed patch. Could you try it?
Takashi
---
include/ac97_codec.h +1 -0
@@ -397,6 +397,7 @@#define AC97_HAS_NO_TONE (1<<16)/* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17)/* no standard AC97 PCM volume and mute */ #define AC97_HAS_NO_AUX (1<<18)/* no standard AC97 AUX volume and mute */ +#define AC97_HAS_8CH (1<<19)/* supports 8-channel output */ /* rates indexes */ #define AC97_RATES_FRONT_DAC 0
pci/ac97/ac97_patch.c +33 -13
111 lines not on this page · raw message
pci/intel8x0.c +25 -3
@@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */#define ICH_PCM_SPDIF_69 0x80000000/* s/pdif pcm on slots 6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000/* s/pdif pcm on slots 10&11 */ #define ICH_PCM_20BIT 0x00400000/* 20-bit samples (ICH4) */ -#define ICH_PCM_246_MASK 0x00300000/* 6 channels (not all chips) */ +#define ICH_PCM_246_MASK 0x00300000/* channels (not all chips) */ +#define ICH_PCM_8 0x00300000/* 8 channels (not all chips) */ #define ICH_PCM_6 0x00200000/* 6 channels (not all chips) */ #define ICH_PCM_4 0x00100000/* 4 channels (not all chips) */ #define ICH_PCM_2 0x00000000/* 2 channels (stereo) */
@@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8 :1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1,
@@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |=ICH_PCM_4 ; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8;if (chip->device_type ==DEVICE_NFORCE ) {/* reset to 2ch once to keep the 6 channel data in alignment, * to start from Front Left always
@@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { +2 ,4 ,6 ,8 , +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count =ARRAY_SIZE (channels8), + .list = channels8, + .mask =0 , +}; +static int snd_intel8x0_pcm_open (struct snd_pcm_substream *substream,struct ichdev *ichdev) {struct intel8x0 *chip =snd_pcm_substream_chip (substream);
@@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(stif (err <0 )return err; -if (chip->multi6) { +if (chip->multi8) { + runtime->hw.channels_max =8 ; +snd_pcm_hw_constraint_list (runtime,0 , +SNDRV_PCM_HW_PARAM_CHANNELS , + &hw_constraints_channels8); + }else if (chip->multi6) { runtime->hw.channels_max =6 ;snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , &hw_constraints_channels6);
@@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( }if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_PCM_SLEFT )) { chip->multi4 =1 ; -if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) +if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) { chip->multi6 =1 ; +if (chip->ac97[0 ]->flags &AC97_HAS_8CH ) + chip->multi8 =1 ; + } }if (pbus->pcms[0 ].r[1 ].rslots[0 ]) { chip->dra =1 ;
Quoted 256 lines · Takashi Iwai
At Thu, 14 Feb 2008 15:02:04 -0500,
Quoted 2 lines · Andrew Boettcher
For some intel 8x0 cards there is 8 channel sound (such as the ALC850
chip
Quoted 1 line
on NFORCE 4 boards), and this has not been patched yet though the patch
has
Quoted 3 lines
been on the bug tracker. Here it is again updated for 1.0.16. There is also a patch for the configuration in alsa-lib for
cards/NFORCE.conf. I have been patching my sources every time I update my kernel, I figuredit
Quoted 1 line
was time for someone to actually submit this somewhere else. The patch
was
Quoted 1 line
written by Martin Ellis.
Thanks for submitting this. I haven't checked that issue.
The change is almost OK. One thing to be fixed is the enablement of
chip->multi8. It's unconditionally enabled together with multi6.I think we should add a new bitflag in
ac97_codec->flagsto indicate that the codec supports 8 channels. Also,ac97_channel_mode_info()shouldn't be unconditionally 8-channels, too. It should check the 8-channel capability as well.Do you know which audio controller model supports 7.1 output? We may need to check the chip model eventualy for 7.1-enablement. Certainly the earlier version of controllers don't support 7.1 output. Well, but these are very unlikely with ALC850 chip, so maybe it doesn't matter... :)
The below is a quick-fixed patch. Could you try it?
Takashi
---
diff -r
362cee3efa84include/ac97_codec.hinclude/ac97_codec.h Fri Feb 15 16:59:51 2008 +0100 renamed from include/ac97_codec.h Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -397,6 +397,7 @@ #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume andmute */
#defineAC97_HAS_NO_AUX(1<<18) /* no standard AC97 AUX
volume and mute */
+#defineAC97_HAS_8CH(1<<19) /* supports 8-channel output *//* rates indexes */
#defineAC97_RATES_FRONT_DAC0
diff -r362cee3efa84pci/ac97/ac97_patch.cpci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +0
-3@@ -114,10 +114,9 @@ static int ac97_surround_jack_mode_put(s static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static const char *texts[] = { "2ch", "4ch", "6ch" }; - if (kcontrol->private_value) - return ac97_enum_text_info(kcontrol, uinfo, texts, 2); /*4ch only */
pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +3
-1- return ac97_enum_text_info(kcontrol, uinfo, texts, 3); + static const char *texts[] = { "2ch", "4ch", "6ch", "8ch" }; + return ac97_enum_text_info(kcontrol, uinfo, texts, + kcontrol->private_value); } static int ac97_channel_mode_get(struct snd_kcontrol *kcontrol, struct
snd_ctl_elem_value*ucontrol)pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +29
-9@@ -133,13 +132,8 @@ static int ac97_channel_mode_put(struct struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); unsigned char mode = ucontrol->value.enumerated.item[0]; - if (kcontrol->private_value) { - if (mode >= 2) - return -EINVAL; - } else { - if (mode >= 3) - return -EINVAL; - } + if (mode >= kcontrol->private_value) + return -EINVAL; if (mode != ac97->channel_mode) { ac97->channel_mode = mode;@@ -158,6 +152,7 @@ static int ac97_channel_mode_put(struct .get = ac97_surround_jack_mode_get, \ .put = ac97_surround_jack_mode_put, \ } +/* 6ch */ #define AC97_CHANNEL_MODE_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \@@ -165,7 +160,9 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ + .private_value = 3, \ } +/* 4ch */ #define AC97_CHANNEL_MODE_4CH_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \@@ -173,7 +170,17 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ - .private_value = 1, \ + .private_value = 2, \ + } +/* 8ch */ +#define AC97_CHANNEL_MODE_8CH_CTL \ + { \ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ + .name = "Channel Mode", \ + .info = ac97_channel_mode_info, \ + .get = ac97_channel_mode_get, \ + .put = ac97_channel_mode_put, \ + .private_value = 4, \ } static inline int is_surround_on(struct snd_ac97 *ac97)@@ -208,6 +215,11 @@ static inline int is_shared_micin(struct static inline int is_shared_micin(struct snd_ac97 *ac97) { return !ac97->indep_surround && !is_clfe_on(ac97); +} + +static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) +{ + return is_surround_on(ac97); }@@ -2816,10 +2828,12 @@ static int patch_alc655(struct snd_ac97 #define AC97_ALC850_JACK_SELECT 0x76 #define AC97_ALC850_MISC1 0x7a +#define AC97_ALC850_MULTICH 0x6a static void alc850_update_jacks(struct snd_ac97 *ac97) { int shared; + int aux_is_back_surround; /* shared Line-In / Surround Out */ shared = is_shared_surrout(ac97);@@ -2837,13 +2851,18 @@ static void alc850_update_jacks(struct s /* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, shared ? (5<<4) : (1<<4)); + + aux_is_back_surround = alc850_is_aux_back_surround(ac97); + /* Aux is Back Surround */ + snd_ac97_update_bits(ac97, AC97_ALC850_MULTICH, 1 << 10, + aux_is_back_surround ? (1<<10) : (0<<10)); } static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = { AC97_PAGE_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0, 0), AC97_SINGLE("Mic Front Input Switch", AC97_ALC850_JACK_SELECT, 15, 1, 1), AC97_SURROUND_JACK_MODE_CTL, - AC97_CHANNEL_MODE_CTL, + AC97_CHANNEL_MODE_8CH_CTL, };static int
patch_alc850_specific(struct snd_ac97 *ac97)pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +1
-0@@ -2878,6 +2897,7 @@ static int patch_alc850(struct snd_ac97 spdif-in monitor off, spdif-in PCM off center on mic off, surround on line-in off duplicate front off + NB default bit 10=0 = Aux is Capture, not Back Surround */ snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); /* SURR_OUT: on, Surr 1kOhm: on, Surr Amp: off, Front 1kOhm: offdiff -r
362cee3efa84pci/intel8x0.cpci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */ #define ICH_PCM_SPDIF_69 0x80000000 /* s/pdif pcm on slots 6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000 /* s/pdif pcm on slots10&11 */
#defineICH_PCM_20BIT0x00400000/* 20-bit samples
(ICH4) */
-#defineICH_PCM_246_MASK0x00300000/* 6 channels (not all
chips) */
+#defineICH_PCM_246_MASK0x00300000/* channels (not all
chips) */
+#defineICH_PCM_80x00300000/* 8 channels (not all
chips) */
#defineICH_PCM_60x00200000/* 6 channels (not all
chips) */
#defineICH_PCM_40x00100000/* 4 channels (not all
chips) */
#defineICH_PCM_20x00000000/* 2 channels (stereo) */pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +3
-0@@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8 :1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1,@@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |= ICH_PCM_4; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8; if (chip->device_type == DEVICE_NFORCE) { /* reset to 2ch once to keep the 6 channel data in alignment,* to start from Front Left always
pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +10
-0@@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { + 2, 4, 6, 8, +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count = ARRAY_SIZE(channels8), + .list = channels8, + .mask = 0, +}; + static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) {struct intel8x0 *chip = snd_pcm_substream_chip(substream);pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +6
-1@@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(st if (err < 0) return err; - if (chip->multi6) { + if (chip->multi8) { + runtime->hw.channels_max = 8; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &hw_constraints_channels8); + } else if (chip->multi6) { runtime->hw.channels_max = 6; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,&hw_constraints_channels6);pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( } if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) {
pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 static int __devinit snd_intel8x0_mixer( · line 2224
Quoted 10 lines
pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +4
-1chip->multi4 = 1; - if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) + if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) { chip->multi6 = 1; + if (chip->ac97[0]->flags & AC97_HAS_8CH) + chip->multi8 = 1; + } } if (pbus->pcms[0].r[1].rslots[0]) { chip->dra = 1;
It does not work 8 channel. I found the problem though. in line 2219 of the patched pci/intel8x0.c it checks for the flag AC97_HAS_8CH This flag is never set anywhere. where would be the appropriate place?
if (chip->ac97[0]->flags & AC97_HAS_8CH)
chip->multi8 = 1;Andrew Boettcher
Quoted 278 lines · Andrew Boettcher
Quoted 259 lines · Takashi Iwai
At Thu, 14 Feb 2008 15:02:04 -0500,
Quoted 2 lines · Andrew Boettcher
For some intel 8x0 cards there is 8 channel sound (such as the ALC850
chip
Quoted 1 line
on NFORCE 4 boards), and this has not been patched yet though the
patch has
Quoted 1 line
been on the bug tracker. Here it is again updated for 1.0.16. There
is
Quoted 1 line
also a patch for the configuration in alsa-lib for
cards/NFORCE.conf.I
Quoted 1 line
have been patching my sources every time I update my kernel, I figured
it
Quoted 1 line
was time for someone to actually submit this somewhere else. The
patch was
Quoted 1 line
written by Martin Ellis.
Thanks for submitting this. I haven't checked that issue.
The change is almost OK. One thing to be fixed is the enablement of
chip->multi8. It's unconditionally enabled together with multi6.I think we should add a new bitflag in
ac97_codec->flagsto indicate that the codec supports 8 channels. Also,ac97_channel_mode_info()shouldn't be unconditionally 8-channels, too. It should check the 8-channel capability as well.Do you know which audio controller model supports 7.1 output? We may need to check the chip model eventualy for 7.1-enablement. Certainly the earlier version of controllers don't support 7.1 output. Well, but these are very unlikely with ALC850 chip, so maybe it doesn't matter... :)
The below is a quick-fixed patch. Could you try it?
Takashi
---
diff -r
362cee3efa84include/ac97_codec.hinclude/ac97_codec.h Fri Feb 15 16:59:51 2008 +0100 renamed from include/ac97_codec.h Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -397,6 +397,7 @@ #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volumeand mute */
#defineAC97_HAS_NO_AUX(1<<18) /* no standard AC97 AUX
volume and mute */
+#defineAC97_HAS_8CH(1<<19) /* supports 8-channel output *//* rates indexes */
#defineAC97_RATES_FRONT_DAC0
diff -r362cee3efa84pci/ac97/ac97_patch.cpci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +3
-4@@ -114,10 +114,9 @@ static int ac97_surround_jack_mode_put(s static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static const char *texts[] = { "2ch", "4ch", "6ch" }; - if (kcontrol->private_value) - return ac97_enum_text_info(kcontrol, uinfo, texts, 2); /* 4ch only */ - return ac97_enum_text_info(kcontrol, uinfo, texts, 3); + static const char *texts[] = { "2ch", "4ch", "6ch", "8ch" }; + return ac97_enum_text_info(kcontrol, uinfo, texts, + kcontrol->private_value); }static int ac97_channel_mode_get(struct
snd_kcontrol*kcontrol, structsnd_ctl_elem_value*ucontrol)pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +29
-9@@ -133,13 +132,8 @@ static int ac97_channel_mode_put(struct struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); unsigned char mode = ucontrol->value.enumerated.item[0]; - if (kcontrol->private_value) { - if (mode >= 2) - return -EINVAL; - } else { - if (mode >= 3) - return -EINVAL; - } + if (mode >= kcontrol->private_value) + return -EINVAL; if (mode != ac97->channel_mode) { ac97->channel_mode = mode;@@ -158,6 +152,7 @@ static int ac97_channel_mode_put(struct .get = ac97_surround_jack_mode_get, \ .put = ac97_surround_jack_mode_put, \ } +/* 6ch */ #define AC97_CHANNEL_MODE_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \@@ -165,7 +160,9 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ + .private_value = 3, \ } +/* 4ch */ #define AC97_CHANNEL_MODE_4CH_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \@@ -173,7 +170,17 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ - .private_value = 1, \ + .private_value = 2, \ + } +/* 8ch */ +#define AC97_CHANNEL_MODE_8CH_CTL \ + { \ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ + .name = "Channel Mode", \ + .info = ac97_channel_mode_info, \ + .get = ac97_channel_mode_get, \ + .put = ac97_channel_mode_put, \ + .private_value = 4, \ } static inline int is_surround_on(struct snd_ac97 *ac97)@@ -208,6 +215,11 @@ static inline int is_shared_micin(struct static inline int is_shared_micin(struct snd_ac97 *ac97) { return !ac97->indep_surround && !is_clfe_on(ac97); +} + +static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) +{ + return is_surround_on(ac97); }@@ -2816,10 +2828,12 @@ static int patch_alc655(struct snd_ac97 #define AC97_ALC850_JACK_SELECT 0x76 #define AC97_ALC850_MISC1 0x7a +#define AC97_ALC850_MULTICH 0x6a static void alc850_update_jacks(struct snd_ac97 *ac97) { int shared; + int aux_is_back_surround; /* shared Line-In / Surround Out */ shared = is_shared_surrout(ac97);@@ -2837,13 +2851,18 @@ static void alc850_update_jacks(struct s /* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, shared ? (5<<4) : (1<<4)); + + aux_is_back_surround = alc850_is_aux_back_surround(ac97); + /* Aux is Back Surround */ + snd_ac97_update_bits(ac97, AC97_ALC850_MULTICH, 1 << 10, + aux_is_back_surround ? (1<<10) : (0<<10)); } static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = { AC97_PAGE_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0, 0), AC97_SINGLE("Mic Front Input Switch", AC97_ALC850_JACK_SELECT, 15, 1, 1), AC97_SURROUND_JACK_MODE_CTL, - AC97_CHANNEL_MODE_CTL, + AC97_CHANNEL_MODE_8CH_CTL, };static int
patch_alc850_specific(struct snd_ac97 *ac97)pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +1
-0@@ -2878,6 +2897,7 @@ static int patch_alc850(struct snd_ac97 spdif-in monitor off, spdif-in PCM off center on mic off, surround on line-in off duplicate front off + NB default bit 10=0 = Aux is Capture, not Back Surround */ snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); /* SURR_OUT: on, Surr 1kOhm: on, Surr Amp: off, Front 1kOhm: offdiff -r
362cee3efa84pci/intel8x0.cpci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */ #define ICH_PCM_SPDIF_69 0x80000000 /* s/pdif pcm on slots6&9 */
#defineICH_PCM_SPDIF_10110xc0000000/* s/pdif pcm on slots
10&11 */
#defineICH_PCM_20BIT0x00400000/* 20-bit
samples (ICH4) */
-#defineICH_PCM_246_MASK0x00300000/* 6 channels (not all
chips) */
+#defineICH_PCM_246_MASK0x00300000/* channels (not all
chips) */
+#defineICH_PCM_80x00300000/* 8 channels (not all
chips) */
#defineICH_PCM_60x00200000/* 6 channels (not all
chips) */
#defineICH_PCM_40x00100000/* 4 channels (not all
chips) */
#defineICH_PCM_20x00000000/* 2 channels (stereo)
*/pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +3
-0@@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8 :1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1,@@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |= ICH_PCM_4; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8; if (chip->device_type == DEVICE_NFORCE) { /* reset to 2ch once to keep the 6 channel data in alignment,* to start from Front Left always
pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +10
-0@@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { + 2, 4, 6, 8, +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count = ARRAY_SIZE(channels8), + .list = channels8, + .mask = 0, +}; + static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) {struct intel8x0 *chip = snd_pcm_substream_chip(substream);pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +6
-1@@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(st if (err < 0) return err; - if (chip->multi6) { + if (chip->multi8) { + runtime->hw.channels_max = 8; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &hw_constraints_channels8); + } else if (chip->multi6) { runtime->hw.channels_max = 6; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,&hw_constraints_channels6);pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +0
-0@@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( } if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) {pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 static int __devinit snd_intel8x0_mixer( · line 2224
Quoted 10 lines
pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 renamed from pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +4
-1chip->multi4 = 1; - if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) + if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) { chip->multi6 = 1; + if (chip->ac97[0]->flags & AC97_HAS_8CH) + chip->multi8 = 1; + } } if (pbus->pcms[0].r[1].rslots[0]) { chip->dra = 1;It does not work 8 channel. I found the problem though. in line 2219 of the patched
pci/intel8x0.cit checks for the flagAC97_HAS_8CHThis flag is never set anywhere. where would be the appropriate place?
Quoted 4 lines
if (chip->ac97[0]->flags & AC97_HAS_8CH) chip->multi8 = 1;Andrew Boettcher
I went ahead and made a new patch, attached. I put the flag in patch_alc850() in pci/ac97/ac97_patch.c
The only issue I see now is the imbalanced volumes, nothing a .asoundrc can't fix. I wonder if the DAC volumes are maxed for the side and rear DACs? In the code it only maxes 2 of them. I don't have a data sheet to see how to max the others if they are maxed, or what the deal is.
Andrew Boettcher
include/ac97_codec.h +1 -0
@@ -397,6 +397,7 @@#define AC97_HAS_NO_TONE (1<<16)/* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17)/* no standard AC97 PCM volume and mute */ #define AC97_HAS_NO_AUX (1<<18)/* no standard AC97 AUX volume and mute */ +#define AC97_HAS_8CH (1<<19)/* supports 8-channel output */ /* rates indexes */ #define AC97_RATES_FRONT_DAC 0
pci/ac97/ac97_patch.c +34 -13
118 lines not on this page · raw message
pci/intel8x0.c +25 -3
@@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */#define ICH_PCM_SPDIF_69 0x80000000/* s/pdif pcm on slots 6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000/* s/pdif pcm on slots 10&11 */ #define ICH_PCM_20BIT 0x00400000/* 20-bit samples (ICH4) */ -#define ICH_PCM_246_MASK 0x00300000/* 6 channels (not all chips) */ +#define ICH_PCM_246_MASK 0x00300000/* 6/8 channels (not all chips) */ +#define ICH_PCM_8 0x00300000/* 8 channels (not all chips) */ #define ICH_PCM_6 0x00200000/* 6 channels (not all chips) */ #define ICH_PCM_4 0x00100000/* 4 channels (not all chips) */ #define ICH_PCM_2 0x00000000/* 2 channels (stereo) */
@@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8: 1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1,
@@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |=ICH_PCM_4 ; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8;if (chip->device_type ==DEVICE_NFORCE ) {/* reset to 2ch once to keep the 6 channel data in alignment, * to start from Front Left always
@@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { +2 ,4 ,6 ,8 , +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count =ARRAY_SIZE (channels8), + .list = channels8, + .mask =0 , +}; +static int snd_intel8x0_pcm_open (struct snd_pcm_substream *substream,struct ichdev *ichdev) {struct intel8x0 *chip =snd_pcm_substream_chip (substream);
@@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(stif (err <0 )return err; -if (chip->multi6) { +if (chip->multi8) { + runtime->hw.channels_max =8 ; +snd_pcm_hw_constraint_list (runtime,0 , +SNDRV_PCM_HW_PARAM_CHANNELS , + &hw_constraints_channels8); + }else if (chip->multi6) { runtime->hw.channels_max =6 ;snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , &hw_constraints_channels6);
@@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( }if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_PCM_SLEFT )) { chip->multi4 =1 ; -if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) +if (pbus->pcms[0 ].r[0 ].slots & (1 <<AC97_SLOT_LFE )) { chip->multi6 =1 ; +if (chip->ac97[0 ]->flags &AC97_HAS_8CH ) + chip->multi8 =1 ; + } }if (pbus->pcms[0 ].r[1 ].rslots[0 ]) { chip->dra =1 ;
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Sun, 17 Feb 2008 14:31:11 -0500,
Quoted 288 lines · Andrew Boettcher
[1 <multipart/alternative (7bit)>]
[1.1 <text/plain; ISO-8859-1 (7bit)>][1.2 <text/html; ISO-8859-1 (7bit)>]
On Feb 17, 2008 1:53 PM, Andrew Boettcher <[email protected]> wrote:On Feb 15, 2008 11:01 AM, Takashi Iwai <[email protected]> wrote: At Thu, 14 Feb 2008 15:02:04 -0500, Andrew Boettcher wrote: > > For some intel 8x0 cards there is 8 channel sound (such as the ALC850 chip > on NFORCE 4 boards), and this has not been patched yet though the patch has > been on the bug tracker. Here it is again updated for 1.0.16. There is > also a patch for the configuration in alsa-lib for cards/ NFORCE.conf. I > have been patching my sources every time I update my kernel, I figured it > was time for someone to actually submit this somewhere else. The patch was > written by Martin Ellis. Thanks for submitting this. I haven't checked that issue. The change is almost OK. One thing to be fixed is the enablement of chip->multi8. It's unconditionally enabled together with multi6. I think we should add a new bitflag in ac97_codec->flags to indicate that the codec supports 8 channels. Also, ac97_channel_mode_info() shouldn't be unconditionally 8-channels, too. It should check the 8-channel capability as well. Do you know which audio controller model supports 7.1 output? We may need to check the chip model eventualy for 7.1-enablement. Certainly the earlier version of controllers don't support 7.1 output. Well, but these are very unlikely with ALC850 chip, so maybe it doesn't matter... :) The below is a quick-fixed patch. Could you try it? Takashi --- diff -r 362cee3efa84 include/ac97_codec.h --- a/include/ac97_codec.h Fri Feb 15 16:43:11 2008 +0100 +++ b/include/ac97_codec.h Fri Feb 15 16:59:51 2008 +0100 @@ -397,6 +397,7 @@ #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */ #define AC97_HAS_NO_AUX (1<<18) /* no standard AC97 AUX volume and mute */ +#define AC97_HAS_8CH (1<<19) /* supports 8-channel output * / /* rates indexes */ #define AC97_RATES_FRONT_DAC 0 diff -r 362cee3efa84 pci/ac97/ac97_patch.c --- a/pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +++ b/pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 @@ -114,10 +114,9 @@ static int ac97_surround_jack_mode_put(s static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static const char *texts[] = { "2ch", "4ch", "6ch" }; - if (kcontrol->private_value) - return ac97_enum_text_info(kcontrol, uinfo, texts, 2); /* 4ch only */ - return ac97_enum_text_info(kcontrol, uinfo, texts, 3); + static const char *texts[] = { "2ch", "4ch", "6ch", "8ch" }; + return ac97_enum_text_info(kcontrol, uinfo, texts, + kcontrol->private_value); } static int ac97_channel_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -133,13 +132,8 @@ static int ac97_channel_mode_put(struct struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); unsigned char mode = ucontrol->value.enumerated.item[0]; - if (kcontrol->private_value) { - if (mode >= 2) - return -EINVAL; - } else { - if (mode >= 3) - return -EINVAL; - } + if (mode >= kcontrol->private_value) + return -EINVAL; if (mode != ac97->channel_mode) { ac97->channel_mode = mode; @@ -158,6 +152,7 @@ static int ac97_channel_mode_put(struct .get = ac97_surround_jack_mode_get, \ .put = ac97_surround_jack_mode_put, \ } +/* 6ch */ #define AC97_CHANNEL_MODE_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ @@ -165,7 +160,9 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ + .private_value = 3, \ } +/* 4ch */ #define AC97_CHANNEL_MODE_4CH_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ @@ -173,7 +170,17 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ - .private_value = 1, \ + .private_value = 2, \ + } +/* 8ch */ +#define AC97_CHANNEL_MODE_8CH_CTL \ + { \ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ + .name = "Channel Mode", \ + .info = ac97_channel_mode_info, \ + .get = ac97_channel_mode_get, \ + .put = ac97_channel_mode_put, \ + .private_value = 4, \ } static inline int is_surround_on(struct snd_ac97 *ac97) @@ -208,6 +215,11 @@ static inline int is_shared_micin(struct static inline int is_shared_micin(struct snd_ac97 *ac97) { return !ac97->indep_surround && !is_clfe_on(ac97); +} + +static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) +{ + return is_surround_on(ac97); } @@ -2816,10 +2828,12 @@ static int patch_alc655(struct snd_ac97 #define AC97_ALC850_JACK_SELECT 0x76 #define AC97_ALC850_MISC1 0x7a +#define AC97_ALC850_MULTICH 0x6a static void alc850_update_jacks(struct snd_ac97 *ac97) { int shared; + int aux_is_back_surround; /* shared Line-In / Surround Out */ shared = is_shared_surrout(ac97); @@ -2837,13 +2851,18 @@ static void alc850_update_jacks(struct s /* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, shared ? (5<<4) : (1<<4)); + + aux_is_back_surround = alc850_is_aux_back_surround(ac97); + /* Aux is Back Surround */ + snd_ac97_update_bits(ac97, AC97_ALC850_MULTICH, 1 << 10, + aux_is_back_surround ? (1<<10) : (0 <<10)); } static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = { AC97_PAGE_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0, 0), AC97_SINGLE("Mic Front Input Switch", AC97_ALC850_JACK_SELECT, 15, 1, 1), AC97_SURROUND_JACK_MODE_CTL, - AC97_CHANNEL_MODE_CTL, + AC97_CHANNEL_MODE_8CH_CTL, }; static int patch_alc850_specific(struct snd_ac97 *ac97) @@ -2878,6 +2897,7 @@ static int patch_alc850(struct snd_ac97 spdif-in monitor off, spdif-in PCM off center on mic off, surround on line-in off duplicate front off + NB default bit 10=0 = Aux is Capture, not Back Surround */ snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); /* SURR_OUT: on, Surr 1kOhm: on, Surr Amp: off, Front 1kOhm: off diff -r 362cee3efa84 pci/intel8x0.c --- a/pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +++ b/pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 @@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */ #define ICH_PCM_SPDIF_69 0x80000000 /* s/pdif pcm on slots 6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000 /* s/pdif pcm on slots 10&11 */ #define ICH_PCM_20BIT 0x00400000 /* 20-bit samples (ICH4) */ -#define ICH_PCM_246_MASK 0x00300000 /* 6 channels (not all chips) */ +#define ICH_PCM_246_MASK 0x00300000 /* channels (not all chips) */ +#define ICH_PCM_8 0x00300000 /* 8 channels (not all chips) */ #define ICH_PCM_6 0x00200000 /* 6 channels (not all chips) */ #define ICH_PCM_4 0x00100000 /* 4 channels (not all chips) */ #define ICH_PCM_2 0x00000000 /* 2 channels (stereo) */ @@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8 :1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1, @@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |= ICH_PCM_4; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8; if (chip->device_type == DEVICE_NFORCE) { /* reset to 2ch once to keep the 6 channel data in alignment, * to start from Front Left always @@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { + 2, 4, 6, 8, +}; + +static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { + .count = ARRAY_SIZE(channels8), + .list = channels8, + .mask = 0, +}; + static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) { struct intel8x0 *chip = snd_pcm_substream_chip(substream); @@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(st if (err < 0) return err; - if (chip->multi6) { + if (chip->multi8) { + runtime->hw.channels_max = 8; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &hw_constraints_channels8); + } else if (chip->multi6) { runtime->hw.channels_max = 6; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels6); @@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( } if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) { chip->multi4 = 1; - if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) + if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) { chip->multi6 = 1; + if (chip->ac97[0]->flags & AC97_HAS_8CH) + chip->multi8 = 1; + } } if (pbus->pcms[0].r[1].rslots[0]) { chip->dra = 1; It does not work 8 channel. I found the problem though. in line 2219 of the patched pci/intel8x0.c it checks for the flag AC97_HAS_8CH This flag is never set anywhere. where would be the appropriate place? if (chip->ac97[0]->flags & AC97_HAS_8CH) chip->multi8 = 1; Andrew Boettcher
Quoted 2 lines
I went ahead and made a new patch, attached. I put the flag in
patch_alc850() inpci/ac97/ac97_patch.c
Yes, that's the right place.
Quoted 4 lines
The only issue I see now is the imbalanced volumes, nothing a .asoundrc can't fix. I wonder if the DAC volumes are maxed for the side and rear DACs? In the code it only maxes 2 of them. I don't have a data sheet to see how to max the others if they are maxed, or what the deal is.
Hm, could you elaborate? Which DAC volume doesn't get the maximum volume and which volume can be in the max level (supposed 0dB) via which AC97 register / ALSA mixer control right now?
Takashi
At Mon, 18 Feb 2008 07:59:17 +0100,
Quoted 5 lines · I wrote:
Quoted 3 lines
I went ahead and made a new patch, attached. I put the flag in
patch_alc850() inpci/ac97/ac97_patch.cYes, that's the right place.
... and committed to HG tree after minor codin-style fixes.
thanks,
Takashi
Quoted 344 lines · Takashi Iwai
At Sun, 17 Feb 2008 14:31:11 -0500,
Quoted 7 lines · Andrew Boettcher
[1 <multipart/alternative (7bit)>]
[1.1 <text/plain; ISO-8859-1 (7bit)>][1.2 <text/html; ISO-8859-1 (7bit)>]
On Feb 17, 2008 1:53 PM, Andrew Boettcher <[email protected]> wrote:Quoted 8 lines
On Feb 15, 2008 11:01 AM, Takashi Iwai <[email protected]> wrote: At Thu, 14 Feb 2008 15:02:04 -0500, Andrew Boettcher wrote: > > For some intel 8x0 cards there is 8 channel sound (such as the ALC850 chip > on NFORCE 4 boards), and this has not been patched yet thoughthe
Quoted 8 lines
patch has
> been on the bug tracker. Here it is again updated for 1.0.16.
There is
> also a patch for the configuration in alsa-lib for cards/ NFORCE.conf. I
> have been patching my sources every time I update my kernel, I figured it
> was time for someone to actually submit this somewhere else.The
Quoted 6 lines
patch was
> written by Martin Ellis.Thanks for submitting this. I haven't checked that issue.
The change is almost OK. One thing to be fixed is the
enablement of
Quoted 1 line
chip->multi8. It's unconditionally enabled together withmulti6.
Quoted 2 lines
I think we should add a new bitflag in ac97_codec->flags toindicate
Quoted 1 line
that the codec supports 8 channels. Also,
ac97_channel_mode_info()Quoted 1 line
shouldn't be unconditionally 8-channels, too. It should check
the
Quoted 3 lines
8-channel capability as well.
Do you know which audio controller model supports 7.1 output?
We may
Quoted 9 lines
need to check the chip model eventualy for 7.1-enablement. Certainly the earlier version of controllers don't support 7.1output. Well, but these are very unlikely with ALC850 chip, so maybe it doesn't matter... :) The below is a quick-fixed patch. Could you try it? TakashiQuoted 8 lines
--- diff -r 362cee3efa84 include/ac97_codec.h --- a/include/ac97_codec.h Fri Feb 15 16:43:11 2008 +0100 +++ b/include/ac97_codec.h Fri Feb 15 16:59:51 2008 +0100 @@ -397,6 +397,7 @@ #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCMvolume
Quoted 2 lines
and mute */
#defineAC97_HAS_NO_AUX(1<<18) /* no standardAC97
Quoted 2 lines
AUX volume and mute */
+#defineAC97_HAS_8CH(1<<19) /* supports 8-channeloutput *
Quoted 10 lines
/ /* rates indexes */ #define AC97_RATES_FRONT_DAC 0 diff -r 362cee3efa84 pci/ac97/ac97_patch.c --- a/pci/ac97/ac97_patch.c Fri Feb 15 16:43:11 2008 +0100 +++ b/pci/ac97/ac97_patch.c Fri Feb 15 16:59:51 2008 +0100 @@ -114,10 +114,9 @@ static int ac97_surround_jack_mode_put(s static int ac97_channel_mode_info(struct snd_kcontrol*kcontrol,
Quoted 5 lines
struct
snd_ctl_elem_info*uinfo)
{
- static const char *texts[] = { "2ch", "4ch", "6ch" };
- if (kcontrol->private_value)
- return ac97_enum_text_info(kcontrol, uinfo,texts, 2);
Quoted 3 lines
/* 4ch only */
- returnac97_enum_text_info(kcontrol, uinfo, texts, 3);
+ static const char *texts[] = { "2ch", "4ch", "6ch","8ch" };
Quoted 58 lines
+ return ac97_enum_text_info(kcontrol, uinfo, texts, + kcontrol->private_value); } static int ac97_channel_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -133,13 +132,8 @@ static int ac97_channel_mode_put(struct struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); unsigned char mode = ucontrol->value.enumerated.item[0]; - if (kcontrol->private_value) { - if (mode >= 2) - return -EINVAL; - } else { - if (mode >= 3) - return -EINVAL; - } + if (mode >= kcontrol->private_value) + return -EINVAL; if (mode != ac97->channel_mode) { ac97->channel_mode = mode; @@ -158,6 +152,7 @@ static int ac97_channel_mode_put(struct .get = ac97_surround_jack_mode_get, \ .put = ac97_surround_jack_mode_put, \ } +/* 6ch */ #define AC97_CHANNEL_MODE_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ @@ -165,7 +160,9 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ + .private_value = 3, \ } +/* 4ch */ #define AC97_CHANNEL_MODE_4CH_CTL \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ @@ -173,7 +170,17 @@ static int ac97_channel_mode_put(struct .info = ac97_channel_mode_info, \ .get = ac97_channel_mode_get, \ .put = ac97_channel_mode_put, \ - .private_value = 1, \ + .private_value = 2, \ + } +/* 8ch */ +#define AC97_CHANNEL_MODE_8CH_CTL \ + { \ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ + .name = "Channel Mode", \ + .info = ac97_channel_mode_info, \ + .get = ac97_channel_mode_get, \ + .put = ac97_channel_mode_put, \ + .private_value = 4, \ }Quoted 8 lines
static inline int is_surround_on(struct snd_ac97 *ac97) @@ -208,6 +215,11 @@ static inline int is_shared_micin(struct static inline int is_shared_micin(struct snd_ac97 *ac97) { return !ac97->indep_surround && !is_clfe_on(ac97); +} + +static inline int alc850_is_aux_back_surround(struct snd_ac97*ac97)
Quoted 12 lines
+{ + return is_surround_on(ac97); } @@ -2816,10 +2828,12 @@ static int patch_alc655(struct snd_ac97 #define AC97_ALC850_JACK_SELECT 0x76 #define AC97_ALC850_MISC1 0x7a +#define AC97_ALC850_MULTICH 0x6a static void alc850_update_jacks(struct snd_ac97 *ac97) {Quoted 8 lines
int shared; + int aux_is_back_surround; /* shared Line-In / Surround Out */ shared = is_shared_surrout(ac97); @@ -2837,13 +2851,18 @@ static void alc850_update_jacks(struct s /* MIC-IN = 1, CENTER-LFE = 5 */ snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 <<4,
Quoted 3 lines
shared ? (5<<4) : (1<<4)); + + aux_is_back_surround =
alc850_is_aux_back_surround(ac97);Quoted 7 lines
+ /* Aux is Back Surround */
+ snd_ac97_update_bits(ac97,AC97_ALC850_MULTICH, 1 << 10,
+aux_is_back_surround? (1<<10) : (0
<<10));
}static const struct
snd_kcontrol_newsnd_ac97_controls_alc850[]= {
Quoted 1 line
AC97_PAGE_SINGLE("Duplicate Front", AC97_ALC650_MULTICH,0, 1,
Quoted 2 lines
0, 0),
AC97_SINGLE("Mic Front Input Switch",
AC97_ALC850_JACK_SELECT,Quoted 6 lines
15, 1, 1),
AC97_SURROUND_JACK_MODE_CTL,
-AC97_CHANNEL_MODE_CTL,
+AC97_CHANNEL_MODE_8CH_CTL,
};Quoted 6 lines
static int
patch_alc850_specific(struct snd_ac97 *ac97)
@@ -2878,6 +2897,7 @@ static int patch_alc850(structsnd_ac97
spdif-in monitor off, spdif-in PCM off center on mic off, surround on line-in off duplicate front off
+ NB default bit 10=0 = Aux is Capture, not BackSurround
Quoted 3 lines
*/ snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); /* SURR_OUT: on, Surr 1kOhm: on, Surr Amp: off, Front1kOhm:
Quoted 6 lines
off diff -r 362cee3efa84 pci/intel8x0.c --- a/pci/intel8x0.c Fri Feb 15 16:43:11 2008 +0100 +++ b/pci/intel8x0.c Fri Feb 15 16:59:51 2008 +0100 @@ -155,7 +155,8 @@ DEFINE_REGSET(SP, 0x60); /* SPDIF out */ #define ICH_PCM_SPDIF_69 0x80000000 /* s/pdif pcm onslots
Quoted 2 lines
6&9 */ #define ICH_PCM_SPDIF_1011 0xc0000000 /* s/pdif pcm onslots
Quoted 2 lines
10&11 */ #define ICH_PCM_20BIT 0x00400000 /*20-bit
Quoted 2 lines
samples (ICH4) */ -#define ICH_PCM_246_MASK 0x00300000 /* 6 channels(not all
Quoted 2 lines
chips) */ +#define ICH_PCM_246_MASK 0x00300000 /* channels (notall
Quoted 2 lines
chips) */ +#define ICH_PCM_8 0x00300000 /* 8 channels(not all
Quoted 2 lines
chips) */ #define ICH_PCM_6 0x00200000 /* 6 channels(not all
Quoted 2 lines
chips) */ #define ICH_PCM_4 0x00100000 /* 4 channels(not all
Quoted 2 lines
chips) */ #define ICH_PCM_2 0x00000000 /* 2 channels(stereo)
Quoted 9 lines
*/ @@ -382,6 +383,7 @@ struct intel8x0 { unsigned multi4: 1, multi6: 1, + multi8 :1, dra: 1, smp20bit: 1; unsigned in_ac97_init: 1,Quoted 8 lines
@@ -995,6 +997,8 @@ static void snd_intel8x0_setup_pcm_out(s cnt |= ICH_PCM_4; else if (runtime->channels == 6) cnt |= ICH_PCM_6; + else if (runtime->channels == 8) + cnt |= ICH_PCM_8; if (chip->device_type == DEVICE_NFORCE) { /* reset to 2ch once to keep the 6channel data
Quoted 11 lines
in alignment, * to start from Front Left always @@ -1104,6 +1108,16 @@ static struct snd_pcm_hw_constraint_list .mask = 0, }; +static unsigned int channels8[] = { + 2, 4, 6, 8, +}; + +static struct snd_pcm_hw_constraint_list
hw_constraints_channels8= {Quoted 6 lines
+ .count = ARRAY_SIZE(channels8), + .list = channels8, + .mask = 0, +}; + static int snd_intel8x0_pcm_open(struct snd_pcm_substream*substream,
Quoted 3 lines
struct ichdev *ichdev)
{
struct intel8x0 *chip =
snd_pcm_substream_chip(substream);Quoted 11 lines
@@ -1134,7 +1148,12 @@ static int snd_intel8x0_playback_open(st if (err < 0) return err; - if (chip->multi6) { + if (chip->multi8) { + runtime->hw.channels_max = 8; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, +
&hw_constraints_channels8);Quoted 5 lines
+ } else if (
chip->multi6) {
runtime->hw.channels_max= 6; snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_CHANNELS,
&hw_constraints_channels6);Quoted 3 lines
@@ -2195,8 +2214,11 @@ static int __devinit snd_intel8x0_mixer( } if (pbus->pcms[0].r[0].slots & (1 <<
AC97_SLOT_PCM_SLEFT)) {Quoted 2 lines
chip->multi4= 1;
- if (pbus->pcms[0].r[0].slots & (1 <<
AC97_SLOT_LFE))Quoted 1 line
+ if (pbus->pcms[0].r[0].slots & (1 <<
AC97_SLOT_LFE)) {Quoted 9 lines
chip->multi6= 1;
+ if (chip->ac97[0]->flags &AC97_HAS_8CH)
+chip->multi8= 1;
+ }
}
if (pbus->pcms[0].r[1].rslots[0]) {
chip->dra= 1;It does not work 8 channel. I found the problem though. in line
2219 of
Quoted 2 lines
the patched
pci/intel8x0.cit checks for the flagAC97_HAS_8CHThis flag is never set anywhere. where would be the appropriateplace?
Quoted 7 lines
if (chip->ac97[0]->flags & AC97_HAS_8CH) chip->multi8 = 1; Andrew BoettcherI went ahead and made a new patch, attached. I put the flag in
patch_alc850Quoted 1 line
() in
pci/ac97/ac97_patch.cYes, that's the right place.
Quoted 1 line
The only issue I see now is the imbalanced volumes, nothing a .asoundrc
can't
Quoted 1 line
fix. I wonder if the DAC volumes are maxed for the side and rear DACs?
In
Quoted 1 line
the code it only maxes 2 of them. I don't have a data sheet to see how
to max
Quoted 9 lines
Quoted 1 line
the others if they are maxed, or what the deal is.
Hm, could you elaborate? Which DAC volume doesn't get the maximum volume and which volume can be in the max level (supposed 0dB) via which AC97 register / ALSA mixer control right now?
Takashi
After reading the datasheet AC97_PCM is _only_ the front DAC volume. The center/LFE and Surround DAC volumes are forced to 0x0808 (+0dB gain). The rear surround DAC has no method of controlling the DAC volume, it only has its normal volume control that it shares with aux in. I am going to change my own source to remove the PCM volume control and just force it to 0x0808, but not all people want balanced sound so I guess I will keep that patch to myself. I would however recommend setting the AC97_PCM register to 0x0808 by default to match the other DAC volumes. Normally volumes are all muted at first by default, so I don't know how this would be done. The DACs go up to +12dB gain, so max PCM volume is what made my front speakers much louder than the center/LFE side and rear.
Andrew