CHROMIUM: regulator: add regulator-suspend-enable properties

Add the properties regulator-suspend-{disk,mem,standby}-enable
to indicate that a regulator should be powered in a particular
suspend state.

This is separate from the regulator-suspend-*-microvolts properties
since PMICs may not necessarily support setting a different voltage
for regulators enabled during suspend.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: Iab6cd30e1f9dd827eb393bee1720f374d6b8e114
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183147
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: regulator: as3722: rename sleep_ctrl* to ext_ctrl*

sleep_ctrl_{reg,mask} were used to store the location of a regulator's
extenral control settings (i.e. if the regulator is controlled by an
external ENABLE pin) and have nothing to do with sleep/standby mode.
Rename them to ext_ctrl_{reg,mask} instead.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: Ic319de162c4e3147df9e2fcc68e9885b21038834
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183523
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: regulator: as3722: add support for setting suspend state

The AS3722 PMIC supports setting the suspend state of its regulators
through the REG_STANDBY_MOD registers.  Regulators will enter the
requested state when the PMIC enters standby mode.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: I4977057765552aa155a9d4f01262b78b9d2f9898
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183148
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: regulator: as3722: add support for standby sequencing

The AS3722 PMIC supports a standby entry/exit sequence with up to
10 entries.  Regulators powered down during standby can have their
power down sequenced and regulators that are enabled and require a
different voltage during standby can have that voltage applied in
the sequence.  A new DT property, "ams,stanby-sequence", is used
to specify a regulator's slot in the sequence.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: I12907db76c26fd49ed4681e53e4f76cefd4cb27f
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183149
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: mfd: as3722: enable standby mode

Enable entry/exit from standby via the ENABLE1 pin (CORE_PWR_REQ) on
the AS3722 PMIC.  The PMIC will enter standby mode on de-assertion of
ENABLE1 and will exit on re-assertion or an external interrupt (e.g RTC).

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: Idf978f0a5129027f9474d225ea835274419faaa6
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183386
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: ARM: tegra: set up regulators for suspend

Call regulator_suspend_prepare() to apply the regulator constraints
for suspend in tegra_suspend_valid().  Note that it cannot be done
later, such as in tegra_suspend_enter(), since i2c will have been
suspended at that point.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan.

Change-Id: Ida3a3d780208deb29330cf2fcdd6000de298a935
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183387
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: ARM: dts: nyan: add PMIC suspend settings

Add regulator suspend states and standby entry/exit sequencing.

BUG=chrome-os-partner:25096
TEST=Build and boot on Nyan; suspend power drops from 170mW to 100mW.

Change-Id: I5c75a232afafa547d9531576a5ff06914f7d68f6
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183388
Reviewed-by: Dylan Reid <dgreid@chromium.org>
CHROMIUM: cpufreq: interactive: delete timer at GOV_START

Make sure cpu_timer is deactivated before adding a new one.
This is similar to the fix from the android 3.10 tree, but applies to
our tree(there is no slack_timer in ChromeOS's interactive governor).

see b430123367e78a6557bac3cf1558bcb85193fb12 in android-tegra-3.10

BUG=chrome-os-partner:25195
TEST=set governor and note that kernel doesn't panic.

Change-Id: I9d058d2230aedeb708e8bf2a4f3dd3317ee9dc2b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183390
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: DPTF: Add ESIF_LF as an x86 platform driver

This adds the kernel support for the Intel Dynamic Platform
and Thermal Framework (aka Eco-System Independent Framework).

The raw code is imported from the 8.0.1 release from the
following directories:

Products/ESIF_LF/Sources/*
Products/ESIF_LF/Sources/lin/*
Products/ESIF_CM/Sources/*

BUG=chrome-os-partner:25110
TEST=manual: This commit adds new code that is not compiled yet.

When complete this provides a set of kernel drivers that are used
by the ESIF upper framework applications.  This is tested by loading
the drivers and starting the ESIF application to ensure that the
sysfs nodes are created as expected and the DPTF/ESIF application
runs without issue.

Change-Id: I850dcc60374203bfe1706d89b93ccabeb494feaf
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183042
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Brian Bian <brian.bian@intel.com>
CHROMIUM: DPTF: Fix compile and runtime issues

There are a few places that were causing compile warnings/failures
and runtime warnings that are fixed by this change:

- acpi_remove() prototype has extra 'type' argument
- API changes to use latest upstream iosf_mbi driver
- fix typo in dptf_device_aux1_store() debug message
- some static functions that are not used unless debug is enabled
- a few DEVICE_ATTR declared as RW when they should be RO based
on the implemented handlers. This fixes runtime warnings such as:
"Attribute rapl_time_window_2: write permission without 'store'"
- the RO permission mask cannot have read permissions set.  This fixes
the runtime warnings such as:
"Attribute _event: read permission without 'show'"

BUG=chrome-os-partner:25110
TEST=manual:

1) ensure dptf modules compile cleanly
2) boot kernel and load modules: dptf_acpi dptf_pch dptf_cpu
3) start esif_uf application
4) check dmesg to ensure that no runtime warnings are reported

Change-Id: I2915db79ccc2283cf8226c772fff11c604fd34b8
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183043
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Brian Bian <brian.bian@intel.com>
CHROMIUM: DPTF: Add Kconfig and Makefile for ESIF_LF drivers

This adds a Kconfig and Makefile to enable and build the
DPTF/ESIF_LF drivers.

It is hooked into the drivers/platform/x86 Kconfig and Makefile
in order to be part of the kernel build.

BUG=chrome-os-partner:25110
TEST=manual: Enable DPTF config options and compile the kernel

When complete this provides a set of kernel drivers that are used
by the ESIF upper framework applications.  This is tested by loading
the drivers and starting the ESIF application to ensure that the
sysfs nodes are created as expected and the DPTF/ESIF application
runs without issue.

Change-Id: I6026d2f02c4f849629f88b80d273430dda839d51
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183044
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Brian Bian <brian.bian@intel.com>
CHROMIUM: hung_task: dump all UNINTERUPTIBLE tasks

When the panic path is taken for khungtaskd dump all
tasks with the UNINTERUPTIBLE state. That way, any
inter-dependent tasks that caused one another to hang
will be saved in the crash output.

BUG=chrome-os-partner:24397
BRANCH=None
TEST=Manual

echo HUNG_TASK > /sys/kernel/debug/provoke_crash/DIRECT' &
echo HUNG_TASK > /sys/kernel/debug/provoke_crash/DIRECT' &
echo HUNG_TASK > /sys/kernel/debug/provoke_crash/DIRECT' &

Checked outout of crash showing stack deduping.

Change-Id: I3d7e62ca3d97b78c897e27b903cebe7da7d66025
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183593
Reviewed-by: Benson Leung <bleung@chromium.org>
UPSTREAM: NFC: Only warn on SE discovery error

SE discovery errors are currently overwriting the dev_up() return error.
This is wrong for many reasons:

- We don't want to report an error if we actually brought the device up
  but it failed to discover SEs. By doing so we pretend we don't have an
  NFC functional device even we do. The only thing we could not do was
  checking for SEs availability. This is the false negative case.

- In some cases the actual device power up failed but the SE discovery
  succeeded. Userspace then believes the device is up while it's not.
  This is the false positive case.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
(cherry picked from commit a434c2407467a76c0e1416c45f7b31cfbe1b6b3b)
http://git.kernel.org/cgit/linux/kernel/git/sameo/nfc-next.git/commit/?id=a434c2407467a76c0e1416c45f7b31cfbe1b6b3b

BUG=chromium:336972
TEST=Reproduce crbug.com/333426. Try to enable the NFC adapter using
neard. This should fail immediately instead of immediately succeeding.

Change-Id: I2efe21f743c29916e6e6a91b4af59bbf66746627
Signed-off-by: Arman Uguray <armansito@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183536
Reviewed-by: Benson Leung <bleung@chromium.org>
CHROMIUM: video: nyan: Fixup hdmi on tegra124

Fix clock programming for hdmi.

BUG=none
TEST=Connected hdmi monitor to see extended desktop.

Signed-off-by: David Ung <davidu@nvidia.com>
Change-Id: I0c8509ec7bddb181d907ce80d32c00c1f32b7071
Reviewed-on: https://chromium-review.googlesource.com/183728
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
UPSTREAM: regcache-rbtree: Fix reg_stride != 1

There are a couple of calculations, which convert between register addresses and
block indices, in regcache_rbtree_sync() and regcache_rbtree_node_alloc() which
assume that reg_stride is 1. This will break the rb cache for configurations
which do not use a reg_stride of 1.

Also rename 'base' in regcache_rbtree_sync() to 'start' to avoid confusion with
'base_reg'.

BUG=chrome-os-partner:25253
TEST=LP1 suspend resume while playing audio with aplay.

Conflicts:
	drivers/base/regmap/regcache-rbtree.c

Change-Id: I1e495e379d4d6d15473cf870642b92e4001a437e
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit b6752123ccef4eec3c70c20dbdfc05d1674319c5)
Reviewed-on: https://chromium-review.googlesource.com/183808
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: ARM: tegra124: Add XHCI clk names to powergate table

Add clock names "xusb_ss", "xusb_host", and "xusb_dev" into powergate
table tegra124_powergate_partition_info[].

BUG=None
TEST=Tested on Tegra124 Venice2 and Norrin.

Change-Id: If962d933b864972408a09cf9c076868dcdbaa5df
Signed-off-by: Jim Lin <jilin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/182769
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: clk: tegra: Enable hw control of xusb brick pll

Enable hw control of xusb brick pll if clock plle is enabled.

BUG=None
TEST=Tested on Tegra124 Venice2 and Norrin.

Change-Id: I98b91784d590b0cabcb2541942a009af9ff072a8
Signed-off-by: Jim Lin <jilin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/182830
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: clk: tegra: Add mux table to select source for "xusb_fs_src"

Add mux table mux_clkm_48M_pllp_480M_idx[] to select requested source
for clk "xusb_fs_src".

BUG=None
TEST=Tested on Tegra124 Venice2 and Norrin.

Change-Id: I8584685e4b8483bb88f2e95fa16925f3132efe68
Signed-off-by: Jim Lin <jilin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/182831
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: clk: tegra: Add mux table to select source for plle

Add mux table mux_pll_e[] to select requested source for clock plle.
This is for XHCI function.

BUG=None
TEST=Tested on Tegra124 Venice2 and Norrin.

Change-Id: I43c1597647cc88c03b58ad700fd6c07eb8164811
Signed-off-by: Jim Lin <jilin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/182832
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
CHROMIUM: clk: tegra: Add XHCI clock aliases

Add clocks "xusb_ss_src", "xusb_host", "xusb_dev", "xusb_ss",
and "xusb_falcon_src" into devclks[] table for lookup during
initialization phase.

BUG=None
TEST=Tested on Tegra124 Venice2 and Norrin.

Change-Id: I98d2d0073d915c30ab2f7c55bb37d3e575d748d8
Signed-off-by: Jim Lin <jilin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/182833
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>