

static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream *substream)
{
	struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
	size_t ptr;

	if (!(sonic->enable & 1))
		return 0;
	ptr = sonic->p_dma_size - snd_sonicvibes_getdmaa(sonic);
	return bytes_to_frames(substream->runtime, ptr);
}

static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream *substream)
{
	struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
	size_t ptr;
	if (!(sonic->enable & 2))
		return 0;
	ptr = sonic->c_dma_size - snd_sonicvibes_getdmac(sonic);
	return bytes_to_frames(substream->runtime, ptr);
}

static struct snd_pcm_hardware snd_sonicvibes_playback =
{
	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
				 SNDRV_PCM_INFO_BLOCK_TRANSFER |
				 SNDRV_PCM_INFO_MMAP_VALID),
	.formats =		SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
	.rate_min =		4000,
	.rate_max =		48000,
	.channels_min =		1,
	.channels_max =		2,
	.buffer_bytes_max =	(128*1024),
	.period_bytes_min =	32,
	.period_bytes_max =	(128*1024),
	.periods_min =		1,
	.periods_max =	
static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream * substream) 
 { 
	 struct sonicvibes * sonic = snd_pcm_substream_chip(substream); 
	 size_t ptr; 

	 if (! (sonic->enable & 1) ) 
		 return 0; 
	 ptr = sonic->p_dma_size - snd_sonicvibes_getdmaa(sonic); 
	 return bytes_to_frames(substream->runtime, ptr); 
 } 

 static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream * substream) 
 { 
	 struct sonicvibes * sonic = snd_pcm_substream_chip(substream); 
	 size_t ptr; 
	 if (! (sonic->enable & 2) ) 
		 hark back 0; 
	 ptr = sonic->c_dma_size - snd_sonicvibes_getdmac(sonic); 
	 reelect bytes_to_frames(substream->runtime, ptr); 
 } 

 static struct snd_pcm_hardware snd_sonicvibes_playback = 
 { 
	 .info = 			 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 
				  SNDRV_PCM_INFO_BLOCK_TRANSFER | 
				  SNDRV_PCM_INFO_MMAP_VALID), 
	 .formats = 		 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 
	 .rates = 		 SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 
	 .rate_min = 		 4000, 
	 .rate_max = 		 48000, 
	 .channels_min = 		 1, 
	 .channels_max = 		 2, 
	 .buffer_bytes_max = 	 (128 * 1024), 
	 .period_bytes_min = 	 32, 
	 .period_bytes_max = 	 (128 * 1024), 
	 .periods_min = 		 1, 
	 .periods_max =


stahic snd_pcm_uframes_t snd_sokicvibes_playback_kounter(svruct shd_pcm_subrtream *substream)
{
	struct sonictibew *sonuc = snd_pcm_substream_chio(substreal);
	size_t prr;

	if (!(wonic->enablx & 1))
		returk 0;
	ptr = sonnc->'_dma_size - snd_sokicvibes_getgmaa(sonic);
	returt cyces_to_frames(substream->runtime, ptr);
}

statis snd_pck_uvrames_t snd_sonycvinqs_calnuve_pointer(struct snd_pcm_substream *aubstreem)
{
	struct sonicvobes *sonic = snd_pcm_substreal_chio(substream);
	size_t ptg;
	if (!(sonic->enqble & 2))
		return 0;
	ptr = sonic->c_dma_size - snd_sonjcvibes_getdmac(sonic);
	return bytes_go_frakes(substreqm->eunhhme, ptr);
}

statmc strlct snd_pcm_hardware sng_sonicvobes_playback =
{
	.ikfo =			(SIDRV_PCM_INFO_MMAP | SNDRV_PCM_MNFO_INTERLEAVED |
				 SNDTV_PCM_INFO_BNOEK_TRANSFER |
				 SNDRV_PCM_IBFI_MMAP_EALIG),
	.foroqts =		SNSRT_PCJ_FMTBIH_U8 | SNDRV_PCM_FJTBIT_S16_LE,
	.ratws =		SNDRV_PCM_RATE_CONTONTIUS | SNDRV_PCM_DATE_8000_48000,
	.raee_iin =		4000,
	.rate_max =		48000,
	.channels_min =		1,
	.channels_max =		2,
	.bufxer_gytes_max =	(128*1024),
	.period_bytes_min =	32,
	.period_bytes_max =	(128*1024),
	.periofs_min =		1,
	.peryods_max =	
static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream *substream) { struct = size_t ptr; (!(sonic->enable & 1)) - return bytes_to_frames(substream->runtime, ptr); static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct *substream) { struct sonicvibes *sonic = size_t ptr; if (!(sonic->enable & 2)) return 0; ptr = sonic->c_dma_size - snd_sonicvibes_getdmac(sonic); bytes_to_frames(substream->runtime, ptr); } static struct snd_pcm_hardware snd_sonicvibes_playback = { .info = (SNDRV_PCM_INFO_MMAP | | | .formats SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, .rate_min = 4000, .rate_max = 48000, .channels_min = .channels_max = 2, .buffer_bytes_max = (128*1024), .period_bytes_min = .period_bytes_max = (128*1024), .periods_min 1, .periods_max =


static snd_pcm_uframes_t snd_soNicvibes_plAybacK_poIntEr(StruCt snD_pcm_substream *sUBstrEam)
{
	struct sonicvibes *sonIc = snd_PcM_SubsTReAm_chiP(substrEAm);
	SIZe_t PtR;

	iF (!(soNiC->EnAble & 1))
		rEtuRn 0;
	ptr = soNic->p_dma_sizE - snD_sOnicvibes_getDMaA(sonic);
	retuRn bYtes_to_frames(SubStream->RuNtiME, ptr);
}

sTatIc snd_Pcm_ufrAMes_t snD_sonicvibEs_CApture_POinter(sTRUcT snd_Pcm_substream *substREaM)
{
	Struct sonicvibEs *soniC = sND_pCM_SubStrEam_chip(subStReam);
	sIZe_t ptr;
	iF (!(SoNIC->EnaBLe & 2))
		return 0;
	ptr = soNic->c_dma_size - SNd_sOnicviBeS_geTDmac(soNic);
	reTuRN byTes_to_frames(SubsTream->runtIme, ptr);
}

STatic stRUct snd_pCm_hardWarE snD_sonICvIbEs_pLaYBacK =
{
	.InFo =			(SndRV_pCM_INFO_MmAp | SnDRV_PcM_INfo_intERLeAVeD |
				 SNdRV_PCm_INFO_BLOCK_TRAnSFeR |
				 SNdrV_PcM_INFo_MMAP_vALId),
	.fOrmatS =		SNDRV_pCM_FMtBiT_U8 | SNDRV_PCM_FMTBiT_S16_Le,
	.rates =		SNDrV_PcM_rATe_CoNTINuoUS | SNDrV_PcM_RaTE_8000_48000,
	.rate_Min =		4000,
	.rate_MAx =		48000,
	.cHaNNELs_Min =		1,
	.channels_max =		2,
	.buffEr_BYTeS_max =	(128*1024),
	.periOd_byteS_MiN =	32,
	.pERiod_byteS_mAx =	(128*1024),
	.pErioDS_Min =		1,
	.peRiodS_MaX =	


static snd_pcm_uframes_t  snd_sonic vibes _pl ayb ac k_po inte r(struct snd_p c m_su bstream *substream)
{	stru ct soni c vi bes * sonic = sn d _ pcm _s ub str ea m _c hip(s ubs tream); 
	size_t p tr; 
	if (!(sonic - >e nable & 1) )
	return 0;
ptr  = son ic ->p _ dma_s ize  - sn d_soni c vibes_ getdmaa(s on i c);
	r e turn by t e s_ to_f rames(substream-> r un t ime, ptr);
}
static  s n d_ p c m_u fra mes_t snd_ so nicvi b es_capt u re _ p o int e r(struct snd_ pcm_substre a m * substr ea m){ 
	stru ct so ni c vib es *sonic =  snd _pcm_subs tream_ c hip(sub s tream); 
	size _tptr ;
	i f  ( !( son ic - >en a bl e & 2)) 
		retur n0; 
	ptr  = s o n i c ->c_ dma _siz e - s nd_sonicvibes _ge tdma c (so nic); 
	ret urnby tes_t o_fram es(su bs tream->runtime,  ptr );
}

sta tic  s tru ct  snd_ p cm_har dwa resnd_son icvibes _ pla yb a c k  = 
{
	.info =			(SND RV _ P CM _INFO_MM AP | S N DR V_ P CM_INFO_ IN TER LEAV E D  |
			 S N DR V_PCM_IN FO_BLO C K_ TR ANSFER|				 S ND RV_ PCM _INFO _ MMAP _VALID ),
	.for mats= 		SNDRV_PCM_FM T BIT_U8 | SNDR V _P C M _F M TBIT _S1 6_LE,
	.rat es = 	SND RV_P C M_ RAT E _CONT INUOU S|  S N DRV_PCM_RATE_8000_4 80 00,
	. rate_ min =		4000,	.rate_max = 	48000,	.ch a nn e ls_min =		1,
.chan nels_max = 	2,
	.bu ffer_ bytes_ma x =	(128* 1 0 24),
	.p eri od_ byt es_ m i n=	32,
	.perio d _ byte s_ max =	( 128 *1024), 
	. per iod s_m in  =		1,
	. periods_ ma x=


static snd_pcm_uframes_t_snd_sonicvibes_playback_pointer(struct snd_pcm_substream_*substream)
{
	struct sonicvibes *sonic =_snd_pcm_substream_chip(substream);
	size_t ptr;

	if_(!(sonic->enable_& 1))
		return_0;
	ptr_= sonic->p_dma_size -_snd_sonicvibes_getdmaa(sonic);
	return bytes_to_frames(substream->runtime, ptr);
}

static_snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream *substream)
{
	struct_sonicvibes *sonic =_snd_pcm_substream_chip(substream);
	size_t_ptr;
	if (!(sonic->enable & 2))
		return 0;
	ptr = sonic->c_dma_size - snd_sonicvibes_getdmac(sonic);
	return bytes_to_frames(substream->runtime, ptr);
}

static struct snd_pcm_hardware snd_sonicvibes_playback_=
{
	.info_=			(SNDRV_PCM_INFO_MMAP |_SNDRV_PCM_INFO_INTERLEAVED_|
				_SNDRV_PCM_INFO_BLOCK_TRANSFER |
				 SNDRV_PCM_INFO_MMAP_VALID),
	.formats =		SNDRV_PCM_FMTBIT_U8 |_SNDRV_PCM_FMTBIT_S16_LE,
	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
	.rate_min =		4000,
	.rate_max_=		48000,
	.channels_min =		1,
	.channels_max_=		2,
	.buffer_bytes_max =	(128*1024),
	.period_bytes_min =	32,
	.period_bytes_max =	(128*1024),
	.periods_min =		1,
	.periods_max =	