bluetooth: bluesleep: Bluetooth active power management driver

A new driver is implemented to actively manage the bluetooth module
power. bluesleep also tries to manage the power of the transport used.

Two signals (GPIOs) are used to manage the power events.

BT_WAKE  : signal from HOST to BT chip to intimate BT chip can sleep.
HOST_WAKE: signal from BT chip to HOST to intimate HOST should wakeup/
activate the transport modules required for BT communication.

Change-Id: I96202e1cc67dbcbcfa2be874aa2d845e8350f755
Signed-off-by: Bryan Smith <zarboz@gmail.com>
changed to dlxp

Signed-off-by: Bryan Smith <zarboz@gmail.com>
bluetooth: Fixed ld mismatched symbols

The driver data structure referenced a function point which is defined
as __init data. This caused symbol mismatch error. This could be fixed
by defined driver data with __init macro, otherwise, by cancel __init on
probe function. Have this done in a safe way.

This file is removed in upstream. It seems that is the only chance to
fix it in our own repository.

Reviewed-on: http://git-master/r/20931
Reviewed-by: David Schalig <dschalig@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Chao Jiang <chaoj@nvidia.com>

Change-Id: I3eba3578c84d8ec67707a276841d72f98c47267d
bluetooth: bluesleep: Exit early if device not registered

If the device isn't registered for this board, return out of the init
function early.

Reviewed-on: http://git-master/r/24254
Reviewed-by: Daniel Willemsen <dwillemsen@nvidia.com>
Tested-by: Daniel Willemsen <dwillemsen@nvidia.com>
Reviewed-by: Anantha Idapalapati <aidapalapati@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Change-Id: Ic806b4be1671a77a8fedc1c0376362bc177b0604
bluetooth: bluesleep: add suspend and resume

suspend and resume function() to avoid uart
api call when uart driver is not resumed.

bug 863564

Reviewed-on: http://git-master/r/48716
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Tested-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>

Change-Id: I036260f244b2067200050fd5252d91ec23518b86
bluetooth: bluesleep: workaround to enable bluesleep functionality

Enable_irq_wake function is returning error while registering bank
irqs. Commenting out enable_irq_wake,disable_irq_wake function will
not affect bluesleep functionality except wake-on-bluethooth.

Bug 890309

Reviewed-on: http://git-master/r/61090
Reviewed-by: Om Prakash Singh <omp@nvidia.com>
Tested-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

Change-Id: I25e03331ee3cd228669520c2c6db9aabe07920a7
bluetooth: bluesleep: remove blocking call in bluesleep_start

bluesleep_start is not allowed to sleep because it's called by
an atomic_notifier, so we move request_irq to the probe function

Reviewed-on: http://git-master/r/65018
Tested-by: Matt Wagner <mwagner@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Change-Id: I428bd6c9ab07cf7e5ab2029975cc9a617fea03b0
bluetooth: bluesleep: enable wake-on-bluetooth

Bug 910402

Signed-off-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-on: http://git-master/r/66614
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Change-Id: I6835cacd12573c2bc6adb86ea3742d934d0fc118
bluetooth: bluesleep: call free_irq during driver unload only

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/67654
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User

Change-Id: Iabad9617752af43c7184d0335177c60fba6bd715
bluesleep: implement to support bluedroid

"#define BT_BLUEDROID_SUPPORT 1" -> support BlueDroid
"#define BT_BLUEDROID_SUPPORT 0" -> support BlueZ

Since BlueDroid does not use kernel space HCI driver now, we add the
below 2 /proc nodes to make BlueDroid able to send HCI events to
bluesleep driver.

write 1 to /proc/bluetooth/sleep/lpm -> equivalent to HCI_DEV_REG event
write 0 to /proc/bluetooth/sleep/lpm -> equivalent to HCI_DEV_UNREG event
write 1 to /proc/bluetooth/sleep/btwrite -> equivalent to HCI_DEV_WRITE event

Signed-off-by: Haley Teng <hteng@nvidia.com>

Change-Id: I9ab3e0b83610b094b569f5334557b6fe23ffcd5b
msm: vidc: Allow client to set turbo mode

- Allow client to set TURBO performance level
  to video driver.
- Update max performance level to TURBO perf level
  on supported targets.

Change-Id: I0b3b38140d777984ba5062ddd614c07a002389ba
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Handle mgen2maxi interrupt in video driver

Handle interrupt generated by mgen2maxi h/w and
avoid unknown interrupts storm which results in
target reset issues.

Change-Id: Ida24cb2dde15c9cd4a4c1d9ca336b1a4b662c4d1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Get the current performance level

This change supports client to get the current
performance level of the video driver via
IOCTL_GET_PERF_LEVEL. The current performance
level indicate the number of MBs per second
is being processed by video hardware.

Change-Id: Ic6f5b2b14e0d77bf801c4f857f8a0e20339c199f
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Bryan Smith <zarboz@gmail.com>
msm:board-8064: Correct ab/ib values of 1080p turbo vectors

This change corrects the ab/ib values of turbo vectors
intended for 1080p encoder.

CRs-Fixed: 473197

Change-Id: I172b241e7b8b7b2d8600647ac35af78ed928e052
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
msm: kgsl: Don't do intensive memory recovery when allocating big pages

We don't want to incur too much overhead when allocating big pages
so don't attempt to retry, perform reclaim, or run memory compaction
on high-order allocations.

Change-Id: Ic0dedbadb354c6faea34abec36aee268ac0f2c34
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Insert kgsl idle for iommu-v1 when pagetables are changed.

An idle is needed for iommu-v1 before programming both tlb registers
and the pagetable register. Without this idle faults are observed on
2D core because a process uses another processes pagetable.

Change-Id: Ief14cd79b8e7ffaed413da49dc4b9e8416233186
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Don't access context memory after it's freed

Context memory was potentially accessed after being freed. Fix this
by incrementing the context's refcount at strategic places.

Change-Id: I31049bdd3eb9ac52160ca593619fcc8a32d4ddee
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
gpu: ion: enable the kmalloc heap

There are some Ion clients who would like to use the kmalloc
heap. Enable it.

Change-Id: Ie818be9e1211d52d489ad2cb63d94e2fddfc0f01
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: kgsl: Add NULL check for next_event hook

KGSL driver needs to check that the function pointer
is not NULL before calling the hook. next_event
is an optional function not implemented by the 2d
core. This fix ensures that optional and unimplemented
function will not invoked by the driver.

Change-Id: I687b028260e3ec304d973c6a5bded0a8fdbfb73b
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Don't consider active count if not in active state

Don't consider active_cnt variable if not already in ACTIVE state.
The active count variable does not necessarily exactly indicate the
number of open handles to GPU for switching power state. Hence,
only wait for active count to reach zero before switching to SUSPEND
state if, the current state is ACTIVE.

CRs-fixed: 483154
Change-Id: Ie025a1873cfb9237bdfba89204f4c2116549eba4
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>