WLAN: WCN1314: Fixed kernel panic during unloading WLAN driver

Declaring completion variables, card_rem_event_var and shutdown_event_var
as global variables, because we observed these completion variables,
getting freed while wait on these variables.

(cherry picked from commit b968a7c0a3489cb09845dd53507d3df794bbca6d)

Change-Id: Ifcae4001e6bbd02f7564d62f156ec32be5472604
CRs-Fixed: 393414
Signed-off-by: c_gowri <deepthi@codeaurora.org>
msm: camera: Change timeout values for msm_server_proc_ctrl.

Allow userspace to set timeout values for msm_server_proc_ctrl.

(cherry picked from commit 5bd0660a216dfdf934e4d91b519aa04cc186c9dc)

Change-Id: Ic513d2c3707f0ed81a571d7bf7430846e947092c
Signed-off-by: Deepak Kurien <dkurien@codeaurora.org>
Signed-off-by: Jignesh Mehta <jigneshm@codeaurora.org>
Bluetooth: Fix for supervision timeout must be 6X connection interval

Added a new function to verify whether the LE Connection Update
parameters are valid instaed of verifying all the LE Connection
parameters since only update parameters are set in the Connection
Update Request.

(cherry picked from commit 95319af0612d58788279748f586cc57221c3443e)

Change-Id: I48b74375efe3429cc463db10746a2ec368719cb5
CRs-Fixed: 387146
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
msm: camera: synchronize vfe start/stop operations.

In monkey runs due to race condition vfe_start gets triggered
before vfe_stop. Add synchoronization mechanism to avoid this.

CRs-fixed: 375444
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
(cherry picked from commit eeca82f2028f888f4895c6530879446cb3a2693f)

Change-Id: Ie7397e5ad8e1467cd47b822ca2c47e15ccbf03c8
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm-camera: Add Double Padding Support in Gemini

Add support to handle the padding
on both sides of the input buffers
to the Gemini driver to support
rotation in ZSL mode

Change-Id: I4bc0ef5a3d0f551021afbb93fd57acdcc83875b4
Signed-off-by: Ashwini Rao <ashwinik@codeaurora.org>
msm: bam_dmux: Extend locking around SPS transfer call

When a new receive packet is created in queue_rx(), it is added to the
receive packet queue and also queued with the SPS driver.  Once the
packet is filled, then BAM DMUX calls sps_get_iovec() to get the filled
receive buffer.  BAM DMUX then pulls the receive packet info off of the
RX queue and compares the DMA address from the sps_get_iovec() call to
the expected DMA address.  In some cases, they do not match resulting in
BAM DMUX processing the wrong RX buffer.

Going back to the queue_rx() processing, the packet is added to the
receive queue with a mutex locked, but then the mutex is unlocked before
the call to sps_transfer_one() which allows a race condition to exist if
multiple threads call queue_rx().

During normal operation, queue_rx() is only called by the
single-threaded receive workqueue, but during the call to
reconnect_to_bam(), a race condition is expected between the call to
rx_siwtch_to_interrupt_mode() and the final call to queue_rx() if a
packet comes in and is processed before the queue_rx() call is
completed.

This change extends the receive pool mutex locking around
sps_transfer_one() call which resolves the issue.

(cherry picked from commit 00cf869cf08158aae15e568d687603512f99dfd6)

Change-Id: I9bcc089f3ce484cff7298a254382f5f22371c702
CRs-Fixed: 377609
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
power: pm8921-charger: remove OV UV irq

Enabling the OverVoltage (OV) and UnderVoltage (UV) interrupts is
causing an interrupt storm. These interrupts are not used by the
charger driver.

Remove them from being registered and enabled.

CRs-fixed: 397078
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 8a2a5f509a80b5188cd7379ad66c085344c25f77)

Conflicts:

	drivers/power/pm8921-charger.c

Change-Id: I622d0d7fd35b223c9d7eaedd6f1931dc7cb41e95
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: hidp: safely acquire hci connection

Claim device lock to safely enumerate hci connection list and bump
hci connection proxy device ref count simultaneously.

This patch incorporates David Herrmann's fix to prevent adding an
HID device when the hci connection no longer exists.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Sumit Bajpai <sbajpai@codeaurora.org>
(cherry picked from commit e0a15cea91da20b047f30244f06de238008e0685)

Conflicts:

	net/bluetooth/hidp/core.c

Change-Id: I0c9de44f8f5f909d330f97f5a0a9776eacb46f8a
CRs-fixed: 390876
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Rename hidp_find_connection()

hidp_get_connection() makes more sense because we hold a reference to the
connection inside this function.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Sumit Bajpai <sbajpai@codeaurora.org>
(cherry picked from commit c7e4ebda4ab85605b3b2aba66411989d3dafdb7d)

Change-Id: I3442281bf2142f781d8a371914a632bda2b21947
CRs-fixed: 390876
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Fix hidp_get_connection()

This functions needs crtl_sock and intr_sock to be set first.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Sumit Bajpai <sbajpai@codeaurora.org>
(cherry picked from commit be96be79a7fdd31825666ae645107da25a78bd12)

Change-Id: Ic2ecefe3eba8dfe80574755662909be3e136821a
CRs-fixed: 390876
Signed-off-by: Srivalli Oguri <oguri@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>
power: pm8921-charger: enable DCIN_VALID_IRQ as wake irq

When the device is in suspend the DCIN_VALID_IRQ is not
used as a wake up interrupt.

Fix this by configuring the DCIN_VALID_IRQ as a wake up
interrupt.

CRs-Fixed: 389524
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit 8d7b8f7264da504cc10b7d987a9ab6c62dafc9c0)

Conflicts:

	drivers/power/pm8921-charger.c

Change-Id: I56ad75068cadb658554f86ab2ddda9b008d1eb54
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
power: pm8921-charger: Start unplug check worker for DC

It could happen that the device is powered up with a dc charger.
We should start the unplug check worker when the device starts with
dc charger or else we run the risk of not detecting the dc charger
removal.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 90e49c590fccdae53933f7a8fa62a7f0d65c4a0f)

Change-Id: Iaa9e6c56c5766addbf26f1a5052c6ee923ae1013
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
power: pm8921-bms: reintroduce hkadc calibration during probe

The hkadc calibration process takes only one sample. This should be
a quick procedure to be done during probe. Without calibration the
voltage readings are skewed which affect the accuracy of BMS.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 067b0f024744f04b25766437fbd13718c71e76c7)

Change-Id: I1862c7df17f7aa9fbf339ddf9f47718b54e725f2
Signed-off-by: Srivalli Oguri <oguri@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>
Revert "power: pm8921-charger: Add power supply property"

This reverts commit 753ddad790b8c2c5536c71ffb9794ed8130712a8.

Change-Id: Ib34598c3c932d264a622f5bff411f722c7354767
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
power: pm8921-charger: resume charging based on SOC

At EOC, the battery is disconnected from the charger and starts
discharging. This can result in SOC dropping to around 93% before
charging starts again.

Manually set the CHG_VBAT_DET threshold high to restart charging once SOC
drops below keep_charge_percent.

CRs-Fixed: 404909
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
(cherry picked from commit 14e8fa1e42c02ea643d16d3f833b5d8e1b5753e6)

Conflicts:

	arch/arm/mach-msm/board-8064-pmic.c
	arch/arm/mach-msm/board-8930-pmic.c
	arch/arm/mach-msm/board-8960-pmic.c
	drivers/power/pm8921-charger.c

Change-Id: Iceb49784ec6be2c45076e33d04aac73cb9992a03
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
spi_qsd: Runtime configuration of spi gpio's

Configure the spi clk, mosi, miso, cs gpio's on per
transaction basis and unconfigure otherwise.
It will remove the conflicts if same gpio's are
being used by different modules if no SPI device
is present.

CRs-Fixed: 387043
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
(cherry picked from commit 66554a1317d40fbacd1a7e1e3210de8fb947ad57)

Conflicts:

	drivers/spi/spi_qsd.c

Change-Id: I7f121d1b663af352162064c0387e5bdf34276fec
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
PM / Sleep: Do not check wakeup too often in try_to_freeze_tasks()

Use the observation that it is more efficient to check the wakeup
variable once before the loop reporting tasks that were not
frozen in try_to_freeze_tasks() than to do that in every step of that
loop.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Conflicts:

	kernel/power/process.c

Change-Id: I2abf3a9ef06c5b90beb12bbc542a87f79e42a14a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>