framebuffer: add a pollable sysfs entry for display status

Wakeup the userspace poll on change of display status. The
userspace then may take action to change the
power/performance characteristics of the device.

Change-Id: I9bd11f3d895d3d83230104f5d8dcd1deeaa754cd
Signed-off-by: Amar Singhal <asinghal@codeaurora.org>
PM / driver core: disable device's runtime PM during shutdown

commit af8db1508f2c9f3b6e633e2d2d906c6557c617f9 upstream.

There may be an issue when the user issue "reboot/shutdown" command, then
the device has shut down its hardware, after that, this runtime-pm featured
device's driver will probably be scheduled to do its suspend routine,
and at its suspend routine, it may access hardware, but the device has
already shutdown physically, then the system hang may be occurred.

I ran out this issue using an auto-suspend supported USB devices, like
3G modem, keyboard. The usb runtime suspend routine may be scheduled
after the usb controller has been shut down, and the usb runtime suspend
routine will try to suspend its roothub(controller), it will access
register, then the system hang occurs as the controller is shutdown.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
wcnss: cancel any pending APPS votes from coldboot before SSR

APPS vote from coldboot may be still pending when SSR is invoked;
so make sure that the APPS votes from coldboot are cancelled before
SSR votes for these Riva regulators.

CRs-fixed: 380434
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
(cherry picked from commit 13f45182fcd1756df8526e1be19c1cf4717dec09)

Change-Id: I4b06d8445c9036078c1962280047990621dcdbbb
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:
	include/linux/wcnss_wlan.h

Conflicts:
	arch/arm/mach-msm/wcnss-ssr-8960.c
wcnss: wake lock APIs for host drivers

wcnss related host drivers can use these APIs to prevent Apps suspend.
WLAN driver uses this API to prevent suspend, when it's module
initialization routines are being executed.

Change-Id: Id072804e6ccc953c78caf6cf11c73e0ea1d71d18
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm:vidc: Fix buffer pool index

While searching for the available buffer entry
in the buffer pool the search should begin from
index 1 as zeroth entry is reserved.

CRs-fixed: 366361
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
(cherry picked from commit 8c7e367a5ccd1c78c728657a14f08d6956b72e50)

Change-Id: I754fac98ce14f28cede1cb590c62784ad303a645
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
ASoC: msm: qdsp6: Fixed the issue unmap command is sent incorrectly

When session CLOSE command is sent right before session RUN command
is acknowledged, callback function can mistakenly think that
the next received acknowledgement is for CLOSE command instead of
RUN command. This triggers driver to send memory unmap command to
the Q6 while it is still processing the CLOSE command. Eventually,
this leads to an invalid memory access and causes Q6 crash.

CRs-Fixed: 377281
Signed-off-by: Jay Wang <jaywang@codeaurora.org>
(cherry picked from commit 0668d106027ab1f2608171db970ecd1edf634d65)

Conflicts:

	sound/soc/msm/qdsp6/q6asm.c

Change-Id: Ieeadf5bc48060fd0462d23f5e0ca023dec43e09c
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: audio: qdsp6v2: Fix WMV stream resume issue

- Suspend phone while WMV clip playback is going on.
Resume it, clip fails to play.
- At resume of WMV clip, Pause is issued initially
to driver. But there is a bug in pause API which is
not returning appropriate result. OMX component when
starts playback, it now issues resume to driver and
driver is setting DSP to run state even before ENC_DEC
params are set.
- Fix pause code to return error value if driver is not
enabled. This will avoid driver in sending CMD_RUN
before ENC_DEC command.

(cherry picked from commit 92ad28cd56803b451ae4bde72bfd20021c769649)

Change-Id: If2814bab09d47fd4c99cc1e917be8f573bed0b50
CRs-Fixed: 394756
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
msm: gpio-v2: Dont re-enable the interrupt and clear the status

If a gpio interrupt is already enabled, do not re-enable it again
and do not clear the interrupt status.
Before this patch:
If an edge interrupt is marked as wakeup, the gpio sys suspend will
clear the status and enable it.
On Resume - the gpio sys resume would clear the intr_status of the wakeup
irq.
Thus, if this particular wakeup irq triggered and woke us up, we lose its
intr_status before calling the gpio summary handler.
Now, when the summary handler is finally called, the irq handler for the
wakeup interrupt is never called.

With this change:
1) Not clearing the intr_status on sys-resume, ensures that it is marked as
pending in the gpio layer.
2) Not re-enabling it again, makes sure that when the irq framework unmasks
all irqs on resume, it does not clear the intr_status either.

Change-Id: I7289522c8c9c97c6f4210433814013160678d130
CRs-Fixed: 400562
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
lib: genalloc: Change chunk allocation to vmalloc

Change the chunk allocation from kmalloc to vmalloc for
allocations greater than a page. This allows large
chunks to be allocated from physically non-contiguous
memory and increases the chance of the allocation
succeeding.

(cherry picked from commit 0614b96dc8e4c8a0dd0db41aec5a79daa3bdf091)

Conflicts:

	lib/genalloc.c

(cherry picked from commit 64cf7183f37df623bec8f46348b11c5781d3b0cc)

Change-Id: Ied97c888b967c4433519cb47e972f7a0f2281d71
CRs-fixed: 387655
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm_serial_hs_hwreg.h: Correcting the even parity and odd parity bits

Currently parity bits are defined to be used with UART_DM_MR2
register with PARITY_MODE Bit as below :
EVEN_PARTIY = 1 and ODD_PARITY = 2
With these values, UART functionality doesn't work after enabling parity.
Hence adding correct used PARITY_MODE bits value as
EVEN_PARITY = 2 and ODD_PARITY = 1
after confirming with UART hardware programming guide.

(cherry picked from commit fd40e5f6313fbc74e8897927be1004faa5d9df08)

Change-Id: I90fa8384d434abd42dc46c917d39e8de1f540993
CRs-Fixed: 410377
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Staging: android: binder: Fix memory leak on thread/process exit

If a thread or process exited while a reply, one-way transaction or
death notification was pending, the struct holding the pending work
was leaked.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
msm: kgsl: Add new sysfs node to list GPU clock frequencies

Add a new sysfs node to communicate available GPU clock frequencies
to userspace for the power daemons.

Signed-off-by: Anshuman Dani <adani@codeaurora.org>
(cherry picked from commit 0e80b365d2b6e15344a774667a1e273edb2d64ff)

Conflicts:

	drivers/gpu/msm/kgsl_pwrctrl.c

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
(cherry picked from commit 9ca738c3c746017e5a4c8d5fe64e1ed3e6128cc1)

Change-Id: I623a36148ae86a9a527f28e7d768535f67ceaa01
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: kgsl: Fix the address translation ranges for GPU IOMMU

Set the address translation to happen via ttbr0 for GPU IOMMU till
address 0x80000000 instead of 0x40000000. Also, adjust the size of
virtual pool so that it does not allocate an address greater
than 0x80000000.

CRs-fixed: 401364
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 54aa5c08ddbdb2255102758237f8717302558c63)

Change-Id: I051a2197fc6a56285d153f3200b4b4500035de7f
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm_fb: display: add config option to set HDMI as primary

Change-Id: Icdc38b6586f30a7b2f18ac8910b8d4eaeb55c3e1
gpu: ion: undo more HTC additions

Change-Id: Ibca93c23b2867dd7b534d6a74f73ace570a7599c
fs: meminfo: move HTC debug function stub

Change-Id: I49af50208e699d1053821f1b150a022d1ded11b7
msm_rotator: add rotator ref count to cleanup code

Perform cleanup of rotator sessions only if reference count reaches 0,
this avoids closing rotator sessions from sibling threads.

Change-Id: I83add90cc04faa90c372dde09a096c7a07be528a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Revert "msm_fb: display: disable waiting for mdp4 writeback on HTC 8960"

This reverts commit 5145a4810815e0a012841895303a48dc1d2a47b2.
msm_fb: display: add missing writeback and wfd files from CAF

Change-Id: Ie6e390ce954c93b866c4d38dc3c1e6f0c977a763
msm: HTC8960: update configs

Change-Id: I85a4341c3c70adbf625e05521e4cbff4828f2cac