mcpm: exynos: Fix races in exynos_power_up()

There were two problems in exynos_power_up():

1. We were setting the mcpm_entry_point _after_ we powered things up.
   If there was too long of a delay here it's possible that a CPU
   might come up and look at the old entry point.

2. We were relying on the mcpm_cluster_state taking a little while to
   take effect.  When deciding whether to adjust cci settings we were
   checking whether a cluster was currently down.  However, we really
   wanted to know whether the cluster was down at the start of the
   block of code and we were just getting lucky that our powering on
   of the cluster hadn't yet taken effect.

BUG=chrome-os-partner:26867
TEST=Sprinkle udelay(1000) calls in exynos_power_up() and see that
system boots OK and suspend/resumes OK.

Change-Id: If751c6a7f232295e736e9ba1b3f1379cb6d01b7c
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190316
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: <thomas.ab@samsung.com>
Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com>
UPSTREAM: coredump: add new %P variable in core_pattern

Add a new %P variable to be used in core_pattern.  This variable contains
the global PID (PID in the init namespace) as %p contains the PID in the
current namespace which isn't always what we want.

The main use for this is to make it easier to handle crashes that happened
within a container.  With that new variables it's possible to have the
crashes dumped into the container or forwarded to the host with the right
PID (from the host's point of view).

BUG=chromium:351568
TEST=`cbuildbot link-release` passes

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Reported-by: Hans Feldt <hans.feldt@ericsson.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit 65aafb1e7484b7434a0c1d4c593191ebe5776a2f)

Change-Id: I3521e781c226c9fb73b16be6f207fd0dcece9229
Reviewed-on: https://chromium-review.googlesource.com/190020
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
CHROMIUM: Bluetooth: Add intel_btusb module for Intel Bluetooth device

Intel Bluetooth device (7260) requires device firmware patching before
the host send HCI initialization commands. This setup routine was added
in 3.10 kernel with a framework support from the Bluetooth subsystem
which is also introduced in 3.10 kernel.

Because the backporting this setup routine from 3.10 to 3.8 requires
also backporting Bluetooth framework change, which is significant in
the Bluetooth subsystem, it is not recommened by the Google maintainer.

Thus, intel_btusb module is forked from btusb module to have its own
device firmware setup routine without changing Bluetooth susbsystem.

Even if it is for Intel Bluetooth device, any other routines such as
submit USB urb, interrupt handling, and ISOC setup are same as btusb
module.

This is a custom patch for ChromeOS

BUG=chrome-os-partner:21770
TEST=tested with HID mouse and A2DP headset

Change-Id: Ic62d6794fb39b23db4ce31a303c04d9b5285ee8b
Reviewed-on: https://chromium-review.googlesource.com/190552
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Tedd An <tedd.an@intel.com>
Tested-by: Tedd An <tedd.an@intel.com>
drm/bridge: Use IRQF_TRIGGER_RISING in anx

TRIGGER_HIGH will cause an interrupt storm. This regressed in:

commit 3ca0b91be6addfc03576a4eaec95629822385304
Author: Ben Zhang <benzh@chromium.org>
Date:   Tue Nov 12 16:45:37 2013 -0800

    drm/anx7808: Add HDCP support in anx7808 driver

BUG=353784
TEST=by hand: boot on spring, there is no interrupt storm

Change-Id: I793892f2313393a01c4137f98b86082ce27d27e1
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190573
Reviewed-by: Ben Zhang <benzh@chromium.org>
net/usb: r8152: Remove redundant version.h header inclusion

version.h header inclusion is not necessary as detected by
checkversion.pl.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 18cf1f1270e7f01be5217203c9f46c5d88a54839)

(resubmitting since due to gerrit/git races, this was one of many
 changes that wasn't properly merged even though gerrit claimed it was.
 https://b.corp.google.com/issue?id=12963442)

BUG=chrome-os-partner:24570
TEST=manual testing with RealTek (not Samsung) USB rtl8153

Change-Id: Id40e733df02545ae34287b06f51a337b04f7cc6a
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190522
r8152: replace the return value of rtl_ops_init

Replace the boolean value with the error code for the return value
of the rtl_ops_init().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 31ca1decfbc5fe86094c6c8f0a590a2c0a29fabf)

(resubmitting since due to gerrit/git races, this was one of many
 changes that wasn't properly merged even though gerrit claimed it was.
 https://b.corp.google.com/issue?id=12963442)

BUG=chrome-os-partner:24570
TEST=manual testing with RealTek (not Samsung) USB rtl8153

Change-Id: Ic9d6c063af12af04693a5f40c59f4cc44dff2428
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190523
CHROMIUM: config: enable building brcmfmac wlan driver

BUG=chrome-os-partner:27006
TEST=autotest (wifi tests)

Change-Id: Ia4fcebc1e0bb9c91d9c4d9bee4d0c069bbd49cef
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Daniel Kim <dekim@broadcom.com>
Reviewed-on: https://chromium-review.googlesource.com/190553
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Revert "ARM: fix erratum 798181 workaround for multi-cluster systems"

This reverts commit 00fd8cdaeef9a94b1824f2ef97e2209ec0ab2854.

The above commit is no longer needed with the upstream fix (UPSTREAM:
ARM: 7855/1: Add check for Cortex-A15 errata 798181 ECO).  Reverting
in preparation for the upstream fix.

Conflicts:
	arch/arm/mm/context.c
...due to <http://crosreview.com/177006>.  Resolution was obvious.

CQ-DEPEND=CL:190788
BUG=chrome-os-partner:24078
TEST=Run factory stress test.

Change-Id: Ibe393c1a1bfe6ac7c58ab58dea0d1c5eb54a74a3
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190872
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
UPSTREAM: ARM: 7855/1: Add check for Cortex-A15 errata 798181 ECO

The work-around for A15 errata 798181 is not needed if appropriate ECO
fixes have been applied to r3p2 and earlier core revisions. This can be
checked by reading REVIDR register bits 4 and 9. If only bit 4 is set,
then the IPI broadcast can be skipped.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

(cherry-picked from commit 92871b94a5f9892e324c31960678387922c75049)
[arjun resolved merge conflicts]

BUG=chrome-os-partner:24078
TEST=Run factory stress test.

Change-Id: I6796b22f634b40fd0d70d7ee5725ba1c27782041
Signed-off-by: Arjun.K.V <arjun.kv@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190788
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
UPSTREAM: mwifiex: abort scan while cancelling pending command

mwifiex_cancel_pending_ioctl() and
mwifiex_cancel_all_pending_cmd() are called in command timeout
and driver unload paths respectively.
If scan operation is in progress, we should abort it smoothly.

Reported-by: Tim Shepard <shep@alum.mit.edu>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

BUG=chrome-os-partner:26626
TEST=run "./reload_network_device.sh mlan0; sleep 30" in a loop
for 50 times.

Change-Id: I44de2acf0d0cb7f72fbda45bd68037b9a259ffa8
Reviewed-on: https://chromium-review.googlesource.com/190810
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Reviewed-by: hyuckjoo lee <hyuckjoolee345@gmail.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
ARM: Add ISB and DSB according to erratum 799270

As per erratum 799270, add isb and dsb after inserting
the dummy load.

BUG=chrome-os-partner:24078
TEST=Run factory stress test on pi/t.

Change-Id: I793e699205dfae85c16f8f423941d3a7880a8048
Signed-off-by: Arjun.K.V <arjun.kv@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/190789
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
CHROMIUM: TPM: log "gentle shutdown" notice on all platforms.

We logged this on x86 only, thus making kernel_TPMPing fail on ARM.

BUG=chromium:351054
TEST=none
BRANCH=none
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>

Change-Id: I0dab38bd87e6d925bda6b5302b8f8b1014e84a75
Reviewed-on: https://chromium-review.googlesource.com/189449
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Revert "drm/bridge: Use IRQF_TRIGGER_RISING in anx"

This reverts commit 64e7e14aba2b7fd0d9afcde298af2e087b500801.

Vincent, who knew where to find the EVT schematics, told me that the
pullup on EVT was wrong. So this is a hardware issue; I've replaced
the machine with an MP and things are fine now.

BUG=chromium:353784
TEST=by hand on a non-EVT machine: no irq storm

Change-Id: I9c0dba85ebbac87d62b9d530c65c64c7ec5ebc11
Reviewed-on: https://chromium-review.googlesource.com/190873
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ben Zhang <benzh@chromium.org>
Commit-Queue: Ben Zhang <benzh@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
UPSTREAM: mwifiex: scan command preparation failure handling

When scan request is received, scan commands are prepared and
queued into scan pending queue. There is a corner case when
command nodes are full. So we stop queueing further scan
commands and return an error. This patch makes sure that
currently queued commands in scan pending queue are also freed
in this case.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

BUG=chrome-os-partner:26770,26916
TEST=run "suspend_stress_test" overnight and confirm no msgs
"GET_CMD_NODE: cmd node not available" in /var/log/messages.

Change-Id: Ib61533ebb9636fb77731981005f90f43cec846a7
Reviewed-on: https://chromium-review.googlesource.com/191024
Reviewed-by: hyuckjoo lee <hyuckjoolee345@gmail.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
UPSTREAM: mwifiex: cancel pending commands for signal

When a thread is interrupted by signal, all
wait_event_interruptible calls after queueing commands return
an error. Numbers of commands in pending queue are increased
in this case. Sometimes all commands nodes in pool are filled.

We will cancel pending commands when signal is received.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

BUG=chrome-os-partner:26770,26916
TEST=run "suspend_stress_test" overnight and confirm no msgs
"GET_CMD_NODE: cmd node not available" in /var/log/messages.

Change-Id: I04841c7991e570b269bde55485a13f0ada97afdc
Reviewed-on: https://chromium-review.googlesource.com/191025
Reviewed-by: hyuckjoo lee <hyuckjoolee345@gmail.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
UPSTREAM: mwifiex: use timeout variant for wait_event_interruptible

It has been observed that system hangs during suspend, if host
sleep activation fails due to a missing interrupt from firmware.
Use timeout variant, so that the thread will be woken up when
timer expires.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

BUG=chrome-os-partner:26770,26781,26916
TEST=run "suspend_stress_test" overnight and confirm no msgs
"GET_CMD_NODE: cmd node not available" in /var/log/messages.
There could be "cmd_wait_q terminated: -512" logs but they
should not cause system hang.

Change-Id: I50f3868fe6bf3c715fd7f185b54383eb22d804f2
Reviewed-on: https://chromium-review.googlesource.com/191026
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
CHROMIUM: USB: cdc: add MBIM extended functional descriptor structure

This patch adds the MBIM extended functional descriptor structure
defined in "Universal Serial Bus Communications Class Subclass
Specification for Mobile Broadband Interface Model, Revision 1.0,
Errata-1" published by USB-IF.

BUG=chromium:352858
TEST=`emerge-$BOARD chromeos-kernel-next`

Change-Id: I91395e530b97835d6ea4ece0ec1590de86de1c6b
Signed-off-by: Ben Chan <benchan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190125
Reviewed-by: Paul Stewart <pstew@chromium.org>
CHROMIUM: net: cdc_ncm: respect operator preferred MTU reported by MBIM

According to "Universal Serial Bus Communications Class Subclass
Specification for Mobile Broadband Interface Model, Revision 1.0,
Errata-1" published by USB-IF, the wMTU field of the MBIM extended
functional descriptor indicates the operator preferred MTU for IP data
streams.

This patch modifies cdc_ncm_setup to ensure that the MTU value set on
the usbnet device does not exceed the operator preferred MTU indicated
by wMTU if the MBIM device exposes a MBIM extended functional
descriptor.

BUG=chromium:352858
TEST=Tested the following:
1. `emerge-$BOARD chromeos-kernel-next`
2. Verify that a MBIM modem without a MBIM extended functional
   descriptor still functions correctly. Use ModemManager to connect the
   modem to a network and verify IP connectivity.
3. Verify that /sys/class/net/wwan0/mtu is set to the value of the wMTU
   field of a MBIM extended functional descriptor exposed by a MBIM
   modem. Use ModemManager to connect the modem to a network and verify
   IP connectivity.

Change-Id: I1a21898f8ff33118fb1c1d57b56c6c92d3987729
Signed-off-by: Ben Chan <benchan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190126
Reviewed-by: Paul Stewart <pstew@chromium.org>
Revert "HID: multitouch: add support for IDSPULSE PulseIR touchscreen"

This reverts commit 424ec0101989d783692d178cbce419c3a76ff725.

It turns out the RNDPLUS PulseIR touchscreen does not need any special
handling in the kernel driver. It only needs to be configured through
utility program first and will just work with CrOS.

BUG=chromium:338823
TEST=None.

Change-Id: I7190cbece0125f226d993d078b89e7758a668745
Signed-off-by: Yufeng Shen <miletus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190920
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
drm/anx7808: Increase delay at the end of power_off

This increases the delay at the end of the power_off routine to ensure
the value of the cable_det gpio is valid when we exit. The gpio bounces
as a result of powering down the chip, so waiting 25ms ensures that it's in
steady state.

BUG=chromium:351844
TEST=Tested on spring by entering/exiting docked mode repeatedly

Change-Id: Iad2efec2e8d4a8c722a8b7539fce006c3a9cb4dd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190494
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>