Skip to contentSkip to conversation

More CS4630, secondary CODEC output.

DISCUSSION Benny Sjostrand 4 participants 15 messages Jul 26, 2002 – Aug 2, 2002

lore
Share & tools
lore
#0 lore raw

Hi again!

Seems there's quite big interest in the cs46xx stuff. Finally i've been able to have output from the rear channel on the secondary CODEC. For the moment the output are same on both rear and front channels, but it's possible to create a secondary .WAV device and transfer two independent DMA channels to front and rear, and I believe that I know how to do that, but that will require some more work and some drastic changes in cs46xx_lib.c.

It was not easy to find out how to probe and speak to the secondary CODEC,
it has to be done different with AC97 2.0 and AC97 1.03 codecs, on AC97 1.03
I believe that codec_write && codec_read fucntions cant be the same so for the moment (probably) only cards with AC97 2.0 codecs will work. I've only tested this with "Hercules Game Theater", probably there will be a lot of strange behaviours with other soundcards.

Now the "Game Theater XP" got two CS294 codecs, and now the ALSA mixer got two elements of almost everything, where about a 70% of all controls in the mixer are probably totally meaningless, controlling stuffs that are not conected to CODEC any suggestions about what to do with this ??? It dont not feel necesary to have two Master volumes ...

Heres my new snaphot, you are welcome to test it out:
http://www.cucumelo.org/~gorm/alsa-driver-0.9.0rc2-bs20020727.tar.gz
http://www.cucumelo.org/~gorm/alsa-driver-0.9.0rc2-bs20020727.diff.gz

/Benny

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

#1 lore raw
Quoted 2 lines · On 2002.07.26 16:01 Benny Sjostrand wrote:

Hi again!

[...]

And thanks again! For anybody interested, I have the same patch that
modified to work against CVS. Feel free to ask if you want it. (it's 61k)

And to those with Santa Cruz cards, after my first (quick) test the
rear
channel doesn't seem to work... yet.

Gee, thanks Benny. Just when I was getting used to the dsp_scb layout,
you change it. ;) (though I admit it is a _good_ change)

-- Peter Heatwole
"Murphy was just a well known pessimist."

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

#2 lore raw
Quoted 3 lines

And to those with Santa Cruz cards, after my first (quick) test the
rear
channel doesn't seem to work... yet.

Well, you dont seems to any luck ... no SPDIF, no rear sound -:( Do you know which CODEC's you card have ??, are AC97 2.0 or AC97 1.03

The problem is that the secondary AC97 2.0 CODEC uses:
BA0_ACSDA2, BA0_ACCTL, BA0_ACCAD, BA0_ACCDA, BA0_CSTS2
registers, using BA0_ACCTL reigsters TC bit to address primary or seconary CODEC. But seconary AC97 1.03 uses:
BA0_ACSDA2, BA0_ACCTL2, BA0_ACCAD2, BA0_ACCDA,2 BA0_CSTS2
registers to address the secondary CODEC.
(about what I can understand from the bloody spec. )

The case for 1.03 CODEC's is not implemented for the moment, I got no way to test it.

Quoted 3 lines

Gee, thanks Benny. Just when I was getting used to the dsp_scb layout,
you change it. ;) (though I admit it is a _good_ change)

Well, but I got yet another new problem here. the /proc/asound/card0/dsp_scb entry is to long, and now it's not possible to view all entries, the last entries (SPDIFOSCB, SPDIFISCB and AsyncCODECSCB) are cut of.
Any suggestion about what to do ??

/Benny

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

#3 lore raw
Quoted 7 lines · Benny Sjostrand
Quoted 3 lines

And to those with Santa Cruz cards, after my first (quick) test the
rear
channel doesn't seem to work... yet.

Well, you dont seems to any luck ... no SPDIF, no rear sound -:( Do you know which CODEC's you card have ??, are AC97 2.0 or AC97 1.03

Turtle Beach Santa Cruz boards have:

CS4630-CM DSP,
CS4294-JO codec,
CS4297A-JO codec

the board supports 4 analog inputs + 6 analog outputs (I use it for multi-track recording). One thing that might cause for the driver is that it has one 1/8" jack, the 'versa jack' that combines multiple (selectable) functions:

- analog in (channel 3+4)
- analog out (channel (5+6)
- digital out (spdif+ac3; these are different signals on the tip/ring of the mini jack)

Frank.

Signature · 11 lines
+---- --- -- -  -   -    - 
| Frank van de Pol                  -o)    A-L-S-A
| [email protected]                    /\\  Sounds good!
| http://www.alsa-project.org      _\_v
| Linux - Why use Windows if we have doors available?


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#4 lore raw
Quoted 9 lines · On 2002.07.27 08:13 Frank van de Pol wrote:
Quoted 3 lines

Well, you dont seems to any luck ... no SPDIF, no rear sound -:( Do you know which CODEC's you card have ??, are AC97 2.0 or AC97 1.03

Turtle Beach Santa Cruz boards have:

CS4630-CM DSP,
CS4294-JO codec,
CS4297A-JO codec

Both are AC97 2.0 codecs.

Quoted 5 lines

the board supports 4 analog inputs + 6 analog outputs (I use it for multi-track recording). One thing that might cause for the driver is that it
has one 1/8" jack, the 'versa jack' that combines multiple (selectable) functions:

I have been thinking about this as well. I wrote Turtle Beach
requesting
any kind of documentation on the Santa Cruz, specifically, design docs. Hopefully they will provide some useful information regarding this question as well as "does S/PDIF travel through the CS4297A or is it output directly by the CS4630?". I informed them that the Hercules Game Theater had digital and rear channel support functioning, and that the current driver implementation was incompatible with the Santa Cruz. Hopefully that will spur them to release some useful docs. (I figure I might as well use the leverage while we have it. :)

-- Peter Heatwole
"Murphy was just a well known pessimist."

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

#5 lore raw
In reply to Benny Sjostrand
Quoted 5 lines · On 2002.07.27 00:02 Benny Sjostrand wrote:
Quoted 3 lines

And to those with Santa Cruz cards, after my first (quick) test the
rear
channel doesn't seem to work... yet.

Well, you dont seems to any luck ... no SPDIF, no rear sound -:(

I just recalled something that may help with this problem. Crystal
released a driver that had support for the second codec; that driver worked fine with my Santa Cruz, so we may be able to compare the setup and find the problem.
I'll start looking, but if anybody else wants to help feel free. The
Crystal driver is available at:

ftp1.cirrus.com
username: ftppclink
password: cSPxQMd

It's under the folder "cs46xx-02a-secondcodec". Also, there's another
datasheet available that was previously on that FTP site, but has recently been removed. If anyony would like a copy, you can e-mail me for one. It contains very useful documentation on the CS4630.

-- Peter Heatwole
"Murphy was just a well known pessimist."

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#6 lore raw
In reply to Benny Sjostrand

Hi Benny,

At Sat, 27 Jul 2002 01:01:48 +0200,

Quoted 30 lines · Benny Sjostrand

Hi again!

Seems there's quite big interest in the cs46xx stuff. Finally i've been able to have output from
the rear channel on the secondary CODEC. For the moment the output are same on both
rear and front channels, but it's possible to create a secondary .WAV device and
transfer two independent DMA channels to front and rear, and I believe that I know
how to do that, but that will require some more work and some drastic changes in cs46xx_lib.c.

It was not easy to find out how to probe and speak to the secondary CODEC, it has to be done different with AC97 2.0 and AC97 1.03 codecs, on AC97 1.03 I believe that codec_write && codec_read fucntions cant be the same so for the moment
(probably) only cards with AC97 2.0 codecs will work. I've only tested this with "Hercules Game Theater",
probably there will be a lot of strange behaviours with other soundcards.

Now the "Game Theater XP" got two CS294 codecs, and now the ALSA mixer got two elements
of almost everything, where about a 70% of all controls in the mixer are probably totally meaningless,
controlling stuffs that are not conected to CODEC any suggestions about what to do with this ???
It dont not feel necesary to have two Master volumes ...

Quoted 3 lines

Heres my new snaphot, you are welcome to test it out:
http://www.cucumelo.org/~gorm/alsa-driver-0.9.0rc2-bs20020727.tar.gz
http://www.cucumelo.org/~gorm/alsa-driver-0.9.0rc2-bs20020727.diff.gz

I merged your codes into the cvs.
The codes are almost identical except for small bugfixes, re-indentation, and replacement of debug printing.

To be sure, the old dsp image is still chosen unless CONFIG_SND_CS46XX_NEW_DSP is set to yes.
For compiling the new dsp image, please remove the comments in alsa-driver/pci/cs46xx/Makefile.

The driver seems working on TerraTec DMX XFire. The status is:
- OK: The first codec
- OK: SPDIF playback (audio)
- NG: SPDIF AC3 (non-audio)
- NG: The secondary codec, not detected.

Anyway, thanks for your work!

Please send patches againt cvs if you modify the driver more, so that I can commit it soon.

ciao,

Takashi

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

#7 lore raw
Quoted 7 lines

I merged your codes into the cvs.
The codes are almost identical except for small bugfixes, re-indentation, and replacement of debug printing.

-:)

Quoted 6 lines

To be sure, the old dsp image is still chosen unless CONFIG_SND_CS46XX_NEW_DSP is set to yes.
For compiling the new dsp image, please remove the comments in alsa-driver/pci/cs46xx/Makefile.

With the new PCM multi channel support, I believe there no way to have the support for the old image, to many changes in cs46xx_lib.c now hardly depends on the new stuff.
So if we want to still support the old code i think the only way is to create a new directory alsa-driver/pci/cs46xx_old/_new, having to independent cs46xx drivers.
But I hope that in some near future we can discard the old cs46xx. Of course that we must be sure it work at least so good as before with all known CS46xx soundcards before discarding anything.

Quoted 3 lines

Please send patches againt cvs if you modify the driver more, so that I can commit it soon.

Well, i got some more work to do. I will try fixup my new code changes so it follows the coding-style used by ALSA, and then become mergable with current CVS. (and you dont have to do all thoose indentation fixes again)

Regards

/Benny

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

#8 lore raw

At Thu, 01 Aug 2002 11:39:37 +0200,

Quoted 11 lines · Benny Sjostrand
Quoted 8 lines

I merged your codes into the cvs.
The codes are almost identical except for small bugfixes, re-indentation, and replacement of debug printing.

-:)

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

To be sure, the old dsp image is still chosen unless CONFIG_SND_CS46XX_NEW_DSP is set to yes.
For compiling the new dsp image, please remove the comments in alsa-driver/pci/cs46xx/Makefile.

With the new PCM multi channel support, I believe there no way to have the support for the old image, to many changes in cs46xx_lib.c now hardly depends on the new stuff.

yep, looks so...

Quoted 4 lines

So if we want to still support the old code i think the only way is to create
a new directory alsa-driver/pci/cs46xx_old/_new, having to independent cs46xx drivers.

i'm now merging the new stuff. let's see what happens.

Quoted 3 lines

But I hope that in some near future we can discard the old cs46xx. Of course that we must be sure it work at least so good as before with all known CS46xx soundcards before discarding anything.

yes. if the new driver is confirmed to work on most of machines (cs46xx is used on many notebooks), then we can obsolete it.

Quoted 8 lines
Quoted 4 lines

Please send patches againt cvs if you modify the driver more, so that I can commit it soon.

Well, i got some more work to do. I will try fixup my new code changes so it follows
the coding-style used by ALSA, and then become mergable with current CVS. (and you dont have to do all thoose indentation fixes again)

the coding-style of ALSA is not particular except for its naming rule. we followed the standard kernel coding style.

as said, i'm now managing to merge the 0731 stuff. just a moment...

ciao,

Takashi

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

#9 lore raw

At Thu, 01 Aug 2002 12:57:23 +0200,

Quoted 7 lines · I wrote:
Quoted 5 lines

So if we want to still support the old code i think the only way is to create
a new directory alsa-driver/pci/cs46xx_old/_new, having to independent cs46xx drivers.

i'm now merging the new stuff. let's see what happens.

finished. now committed to cvs.

the old driver is still integrated into the same source. the number of ifdefs increased, so more clean-up's will be necessary, though.

about the secondary codec on terratec xfire: it's still not detected. could you test the latest cvs driver? i'm afraid that i did something wrong in merging...

ciao,

Takashi

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

#10 lore raw
Quoted 8 lines

about the secondary codec on terratec xfire: it's still not detected. could you test the latest cvs driver? i'm afraid that i did something wrong in merging...

My quick look on the cvsweb everything looks just fine, just one small critical
fix that I missed in my 0731 release, I believe that's easy commited to CVS (see my notice about this earlier today) in _dsp_unlink_scb() function:

dsp_spos_scb_lib.c Thu Aug 1 07:25:14 2002 renamed from home/pub/src/alsa-driver-0.9.0rc2-bs20020731/alsa-kernel/pci/cs46xx/dsp_spos_scb_lib.c Wed Jul 31 23:19:19 2002 +6 -0
@@ -148,6 +148,12 @@
      spin_lock_irqsave(&chip->reg_lock, flags);    
   /* update entry in DSP RAM */
   snd_cs46xx_poke(chip,
+                    (scb->address + SCBsubListPtr) << 2,
+                    (scb->sub_list_ptr->address << 0x10) |
+                    (scb->next_scb_ptr->address));
+
+    /* update parent entry in DSP RAM */
+    snd_cs46xx_poke(chip,
                   (scb->parent_scb_ptr->address + SCBsubListPtr) << 2,
                   (scb->parent_scb_ptr->sub_list_ptr->address << 0x10) |
                   (scb->parent_scb_ptr->next_scb_ptr->address));

As soon I can I will test the CVS release, I'll comeback with feedback. Any change from now
will be based on the CVS.
About the secondary CODEC, 1.03 codecs are not supported with the current code, read, and write fucntions
needs to be slightly different for 1.03 codecs. I believe there are very few cards shipped with 1.03 codecs, dont know the case
with terratec.
All differents boards always are shipped with some dam GPIO controls which you never knows where they are wired, which never are documented, if the terratec board is shipped with 2.0 codecs and it's not detected I believe it's some magic GPIO pin that we need to turn on.

/Benny

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

#11 lore raw
In reply to Takashi Iwai
Quoted 7 lines

about the secondary codec on terratec xfire: it's still not detected. could you test the latest cvs driver? i'm afraid that i did something wrong in merging...

I've done a quick test with the CVS code now, and it seems to work just fine, i just got some newbie questions, how do activate CONFIG_SND_CS46XX without modifying the Makefile?, how do I activate the snd_printd ? , (without modifying config.h)

About the secondary codec on the terratex xfire card, can we try to trace exactly where it failed to detect it, I would like to know.

On the "Turtle Beach Santa Cruz" now i know that GPIO7/GPIO8 on sec. codec controls back speakers, that's not done yet, But I would like to know if current code at least detects the secondary CODEC successfully. In theory it should.

I would like to build a list with card and of DSP and codec (only cs46xx cards), please helpme to complete this list.

Hercules Game Theater XP
dsp: cs4630
primary codec: cs4294
secondary codec: cs4294
EPGIO2 controls ext. amplifier

Turtle Beach Santa Cruz
dsp: cs4630
primary codec: cs4294
secondary codec: cs4297A
GPIO7/GPIO8 on secondary codec controls back speakers support

Terratec XFIRE:

dsp: cs4630
primary codec:  ????
secondary codec:  ????

????

....

A small fix to cs46xx_lib.c, it does not make any sense calling playback_transfer before the PCMreader is linked or Playback controll register set to 0. && I would like to update the TODO text to something else.

pci/cs46xx/cs46xx_lib.c Fri Aug 2 07:22:34 2002 renamed from ../cvs_ref/alsa-kernel/pci/cs46xx/cs46xx_lib.c Thu Aug 1 14:30:52 2002 +4 -4
@@ -8,11 +8,11 @@
 *    --
 *
 *  TODO:
- *    We need a DSP code to support multichannel outputs and S/PDIF.
- *    Unfortunately, it seems that Cirrus Logic, Inc. is not willing
- *    to provide us sufficient information about the DSP processor,
- *    so we can't update the driver.
+ *    SPDIF input.
+ *    Secondary CODEC on some soundcards
 *
+ *  NOTE: with CONFIG_SND_CS46XX_NEW_DSP unset uses old DSP image (which is default
+ *   configuration), no SPDIF, no secondary codec, no multi channel PCM. But known to work.
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
@@ -334,7 +334,6 @@
 

#ifdef CONFIG_SND_CS46XX_NEW_DSP

-// #include "imgs/cwcemb80.h"
#include "imgs/cwc4630.h"
#include "imgs/cwcasync.h"
#include "imgs/cwcsnoop.h"
@@ -880,8 +879,6 @@

    switch (cmd) {
    case SNDRV_PCM_TRIGGER_START:
    case SNDRV_PCM_TRIGGER_RESUME:
-        if (substream->runtime->periods != CS46XX_FRAGS)
-            snd_cs46xx_playback_transfer(substream, 0);
#ifdef CONFIG_SND_CS46XX_NEW_DSP
        if (cpcm->pcm_channel->unlinked)
            cs46xx_dsp_pcm_link(chip,cpcm->pcm_channel);
@@ -892,6 +889,8 @@
        snd_cs46xx_poke(chip, BA1_PCTL, chip->play_ctl | tmp);
        }
#endif
+        if (substream->runtime->periods != CS46XX_FRAGS)
+           snd_cs46xx_playback_transfer(substream, 0);
        break;
    case SNDRV_PCM_TRIGGER_STOP:
    case SNDRV_PCM_TRIGGER_SUSPEND:

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

#12 lore raw

At Fri, 02 Aug 2002 07:51:27 +0200,

Quoted 9 lines · Benny Sjostrand
Quoted 8 lines

about the secondary codec on terratec xfire: it's still not detected. could you test the latest cvs driver? i'm afraid that i did something wrong in merging...

Quoted 5 lines

I've done a quick test with the CVS code now, and it seems to work just fine, i just got some newbie
questions, how do activate CONFIG_SND_CS46XX without modifying the Makefile?, how do
I activate the snd_printd ? , (without modifying config.h)

if you build the modules from alsa-driver (i.e. not on 2.5 kernel), then CONFIG_SND_CS46XX is set in the configure script. as default, all card modules are compiled, or selectable via --with-cards option.

but the CONFIG_SND_CS46XX_NEW_DSP variable is not set in configure script. you have to modify it in alsa-driver/pci/cs46xx/Makefile. you'll see the two lines which are currently commented out. if this is extremely annoying, i will enable it as default, but i don't think it's too much job :)

abound snd_printd() and snd_printdd().
the former is activated when --with-debug=full option is given to the configure script. and the latter is on when --with-debug=detect. the latter option enables all debug information.

Quoted 9 lines

About the secondary codec on the terratex xfire card, can we try to trace exactly where it failed
to detect it, I would like to know.

On the "Turtle Beach Santa Cruz" now i know that GPIO7/GPIO8 on sec. codec controls back speakers, that's not done yet,
But I would like to know if current code at least detects the secondary CODEC successfully. In theory it should.

perhaps X-Fire has also some gpio's. i'll try to contact with TerraTec about this info.

Terratec X-Fire:

dsp: cs4630
primary codec:  CS4294 rev 5
secondary codec:  not sure.. the driver shows 'not present'

i will take a look at the card later

Quoted 4 lines

A small fix to cs46xx_lib.c, it does not make any sense calling playback_transfer before the PCMreader is linked or Playback controll register set to 0. && I would like to update the TODO text to something else.

ok. will be fixed soon.

ciao,

Takashi

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

#13 lore raw
In reply to Benny Sjostrand
Quoted 2 lines · On 2002.08.01 22:51 Benny Sjostrand wrote:

On the "Turtle Beach Santa Cruz" now i know that GPIO7/GPIO8 on sec. codec controls back speakers, that's not done yet, But I would like to know if current code at least detects the secondary CODEC successfully. In theory it should.

[...]

Quoted 5 lines

Turtle Beach Santa Cruz
dsp: cs4630
primary codec: cs4294
secondary codec: cs4297A
GPIO7/GPIO8 on secondary codec controls back speakers support

Actually, the codecs are reversed. The CS4297A is the primary codec,
and
the CS4294 is the secondary. And yes, your driver detects them both just fine and I can manipulate both with alsamixer and confirm the changes to the CS4294 with the changes in the "ac97#0-1regs" file in /proc/asound/card0.

-- Peter Heatwole
"Murphy was just a well known pessimist."

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

#14 lore raw
Quoted 6 lines

Actually, the codecs are reversed. The CS4297A is the primary
codec, and
the CS4294 is the secondary. And yes, your driver detects them both just fine and I can manipulate both with alsamixer and confirm the changes to the CS4294 with the changes in the "ac97#0-1regs" file in /proc/asound/card0.

Hopefully then the only thing left is too activate the GPIO pins, i'll try to write some code doing this, we will se if it works ...

/Benny

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