Max screen off frequency and shut down cores while screen is off

Conflicts:
	arch/arm/mach-msm/Makefile
Change msm-sleeper to use lcd-notifier
Enable ARCH_POWER
FS: import F2FS

Signed-off-by: Paul Reioux <reioux@gmail.com>
f2fs: data: AIO optimization compatibility fixup

Signed-off-by: Paul Reioux <reioux@gmail.com>
Add F2FS in defconfig
USB: Set power supply online status to false after cable disconnect

During bootup, power supply online status is set to true in
qpnp_charger_probe() as soon as usb cable insert is detected by
PMIC without waiting for notification from USB driver.
Later when usb cable is disconnected before charger detection
mechanism starts, online status is not set to false by USB.
As part of cable disconnect, USB checks in msm_otg_notify_charger()
whether the cur_power is same as requested mA, if both are same
then USB does not call power_supply_set_online() to set it to false.

Fix the issue by setting power supply online status to false for
the scenario when usb cable is disconected during bootup before
charger detection mechanism is completed.

CRs-fixed: 634183
Change-Id: Ibd57a40c7364e13bb10870e9e6343224e01171d7
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Added CPUfreq governor 'wheatley'

Thanks to r_data for taking the time to fix all the build errors for the Nexus 4.
cpufreq: Add OndemandPLUS Gov

Signed-off-by: houst0nn <houstonn@gmail.com>

Conflicts:
	drivers/cpufreq/Kconfig
	include/linux/cpufreq.h

Conflicts:
	arch/arm/configs/d800_defconfig
	arch/arm/configs/d801_defconfig
	arch/arm/configs/d802_defconfig
	arch/arm/configs/d803_defconfig
	arch/arm/configs/ls980_defconfig
	arch/arm/configs/vs980_defconfig

Conflicts:
	include/linux/cpufreq.h
Add more Governors to defconfig
msm: vidc: Enable venus power management

Besides clock gating, turn venus core power off
if the core stays idle for given amount of time.
Powering off venus core involves telling TZ to
suspend venus core, detach IOMMU, disable GDSC
regulator, unvote DDR/OCMEM buses.

Turn it on again when driver starts processing new
commands before enabling clocks.

Protect clock and power states and operations
with a common lock.

Change-Id: I49654069920ddaae0e2f8792b14cd1bfeb431c34
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Make HW timeout and power collapse delay configurable

Provide debugfs node for HW response timeout and a sysfs device
attribute for power collapse delay.

Change-Id: I586f10f3e90df5384c8e465fbfe8e7ebec0915eb
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Protect remaining clock operations

Clock enable/disable operations are only protected
during interframe clock gating and power collapse.
With this change, clock operations are also protected
during device initialization and removal.

Change-Id: Idcc81b7563349a45affe4abf0a148c4386be3aa0
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Add clocks and power counts

Enable power and clock ref counts in debugfs
to easily debug any ref count mismatch.

Change-Id: If06ef139f5a4517cb29a84e86193a6cc2c0f9e64
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Synchronise data shared between controls

Some of the V4L2 controls perform similar tasks and have some shared
data between them.  Unexpected sequences of controls can possibly cause
data coherency issues causing the firmware to be programmed incorrectly.
So, when a control is updated with a new value, update related controls
with a similar enum so that they both have similar values.

Also, change the frame rate values to normal FPS rather than Q16 format.

Change-Id: Iebb0ddc33374ab8eb7106b005965c2eede797aea
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Increase timeout for power collapse

Increase power collase timeout to avoid venus power
collapse before the video video/encoding decoding is
actually started. This is needed to avoid iommu map
failures at the beginning of the playback.

Change-Id: I82457a9b847c6e8e53bd6ffb6a381a64c0d38417
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Handle SYS_IDLE interrupt concurrency

It is possible to receive SYS_IDLE message before
Venus core sends the interrupt for that message.
This results in clocks not being disabled at all
and device will continue to drain power.

This change checks when the interrupt is received
if the venus core is still in IDLE state. If it is
then disable the clocks.

Change-Id: If2b8d778054a702eada40ac3588e2ec3a3fbd80a
CRs-fixed: 548745
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Fix handling of ocmem_notifier_register() return value

The ocmem driver might return -EPROBE_DEFER (or any other error)
as a ERR_PTR.  These shouldn't be construed as a valid handle.

CRs-fixed: 565882

Change-Id: I57c9739ae766a1b512ce930005c1cb310aa74034
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Halt axi bus before clock disable

Before turning off venus clock, host should make sure
that there are no pending AXI transactions. This is achieved
by halting AXI.

CRs-Fixed: 578007

Change-Id: Ib4a71d1097f2f62e910e00c7be5d32e006d4c62b
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Mask interrupts from venus after receiving IDLE message

IDLE message from venus indicates that the venus is idle and its
clocks are turned off. These clocks should not be turned on by any
pending or spurious(interrupts without any message) interrupts to save
power.

Change-Id: I622212a7e8c51106fbf69c491d129f219eb6ce54
CRs-fixed: 583989
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>