CHROMIUM: arm: exynos5420: dt: add device tree support for dwmmc

This patch adds alias names, device tree nodes for dw-mmc controller for
exynos5420 soc.

BUG=chrome-os-partner:19007
TEST=Boot kernel on SMDK5420. Boot on snow and test s2r

Change-Id: I00fdebe10497d864be8fd16f80225dd728cfbb6d
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49481
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
MALI: Wk 20 pre-release r3p0 TX011 DDK

Early release of the r3p0 versions of part TX011-SW-99002.
Includes the chromebook platform config.

BUG=chrome-os-partner:17278
TEST=After Chrome-specific changes cherry-picked. Built and ran for debug and
     release. Checked login page, general browsing and WebGL tests.

Conflicts:
	drivers/gpu/arm/t6xx/kbase/src/linux/mali_kbase_mem_linux.c

Change-Id: I2fbf0d20d45fd893e0c7b89946187b041fc53276

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: I09af6e6f593b58dba3716c8349769720c367cd3f
Reviewed-on: https://gerrit.chromium.org/gerrit/56545
MALI: Update Makefile for new KDS location

TEST=Kernel builds
BUG=chrome-os-partner:17278

Change-Id: I1ea3157a05446d06d9f7e34505a039a8941051b7

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: Ibab3e46eb9a26ce383389b095fcd285dd1dbb102
Reviewed-on: https://gerrit.chromium.org/gerrit/56546
drm/exynos: Update exynos DRM for r3p0 KDS API

BUG=chrome-os-partner:17278
TEST=Built kernel. Tested on Lucas.

Change-Id: I3d2c86f642d21d2b8bb5ef6ed3d0e393ae4f99ca
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/55945
CONFIG: MALI: Update config for r3p0 driver

BUG=chrome-os-partner:17278
TEST=Kernel builds. Tested on Lucas.

Conflicts:
	chromeos/config/armel/common.config

Change-Id: Ieaeb1da258b4e01b69e6b01317e1932fcb0ba514

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: Ia9421b8242e1195283d2ff85956ddb93c9e4418c
Reviewed-on: https://gerrit.chromium.org/gerrit/56547
CHROMIUM: MALI: remove current_euid usage

Using current_euid is deprecated because uid and gid values are stored
in struct cred as kuid_t and kgid_t types. This patch replaces current_euid()
with from_kuid(&init_user_ns, current_euid().
From Wk20 DDK release onwards this patch applies
onto mali_kbase_security.c file.

BUG=chrome-os-partner:19339
TEST=Built and booted snow board and saw login screen

Change-Id: I305164f19d6206acfefd993d571853f70edc3d40
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Shirish S <s.shirish@samsung.com>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56184
ARM: Mali: Add device tree support to wk20 release

This patch is required on top the original patch
to add DT support to mali for 13WK20 mali release

BUG=chrome-os-partner:19339
TEST=Built and booted snow board and saw login screen

[dianders: Moved dtsi change to a separate patch; removed unneeded
whitespace change]

Change-Id: I53e2314e8bc205641e676e380dbc0608dcb79bcc
Signed-off-by: Shirish S <s.shirish@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56213
CHROMIUM: dts: Change clock name for mali in 5250

WK20 mali code changes the clock name to aclk_g3d.
Changing it in the 5250 dtsi file.

BUG=chrome-os-partner:19339
TEST=Built and booted snow board and saw login screen

Change-Id: Id9220b1230d6bd0a6f2e328b76098dd3c88cee61
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56214
exynos5: config: Disable devfreq for mali wk20 port

Signed-off-by: Shirish S <s.shirish@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>

Change-Id: Ie4a1c7ed28571a9c933bf0d7df3a98ccbe793100
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56215
CHROMIUM: MALI: Don't crash when we have no context

Other places protect calls to kbase_device_trace_register_access with
if (kctx && kctx->jctx.tb)
So let's do the same here (although the kctx->jctx.tb isn't required
since it is tested again in kbase_device_trace_register_access.

BUG=chrome-os-partner:19593
TEST=can't repro, but compiles and runs

Change-Id: Ic3c2efd8c24cc7a061c32e9086d937adbff96596
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56349
CHROMIUM: drm/exynos: fb: hold struct_mutex when calling cleanup

Caller of drm_framebuffer_cleanup() must hold mode config lock.
The originally caller of exynos_drm_fb_release() may have been holding the
lock, but not the worker thread on which exynos_drm_fb_release_work_fn()
is executed.

Since we just grabbed the lock to cleanup fb, let's keep holding it
while unref'ing the fb's gems.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=none
TEST=sanity check UI; login/logout; VT-switch

Change-Id: If1e6bbf8976a55a8f9b975646679c78b6cb82940
Reviewed-on: https://gerrit.chromium.org/gerrit/56561
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
CHROMIUM: drm/exynos: hdmi: Let mixer check its own window validity

The number of mixer windows and which window is the "default" are both
mixer properties.  Therefore, just pass the zpos down to mixer instead of
processing at drm_hdmi layer.

As a side effect, window range checking becomes a bit simpler.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=none
TEST=none

Change-Id: Ib93a84f707478bbfd9726c673178c40e2f89158f
Reviewed-on: https://gerrit.chromium.org/gerrit/56010
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
BACKPORT: drm/i915: add encoder->pre_pll_enable callback

Currently we have two encoder specific bits in the common mode_set
functions:
- lvds pin pair enabling
- dp m/n setting and computation

Now the lvds stuff needs to happen before the pll is enabled. Since
that is done in the crtc_mode_set functions, we need to add a new
callback to be able to move them to the encoder code (where they
belong). The dp m/n stuff is a giant mess anyway (since it also
confuses itself with the fdi link m/n handling), so that needs to be
handled separately.

I think that we can move the pll enabling down quite a bit, which
might allow us to eventually merge encoder->pre_enable with this new
pre_pll_enable callback. But for now this will allow us to clean
things up a bit.

Note that vlv doesn't support lvds, hence we don't need to change
anything in there.

v2: Fixup commit message, both suggested from Paulo Zanoni.
- dp m/n doesn't need to happen before pll enabling
- lvds doesn't exist on vlv, hence no changes required in the vlv pll
  function.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit dafd226c4f54eded10ba43c37789a6aa20b59c32)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: Ib67b2b281709f764cd9b13af422a7bc35649434e
Reviewed-on: https://gerrit.chromium.org/gerrit/56423
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: replace ad-hoc dual-link lvds checks

... with is_dual_link_lvds introduced in

commit b03543857fd75876b96e10d4320b775e95041bb7
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Mar 20 13:07:05 2012 +0100

    drm/i915: Check VBIOS value for determining LVDS dual channel mode, too

All these checks predate this commit and have simply been overlooked.
Since we don't support switching between single-link and dual-link
modes anyway, this different checks could at best only get in the way
of refactorings, and in the worst case cause inconsistencies.

v2: Update the comment, we now have a solid way to figure out whether
we need dual-link lvds or not (falling back to vbt values as a last
resort). We still don't know how to switch between dual-link and
single link so leave that part intact. I'm not sure though whether
switching between these two modes makes any sense - we always drive
the panel at its fixed mode (with a fixed bpc) anyway ...

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit a210b028f07690c127733addbbe137e8f4cad30c)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: Ic5cff4afacc7a695c8ad7fc03f46907886c32b27
Reviewed-on: https://gerrit.chromium.org/gerrit/56424
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: move is_dual_link_lvds to intel_lvds.c

Just a prep patch to make this a property of intel_lvds. Makes more
sense, removes clutter from intel_display.c and eventually I want to
move all the encoder special cases wrt clock handling to encoders
anyway.

v2: Add an intel_ prefixe to is_dual_link_lvds since it's non-static
now.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1974cad0ee4ce84e5cb792e49c4f0d9421e0312c)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: I813d82450b14b22b120cd140e47e0eb112f3f518
Reviewed-on: https://gerrit.chromium.org/gerrit/56425
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: track is_dual_link in intel_lvds

Yeah, all users (both the clock selection special cases and the lvds
pin pair stuff) are still in common code, but this will change.

v2: Rebase on top of Jani Nikula's panel rework.

v3: Incorporate review from Paulo Zanoni:
- s/__is_dual_link_lvds/compute_is_dual_link_lvds
- kill dev_priv->lvds_val
- drop spurious whitespace change

v4: Add a debug printk to display the dual-link status, as suggested
by Paulo Zanoni in review.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> (v3)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 13c7d8703127334890c894ddab13b3a92a26580a)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: If917a489b012556cbdfeb2a1e2b0f8677cf71fc4
Reviewed-on: https://gerrit.chromium.org/gerrit/56426
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: add intel_lvds->reg

To ditch at least some of the PCH_SPLIT ? PCH_LVDS : LVDS code ...

v2: Rebase on top of Jani Nikula's panel rework.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7dec060675125f17a547950d715018a63131a437)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: I1705219dce29f439d136f5f503406dfcbeb1fc76
Reviewed-on: https://gerrit.chromium.org/gerrit/56427
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: move intel_update_lvds to intel_lvds->pre_pll_enable

A few things needed to change:
- HAS_PCH_SPLIT since ilk+ is not yet converted to this.
- s/LVDS/intel_lvds->reg/ to prep for ilk conversion
- replace the clock.p2 == 7 check with a is_dual_link check
- s/adjusted_mode/intel_lvds->fixed_mode

v2: Rebase on top of Jani Nikula's panel rework. I'm wondering whether
we shouldn't add an attached_panel pointer to intel_encoder, to
replace the encoder private ->attached_connector pointers, since
that's essentially what we need.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit fc683091eb57692679f629784f42dce453877430)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: I5f015b8c1fa2f5c657a91188c5c8670c29883515
Reviewed-on: https://gerrit.chromium.org/gerrit/56428
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: enable intel_lvds->pre_pll_enable for ilk+, too

Only two things needed adjustment:
- pipe select for PCH_CPT
- There's no dithering bit on ilk+ in the lvds ctl reg

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 62810e5a9df3f47b7261e5d78fc1c33e550f2171)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: I0d71228384e98d06dc7f9bffc8eccf6da35bd627
Reviewed-on: https://gerrit.chromium.org/gerrit/56429
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
BACKPORT: drm/i915: add HAS_DDI check

And use it whenever we call code that uses the DDIs. We already have
intel_ddi.c and prefix every function with intel_ddi_something instead of
haswell_something, so I think replacing the checks with HAS_DDI makes more
sense. Just a cosmetical change, yes I know, but I have this OCD...

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit affa935440733a79c5a9eb0e5357e2564ca4b355)

BUG=chrome-os-partner:19682
TEST=With entire patch series applied, observe PC7 residency via powertop in
     crosh.
Change-Id: Id5689b181d8867e0e8020819a977e97fadc663ab
Reviewed-on: https://gerrit.chromium.org/gerrit/56430
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>