[Nexus S Android Development] _thalamus:
Update (10/09/2012):

IDLE2 v0.391 - details here.

Known issues:

Bluetooth sometimes doesn't work correctly in rare cases on some devices. I've done all I can with this. Whenever I test it, it works. So this one is going to be for the community to solve, should anyone wish to fix it.

Excessive battery drain during suspend. Unsure why this occurs, I'm investigating. It actually uses less battery if you kill suspend by holding a wakelock. This suggests to me that the device is 'pretending' to go into suspend, it *is* freezing tasks and calling wfi, but I suspect the SoC isn't being powered off, which may be a syscon issue. Time to do more TRM reading.

Update (09/09/2012):

Current version v0.390, which I'm also going to declare stable. It *may* still have minor bugs, but the blockers are definitely fixed, such as the kernel panics and lockups. The code churn is also over, as the implementation is looking good and cheap.

Development is now in this branch.

Changes here, here and here.

I also deleted a load of old crap from below.

Update (30/08/2012):

Still too busy / lazy to update the first post. Actually getting the damn thing working takes priority.

Current development is all taking place in this branch.

Current version (v0.370) highlights:

It actually saves power now after I fixed a few bugs causing stupidly low residencies.

Enabled continually. TOP block will be left on unless the screen is off, or the USB is plugged in.

CPU frequency set to 800MHz at all times whilst screen off

Tons of code re-written / refactored / deleted / reinvented.

Plenty of code comments added.

Statistics exported to /sys/kernel/debug/idle2/statistics (note the changed path) - Enable in menuconfig (CONFIG_S5P_IDLE2_STATS) (Would be better if this were disabled for 'stable' builds). I will probably remove it once IDLE2 is declared stable.

Hot path code is now cheap as chips.

IDLE / resume stuff reworked to use the S5P platform suspend code instead of specific assembly.

Blah blah blah. Probably loads more, but I forget, I've rewritten 90% of the code 2 or 3 times now, but I've learnt a lot.

Ignore the majority of the below, it's old and inaccurate. Perhaps I will update it sometime. :p

Any sensible questions regarding the code, ask in the thread.

No n00bs and no moronic questions please, think before post.

Patches and improvement suggestions are more than welcome, particularly now I think the code churn has stopped.

Credits and copyright of IDLE2 v0.3xx:

Originally, the majority was a port of code from Samsungs 2.6.32 P1000 kernel, hence Samsung retained the copyright because the changes were minor.

This is no longer the case as the current status of v0.3xx is that the vast majority of it, over 90%, is original code written by me as I have completely reworked and rewritten pretty much everything.

Describing it as a 'port' is not appropriate either, as it's not a port, it's a completely fresh implementation which has pretty much nothing in common with Samsungs LPAUDIO or Ezekeels didle, other than it achieves the same thing, arguably in a more robust and cheaper way, utilising as much common code as possible such as the platform suspend code.

IDLE2 was inspired by:

Samsungs P1000 kernel (my original port)

OMAP3/4 cpuidle

NVIDIA T2/3 cpuidle

S5PV210 TRM

There are a few portions of code in idle2.c which bear resemblance to the code in Samsungs 2.6.32 kernel, such as the defines and struct for the device checks, the memory allocation in idle2_post_init(), the gpio code in s5p_enter_idle2(), checks for activity in MMC/OneNAND et al, but the rest is entirely my work.

In short: The MMC & OneNAND activity check and the GPIO power down are Samsung code with modifications, but that is the extent of Samsung copyright.

Wilful kanging, not clearly giving proper credits and not contributing back is extremely unwelcome.

Open source is not about copying other peoples work, a principle which some developers don’t get.

The GPL was never designed for the purpose of copying code verbatim and riding on other peoples work, it was designed to allow freedom of code, a continual cycle of improvement and peer review, so consider that please and if you aren't prepared to work like that, perhaps consider the reasons why you are actually 'developing' and releasing stuff on here.