CHROMIUM: iwl7000: add back support for low-priority scan

The low-priority scan feature can be useful, e.g. for OBSS
scans (if those are required by the AP); add back support
for it, restoring the maximum out time to the value it was
for low-priority scan before that was removed.

BUG=chrome-os-partner:28976
TEST=run chrome wpa_supplicant with OBSS scan (or OBSS scan test)

Change-Id: Id08a53c68158883e512ab553e1e532786f589418
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/202646
Reviewed-by: Paul Stewart <pstew@chromium.org>
CHERRY-PICK: Revert "Bluetooth: Enable autosuspend for Intel Bluetooth device"

This reverts commit d2bee8fb6e18f6116aada39851918473761f7ab1.

Enabling autosuspend for Intel Bluetooth devices has been shown to not
work reliable. It does work for some people with certain combinations
of USB host controllers, but for others it puts the device to sleep and
it will not wake up for any event.

These events can be important ones like HCI Inquiry Complete or HCI
Connection Request. The events will arrive as soon as you poke the
device with a new command, but that is not something we can do in
these cases.

Initially there were patches to the xHCI USB controller that fixed
this for some people, but not for all. This could be well a problem
somewhere in the USB subsystem or in the USB host controllers or
just plain a hardware issue somewhere. At this moment we just do
not know and the only safe action is to revert this patch.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Tedd Ho-Jeong An <tedd.an@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
BUG=chromium:383984
TEST=emerge, test_that suite:bluetooth

Change-Id: Ic659a4c239471ccae3221f5e4662dcfd74ebc34f
Reviewed-on: https://chromium-review.googlesource.com/203753
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
CHERRY-PICK: Bluetooth: Fix triggering BR/EDR L2CAP Connect too early

Commit 1c2e004183178 introduced an event handler for the encryption key
refresh complete event with the intent of fixing some LE/SMP cases.
However, this event is shared with BR/EDR and there we actually want to
act only on the auth_complete event (which comes after the key refresh).

If we do not do this we may trigger an L2CAP Connect Request too early
and cause the remote side to return a security block error.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
BUG=chromium:383984
TEST=emerge, test_that suite:bluetooth

Change-Id: Iafb93b6e5aa385e4c4a0e3ec26b53ebcf80d25f1
Reviewed-on: https://chromium-review.googlesource.com/203754
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
CHERRY-PICK: Bluetooth: Fix redundant encryption request for reauthentication

When we're performing reauthentication (in order to elevate the
security level from an unauthenticated key to an authenticated one) we
do not need to issue any encryption command once authentication
completes. Since the trigger for the encryption HCI command is the
ENCRYPT_PEND flag this flag should not be set in this scenario.
Instead, the REAUTH_PEND flag takes care of all necessary steps for
reauthentication.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
BUG=chromium:383984
TEST=emerge, test_that suite:bluetooth

Change-Id: I4c5c0f0c626249c132d5782ccc960c72c234e796
Reviewed-on: https://chromium-review.googlesource.com/203755
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
CHERRY-PICK: Bluetooth: Fix L2CAP LE debugfs entries permissions

0466 was probably meant to be 0644, there's no reason why everyone
except root could write there.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
BUG=chromium:383984
TEST=emerge, test_that suite:bluetooth

Change-Id: Ic534fe19a7510ccbc3bd0503731ed7c0aaf0aa21
Reviewed-on: https://chromium-review.googlesource.com/203756
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
CHERRY-PICK: Bluetooth: Fix indicating discovery state when canceling inquiry

When inquiry is canceled through the HCI_Cancel_Inquiry command there is
no Inquiry Complete event generated. Instead, all we get is the command
complete for the HCI_Inquiry_Cancel command. This means that we must
call the hci_discovery_set_state() function from the respective command
complete handler in order to ensure that user space knows the correct
discovery state.

BUG=chrome-os-partner:26547
TEST=Enable and disable the BT device multiple times

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(cherry picked from commit 3c7f175ad7898fbeceadb2787847e23a975ebd62)
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>

Change-Id: Ib16f44acbb654b6c7847e69a6abaa8f532ffd39b
Reviewed-on: https://chromium-review.googlesource.com/203530
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Commit-Queue: Tedd An <tedd.an@intel.com>
Tested-by: Tedd An <tedd.an@intel.com>
CHERRY-PICK: Bluetooth: Refactor discovery stopping into its own function

We'll need to reuse the same logic for stopping discovery also when
cleaning up HCI state when powering off. This patch refactors the code
out to its own function that can later (in a subsequent patch) be used
also for the power off case.

BUG=chrome-os-partner:26547
TEST=Enable and disable the BT device multiple times

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(cherry picked from commit 1bd745cde75ea0f7cfde7c741f38e53052f58e95)
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>

Change-Id: I231dd8010868249d1015ea17d2036eb42db4f850
Reviewed-on: https://chromium-review.googlesource.com/203531
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Tested-by: Tedd An <tedd.an@intel.com>
CHERRY-PICK: Bluetooth: Reuse hci_stop_discovery function when cleaning up HCI state

When cleaning up the HCI state as part of the power-off procedure we can
reuse the hci_stop_discovery() function instead of explicitly sending
HCI command related to discovery. The added benefit of this is that it
takes care of canceling name resolving and inquiry which were not
previously covered by the code.

BUG=chrome-os-partner:26547
TEST=Enable and disable the BT device multiple times

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(cherry picked from commit 986603b8949d4347717105556f774f956d8fc605)
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>

Change-Id: Ib2e1399280b9db86997df7612cdc9e114e06c76e
Reviewed-on: https://chromium-review.googlesource.com/203532
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Tested-by: Tedd An <tedd.an@intel.com>
CHROMIUM: s5p-mfc: Don't change the image size to smaller than the request.

Use the requested size as the minimum bound, unless it's less than the
required hardware minimum. The bound align function will align to the
closest value but we do not want to adjust below the requested size.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>

BUG=chromium:381444
TEST=webrtc call and VEA unittest.

Change-Id: I1c70447b9be4e09095862fb828903c32fd594269
Reviewed-on: https://chromium-review.googlesource.com/203388
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Tested-by: Wu-Cheng Li <wuchengli@chromium.org>
Commit-Queue: Haixia Shi <hshi@chromium.org>
UPSTREAM: mwifiex: correct packet length for packets from SDIO interface

While receiving a packet on SDIO interface, we allocate skb with
size multiple of SDIO block size. We need to resize this skb
after RX using packet length from RX header.

Cc: <stable@vger.kernel.org>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

BUG=None
TEST="while true; do echo scanning; iw mlan0 scan | grep SSID; done"
and suspend_stress_test

Change-Id: I8eb51742f4c62fc6e4011bac0e720ff8d356727c
Reviewed-on: https://chromium-review.googlesource.com/203425
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
Tested-by: Bing Zhao <bzhao@marvell.com>
Merge branch 'chromeos-3.8' of https://chromium.googlesource.com/chromiumos/third_party/kernel into chromeos-3.8