kernels/linux-2.4.0/drivers/sound/ad1848.c
/*
 *	Experimental initialization sequence for the integrated sound system
 *	of Compaq Deskpro XL.
 */
Experimental initialization sequence for the integrated sound system
of Compaq Deskpro XL.
Experimental initialization sequence for the integrated sound system of Compaq Deskpro XL .
static int init_deskpro(struct address_info *hw_config)
{
	unsigned char   tmp;
	if ((tmp = inb(0xc44)) == 0xff)
	{
		DDB(printk("init_deskpro: Dead port 0xc44\n"));
		return 0;
	}
	outb((tmp | 0x04), 0xc44);	
	if (inb(0xc44) != 0x04)
	{
		DDB(printk("init_deskpro: Invalid bank1 signature in port 0xc44\n"));
		return 0;
	}
#ifdef DEBUGXL
	printk("Port 0xc44 (before): ");
	outb((tmp & ~0x04), 0xc44);
	printk("%02x ", inb(0xc44));
	outb((tmp | 0x04), 0xc44);
	printk("%02x\n", inb(0xc44));
#endif
	tmp = 0x58;		
	switch (hw_config->io_base)
	{
		case 0x530:
			tmp |= 0x00;
			break;
		case 0x604:
			tmp |= 0x01;
			break;
		case 0xf40:
			tmp |= 0x02;
			break;
		case 0xe80:
			tmp |= 0x03;
			break;
		default:
			DDB(printk("init_deskpro: Invalid MSS port %x\n", hw_config->io_base));
			return 0;
	}
	outb((tmp & ~0x04), 0xc44);	
#ifdef DEBUGXL
	printk("Port 0xc44 (after): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc44));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc44));
#endif
#ifdef DEBUGXL
	printk("Port 0xc45 (before): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc45));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc45));
#endif
	outb((tmp & ~0x04), 0xc44);	
	outb((0x88), 0xc45);	
	outb((tmp | 0x04), 0xc44);	
	outb((0x10), 0xc45);	
#ifdef DEBUGXL
	printk("Port 0xc45 (after): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc45));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc45));
#endif
#ifdef DEBUGXL
	printk("Port 0xc46 (before): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc46));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc46));
#endif
	outb((tmp & ~0x04), 0xc44);	
	outb((0x03), 0xc46);	
	outb((tmp | 0x04), 0xc44);	
	outb((0x11), 0xc46);	
#ifdef DEBUGXL
	printk("Port 0xc46 (after): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc46));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc46));
#endif
#ifdef DEBUGXL
	printk("Port 0xc47 (before): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc47));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc47));
#endif
	outb((tmp & ~0x04), 0xc44);	
	outb((0x7c), 0xc47);	
	outb((tmp | 0x04), 0xc44);	
	outb((0x00), 0xc47);	
#ifdef DEBUGXL
	printk("Port 0xc47 (after): ");
	outb((tmp & ~0x04), 0xc44);	
	printk("%02x ", inb(0xc47));
	outb((tmp | 0x04), 0xc44);	
	printk("%02x\n", inb(0xc47));
#endif
#ifdef DEBUGXL
	printk("Port 0xc6f (before) = %02x\n", inb(0xc6f));
#endif
	outb((0x80), 0xc6f);
#ifdef DEBUGXL
	printk("Port 0xc6f (after) = %02x\n", inb(0xc6f));
#endif
	return 1;
}
static int init_deskpro ( struct address_info * hw_config ) { unsigned char tmp ; if ( ( tmp = inb ( 0xc44 ) ) == 0xff ) { DDB ( printk ( " \n " ) ) ; return 0 ; } outb ( ( tmp | 0x04 ) , 0xc44 ) ; if ( inb ( 0xc44 ) != 0x04 ) { DDB ( printk ( " \n " ) ) ; return 0 ; } #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc44 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc44 ) ) ; #endif tmp = 0x58 ; switch ( hw_config -> io_base ) { case 0x530 : tmp |= 0x00 ; break ; case 0x604 : tmp |= 0x01 ; break ; case 0xf40 : tmp |= 0x02 ; break ; case 0xe80 : tmp |= 0x03 ; break ; default : DDB ( printk ( " \n " , hw_config -> io_base ) ) ; return 0 ; } outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc44 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc44 ) ) ; #endif #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc45 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc45 ) ) ; #endif outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; outb ( ( 0x88 ) , 0xc45 ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; outb ( ( 0x10 ) , 0xc45 ) ; #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc45 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc45 ) ) ; #endif #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc46 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc46 ) ) ; #endif outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; outb ( ( 0x03 ) , 0xc46 ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; outb ( ( 0x11 ) , 0xc46 ) ; #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc46 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc46 ) ) ; #endif #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc47 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc47 ) ) ; #endif outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; outb ( ( 0x7c ) , 0xc47 ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; outb ( ( 0x00 ) , 0xc47 ) ; #ifdef DEBUGXL printk ( " " ) ; outb ( ( tmp & ~ 0x04 ) , 0xc44 ) ; printk ( " " , inb ( 0xc47 ) ) ; outb ( ( tmp | 0x04 ) , 0xc44 ) ; printk ( " \n " , inb ( 0xc47 ) ) ; #endif #ifdef DEBUGXL printk ( " \n " , inb ( 0xc6f ) ) ; #endif outb ( ( 0x80 ) , 0xc6f ) ; #ifdef DEBUGXL printk ( " \n " , inb ( 0xc6f ) ) ; #endif return 1 ; }
Experimental initialization sequence for the integrated sound system
      of Compaq Deskpro XL.
Experimental initialization sequence for the integrated sound system of Compaq Deskpro XL .
/* Select bank 1 */ /*
	 * OK. It looks like a Deskpro so let's proceed.
	 */ /*
	 * I/O port 0xc44 Audio configuration register.
	 *
	 * bits 0xc0:   Audio revision bits
	 *              0x00 = Compaq Business Audio
	 *              0x40 = MS Sound System Compatible (reset default)
	 *              0x80 = Reserved
	 *              0xc0 = Reserved
	 * bit 0x20:    No Wait State Enable
	 *              0x00 = Disabled (reset default, DMA mode)
	 *              0x20 = Enabled (programmed I/O mode)
	 * bit 0x10:    MS Sound System Decode Enable
	 *              0x00 = Decoding disabled (reset default)
	 *              0x10 = Decoding enabled
	 * bit 0x08:    FM Synthesis Decode Enable
	 *              0x00 = Decoding Disabled (reset default)
	 *              0x08 = Decoding enabled
	 * bit 0x04     Bank select
	 *              0x00 = Bank 0
	 *              0x04 = Bank 1
	 * bits 0x03    MSS Base address
	 *              0x00 = 0x530 (reset default)
	 *              0x01 = 0x604
	 *              0x02 = 0xf40
	 *              0x03 = 0xe80
	 */ /* Debug printing */ /* Set bank 1 of the register */ /* MSS Mode, MSS&FM decode enabled */ /* Write to bank=0 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /*
	 * I/O port 0xc45 FM Address Decode/MSS ID Register.
	 *
	 * bank=0, bits 0xfe:   FM synthesis Decode Compare bits 7:1 (default=0x88)
	 * bank=0, bit 0x01:    SBIC Power Control Bit
	 *                      0x00 = Powered up
	 *                      0x01 = Powered down
	 * bank=1, bits 0xfc:   MSS ID (default=0x40)
	 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /* Select bank=0 */ /* FM base 7:0 = 0x88 */ /* Select bank=1 */ /* MSS ID = 0x10 (MSS port returns 0x04) */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /*
	 * I/O port 0xc46 FM Address Decode/Address ASIC Revision Register.
	 *
	 * bank=0, bits 0xff:   FM synthesis Decode Compare bits 15:8 (default=0x03)
	 * bank=1, bits 0xff:   Audio addressing ASIC id
	 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /* Select bank=0 */ /* FM base 15:8 = 0x03 */ /* Select bank=1 */ /* ASIC ID = 0x11 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /*
	 * I/O port 0xc47 FM Address Decode Register.
	 *
	 * bank=0, bits 0xff:   Decode enable selection for various FM address bits
	 * bank=1, bits 0xff:   Reserved
	 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /* Select bank=0 */ /* FM decode enable bits = 0x7c */ /* Select bank=1 */ /* Reserved bank1 = 0x00 */ /* Debug printing */ /* Select bank=0 */ /* Select bank=1 */ /*
	 * I/O port 0xc6f = Audio Disable Function Register
	 */