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

Conflicts:
	arch/arm/mach-msm/Makefile

Conflicts:
	arch/arm/mach-msm/Makefile
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
ASoC: fix bad merge of lpa
bluesleep: adapt m7 to monarudo
Fix bluesleep for DLXJ