[KERNEL][PATCH][Semi-working] Gamma Controls (compatible with FauxClock)

fnf

Senior Member
Sep 18, 2007
69
88
0
I decided to have a go with custom gamma control as many people want to use it in other kernels, not just stock and Faux's. In a nutshell, it doesn't produce the same colours as Faux's kernel or stock (with Faux's lge_gamma_control kernel module) so it's not a drop-in replacement to his solution.

The reason that it's not working is because I haven't been able to find the correllations/formulae between the colours on the screen and the variables in kernel. I'm not sure why Faux isn't able/willing to release his code, although it could be due to NDA.

Attached is the patch to enable gamma control that works with FauxClock and also a prebuilt kernel with UV enabled.

I hope that inspired devs will be more patient than I am so we can have gamma control for all :) .
 

Attachments

Last edited:

franciscofranco

Recognized Developer
Dec 9, 2010
24,725
136,397
0
Carcavelos
I decided to have a go with custom gamma control as many people want to use it in other kernels, not just stock and Faux's. In a nutshell, it doesn't produce the same colours as Faux's kernel or stock (with Faux's lge_gamma_control kernel module) so it's not a drop-in replacement to his solution.

The reason that it's not working is because I haven't been able to find the correllations/formulae between the colours on the screen and the variables in kernel. I'm not sure why Faux isn't able/willing to release his code, although it could be due to NDA.

Attached is the patch to enable gamma control that works with FauxClock and also a prebuilt kernel with UV enabled.

I hope that inspired devs will be more patient than I am so we can have gamma control for all :) .
Thanks so much for the .patch, its much better than my half-assed attempt few weeks ago. I'm gonna try and make yours work with correct colors ;)

Thank you again.
 

fnf

Senior Member
Sep 18, 2007
69
88
0
Thanks Franco,

I peeked into the lge_gamma_control.ko from Faux, it's doing some more calculations before storing back the values to the kernel. I don't have much experience with decompiling ARM instructions, but it doesn't look complicated. It's probably worth less than 10 lines of C code.

I updated the patch to separate the handling of kgamma_* to their own methods, as different correction coefficients apply to red, green and blue.

Of course, credits to Faux for the binary ;) .
 
  • Like
Reactions: Luigi_2
Jul 29, 2009
39
32
0
@fnf thanks for the patch.
As i can see we are now able to access the values from board-mako-display.c via /sys/:

Code:
static char p_gamma_r_setting[10] = {0xD0, 0x72, 0x15, 0x76, 0x00, 0x00, 0x00, 0x50, 0x30, 0x02};
static char p_gamma_g_setting[10] = {0xD2, 0x72, 0x15, 0x76, 0x00, 0x00, 0x00, 0x50, 0x30, 0x02};
static char p_gamma_b_setting[10] = {0xD4, 0x72, 0x15, 0x76, 0x00, 0x00, 0x00, 0x50, 0x30, 0x02};
somebody knows how these values are working?

thanks

YourNameInHere

Edit: ok just tested it with the faux-app:
Gamma Amp Adjust 0 = value number 6
Gamma Amp Adjust 1 = value number 7

some more info? :)
 
Last edited:
  • Like
Reactions: faux123 and deezid

faux123

Senior Member
Dec 16, 2010
8,536
34,426
113
West Los Angeles
www.canonspike.com
Here are my original mods to the LGE video driver (see attachment) (fnf has faithfully reverse engineered, congrats and very nice indeed, we should talk sometimes if you have a chance):

The last bit of "mystery code" that fnf has noticed is nothing really big as he suspected. This is a simple checksuming code that's commonly used in many computer data transfers. What it does it to validate the payload values before accepting them into the video drivers because incorrect values could CAUSE PERMANENT damage to your screen. It was added to prevent derps from users trying to mess with the sysfs directly burning up the displays due to incorrect values.

Also as YourNameInHere have described:

gamma amp 0 is value 6
gamma amp 1 is value 7

This code needs a custom kernel in order to function and won't work in non-custom kernels.
 

Attachments

deezid

Senior Member
Jun 26, 2010
954
205
0
Viersen
Here are my original mods to the LGE video driver (see attachment) (fnf has faithfully reverse engineered, congrats and very nice indeed, we should talk sometimes if you have a chance):

The last bit of "mystery code" that fnf has noticed is nothing really big as he suspected. This is a simple checksuming code that's commonly used in many computer data transfers. What it does it to validate the payload values before accepting them into the video drivers because incorrect values could CAUSE PERMANENT damage to your screen. It was added to prevent derps from users trying to mess with the sysfs directly burning up the displays due to incorrect values.

Also as YourNameInHere have described:

gamma amp 0 is value 6
gamma amp 1 is value 7

This code needs a custom kernel in order to function and won't work in non-custom kernels.

Looking forward to see this enhancement (LG-Presets: YAY!!!) in other kernels :)
 

deeper-blue

Senior Member
Nov 28, 2010
58
609
0
somewhere in good ol' Germany
Does anybody know more about the other values we can control this way?
The only hint I found is in the change to the color calibration by google:
https://github.com/CyanogenMod/lge-kernel-mako/commit/c1be92b7967f05ed5c6ea3b9c31060617541f96a
https://github.com/CyanogenMod/lge-kernel-mako/commit/0c0acb146c275ae01837fd6ad583df5fcdaa744c

What does ief stand for?

Also has anyone played with the look up tables yet?
https://github.com/CyanogenMod/lge-...bean/arch/arm/mach-msm/lge/lge_qc_lcdc_luts.c
 
Last edited: