drm/anx7808: Properly disable/re-enable hdcp on unplug

This patch disables and re-enables HDCP when the HDMI cable is
unplugged and re-plugged. To achieve this with the anx7808's warts, we
disable the upstream encoder's hdcp on disable, and then re-enable it
after a delay on enable. The reason we need a delay on re-enable is b/c
it seems the bridge doesn't like it when HDCP is enabled too close to power
on.

BUG=chromium:389282
TEST=Tested on spring, enable HDCP then unplug HDMI and replug

Change-Id: I2ea611fab2b504f25ff2f542f8715a6f6da374ba
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206025
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
UPSTREAM: Bluetooth: btmrvl: wait for HOST_SLEEP_ENABLE event in suspend

After BT_CMD_HOST_SLEEP_ENABLE command finishes, driver should
wait until getting BT_EVENT_HOST_SLEEP_ENABLE event to complete
suspend procedure.
Without this patch the suspend handler would return success
earlier. By the time when the BT_EVENT_HOST_SLEEP_ENABLE event
comes in the controller driver could have already turned off the
bus clock. This causes kernel crash or system reboot eventually.

Cc: <stable@vger.kernel.org> # 3.13+
Signed-off-by: Chin-Ran Lo <crlo@marvell.com>
Signed-off-by: Jeff CF Chen <jeffc@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

BUG=chrome-os-partner:29565,chrome-os-partner:28553,chrome-os-partner:25091
TEST=WLAN connected to AP; BT running A2DP; suspend_stress_test.
Unit test passed overnight.
Based on ODM's test result, 10 out of 13 passed 600 iterations.
It used to fail on every unit.
Without this patch, the current in suspend mode was 7.1mA,
deep sleep 2.2mA. With this patch applied, the current in suspend
mode drops to 2.2mA, same as in deep sleep mode.

Change-Id: I985278c460e3dfe1ceaa8b2a1233d0bfd8c0dd4a
Reviewed-on: https://chromium-review.googlesource.com/206342
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
drm,MALI: fix race conditions and reservation_cb cleanup

Fix race condition in reservation_cb worker, it should signal the completion
after cleaning up internal data structures, not before.

Call drm_reservation_cb_fini in Mali driver when signaling fence. When contexts
and katoms are zapped they may be destroyed before reservation_cb worker is
called and it could result in the worker accessing freed memory.

BUG=chromium:393290
TEST=run graphics_GLMark2 on daisy 10 times

Change-Id: I1d093e83fc477f7dd48082a3fd2405880753ac3c
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207991
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Revert "CHROMIUM: config: enable reservation and fence sync for Exynos and Mali"

This reverts commit 6d75fd98a5c74b5dd0501463af5b765043b4ba24.
BUG=chromium:393290
TEST=run graphics_GLMark2 on Daisy 10 times.

Change-Id: Ifc147a4808ac02803c0d9c74eaa0812ce9f2a705
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207983
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
drm/exynos: Always setup the primary plane

In the new world of atomic modeset, the primary plane isn't enabled by
default when we set a mode. This breaks a number of things, in
particular framebuffer (which in turn breaks the splash screen and the
recovery install screen).

To fix this, we always enable the primary plane on modeset by calling
update_plane() from commit(). This is limiting the API a bit since
this always forces the primary plane to be enabled, but ensures
compatibility with old user space and framebuffer.

BUG=chromium:390147
TEST=boot on daisy, see a framebuffer

Change-Id: I3e4d522ac5d16b2d38d8031fdb42ae65558f965f
Reviewed-on: https://chromium-review.googlesource.com/207708
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
UPSTREAM: HID: Add some missing HUT mappings

Add mapping for "AL Next Task/Application", "AL Previous Task/Application"
and "AL File Browser" buttons, as found on the Microsoft Office keyboard.

Note that there already is a mapping for "AL Local Machine Browser" to
KEY_FILE. Unless we ever encounter a device with both that should not be
a problem.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

(cherry picked from commit 5820e4d4ae17c0994c93d0537bd1a184267f3cae)
BUG=chromium:389558
TEST=none

Change-Id: I8fb5b16384bfb0f623b18ee9d0b3ba198b5ce3e3
Reviewed-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Commit-Queue: Nestor Lopez Casado <nlopezcasad@logitech.com>
Tested-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Reviewed-on: https://chromium-review.googlesource.com/207790
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
UPSTREAM: HID: add missing hid usages

Add some missing hid usages from consumer page, add
some display brightness control usages from approved hid usage
table request HUTTR41:
http://www.usb.org/developers/hidpage/HUTRR41.pdf
and add voice command usage from approved request HUTTR45:
http://www.usb.org/developers/hidpage/Voice_Command_Usage.pdf

[jkosina@suse.cz: removed KEY_BRIGHTNESS_TOGGLE / KEY_DISPLAYTOGGLE
 conflict from hid-debug.c]

Signed-off-by: Olivier Gay <ogay@logitech.com>
Signed-off-by: Mathieu Meisser <mmeisser@logitech.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

(cherry-picked from commit f362e690e5530dd8ace289da991bda558731678e)
BUG=chromium:389558
TEST=compiles

Change-Id: I8ffd98e2f5ea927aaebcd7c5d6d762b951e9c590
Reviewed-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Commit-Queue: Nestor Lopez Casado <nlopezcasad@logitech.com>
Tested-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Reviewed-on: https://chromium-review.googlesource.com/207791
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Merge branch 'chromeos-3.8' of https://chromium.googlesource.com/chromiumos/third_party/kernel into chromeos-3.8
drm/exynos: turn DPMS on in set_base

set_base is called from drm_crtc_helper_set_config when display width, height
and bpp is the same, so we set DPMS on like in regular mode set.

BUG=chromium:392397
TEST=wait for suspend, after resume there should be no "Dear monitor..."\
notification nor mode set errors in /var/log/Xorg.0.log

Change-Id: Ia5a27bc1b71018028d7072b86f85a9b563635ae0
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207472
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
CHROMIUM: Bluetooth: btmrvl: avoid sending data to firmware after hs_activated

We should suspend hci device and purge remaining data in tx queue
before enabling host sleep in firmware. If any data is sent to
firmware after host sleep is activated, firmware may end up
sending a TX_DONE interrupt to driver. If this interrupt gets
delivered to host while the SDIO host controller is suspending,
it may crash the system.

Conversely, in resume handler, we should resume hci device after
host sleep is de-activated.

Signed-off-by: Chin-Ran Lo <crlo@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

BUG=chrome-os-partner:28553
TEST=WLAN connected to AP; BT running A2DP; suspend_stress_test.

Change-Id: I0404e7637ffe129d9f1e3da1c209b3758fb4cebf
Reviewed-on: https://chromium-review.googlesource.com/208130
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
Tested-by: Bing Zhao <bzhao@marvell.com>
CHROMIUM: drm/exynos: fix plane position

In the previous patch, I forgot to set the x/y coordinates for the
plane, which results in scanning out from the wrong address when
coming out of DPMS. And since coming out of DPMS was broken, I didn't
notice.

BUG=none
TEST=plug an external monitor, let it dpms off, touch the keyboard, the external display scans from the right position

Change-Id: I4d6da36498dcc12ceb3f88fce3bc3c7e5db3923d
Reviewed-on: https://chromium-review.googlesource.com/208243
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: David Sodman <dsodman@chromium.org>
drm/exynos: remove completion from drm_reservation_cb

The completion was only used in one case and it is easy enough to declare
it elsewhere and signal from the callback. It was signaled and caused function,
that had drm_reservation_cb struct on stack, exit while drm_reservation_cb func
member was accessed in the worker.

BUG=chromium:393290
TEST=run graphics_GLMark2 10 times on daisy

Change-Id: I24c29dbfd5dd105947e86b0a864568fabceb5460
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208555
CHROMIUM: mwifiex: dump pcie debug registers on cmd timeout

This is helpful for debugging pcie related command timeouts,
especially when firmware is already hung (fw_dump doesn't work).

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

BUG=None
TEST=when command timeout happens check dmesg for pcie
debug register dump.

Change-Id: I84f9d6dc3beb33d96c00d4a5c42bbe59e8e5692a
Reviewed-on: https://chromium-review.googlesource.com/208832
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
UPSTREAM: mwifiex: print sleep_confirm cmd/response and power save events

Sleep Confirm command is sent separately while other commands
are handled through cmd_pending_q. Print sleep_confirm cmd and
its response as well as power save events so that we have a
clearer picture of power save handshake in driver log.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

BUG=None
TEST=enable dynamic_debug and check all added dev_dbg are printed

Change-Id: I516fd1a8dcf9213df7dc6eb24fc089c99c273c10
Reviewed-on: https://chromium-review.googlesource.com/208833
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
CHROMIUM: mwifiex: remove redundant timestamps in debug prints

We don't need wall-clock time here, and in most configurations
that care, there are already timestamps in the kernel using
CONFIG_PRINTK_TIME=y.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

BUG=None
TEST=enable dynamic_debug and dmesg shows no extra timestamps.

Change-Id: Ief27e4faa81abd0bae130c443369597aada1ad8f
Reviewed-on: https://chromium-review.googlesource.com/208834
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
Revert "Revert "CHROMIUM: config: enable reservation and fence sync for Exynos and Mali""

This reverts commit 14fe4241b05c4150cead74a9aa5ea2410a1bf5b9.

The problem that caused crbug.com/393290 was fixed so reenabling fence based
dma sync.

BUG=chromium:340541,393290
TEST=run graphics_GLMark2 on Daisy 10 times

Change-Id: Ie1c528763eae216623dfa814d38b0d2afd4b8795
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/209046
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
CHROMIUM: ASoC: max98090 - Expose HP out enable.

Expose the headphone output enables to user space.  This will allow
userspace to ensure that there is stable output before the headphones
are turned on, avoiding a pop on insertion.

BUG=chrome-os-partner:26094
TEST=plug/unplug headphones while playing silence.

Change-Id: Idfb03f54fdc90b971494d9f7418d0a8a555ef40f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191003
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/203581
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
CHROMIUM: ASoC: daisy_max98095: Register HP jack debounce time.

The headset chip runs a detection sequence when a jack is plugged.
Checking for a microphone can take 500ms in the worse case.  Enabling
audio output during that sequence can cause loud pops.  Set the
debounce time longer than the detection sequence to avoid that.

This comes from https://chromium-review.googlesource.com/#/c/198690/

BUG=chrome-os-partner:26094
TEST=play silence, plug/unplug headphones, listen for loud pop.

Change-Id: I8f013b5fd1024e42220831bcbfff7fdfef0f82e9
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/203582
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
CHROMIUM: Input: elan_i2c - Add lid event listener

The patch tries to add a LID input event filter to listen for SW_LID events
to enable/disable touchpad when LID is open/closed.

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>
BUG=chrome-os-partner:29727
TEST=Do the following on device with Elan touchpad.
 * Test normal lid-closed suspend :
  1. log in as guest
  2. close the lid, wait for suspend
  3. open the lid to resume
  4. Check that touchpad is responsive.

 * Test suspend, lid-closed, then lid-open:
  1. log in as guest
  2. wait for the suspend
  3. close the lid
  4. opend the lid to resume
  5. check that touchpad is responsive.

 * Test normal lid-open, suspend, then lid-closed:
  1. log in as guest with external DISPLAY+keyboard connected with lid-open
  2. wait for the suspend
  3. close the lid
  4. wake up the device with external keyboard
  5. ensure no stray touches from touchpad*

 * Test Docked mode, lid close-open, no suspend :
  1. log in as guest
  2. connect external display to extend monitor
  3. close the lid to enter docked mode
  4. ensure no stray touches from touchpad here*
  5. open the lid
  6. Check that touchpad is responsive.

 * Test Docked mode, lid closed, idle suspend :
  1. log in as guest
  2. connect external display and connect USB keyboard.
  3. close the lid to enter docked mode
  4. ensure no stray touches from touchpad here*
  5. from a remote shell (ssh) : powerd_dbus_suspend
  6. strike a key from usb keyboard to resume.
  7. ensure no stray touches from touchpad here*
  8. open the lid
  9. Check that touchpad is responsive.

 * Test normal lid-closed suspend with external mouse, docked mode, lid open:
  1. log in as guest
  2. connect USB keyboard.
  3. close the lid to enter suspend mode
  4. connect external display
  5. strike a key from usb keyboard to resume.
  6. ensure no stray touches from touchpad here*
  7. open the lid
  8. Check that touchpad is responsive.

  *: To check that no stray touches occur:
  a) ssh to dut.
  b) run "evtest" command.
  c) open the lid a little bit(good enough for your finger to touch the pad, but
     make sure it won't trigger lid open event.
  d) a finger touches the pad to verify that touchpad should not be responsive.

Reviewed-on: https://chromium-review.googlesource.com/205640
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>

(cherry picked from commit 646e0a5f141a5f4f3a96b0aca53cd5bf7933f668)
[bleung : picked from 3.10]
Signed-off-by: Benson Leung <bleung@chromium.org>

Change-Id: Idee243d24ab708eac4bf85e09785e34013f29611
Reviewed-on: https://chromium-review.googlesource.com/207475
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
drm/exynos: Invalidate crtc mode when powered off

This patch invalidates the crtc's current mode when we enter set_config with
the hardware powered off. This will force the crtc helper to go through a full
modeset instead of short-circuiting with mode_set_base. By doing this, we can
now remove the dpms on call from mode_set_base since that function should really
only be called with the hardware is active (since this has the effect of turning
on the crtc without the encoders/bridges powered).

BUG=None
TEST=Tested on peach-pit dpms/suspend work as expected

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