Bluetooth: Update Local COD to bluez userspace on write complete.

Class of device information is required to the bluez userspace
to write to persistant storage and also update upper layers on
request. So update the local CoD info to bluez once the hci write
is successful.

CRs-fixed: 375304
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
(cherry picked from commit 58562d8177e97893c27d04a378867e714029e620)

Change-Id: I88355cbf128f8e5f9b85f2a4bcfcdea4ab3b0f78
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Bluetooth: Update the scan state with Inquiry commands in non-LE case

Update the hdev scan state with Inquiry start/cancel commands in
non-LE case accordingly. And also there was no check to see the
SCAN_BR mode before sending inquiry cancel.Added a check to see
if the scan state is SCAN_BR,then send inquiry cancel

Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
CRs-fixed: 359771
(cherry picked from commit 0976074df4de122b042c82a6b9c4df1ea05f0eb6)

Change-Id: Iffbe7286fdf59c43820f8fa0a346267e708c7080
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Prevents update of Low Energy connection parameters

The start encryption command fails when the LE update
connection parameters request is pending.
Hence, prevent the update of LE connection parameters during the
bonding process. The update of connection parameters is
not necessary during bonding process.

CRs-fixed: 380257
Signed-off-by: Subramanian Srinivasan <subrsrin@codeaurora.org>
(cherry picked from commit 923e3e66d32f7071fcf8eea87b073aa1966e4e9b)

Change-Id: I9e9607423aae2a0bb2e7469d7cdbebefc3fc664b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Bluetooth: Fix RFCOMM session reference counting issue

There is an imbalance in the rfcomm_session_hold / rfcomm_session_put
operations which causes the following crash:

[  685.010159] BUG: unable to handle kernel paging request at 6b6b6b6b
[  685.010169] IP: [<c149d76d>] rfcomm_process_dlcs+0x1b/0x15e
[  685.010181] *pdpt = 000000002d665001 *pde = 0000000000000000
[  685.010191] Oops: 0000 [#1] PREEMPT SMP
[  685.010247]
[  685.010255] Pid: 947, comm: krfcommd Tainted: G         C  3.0.16-mid8-dirty #44
[  685.010266] EIP: 0060:[<c149d76d>] EFLAGS: 00010246 CPU: 1
[  685.010274] EIP is at rfcomm_process_dlcs+0x1b/0x15e
[  685.010281] EAX: e79f551c EBX: 6b6b6b6b ECX: 00000007 EDX: e79f40b4
[  685.010288] ESI: e79f4060 EDI: ed4e1f70 EBP: ed4e1f68 ESP: ed4e1f50
[  685.010295]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[  685.010303] Process krfcommd (pid: 947, ti=ed4e0000 task=ed43e5e0 task.ti=ed4e0000)
[  685.010308] Stack:
[  685.010312]  ed4e1f68 c149eb53 e5925150 e79f4060 ed500000 ed4e1f70 ed4e1f80 c149ec10
[  685.010331]  00000000 ed43e5e0 00000000 ed4e1f90 ed4e1f9c c149ec87 0000bf54 00000000
[  685.010348]  00000000 ee03bf54 c149ec37 ed4e1fe4 c104fe01 00000000 00000000 00000000
[  685.010367] Call Trace:
[  685.010376]  [<c149eb53>] ? rfcomm_process_rx+0x6e/0x74
[  685.010387]  [<c149ec10>] rfcomm_process_sessions+0xb7/0xde
[  685.010398]  [<c149ec87>] rfcomm_run+0x50/0x6d
[  685.010409]  [<c149ec37>] ? rfcomm_process_sessions+0xde/0xde
[  685.010419]  [<c104fe01>] kthread+0x63/0x68
[  685.010431]  [<c104fd9e>] ? __init_kthread_worker+0x42/0x42
[  685.010442]  [<c14dae82>] kernel_thread_helper+0x6/0xd

This issue has been brought up earlier here:

https://lkml.org/lkml/2011/5/21/127

The issue appears to be the rfcomm_session_put in rfcomm_recv_ua. This
operation doesn't seem be to required as for the non-initiator case we
have the rfcomm_process_rx doing an explicit put and in the initiator
case the last dlc_unlink will drive the reference counter to 0.

There have been several attempts to fix these issue:

6c2718d Bluetooth: Do not call rfcomm_session_put() for RFCOMM UA on closed socket
683d949 Bluetooth: Never deallocate a session when some DLC points to it

but AFAICS they do not fix the issue just make it harder to reproduce.

Change-Id: I0b8f5b84211a3893c3bac4cce143172c327a7aa2
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Gopala Krishna Murala <gopala.krishna.murala@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
video: msm: Add user-defined backlight scaling

Add method for scaling backlight based off of a user provided ratio and
minimum level for the scaling to be applied.

Change-Id: I494bdd4545e9e02602faa01bed820120cd96298f
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit f0fd8e7323ea0f60539918528a4cfa1edb39b828)

Conflicts:

	include/linux/msm_mdp.h
Bluetooth : hidp: Get the valid hci_conn while unlink

Since the context where unlink will be called is unaware of
validity of hci_conn pointer, fetch the valid hci_conn
before unlink.

CRs-fixed: 370274
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
(cherry picked from commit f411769619b631aa0d9f7d460bcfec4ff3e6f54a)

Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
(cherry picked from commit fce25f117ec7ea4296f550f8ed819dc517f89172)

Signed-off-by: Sunil Joseph <sunilj@codeaurora.org>
(cherry picked from commit 025e910a412c9f5d2e8d247e69afdb3041706a3a)

Change-Id: I60c9024c1c27d18ee2852166eed03a4c8593ca88
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
Bluetooth: hidp: use dest address from session info

While hid device unpair process, we are trying to access released
socket as apart of getting hci device which results a kernel panic.

CRs-fixed: 387164
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
(cherry picked from commit 27e77d2bda65c96815cb5f785df9ffd7bd733e6a)

Change-Id: Ic4359adf41c3da4effba25856169629787b5f7e0
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>