Skip to contentSkip to conversation

VIA 8233A

DISCUSSION p z oooo 4 participants 9 messages Feb 10, 2003 – Feb 25, 2003 Kbuild

lore
Share & tools
lore

p z oooo

author
#0 lore raw

Hi,

There is bug in via82xx.c. VIA8233A is wrongly detected as VIA8233 and then not working.

in function snd_via82xx_probe is this

case TYPE_CARD_VIA8233:

		chip_type = TYPE_VIA8233;
		sprintf(card->shortname, "VIA 823x rev%d", revision);
		for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
			if (revision == via823x_cards[i].revision) {
				chip_type = via823x_cards[i].type;
				strcpy(card->shortname, via823x_cards
[i].name);
				break;
			}
		}
		if (chip_type == VIA_REV_8233A)
			strcpy(card->driver, "VIA8233A");
		else
			strcpy(card->driver, "VIA8233");
		break;
	default:
		snd_printk(KERN_ERR "invalid card type %d\n", 
card_type);
		err = -EINVAL;
		goto __error;
	}
		
	if ((err = snd_via82xx_create(card, pci, chip_type, revision, 
ac97_clock[dev], &chip)) < 0)
		goto __error;

	if ((err = snd_via82xx_mixer_new(chip)) < 0)
		goto __error;

	if (chip_type == TYPE_VIA686) {
		if ((err = snd_via686_pcm_new(chip)) < 0 ||
		    (err = snd_via686_init_misc(chip, dev)) < 0)
			goto __error;
	} else {
		if (chip_type == VIA_REV_8233A) {
			if ((err = snd_via8233a_pcm_new(chip)) < 0)
				goto __error;
		} else {
			if ((err = snd_via8233_pcm_new(chip)) < 0)
				goto __error;
		}
		if ((err = snd_via8233_init_misc(chip, dev)) < 0)
			goto __error;
	} 

But chip_type is compared to VIA_REV_8233A, but must be comparet to TYPE_VIA8233A.

When I changed VIA_REV_8233A to TYPE_VIA8233A my onboard soundcard (VIA8233A + ALC650) works (2 channel, 4 cannel).

5.1 has problem - swaped channels. (LF, RF, Center - OK, LS - Woofer, RS - LS, Woofer - RS.

Peter Zubaj

====================== REKLAMA ================================= Vyrazne zlavy pocitacov a prislusenstva
Toshiba Pocket PC e740 v cench u? od 24.300,- Sk bez DPH Navstivte nas na adrese http://www.somi.sk/akcie.php
================================================================

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld =Something 2 See!
http://www.vasoftware.com

#1 lore raw

Re: VIA 8233A - Patch included

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · p z oooo

There is bug in via82xx.c. VIA8233A is wrongly detected as VIA8233 and then not working.

You're the man! You've found the bug I've been cursing for days now.

Takashi, I've attached a patch for you. Now the sound works like a charm again! :)

- --
Regards,
Tais M. Hansen
OSD

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iQIVAwUBPkdhJIIvLOJqwYc4AQJqARAAosj0rw3+qHGPuRCuHeI9nE1ktNNrCZcY Dq4bpUKB7fyttuocKeT8cAJdeArE7B7/NJ+uW9FpAsUPH1KP0qwTmRJHww0EHOuq mW2A1QIwvjl/csoCYRlSHrRStq2a2to/Igv7IxKJOTE7hz+L+iiV+7NLaCogFywT Mi3Fr6VNkkInqCm2vPdIsOiTUrwS9630l7KqXshmd8bqx193ZS3rgFQgGb327IBj xrF50b0GqrIGU+UwGN50mmgrcHwfFWfh+8r6os59dFvslzQeh3+QY3Xhungm1emR SfLMNtU0AvZmQNDF8t9b5B5UERHXFjO3yS0lsTptVd5CxXko11ShehqAqYBuIUuF f83habq4Sy6Mv65QuaTGLwDNwieycI1RFSbwEgii1CNwcHlEVUb9v9XP1Yhz+U1P rQQRKPp7rlxsNWF5VYdIBUIJlCny2UWYQOrPdVDzrfi5wfvGPWztCGU920YtQwrK ohZ3Hb8x+sDMP4MZmJaydwCQoTu5h5wmsYhTKP6jyQPw6vgb7Z7pmrLzLa51og8k vpKOl0kNA9GbbsN+gv78Ie3hLEW4hDPV20NQa+lh8CFga05namp1GAdHvJA0QOY+ 9m2k+rLZMwIjQF74BZLmXu6i+txWPwrjRVK8akV/2CY2+lC9dABz/unoDlRo1v/m Wq34yrsQRQ4=
=vWEn
-----END PGP SIGNATURE-----

Index: via82xx.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/via82xx.c,v retrieving revision 1.24

via82xx.c +2 -2
diff -u -4 -p -r1.24 via82xx.c
@@ -1861,9 +1861,9 @@ static int __devinit snd_via82xx_probe(s
 				strcpy(card->shortname, via823x_cards[i].name);
 				break;
 			}
 		}
-		if (chip_type == VIA_REV_8233A)
+		if (chip_type == TYPE_VIA8233A)
 			strcpy(card->driver, "VIA8233A");
 		else
 			strcpy(card->driver, "VIA8233");
 		break;
@@ -1883,9 +1883,9 @@ static int __devinit snd_via82xx_probe(s
 		if ((err = snd_via686_pcm_new(chip)) < 0 ||
 		    (err = snd_via686_init_misc(chip, dev)) < 0)
 			goto __error;
 	} else {
-		if (chip_type == VIA_REV_8233A) {
+		if (chip_type == TYPE_VIA8233A) {
 			if ((err = snd_via8233a_pcm_new(chip)) < 0)
 				goto __error;
 		} else {
 			if ((err = snd_via8233_pcm_new(chip)) < 0)
#2 lore raw
In reply to p z oooo

At Mon, 10 Feb 2003 07:21:47 +0100,

Quoted 5 lines · p z oooo

Hi,

There is bug in via82xx.c. VIA8233A is wrongly detected as VIA8233 and then not working.

...

Quoted 2 lines

But chip_type is compared to VIA_REV_8233A, but must be comparet to TYPE_VIA8233A.

ouch, my bad. thanks for spotting this out!
fixed on cvs now.

Quoted 5 lines

When I changed VIA_REV_8233A to TYPE_VIA8233A my onboard soundcard (VIA8233A + ALC650) works (2 channel, 4 cannel).

5.1 has problem - swaped channels. (LF, RF, Center - OK, LS - Woofer, RS - LS, Woofer - RS.

which program are you using?

please check the ac97 register 0x6a in /proc/asound/card0/ac97#0regs and whether the bits 30-31 (zero-based) are off.

Takashi

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

#3 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

Dear Takashi Iwai,

Quoted 5 lines · you
Quoted 5 lines

When I changed VIA_REV_8233A to TYPE_VIA8233A my onboard soundcard (VIA8233A + ALC650) works (2 channel, 4 cannel).

5.1 has problem - swaped channels. (LF, RF, Center - OK, LS - Woofer, RS - LS, Woofer - RS.

TI> which program are you using?

TI> please check the ac97 register 0x6a in /proc/asound/card0/ac97#0regs TI> and whether the bits 30-31 (zero-based) are off.

Do you mean bit 14-15 ?

As i posted before, i have similar channel swapping with VIA8235 + ALC650. If bits 14-15 (slot modify) set to 0 - channels has incorrect placement. It can be fixed by exchanging Rear and Center/LFE jacks.
When i set bit 14 to 1 - OK
Surely via8235 transmit multi-channel data in AC-Link in 3,4,6,9,7,8 order, instead of 3,4,7,8,6,9 as specified in AC97.
I switch codec to 3,4,6,9,7,8 mode by setting bit 14 with following patch in attachment for ac97_patch.c.

Other option is to apply may old patch to via82xx.c like this:

812,813c812,815

<       case 5: slots = (1<<0) | (2<<4) | (5<<8) | (3<<12) | (4<<16); break;
<       case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); break;

---

Quoted 4 lines
//    case 5: slots = (1<<0) | (2<<4) | (5<<8) | (3<<12) | (4<<16); break;
//    case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); 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;

We can't do this if there are any positive reports for 5.1 playback on via82xx.

May be better to create a new ALC650 specific mixer switch for bit 14 of 0x6a register ? By this way we can solve all such future problems too.

Please commit one of this solutions to cvs.

Sincerely yours

Anton Worshevsky

usr/src/alsa/alsa-20030210/alsa-kernel/pci/ac97/ac97_patch.c renamed from usr/src/alsa/ac97_patch.c +2 -1
@@ -365,7 +365,8 @@
 		ac97->ext_id &= ~AC97_EI_SPDIF; /* disable extended-id */
 
 	val = snd_ac97_read(ac97, AC97_ALC650_MULTICH);
-	val &= ~0xc000; /* slot: 3,4,7,8,6,9 */
+	// val &= ~0xc000; /* slot: 3,4,7,8,6,9 */
+	val |= 0x4000; /* slot: 3,4,6,9,7,8 */
 	snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, val | 0x03);
 
 	/* full DAC volume */
#4 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

At Tue, 18 Feb 2003 07:43:26 +0300,

Quoted 11 lines · Anton Worshevsky

Dear Takashi Iwai,

Quoted 5 lines · you
Quoted 5 lines

When I changed VIA_REV_8233A to TYPE_VIA8233A my onboard soundcard (VIA8233A + ALC650) works (2 channel, 4 cannel).

5.1 has problem - swaped channels. (LF, RF, Center - OK, LS - Woofer, RS - LS, Woofer - RS.

Quoted 6 lines

TI> which program are you using?

TI> please check the ac97 register 0x6a in /proc/asound/card0/ac97#0regs TI> and whether the bits 30-31 (zero-based) are off.

Do you mean bit 14-15 ?

yep :)

Quoted 8 lines

As i posted before, i have similar channel swapping with VIA8235 + ALC650. If bits 14-15 (slot modify) set to 0 - channels has incorrect placement. It can be fixed by exchanging Rear and Center/LFE jacks.
When i set bit 14 to 1 - OK
Surely via8235 transmit multi-channel data in AC-Link in 3,4,6,9,7,8 order, instead of 3,4,7,8,6,9 as specified in AC97.
I switch codec to 3,4,6,9,7,8 mode by setting bit 14 with following patch in attachment for ac97_patch.c.

well, then your investigation may be correct. i have also no datasheet regarding this.
i'll ask VIA guys whether the correct order is 3/4/6/9/7/8 or 3/4/7/8/6/9.

ciao,

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#5 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

Dear Takashi Iwai,

Tuesday, February 18, 2003, 8:03:56 PM, you wrote:

TI> At Tue, 18 Feb 2003 07:43:26 +0300,

Quoted 6 lines · TI> Anton Worshevsky wrote:
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

When I changed VIA_REV_8233A to TYPE_VIA8233A my onboard soundcard (VIA8233A + ALC650) works (2 channel, 4 cannel).
5.1 has problem - swaped channels. (LF, RF, Center - OK, LS - Woofer, RS - LS, Woofer - RS.

Quoted 8 lines
Quoted 8 lines

As i posted before, i have similar channel swapping with VIA8235 + ALC650. If bits 14-15 (slot modify) set to 0 - channels has incorrect placement. It can be fixed by exchanging Rear and Center/LFE jacks.
When i set bit 14 to 1 - OK
Surely via8235 transmit multi-channel data in AC-Link in 3,4,6,9,7,8 order, instead of 3,4,7,8,6,9 as specified in AC97.
I switch codec to 3,4,6,9,7,8 mode by setting bit 14 with following patch in attachment for ac97_patch.c.

TI> well, then your investigation may be correct. i have also no TI> datasheet regarding this.
TI> i'll ask VIA guys whether the correct order is 3/4/6/9/7/8 or TI> 3/4/7/8/6/9.

There are following slot assignments accordantly AC97 spec. v2.2 and v.2.3 LF/RF/LR/RR/C/LFE -- 3/4/7/8/6/9

In this ALC650 data sheet
http://www.realtek.com.tw/downloads/downloads1-3.aspx?refdesign=True&compamodel=ALC650
there are next:
LF/RF/LR/RR/C/LFE -- 3/4/7/8/6/9 if 0x6a.14=0 (default) LF/RF/LR/RR/C/LFE -- 3/4/6/9/7/8 if 0x6a.14=1

As i see on VIA website, there is no via82xx spec freely available. I don't understand their position in this question.

Now i made tests with last cvs for 4 channel too :
VIA8235 + ALC650
0x6a.14=0 : 4ch - OK; 5.1 - swaped 0x6a.14=1 : 4ch - swaped; 5.1 - OK

As you see - setting bit 14 of 0x6a reg is not an option.

We need to apply following patch again. =)

@@ -919,8 +920,8 @@

        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) | (5<<8) | (3<<12) | (4<<16); break;
-       case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); 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;
        default: slots = 0; break;
        }
        /* STOP index is never reached */

All working fine with this for VIA8235 + ALC650 It does not affect on VIA8233A as you remembered. =) What chip combination is working wrong with this ? It's much better solution for via8235, than

if (runtime->channels > 4)

    val = 0x4000;
else
    val = 0;

snd_ac97_update_bits(chip->ac97, AC97_ALC650_MULTICH, 0xc000, val);

Sincerely yours

Anton Worshevsky

-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge

#6 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

At Thu, 20 Feb 2003 05:51:01 +0300,

Quoted 11 lines · Anton Worshevsky

Now i made tests with last cvs for 4 channel too :
VIA8235 + ALC650
0x6a.14=0 : 4ch - OK; 5.1 - swaped 0x6a.14=1 : 4ch - swaped; 5.1 - OK

As you see - setting bit 14 of 0x6a reg is not an option.

We need to apply following patch again. =)

Review line 927

Quoted 10 lines
(quoted diff) +2 -2
@@ -919,8 +920,8 @@
        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) | (5<<8) | (3<<12) | (4<<16); break;
-       case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); 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;
        default: slots = 0; break;
        }
        /* STOP index is never reached */

ok. i'll take the change back again.

Quoted 3 lines

All working fine with this for VIA8235 + ALC650 It does not affect on VIA8233A as you remembered. =) What chip combination is working wrong with this ?

no idea. i hope both via8233 and 8233c follow to the same rule.

thanks,

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge

#7 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

Dear Takashi Iwai,

Quoted 9 lines · you
Quoted 9 lines

Now i made tests with last cvs for 4 channel too :
VIA8235 + ALC650
0x6a.14=0 : 4ch - OK; 5.1 - swaped 0x6a.14=1 : 4ch - swaped; 5.1 - OK

As you see - setting bit 14 of 0x6a reg is not an option.

We need to apply following patch again. =)

Quoted 11 lines

Review line 927

Quoted 11 lines
(quoted diff) +2 -2
@@ -919,8 +920,8 @@
        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) | (5<<8) | (3<<12) | (4<<16); break;
-       case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); 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;
        default: slots = 0; break;
        }
        /* STOP index is never reached */

TI> ok. i'll take the change back again.

Playback in alsa applications now is GOOD. =) simultaneous multiple streams - OK
5.1ch - OK
Only in some games working with oss-emulation sound is still bad (tux-racer, ut, heroes3)

Quoted 3 lines
Quoted 3 lines

All working fine with this for VIA8235 + ALC650 It does not affect on VIA8233A as you remembered. =) What chip combination is working wrong with this ?

TI> no idea. i hope both via8233 and 8233c follow to the same rule.

I suggest to add ALC650 specific control for 0x6a.14 "Slot Modify" (see my patch). I think this will make a life of future testers a little bit easy. There is also small fix (i think) for ac97_patch.c in my patch.

I found that "Exchange Center/LFE" is not working on my hardware. After changing bit 0x6a.3 by snd_ac97_write_cache() it still has 0 value. All other controls for 0x6a register works fine
( "Duplicate Front", "Mic As Center/LFE", "Line-In As Surround", "Center/LFE Down Mix", "Surround Down Mix" and my new "Slot Modify" ). I think that bit 0x6a.3 can not be set on my combination of hardware. Is it possible ? Or just another software bug ?

Sincerely yours

Anton Worshevsky

alsa-kernel/pci/ac97/ac97_codec.c +1 -0
diff -u -r control-build/alsa-kernel/pci/ac97/ac97_codec.c alsa-20030223/alsa-kernel/pci/ac97/ac97_codec.c
@@ -1081,6 +1081,7 @@
 	/* 8: reserved */
 	AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0),
 	AC97_SINGLE("Mic As Center/LFE", AC97_ALC650_MULTICH, 10, 1, 0),
+	AC97_SINGLE("Slot Modify", 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),
 	AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0),
alsa-kernel/pci/ac97/ac97_patch.c +1 -1
diff -u -r control-build/alsa-kernel/pci/ac97/ac97_patch.c alsa-20030223/alsa-kernel/pci/ac97/ac97_patch.c
@@ -366,7 +366,7 @@
 
 	val = snd_ac97_read(ac97, AC97_ALC650_MULTICH);
 	val &= ~0xc000; /* slot: 3,4,7,8,6,9 */
-	snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, val | 0x03);
+	snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, val);
 
 	/* full DAC volume */
 	snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
#8 lore raw

Re: VIA 8233A, 8235 with ALC650 codec

At Mon, 24 Feb 2003 00:50:27 +0300,

Quoted 10 lines · Anton Worshevsky
Quoted 4 lines
Quoted 4 lines

All working fine with this for VIA8235 + ALC650 It does not affect on VIA8233A as you remembered. =) What chip combination is working wrong with this ?

TI> no idea. i hope both via8233 and 8233c follow to the same rule.

I suggest to add ALC650 specific control for 0x6a.14 "Slot Modify" (see my patch). I think this will make a life of future testers a little bit easy. There is also small fix (i think) for ac97_patch.c in my patch.

that would be nice. applied a similar patch to the cvs.

Quoted 7 lines

I found that "Exchange Center/LFE" is not working on my hardware. After changing bit 0x6a.3 by snd_ac97_write_cache() it still has 0 value. All other controls for 0x6a register works fine
( "Duplicate Front", "Mic As Center/LFE", "Line-In As Surround", "Center/LFE Down Mix", "Surround Down Mix" and my new "Slot Modify" ). I think that bit 0x6a.3 can not be set on my combination of hardware. Is it possible ? Or just another software bug ?

i believe it's a hardware bug (or feature).

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf