[Sony Xperia T, TL, TX, V] updateing:
(I don't know if T suffers from inverted screen...)

According to my research,inverted screen is caused by cross-flashing.Wrong screen driver is used for initializing the screen,and the registers get corrupted(written data from the inappropriate driver).After that,the screen will be recognized as other model(written data suggests)so even if you use stock kernel,no proper driver will be loaded.

In order to fix this,we need to write proper register data into the screen again.If we take a look at the source of the driver,we will find "RECOVER_NVM" feature.That's how pre-defined data gets written into screen and we will use it for rescuing the screen.

Step 1.COLLECTING CORRECT DATA.

1.1 Identify your actual screen model

Since the screen is already broken,we can't use any software to make it clear.You need to distinguish them using other ways.For example,TX's B screen has a much wider viewing angle than Screen C.Looking from side will give you answer.​

1.2 Get to know current detected model.

1.2.1 Reboot your phone to clear dmesg cache.

1.2.2 When it finishes boot,open ADB SHELL or Terminal Emulator.

1.2.3 Type "su".

1.2.4 After # shows up(root privilege acquired),type

dmesg | grep "panel"

1.2.5 Look at the lines in red

In this case,ls043k3sx04 is detected screen model.

(Mine is MDX80,not this log)​

1.3 Collect correct register data for your ACTUAL screen model.

You may ask your friend who has the same phone and screen to run the script from this post:http://xdaforums.com/showthread.php?t=2607323

And run the dmesg | grep "panel" also to find the model number.

Note that the register number may differ.The numbers in the script is for TX with Screen C.You can download the kernel source of your phone,navigate to /drivers/video/msm and search for your DETECTED model,open the .c file with any text editor.Search for "nvm_**_reg".The hex number is the register number.List them all in the script.

EG.Mine is Screen C/MDW30​

2.MODIFY THE DETECTED MODEL'S DRIVER

2.1 Open the driver mentioned above.​

2.2 Scroll to the first "nvm_**_reg".

You can simply skip the nvm_e4_00_00_00_f0_ff_reg ones(have more than one hex num in their names-they are not storing the register data and are more like START/END BURNING commands :) )

For example,you find

static char nvm_[COLOR="Red"]e7[/COLOR]_reg[] = {
0x[COLOR="red"]E7[/COLOR], 0x0F, 0x0C, 0x0B, 0x34
};

The first byte in the array is the same as register number.Leave it unchanged and modify the rest bytes accroding to the correct data you have just collected.

EG.The collected data for E7 is

GEN_READ
reg=0xE7
len=10
data[0]=0x02
data[1]=0x02
data[2]=0x0D
data[3]=0x36
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0xCE
data[9]=0x9A

We have 1+4 bytes in the nvm_e7_reg array,1 for reg number and 4 for rest bytes.So you copy 4bytes from this list to the array.

After modding,it should be

static char nvm_e7_reg[] = {
0xE7, 0x02, 0x02, 0x0D, 0x36
};

NOTE! The last 2 bytes in each register data is checksum.DO NOT write them into the driver.So the max. available data is 8 bytes.If you find some arrays have more than 8 bytes of data,you need to skip them and go on.​

2.3 Find the correct values of long arrays

Open ACTUAL screen's driver,search 0xREG_NUM.

EG. You find

static char nvm_[COLOR="Red"]ca[/COLOR]_reg[] = {
0xCA, 0x0A, 0x15, 0x2E, 0x2D, 0x27, 0x1B, 0x20, 0x2B, 0x29, 0x31,
0x4F, 0x79, 0x3F
};

There are 1+13 bytes.So you search for 0xCA in mdw30.c(my actual model)

You will find in mdw30.c

EG.

static char gamma_ctrl_set_r_neg[] = {
[COLOR="red"]0xCA[/COLOR], 0x00, 0x12, 0x22, 0x26, 0x21, 0x1C, 0x25,
0x31, 0x2D, 0x49, 0x5F, 0x3F, 0x3F
};

So this is the actual value for Register CA.Copy the rest bytes to mdx80.c(my detected model)

Note: do not use value from arrays named "eco".​

2.4 Save the file.​

3.RE-COMPILE THE KERNEL AND APPLY MOD

The rest is pretty easy:compile this kernel with CONFIG_MSM_FB_RECOVER_PANEL,boot into recovery,and follow command in this post:

http://xdaforums.com/showthread.php?p=49297118

Note:

cd /d/msm_fb/mipi_[COLOR="red"]r63306[/COLOR]

r63306 is the controller name.You can see it in the directory name of the driver.

I hope this will help you.If you have any question,please ask. :)