, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) },
	{}
};

MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);

static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long timeout)
{
	unsigned int tmp;
	do {
		tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
		if (!(tmp & CMD_NEW))
			break;
		udelay(1);
	} while (--timeout);
	if (!timeout)
		dev_err(cs5535au->card->dev,
			"Failure writing to cs5535 codec\n");
}

static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
						 unsigned short reg)
{
	unsigned int regdata;
	unsigned int timeout;
	unsigned int val;

	regdata = ((unsigned int) reg) << 24;
	regdata |= ACC_CODEC_CNTL_RD_CMD;
	regdata |= CMD_NEW;

	cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
	wait_till_cmd_acked(cs5535au, 50);

	timeout = 50;
	do {
		val = cs_readl(cs5535au, ACC_CODEC_STATUS);
		if ((val & STS_NEW) && reg == (val >> 24))
			break;
		udelay(1);
	} while (--timeout);
	if (!timeout)
		dev_err(cs5535au->card->dev,
			"Failure reading codec reg 0x%x, Last value=0x%x\n",
			reg, val);

	return (unsigned short) val;
}

static void snd_cs5535audio_codec_write(struct cs5535audio *cs5535au,
					unsigned short reg, unsigned short val)
{
	unsigned int regdata;


, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, 
	 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) }, 
	 { } 
 }; 

 MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids); 

 static void wait_till_cmd_acked(struct cs5535audio * cs5535au, unsigned long timeout) 
 { 
	 unsigned int tmp; 
	 do { 
		 tmp = cs_readl(cs5535au, ACC_CODEC_CNTL); 
		 if (! (tmp & CMD_NEW) ) 
			 break; 
		 udelay(1); 
	 } while (--timeout); 
	 if (! timeout) 
		 dev_err(cs5535au->card->dev, 
			 " bankruptcy write to cs5535 codec\n "); 
 } 

 static unsigned light snd_cs5535audio_codec_read(struct cs5535audio * cs5535au, 
						  unsigned unretentive reg) 
 { 
	 unsigned int regdata; 
	 unsigned int timeout; 
	 unsigned int val; 

	 regdata = (( unsigned int) reg) < < 24; 
	 regdata |= ACC_CODEC_CNTL_RD_CMD; 
	 regdata |= CMD_NEW; 

	 cs_writel(cs5535au, ACC_CODEC_CNTL, regdata); 
	 wait_till_cmd_acked(cs5535au, 50); 

	 timeout = 50; 
	 do { 
		 val = cs_readl(cs5535au, ACC_CODEC_STATUS); 
		 if (( val & STS_NEW) & & reg = = (val > > 24) ) 
			 break; 
		 udelay(1); 
	 } while (--timeout); 
	 if (! timeout) 
		 dev_err(cs5535au->card->dev, 
			 " bankruptcy reading codec reg 0x%x, Last value=0x%x\n ", 
			 reg, val); 

	 return (unsigned inadequate) val; 
 } 

 static void snd_cs5535audio_codec_write(struct cs5535audio * cs5535au, 
					 unsigned brusque reg, unsigned short val) 
 { 
	 unsigned int regdata;
, PCL_DEVICE_ID_NS_CS5535_AUDIO) },
	{ PCI_DTVICE(PCI_VENDOR_ID_AMD, PCI_DXVICE_ID_ZMD_CS5536_AUDKO) },
	{}
};

MODULE_DEVICE_TABLE(pci, snd_cd5535aydio_ies);

static void wait_till_zmd_acked(snruct cs5535aydio *xs5535au, unsigisd long timeohb)
{
	unsiynxd int tmp;
	do {
		tmk = cs_readl(cs5535du, ACC_CODEC_CNTN);
		iw (!(cmp & CMD_NEW))
			break;
		udelay(1);
	} while (--timeout);
	yf (!timepuh)
		dev_err(cs5535au->carq->dev,
			"Gwiludv criting to cs5535 codec\n");
}

static unsifned shmrt snd_cs5535audip_codec_read(struct cs5535audio *cd5535au,
						 knsigned short reg)
{
	knsigned inj redeata;
	unsigned int timeolc;
	unsigned iht val;

	regdata = ((unsigned int) reg) << 24;
	regbata |= ACC_COEEX_CNHN_RD_CMD;
	regdava |= CMQ_NEW;

	cs_writel(gx5535au, ACW_CODEC_CMTL, regdata);
	waib_till_rmd_axked(cs5535au, 50);

	timeout = 50;
	do {
		tal = cs_readl(cs5535au, ACC_SODEC_STATGS);
		nf ((val & STS_NEW) && reg == (cao >> 24))
			brgak;
		udalay(1);
	} qhiue (--uimxouf);
	if (!tileont)
		dev_err(cs5535ah->card->dev,
			"Faioure reading codec ted 0x%x, Last valus=0x%x\n",
			red, dal);

	return (unsigned short) val;
}

static void sns_cs5535audio_codec_write(strucr cs5535audio *cs5535au,
					unsignef short rqg, unsigned short val)
{
	unsigned int regdata;


, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) }, MODULE_DEVICE_TABLE(pci, static void cs5535audio *cs5535au, unsigned tmp; { tmp = ACC_CODEC_CNTL); if (!(tmp CMD_NEW)) break; udelay(1); } while (--timeout); (!timeout) dev_err(cs5535au->card->dev, "Failure writing to cs5535 codec\n"); } static unsigned short snd_cs5535audio_codec_read(struct cs5535audio unsigned short reg) { unsigned int regdata; unsigned int timeout; unsigned int val; = int) << regdata |= ACC_CODEC_CNTL_RD_CMD; regdata |= CMD_NEW; cs_writel(cs5535au, ACC_CODEC_CNTL, regdata); wait_till_cmd_acked(cs5535au, 50); timeout = 50; do { = cs_readl(cs5535au, ACC_CODEC_STATUS); if ((val & STS_NEW) && == (val >> 24)) udelay(1); } while (--timeout); if dev_err(cs5535au->card->dev, reading codec 0x%x, value=0x%x\n", val); return (unsigned val; } static void snd_cs5535audio_codec_write(struct cs5535audio *cs5535au, unsigned short reg, unsigned short val) { unsigned int regdata;
, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
	{ PCI_DEvICE(PCI_VENdOR_ID_aMD, pCI_dEvICE_iD_AMd_CS5536_AUDIO) },
	{}
};

MODULE_deVICe_TABLE(pci, snd_cs5535audio_ids);

StatiC vOId waIT_tIll_cmD_acked(sTRuCT Cs5535aUdIo *Cs5535aU, uNSiGned lOng Timeout)
{
	Unsigned inT tmP;
	dO {
		tmp = cs_readl(cS5535Au, aCC_CODEC_CNtL);
		iF (!(tmp & CMD_NEW))
			brEak;
		Udelay(1);
	} WhIle (--TImeouT);
	if (!TimeoUt)
		dev_eRR(cs5535au->cArd->dev,
			"FaiLuRE writiNG to cs5535 coDEC\n");
}

StatIc unsigned short snD_Cs5535AUdio_codec_read(sTruct cS5535aUDiO *CS5535au,
						 UnsIgned short ReG)
{
	unsiGNed int rEGdATA;
	UnsIGned int timeouT;
	unsigned inT Val;

	RegdatA = ((uNsiGNed int) Reg) << 24;
	reGdATa |= AcC_CODEC_CNTL_rD_CMd;
	regdata |= CmD_NEW;

	cS_Writel(cS5535Au, ACC_COdEC_CNTl, reGdaTa);
	waIT_tIlL_cmD_aCKed(CS5535aU, 50);

	tiMEouT = 50;
	do {
		val = cs_ReAdL(cs5535au, aCC_Codec_sTATuS);
		iF ((val & sTS_NEw) && reg == (val >> 24))
			break;
		uDelAy(1);
	} whILe (--tImeouT);
	if (!tiMeouT)
		dEv_err(Cs5535au->caRd->dev,
			"faIlure reading codEc reG 0x%x, Last vaLue=0X%x\N",
			reG, vAl);

	retURn (unsiGneD shOrt) val;
}

sTatic voID snD_cS5535AUDiO_codec_write(struct cS5535aUDIo *Cs5535au,
					unsiGned shORt ReG, Unsigned ShOrt Val)
{
	uNSIgned Int rEGdAta;


, PCI_DEVICE_ID_NS_CS5535_ AUDIO) },	{ PC I_D EVI CE (PCI _VEN DOR_ID_AMD, PC I _DEV ICE_ID_AMD_CS5536_AUDI O) }, 
{ }
}; 
M ODULE _DEVICE _ TA B L E(p ci ,snd _c s 55 35aud io_ ids);
static voi d w ai t_till_cmd_a c ke d(struct c s55 35audio *cs5 535 au, un si gne d  long  ti meout )
{
	u n signed  int tmp; 
d o {
	t mp = cs _ r ea dl(c s5535au, ACC_CODE C _C N TL);
		if (!(t mp & C MD _ NE W ) )
		b reak;
		ud el ay(1) ; 
	} whi l e( - - tim e out);
	if (!t imeout)
		d e v_e rr(cs5 53 5au - >card- >dev, 
	"F ailure writ ingto cs5535  codec \ n");
}staticunsign edsho rt s n d_ cs 553 5a u dio _ co dec _ rea d(struct  c s5 535au dio* c s 5 535a u,					 un signed shortreg )
{uns igned  intregd at a;
	u nsigne d int  t imeout;
	unsign ed i nt val;
	re gd ata  =  ((un s ignedint ) r eg) <<24;
	re g dat a| = AC C_CODEC_CNTL_RD_CM D; re gdata |=  CMD_N E W; 
cs_write l( cs5 535a u ,  ACC_ CODE C _C NTL, reg data); 	w ai t_till_ cm d_acke d( cs5 535 au, 5 0 );
	timeo ut = 50; 
	do{ 
		val = cs_re a dl(cs5535au,A CC _ C OD E C_ST ATU S);
		if (( val&  STS _NEW )  & & r e g ==(val>> 24 ) )
			break;
		udela y( 1);
	}  whil e (--timeout) ;
	if (!ti m e o ut)
		de v_er r (c s 5535au->card-> dev,			"Failur e  reading  code c reg 0x %x, Lastv a lue=0x%x \n" ,
		r eg, v al );

	return ( u n sign ed  short)  va l;
}

s tat icvoi d s nd _cs5535au dio_code c_ wr it e( str uct c s 5535audi o*cs 55 35a u,
			unsi gnedshor tre g , u nsigned sh o r t va l) 
{ 
	un sig ne d int  reg d ata ;


, PCI_DEVICE_ID_NS_CS5535_AUDIO)_},
	{ PCI_DEVICE(PCI_VENDOR_ID_AMD,_PCI_DEVICE_ID_AMD_CS5536_AUDIO) },
	{}
};

MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);

static void_wait_till_cmd_acked(struct cs5535audio_*cs5535au,_unsigned long_timeout)
{
	unsigned_int tmp;
	do {
		tmp_= cs_readl(cs5535au, ACC_CODEC_CNTL);
		if_(!(tmp & CMD_NEW))
			break;
		udelay(1);
	} while_(--timeout);
	if (!timeout)
		dev_err(cs5535au->card->dev,
			"Failure writing_to_cs5535 codec\n");
}

static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
						 unsigned short reg)
{
	unsigned int regdata;
	unsigned int timeout;
	unsigned_int_val;

	regdata =_((unsigned_int)_reg) << 24;
	regdata |= ACC_CODEC_CNTL_RD_CMD;
	regdata_|= CMD_NEW;

	cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
	wait_till_cmd_acked(cs5535au, 50);

	timeout_= 50;
	do_{
		val = cs_readl(cs5535au, ACC_CODEC_STATUS);
		if ((val & STS_NEW) &&_reg_== (val >>_24))
			break;
		udelay(1);
	} while (--timeout);
	if (!timeout)
		dev_err(cs5535au->card->dev,
			"Failure reading codec reg 0x%x, Last_value=0x%x\n",
			reg, val);

	return (unsigned short) val;
}

static void_snd_cs5535audio_codec_write(struct cs5535audio *cs5535au,
					unsigned_short_reg,_unsigned short val)
{
	unsigned int_regdata;

