Revert "usb fastcharge: add check for charging current > usb fastcharging current"

This reverts commit ba29253eaeada0540eb48ea048af803a10ad5cd5.
Revert "USB Force Fast charge"

This reverts commit cd64cf159fd897a6647266e63db5485cae4d3d42.
fastcharge: initial adaptation for HTC One + port to yuga

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

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
	drivers/power/pm8921-charger-htc.c

Change-Id: I642949782ff42ec35a92cebc1842ab526dd1b832

Conflicts:
	arch/arm/mach-msm/Kconfig
cpufreq: interactive & intelliactive: update

include:
cpufreq: interactive: Move definition of
cpufreq_gov_interactive downwards -
https://github.com/franciscofranco/hammerhead/commit/ddc8f382a561937aeca30cb037b492834ba67735
cpufreq:
interactive: fix compiling warnings -
https://github.com/franciscofranco/hammerhead/commit/b1a8ee23ba3dc503bee3edfb5b3257e7f88e8913
cpufreq:
interactive: fix compiling warnings -
https://github.com/franciscofranco/hammerhead/commit/3057efdb809c5df1079d11c5082ac9dc42f478dc

Conflicts:
	drivers/cpufreq/cpufreq_intelliactive.c
	drivers/cpufreq/cpufreq_interactive.c

Change-Id: Idbf894e5b96dd2d1ea28b858bcb9d8c631f247a5
Revert some changes from interactive (warnings are still fixed)

Change-Id: Ibf9c45bb6f2ebb8a867839435d8b9bf3721e70be
first some fixes

Conflicts:
	Makefile

Change-Id: I7ca2abb417b7c24ba0b42b5c86774f1feeeb8781
first some fixes - 1
USB force fast charging for Xperia Z

this patch
include:
https://github.com/faux123/htc-m7/commit/2fc85d234bd28f8a2eb76483faabd8d16a2ea0ae
https://github.com/faux123/htc-m7/commit/20c36e0338e2ff49fc72ee828c7123202a76fc6f

Conflicts:
	drivers/power/pm8921-charger-sony.c
	drivers/usb/otg/msm_otg.c

Change-Id: I24e4c1cc17e3248049a56ad5703cf3b9ce464c31
cpufreq:cpufreq_intellidemand: adaptation to Xperia Z
sched: add wait_for_completion_io[_timeout]

The only difference between wait_for_completion[_timeout]() and
wait_for_completion_io[_timeout]() is that the latter calls
io_schedule_timeout() instead of schedule_timeout() so that the caller
is accounted as waiting for IO, not just sleeping.

These functions can be used for correct iowait time accounting when the
completion struct is actually used for waiting for IO (e.g. completion
of a bio request in the block layer).

Modified to compile with 3.4.0 on the Xperia Z

idea is taken here -
https://github.com/flar2/m7-GPE/commit/0782a7b5cdf4eabde9ad0637e19e1278ec5457a7
Remove tracing

idea is taken here -
https://github.com/flar2/ElementalX-ville-6.0/commit/cb4322178a14a177b3fae560e85dff6db02ee9ec#diff-a28f9d22c41841e788e9f2a3f2d33e9eR52
sched: Remove get_online_cpus() usage

Testing/Modified for 3.4.y from upstream.

Remove get_online_cpus() usage from the scheduler; there's 4 sites that
use it:

- sched_init_smp(); where its completely superfluous since we're in
'early' boot and there simply cannot be any hotplugging.

- sched_getaffinity(); we already take a raw spinlock to protect the
task cpus_allowed mask, this disables preemption and therefore
also stabilizes cpu_online_mask as that's modified using
stop_machine. However switch to active mask for symmetry with
sched_setaffinity()/set_cpus_allowed_ptr(). We guarantee active
mask stability by inserting sync_rcu/sched() into _cpu_down.

- sched_setaffinity(); we don't appear to need get_online_cpus()
either, there's two sites where hotplug appears relevant:
* cpuset_cpus_allowed(); for the !cpuset case we use possible_mask,
for the cpuset case we hold task_lock, which is a spinlock and
thus for mainline disables preemption (might cause pain on RT).
* set_cpus_allowed_ptr(); Holds all scheduler locks and thus has
preemption properly disabled; also it already deals with hotplug
races explicitly where it releases them.

- reinit_sched_domains(); we shouldn't need to hotplug here. In fact,
this has likely been the thorn in my side, causing mpdecision to
break on sched_mc_power_savings changes.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(Modified for 3.4.y to include sched_domains())
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

idea is taken here -
https://github.com/franciscofranco/flo/commit/320492c9358d623fc7db920625b56655d8f40b28

Conflicts:
	kernel/sched/core.c

Change-Id: I04c062132ab83c868c6f2f6c2d4298002a96c926
Enable ARCH_POWER
sched: Fix select_idle_sibling() bouncing cow syndrome

If the previous CPU is cache affine and idle, select it.

The current implementation simply traverses the sd_llc domain,
taking the first idle CPU encountered, which walks buddy pairs
hand in hand over the package, inflicting excruciating pain.

1 tbench pair (worst case) in a 10 core + SMT package:

pre   15.22 MB/sec 1 procs
post 252.01 MB/sec 1 procs

Signed-off-by: Mike Galbraith <bitbucket@online.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link:
http://lkml.kernel.org/r/1359371965.5783.127.camel@marge.simpson.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: flar2 <asegaert@gmail.com>

idea is taken here -
https://github.com/flar2/m8-Sense/commit/1433dfa91557964ea386a6415c1a9135f55dcd24
sched: Fix clear NOHZ_BALANCE_KICK

I have faced a sequence where the Idle Load Balance was sometime
not
triggered for a while on my platform, in the following scenario:

CPU 0 and CPU 1 are running tasks and CPU 2 is idle

 CPU 1 kicks the
Idle Load Balance
 CPU 1 selects CPU 2 as the new Idle Load Balancer

CPU 2 sets NOHZ_BALANCE_KICK for CPU 2
 CPU 2 sends a reschedule IPI to
CPU 2

 While CPU 3 wakes up, CPU 0 or CPU 1 migrates a waking up task A
on CPU 2

 CPU 2 finally wakes up, runs task A and discards the Idle
Load Balance
       task A quickly goes back to sleep (before a tick
occurs on CPU 2)
 CPU 2 goes back to idle with NOHZ_BALANCE_KICK
set

Whenever CPU 2 will be selected as the ILB, no reschedule IPI will
be sent
because NOHZ_BALANCE_KICK is already set and no Idle Load
Balance will be
performed.

We must wait for the sched softirq to be
raised on CPU 2 thanks to another
part the kernel to come back to clear
NOHZ_BALANCE_KICK.

The proposed solution clears NOHZ_BALANCE_KICK in
schedule_ipi if
we can't raise the sched_softirq for the Idle Load
Balance.

Change since V1:

- move the clear of NOHZ_BALANCE_KICK in
got_nohz_idle_kick if the ILB
  can't run on this CPU (as suggested by
Peter)

Signed-off-by: Vincent Guittot
<vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra
<peterz@infradead.org>
Link:
http://lkml.kernel.org/r/1370419991-13870-1-git-send-email-vincent.guittot@linaro.org
Signed-off-by:
Ingo Molnar <mingo@kernel.org>
Git-commit: 873b4c6
Git-repo:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[smuckle@codeaurora.org:
minor merge resolution for 3.4 in scheduler_ipi()]
Signed-off-by: Steve
Muckle <smuckle@codeaurora.org>
Change-Id:
I3548612057cccc2ecc29429c129c44183083831f

idea is taken here -
https://github.com/jrior001/android_kernel_samsung_d2/commit/51c8bddb6812c3162a3115fb22f01b2a798d8754
block: introduce the BFQ-v7r4 I/O sched for 3.4

Add the BFQ-v7r4 I/O scheduler to 3.4.
The general structure is
borrowed
from CFQ, as much of the code for
handling I/O contexts. Over
time,
several useful features have been
ported from CFQ as well (details
in
the changelog in README.BFQ). A
(bfq_)queue is associated to each
task
doing I/O on a device, and each
time a scheduling decision has to
be
made a queue is selected and served
until it expires.

    - Slices
are
given in the service domain: tasks are assigned
      budgets,
measured
in number of sectors. Once got the disk, a task
      must
however
consume its assigned budget within a configurable
      maximum
time (by
default, the maximum possible value of the
      budgets
is
automatically computed to comply with this timeout).
      This
allows
the desired latency vs "throughput boosting" tradeoff
      to be
set.

- Budgets are scheduled according to a variant of WF2Q+,
implemented

using an augmented rb-tree to take eligibility into account
while

preserving an O(log N) overall complexity.

    - A low-latency
tunable
is provided; if enabled, both interactive
      and soft
real-time
applications are guaranteed a very low latency.

    -
Latency
guarantees are preserved also in the presence of NCQ.

    -
Also with
flash-based devices, a high throughput is achieved
      while
still
preserving latency guarantees.

    - BFQ features Early Queue
Merge
(EQM), a sort of fusion of the
      cooperating-queue-merging and
the
preemption mechanisms present
      in CFQ. EQM is in fact a
unified
mechanism that tries to get a
      sequential read pattern, and
hence a
high throughput, with any
      set of processes performing
interleaved
I/O over a contiguous
      sequence of sectors.

    - BFQ
supports
full hierarchical scheduling, exporting a cgroups

interface.
Since each node has a full scheduler, each group can
      be
assigned
its own weight.

    - If the cgroups interface is not used,
only I/O
priorities can be
      assigned to processes, with ioprio
values mapped
to weights
      with the relation weight = IOPRIO_BE_NR -
ioprio.

- ioprio classes are served in strict priority order, i.e.,
lower

priority queues are not served as long as there are
higher

priority queues.  Among queues in the same class the bandwidth
is

distributed in proportion to the weight of each queue. A very

thin
extra bandwidth is however guaranteed to the Idle class,
to

prevent it from starving.

Signed-off-by: Paolo
Valente
<paolo.valente@unimore.it>
Signed-off-by: Arianna
Avanzini
<avanzini.arianna@gmail.com>
Signed-off-by:
poondog
<markj338@gmail.com>
block, bfq: add Early Queue Merge (EQM) to BFQ-v7r4 for 3.4.0

A set of processes may happen  to  perform interleaved reads, i.e.,
requests whose union would give rise to a  sequential read  pattern. There are two typical  cases: in the first  case,   processes  read fixed-size chunks of data at a fixed distance from each other, while in the second case processes may read variable-size chunks at  variable distances. The latter case occurs for  example with  KVM, which  splits the  I/O generated  by the  guest into multiple chunks,  and lets these chunks  be served by a  pool of cooperating processes,  iteratively assigning  the  next  chunk of  I/O  to  the first available  process. CFQ  uses actual  queue merging  for the  first type of
rocesses, whereas it  uses preemption to get a sequential  read pattern out of the read requests  performed by the second type of  processes. In the end it uses  two different  mechanisms to  achieve the  same goal: boosting the throughput with interleaved I/O.

This patch introduces  Early Queue Merge (EQM), a unified mechanism to get a sequential  read pattern  with
both  types of  processes. The  main idea is checking newly arrived
requests against the next request of the active queue both in case of actual request insert and in case of request merge. By doing so, both the types of processes can be handled by just merging their queues.
EQM is  then simpler and  more compact than the  pair of mechanisms used in CFQ.

Finally, EQM  also preserves the  typical low-latency
properties of BFQ, by properly restoring the weight-raising state of  a queue when it gets back to a non-merged state.

Signed-off-by: Mauro Andreolini <mauro.andreolini@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Reviewed-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: poondog <markj338@gmail.com>
Merge remote-tracking branch 'caf/kk_2.7_rb1.41' into cm-11.0

Conflicts:
	arch/arm/kernel/perf_event.c
	kernel/events/core.c
	kernel/sched/fair.c

Change-Id: I5b14d26d6c85d44bfbcd160f2e9d6c3544386eb8

Conflicts:
	kernel/sched/fair.c
exFAT 1.2.6
Some fixes for the previous merge

Change-Id: Ief5401cc32d805905ce70c3af1f7e6c8bee77a9c