msm: thermal: Update to speed up bootup time

Update KTM driver to remove flush_scheduled_work that
would introduce bootup delay. This patch replaces
cancel_delayed_work with cancel_delayed_work_sync
to cancel a delayed work.

CRs-Fixed: 647439
Change-Id: Ie81278ca3a7a58f8f46463f7149b512bd07cbcbc
Signed-off-by: Shiju Mathew <shijum@codeaurora.org>

Conflicts:
	drivers/thermal/msm_thermal.c
softirq: reduce latencies

Date	Thu, 03 Jan 2013 23:49:40 -0800

In various network workloads, __do_softirq() latencies can be up
to 20 ms if HZ=1000, and 200 ms if HZ=100.

This is because we iterate 10 times in the softirq dispatcher,
and some actions can consume a lot of cycles.

This patch changes the fallback to ksoftirqd condition to :

- A time limit of 2 ms.
- need_resched() being set on current task

When one of this condition is met, we wakeup ksoftirqd for further
softirq processing if we still have pending softirqs.

Using need_resched() as the only condition can trigger RCU stalls,
as we can keep BH disabled for too long.

I ran several benchmarks and got no significant difference in
throughput, but a very significant reduction of latencies (one order
of magnitude) :

In following bench, 200 antagonist "netperf -t TCP_RR" are started in
background, using all available cpus.

Then we start one "netperf -t TCP_RR", bound to the cpu handling the NIC
IRQ (hard+soft)

Before patch :

RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
RT_LATENCY=550110.424
MIN_LATENCY=146858
MAX_LATENCY=997109
P50_LATENCY=305000
P90_LATENCY=550000
P99_LATENCY=710000
MEAN_LATENCY=376989.12
STDDEV_LATENCY=184046.92
After patch :

RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
RT_LATENCY=40545.492
MIN_LATENCY=9834
MAX_LATENCY=78366
P50_LATENCY=33583
P90_LATENCY=59000
P99_LATENCY=69000
MEAN_LATENCY=38364.67
STDDEV_LATENCY=12865.26

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Miller <davem@davemloft.net>
Cc: Tom Herbert <therbert@google.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	kernel/softirq.c

Conflicts:

	kernel/softirq.c
sec_battery: Remove vbus_present wakelock

The vbus_present wakelock prevents the phone from going into deep sleep when the charger is connected; however, after charging the device with a cable type 6 (unknown cable type) charger, the wakelock is not destroyed after the cable is disconnected and instead remains, draining battery. The Nexus 5 goes into deep sleep while charging, so it's safe to assume that the vbus_present wakelock is unnecessary and can be removed completely.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
drivers: power: Increase AC max current from 900mA to 1200mA+

Signed-off-by: Sultanxda <sultanxda@gmail.com>
smb328a_charger: Remove CHG_MODE_UNKNOWN

CHG_MODE_UNKNOWN is detected as CHG_MODE_AC instead.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
drivers: power: Enable 1200mA+ max charge current over USB

Signed-off-by: Sultanxda <sultanxda@gmail.com>
sec_battery: Allow high-speed charging over USB up until 95% battery

Previously, high-speed charging over USB would stop at 90%, at which point the charging current would be lowered to 500mA.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
sec_battery: Use AC charging for unknown cable types

Unknown cable types are charger type 6. This fixes the very annoying issue described in this thread: http://forum.xda-developers.com/showthread.php?t=1759541

Signed-off-by: Sultanxda <sultanxda@gmail.com>
drivers: power: Determine charge mode from actual cable type

CHG_MODE_UNKNOWN is now detected as CHG_MODE_AC, so remove it.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
Defconfig: Allow CPU Alignement

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>