Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0086efb authored by eric miao's avatar eric miao Committed by Linus Torvalds
Browse files

pxafb: fix various coding style issues for pxafb



Signed-off-by: default avatareric miao <eric.miao@marvell.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 817daf14
Loading
Loading
Loading
Loading
+144 −136
Original line number Original line Diff line number Diff line
@@ -57,13 +57,18 @@
#include "pxafb.h"
#include "pxafb.h"


/* Bits which should not be set in machine configuration structures */
/* Bits which should not be set in machine configuration structures */
#define LCCR0_INVALID_CONFIG_MASK (LCCR0_OUM|LCCR0_BM|LCCR0_QDM|LCCR0_DIS|LCCR0_EFM|LCCR0_IUM|LCCR0_SFM|LCCR0_LDM|LCCR0_ENB)
#define LCCR0_INVALID_CONFIG_MASK	(LCCR0_OUM | LCCR0_BM | LCCR0_QDM |\
#define LCCR3_INVALID_CONFIG_MASK (LCCR3_HSP|LCCR3_VSP|LCCR3_PCD|LCCR3_BPP)
					 LCCR0_DIS | LCCR0_EFM | LCCR0_IUM |\
					 LCCR0_SFM | LCCR0_LDM | LCCR0_ENB)

#define LCCR3_INVALID_CONFIG_MASK	(LCCR3_HSP | LCCR3_VSP |\
					 LCCR3_PCD | LCCR3_BPP)


static void (*pxafb_backlight_power)(int);
static void (*pxafb_backlight_power)(int);
static void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
static void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);


static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *);
static int pxafb_activate_var(struct fb_var_screeninfo *var,
				struct pxafb_info *);
static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);


#ifdef CONFIG_FB_PXA_PARAMETERS
#ifdef CONFIG_FB_PXA_PARAMETERS
@@ -79,10 +84,12 @@ static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state)
	/*
	/*
	 * We need to handle two requests being made at the same time.
	 * We need to handle two requests being made at the same time.
	 * There are two important cases:
	 * There are two important cases:
	 *  1. When we are changing VT (C_REENABLE) while unblanking (C_ENABLE)
	 *  1. When we are changing VT (C_REENABLE) while unblanking
	 *     We must perform the unblanking, which will do our REENABLE for us.
	 *     (C_ENABLE) We must perform the unblanking, which will
	 *  2. When we are blanking, but immediately unblank before we have
	 *     do our REENABLE for us.
	 *     blanked.  We do the "REENABLE" thing here as well, just to be sure.
	 *  2. When we are blanking, but immediately unblank before
	 *     we have blanked.  We do the "REENABLE" thing here as
	 *     well, just to be sure.
	 */
	 */
	if (fbi->task_state == C_ENABLE && state == C_REENABLE)
	if (fbi->task_state == C_ENABLE && state == C_REENABLE)
		state = (u_int) -1;
		state = (u_int) -1;
@@ -229,15 +236,14 @@ static unsigned int pxafb_display_dma_period(struct fb_var_screeninfo *var)
	 */
	 */
	return var->pixclock * 8 * 16 / var->bits_per_pixel;
	return var->pixclock * 8 * 16 / var->bits_per_pixel;
}
}

extern unsigned int get_clk_frequency_khz(int info);
#endif
#endif


/*
/*
 * Select the smallest mode that allows the desired resolution to be
 * Select the smallest mode that allows the desired resolution to be
 * displayed. If desired parameters can be rounded up.
 * displayed. If desired parameters can be rounded up.
 */
 */
static struct pxafb_mode_info *pxafb_getmode(struct pxafb_mach_info *mach, struct fb_var_screeninfo *var)
static struct pxafb_mode_info *pxafb_getmode(struct pxafb_mach_info *mach,
					     struct fb_var_screeninfo *var)
{
{
	struct pxafb_mode_info *mode = NULL;
	struct pxafb_mode_info *mode = NULL;
	struct pxafb_mode_info *modelist = mach->modes;
	struct pxafb_mode_info *modelist = mach->modes;
@@ -245,8 +251,10 @@ static struct pxafb_mode_info *pxafb_getmode(struct pxafb_mach_info *mach, struc
	unsigned int i;
	unsigned int i;


	for (i = 0; i < mach->num_modes; i++) {
	for (i = 0; i < mach->num_modes; i++) {
		if (modelist[i].xres >= var->xres && modelist[i].yres >= var->yres &&
		if (modelist[i].xres >= var->xres &&
				modelist[i].xres < best_x && modelist[i].yres < best_y &&
		    modelist[i].yres >= var->yres &&
		    modelist[i].xres < best_x &&
		    modelist[i].yres < best_y &&
		    modelist[i].bpp >= var->bits_per_pixel) {
		    modelist[i].bpp >= var->bits_per_pixel) {
			best_x = modelist[i].xres;
			best_x = modelist[i].xres;
			best_y = modelist[i].yres;
			best_y = modelist[i].yres;
@@ -257,7 +265,8 @@ static struct pxafb_mode_info *pxafb_getmode(struct pxafb_mach_info *mach, struc
	return mode;
	return mode;
}
}


static void pxafb_setmode(struct fb_var_screeninfo *var, struct pxafb_mode_info *mode)
static void pxafb_setmode(struct fb_var_screeninfo *var,
			  struct pxafb_mode_info *mode)
{
{
	var->xres		= mode->xres;
	var->xres		= mode->xres;
	var->yres		= mode->yres;
	var->yres		= mode->yres;
@@ -327,7 +336,8 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
		var->blue.offset  = 0;  var->blue.length  = 5;
		var->blue.offset  = 0;  var->blue.length  = 5;
		var->transp.offset = var->transp.length = 0;
		var->transp.offset = var->transp.length = 0;
	} else {
	} else {
		var->red.offset = var->green.offset = var->blue.offset = var->transp.offset = 0;
		var->red.offset = var->green.offset = 0;
		var->blue.offset = var->transp.offset = 0;
		var->red.length   = 8;
		var->red.length   = 8;
		var->green.length = 8;
		var->green.length = 8;
		var->blue.length  = 8;
		var->blue.length  = 8;
@@ -346,7 +356,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
static inline void pxafb_set_truecolor(u_int is_true_color)
static inline void pxafb_set_truecolor(u_int is_true_color)
{
{
	pr_debug("pxafb: true_color = %d\n", is_true_color);
	pr_debug("pxafb: true_color = %d\n", is_true_color);
	// do your machine-specific setup if needed
	/* do your machine-specific setup if needed */
}
}


/*
/*
@@ -379,7 +389,8 @@ static int pxafb_set_par(struct fb_info *info)
	if (var->bits_per_pixel == 16)
	if (var->bits_per_pixel == 16)
		fbi->palette_size = 0;
		fbi->palette_size = 0;
	else
	else
		fbi->palette_size = var->bits_per_pixel == 1 ? 4 : 1 << var->bits_per_pixel;
		fbi->palette_size = var->bits_per_pixel == 1 ?
					4 : 1 << var->bits_per_pixel;


	if ((fbi->lccr4 & LCCR4_PAL_FOR_MASK) == LCCR4_PAL_FOR_0)
	if ((fbi->lccr4 & LCCR4_PAL_FOR_MASK) == LCCR4_PAL_FOR_0)
		palette_mem_size = fbi->palette_size * sizeof(u16);
		palette_mem_size = fbi->palette_size * sizeof(u16);
@@ -460,11 +471,11 @@ static int pxafb_blank(int blank, struct fb_info *info)
				pxafb_setpalettereg(i, 0, 0, 0, 0, info);
				pxafb_setpalettereg(i, 0, 0, 0, 0, info);


		pxafb_schedule_work(fbi, C_DISABLE);
		pxafb_schedule_work(fbi, C_DISABLE);
		//TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
		/* TODO if (pxafb_blank_helper) pxafb_blank_helper(blank); */
		break;
		break;


	case FB_BLANK_UNBLANK:
	case FB_BLANK_UNBLANK:
		//TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
		/* TODO if (pxafb_blank_helper) pxafb_blank_helper(blank); */
		if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
		if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
		    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
		    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
			fb_set_cmap(&fbi->fb.cmap, info);
			fb_set_cmap(&fbi->fb.cmap, info);
@@ -529,7 +540,8 @@ static struct fb_ops pxafb_ops = {
 *
 *
 * Factoring the 10^4 and 10^-12 out gives 10^-8 == 1 / 100000000 as used below.
 * Factoring the 10^4 and 10^-12 out gives 10^-8 == 1 / 100000000 as used below.
 */
 */
static inline unsigned int get_pcd(struct pxafb_info *fbi, unsigned int pixclock)
static inline unsigned int get_pcd(struct pxafb_info *fbi,
				   unsigned int pixclock)
{
{
	unsigned long long pcd;
	unsigned long long pcd;


@@ -578,10 +590,11 @@ EXPORT_SYMBOL(pxafb_get_hsync_time);


/*
/*
 * pxafb_activate_var():
 * pxafb_activate_var():
 *	Configures LCD Controller based on entries in var parameter.  Settings are
 *	Configures LCD Controller based on entries in var parameter.
 *	only written to the controller if changes were made.
 *	Settings are only written to the controller if changes were made.
 */
 */
static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *fbi)
static int pxafb_activate_var(struct fb_var_screeninfo *var,
			      struct pxafb_info *fbi)
{
{
	struct pxafb_lcd_reg new_regs;
	struct pxafb_lcd_reg new_regs;
	u_long flags;
	u_long flags;
@@ -662,8 +675,10 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *


	new_regs.lccr3 = fbi->lccr3 |
	new_regs.lccr3 = fbi->lccr3 |
		pxafb_bpp_to_lccr3(var) |
		pxafb_bpp_to_lccr3(var) |
		(var->sync & FB_SYNC_HOR_HIGH_ACT ? LCCR3_HorSnchH : LCCR3_HorSnchL) |
		(var->sync & FB_SYNC_HOR_HIGH_ACT ?
		(var->sync & FB_SYNC_VERT_HIGH_ACT ? LCCR3_VrtSnchH : LCCR3_VrtSnchL);
		 LCCR3_HorSnchH : LCCR3_HorSnchL) |
		(var->sync & FB_SYNC_VERT_HIGH_ACT ?
		 LCCR3_VrtSnchH : LCCR3_VrtSnchL);


	if (pcd)
	if (pcd)
		new_regs.lccr3 |= LCCR3_PixClkDiv(pcd);
		new_regs.lccr3 |= LCCR3_PixClkDiv(pcd);
@@ -677,9 +692,12 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
	local_irq_save(flags);
	local_irq_save(flags);


	/* setup dma descriptors */
	/* setup dma descriptors */
	fbi->dmadesc_fblow_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 3*16);
	fbi->dmadesc_fblow_cpu = (struct pxafb_dma_descriptor *)
	fbi->dmadesc_fbhigh_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 2*16);
				((unsigned int)fbi->palette_cpu - 3*16);
	fbi->dmadesc_palette_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 1*16);
	fbi->dmadesc_fbhigh_cpu = (struct pxafb_dma_descriptor *)
				((unsigned int)fbi->palette_cpu - 2*16);
	fbi->dmadesc_palette_cpu = (struct pxafb_dma_descriptor *)
				((unsigned int)fbi->palette_cpu - 1*16);


	fbi->dmadesc_fblow_dma = fbi->palette_dma - 3*16;
	fbi->dmadesc_fblow_dma = fbi->palette_dma - 3*16;
	fbi->dmadesc_fbhigh_dma = fbi->palette_dma - 2*16;
	fbi->dmadesc_fbhigh_dma = fbi->palette_dma - 2*16;
@@ -716,32 +734,12 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
		/* init it to something, even though we won't be using it */
		/* init it to something, even though we won't be using it */
		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_palette_dma;
		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_palette_dma;
	} else {
	} else {
		/* flips back and forth between pal and fbhigh */
		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
		fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_palette_dma;
		fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_palette_dma;
		fbi->fdadr0 = fbi->dmadesc_palette_dma; /* flips back and forth between pal and fbhigh */
		fbi->fdadr0 = fbi->dmadesc_palette_dma;
	}
	}


#if 0
	pr_debug("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu);
	pr_debug("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu);
	pr_debug("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu);
	pr_debug("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma);
	pr_debug("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma);
	pr_debug("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma);

	pr_debug("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr);
	pr_debug("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr);
	pr_debug("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr);

	pr_debug("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr);
	pr_debug("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr);
	pr_debug("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr);

	pr_debug("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd);
	pr_debug("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd);
	pr_debug("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd);
#endif

	fbi->reg_lccr0 = new_regs.lccr0;
	fbi->reg_lccr0 = new_regs.lccr0;
	fbi->reg_lccr1 = new_regs.lccr1;
	fbi->reg_lccr1 = new_regs.lccr1;
	fbi->reg_lccr2 = new_regs.lccr2;
	fbi->reg_lccr2 = new_regs.lccr2;
@@ -802,18 +800,22 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi)


	/* 8 bit interface */
	/* 8 bit interface */
	else if (((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
	else if (((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
		  ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_DPD) == LCCR0_8PixMono)) ||
		  ((lccr0 & LCCR0_SDS) == LCCR0_Dual ||
		   (lccr0 & LCCR0_DPD) == LCCR0_8PixMono)) ||
		 ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
		 ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
		  (lccr0 & LCCR0_PAS) == LCCR0_Pas && (lccr0 & LCCR0_SDS) == LCCR0_Sngl))
		  (lccr0 & LCCR0_PAS) == LCCR0_Pas &&
		  (lccr0 & LCCR0_SDS) == LCCR0_Sngl))
		ldd_bits = 8;
		ldd_bits = 8;


	/* 16 bit interface */
	/* 16 bit interface */
	else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
	else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
		 ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act))
		 ((lccr0 & LCCR0_SDS) == LCCR0_Dual ||
		  (lccr0 & LCCR0_PAS) == LCCR0_Act))
		ldd_bits = 16;
		ldd_bits = 16;


	else {
	else {
	        printk(KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n");
		printk(KERN_ERR "pxafb_setup_gpio: unable to determine "
			       "bits per pixel\n");
		return;
		return;
	}
	}


@@ -921,7 +923,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
		 */
		 */
		if (old_state != C_DISABLE && old_state != C_DISABLE_PM) {
		if (old_state != C_DISABLE && old_state != C_DISABLE_PM) {
			fbi->state = state;
			fbi->state = state;
			//TODO __pxafb_lcd_power(fbi, 0);
			/* TODO __pxafb_lcd_power(fbi, 0); */
			pxafb_disable_controller(fbi);
			pxafb_disable_controller(fbi);
		}
		}
		break;
		break;
@@ -948,7 +950,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
		if (old_state == C_DISABLE_CLKCHANGE) {
		if (old_state == C_DISABLE_CLKCHANGE) {
			fbi->state = C_ENABLE;
			fbi->state = C_ENABLE;
			pxafb_enable_controller(fbi);
			pxafb_enable_controller(fbi);
			//TODO __pxafb_lcd_power(fbi, 1);
			/* TODO __pxafb_lcd_power(fbi, 1); */
		}
		}
		break;
		break;


@@ -1019,7 +1021,7 @@ static int
pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
{
{
	struct pxafb_info *fbi = TO_INF(nb, freq_transition);
	struct pxafb_info *fbi = TO_INF(nb, freq_transition);
	//TODO struct cpufreq_freqs *f = data;
	/* TODO struct cpufreq_freqs *f = data; */
	u_int pcd;
	u_int pcd;


	switch (val) {
	switch (val) {
@@ -1030,7 +1032,8 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
	case CPUFREQ_POSTCHANGE:
	case CPUFREQ_POSTCHANGE:
		pcd = get_pcd(fbi, fbi->fb.var.pixclock);
		pcd = get_pcd(fbi, fbi->fb.var.pixclock);
		set_hsync_time(fbi, pcd);
		set_hsync_time(fbi, pcd);
		fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd);
		fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) |
				  LCCR3_PixClkDiv(pcd);
		set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
		set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
		break;
		break;
	}
	}
@@ -1050,18 +1053,8 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
		pr_debug("min dma period: %d ps, "
		pr_debug("min dma period: %d ps, "
			"new clock %d kHz\n", pxafb_display_dma_period(var),
			"new clock %d kHz\n", pxafb_display_dma_period(var),
			policy->max);
			policy->max);
		// TODO: fill in min/max values
		/* TODO: fill in min/max values */
		break;
		break;
#if 0
	case CPUFREQ_NOTIFY:
		printk(KERN_ERR "%s: got CPUFREQ_NOTIFY\n", __FUNCTION__);
		do {} while(0);
		/* todo: panic if min/max values aren't fulfilled
		 * [can't really happen unless there's a bug in the
		 * CPU policy verification process *
		 */
		break;
#endif
	}
	}
	return 0;
	return 0;
}
}
@@ -1131,9 +1124,11 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
		else
		else
			palette_mem_size = fbi->palette_size * sizeof(u32);
			palette_mem_size = fbi->palette_size * sizeof(u32);


		pr_debug("pxafb: palette_mem_size = 0x%08lx\n", palette_mem_size);
		pr_debug("pxafb: palette_mem_size = 0x%08lx\n",
				palette_mem_size);


		fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size);
		fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE
						- palette_mem_size);
		fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
		fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
	}
	}


@@ -1211,7 +1206,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
}
}


#ifdef CONFIG_FB_PXA_PARAMETERS
#ifdef CONFIG_FB_PXA_PARAMETERS
static int parse_opt_mode(struct device *dev, const char *this_opt)
static int __init parse_opt_mode(struct device *dev, const char *this_opt)
{
{
	struct pxafb_mach_info *inf = dev->platform_data;
	struct pxafb_mach_info *inf = dev->platform_data;


@@ -1270,7 +1265,7 @@ static int parse_opt_mode(struct device *dev, const char *this_opt)
	return 0;
	return 0;
}
}


static int parse_opt(struct device *dev, char *this_opt)
static int __init parse_opt(struct device *dev, char *this_opt)
{
{
	struct pxafb_mach_info *inf = dev->platform_data;
	struct pxafb_mach_info *inf = dev->platform_data;
	struct pxafb_mode_info *mode = &inf->modes[0];
	struct pxafb_mode_info *mode = &inf->modes[0];
@@ -1413,27 +1408,36 @@ static int __init pxafb_probe(struct platform_device *dev)
	 * a warning is given. */
	 * a warning is given. */


	if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK)
	if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK)
                dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n",
		dev_warn(&dev->dev, "machine LCCR0 setting contains "
				"illegal bits: %08x\n",
			inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
			inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
	if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK)
	if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK)
                dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n",
		dev_warn(&dev->dev, "machine LCCR3 setting contains "
				"illegal bits: %08x\n",
			inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
			inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
	if (inf->lccr0 & LCCR0_DPD &&
	if (inf->lccr0 & LCCR0_DPD &&
	    ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas ||
	    ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas ||
	     (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl ||
	     (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl ||
	     (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono))
	     (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono))
                dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono"
		dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is "
				"only valid in passive mono"
				" single panel mode\n");
				" single panel mode\n");
	if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
	if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
	    (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
	    (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
		dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
		dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
	if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
	if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
	     (inf->modes->upper_margin || inf->modes->lower_margin))
	     (inf->modes->upper_margin || inf->modes->lower_margin))
                dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n");
		dev_warn(&dev->dev, "Upper and lower margins must be 0 in "
				"passive mode\n");
#endif
#endif


	dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->modes->xres, inf->modes->yres, inf->modes->bpp);
	dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",
	if (inf->modes->xres == 0 || inf->modes->yres == 0 || inf->modes->bpp == 0) {
			inf->modes->xres,
			inf->modes->yres,
			inf->modes->bpp);
	if (inf->modes->xres == 0 ||
	    inf->modes->yres == 0 ||
	    inf->modes->bpp == 0) {
		dev_err(&dev->dev, "Invalid resolution or bit depth\n");
		dev_err(&dev->dev, "Invalid resolution or bit depth\n");
		ret = -EINVAL;
		ret = -EINVAL;
		goto failed;
		goto failed;
@@ -1442,8 +1446,9 @@ static int __init pxafb_probe(struct platform_device *dev)
	pxafb_lcd_power = inf->pxafb_lcd_power;
	pxafb_lcd_power = inf->pxafb_lcd_power;
	fbi = pxafb_init_fbinfo(&dev->dev);
	fbi = pxafb_init_fbinfo(&dev->dev);
	if (!fbi) {
	if (!fbi) {
		/* only reason for pxafb_init_fbinfo to fail is kmalloc */
		dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
		dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
		ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
		ret = -ENOMEM;
		goto failed;
		goto failed;
	}
	}


@@ -1473,19 +1478,22 @@ static int __init pxafb_probe(struct platform_device *dev)


	ret = register_framebuffer(&fbi->fb);
	ret = register_framebuffer(&fbi->fb);
	if (ret < 0) {
	if (ret < 0) {
		dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret);
		dev_err(&dev->dev,
			"Failed to register framebuffer device: %d\n", ret);
		goto failed;
		goto failed;
	}
	}


#ifdef CONFIG_PM
#ifdef CONFIG_PM
	// TODO
	/* TODO */
#endif
#endif


#ifdef CONFIG_CPU_FREQ
#ifdef CONFIG_CPU_FREQ
	fbi->freq_transition.notifier_call = pxafb_freq_transition;
	fbi->freq_transition.notifier_call = pxafb_freq_transition;
	fbi->freq_policy.notifier_call = pxafb_freq_policy;
	fbi->freq_policy.notifier_call = pxafb_freq_policy;
	cpufreq_register_notifier(&fbi->freq_transition, CPUFREQ_TRANSITION_NOTIFIER);
	cpufreq_register_notifier(&fbi->freq_transition,
	cpufreq_register_notifier(&fbi->freq_policy, CPUFREQ_POLICY_NOTIFIER);
				CPUFREQ_TRANSITION_NOTIFIER);
	cpufreq_register_notifier(&fbi->freq_policy,
				CPUFREQ_POLICY_NOTIFIER);
#endif
#endif


	/*
	/*