[Nexus 4 Original Android Development] _motley:
_motley kernel for the Nexus 4

Disclaimer: You know the gig...I am not responsible for damaging your device or voiding your warranty. Play at your own risk!

ROM devs/cooks: If you want to use this kernel in your ROM, I am fine with that, but please include a "thanks" AND a link back to this thread. Thanks!

Features

Highly customizable with scripts. See post #2 for all the tuning options.

Google 3.4 base. All stock features are of course supported (camera, NFC etc.)

Compiler optimizations (-O2 + others) - using 2012.12 Linaro toolchain

Full ramdisk install with init.d support for stock/AOSP (CM already has support, for stock you must install busybox!)

CPU Overclock steps 1.56, 1.62, and 1.67GHz (default freq is still stock on boot, OC is optional)

304MHz lowest CPU freq step added with lower voltage than stock, since the device spends a lot of time at this frequency.

Safe UV by default for nominal, fast, and faster binned chips.

Voltage control - be careful to not save the setting on boot until you are 100% sure it is stable! (thanks faux123! + my tweaks)

In-kernel auto_hotplug (thanks to thalamus). I have added and exposed all the tuning parameters and a debug mode to userspace.

Customized in-kernel thermal solution smart scaling, dynamic polling, and configurable throttle temp.

Custom PowerHAL module (spam-free Android log from PowerHAL events)

Controllable touchboost frequency and duration

Gamma and Sound control (thanks faux123!)

Fsync control (3 modes)

USB Force Fast Charge

I/O schedulers - SIO(optimized), deadline (optimized), row, cfq, noop, and fiops

TCP Congestion Control (several choices available) - veno is the default

Governors - Interactive (default), OnDemand, PowerSave, Conservative

CIFS, NFS, NTFS r/w, TUN - built-in, no need for any kernel modules

Other misc patches and tweaks (see github link at the bottom of this post)

GPL compliant - source is kept up to date at github.com and

released at the time the kernel is released to the public

via this post. Demand that other devs do the same!

Requirements (please read carefully and visit the other dev threads as necessary)

Boot-loader must be unlocked and you must have a custom recovery installed (CWM or TWRP).

Have your ROM zip on your /sdcard so you can restore your whole ROM if necessary.

Do a complete backup using custom recovery so you can restore your boot.img and ROM if necessary!

System Tuner is recommended for monitoring/tuning the CPU, especially for voltage control. Other kernel apps like faux123's will likely work as well, but they have not been tested.

AOSP ROMs including stock - for init.d support, you must have a working busybox install in /system/xbin.

Installation

Check the requirements above

and

read release notes below for the build # you are installing for any extra instructions!

If coming from another kernel, read the instructions in red below and follow them before flashing.

Flash the the kernel zip using your custom recovery.

Optional: if you want to revert back to what you had, restore your backup of your boot.img in recovery. Another option for reset back to stock is to flash the stock reset zip above. For other custom ROMs, dirty flash your custom ROM in recovery to get your default kernel and ramdisk back.

If you have issues and are coming from another custom kernel or ROM, follow these instructions first before the install. Many custom kernels are changing the ramdisk or other binaries that require a reset before moving back to stock or another kernel.

Reset for Stock ROM - flash this reset package that includes the stock kernel, ramdisk, thermald, mpdecision, and PowerHAL binary. This can also be used if you are using the stock ROM and want to go back to stock.

4.2.1 View attachment 1550949

4.2.2 View attachment 1737875

Reset for any non-stock ROMs like CM, AOKP etc - dirty flash your current ROM or nightly zip then your gapps in recovery (just flash, no wiping). This will give you back your original ramdisk, kernel, and other binaries that other kernel devs may have tweaked, renamed, replaced etc.

Builds

Build 49 - 2013-03-10 (stable) - Android 4.2.2

Added faux123's "Sound Control: Sound control for WCD93xx codec" for testing (thanks!)

AnyKernel UPDATE ONLY - must already be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1794066

Build 48 - 2013-03-09 (stable) - Android 4.2.2

Turned off touchscreen accuracy filter by default and allow users to turn them on via the same interface (see git for all the details). In the commit comments on github, I also document how the stock kernel already allows these adjustments, but now we have easier control of them individually. Let me know if this fixes issues for those having them.

Reverted back the changes for notification delays. They didn't fix anything. If you swapped out your prime WiFi INI file, I recommend changing back to stock for now.

AnyKernel UPDATE ONLY - must already be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1792114

Build 44 - 2013-03-04 (beta) - Android 4.2.2

Updated touchscreen Accuracy Filter Control with franco's cleanup patch. Reverting back to a single threaded workqueue should hopefully help fix the touchscreen issues some reported.

Per Google's kernel devs, we should not have CONFIG_NF_CONNTRACK_SIP/CONFIG_NF_NAT_SIP turned on in the config. Testing is under way (introduced in b43 posted in the thread).

AnyKernel UPDATE ONLY - must already be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1779943

Build 42 - 2013-03-02 (beta) - Android 4.2.2

Added faux123 Speaker Amp Control by request for testing (thx!)

Added franciscofranco touchscreen Accuracy Filter Control by request for testing (thx!)

Reverted "Mako Gamma: allow values greater than 31 for array positions 5 and 6". Brought to faux's attention and his app is now fixed, so this is no longer needed. Values should be capped at 31 like we have always known.

AnyKernel UPDATE ONLY - must already be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1773902

Build 40 - 2013-02-25 (stable) - Android 4.2.2

Added upstream smp patches from 4.2.1 back into 4.2.2 build

Added optimized ARM RWSEM algorithm backin into 4.2.2 build

AnyKernel UPDATE ONLY - must be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1759617

Build 39 - 2013-02-20 (stable) - Android 4.2.2

Added usb/hsic patches into 4.2.2 build

Turned off prima debugging in 4.2.2 build

AnyKernel UPDATE ONLY - must be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1747607

Build 38 - 2013-02-17 (stable) - Android 4.2.2

Loosen up validation for gamma interface to allow values greater than 31 for array positions 5 and 6.

AnyKernel UPDATE ONLY - must be on b37 or higher first! Anykernel is the same for both Stock/AOSP and CM 10.1

View attachment 1738773

Build 37 - 2013-02-17 (stable) - First build with 4.2.2 support added

4.2.2 - rebased upon android-msm-mako-3.4-jb-mr1.1, ramdisk updated etc.

All major features added back in, but I have left a few patches out (hsic etc.) so we can evaluate before adding them back in.

Back to b32 colors, from here out you are on your own using the gamma interface of choice.

Fixed issue where fsync was still on like in previous builds. Dynamic fsync is now the default (see post 2)

Added franco gamma interface, so the kernel can support all popular interfaces until/if a standard interface is adopted.

Added refresh_screen sysfs (see post 2). This should only be called by apps or scripts while adjusting colors "live" with the motley or faux interface and NOT implemented on startup via init.d or apps since it will compete with the normal power on process and the colors will be set twice.

Use a 4.2.2 ROM and binaries. I will not troubleshoot any issues if you use this on 4.2.1 ROMs and binaries

Stock/AOSP with init.d support: View attachment 1737866

-or-

CM 10.1: View attachment 1738415

Previous builds and release notes:

Exp build 35 - 2013-02-11 (stable) - Last build for 4.2.1 for now

New default gamma values (this is an experiment, so let's see how everyone likes it)

cifs support for 4.2 (no modules required) - make sure you pass unc=\\\\server_name\\share_name as a mount option, or it will not work. It is a problem in the mainline kernel for 3.4 where they seem to have accidentally made the unc option mandatory. Also, no promises that the mount will be solid after the device sleeps. For now, I suggest you unmount after you are done using the file system unless we find a workaround. I have tested with cifsmanager from the app store. Other apps may or may not work.

Vibrator default is now 80 in init.mako.rc. This thing was anemic and it was about time.

FIOPS io scheduler added for testing by request

Applied several kernel\sched patches

auto_hotplug tweaks, nothing major.

Added dynamic fsync (thanks faux123) - I will update post 2 with the 3 different FSYNC options. Both toggles were left in the kernel since they are both available in different apps. If someone liked it the way it was, I didn't want to take that away.

Stock/AOSP with init.d support: View attachment 1721927

-or-

CM 10.1: View attachment 1721938

Exp build 32 - 2013-02-03 (stable)

Merged Google's latest kernel patches for off-mode charging (from android-msm-mako-3.4-jb-mr1)

Interactive governor default tweaks - seems to give better user experience in testing thus far.

One other patch from Google's common 3.4 repo (sync: Fix race condition between merge and signal)

AnyKernel UPDATE ONLY - You must already be on exp b31. If not flash that first, then flash this. This works for both Stock/AOSP and CM

View attachment 1700779

Exp build 31 - 2013-01-28 (stable)

Added support for generic gamma control via sysfs with scripts (will update post #2 with details and examples). Again, thanks to faux123 for sharing his code.

Back on Linaro toolchain. Touch Control (PGM) support is still working fine.

TCP Congestion Control default changed to "veno" to see if it helps achieve faster speeds for some. Also added cubic, bic, illinois, and yeah for testing. Westwood+, reno, and vegas still available.

Stock/AOSP with init.d support: View attachment 1689025

-or-

CM 10.1: View attachment 1689029

-or-

AnyKernel UPDATE ONLY - If you already on this kernel exp b17 or higher. For both Stock/AOSP and CM (keep this around for those who may want it for some reason)

View attachment 1682822

Exp build 28 update - 2013-01-24 (alpha 3)

Added support for gamma control (thanks to faux123, the faux123 app is required). Will likely provide something more generic in the future for tuning via sysfs without a 3rd party app.

Added some modest CPU OC steps of 1.56, 1.62, and 1.67GHz (voltages are scaled by bin but might not yet be optimal as the defaults). It still boots to the stock 1.5GHz, so it won't affect those that don't want to OC.

Giving the Google 4.7 toolchain a try. This base will give Touch Control a chance to work when the dev has a change to take a look. I am also inquiring to see if he thinks we can give Linaro a try. Google has made a lot of strides in this latest version, but I don't think it is yet on par with Linaro. I may do another alpha build with Linaro so we can compare. Perhaps I don't have the proper optimizations in place. we will see where this goes.

Thermal throttling improvements (new tuneable "min_freq_index" - what freq does it throttle down to before returning to max?)(default = 7 = 1.13GHz). This is the index in the frequency table as seen in Trickster MOD, System Tuner etc. It is zero based (i.e. 304MHz is zero). Several other changes, see my git commits for details.

Touch Control (PGM) support now available (thanks to bponury for his support!)

AnyKernel UPDATE ONLY - If you are not on b17 or higher already, flash build 17 first (Stock/AOSP or CM), then flash the AnyKernel zip for both Stock/AOSP and CM

Exp build 22 update - 2013-01-19 (stable)

Added hsic/usb patches (thanks to code aurora, harsh, thracemerin, and all the other kernel devs that helped with testing and troubleshooting)

See this post for some more info and why it was first released. It is now considered beta and not alpha.

AnyKernel UPDATE ONLY - If you are not on it already, flash build 17 first (Stock/AOSP or CM), then flash the AnyKernel zip for both Stock/AOSP and CM

motley_anykernel_nexus_4_EXP_build_22.zip

Exp build 21 update - 2013-01-19 (stable)

I am hoping this has us back to the b12 smoothness and we have settled in on some good defaults for moving forward.

Upgraded prima WLAN driver to 3.2.1.13 (connected to 3 different WiFi networks yesterday and it is working flawless for me)

Interactive gov tweaks based upon testing and feedback (boostpulse freq is now stock)

Default throttle temp now 67C

Other minor patches: auto_hotplug kick start on resume, update L2 voltage table, etc. (see github)

AnyKernel UPDATE ONLY - If you are not on it already, flash build 17 first (Stock/AOSP or CM), then flash the AnyKernel zip for both Stock/AOSP and CM

View attachment 1658188

Exp build 17 - 2013-01-16 (stable)

Back to new 3.4 Google interactive governor base like in b12

PowerHAL and boostpulse setup from b12 is also back. Touchboost default settings have been tweaked based on user feedback (how long does it boost? boostpulse_duration, what freq to boost to? hispeed_freq). If you want to use OnDemand, or don't want any touchboost, then you can flash the "inert" PowerHAL at the bottom of this post.

auto_hotplug enhancements rev 3 (see github) - I will update post #2 as soon as I can. We now have control over how many cpu cores you want online (for battery or performance). Thanks to mathkid for the min_online_cpus commit. It gave me the idea for max_online_cpus.

Back to the partial mako display partial revert by popular demand. My RBG tweak was reverted back to stock (255,255,255). Remember, the RGB can be changed in this kernel and it will persist after screen off/on without an app (see post #2). Trickster MOD can be used to tweak RGB.

OnDemand gov - latest patches from Code Aurora.

Note: Make sure you test with out of the box voltages, especially in the mid-range! There is already a healthy amount of under-volting in this kernel for all binned chips except "slow".

Stock/AOSP with init.d support: View attachment 1651464

-or-

CM 10.1: View attachment 1651468

Exp build 14 - 2013-01-14 (beta)

Reverted back to stock interactive governor base.

Added touchboost changes into stock interactive gov base and tweaked touchboost default settings based on user feedback.

Reverted back to b10 inert PowerHAL (same a separate flash I provided for b12 for those having issues)

Reverted one other scheduler patch that I thought could be playing a role in the reboot. I also didn't think it showed benefits after testing.

Notes: you can control touchboost using the interactive gov (turn off/on touchboost: input_boost, length of boost pulse: above_hispeed_delay, freq to boost to: hispeed_freq)

Stock/AOSP with init.d support: View attachment 1645970

-or-

CM 10.1: View attachment 1645993

Exp build 12 - 2013-01-13 (beta)

Touchboost control - connected custom Android PowerHAL module with interactive touchboost. Then, I married interactive touchboost with autoplug touchboost. If you want to tune tune interactive governor touchboost differently, you can use sysfs scripts, Trickster MOD or other capable apps (how long does it boost? boostpulse_duration, what freq to boost to? hispeed_freq)

Added touchscreen patch (thanks faux123) - seems to make the touchscreen more usable and responsive in my testing.

autoplug enhancements rev 2 - added ability to change # of sampling_periods on the fly using a module parameter (whilst preserving past history). Added get/set methods for all module parameters to make them safe. See github for all the details.

Added "row io scheduler by request - SIO is still the default for now.

Some other misc patches

Stock/AOSP with init.d support: View attachment 1641515

-or-

CM 10.1: View attachment 1641518

Exp build 10 - 2012-12-30 (stable)

Important: Since freqs have been added at the high end below 1.5GHz for smoother scaling, if you use voltage control make sure voltage data is not applied on start-up since you won't have the values for the new freqs.

Userspace tuning for thermal and hotplug (see post 2 for details shortly)

Enhanced thermal throttling and frequency scaling (see github commits for details, too many changes to list here)

Merged Code Aurora HSIC patches that hopefully will reduce duration of the infamous wakelock (and revert of prior trial workaround)

Added optimized ARM RWSEM algorithm

SMP patches from 3.5 that address hotplug efficiency and lay the foundation for other future patches I am studying.

Some other minor patches and changes (see github)

Stock/AOSP with init.d support: View attachment 1604553

-or-

CM 10.1: View attachment 1604557

Exp build 8 - initial release

Same base features as build 57 mainline

ARM auto hotplug v0.220 by _thalamus

Custom PowerHAL (chatter-free Android log)

Interactive (default) - with input boost

MSM-thermal in-kernel solution

thermald and mpdecision are disabled (services are not started in the ramdisk)

Inert PowerHAL library

This is a shell PowerHAL library that allows Android to function and stops the input boostpulse requests

(same as included in b8 and b10 Exp kernels).It was originally released for testing b12, but can be used in other builds. Personally, I would only flash the "inert PowerHAL" if you are using OnDemand full-time and no longer using interactive (set on boot), OR if you are using interactive and want to completely remove the boostpulse requests coming from Android. In the later case, UI performance may be sacrificed a bit for better battery.

View attachment 1642928

Mirror site - thanks tlongren! - will typically be updated within a day after I post

http://www.longren.org/nexus4/motley

Git repo:

https://github.com/motley-git/kernel-Nexus4

(http://www.gnu.org/copyleft/gpl.html)