--- kernel-source-2.6.16.old/drivers/video/omap/lcd_lph8923.c	2006-06-20 16:02:01.000000000 +0200
+++ kernel-source-2.6.16/drivers/video/omap/lcd_lph8923.c	2006-10-17 12:53:39.000000000 +0200
@@ -20,6 +20,14 @@
 
 #define LPH8923_VER_NON_BUGGY		3
 
+#define	BACKLIGHT_USE_TABLE
+
+
+#ifdef	BACKLIGHT_USE_TABLE
+unsigned char bklight_table[] = {3,25,33,42,50,76,93,110,127};
+#define BACKLIGHT_TABLE_SIZE	9
+#endif
+
 static struct {
 	int		enabled;
 	int		version;
@@ -32,6 +40,10 @@
 	unsigned long	hw_guard_wait;		/* max guard time in jiffies */
 	struct omapfb_device *fbdev;
 	struct spi_device *spi;
+#ifdef	BACKLIGHT_USE_TABLE
+	unsigned char	bklight_table_src[BACKLIGHT_TABLE_SIZE];
+	unsigned char	bklight_table_dst[BACKLIGHT_TABLE_SIZE];
+#endif
 } lph8923;
 
 static struct lcd_panel lph8923_panel;
@@ -259,7 +271,11 @@
 static int lph8923_panel_init(struct omapfb_device *fbdev)
 {
 	lph8923.fbdev = fbdev;
-
+#ifdef	BACKLIGHT_USE_TABLE
+	/* initialize translation table */
+	memcpy(lph8923.bklight_table_src,bklight_table,BACKLIGHT_TABLE_SIZE);
+	memcpy(lph8923.bklight_table_dst,bklight_table,BACKLIGHT_TABLE_SIZE);
+#endif
 	lph8923_detect();
 	lph8923.enabled = lph8923_enabled();
 
@@ -272,20 +288,68 @@
 
 static int lph8923_panel_set_bklight_level(unsigned int level)
 {
-	if (level > tahvo_get_max_backlight_level())
+	if (level > tahvo_get_max_backlight_level()){
+#ifdef	BACKLIGHT_USE_TABLE
+	/*
+	values greater than valid maximum will change translation table
+	to map srclevel to dstlevel value 0x80|srclevel + (dstlevel<<8) needs to be written
+	if srclevel is 0, current active level is changed
+	*/
+	unsigned int srclevel,dstlevel,i;
+	//level -= 0x80; //1 + tahvo_get_max_backlight_level();
+	srclevel = level & 0x7F;
+	dstlevel = level >> 8;
+	if (dstlevel > tahvo_get_max_backlight_level())
 		return -EINVAL;
+	if (srclevel == 0)
+		srclevel = lph8923.saved_bklight_level; /* zero means change current level */
+// srclevel is used as table index, not direct value to remap
+// remove those 5 lines below to use it as direct value
+	else {
+		if (srclevel>BACKLIGHT_TABLE_SIZE)
+			return -EINVAL;
+		srclevel=lph8923.bklight_table_src[srclevel-1];	
+	}
+//
+	for (i=0;i<BACKLIGHT_TABLE_SIZE;i++){
+		if (srclevel == lph8923.bklight_table_src[i]){
+			/* OK, found matching src level, set destination */
+			lph8923.bklight_table_dst[i] = dstlevel;
+			break;
+		}
+	}
+	if (srclevel != lph8923.saved_bklight_level)
+		return 0; /* not current level */
+		
+	/* we are changing current active level, continue */	
+	level = srclevel;	
+#else
+		return -EINVAL;
+#endif
+	}
+	lph8923.saved_bklight_level = level;
+#ifdef	BACKLIGHT_USE_TABLE
+	/* try to translate level */
+	{ int i;
+	for (i=0;i<BACKLIGHT_TABLE_SIZE;i++){
+		if (level == lph8923.bklight_table_src[i]){
+			level = lph8923.bklight_table_dst[i];
+			break;
+		}
+	}
+	}
+#endif
 	if (!lph8923.enabled) {
-		lph8923.saved_bklight_level = level;
 		return 0;
 	}
 	tahvo_set_backlight_level(level);
-
 	return 0;
 }
 
 static unsigned int lph8923_panel_get_bklight_level(void)
 {
-	return tahvo_get_backlight_level();
+	return (unsigned int) lph8923.saved_bklight_level; // we save it on every set call, no need to read from tahvo
+	//return tahvo_get_backlight_level();
 }
 
 static unsigned int lph8923_panel_get_bklight_max(void)
