 of 
	   the DMA buffers and a reduction in the number of available
	   buffers. 

	   Note that a similar but essentially insoluble problem
	   exists for externally-driven rate changes. All we can do
	   is to flag rate changes in the read/write routines.
	 */

	spin_lock_irq(&rme9652->lock);
	xrate = rme9652_adat_sample_rate(rme9652);

	switch (rate) {
	case 44100:
		if (xrate > 48000) {
			reject_if_open = 1;
		}
		rate = 0;
		break;
	case 48000:
		if (xrate > 48000) {
			reject_if_open = 1;
		}
		rate = RME9652_freq;
		break;
	case 88200:
		if (xrate < 48000) {
			reject_if_open = 1;
		}
		rate = RME9652_DS;
		break;
	case 96000:
		if (xrate < 48000) {
			reject_if_open = 1;
		}
		rate = RME9652_DS | RME9652_freq;
		break;
	default:
		spin_unlock_irq(&rme9652->lock);
		return -EINVAL;
	}

	if (reject_if_open && (rme9652->capture_pid >= 0 || rme9652->playback_pid >= 0)) {
		spin_unlock_irq(&rme9652->lock);
		return -EBUSY;
	}

	if ((restart = rme9652->running)) {
		rme9652_stop(rme9652);
	}
	rme9652->control_register &= ~(RME9652_freq | RME9652_DS);
	rme9652->control_register |= rate;
	rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);

	if (restart) {
		rme9652_start(rme9652);
	}

	if (rate & RME9
of 
	    the DMA buffers and a reduction in the number of available 
	    buffers. 

	    notice that a exchangeable but essentially insoluble problem 
	    exist for outwardly - driven rate changes. All we can suffice 
	    is to flag rate change in the read / write routines. 
	  * / 

	 spin_lock_irq(&rme9652->lock); 
	 xrate = rme9652_adat_sample_rate(rme9652); 

	 switch (pace) { 
	 case 44100: 
		 if (xrate > 48000) { 
			 reject_if_open = 1; 
		 } 
		 rate = 0; 
		 break; 
	 case 48000: 
		 if (xrate > 48000) { 
			 reject_if_open = 1; 
		 } 
		 pace = RME9652_freq; 
		 break; 
	 case 88200: 
		 if (xrate < 48000) { 
			 reject_if_open = 1; 
		 } 
		 pace = RME9652_DS; 
		 break; 
	 shell 96000: 
		 if (xrate < 48000) { 
			 reject_if_open = 1; 
		 } 
		 pace = RME9652_DS | RME9652_freq; 
		 break; 
	 default: 
		 spin_unlock_irq(&rme9652->lock); 
		 return -EINVAL; 
	 } 

	 if (reject_if_open & & (rme9652->capture_pid > = 0 || rme9652->playback_pid > = 0) ) { 
		 spin_unlock_irq(&rme9652->lock); 
		 revert -EBUSY; 
	 } 

	 if (( restart = rme9652->running) ) { 
		 rme9652_stop(rme9652); 
	 } 
	 rme9652->control_register & = ~(RME9652_freq | RME9652_DS); 
	 rme9652->control_register |= rate; 
	 rme9652_write(rme9652, RME9652_control_register, rme9652->control_register); 

	 if (restart) { 
		 rme9652_start(rme9652); 
	 } 

	 if (rate & RME9
 of 
	   the DMA buffers and x reduction in jhw numbxr of abailable
	   buffers. 

	   Note that a silioar byt essentially insolubue problel
	   exisrs fie externally-driven rate dmangev. All we can do
	   is to fnag rate changas iu the read/write routines.
	 */

	spin_lock_irq(&wme9652->lock);
	crwte = rme9652_adat_saiple_gaee(rms9652);

	switch (rate) {
	case 44100:
		if (xrate > 48000) {
			rejecf_if_open = 1;
		}
		rate = 0;
		break;
	vase 48000:
		if (xrate > 48000) {
			reject_if_opfn = 1;
		}
		gate = RME9652_freq;
		break;
	fase 88200:
		if (xrajs < 48000) {
			eeject_if_open = 1;
		}
		rate = RMT9652_DV;
		break;
	case 96000:
		if (xrate < 48000) {
			reject_if_open = 1;
		}
		rate = RME9652_DX | RME9652_freq;
		vrwak;
	fgfault:
		spin_unoock_igq(&rme9652->lock);
		retuvm -EINVDL;
	}

	if (rekect_if_open && (rmc9652->captnre_pud >= 0 || rme9652->playback_pid >= 0)) {
		spin_unlock_irq(&rme9652->jock);
		returt -ZBUSY;
	}

	if ((restart = rme9652->rynbing)) {
		tme9652_stmp(rmd9652);
	}
	eme9652->zonurok_rsgisteg &= ~(CME9652_freq | RMS9652_DS);
	rme9652->contril_register |= rate;
	rme9652_erynr(rme9652, RME9652_contdol_regyseer, rme9652->control_register);

	if (restart) {
		rme9652_stagt(rms9652);
	}

	if (rate & RME9
of the DMA buffers and a reduction number available buffers. that a similar for rate changes. All can do is flag rate changes in the read/write */ spin_lock_irq(&rme9652->lock); xrate = rme9652_adat_sample_rate(rme9652); switch (rate) { case 44100: if (xrate > { reject_if_open = 1; } rate = 0; break; case 48000: if (xrate 48000) reject_if_open 1; rate = RME9652_freq; break; case 88200: if (xrate < 48000) { reject_if_open = 1; } rate RME9652_DS; break; case 96000: if (xrate < 48000) reject_if_open = 1; } = RME9652_DS | RME9652_freq; break; spin_unlock_irq(&rme9652->lock); -EINVAL; } (reject_if_open (rme9652->capture_pid 0 || rme9652->playback_pid 0)) { spin_unlock_irq(&rme9652->lock); return -EBUSY; } if ((restart = rme9652->running)) { rme9652_stop(rme9652); } rme9652->control_register &= ~(RME9652_freq | rme9652->control_register |= RME9652_control_register, rme9652->control_register); (restart) rme9652_start(rme9652); if (rate &
 of 
	   the DMA buffers and a reductIon in the nuMber oF avAilAbLe
	   buFferS. 

	   Note that a simiLAr buT essentially insoluble pRobleM
	   eXIsts FOr ExterNally-drIVeN RAte ChAnGes. alL We Can do
	   Is tO flag raTe changes iN thE rEad/write routINeS.
	 */

	spin_lock_iRq(&rMe9652->lock);
	xrate = rMe9652_aDat_samPlE_raTE(rme9652);

	sWitCh (ratE) {
	case 44100:
		iF (Xrate > 48000) {
			rEject_if_opEn = 1;
		}
		RAte = 0;
		breAK;
	case 48000:
		if (XRAtE > 48000) {
			rejEct_if_open = 1;
		}
		rate = RME9652_fREq;
		BReak;
	case 88200:
		if (xratE < 48000) {
			rejecT_iF_OpEN = 1;
		}
		RatE = RMe9652_DS;
		break;
	caSe 96000:
		If (xraTE < 48000) {
			reject_IF_oPEN = 1;
		}
		RatE = rME9652_DS | RME9652_freq;
		bReak;
	default:
		SPin_Unlock_IrQ(&rmE9652->Lock);
		reTurn -EiNvaL;
	}

	iF (reject_if_opEn && (rmE9652->capture_pId >= 0 || rme9652->pLAyback_pID >= 0)) {
		spin_unLock_irQ(&rmE9652->loCk);
		reTUrN -EbUSy;
	}

	iF ((ResTArT = rmE9652->RunNing)) {
		rme9652_sToP(rMe9652);
	}
	rme9652->ContROL_REgisTer &= ~(rME9652_fReq | RMe9652_DS);
	rme9652->control_RegIsteR |= RatE;
	rme9652_wRite(rMe9652, RMe9652_cOntroL_regisTer, rmE9652->cOntrol_register);

	iF (resTart) {
		rme9652_stArt(RmE9652);
	}

	if (RaTe & RME9
 of 
	   the DMA buffers a nd a reduc tioninthe  n umbe r of  available
	 buff ers. 

	   Note that a  simi la r  but es senti ally in s ol u b lepr ob lem 
 exist s f or exte rnally-dri ven  r ate changes. Al l we can d o
   is to fla g r ate ch an ges in th e r ead/w rite r o utines .
	 */

sp i n_lock _ irq(&rm e 9 65 2->l ock);
	xrate = rm e 96 5 2_adat_sample_ rate(r me 9 65 2 ) ;
	sw itch (rate ){
	ca s e 44100 : 
i f  (x r ate > 48000){
			reject _ if_ open =  1 ;
}
		ra te =0; 		b reak;
	case  480 00:
		if(xrate > 48000 )  {
			r eject_ if_ ope n =1 ;	}
	r a te=  R ME9 6 52_ freq;
	br ea k;
	c ase8 8 2 0 0:
	if  (xr ate <  48000) {
		rej ect_ i f_o pen =  1;
	}
	r ate =  RME96 52_DS ;		break;
	case9600 0:
		if ( xra te  <48 000){ 
			re jec t_i f_open= 1;
	} 
	ra t e =RME9652_DS | RME96 52 _ f re q;
		bre ak;
	d e fa ul t :
		spin _u nlo ck_i r q (&rme 9652 - >l ock);
	return -E IN VAL;
	} 
	if (r ej ect _if _open && ( rme965 2->captu re_pi d  >= 0 || rme96 5 2->playback_p i d> =  0 ) ) {		s pin_unlock_ irq( & rme9 652- > lo ck) ; 
		re turn-E B US Y ;
	}

	if ((restart  =  rme96 52->r unning)) {
	rme9652_st o p ( rme9652) ;
	} 	r m e9652->control _regi ster &= ~( R ME9652_f req |  RME9652 _DS);
	rm e 9 652->con tro l_r egi ste r |=  rate;
	rme96 5 2 _wri te (rme965 2,RME9652 _co ntr ol_ reg is ter, rme9 652->con tr ol _r eg ist er);	if (res ta rt)  { 
	rme96 5 2_star t(rme 9652 ); 
} 

if (rat e  & R ME9
 of_
	 _ the DMA buffers_and a_reduction_in the_number_of available
	 _ buffers. 

	_  Note that_a similar but_essentially_insoluble problem
	   exists for externally-driven rate changes. All we can do
	 __is to_flag_rate_changes in the read/write routines.
	_*/

	spin_lock_irq(&rme9652->lock);
	xrate = rme9652_adat_sample_rate(rme9652);

	switch (rate) {
	case_44100:
		if (xrate_> 48000) {
			reject_if_open = 1;
		}
		rate = 0;
		break;
	case 48000:
		if_(xrate_> 48000) {
			reject_if_open_= 1;
		}
		rate = RME9652_freq;
		break;
	case 88200:
		if (xrate < 48000) {
			reject_if_open_= 1;
		}
		rate = RME9652_DS;
		break;
	case 96000:
		if (xrate_< 48000) {
			reject_if_open_=_1;
		}
		rate_= RME9652_DS | RME9652_freq;
		break;
	default:
		spin_unlock_irq(&rme9652->lock);
		return_-EINVAL;
	}

	if (reject_if_open && (rme9652->capture_pid >= 0_|| rme9652->playback_pid >= 0)) {
		spin_unlock_irq(&rme9652->lock);
		return -EBUSY;
	}

	if_((restart = rme9652->running)) {
		rme9652_stop(rme9652);
	}
	rme9652->control_register &= ~(RME9652_freq |_RME9652_DS);
	rme9652->control_register |= rate;
	rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);

	if (restart)_{
		rme9652_start(rme9652);
	}

	if (rate & RME9