ctrl0 |= route;

	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0,
					bdev->cache_fm_audio_ctrl0);

	mutex_unlock(&bdev->mutex);
	return err;
}

static int bcm2048_get_audio_route(struct bcm2048_device *bdev)
{
	int err;
	u8 value;

	mutex_lock(&bdev->mutex);

	err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, &value);

	mutex_unlock(&bdev->mutex);

	if (!err)
		return value & (BCM2048_AUDIO_ROUTE_DAC |
			BCM2048_AUDIO_ROUTE_I2S);

	return err;
}

static int bcm2048_set_dac_output(struct bcm2048_device *bdev, u8 channels)
{
	int err;

	mutex_lock(&bdev->mutex);

	bdev->cache_fm_audio_ctrl0 &= ~(BCM2048_DAC_OUTPUT_LEFT |
					BCM2048_DAC_OUTPUT_RIGHT);
	bdev->cache_fm_audio_ctrl0 |= channels;

	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0,
					bdev->cache_fm_audio_ctrl0);

	mutex_unlock(&bdev->mutex);
	return err;
}

static int bcm2048_get_dac_output(struct bcm2048_device *bdev)
{
	int err;
	u8 value;

	mutex_lock(&bdev->mutex);

	err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, &value);

	mutex_unlock(&bdev->mutex);

	if (!err)
		return value & (BCM2048_DAC_OUTPUT_LEFT |
			BC
ctrl0 |= route; 

	 err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, 
					 bdev->cache_fm_audio_ctrl0); 

	 mutex_unlock(&bdev->mutex); 
	 return err; 
 } 

 static int bcm2048_get_audio_route(struct bcm2048_device * bdev) 
 { 
	 int err; 
	 u8 value; 

	 mutex_lock(&bdev->mutex); 

	 err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, & value); 

	 mutex_unlock(&bdev->mutex); 

	 if (! err) 
		 return value & (BCM2048_AUDIO_ROUTE_DAC | 
			 BCM2048_AUDIO_ROUTE_I2S); 

	 recurrence err; 
 } 

 inactive int bcm2048_set_dac_output(struct bcm2048_device * bdev, u8 channels) 
 { 
	 int err; 

	 mutex_lock(&bdev->mutex); 

	 bdev->cache_fm_audio_ctrl0 & = ~(BCM2048_DAC_OUTPUT_LEFT | 
					 BCM2048_DAC_OUTPUT_RIGHT); 
	 bdev->cache_fm_audio_ctrl0 |= channels; 

	 err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, 
					 bdev->cache_fm_audio_ctrl0); 

	 mutex_unlock(&bdev->mutex); 
	 return err; 
 } 

 electrostatic int bcm2048_get_dac_output(struct bcm2048_device * bdev) 
 { 
	 int err; 
	 u8 value; 

	 mutex_lock(&bdev->mutex); 

	 err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, & value); 

	 mutex_unlock(&bdev->mutex); 

	 if (! err) 
		 return value & (BCM2048_DAC_OUTPUT_LEFT | 
			 BC
ctrp0 |= route;

	err = bcm2048_send_commxnd(bdev, BCM2048_I2C_FM_CYDIO_CTCL0,
					bdev->czche_fm_auaio_ctrl0);

	mutex_unlock(&bdev->mutex);
	rxturb err;
}

wtatic int bcm2048_get_audio_foute(strubt bcm2048_devuce *udev)
{
	int err;
	u8 valns;

	mutex_lock(&bdeb->luter);

	ecr = bcm2048_recv_commsnd(bdev, BCK2048_I2C_FM_AUDIO_CTRL0, &vxlbe);

	mutex_unlock(&bdev->mutex);

	if (!err)
		return vwlue & (BVM2048_WUDIO_ROUTE_DAC |
			FCM2048_ALDYO_ROHNE_L2S);

	return err;
}

static int bcm2048_set_dac_kutput(suruct bcm2048_device *bdrv, u8 channels)
{
	int err;

	mutex_llck(&bfev->mutex);

	bdev->cache_fl_audio_ctrl0 &= ~(BCM2048_QQC_OUTPUT_LEFT |
					BCM2048_DAC_OUTKUC_RIGHT);
	bdev->czche_fm_audio_ctrl0 |= channels;

	err = bzm2048_senb_command(bdec, VCM2048_L2W_FM_AUDIO_CTRO0,
					bdev->bache_fm_audio_cbgl0);

	mutex_gnlock(&bcev->mutex);
	return erc;
}

staric int bcm2048_get_dac_outpnt(struct bcm2048_device *bqev)
{
	int ers;
	u8 value;

	mutex_lock(&bdwv->nutex);

	grr = tcm2048_rdxv_cummznv(bdsv, BCM2048_L2C_FJ_AUDIO_CTRL0, &value);

	mutex_ynlock(&bdev->mutex);

	if (!etr)
		wvyurn value & (GCM2048_DAC_JUEPUT_LEFT |
			BC
ctrl0 |= route; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, return } static bcm2048_get_audio_route(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, mutex_unlock(&bdev->mutex); if (!err) value & (BCM2048_AUDIO_ROUTE_DAC | BCM2048_AUDIO_ROUTE_I2S); return } static int bcm2048_set_dac_output(struct bcm2048_device *bdev, u8 channels) { int err; mutex_lock(&bdev->mutex); bdev->cache_fm_audio_ctrl0 ~(BCM2048_DAC_OUTPUT_LEFT | BCM2048_DAC_OUTPUT_RIGHT); bdev->cache_fm_audio_ctrl0 |= channels; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, bdev->cache_fm_audio_ctrl0); mutex_unlock(&bdev->mutex); return } int bcm2048_device { int err; u8 value; mutex_lock(&bdev->mutex); err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, &value); mutex_unlock(&bdev->mutex); if (!err) return value (BCM2048_DAC_OUTPUT_LEFT | BC
ctrl0 |= route;

	err = bcm2048_send_commanD(bdev, BCM2048_I2C_fM_AUDiO_CtRL0,
					BdEv->caChe_fM_audio_ctrl0);

	muteX_UnloCk(&bdev->mutex);
	return err;
}

stAtic iNt BCm2048_geT_AuDio_roUte(struCT bCM2048_DevIcE *bDev)
{
	InT ErR;
	u8 valUe;

	mUtex_locK(&bdev->mutex);

	Err = BcM2048_recv_command(BDeV, BCM2048_I2C_FM_AUdIO_cTRL0, &value);

	mutEx_uNlock(&bDeV->muTEx);

	if (!eRr)
		rEturn Value & (Bcm2048_AUDIO_rOUTE_DAC |
			BcM2048_auDIO_ROutE_I2S);

	retURN eRr;
}

stAtic int bcm2048_set_dac_oUTpUT(struct bcm2048_deviCe *bdev, U8 cHAnNELs)
{
	iNt eRr;

	mutex_locK(&bDev->muTEx);

	bdev->cAChE_FM_AudIO_ctrl0 &= ~(BCM2048_DAC_OUtPUT_LEFT |
					BCM2048_daC_OuTPUT_RiGhT);
	bDEv->cachE_fm_auDiO_CtrL0 |= channels;

	erR = bcm2048_Send_commaNd(bdev, bcM2048_I2C_FM_AudIO_CTRL0,
					Bdev->caChe_Fm_aUdio_CTrL0);

	mUteX_uNLocK(&BdEv->mUTex);
	Return erR;
}

sTaTic inT bcm2048_GET_DAc_ouTpuT(strUct bcM2048_device *bdev)
{
	inT erR;
	u8 vaLUe;

	mUtex_lOck(&bdEv->muTeX);

	err = bCm2048_recv_CommaNd(Bdev, BCM2048_I2C_FM_AUDIo_CTRl0, &value);

	mutEx_uNlOck(&BdEv->mutEX);

	if (!err)
		RetUrn Value & (BCm2048_DAC_OUTpuT_LeFt |
			bc
ctrl0 |= route;

	err = bc m2048_send _comm and (bd ev , BC M204 8_I2C_FM_AUDIO _ CTRL 0,
					bdev->cache_fm _audi o_ c trl0 ) ;
	mut ex_unlo c k( & b dev -> mu tex ); 	r eturn  er r;
}

s tatic intbcm 20 48_get_audio _ ro ute(struct  bc m2048_device  *b dev)
{ 
int err;	u8  valu e;

	m u tex_lo ck(&bdev- >m u tex);	err =b c m2 048_ recv_command(bdev ,  B C M2048_I2C_FM_A UDIO_C TR L 0, & val ue) ;

	mutex_ un lock( & bdev->m u te x ) ; 

i f (!err)
		re turn value&  (B CM2048 _A UDI O _ROUTE _DAC|		B CM2048_AUDI O_RO UTE_I2S); 

	ret u rn err; }

stat ic int  bc m20 48_s e t_ da c_o ut p ut( s tr uct bcm 2048_dev ic e*bdev , u8 c h a nnel s){
	i nt er r;

	mutex_lo ck( &bde v ->m utex) ;

	b dev- >c ache_ fm_aud io_ct rl 0 &= ~(BCM2048_ DAC_ OUTPUT_LE FT|			BCM20 4 8_DAC_ OUT PUT _RIGHT) ;
	bdev - >ca ch e _ f m_ audio_ctrl0 |= cha nn e l s; 

	err =  bcm20 4 8_ se n d_comman d( bde v, B C M 2048_ I2C_ F M_ AUDIO_CT RL0,
		b dev->ca ch e_fm_a ud io_ ctr l0);	mut ex_unl ock(&bde v->mu t ex);
	return e r r;
}

statici nt b cm 2 048_ get _dac_output (str u ct b cm20 4 8_ dev i ce *b dev){in t  err;
	u8 value;

mu tex_lo ck(&b dev->mutex);
	err = bc m 2 0 48_recv_ comm a nd ( bdev, BCM2048_ I2C_F M_AUDIO_CT R L0, &val ue);
	mutex_ unlock(&b d e v->mutex );
	i f ( !er r ) 
	return value &  (BC M2 048_DAC _OU TPUT_LE FT|
		B C
ctrl0 |=_route;

	err =_bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0,
					bdev->cache_fm_audio_ctrl0);

	mutex_unlock(&bdev->mutex);
	return err;
}

static int_bcm2048_get_audio_route(struct bcm2048_device_*bdev)
{
	int_err;
	u8 value;

	mutex_lock(&bdev->mutex);

	err_=_bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, &value);

	mutex_unlock(&bdev->mutex);

	if_(!err)
		return value &_(BCM2048_AUDIO_ROUTE_DAC |
			BCM2048_AUDIO_ROUTE_I2S);

	return err;
}

static int_bcm2048_set_dac_output(struct bcm2048_device *bdev,_u8_channels)
{
	int err;

	mutex_lock(&bdev->mutex);

	bdev->cache_fm_audio_ctrl0 &= ~(BCM2048_DAC_OUTPUT_LEFT |
					BCM2048_DAC_OUTPUT_RIGHT);
	bdev->cache_fm_audio_ctrl0 |= channels;

	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0,
					bdev->cache_fm_audio_ctrl0);

	mutex_unlock(&bdev->mutex);
	return err;
}

static int bcm2048_get_dac_output(struct bcm2048_device_*bdev)
{
	int_err;
	u8 value;

	mutex_lock(&bdev->mutex);

	err_=_bcm2048_recv_command(bdev,_BCM2048_I2C_FM_AUDIO_CTRL0, &value);

	mutex_unlock(&bdev->mutex);

	if (!err)
		return value &_(BCM2048_DAC_OUTPUT_LEFT |
			BC