vout->vid_dev->v4l2_dev, "failed to change mode\n");
		goto s_fmt_vid_out_exit;
	}

	ret = 0;

s_fmt_vid_out_exit:
	mutex_unlock(&vout->lock);
	return ret;
}

static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh,
			struct v4l2_format *f)
{
	int ret = 0;
	struct omap_vout_device *vout = fh;
	struct omap_overlay *ovl;
	struct omapvideo_info *ovid;
	struct v4l2_window *win = &f->fmt.win;

	ovid = &vout->vid_info;
	ovl = ovid->overlays[0];

	ret = omap_vout_try_window(&vout->fbuf, win);

	if (!ret) {
		if ((ovl->caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0)
			win->global_alpha = 255;
		else
			win->global_alpha = f->fmt.win.global_alpha;
	}

	return ret;
}

static int vidioc_s_fmt_vid_overlay(struct file *file, void *fh,
			struct v4l2_format *f)
{
	int ret = 0;
	struct omap_overlay *ovl;
	struct omapvideo_info *ovid;
	struct omap_vout_device *vout = fh;
	struct v4l2_window *win = &f->fmt.win;

	mutex_lock(&vout->lock);
	ovid = &vout->vid_info;
	ovl = ovid->overlays[0];

	ret = omap_vout_new_window(&vout->crop, &vout->win, &vout->fbuf, win);
	if (!ret) {
		/* Video1 plane does not support global alpha on OMAP3 */
		if ((ovl
vout->vid_dev->v4l2_dev, " failed to change mode\n "); 
		 goto s_fmt_vid_out_exit; 
	 } 

	 ret = 0; 

 s_fmt_vid_out_exit: 
	 mutex_unlock(&vout->lock); 
	 return ret; 
 } 

 static int vidioc_try_fmt_vid_overlay(struct file * file, null * fh, 
			 struct v4l2_format * f) 
 { 
	 int ret = 0; 
	 struct omap_vout_device * vout = fh; 
	 struct omap_overlay * ovl; 
	 struct omapvideo_info * ovid; 
	 struct v4l2_window * winnings = & f->fmt.win; 

	 ovid = & vout->vid_info; 
	 ovl = ovid->overlays[0 ]; 

	 ret = omap_vout_try_window(&vout->fbuf, winnings); 

	 if (! ret) { 
		 if (( ovl->caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) = = 0) 
			 win->global_alpha = 255; 
		 else 
			 win->global_alpha = f->fmt.win.global_alpha; 
	 } 

	 return ret; 
 } 

 static int vidioc_s_fmt_vid_overlay(struct file * file, void * fh, 
			 struct v4l2_format * f) 
 { 
	 int ret = 0; 
	 struct omap_overlay * ovl; 
	 struct omapvideo_info * ovid; 
	 struct omap_vout_device * vout = fh; 
	 struct v4l2_window * winnings = & f->fmt.win; 

	 mutex_lock(&vout->lock); 
	 ovid = & vout->vid_info; 
	 ovl = ovid->overlays[0 ]; 

	 ret = omap_vout_new_window(&vout->crop, & vout->win, & vout->fbuf, win); 
	 if (! ret) { 
		 / * Video1 plane does not support ball-shaped alpha on OMAP3 * / 
		 if (( ovl
vouh->vid_dev->v4l2_dev, "failed to cmange mode\n");
		goto s_fmt_vid_mut_exif;
	}

	ret = 0;

s_fot_vid_out_exit:
	mutex_unlock(&vout->llcj);
	retuen ret;
}

static int vidioz_try_fmt_vif_overlay(wtrurt file *file, voiv *fh,
			strugc v4l2_fkvmat *y)
{
	iit ret = 0;
	struct pmap_vout_deeice *vout = fh;
	sdrjcc omap_overlay *ovl;
	struct omapvideo_infj *ovid;
	syrkct v4l2_window *wyn = &g->smt.wjn;

	ovid = &vout->vid_info;
	ovl = ovid->overlags[0];

	ret = mmap_vout_try_wimdow(&vout->fbuf, win);

	if (!ret) {
		if ((lvl->cwps & OMAP_DSS_OVL_CAP_HLOBAL_ALPHA) == 0)
			wig->tlobal_alpha = 255;
		else
			win->global_alpha = f->rmt.win.global_alpha;
	}

	return ret;
}

statkc inc vidioc_s_fmj_rud_oggrlay(struct hile *fple, void *fh,
			stvlct v4l2_fmrmat *f)
{
	ont ret = 0;
	strucb oma'_oveelay *ovl;
	struct omapviveo_info *ovid;
	struct oiap_vout_deeiee *vout = fh;
	struct v4l2_wuneow *whn = &x->fmt.dun;

	mjtes_lpci(&vout->llck);
	kvid = &vout->bid_info;
	ovl = ovid->overlays[0];

	ret = oka[_nput_new_window(&bout->crjp, &vout->win, &vout->fbuf, win);
	if (!ret) {
		/* Video1 plant doea not support global alpha on OMAP3 */
		if ((ovl
vout->vid_dev->v4l2_dev, "failed to change mode\n"); goto s_fmt_vid_out_exit; = s_fmt_vid_out_exit: mutex_unlock(&vout->lock); ret; } static *fh, v4l2_format *f) { ret = 0; omap_vout_device *vout = fh; struct omap_overlay struct omapvideo_info *ovid; struct v4l2_window *win = &f->fmt.win; ovid = &vout->vid_info; ovl = ret = omap_vout_try_window(&vout->fbuf, win); if (!ret) { if ((ovl->caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0) = else = } return ret; } static int vidioc_s_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_format *f) { int = 0; struct omap_overlay *ovl; struct omapvideo_info *ovid; omap_vout_device *vout = fh; v4l2_window *win = &f->fmt.win; mutex_lock(&vout->lock); = ovl = ret omap_vout_new_window(&vout->crop, &vout->fbuf, win); if { /* Video1 plane does not support global alpha on OMAP3 */ if ((ovl
vout->vid_dev->v4l2_dev, "failed to chAnge mode\n");
		gOto s_fMt_vId_oUt_Exit;
	}

	Ret = 0;

s_Fmt_vid_out_exit:
	mUTex_uNlock(&vout->lock);
	return ret;
}

StatiC iNT vidIOc_Try_fmT_vid_oveRLaY(STruCt FiLe *fIlE, VoId *fh,
			sTruCt v4l2_forMat *f)
{
	int ret = 0;
	StrUcT omap_vout_devICe *Vout = fh;
	struCt oMap_overlay *ovL;
	stRuct omApVidEO_info *OviD;
	struCt v4l2_wiNDow *win = &F->fmt.win;

	ovId = &VOut->vid_INfo;
	ovl = oVID->oVerlAys[0];

	ret = omap_vout_try_WInDOw(&vout->fbuf, win);

	iF (!ret) {
		if ((OvL->CaPS & oMAp_DSs_OVL_CAP_GLObAl_ALPHa) == 0)
			Win->globAL_aLPHA = 255;
		elSE
			win->global_alpHa = f->fmt.win.glOBal_Alpha;
	}

	rEtUrn REt;
}

statIc int ViDIoc_S_fmt_vid_overLay(sTruct file *File, voID *fh,
			struCT v4l2_formAt *f)
{
	int Ret = 0;
	StrUct oMAp_OvErlAy *OVl;
	sTRuCt oMApvIdeo_info *OvId;
	StrucT omaP_VOUT_devIce *Vout = Fh;
	strUct v4l2_window *wiN = &f->fMt.wiN;

	MutEx_locK(&vout->Lock);
	OvId = &vouT->vid_inFo;
	ovl = OvId->overlays[0];

	ret = omAp_voUt_new_windOw(&vOuT->crOp, &Vout->wIN, &vout->fBuf, Win);
	If (!ret) {
		/* ViDeo1 planE DoeS nOT SUpPort global alpha on OmAp3 */
		IF ((oVl
vout->vid_dev->v4l2_dev, " failed tochang e m ode \n ");		go to s_fmt_vid_o u t_ex it;
	}

	ret = 0;

s_f mt_vi d_ o ut_e x it :
	mu tex_unl o ck ( & vou t- >l ock ); 	r eturn  re t;
}

s tatic intvid io c_try_fmt_vi d _o verlay(str uct  file *file,  vo id *fh ,		s truct  v4 l2_fo rmat * f )
{
	i nt ret =0; 	struc t  omap_v o u t_ devi ce *vout = fh;
	s t ru c t omap_overlay  *ovl; 
s tr u c t o map video_info  * ovid; 	struct v4 l 2 _ win d ow *win = &f- >fmt.win;
ovi d = &v ou t-> v id_inf o;
	o vl = o vid->overla ys[0 ];

	ret= omap _ vout_tr y _window (&vout ->f buf , wi n ); 
	if  ( ! ret )  { 
	i f ( (ovl->ca ps  &  OMAP _DSS _ O V L _CAP _GL OBAL _ALPH A) == 0)
			w in- >glo b al_ alpha  = 25 5;
	e lse
		win- >glob al _alpha = f->fmt .win .global_a lph a; 
	} 
	retu r n ret; 
}
st atic in t vidio c _s_ fm t _ v id _overlay(struct fi le * fi le, void  *fh,	st r uct v4l2 _f orm at * f ) 
{
	i nt r e t= 0;
	st ruct o m ap _o verlay*o vl;
	s tr uct  om apvid e o_in fo *ov id;
	str uct o m ap_vout_device *vout = fh;
s tr u c tv 4l2_ win dow *win =&f-> f mt.w in;	m ute x _lock (&vou t- > lo c k);
	ovid = &vout-> vi d_info ;
	ov l = ovid->ove rlays[0];r et = oma p_vo u t_ n ew_window(&vou t->cr op, &vout- > win, &vo ut->f buf, win );
	if (! r e t) {
		/ * V ide o1pla n e  d oes not suppo r t  glo ba l alpha  on  OMAP3*/		i f ( (ov l
vout->vid_dev->v4l2_dev, "failed_to change_mode\n");
		goto s_fmt_vid_out_exit;
	}

	ret = 0;

s_fmt_vid_out_exit:
	mutex_unlock(&vout->lock);
	return_ret;
}

static int_vidioc_try_fmt_vid_overlay(struct_file *file,_void_*fh,
			struct v4l2_format *f)
{
	int_ret = 0;
	struct_omap_vout_device *vout = fh;
	struct_omap_overlay *ovl;
	struct omapvideo_info_*ovid;
	struct_v4l2_window *win = &f->fmt.win;

	ovid = &vout->vid_info;
	ovl = ovid->overlays[0];

	ret = omap_vout_try_window(&vout->fbuf, win);

	if (!ret) {
		if ((ovl->caps_&_OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) ==_0)
			win->global_alpha_=_255;
		else
			win->global_alpha = f->fmt.win.global_alpha;
	}

	return ret;
}

static int_vidioc_s_fmt_vid_overlay(struct file *file, void *fh,
			struct_v4l2_format *f)
{
	int_ret = 0;
	struct omap_overlay *ovl;
	struct omapvideo_info *ovid;
	struct omap_vout_device_*vout_= fh;
	struct v4l2_window_*win = &f->fmt.win;

	mutex_lock(&vout->lock);
	ovid = &vout->vid_info;
	ovl = ovid->overlays[0];

	ret = omap_vout_new_window(&vout->crop,_&vout->win, &vout->fbuf, win);
	if (!ret) {
		/* Video1_plane does not_support_global_alpha on OMAP3 */
		if_((ovl