Post Reply

Lightbulb [KERNEL][19 Oct] T705 TW Oloendithas Kernel v1.0

OP heyjoe66

Yesterday, 05:35 PM   |  #1  
OP Senior Member
Thanks Meter: 135
 
496 posts
Join Date:Joined: Mar 2007
Hello.

Here is something I've made for myself, but I think it might be useful for someone else.

Here are some major features list:
  • Based on T700ANG2
  • CPU - 1900-250MHz, voltage control
  • Intelli-Plug CPU hotplug driver (thanks to Faux123)
    - /sys/module/intelli_plug/parameters
  • GPU - 533-100MHz (default to 533-266), governor control, voltage control
  • BFQ I/O governor
  • FIOPS I/O governor (default)
  • Async fsync, dynamic fsync, dynamic read-ahead, dynamic vfs_cache_preassure
    - /proc/sys/vm/[dynamic_dirty_writeback | dirty_expire_centisecs | dirty_writeback_centisecs | dirty_writeback_suspend_centisecs | dirty_writeback_suspend_centisecs]
    - /sys/kernel/dyn_fsync/Dyn_fsync_active
  • New Google's POWERSUSPEND driver
  • SELinux disabled (still present in ROM)
  • mDNIe tunning profiles moved to /data partition to make them stick across screen off/on cycles
  • mDNIe brightness dependency correction mechanism (it's complicated, will be explained later in this post)
  • Wolfson Audio Control (thanks to AndreiLux and UpInTheAir)
    - stereo DRC
    - stereo EQ for both headphones and stereo speakers
    - controlling EQ frequency bands explained next in this post
  • Frandom random number generator
  • Haveged - even faster then Frandom
  • printk and logcat on/off interfaces (/sys/kernel/...)
  • Alot of debug noise removed
  • hundreds of performance and battery saving patches

Attention! Kernel has SELinux disabled, so you might have trouble with installed user apps if returning to kernel with SELinux enabled from this one. Thus, as always it's a good idea to make a backup.


Downloads in attachment

Source here


Now the tricky parts

Color correction
If you are not interested in waisting your life fighting for color correction, just skip this part

 

There are two features regarding mDNIe color correction gonna need explanation:

First one is about profiles themselves. It was explained here, but the difference now is that profiles folder was moved from /sdcard/mdnie to /data/mdnie to make loaded tunning profile stick across screen off/on cycles, so it needs to be loaded only once on boot.
To work, profile need to be copied to /data/mdnie folder and loaded as follows:
echo 1 > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
echo "CUSTOM1" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
It's explained in details in aformentioned thread.


The second one is really tricky. It is related to non-linear color distortion. I've seen it on my previous Tab 7.7, now I see it here, so I guess true for all AMOLED screens (or maybe only Samsung's, or even maybe only SuperAMOLED). Anyway, on low brightness levels screen goes really green. It can be seen clearly on grayscale images.
So the "solution" implemented here is another one profile, which gets loaded ontop of the primary one. Assuming that the primary profile is made for maximum brightness condition, when colors are most correct, this "secondary" profile contains not actual, but shift values, the corrections, need to be applied to primary profile in lowest brightness conditions.

Example:
Suppose you have a value 0x05(5) in line 151 (red in black) of your primary profile, and you figured out that for lowest brightness you need to set that value to 0x14(20) to keep the tint visually same or close to the one in highest brightness condition. So now you just need to substract base value from corrected value and you'll get the shift:
0x14(20) - 0x05(5) = 0x0F(15)
So the value 0x0F is the one you need to have at line 150 in your secondary profile. And when you'll have the implemented algorithm can calculate corrected color values for all brightness levels in between.

Now make deep breath and please be patient a couple of minutes more. Since that mDNIe thing only supports a positive values in profiles, when it comes to addition correction value to the base value you can't just set something like -0x0F or 1x0F. So I've had to use another dirty trick.
Thus, shift values from 1 to 127 are added to base value, like in example above -- base 0x05 + shift 0x0F = corrected value 0x14.
While shift values from 128 to 255 are lowered by 127 and then substracted from the base value like this -- base 0xFD - (shift 0x8A - 0x7F(127)) = 0xF2 corrected value for lowest brightness condition.

I'll attach my personal profiles to help you understand all this better. TUNNING is for primary profile, CORRECTION is for secondary.
Script to load them on boot:
Code:
echo 1 > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
echo "TUNING" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
sleep 30
echo "CORRECTION" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning_correction
PS: you can use Windows(c) calculator for hexadecimal calculations, just switch it to "Programmer" mode - Alt+3.




Parametric equalizer settings
 

For people not aware of what parametric equalizer is, here is a plain explanation:
It's like any regular graphic equalizer you can see in any consumer audio player or application with a difference that in regular graphic equalizer you have predefined bands like 100Hz - 400Hz - 1kHz - 6kHz - 14kHz, while for parametric equalizer you can set those bands manually.
Default values here are might be alright for external speakers, but not quite useful for a headphones.

Now, to the point.
We have a folder /sys/devices/virtual/misc/wolfson_control/ with the following EQ-related attributes:
Code:
/sys/devices/virtual/misc/wolfson_control/switch_eq_headphone
/sys/devices/virtual/misc/wolfson_control/eq_hp_freqs
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_1
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_2
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_3
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_4
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_5
Code:
/sys/devices/virtual/misc/wolfson_control/switch_eq_speaker
/sys/devices/virtual/misc/wolfson_control/eq_sp_freqs
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_1
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_2
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_3
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_4
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_5
And while it's all pretty simple with switch_eq_headphone and switch_eq_speaker, you just set 1 to on, 0 to off, so as for eq_[hp/sp]_gain_[1-5] you can set values from -12 to 12 dB.
But eq_[hp/sp]_freqs attribs are showing us some weird hex values.
So the bad news is we don't have the algorithm to generate custom values for this. The official documentation states "use WISCE software to get..." those magic values. So be brave, it's not that terrifying as you might imagine.

First you have to download that WISCE software, thankfully it's free:
http://www.wolfsonmicro.com/products...WISCESetup.zip
http://www.wolfsonmicro.com/products...ment/?did=5273

Install them both.
Than start it from WM5102 shortcut.

There you'll see an "Add new system" dialog (do as on screenshots):




In the opened window from the tree on left select Tuning->EQ1 (or any of four EQs)


There you'll see an equalizer window


You can setup bands as you prefer


Now select "Registers" from tree on left and scroll right pane till Address RE12h.
There you'll see the values we are looking for:


You need to wright them down and you are ready load them to tablet:
Code:
echo "0x0fc6 0x03ff 0x00e8 0x1ed9 0xf11a 0x040a 0x045d 0x1e60 0xf150 0x040a 0x64cc 0x0b46 0xfed3 0x040a 0x3ab5 0xfc8f 0x0400 0x323c" > /sys/devices/virtual/misc/wolfson_control/eq_hp_freqs
.
That's pretty much it.

I'll attach a script for speaker to make them sound more bassy and sample for headphones with settings from tutorial above.

For speakers
Code:
#!/system/bin/sh

echo 1 > /sys/devices/virtual/misc/wolfson_control/switch_eq_speaker

echo 6 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_1
echo 10 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_2
echo -2 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_3
echo -1 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_4
echo -2 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_5
For headphones
Code:
#!/system/bin/sh

echo 1 > /sys/devices/virtual/misc/wolfson_control/switch_eq_headphone

echo "0x0fc6 0x03ff 0x00e8 0x1ed9 0xf11a 0x040a 0x045d 0x1e60 0xf150 0x040a 0x64cc 0x0b46 0xfed3 0x040a 0x3ab5 0xfc8f 0x0400 0x323c" > /sys/devices/virtual/misc/wolfson_control/eq_hp_freqs

echo 5 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_1
echo 3 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_2
echo 0 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_3
echo 1 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_4
echo 3 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_5


That's pretty much it for now.

Special thanks to
Faux123
Yank555
Halaszk
UpInTheAir
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	113
Size:	3.9 KB
ID:	2977381   Click image for larger version

Name:	2.png
Views:	113
Size:	3.5 KB
ID:	2977382   Click image for larger version

Name:	3.png
Views:	112
Size:	15.5 KB
ID:	2977383   Click image for larger version

Name:	4.png
Views:	112
Size:	62.1 KB
ID:	2977384   Click image for larger version

Name:	5.png
Views:	114
Size:	44.6 KB
ID:	2977405  

Click image for larger version

Name:	6.png
Views:	118
Size:	45.9 KB
ID:	2977427  
Attached Files
File Type: tar Oloendithas_Kernel_v1_0-odin.tar - [Click for QR Code] (6.96 MB, 2 views)
File Type: zip Oloendithas_Kernel_v1_0-cwm.zip - [Click for QR Code] (7.10 MB, 12 views)
File Type: zip color_profile.zip - [Click for QR Code] (500 Bytes, 4 views)
File Type: zip eq_settings.zip - [Click for QR Code] (583 Bytes, 3 views)
Last edited by heyjoe66; Today at 09:49 AM.
The Following 5 Users Say Thank You to heyjoe66 For This Useful Post: [ View ]
Yesterday, 05:35 PM   |  #2  
OP Senior Member
Thanks Meter: 135
 
496 posts
Join Date:Joined: Mar 2007
reserved...
Today, 07:33 AM   |  #3  
Tried this kernel last night, am running twrp which could be the reason, but installed fine but the OS wouldn't hold long enough to get a catlog as to why crashing.

As I say could well be twrp issue as the download says cwm... Nice to see some fresh deving in the thread though. Need to get my nose into the xda university pages

Edit: Am running Super Samsung V2, Not that TW is that super!
Last edited by chrispgibbs81; Today at 07:36 AM.
Today, 09:36 AM   |  #4  
OP Senior Member
Thanks Meter: 135
 
496 posts
Join Date:Joined: Mar 2007
Quote:
Originally Posted by chrispgibbs81

Tried this kernel last night, am running twrp which could be the reason, but installed fine but the OS wouldn't hold long enough to get a catlog as to why crashing.

As I say could well be twrp issue as the download says cwm... Nice to see some fresh deving in the thread though. Need to get my nose into the xda university pages

Edit: Am running Super Samsung V2, Not that TW is that super!

Can you please describe, how did that crash looked like?
And also have you tried to clear the dalvik-cache?
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy Tab S Original Android Development by ThreadRank