I think i've found something interesting.

I downloaded de nvaudio driver from Nvidia's site and read the source a bit.
I found this function:

void __start_dac(struct Nvaudio_state *state)
{
    int i =0;
    unsigned int i_glob_cnt = 0;
    struct Nvaudio_card *card = state->card;
    struct dmabuf *dmabuf = &state->dmabuffer;

    if (dmabuf->count > 0 && state->ready && !state->enable &&
        (state->trigger & PCM_ENABLE_OUTPUT)) {

----------------------------------------------------------------------
        /* Reset the Global Cnt back to Stereo 16ch and set the format 
           This is needed to keep the 6 channel data in alignment ,
           to start from Front Left always */
        i_glob_cnt = inl(card->iobase + GLOB_CNT);
        outl((i_glob_cnt & 0xcfffff),card->iobase + GLOB_CNT);
        mdelay(50);
        outl(i_glob_cnt,card->iobase + GLOB_CNT);
----------------------------------------------------------------------
        /* Reset the leftover datainfo*/
        for(i=0; i < 5 ; i++)
            AnalogLeftovers[i] = 0;
        AnalogLeftoverCount = 0;

        state->enable = DAC_RUNNING;

        /* Interrupt Enable, LVI Enable, DMA Enable*/
        outb((0x10|0x04|0x01), state->card->iobase + PO_CR);

#ifdef NV_DEBUG_PLAY
        printk("Starting DAC \n");
#endif
    }
}

I translated the part that I thought interesting to the function
"snd_intel8x0_setup_multi_channels" in the file intel8x0.c of Alsa (Line
923)

I have added this to the function

        case DEVICE_NFORCE:
                cnt = igetdword(chip, ICHREG(GLOB_CNT));
                cnt &= ~ICH_PCM_246_MASK;
                if (chip->multi4 && channels == 4)
                        cnt |= ICH_PCM_4;
                else if (chip->multi6 && channels == 6)
                        cnt |= ICH_PCM_6;
                iputdword(chip, ICHREG(GLOB_CNT), (cnt & 0xcfffff));
                mdelay(50);
                iputdword(chip, ICHREG(GLOB_CNT), cnt);
                break;

Now speaker_test works well for me and the sound is coming from the right
speaker all the time. But there are some problems.
With mplayer in oss emulation the sound is very choppy and with
alsa9:surround51 there are constant cracks and pops.
If I play a DVD with xine with alsa:surround51 the sound seems correct and I
don't hear cracks. Maybe mplayer has some problems with alsa 1.0.x

I hope it's useful.

Attachment: signature.asc
Description: Digital signature

Reply via email to