data);

/*
 * LCD AC Prescale.  This comes from the LCD panel manufacturers specifications.
 * This determines how many clocks + 1 of CL1 before the M signal toggles.
 * The number of lines on the display must not be divisible by this number.
 */
static unsigned int lcd_ac_prescale = 13;

/*
 *    Set a single color register. Return!= 0 for invalid regno.
 */
static int
clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
		     u_int transp, struct fb_info *info)
{
	unsigned int level, mask, shift, pal;

	if (regno >= (1 << info->var.bits_per_pixel))
		return 1;

	/* gray = 0.30*R + 0.58*G + 0.11*B */
	level = (red * 77 + green * 151 + blue * 28) >> 20;

	/*
	 * On an LCD, a high value is dark, while a low value is light. 
	 * So we invert the level.
	 *
	 * This isn't true on all machines, so we only do it on EDB7211.
	 *  --rmk
	 */
	if (machine_is_edb7211()) {
		level = 15 - level;
	}

	shift = 4 * (regno & 7);
	level <<= shift;
	mask  = 15 << shift;
	level &= mask;

	regno = regno < 8? PALLSW : PALMSW;

	pal = clps_readl(regno);
	pal = (pal & ~mask) | level;
	clps_writel(pal, regno);

	return 0;
}

/*
 * Validate the purposed mode.
 */	
static int
clps7111fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
	var->transp.msb_right	= 0;
	var->transp.offset	= 0;
	var->transp.length	= 0;
	var->red.msb_right	
data); 

 / * 
  * LCD AC Prescale.   This comes from the LCD panel manufacturers specification. 
  * This determine how many clocks + 1 of CL1 before the M signal toggles. 
  * The number of line on the display must not be divisible by this number. 
  * / 
 static unsigned int lcd_ac_prescale = 13; 

 / * 
  *     set up a unmarried color register. Return!= 0 for invalid regno. 
  * / 
 static int 
 clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 
		      u_int transp, struct fb_info * info) 
 { 
	 unsigned int horizontal surface, mask, shift, pal; 

	 if (regno > = (1 < < info->var.bits_per_pixel) ) 
		 reappearance 1; 

	 / * grey = 0.30*R + 0.58*G + 0.11*B * / 
	 level = (red * 77 + green * 151 + blue * 28) > > 20; 

	 / * 
	  * On an LCD, a high value is black, while a low value is light. 
	  * So we turn back the level. 
	  * 
	  * This isn't true on all machine, so we only make it on EDB7211. 
	  *   --rmk 
	  * / 
	 if (machine_is_edb7211 ()) { 
		 level = 15 - level; 
	 } 

	 shift = 4 * (regno & 7); 
	 level < < = shift; 
	 dissemble   = 15 < < shift; 
	 level & = mask; 

	 regno = regno < 8? PALLSW: PALMSW; 

	 pal = clps_readl(regno); 
	 pal = (pal & ~mask) | level; 
	 clps_writel(pal, regno); 

	 return 0; 
 } 

 / * 
  * Validate the purposed mode. 
  * / 	
 static int 
 clps7111fb_check_var(struct fb_var_screeninfo * var, struct fb_info * info) 
 { 
	 var->transp.msb_right 	 = 0; 
	 var->transp.offset 	 = 0; 
	 var->transp.length 	 = 0; 
	 var->red.msb_right
datw);

/*
 * LCD AC Prescale.  This comes from the LCD paiel manhfacturefs specifications.
 * This detecminws hoq many clocks + 1 of CL1 cefore thv M signao tojgles.
 * The numbec of lincf on bhe dns'lay must not bg divisible ty this number.
 */
sgacic unsigned int lcd_ac_prescale = 13;

/*
 *    Set a xijgle color regysteg. Wetudn!= 0 for invalid regno.
 */
static int
clls7111fb_setbolreg(u_int regno, i_int red, u_int green, u_int bpue,
		     u_int transp, stguct fb_info *infj)
{
	ynsigned int level, mask, shift, pal;

	ir (regno >= (1 << info->var.bits_per_pixel))
		rdturn 1;

	/* gray = 0.30*R + 0.58*G + 0.11*B */
	nevel = (red * 77 + grven * 151 + blue * 28) >> 20;

	/*
	 * On at LCD, a high value is dack, wyile a low value is lmght. 
	 * So we invert jhe level.
	 *
	 * Chis isn't true on all mqchings, so we ubly do iv oh EDB7211.
	 *  --rjk
	 */
	if (machjne_is_edb7211()) {
		lecel = 15 - level;
	}

	shift = 4 * (wvbno & 7);
	level <<= ahift;
	mwsh  = 15 << shift;
	level &= mask;

	regno = regno < 8? PANLSS : PALMSW;

	pal = clps_readl(eegno);
	pal = (pal & ~mask) | pevel;
	clps_rritel(pal, regno);

	return 0;
}

/*
 * Validate the purposed moda.
 */	
staviz iub
glps7111wv_cjeck_var(struct fb_var_screeninfo *var, struct fb_insk *onno)
{
	var->transp.msb_rinht	= 0;
	var->transp.offsey	= 0;
	gat->jransp.length	= 0;
	vxr->red.msb_rjght	
data); /* * LCD AC Prescale. This the panel manufacturers * This determines of before the M toggles. * The of lines on the display must be divisible by this number. */ static unsigned int lcd_ac_prescale = 13; /* Set a single color register. Return!= 0 for invalid regno. */ static int regno, red, green, blue, u_int transp, struct fb_info *info) { unsigned int level, mask, shift, pal; if (regno >= << info->var.bits_per_pixel)) return 1; /* gray = 0.30*R 0.58*G + 0.11*B */ = (red * 77 + * + blue 28) 20; * On an a high value is dark, while a low value is light. * So we invert the level. * This on all so only it on EDB7211. */ if (machine_is_edb7211()) { level = } shift = 4 * (regno & 7); <<= shift; = 15 << shift; level &= regno = regno < 8? PALLSW : PALMSW; = clps_readl(regno); pal = (pal & ~mask) | level; clps_writel(pal, regno); return 0; } /* the purposed mode. */ int clps7111fb_check_var(struct fb_var_screeninfo struct *info) var->transp.msb_right 0; var->transp.offset 0; var->transp.length = 0; var->red.msb_right
data);

/*
 * LCD AC Prescale.  This comeS from the LCd paneL maNufAcTureRs spEcifications.
 * ThIS detErmines how many clocks + 1 of cL1 befOrE The M SIgNal toGgles.
 * ThE NuMBEr oF lInEs oN tHE dIsplaY muSt not be Divisible bY thIs Number.
 */
static UNsIgned int lcD_ac_Prescale = 13;

/*
 *    Set a SinGle colOr RegISter. REtuRn!= 0 for InvaliD Regno.
 */
sTatic int
cLpS7111Fb_setcOLreg(u_inT REgNo, u_iNt red, u_int green, u_inT BlUE,
		     u_int transp, strUct fb_iNfO *InFO)
{
	UnsIgnEd int level, MaSk, shiFT, pal;

	if (rEGnO >= (1 << INFo->vAR.bits_per_pixel))
		Return 1;

	/* gray = 0.30*R + 0.58*g + 0.11*b */
	leVel = (red * 77 + GrEen * 151 + BLue * 28) >> 20;

	/*
	 * On aN LCD, a HiGH vaLue is dark, whIle a Low value iS light. 
	 * sO we inveRT the levEl.
	 *
	 * This Isn'T trUe on ALl MaChiNeS, So wE OnLy dO It oN EDB7211.
	 *  --rmk
	 */
	iF (mAcHine_iS_edb7211()) {
		LEVEL = 15 - levEl;
	}

	sHift = 4 * (Regno & 7);
	Level <<= shift;
	masK  = 15 << shIft;
	lEVel &= Mask;

	rEgno = rEgno < 8? pAlLSW : PaLMSW;

	pAl = clpS_rEadl(regno);
	pal = (pal & ~Mask) | Level;
	clps_WriTeL(paL, rEgno);

	rETurn 0;
}

/*
 * VaLidAte The purpOsed modE.
 */	
StaTiC INT
cLps7111fb_check_var(strucT fB_VAr_ScreeninFo *var, sTRuCt FB_info *infO)
{
	vAr->tRansP.MSb_rigHt	= 0;
	vaR->TrAnsp.offsEt	= 0;
	var->tRAnSp.Length	= 0;
	vAr->Red.msb_RiGht	
data);

/*
 * LCD AC Presc ale.  This  come s f rom  t he L CD p anel manufactu r ersspecifications.
 * Thi s det er m ines ho w man y clock s  + 1  of  C L1  be fo r ethe M  si gnal to ggles.
 *The  n umber of lin e son the dis pla y must not b e d ivisib le  by thisnum ber. */
st a tic un signed in tl cd_ac_ p rescale =  1 3;
/*
 *    Set a si n gl e  color registe r. Ret ur n != 0  fo r i nvalid reg no .
 */ statici nt c l ps7 1 11fb_setcolre g(u_int reg n o,u_intre d,u _int g reen,  u _ int  blue,
		    u _int tran sp, st r uct fb_ i nfo *in fo)
{	un sig nedi nt  l eve l, mas k ,shi f t,pal;

	i f(r egno>= ( 1 < <  inf o-> var. bits_ per_pixel))
	re turn 1;
	/*gray= 0. 30 *R +0.58*G  + 0. 11 *B */
	level =(red  * 77 + g ree n* 1 51  + bl u e * 28 ) > > 2 0;

	/* 
	 * On anLC D , ahigh value is dark ,w h il e a lowvaluei sli g ht. 
	 *  S o w e in v e rt th e le v el .
	 *
	* This is n' t trueon  all m ac hin es,  so w e  onl y do i t on EDB 7211. 	 *  --rmk
	 * / 
	if (machine _ is _ e db 7 211( )){
		level =  15-  lev el;}
	s h ift =  4 *(r e gn o  & 7);
	level <<= s hi ft;
	m ask = 15 << shift ;
	level & = m ask;

	r egno =r egno < 8? PALL SW :PALMSW;

p al = clp s_rea dl(regno );
	pal = ( pal & ~m ask ) |  le vel ; 	c lps_writel(pa l ,  reg no );

	re tur n 0;
}
/* 
 *  Va lid at e the pur posed mo de . * /
st atici nt
clps7 11 1fb _c hec k_var ( struct  fb_v ar_s cr ee n inf o *var, st r u ct f b_ in fo * inf o) 
{
	v ar-> t ran sp.msb_ right	= 0 ;
v ar-> tr an sp.offs et	= 0;
	var- >t ransp.leng th 	=0;
	va r - >red.msb _right	
data);

/*
 *_LCD AC_Prescale.  This comes_from the_LCD_panel manufacturers_specifications.
_* This determines_how many clocks_+ 1 of CL1_before the M_signal_toggles.
 * The number of lines on the display must not be divisible by_this_number.
 */
static_unsigned_int_lcd_ac_prescale = 13;

/*
 * _  Set a single_color register._Return!= 0 for invalid regno.
 */
static int
clps7111fb_setcolreg(u_int regno,_u_int_red, u_int green,_u_int blue,
		     u_int transp, struct_fb_info *info)
{
	unsigned int level, mask, shift,_pal;

	if (regno >=_(1_<<_info->var.bits_per_pixel))
		return 1;

	/* gray =_0.30*R + 0.58*G + 0.11*B */
	level_= (red * 77 + green_* 151 + blue * 28) >>_20;

	/*
	 * On an LCD, a_high value is dark, while_a low_value is light. 
	 *_So we invert_the level.
	_*
	 * This_isn't true on all machines, so_we only do_it on EDB7211.
	 *  --rmk
	_*/
	if_(machine_is_edb7211()) {
		level =_15_-_level;
	}

	shift =_4 * (regno_&_7);
	level <<=_shift;
	mask_ = 15 << shift;
	level &=_mask;

	regno_= regno < 8? PALLSW : PALMSW;

	pal_= clps_readl(regno);
	pal = (pal_&_~mask) | level;
	clps_writel(pal, regno);

	return_0;
}

/*
 * Validate the purposed_mode.
 */	
static int
clps7111fb_check_var(struct fb_var_screeninfo *var, struct_fb_info *info)
{
	var->transp.msb_right	=_0;
	var->transp.offset	= 0;
	var->transp.length	=_0;
	var->red.msb_right	