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)
- 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]
- 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
Now the tricky parts
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.
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:
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
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:
/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
/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
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:
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:
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 .
I'll attach a script for speaker to make them sound more bassy and sample for headphones with settings from tutorial above.
#!/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
#!/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