[Galaxy Note II Original Android Development] AndreiLux:
Welcome to the Perseus kernel! I thought it would be a nice catchname considering the Galaxy/Universe/Pegasus themes.

This is a direct port of my kernel on the Galaxy S3. I am using the same source base for both devices for the kernel, just with a different configuration file. The kernel images are not interoperable! I will continue development in parallel for both devices, with the Note 2 having maybe some delay due to third party testing.

I'm trying to be more cutting-edge in terms of development in this kernel. In contrast to other kernels and philosophies of other developers, I don't believe giving the users more choice is a very smart thing to do. As such you won't find a dozen different governors or twenty different settings for this kernel. There is a optimal, or at least, most optimal setting on which the devices operate both in terms of performance and power management. For the average user this kernel will brings lots of benefits to battery life, screen improvement, fluidity and sound enhancements without having to set up any of the configurations.

The kernel comes with a configuration application called STweaks, and is installed automatically with the kernel. You will find all advanced options in there.

Don't be scared by the alpha denomination of the kernel, I'm just taking the traditional naming scheme where alpha designates feature development, beta is feature-completeness, and final will actually be when I'll actively stop developing the kernel. The kernel is very stable, and any bugs are fixed in hotfix versions (alpha x.y)

The kernel is also being maintained and released cross-device for the I9305 (S3 LTE), i9300 (S3) and N7105 (Note 2 LTE) and shares the same base-source. I solely own a I9300 Galaxy S3, but since all the phones derive from the same Midas platform, I merely adapt the differences without having the other devices.

Features / changelist:

Perseus alpha36.3 (26/04):

Fixed slice lookup issue on ABB: It's recommended you put your slices back to default before flashing if you changed them to borderline stability values. Please upgrade.

Perseus alpha36 (22/04):

Adaptive Body Bias control (ABB). (Experimental feature)

Body biasing is taking advantage of transistor body effect for binning the chip depending on its quality. In fact, this is used on the latest Samsung SoCs both for reducing power consumption and validating bad chips by adjusting their electrical characteristics.

The body bias is dictated by the voltage applied to the transistor gate (The usual voltages you're all used to) minus the voltage applied to the transistor body. The resulting bias can change the transistor's electrical characteristics in two possible ways:

Before reading on: A transistor's voltage and operating frequency is defined/limited mostly on its threshold voltage. Wikipedia has a neat visual representation of this; voltage must raise to a certain point for the transistor to be able to switch and operate. This threshold voltage can be highly dependant on temperature, influenced by the body effect, and defined by the manufacturing process. What we're doing nowdays with undervolting is to get as near as possible to the upper bound of this threshold voltage.

With that in mind:

Forward Body Bias

A FBB is defined when the bias of the gate voltage minus body voltage is positive, meaning the gate voltage is higher than the body voltage. This has the effect of reducing the threshold voltage. By reducing it, you can achieve lower voltages, or be able to clock the transistor higher. However the side-effect of lowering the threshold voltage is that you are sacrificing power leakage, meaning that the lower the threshold voltage becomes, the higher leakage current in the transistor becomes. This leakage power rises exponentially with a linear lowering of the threshold voltage. This is what is called static transistor leakage.

Reverse Body Bias

A RBB is defined when the bias of gate voltage minus body voltage is negative, meaning the gate voltage is lower than the body voltage. it has the direct opposite effect of FBB, it raises the threshold voltage thus you would need a higher gate voltage for switching, but however you also dramatically decrease static leakage.

What happens is that you want to use RBB when idling, and a reduced RBB, or even FBB at very high clocks.

Samsung currently uses this on top of voltage scaling to bin their chips. Here's an excerpt of the stock body biasing on the 4412 Prime chip (I'm using that one as an example as it has better adjusted ABB values over the Rev 1.1 chips).

To find out your ASV group: You can read out your ASV group in /sys/devices/system/abb/abb_info now.

I have rewritten the ABB scaling logic/driver for CPU, GPU, MIF and INT voltages.

In the current implementation, since it would be insane to have paired-up gate-body voltages divides the frequency range in several slices; even Samsung uses only three voltage ranges on the DVFS scale. I divided the frequency ranges as follows:

CPU: Divided into four slices, with frequency ranges of 200], 800], 1600] and ]1600 Mhz.

GPU: Three slices: 160], 533] and ]533 Mhz.

MIF and INT: Both only two slices with the bottom frequencies for each as middle-threshold.

As mentioned above, controls can be found in /sys/devices/system/abb/ and the entries are self-explanatory. You can also change the frequency slice limits per sysfs, however in STweaks I only included the voltages for each slice only for now.

Disclaimer

{ And that's about it in that regard. I have tried testing things over last couple of weeks, but I haven't come to a solid conclusion yet beyond what's presented by the stock characteristics: It's up to you people to do some advanced testing on the matter. My limited empirical testing in terms of voltages tells me it works as intended, but if a user with advanced measuring equipment would do similar testing to what I did back on the 4210 it would be perfect. }

zRAM: Switched over from LZO to Snappy compression algorithm, this provides much faster compression and decompression than the LZO implementation which was in the current kernel. I updated the Snappy libraries to the latest original CSNAPPY implementation, so this is extremely new.

Some kernel internal updates to speed up hotplugging and improve I/O latencies.

A correctly (Unlike basically every other kernel out there till now) applied load averaging patch regarding fixing a Moiré pattern in the scheduler load calculations which was floating around.

Fixed mono and equalizer switches in the sound engine. (Thanks to sorgelig for beating me to it)

Fixed led controls to behave correctly with user-space apps.

mDNIe digital brightness reduction:

You can now lower the brightness to basically nothing via this: it uses the mDNIe engine to digitally remove luminance from the RGB channel values, as opposed to reducing brightness via a proper backlight/display driver. The side effect of this is that you lose colour resolution somewhat, but is a practical and working method to reduce the too bright minimum values of our displays.

You have three configurables:

A reduction rate which you want to apply, this is the intensity of the darkening you want to achieve.

The take-over point; the backlight driver gets fed brightness values from 0-255 (In reality values below 20 have no effect). The take-over point is the point where the digital brightness reduction starts, on a reverse scale. The reduction is applied linearly from 0, (Full reduction taking place), to the take-over point (Zero reduction). The stock slider doesn't go below 20 in the interface, so practically the full reduction rate is never applied unless you use a third-party brightness controller app, just to keep that in mind, but in practice it doesn't matter.

Auto-brightness input-delta: This is needed because the stock framework is retarded in the values it forwards to the kernel, you can adjust this to avoid having brightness reduction when you don't want it on auto-brightness.

Somebody needs to edit config_autoBrightnessLevels, config_autoBrightnessLcdBacklightValues in framework-res.apk\res\values\arrays.xml to fix this.

Optionally, if you use a third-party app like Custom Auto Brightness which allows backlight values of down to 0, you can avoid this problem.

The register hook needs to be enabled to be able to use this function.

EA8061 Note 2 owners only: increased the maximum brightness by 50 candela: the manual controls were limited to 250cd as maximum as opposed to 300cd which was only usable during auto-brightness, and unusable for any third-party apps. This doesn't apply to users with S6EVER02 controllers.

Unaligned memory access throughout the kernel when applicable.

Switched over to GCC 4.7.3 Linaro toolchain for compiling.

Perseus alpha35 (06/04):

Further rewrote the in-kernel audio controls:

Threw out the old detection methods for something more robust.

This particularly enables non-cellular applications such as Skype, Viber, and so on to be detected correctly. A "calling" state now includes any and all use-cases where the audio is outputted via the phone's earpiece. This fixes microphone levels for such apps to correctly use the calling sensitivity value.

Added microphone level for camera use, this state is enabled whenever a camera stream is active. It should give more options into adjusting things to your likings.

By now the sound engine has only little similarities to Boeffla, any bugs and feedback now go directly to me.

Developers only: MHS: Added a new small tool for tracking media use and reporting it to other in-kernel drivers. Capable of detecting video recording, decoding and camera streams for now. See commit for more info.

mDNIe control changes:

Removed several controls in STweaks simply because people misunderstood them or misused them, or they simply had no rational use.

Video detection, now with the help of MHS, is no longer limited to the stock video player. Any video players using hardware decoding will now be able to make use of edge enhancement, HDR and DNR, this includes any web-based players and the YouTube app.

Custom LED controls implemented; Exposed most variable controls for the notification LED via sysfs and STweaks (LED tab). :

Control LED brightness. Currently the OS dictates, depending on brightness detected by the light-sensor, wether to run the LED in a low-power mode or in a high-power mode, you can now set brightness for both.

Blinking control, this is basically the shape of the wave-pattern that the LED blinks in, you have several controls, best described the data-sheet description:

The fade-in time period is TT1 in the graph, while the fade-out period is TT2.

Slope (1/2/3/4) detention time represents DT1,2,3,4 in the graph, it controls how "steep" the four different curves are.

The LED fading checkbox simply switches between having the detention times controlled by the sliders to having them to 0 (Stock blinking behaviour).

The ZRam control is found in the I/O Tab in STweaks. Set it to 0 to turn it off completely, any other value to turn swap on. Changing value takes about ~10-20 seconds depending how loaded the disk is with swap pages so don't piss your pants if it doesn't react immediately.

Sources:

https://github.com/AndreiLux/Perseus-S3

Credit and thanks:

gokhanmoral, netarchy, and anybody credited in the commits.

Thanks to sswagonman for the initial testing.

TL;DR: before flashing aside from known issues in the second post.

This isn't an AOSP kernel.

Please choose the right version between N7100 (International 3G) and N7105 (International LTE).

The kernels are labelled for their respective target device. You have no excuse in messing this up.