asoc: samsung: hdmi: Increase the initialization delay

This patch increases the initialization wait time in the samsung hdmi
audio driver to 3 seconds. The wait time was previously 5ms which did
not leave enough time for the hdmi video driver to debounce hotplug and
initialize the hardware.

BUG=chromium:239641
TEST=Tested on snow, hotplug transferred audio between device & monitor

Change-Id: I86f7526923d77e753d0a5546fdeafbe7ee11e1fe
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51118
Reviewed-by: Dylan Reid <dgreid@chromium.org>
UPSTREAM: perf: Treat attr.config as u64 in perf_swevent_init()

Trinity discovered that we fail to check all 64 bits of
attr.config passed by user space, resulting to out-of-bounds
access of the perf_swevent_enabled array in
sw_perf_event_destroy().

Introduced in commit b0a873ebb ("perf: Register PMU
implementations").

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: davej@redhat.com
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/1365882554-30259-1-git-send-email-tt.rantala@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

BUG=chromium:240706
TEST=link build, exploit fails

Change-Id: I69496233eb3f1b8c5411685a5c546255c6e6be38
Signed-off-by: Kees Cook <keescook@chromium.org>
[upstream commit 8176cced706b5e5d15887584150764894e94e02f]
Reviewed-on: https://gerrit.chromium.org/gerrit/51134
Reviewed-by: Julien Tinnes <jln@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
CHROMIUM: Remove "DP Hotplug" in mach-exynos.

Spring is not using the dedicated DP_HPD pin (but a vanilla GPIO)

The only difference between calling exynos_fimd_gpio_setup_24bpp() and calling
exynos_fimd_gpio_setup_24bpp() (which is actually called by the former) is the
pin muxing for DP_HPD pin (aka GPX0_7)

BUG=chrome-os-partner:16196
TEST=See that slimport driver gets through initialization.

Change-Id: I5d26228d4a3027f9669022dc3a12ead70cf202b4
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50538
CHROMIUM: drm/anx7808: Adds a skeleton driver for Analogix 7808 Chip.

Adds a driver that reads parameters from device tree, requests resources
(memory, GPIOs, regulator) from kernel.

BUG=chrome-os-partner:16196
TEST=With verbose logging, see "ANX7808 initialization successful."

Change-Id: I3b492096a776e18bec5bbb928b49c27d42b31f90
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48755
Reviewed-by: Sean Paul <seanpaul@chromium.org>
CHROMIUM: drm/anx7808: Add hardware probe.

Adds register definitions and functions to read registers.

Adds a hardware probe function that reads configuration registers to determine
whether hardware is present and responds as expected.

BUG=chrome-os-partner:16196
TEST=Run on spring with verbose logging, and observe "ANX7808 found." in logs.

Change-Id: I577bbb022e78f4a1c41be1096e740bd3a4463697
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48756
CHROMIUM: drm/anx7808: Add cable detection IRQ.

Adds a function that detects when the cable is inserted.

BUG=chrome-os-partner:16196
TEST=Run on spring with verbose logging, plug in cable, and observe
"Detected cable insertion." in the logs.

Change-Id: I9a79e8755b6d4e402bf90d0f355b83762c270969
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48757
CHROMIUM: drm/anx7808: Add Aux channel reading.

Adds register writing functions and helper functions for setting and clearing
bits.

Adds aux channel read function.

Adds DPCD read function.

Adds a code to print the firmware version of an HDMI dongle, when debugging is
on.

BUG=chrome-os-partner:16196
TEST=With verbose logging, see "ANX7730 Firmware version 0x0d."

Change-Id: I71f0778b9226685d0645234466517818330e61f3
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48861
CHROMIUM: drm/anx7808: Initialize video pipeline.

Adds routines that initialize the video pipeline, HDMI receiver and DP
transmitter, in anx7808 chip.

BUG=chrome-os-partner:16196
TEST=With verbose logging, and HDMI cable plugged into monitor, see:
"Video resolution: 2200x1125"

On the console, do "xrandr -d :0" and see:

eDP-1 connected 1366x768+0+0 0mm x 0mm
  1366x768       59.9*+
HDMI-1 connected 1920x1080+0+768 553mm x 311mm
  1920x1080      60.0*+   50.0
  1920x1080i     30.0     25.0
  1680x1050      60.0
  1440x900       59.9
  1280x720       60.0     50.0
  720x576        50.0
  720x480        59.9
  640x480        60.0

Change-Id: I583ced0a331326e8251a18ee04157de261af7849
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49560
CHROMIUM: drm/anx7808: Train link, config output.

Adds a function that manages the video pipleline through ANX7808.

Adds a timer to debounce the cable detect signal.

Adds a workqueue on which management function runs.

BUG=chrome-os-partner:16196
TEST=Plug in HDMI connector to external monitor, power up, and see video.

Change-Id: I45440b43033304e1703113ec2e949ca39ad17071
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49561
CHROMIUM: drm/anx7808: Adds a binding for anx7808.

BUG=chrome-os-partner:16196
TEST=Tested on spring, with HDMI dongle connected to 1080p and 720p monitors.

Change-Id: Ib1c42c0b8c9cb49a0823bdf4ce21ea170a09fc59
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50539
CHROMIUM: config: Configure anx7808 bridge in Exynos5.

MyDP is a system for video over USB that is used in the Spring project.
Add it to the default build for exynos5 based systems.

BUG=chrome-os-partner:16196
TEST=on Spring, plug a myDP cable, HDMI dongle, or VGA dongle and see video.

Change-Id: Iab53cb95ec3aab004c1efdd508a62504fa9dd7c5
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50540
CHROMIUM: drm/anx7808: Add anx7808 to spring.

BUG=chrome-os-partner:16196
TEST=Plug in HDMI connector to external monitor, power up, and see video.

Change-Id: Ic5c2d2b10ba40f342fe3687b4244bfc8c463d539
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50541
CHROMIUM: ALSA: ASoC: exynos hdmi - fix audio transfer on unplug

Because hotplug handling timeout was increased,
it is no longer safe to read HDMI_MODE_SEL in hdmi_audio_hotplug_func,
since HDMI might be off at that time.

This broke transferring audio to internal speakers on HDMI unplug,
since bogus value was read.

So, move the code that handles DVI plugging inside "if (plugged)",
where reading HDMI registers is safe, since it is powered on.

BUG=chromium:222145,chromium:239641
TEST=Various HDMI/DVI plug/unplug scenarios, the most complex being:
play music, plug HDMI, suspend, unplug HDMI, plug DVI, resume,
listen to sound on internal speakers.

Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Change-Id: I9d27d0e388f444756576e643e20811901c6afe85
Reviewed-on: https://gerrit.chromium.org/gerrit/51178
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: drm/anx7808: anx7808 disconnect handling

Currently, if the analogix dongle is disconnected during setup, the setup
function will get stuck.  Handle this by checking for polling error even during
connection process.

BUG=chrome-os-partner:19436
TEST=Plug in a MyDP dongle without connecting to any monitor, then disconnect.
Following that, plug in with connection to monitor.  See that connection is
established.

Change-Id: Ib531547b744d9bd8d07b933448fefc7af6158c4e
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51301
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
CHROMIUM: mfd: s5m: Enable RTC as wakeup source in suspend.

CL adds necessary power management functions to enable PMICs RTC wake
alarm as a wake source.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=chrome-os-partner:19427
TEST=manual,

rtc=`readlink /dev/rtc`
echo "+10s" > /sys/class/rtc/${rtc}/wakealarm
echo mem > /sys/power/state

Change-Id: I155ccd6f058cdf8ed362a2c128226c5904379432
Reviewed-on: https://gerrit.chromium.org/gerrit/51338
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
CHROMIUM: chromeos_acpi: Enable USB wake from S3

Enable wake from USB devices for x86. Confirmed working on link.
Should likely work on lumpy as well.

BUG=chromium:240942
TEST=Connect a USB keyboard to external USB port. Suspend device using
"powerd_suspend" or idle suspend. After the system has suspended, hit a
key on USB keyboard. The system should resume.

Signed-off-by: Sameer Nanda <snanda@chromium.org>
Change-Id: Ia06b996a67abbf7943d081bf56f01db08292ccba
Reviewed-on: https://gerrit.chromium.org/gerrit/43152
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
hid-logitech-wtp: refactoring for extensibility

Refactored the driver to allow for future devices to be added.

- Changed the initialization procedure to support multiple hidpp
  features. Each feature has methods attached to it, that take care of
  init, polling and parsing of events.
- During init, the driver selects the first available feature that is
  supported (Currently only TouchPadRawXY is supported).
- All device-specific branches are happening during the init method.
  e.q. don't send T651 to raw mode.
- TouchpadRawXY allows two different event formats. Raw or attached to
  the end of the mouse events. The init method decides which one to use.
- The data structures now reflect the data required to generate the
  output, no longer the data available from the device.
- Reordered and renamed to reflect feature-specific code and generic
  code.
BUG=chromium:240850
TEST=manually test with all 3 previously supported touchpads.

Change-Id: I24f67868aa6c26a55193a24c636f0a15a6d70e53
Signed-off-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50754
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
CHROMIUM: security: use -fstack-protector-strong

Build the kernel with -fstack-protector-strong to gain the additional
checks without the performance hit of -fstack-protector-all. This grows
the uncompressed kernel image by less than 0.16% on x86:

-rwxr-xr-x 1 keescook portage 118219343 Apr 17 12:26 /build/link/var/cache/portage/sys-kernel/chromeos-kernel/vmlinux
-rwxr-xr-x 1 keescook portage 118407919 Apr 19 15:00 /build/link/var/cache/portage/sys-kernel/chromeos-kernel/vmlinux

ARM's compressed boot code now triggers stack protection, so a static
guard was added. Since it is only doing decompression and it's been
validated by the firmware, the exposure here is very small. Once it
switches to the full kernel, random stack protection is back to normal.

BUG=chromium:233757
TEST=link and daisy build & boot

Change-Id: I512fb6444463e12a8e04428b6203a00b460a79ae
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48703
Reviewed-by: Will Drewry <wad@chromium.org>
CHROMIUM: dts: spring: Disable Exynos RTC.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=chrome-os-partner:19491
TEST=manual, boot on Spring

  - See only one rtc device
  ls -altr /dev/rtc*
  crw------- 1 root root 254, 0 May 15 11:45 /dev/rtc0
  lrwxrwxrwx 1 root root      4 May 15 11:45 /dev/rtc -> rtc0

  - See system clock set from s5m-rtc
  dmesg | grep "system clock"
  [    3.605657] s5m-rtc s5m-rtc: setting system clock to 2013-05-15 18:45:51 UTC (1368643551)

Change-Id: I14347169d6d8b5eb444ffbcdfdb0c0f065a70dcb
Reviewed-on: https://gerrit.chromium.org/gerrit/51348
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Merge branch 'chromeos-3.4' of https://git.chromium.org/git/chromiumos/third_party/kernel into chromeos-3.4