From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Testers of via82xx 5.1 output (Re: ALC655 in CVS: Are Center/LFE switched with Surround?) Date: Wed, 19 Nov 2003 18:50:28 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <3FBB8699.10602@starhub.net.sg> <3FBB9BBE.20203@starhub.net.sg> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Wed_Nov_19_18:50:28_2003-1" Return-path: In-Reply-To: <3FBB9BBE.20203@starhub.net.sg> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Richard Chan Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Wed_Nov_19_18:50:28_2003-1 Content-Type: text/plain; charset=US-ASCII At Thu, 20 Nov 2003 00:35:10 +0800, Richard Chan wrote: > > Alas, the new VIA82XX.conf doesn't fix the problem. > (ALC655 does not have the "Slot Modify" feature of ALC650). > Also I realise I still need a plug with slave.channels 6 oh yeah, you're right, ALC655 is not completely compatible with ALC655... ok, the attached patch is a quick hack for better supporting ALC655 and ALC658. it includes the swap of via82xx 5.1 output (again). IIRC, the slot assignment was determined by reports of someone else, and we confirmed that is the correct order. but, apparently, it's not true on your board. possibly this depends on the codec or mobo..? not sure, why the slots are swapped on yours. *** so, now the "CALL FOR TESTS". does anyone have 5.1 output-capable boards with VIA823x chipset? the VIA8233A is exception. it needs a different way to handle. if it's one of the others, VIA8233,A,C or 8235, please check whether the jack assignment of 5.1 output is correct. regardless whether the output is correct or not, please give the feedback together with the info, which ac97 codec is on it. see /proc/asound/card0/ac97#0 for that. oh, don't forget to update to 1.0.0pre1 version! thanks, Takashi --Multipart_Wed_Nov_19_18:50:28_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="via-alc655-fix.dif" Content-Transfer-Encoding: 7bit Index: alsa-kernel/pci/via82xx.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/via82xx.c,v retrieving revision 1.76 diff -u -r1.76 via82xx.c --- alsa-kernel/pci/via82xx.c 18 Nov 2003 15:23:27 -0000 1.76 +++ alsa-kernel/pci/via82xx.c 19 Nov 2003 17:34:39 -0000 @@ -972,8 +972,10 @@ case 2: slots = (1<<0) | (2<<4); break; case 3: slots = (1<<0) | (2<<4) | (5<<8); break; case 4: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12); break; - case 5: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16); break; - case 6: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16) | (6<<20); break; + // case 5: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16); break; + case 5: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16); break; + // case 6: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16) | (6<<20); break; + case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); break; default: slots = 0; break; } } Index: alsa-kernel/pci/ac97/ac97_codec.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v retrieving revision 1.101 diff -u -r1.101 ac97_codec.c --- alsa-kernel/pci/ac97/ac97_codec.c 18 Nov 2003 11:48:28 -0000 1.101 +++ alsa-kernel/pci/ac97/ac97_codec.c 19 Nov 2003 17:35:25 -0000 @@ -112,7 +112,8 @@ { 0x414c4721, 0xfffffff0, "ALC650D", patch_alc650, NULL }, { 0x414c4722, 0xfffffff0, "ALC650E", patch_alc650, NULL }, { 0x414c4723, 0xfffffff0, "ALC650F", patch_alc650, NULL }, -{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc650, NULL }, +{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, +{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, { 0x414c4730, 0xffffffff, "ALC101", NULL, NULL }, { 0x414c4740, 0xfffffff0, "ALC202", NULL, NULL }, { 0x414c4750, 0xfffffff0, "ALC250", NULL, NULL }, @@ -1985,9 +1986,9 @@ snd_ac97_write(ac97, AC97_GENERAL_PURPOSE, 0); snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); - snd_ac97_write(ac97, AC97_MASTER, 0x8000); + snd_ac97_write(ac97, AC97_MASTER, 0x8101); for (i = 0; i < 10; i++) { - if (snd_ac97_read(ac97, AC97_MASTER) == 0x8000) + if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) break; mdelay(1); } @@ -1996,7 +1997,7 @@ if (ac97->bus->init) ac97->bus->init(ac97); - is_ad18xx = (ac97->id & 0xffffff40) == AC97_ID_AD1881; + is_ad18xx = (ac97->flags & AC97_AD_MULTI); if (is_ad18xx) { /* restore the AD18xx codec configurations */ for (codec = 0; codec < 3; codec++) { Index: alsa-kernel/pci/ac97/ac97_patch.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_patch.c,v retrieving revision 1.31 diff -u -r1.31 ac97_patch.c --- alsa-kernel/pci/ac97/ac97_patch.c 3 Nov 2003 18:03:53 -0000 1.31 +++ alsa-kernel/pci/ac97/ac97_patch.c 19 Nov 2003 17:37:37 -0000 @@ -983,6 +983,8 @@ /* 7: Independent Master Volume Left */ /* 8: reserved */ AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0), + /* 10: mic, see below */ + /* 11-13: in IEC958 controls */ AC97_SINGLE("Swap Surround Slot", AC97_ALC650_MULTICH, 14, 1, 0), #if 0 /* always set in patch_alc650 */ AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0), @@ -1109,6 +1111,98 @@ return 0; } +static const snd_kcontrol_new_t snd_ac97_controls_alc655[] = { + AC97_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0), + AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0), + AC97_SINGLE("Mic As Center/LFE", AC97_ALC650_MULTICH, 10, 1, 0), +}; + +static int alc655_iec958_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +{ + static char *texts_655[3] = { "PCM", "Analog In", "IEC958 In" }; + static char *texts_658[4] = { "PCM", "Analog1 In", "Analog2 In", "IEC958 In" }; + ac97_t *ac97 = snd_kcontrol_chip(kcontrol); + + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + uinfo->count = 1; + uinfo->value.enumerated.items = ac97->spec.dev_flags ? 4 : 3; + if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) + uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; + strcpy(uinfo->value.enumerated.name, + ac97->spec.dev_flags ? + texts_658[uinfo->value.enumerated.item] : + texts_655[uinfo->value.enumerated.item]); + return 0; + +} + +static int alc655_iec958_route_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + ac97_t *ac97 = snd_kcontrol_chip(kcontrol); + unsigned short val; + + val = ac97->regs[AC97_ALC650_MULTICH]; + val = (val >> 12) & 3; + if (ac97->spec.dev_flags && val == 3) + val = 0; + ucontrol->value.enumerated.item[0] = val; + return 0; +} + +static int alc655_iec958_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + ac97_t *ac97 = snd_kcontrol_chip(kcontrol); + return snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 3 << 12, + (unsigned short)ucontrol->value.enumerated.item[0]); +} + +static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = { + AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0), + AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "IEC958 Playback Route", + .info = alc655_iec958_route_info, + .get = alc655_iec958_route_get, + .put = alc655_iec958_route_put, + }, +}; + +static int patch_alc655_specific(ac97_t * ac97) +{ + int err; + + if ((err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655))) < 0) + return err; + if (ac97->ext_id & AC97_EI_SPDIF) { + if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0) + return err; + } + return 0; +} + +static struct snd_ac97_build_ops patch_alc655_ops = { + .build_specific = patch_alc655_specific +}; + +int patch_alc655(ac97_t * ac97) +{ + ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */ + + ac97->build_ops = &patch_alc655_ops; + + /* enable spdif in */ + snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK, + snd_ac97_read(ac97, AC97_ALC650_MULTICH) | 0x8000); + snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK, + snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x02); + + /* full DAC volume */ + snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); + snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); + return 0; +} + static const snd_kcontrol_new_t snd_ac97_cm9738_controls[] = { AC97_SINGLE("Line-In As Surround", AC97_CM9738_VENDOR_CTRL, 10, 1, 0), AC97_SINGLE("Duplicate Front", AC97_CM9738_VENDOR_CTRL, 13, 1, 0), Index: alsa-kernel/pci/ac97/ac97_patch.h =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_patch.h,v retrieving revision 1.11 diff -u -r1.11 ac97_patch.h --- alsa-kernel/pci/ac97/ac97_patch.h 3 Nov 2003 18:03:53 -0000 1.11 +++ alsa-kernel/pci/ac97/ac97_patch.h 19 Nov 2003 17:34:39 -0000 @@ -46,6 +46,7 @@ int patch_ad1981b(ac97_t * ac97); int patch_ad1985(ac97_t * ac97); int patch_alc650(ac97_t * ac97); +int patch_alc655(ac97_t * ac97); int patch_cm9738(ac97_t * ac97); int patch_cm9739(ac97_t * ac97); int patch_vt1616(ac97_t * ac97); --Multipart_Wed_Nov_19_18:50:28_2003-1-- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/