BACKPORT: drm/i915/tv: add ->get_config callback

We need this to properly fill in adjusted_mode.crtc_clock, otherwise
the state checker gets unhappy. This seems to have been forgotten in
the big clock rework in

commit 18442d08786472c63a0a80c27f92b033dffc26de
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Fri Sep 13 16:00:08 2013 +0300

    drm/i915: Fix port_clock and adjusted_mode.clock readout all over

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7a495cfd9b5f82c40608f26fe523dc9e8533dc14)
Cc: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>

BUG=chromium:342771
TEST=trybot tested

Change-Id: Icb10e0b55a85be43e383766e20c8e3315645e902
Reviewed-on: https://chromium-review.googlesource.com/185850
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Sean Paul <seanpaul@chromium.org>
Tested-by: Sean Paul <seanpaul@chromium.org>
BACKPORT: drm/i915: encoder->get_config is no longer optional

We must have one to fill out the adjusted_mode.crtc_clock. And with
the tv encoder fixed up every encoder we have has a ->get_config
callback. So we can drop the checks.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1d37b689b1c07c01101534e55ffcd43f69069355)
Cc: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>

BUG=chromium:342771
TEST=trybot tested

Change-Id: I35fa5922a6079fc54387b85efdc8de28edd2d685
Reviewed-on: https://chromium-review.googlesource.com/185851
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Sean Paul <seanpaul@chromium.org>
Tested-by: Sean Paul <seanpaul@chromium.org>
CHROMIUM: thermal: tegra124: modify temperature threshold

The old temperature threshold values are safe but a lower
than neccessary. Modify them to the latest margining numbers.

BUG=None
TEST=Verfied. Check these values from sysfs, it's ok.

Change-Id: I1d19974b80ed601bfd7cd2b860e0e59e0812926d
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/183909
Tested-by: Wei Ni <wni.nvidia@gmail.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
CHROMIUM: lkdtm: add "WRITE_KERN" test

Add "WRITE_KERN" crash target to validate that kernel executable memory
is not writable.

BUG=chromium:342511
TEST=link build/boot passes when this whole series is applied

Change-Id: I4a79c3f0a4bfb051306186d49f888798740f0453
(sent upstream in https://lkml.org/lkml/2014/2/9/239)
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186005
Reviewed-by: Sameer Nanda <snanda@chromium.org>
CHROMIUM: platform: fix Kconfig typo

CHROMEOS_VBC_EC should depend on MFD_CROS_EC, not on MFC_CROS_EC
which doesn't exist.

BUG=chromium:341750
TEST=Build for nyan and arm-generic; no more warnings about
unmet dependencies.

Change-Id: I6a7587cfdca08079c329c6da68bf2266a1f207d9
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186410
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: ARM: tegra: fix build for !TEGRA_GRHOST

TEGRA_DC depends on TEGRA_GRHOST and the display(s) won't come
up without TEGRA_DC, so there's no point in trying to initialize
the panel without it.  Make building of board-venice-panel.c
dependent on TEGRA_DC and stub out venice_panel_init() in the
!TEGRA_DC case.

BUG=chromium:341750
TEST=Builds for nyan and arm-generic

Change-Id: Ia4ffd9cc45c8015215b67a6cbf34daa034aca102
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186411
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: cpufreq: interactive: don't defer input open to workqueue

cpufreq_interactive defers opening of input devices from the
->connect() callback to a workqueue.  This introduces races
with the ->disconnect() callback and within the input core as
it expects the input_open_device() call to happen in ->connect().
The only advantage to deferring to a workqueue would be to improve
CPU up/down latency, but this should already be a low overhead
operation on systems where the UI is already monitoring input
devices.

BUG=None
TEST=Rapidly hotplug CPUs and a USB mouse; no crashes observed.

Change-Id: Ic5ffd117538a1b0349c07324f79aca7b76794f38
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186243
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: mmc: tegra: don't scale clock in ->set_clock()

The ->set_clock() callback cannot call clk_set_rate() since it
is called with the sdhci spinlock held.  Instead of using it to
change the source clock rate, just initialize the source clock
to the maximum rate available from the list of tuning frequencies.
sdhci_set_clock() will then set a divider in SDHCI_CLOCK_CONTROL
to generate the actual sdmmc clock rate.  We must also program
the BASE_CLK_FREQ field in SDHCI_VNDR_CLK_CTRL so that the clock
frequency reported in SDHCI_CAPABILITIES reflects the actual source
clock frequency.  The modifying of SDMMC_CLK is also moved from
tegra_sdhci_set_clock() to when the source clock is gated/ungated,
as the TRM suggests.

BUG=None
TEST=eMMC, SD, WiFI still work.  Check that the clocks are correct
in /sys/kernel/debug/clk/clk_summary and that they are consistent
with what's reported in /sys/kernel/debug/mmc*/ios.  Haven't been
able to reproduce spinlock BUG during boot.

Change-Id: I74c3611c5bba77b601d8a983fc9cd5dcf78aad48
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185894
UPSTREAM: ARM: tegra: don't timeout if CPU is powergated

When booting secondary CPU(s) which are not yet powergated, a wrong
check lead to a timeout after 100 jiffies. With this patch, we only
delay powergating if CPUs are still not powered yet.

BUG=none
TEST=Norrin still boots and cpus come up/down.

Change-Id: I88480ee3c015cc9f729ddf9a90e04d79c47bde60
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit 5f809932419375af8203561a39c70ed1a994c877)
Reviewed-on: https://chromium-review.googlesource.com/186306
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: video: tegra: Refactor edid i2c function

Add sturct tegra_dc_i2c_ops to allow different clients to set
different i2c transfer ops.
Move edid i2c init to hdmi.c

BUG=none
TEST=Booted to UI and check edid still works for hdmi

Change-Id: I7a6652296878029c694860a1db2110bcf42f4a43
Signed-off-by: David Ung <davidu@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/186231
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: video: tegra: Add I2C and Edid support for DP

Add I2C transfer support over the DPAUX channel.
If there is no predefined mode, try early_enable() to get
edid modes from panel directly.

BUG=none
TEST=Recompiled and booted to UI

Signed-off-by: David Ung <davidu@nvidia.com>
Change-Id: I5a5958a6f805b7793884ef46078cce7c82114bc7
Reviewed-on: https://chromium-review.googlesource.com/186261
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: video: tegra: Enable edid on DP

Add the edid reference to DC and enable edid on DP.
Fixup code that expected values initialised from DT.

BUG=none
TEST=with a hack to trigger tegra_dc_dp_early_enable, can
see /sys/kernel/debug/edid0 get instanciated.

Change-Id: Icfc2989d5b0bc77600f360b15b23cfbbb30ab15f
Signed-off-by: David Ung <davidu@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/186291
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: ALSA: ASoC: max98090: dt and regulator support

This adds basic device tree support and tries to enable
a regulator to supply dvdd.

BUG=None
TEST=aplay with and without DT entry

Change-Id: I1ed3b01b963d852dd5b32363840a86ead0e1ee11
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/185973
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: ARM: dts: nyan: Specify dvdd supply for max98090.

Tell the max98090 where to find its dvdd supply.

BUG=none
TEST=aplay across suspend/resume.

Change-Id: I72623f1a2b366b5bc0a37149d6d5e60612b3f8bc
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186181
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: ARM: dts: tegra124: add PMU node

Tegra124 has a Cortex-A15 compatible PMU; add it.

BUG=None
TEST=Boot on Nyan; run perf and check that we're getting PMU
interrupts in /proc/interrupts.

Change-Id: Ia13f822337d4a50559faeb155d4489cbb3ca9ec4
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186459
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: arch: arm: dma: add dma_alloc_at_coherent

Updated dma-mapping driver so that memory allocation can take
place at "at" address or the desired address as requested by
the device driver.

Device like NVAVP requires this functionality as it expects allocation
of memory at its own requested address.

Added dma_alloc_at_coherent function which try to allocate memory
"AT" requested address for a device driver.

BUG=None
TEST=emerged kernel for nyan (Tegra124 Norrin) and made sure kernel
boots.

Signed-off-by: Tushar Khinvasara <tkhinvasara@nvidia.com>
Change-Id: Ia2996b4e32b8d64c1c270ed4f759ed73f4058b60
Reviewed-on: https://chromium-review.googlesource.com/183911
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: ARM: dts: nyan: separate EMC table for different platform

The RAM part might be different on different tegra124 platform.
Therefore the EMC table should be different as well.

BUG=none
TEST=built kernel and boot. EMC scaling works on nyan rev1 platform.

Change-Id: I389d6963171a105f3ccf4aa4d7c25d2473af83ae
Signed-off-by: Danny Huang <dahuang@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/185842
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
watchdog: Add tegra watchdog

Add a driver for the hardware watchdogs in NVIDIA Tegra SoCs (Tegra30 and
later).  This driver will configure one watchdog timer that will reset the
system in the case of a watchdog timeout.

This driver binds to the nvidia,tegra30-timer device node and gets its
register base from there.

BUG=none
TEST=emerge-nyan chromeos-kernel-3_10

Change-Id: Iffeae857d3278b5e54d1eaa2a1b5d0380c5ee399
Signed-off-by: Andrew Chew <achew@nvidia.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/185963
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: dts: tegra124: Match against tegra30 for timer

The Tegra watchdog driver matches against nvidia,tegra30-timer.

BUG=none
TEST=emerge-nyan chromeos-kernel-3_10

Change-Id: Ifaa778c080806b7bb45766185ec318cfe0ce8275
Signed-off-by: Andrew Chew <achew@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/185964
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: config: Enable tegra watchdog

Enable the tegra watchdog so that the system resets upon watchdog
timer expiry.

BUG=none
TEST=emerge-nyan chromeos-kernel-3_10, poke /dev/watchdog0, and see that
the target reboots after 2 minutes.  Also tested that poking /dev/watchdog0
resets the timer.

Change-Id: I52fcca85465f3da5912a645003511f34eb2db39e
Signed-off-by: Andrew Chew <achew@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/185965
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>