CHROMIUM: ARM: dts: blaze: update T-SKIN trip temperature

Update T-skin trip temperature to 45 Celsius.

BUG=chrome-os-partner:29744
TEST=build, download and verified by thermal test
Signed-off-by: Neil Chen <neilc@nvidia.com>

Change-Id: I6eddfd61385160f1b749824e8e31d3a8fbc5ad0f
Reviewed-on: https://chromium-review.googlesource.com/207309
Tested-by: Neil Chen <neilc@nvidia.com>
Reviewed-by: Chen Wisley <wisley.chen@quantatw.com>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: HACK: mmc: tegra: don't clock gate across suspend/resume

Sometimes the Marvell SD8897 generates a SDIO interrupt after it should
have been suspended, which will cause a hard hang if the SDIO IRQ thread
runs while the clock is gated.  Don't clock gate the SDHCI host to avoid
this hang.

Note that this only works around the hard hang issue.  If the SDIO IRQ
thread runs after the host has been suspended, there are likely to be
other issues, e.g. MMC transfers issued by the IRQ thread failing or
timing out.

BUG=chrome-os-partner:28553
TEST=10000 LP0 iterations pass

Change-Id: Icddc460332054503a26b495e7536468e4943847c
Signed-off-by: Peer Chen <pchen@nvidia.com>
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206800
(cherry picked from commit bd35685295ff5e2845029b59b6132ae548417397)
Reviewed-on: https://chromium-review.googlesource.com/206975
Tested-by: Artiste Hsu <chhsu@nvidia.com>
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
Commit-Queue: Artiste Hsu <chhsu@nvidia.com>
(cherry picked from commit 61c88ee6ec2f0b3e67cf6f3965ffdfa41456c8f8)
Reviewed-on: https://chromium-review.googlesource.com/207550
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: I0341c5a5bd938b419af68d3f1671f7c137531fd3
Reviewed-on: https://chromium-review.googlesource.com/206341
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>
(cherry picked from commit ddab6fb066da0d3e7cb8f49ef71e4329679adbf8)
Reviewed-on: https://chromium-review.googlesource.com/207541
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: dc: retry out-of-sync handler

Change the implementation of sink out-of-sync handler from the
delay worker to a blocking function. This is because the dp
driver shall block the dc enable callback until it confirms
the sink deivce is already in synchronization wtih main stream.

Sometimes re-do link training does not recover the sink device
from out-of-sync state. In this case, the dp driver will retry
and the max retry count is 3.
In addition, we will increase the delay to read SINK STATUS in
case the sink device is skipping more-than-expected frames before
it starts to receive main stream.

BUG=chrome-os-partner:30039
TEST=panels works fine and can be recoved if out-of-sync is oberved
during boot-up and hdmi hotplug test.

Change-Id: Ifb803dc555fdccfc5fd004189770119635a24848
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/206673
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
(cherry picked from commit 12d7da2ff77831523a99b0385bce3d5c20f112a5)
Reviewed-on: https://chromium-review.googlesource.com/207561
CHROMIUM: video: tegra: Do not clear PMU state on rail gate

When rail gating, we cleared all PMU status. Clear only the relevant
fields.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: Ib9bd35f7cadd0d3f0572247eacc4939a53558c78
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203605
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Mark Zhang <markz@nvidia.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 6ca5b9563f2c7d53fdb6f3d0e31dfe5e25e5663a)
Reviewed-on: https://chromium-review.googlesource.com/207490
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Add PMU sent/recvd messages to dbg log

Add debug log entries for received and sent PMU messages.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: I180cdd1480813d71f36544fdd992e3002b62deb6
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203606
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 2aaaeed00d8b3ffe6411cb2040d7f073b6da065b)
Reviewed-on: https://chromium-review.googlesource.com/207482
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Remove deferred ELPG enable

Prevent the disable ELPG routine from calling deferred re enablement of
ELPG. Remove code related to deferred ELPG enable.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: I62be0a348a45d8fc9f2a28b99e2f30444251a36b
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203607
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 4c20996f3f2c89c411689dfadbdcc6029ccc84a8)
Reviewed-on: https://chromium-review.googlesource.com/207491
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Initialize FECS explicitly on recovery

Instead of calling second phase of PMU boot sequence, initialize FECS
directly.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: I2cda45d663c177fea6e0fb8b1f787fe231c9ffb1
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203608
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Mark Zhang <markz@nvidia.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 8af7daae8ba6b670ab250a4abf79805748058942)
Reviewed-on: https://chromium-review.googlesource.com/207483
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Rewrite PMU boot-up sequence

Rewrite PMU boot sequence as a state machine. At PMU power-up send
initial messages, and reset state machine. At each reply from PMU,
do the next stage of PMU boot and set state.

As now PMU and FECS boot are independent, we need to ensure engine
idle before saving ZBC.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: I3c308f2481d16628ea933dbd27ae91202a2c3d80
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203609
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit dbab8c28c5e4005e8544ce95130a54558c888458)
Reviewed-on: https://chromium-review.googlesource.com/207552
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: fix a race in suspend sequence

There is a possible race condition between devfreq
and suspend sequence. To prevent race between scaling and gk20a
shutdown from happening, ensure devfreq is disabled before
shutting down gk20a.

BUG=chrome-os-partner:28174
TEST=System boots and LP0 stress passed 2900+ cycles

Change-Id: I5c2fe02462f193494b05a50b0e566534ec6c9c07
Signed-off-by: Daehyoung Ko <dko@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/203700
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Mark Zhang <markz@nvidia.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 42c3db7d0086811df56107fdd9c53dc47f97e6fa)
Reviewed-on: https://chromium-review.googlesource.com/207492
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Fix sched error and recovery race

Fix race between channel recovery and sched error.

BUG=chrome-os-partner:29236
TEST=emerged kernel, pass Graphic stress 24 hours

Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Change-Id: I7194d5b602f403a7c28c671ff5ce2a0f339600f4
Signed-off-by: Neil Chen <neilc@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/206966
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
(cherry picked from commit cf53de5a2a7760a1c82a29820874a7f7b6068645)
Reviewed-on: https://chromium-review.googlesource.com/207592
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: drm/edid: Update short blanking modes

This updates the list of short blanking modes:
- remove CMN panels whose min clock is 72.6MHz. We could reduce the
  blanking on those panels, but since the minimum clock is 72.6MHz,
  this is more than what fits in a single eDP lane, so no power
  savings are possible there.
- add short blanking for a bunch of other panels where this is
  possible, this usually saves ~80mW.

Note: This is a truncated version of the original CL that only removes
the CMN panels.

BUG=chrome-os-partner:29738
TEST=on swanky/glimmer/squawks check that the panel works without artifacts

Change-Id: I38d55e449f0d5e1582122a0b330d40e413d6ef51
Reviewed-on: https://chromium-review.googlesource.com/205274
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207478
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
CHROMIUM: atmel_mxt_ts: Add sysfs for requesting T19 status

T19 status can be used to differentiate the touch sensors
that are attached to the touch controller. This CL adds a
sysfs entry for
1) when written to, it requests the touch controller to report the T19 status
2) when read, it returns the latest T19 status

BUG=chrome-os-partner:29065
TEST=tested on clapper that the T19 status can be read as 0x3C, which represents
the correct touch sensor.

Change-Id: I46d9793da242b07aa03b4cb6b1eaf538319b097b
Signed-off-by: Yufeng Shen <miletus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200814
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207784
Reviewed-by: Benson Leung <bleung@chromium.org>
CHROMIUM: thermal: update cdev updated field

Set cdev->updated to false, whatever the target state is same as
current state or not.
Because if a cooling device return an error in set_cur_state
callback, we should give the cooling device a chance in the next
passive check to configure itself to the target state.

BUG=chrome-os-partner:30260
TEST=hack the trip temp of gpu-balanced to 40C and the pid
governor to return the max throttle state, then observe below
on boot:
1. without this change, thermal_cdev_update failed then no retry.
2. while with this change, succeeded after couple retries.

Change-Id: I1999b5840b8a85837f4303fae2992bfecba40a82
Signed-off-by: Ken Chang <kenc@nvidia.com>
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/207501
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit b73a27e7a1e24a9af3c44ec6821a9815aae61dd4)
Reviewed-on: https://chromium-review.googlesource.com/208790
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: thermal: tegra: return gpu throttling result

If update state failed, it would not change the cur_state.
And return the actual result for set_cur_state and let
the user space decide what to do next.

BUG=chrome-os-partner:30260
TEST=Ran WebGl Aquarium to let the GPU temp hit 60C
then hack the trip temp of gpu-balanced to 40C then reboot
the unit.
Observed tegra_gpu_set_speed_cap() failed on some
throttling states then succeeded in the next target state
which is set by the governor policy or the next passive retry.

Change-Id: I99fd71bde7a5b745ff27ecc720e0bf45afd32463
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/207299
Reviewed-by: Ken Chang <kenc@nvidia.com>
Tested-by: Ken Chang <kenc@nvidia.com>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
(cherry picked from commit af126a2b0680fbb5121a1425d035660e7aec0402)
Reviewed-on: https://chromium-review.googlesource.com/208774
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: check driver initialization before access

The tegra throttling driver might access the gk20a clk driver
before clk is initialized due to overheating when booting.
So we have to check the driver's readiness first.

BUG=chrome-os-partner:30260
TEST=None

Change-Id: I0b9461ca4e395e6428b7b2a86e676bb8c923415f
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/207320
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Ken Chang <kenc@nvidia.com>
Tested-by: Ken Chang <kenc@nvidia.com>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
(cherry picked from commit 2b92289c837727ec7fb29dd29de4b3d3186eb7ee)
Reviewed-on: https://chromium-review.googlesource.com/208791
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: elants_i2c: Add support for probing device from ACPI

This patch support function for probing ELAN I2C device from ACPI.
It configures a specific name of ELAN I2C device.
With this device name, touch driver can probe a matched device.

BUG=None
TEST=on Elan touchscreen, boot and touchscreen works.

Change-Id: I2cf4f9627c771290eafba7a170125d6b42b983e8
Signed-off-by: Paul Liang <paul.liang@emc.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/204301
Reviewed-by: Charles Mooney <charliemooney@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: James Chen <james.chen@emc.com.tw>
Tested-by: James Chen <james.chen@emc.com.tw>
Commit-Queue: Charles Mooney <charliemooney@chromium.org>
(cherry picked from commit b6d3fa3a26f62c2d3c26bb4b24b1ca21a7022733)
Reviewed-on: https://chromium-review.googlesource.com/208781
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
UPSTREAM: drm/i915: Use frame counter for intel_wait_for_vblank() on CTG

Use the same wait_for_vblank code for CTG that we use for ILK+.

Also fix the name of the frame counter register while at it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 57e22f4add51b0f42b76a6960c4a4daa71e8f832)
Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>

BUG=chrome-os-partner:28200,chrome-os-partner:24085,chrome-os-partner:25575
TEST=Manual: Boot and suspend/resume Rambi with drm.debug=0x06.
Check that there are a reduced number of vblank timeouts.

Original-Change-Id: I066d322e104ed5ad9b6573820e1b9b036c7b7f6e
Originally-reviewed-on: https://chromium-review.googlesource.com/203782
Originally-reviewed-by: Benson Leung <bleung@chromium.org>
Originally-reviewed-by: Kevin Strasser <kevin.strasser@intel.com>
Commit-Queue: Kevin Strasser <kevin.strasser@intel.com>
Tested-by: Kevin Strasser <kevin.strasser@intel.com>
(cherry picked from commit a096bed37feeb4077f7e3e8a723fd69a53a6fc7c)

Change-Id: Id466e7fd1203df84663594806f1727db633f2eba
Reviewed-on: https://chromium-review.googlesource.com/207924
Reviewed-by: Benson Leung <bleung@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
(cherry picked from commit 27f2151a3c7d2e03bda8083c39e45e0ee0ee9cd3)
Reviewed-on: https://chromium-review.googlesource.com/209312
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>