[G1 Android Development] louyaorong:
Please excuse me if I post the thread in a wrong place. I think it's right to post it here, though the patch is for sapphire(not dream). Because nearly all the sapphire kernel is only a port of dream kernel, there is few real sapphire kernel developer except sanpei's kernel for NEW RADIO(6.35).

The patch solves a very old problem described here:

"The blurry screen problem on Asia-Pacific Edition HTC magic 32A"

http://xdaforums.com/showthread.php?t=560432

Now I find the problem exists in the file: <kernel source folder>/arch/arm/mach-msm/board-sapphire-panel.c

In the file you can find there are two kinds of sapphire screen panel, one is sharp and the other is toppoly. And in most kernel derived from AOSP (e.g. cm-kernel,wg-kernel), the gamma configoration for toppoly panel is wrong! That's why there is a blurry screen problem on some Asia-Pacific Edition sapphire 32A using this toppoly panel.

This is the original AOSP code in board-sapphire-panel.c which is wrong

/* Red Positive Gamma */
{ 0xE00, 0x0f },
{ 0xE01, 0x19 },
{ 0xE02, 0x22 },
{ 0xE03, 0x0b },
{ 0xE04, 0x23 },
{ 0xE05, 0x23 },
{ 0xE06, 0x14 },
{ 0xE07, 0x13 },
{ 0xE08, 0x0f },
{ 0xE09, 0x2a },
{ 0xE0A, 0x0d },
{ 0xE0B, 0x26 },
{ 0xE0C, 0x43 },
{ 0xE0D, 0x20 },
{ 0xE0E, 0x2a },
{ 0xE0F, 0x5c },

/* Red Negative Gamma */
{ 0xE10, 0x0d },
{ 0xE11, 0x45 },
{ 0xE12, 0x4c },
{ 0xE13, 0x1c },
{ 0xE14, 0x4d },
{ 0xE15, 0x33 },
{ 0xE16, 0x23 },
{ 0xE17, 0x0f },
{ 0xE18, 0x0b },
{ 0xE19, 0x3a },
{ 0xE1A, 0x19 },
{ 0xE1B, 0x32 },
{ 0xE1C, 0x4e },
{ 0xE1D, 0x37 },
{ 0xE1E, 0x38 },
{ 0xE1F, 0x3b },

/* Green Positive Gamma */
{ 0xE20, 0x00 },
{ 0xE21, 0x09 },
{ 0xE22, 0x10 },
{ 0xE23, 0x0f },
{ 0xE24, 0x29 },
{ 0xE25, 0x23 },
{ 0xE26, 0x0b },
{ 0xE27, 0x14 },
{ 0xE28, 0x12 },
{ 0xE29, 0x25 },
{ 0xE2A, 0x12 },
{ 0xE2B, 0x2f },
{ 0xE2C, 0x43 },
{ 0xE2D, 0x2d },
{ 0xE2E, 0x52 },
{ 0xE2F, 0x61 },

/* Green Negative Gamma */
{ 0xE30, 0x08 },
{ 0xE31, 0x1d },
{ 0xE32, 0x3f },
{ 0xE33, 0x1c },
{ 0xE34, 0x44 },
{ 0xE35, 0x2e },
{ 0xE36, 0x28 },
{ 0xE37, 0x0c },
{ 0xE38, 0x0a },
{ 0xE39, 0x42 },
{ 0xE3A, 0x17 },
{ 0xE3B, 0x30 },
{ 0xE3C, 0x4b },
{ 0xE3D, 0x3f },
{ 0xE3E, 0x43 },
{ 0xE3F, 0x45 },

/* Blue Positive Gamma */
{ 0xE40, 0x32 },
{ 0xE41, 0x32 },
{ 0xE42, 0x31 },
{ 0xE43, 0x06 },
{ 0xE44, 0x08 },
{ 0xE45, 0x0d },
{ 0xE46, 0x04 },
{ 0xE47, 0x14 },
{ 0xE48, 0x0f },
{ 0xE49, 0x1d },
{ 0xE4A, 0x1a },
{ 0xE4B, 0x39 },
{ 0xE4C, 0x4c },
{ 0xE4D, 0x1e },
{ 0xE4E, 0x43 },
{ 0xE4F, 0x61 },

/* Blue Negative Gamma */
{ 0xE50, 0x08 },
{ 0xE51, 0x2c },
{ 0xE52, 0x4e },
{ 0xE53, 0x13 },
{ 0xE54, 0x3a },
{ 0xE55, 0x26 },
{ 0xE56, 0x30 },
{ 0xE57, 0x0f },
{ 0xE58, 0x0a },
{ 0xE59, 0x49 },
{ 0xE5A, 0x34 },
{ 0xE5B, 0x4a },
{ 0xE5C, 0x53 },
{ 0xE5D, 0x28 },
{ 0xE5E, 0x26 },
{ 0xE5F, 0x27 },

PLEASE modify to this code which is right, from HTC's source

/* Red Positive Gamma */
{0xE00, 0x001A },
{0xE01, 0x001F },
{0xE02, 0x0022 },
{0xE03, 0x0009 },
{0xE04, 0x0023 },
{0xE05, 0x0023 },
{0xE06, 0x002B },
{0xE07, 0x0013 },
{0xE08, 0x000B },
{0xE09, 0x0049 },
{0xE0A, 0x0019 },
{0xE0B, 0x0026 },
{0xE0C, 0x0059 },
{0xE0D, 0x003B },
{0xE0E, 0x0045 },
{0xE0F, 0x0062 },

/* Red Negative Gamma */
{0xE10, 0x001D },
{0xE11, 0x003A },
{0xE12, 0x0043 },
{0xE13, 0x0009 },
{0xE14, 0x0038 },
{0xE15, 0x0024 },
{0xE16, 0x0034 },
{0xE17, 0x0010 },
{0xE18, 0x0009 },
{0xE19, 0x0051 },
{0xE1A, 0x001B },
{0xE1B, 0x0036 },
{0xE1C, 0x0054 },
{0xE1D, 0x0059 },
{0xE1E, 0x005C },
{0xE1F, 0x0060 },

/* Green Positive Gamma */
{0xE20, 0x0005 },
{0xE21, 0x000E },
{0xE22, 0x0017 },
{0xE23, 0x0010 },
{0xE24, 0x0026 },
{0xE25, 0x0027 },
{0xE26, 0x0028 },
{0xE27, 0x0013 },
{0xE28, 0x000E },
{0xE29, 0x0049 },
{0xE2A, 0x0012 },
{0xE2B, 0x001D },
{0xE2C, 0x0035 },
{0xE2D, 0x0047 },
{0xE2E, 0x004F },
{0xE2F, 0x0062 },

/* Green Negative Gamma */
{0xE30, 0x001D },
{0xE31, 0x0030 },
{0xE32, 0x0036 },
{0xE33, 0x0029 },
{0xE34, 0x0043 },
{0xE35, 0x002e },
{0xE36, 0x0035 },
{0xE37, 0x0011 },
{0xE38, 0x000B },
{0xE39, 0x0053 },
{0xE3A, 0x0016 },
{0xE3B, 0x0035 },
{0xE3C, 0x004F },
{0xE3D, 0x0063 },
{0xE3E, 0x006D },
{0xE3F, 0x0076 },

/* Blue Positive Gamma */
{0xE40, 0x0029 },
{0xE41, 0x002A },
{0xE42, 0x002C },
{0xE43, 0x0003 },
{0xE44, 0x0019 },
{0xE45, 0x0017 },
{0xE46, 0x0023 },
{0xE47, 0x0012 },
{0xE48, 0x000B },
{0xE49, 0x0044 },
{0xE4A, 0x0016 },
{0xE4B, 0x0027 },
{0xE4C, 0x0041 },
{0xE4D, 0x0032 },
{0xE4E, 0x003C },
{0xE4F, 0x0062 },

/* Blue Negative Gamma */
{0xE50, 0x0019 },
{0xE51, 0x0042 },
{0xE52, 0x004B },
{0xE53, 0x001C },
{0xE54, 0x0036 },
{0xE55, 0x0028 },
{0xE56, 0x003C },
{0xE57, 0x0011 },
{0xE58, 0x0009 },
{0xE59, 0x005A },
{0xE5A, 0x002A },
{0xE5B, 0x0043 },
{0xE5C, 0x0058 },
{0xE5D, 0x0052 },
{0xE5E, 0x0053 },
{0xE5F, 0x0054 },

That's solve the problem, and we'll have a better sapphire!