msm: kgsl: Resolve a potential race in the interrupt handler

In the GPU interrupt handler we attempt to clear the ts_cmp_enable
for the active context so that future interrupts are skipped until
someone needs one again. If for some reason the interrupt handler
is delayed then there is a possiblity that the "current" context in
the GPU isn't the one that fired the interrupt. In that case we
could be accidently clearing a ts_cmp_enable for a context that
needs it. Instead of clearing in the interrupt handler clear it
from the GPU so we can be sure we got the right context.

As a bonus pushing this logic to the GPU side lets us get rid of
some extra register reads/writes in the interrupt handlers.

Change-Id: I3cb3d1a3c626d0594e55bff4535990c1402764fa
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Check the current interrupt status before power operations

Sometimes the core will go idle before the interrupt can be handled on
the GPU. If that happens then we could go to a lower power state before
cleaning up the pending interrupt and various entities that might be
waiting for it. Consider the current interrupt status when checking
for idle.

Change-Id: Idd43e56e0162a522e0929df83531aff94beadc19
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
drivers: i2c: allow isl29028 recalibration

Change-Id: I24caf36a1921a3a4f9d5327511539554d7691fb4
USB: gadget: Kconfig: Change Max VBUS power usage default value

Currently the VBUS Max power usage is set to default value of 2.
Change this value to default of 500 to honour the code that uses
CONFIG_USB_GADGET_VBUS_DRAW to set the bMaxPower.

Change-Id: If27b422c23ad2a010744f9660cc0b376d02649df
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
scripts/Kbuild.include: Fix portability problem of "echo -e"

"echo -e" is a GNU extension. When cross-compiling the kernel on a
BSD-like operating system (Mac OS X in my case), this doesn't work.

One could install a GNU version of echo, put that in the $PATH before
the system echo and use "/usr/bin/env echo", but the solution with
printf is simpler.

Since it is no disadvantage on Linux, I hope that gets accepted even if
cross-compiling the Linux kernel on another Unix operating system is
quite a rare use case.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Andreas Bießmann <andreas@biessmann.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Change-Id: I6bf4c4ad3aedf880749ccdff738c951ab579cb27
remove HTC_NETWORK_MODIFY

Change-Id: Id3bd3183687d56352d43dcc0981d1e94b6c1bb1a
switch: add timestamps to switch driver

Change-Id: Iac5b5279f45fcc6e506d801cb5e9d6d2f6f6f9fa
Signed-off-by: Erik Gilling <konkers@android.com>
qdsp5v2: add support for two way call recording

Change-Id: Ie6fd1ebf22bc8285bcd044fd34cdd8e1a6c982fa
Glacier: Cleanup board files

Change-Id: Ib0daf3d202eff3db5f591200ba0d3bae1a069472
Glacier: set out_strength in pm8058_gpios_init

Change-Id: I9660d9d1ec34ec47eb0027f0a7684e00887daa06
qup_i2c: Calculate combined write length for multiple write transactions

When a transaction consists of multiple write requests, add up the total
length of the write requests.  If there is a read following the writes,
set the read mode appropriately.

Change-Id: I0c15e14fa4732e4e25f5bb885688662a066b8782
Signed-off-by: Kenneth Heitke <kheitke@codeaurora.org>
qup_i2c: Fix for multiple write transactions

When a transaction consists of multiple write requests, combine them
only when the addresses of the writes are the same.

Change-Id: I35089d7b3936acf2de28f075734da84069b83fb3
Signed-off-by: Harini Jayaraman <harinij@codeaurora.org>
qup_i2c: Recovery mechanism for GSBI when slave pulls line low

If slave pulls one of the I2C lines low,I2C bus may lock out
failing I2C transactions for all slaves on the GSBI.
Recovery mechanism is added to recover the I2C lines when this
happens. Also, we allow clients to retry when a connection error
is returned.

Change-Id: I12675d828d0880ded292724416b5407427cdf73c
Signed-off-by: Harini Jayaraman <harinij@codeaurora.org>
qup_i2c: Enabling CORE_ON_EN bit while disabling the QuPE PCLKs

To disable the GSBI QuPE PCLKs it is important to enable
the CORE_ON_EN bit for some targets like 7x27a.

CRs-Fixed: 302634
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
(cherry picked from commit f0274f1eee416ac0e363e3dfd74c231722673fd1)

Change-Id: I4848a2f2d0eaae5787bdb6614a100011b45db2cb
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
cpuidle: governor: menu: don't use loadavg

get_loadavg doesn't work as intended.  According to the comments, it
should be returning an average over a few seconds, but it is actually
reading the instantaneous load.  It is almost always returning 0, but
can sometimes, depending on workload, spike very high into the hundreds
even when the average cpu load is under 10%.  Disable it for now.

Change-Id: I63ed100af1cf9463549939b8113ed83676db5f86
Signed-off-by: Colin Cross <ccross@android.com>
cpuidle: menu: Remove the unused get_loadavg function

The fuction get_loadavg was unused and this also caused
a warning during build. This change also removes it from
the allowed warnings white-list.

Change-Id: I85b184e1eb0ab8b3cf763cab87a30e140d00332b
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
ARM: smp: Fix cpu_up() racing with sys_reboot

Nothing stops a process from hotplugging in a CPU concurrently
with a sys_reboot() call. In such a situation we could have
ipi_cpu_stop() mark a cpu as 'offline' and _cpu_up() ignore the
fact that the CPU is not really offline and call the
CPU_UP_PREPARE notifier. When this happens stop_machine code will
complain that the cpu thread already exists and BUG_ON().

CPU0                      CPU1

sys_reboot()
 kernel_restart()
  machine_restart()
   machine_shutdown()
    smp_send_stop()
    ...                   ipi_cpu_stop()
                           set_cpu_online(1, false)
                            local_irq_disable()
                             while(1)
    <PREEMPT>
cpu_up()
 _cpu_up()
   if (!cpu_online(1))
    __cpu_notify(CPU_UP_PREPARE...)

cpu_stop_cpu_callback()
  BUG_ON(stopper->thread)

This is easily reproducible by hotplugging in and out in a tight
loop while also rebooting.

Since the CPU is not really offline and hasn't gone through the
proper steps to be marked as such, let's mark the CPU as inactive.
This is just as easily testable as online and avoids any possibility
of _cpu_up() trying to bring the CPU back online when it never was
offline to begin with.

Change-Id: Ia1daea407220578d4212ef6c65c4be837ca370fd
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
qup_i2c: remove TEST_RECOVERY

Change-Id: I54a009ee268a7e1073e52ffc072a57363d52ebf9
i2c: msm: modify I2C msm driver code to use new clock APIs

Replace the existing clock APIs in I2C msm driver
with new APIs.

CRs-Fixed: 366705
Change-Id: I7661c6a9218f37f5cb694e1e3801daeef46fc74c
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
usb: gadget: composite: Fix corruption when changing configuration

Remove the config from the configs list before releasing the spinlock.
Otherwise the other cpu might be processing a SET_CONFIGURATION that
will switch to the configuration that is being released.

Change-Id: Id4da0d0e18ead63e20cb236cd1d3e8e6d116acce
Signed-off-by: Benoit Goby <benoit@android.com>