Exemplo n.º 1
0
void attach_sgalaxy( struct address_info *ai )
{
	int n;
	
	request_region( ai->ai_sgbase, 0x10, "SoundGalaxy SB" );
 
	attach_ms_sound( ai );
	n=ai->slots[0];
	
	if (n!=-1 && audio_devs[n]->mixer_dev != -1 )
	{
		AD1848_REROUTE( SOUND_MIXER_LINE1, SOUND_MIXER_LINE );   /* Line-in */
		AD1848_REROUTE( SOUND_MIXER_LINE2, SOUND_MIXER_SYNTH );  /* FM+Wavetable*/
		AD1848_REROUTE( SOUND_MIXER_LINE3, SOUND_MIXER_CD );     /* CD */
	}
}
Exemplo n.º 2
0
static void __init attach_opl3sa2_mss(struct address_info* hw_config)
{
	int initial_mixers;

	initial_mixers = num_mixers;
	attach_ms_sound(hw_config, THIS_MODULE);	/* Slot 0 */
	if(hw_config->slots[0] != -1) {
		/* Did the MSS driver install? */
		if(num_mixers == (initial_mixers + 1)) {
			/* The MSS mixer is installed, reroute mixers appropiately */
			AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_CD);
			AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_SYNTH);
			AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_LINE);
		}
		else {
			printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
		}
	}
}
Exemplo n.º 3
0
static void __init attach_opl3sa2_mss(struct address_info *hw_config)
{
	char mixer_name[64];

	/* Create pretty names for mixer stuff */
	strncpy(mixer_name, chipset_name, 16);
	strncat(mixer_name, " and AD1848 (through MSS)", 64);

	strncpy(opl3sa2_mixer_operations.name, chipset_name, 16);
	strncat(opl3sa2_mixer_operations.name, "-AD1848", 64);

	/* Install master mixer */
	devc->ad_mixer_dev = -1;
	if((opl3sa2_mixer = sound_install_mixer(MIXER_DRIVER_VERSION,
						mixer_name,
						&opl3sa2_mixer_operations,
						sizeof(struct mixer_operations),
						devc)) < 0) 
	{
		printk(KERN_ERR "Could not install %s master mixer\n", chipset_name);
		return;
	}

	opl3sa2_mixer_reset(devc);

	attach_ms_sound(hw_config, THIS_MODULE);	/* Slot 0 */
	if(hw_config->slots[0] != -1)
	{
		/* Did the MSS driver install? */
		if(num_mixers == (opl3sa2_mixer + 2))
		{
			/* The MSS mixer is installed */
			devc->ad_mixer_dev = audio_devs[hw_config->slots[0]]->mixer_dev;

			/* Reroute mixers appropiately */
			AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_CD);
			AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_SYNTH);
			AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_LINE);
		}
	}
}
Exemplo n.º 4
0
Arquivo: trix.c Projeto: 274914765/C
static int __init init_trix_wss(struct address_info *hw_config)
{
    static unsigned char dma_bits[4] = {
        1, 2, 0, 3
    };
    struct resource *ports;
    int config_port = hw_config->io_base + 0;
    int dma1 = hw_config->dma, dma2 = hw_config->dma2;
    int old_num_mixers = num_mixers;
    u8 config, bits;
    int ret;
 
    switch(hw_config->irq) {
    case 7:
        bits = 8;
        break;
    case 9:
        bits = 0x10;
        break;
    case 10:
        bits = 0x18;
        break;
    case 11:
        bits = 0x20;
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad WSS IRQ %d\n", hw_config->irq);
        return 0;
    }

    switch (dma1) {
    case 0:
    case 1:
    case 3:
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad WSS DMA %d\n", dma1);
        return 0;
    }

    switch (dma2) {
    case -1:
    case 0:
    case 1:
    case 3:
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad capture DMA %d\n", dma2);
        return 0;
    }

    /*
     * Check if the IO port returns valid signature. The original MS Sound
     * system returns 0x04 while some cards (AudioTrix Pro for example)
     * return 0x00.
     */
    ports = request_region(hw_config->io_base + 4, 4, "ad1848");
    if (!ports) {
        printk(KERN_ERR "AudioTrix: MSS I/O port conflict (%x)\n", hw_config->io_base);
        return 0;
    }

    if (!request_region(hw_config->io_base, 4, "MSS config")) {
        printk(KERN_ERR "AudioTrix: MSS I/O port conflict (%x)\n", hw_config->io_base);
        release_region(hw_config->io_base + 4, 4);
        return 0;
    }

    if (!trix_set_wss_port(hw_config))
        goto fail;

    config = inb(hw_config->io_base + 3);

    if ((config & 0x3f) != 0x00)
    {
        MDB(printk(KERN_ERR "No MSS signature detected on port 0x%x\n", hw_config->io_base));
        goto fail;
    }

    /*
     * Check that DMA0 is not in use with a 8 bit board.
     */

    if (dma1 == 0 && config & 0x80)
    {
        printk(KERN_ERR "AudioTrix: Can't use DMA0 with a 8 bit card slot\n");
        goto fail;
    }
    if (hw_config->irq > 9 && config & 0x80)
    {
        printk(KERN_ERR "AudioTrix: Can't use IRQ%d with a 8 bit card slot\n", hw_config->irq);
        goto fail;
    }

    ret = ad1848_detect(ports, NULL, hw_config->osp);
    if (!ret)
        goto fail;

    if (joystick==1)
        trix_write(0x15, 0x80);

    /*
     * Set the IRQ and DMA addresses.
     */

    outb((bits | 0x40), config_port);

    if (dma2 == -1 || dma2 == dma1)
    {
          bits |= dma_bits[dma1];
          dma2 = dma1;
    }
    else
    {
        unsigned char tmp;

        tmp = trix_read(0x13) & ~30;
        trix_write(0x13, tmp | 0x80 | (dma1 << 4));

        tmp = trix_read(0x14) & ~30;
        trix_write(0x14, tmp | 0x80 | (dma2 << 4));
    }

    outb((bits), config_port);    /* Write IRQ+DMA setup */

    hw_config->slots[0] = ad1848_init("AudioTrix Pro", ports,
                      hw_config->irq,
                      dma1,
                      dma2,
                      0,
                      hw_config->osp,
                      THIS_MODULE);

    if (num_mixers > old_num_mixers)    /* Mixer got installed */
    {
        AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);    /* Line in */
        AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_CD);
        AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_SYNTH);        /* OPL4 */
        AD1848_REROUTE(SOUND_MIXER_SPEAKER, SOUND_MIXER_ALTPCM);    /* SB */
    }
    return 1;

fail:
    release_region(hw_config->io_base, 4);
    release_region(hw_config->io_base + 4, 4);
    return 0;
}
Exemplo n.º 5
0
static void __init attach_ss_ms_sound(struct address_info *hw_config)
{
	/*
	 * This routine configures the SoundScape card for use with the
	 * Win Sound System driver. The AD1848 codec interface uses the CD-ROM
	 * config registers of the "ODIE".
	 */

	int i, irq_bits = 0xff;

 		
 	if (!sscape_is_pnp)  /*pnp is already setup*/
 	{
 		/*
     		 * Setup the DMA polarity.
 	    	 */
 		sscape_write(devc, GA_DMACFG_REG, 0x50);
 	
 		/*
 		 * Take the gate-array off of the DMA channel.
 		 */
 		sscape_write(devc, GA_DMAB_REG, 0x20);
 	
 		/*
 		 * Init the AD1848 (CD-ROM) config reg.
 		 */
 		for (i = 0; i < sizeof(valid_interrupts); i++)
 		{
 			if (hw_config->irq == valid_interrupts[i])
 			{
 				irq_bits = i;
 				break;
 			}
 		}	
 		sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1));
 	}
 	
 	if (hw_config->irq == devc->irq)
 		printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n");
 				
	hw_config->slots[0] = ad1848_init(
			sscape_is_pnp ? "SoundScape" : "SoundScape PNP",
			hw_config->io_base,
			hw_config->irq,
			hw_config->dma,
			hw_config->dma,
			0,
			devc->osp,
			THIS_MODULE);

 					  
	if (hw_config->slots[0] != -1)	/* The AD1848 driver installed itself */
	{
		audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations;
		devc->codec_audiodev = hw_config->slots[0];
		devc->my_audiodev = hw_config->slots[0];

		/* Set proper routings here (what are they) */
		AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);
	}
		
#ifdef SSCAPE_DEBUG5
	/*
	 * Temporary debugging aid. Print contents of the registers
	 * after the AD1848 device has been initialized.
	 */
	{
		int i;

		for (i = 0; i < 13; i++)
			printk("I%d = %02x\n", i, sscape_read(devc, i));
	}
#endif

}
Exemplo n.º 6
0
static int __init init_ss_ms_sound(struct address_info *hw_config)
{
    int i, irq_bits = 0xff;
    int ad_flags = 0;
    struct resource *ports;

    if (devc->failed)
    {
        printk(KERN_ERR "soundscape: Card not detected\n");
        return 0;
    }
    if (devc->ok == 0)
    {
        printk(KERN_ERR "soundscape: Invalid initialization order.\n");
        return 0;
    }
    for (i = 0; i < 4; i++)
    {
        if (hw_config->irq == valid_interrupts[i])
        {
            irq_bits = i;
            break;
        }
    }
    if (irq_bits == 0xff) {
        printk(KERN_ERR "soundscape: Invalid MSS IRQ%d\n", hw_config->irq);
        return 0;
    }

    if (old_hardware)
        ad_flags = 0x12345677;	/* Tell that we may have a CS4248 chip (Spea-V7 Media FX) */
    else if (sscape_is_pnp)
        ad_flags = 0x87654321;  /* Tell that we have a soundscape pnp with 1845 chip */

    ports = request_region(hw_config->io_base, 4, "ad1848");
    if (!ports) {
        printk(KERN_ERR "soundscape: ports busy\n");
        return 0;
    }

    if (!ad1848_detect(ports, &ad_flags, hw_config->osp)) {
        release_region(hw_config->io_base, 4);
        return 0;
    }

    if (!sscape_is_pnp)  /*pnp is already setup*/
    {
        /*
        	 * Setup the DMA polarity.
        	 */
        sscape_write(devc, GA_DMACFG_REG, 0x50);

        /*
         * Take the gate-array off of the DMA channel.
         */
        sscape_write(devc, GA_DMAB_REG, 0x20);

        /*
         * Init the AD1848 (CD-ROM) config reg.
         */
        sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1));
    }

    if (hw_config->irq == devc->irq)
        printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n");

    hw_config->slots[0] = ad1848_init(
                              sscape_is_pnp ? "SoundScape" : "SoundScape PNP",
                              ports,
                              hw_config->irq,
                              hw_config->dma,
                              hw_config->dma,
                              0,
                              devc->osp,
                              THIS_MODULE);


    if (hw_config->slots[0] != -1)	/* The AD1848 driver installed itself */
    {
        audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations;
        devc->codec_audiodev = hw_config->slots[0];
        devc->my_audiodev = hw_config->slots[0];

        /* Set proper routings here (what are they) */
        AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);
    }

#ifdef SSCAPE_DEBUG5
    /*
     * Temporary debugging aid. Print contents of the registers
     * after the AD1848 device has been initialized.
     */
    {
        int i;

        for (i = 0; i < 13; i++)
            printk("I%d = %02x\n", i, sscape_read(devc, i));
    }
#endif
    return 1;
}