msm: audio: qdsp6v3: Wait indefinitely for subsystems to be loaded.

Wait indefinitely for lpass or modem to be loaded instead of waiting
for a timeout of 5secs. The reason being downloading of images might
take long time.

CRs-fixed: 302002
Signed-off-by: Bharath Ramachandramurthy <bramacha@codeaurora.org>
msm: audio: qdsp6v3: Close smd ports upon failure to open.

The smd port acqusition is failing as the port is not
populated from modem . But apr driver was not releasing
the apr handle on failure.
This was resulting in failure for subsequent calls.
With this change, the smd ports will be released upon
encountering failure.

CRs-fixed: 309413
Signed-off-by: Bharath Ramachandramurthy <bramacha@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/qdsp6v3/q6voice.c
msm: audio: qdsp6v3: Modify the wait timer for apr registration

As part of subsystem restart, there was a  deadlock where
the kernel acquires a mutex as part of misc device open for
the pcm out driver and the kickstart thread also tries to
acquire the same mutex before restarting the modem
as the apr register was a blocking call.

Instead of waiting indefinitely for lpass or modem to be restarted
the apr register will wait for one second timeout and if the
subsystems are not up, return failure to userspace.
This will release the mutex acquired as part of misc device open
and kickstart thread can reload the modem.

Change-Id: I21a078314ce5fff24bb0cd43fe419dd5a2580ac5
CRs-fixed: 312818
Signed-off-by: Bharath Ramachandramurthy <bramacha@codeaurora.org>
Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>
msm: audio: qdsp6v3: Add delay in speaker device profile to reduce pop

Add delay in the power up sequence of speaker stereo device profile
To reduce the pops.

CRs-Fixed: 327943
CRs-Fixed: 329707
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
(cherry picked from commit 83cda7be04d041c6c003e8cf5fa8d7add91548d4)

Change-Id: Ice03506ce1f8d9c87da812c93a94da0ee6d617b2
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
msm: audio: qdsp6v3: Fix memory leak and error handling

The error handling of apr_reset_workqueue and apr_reset_worker when
NULL should be two seperate checks and hence should have corresponding
appropriate log msgs.

Also there is no need to allocate memory for apr_reset_worker if
apr_reset_workqueue is NULL.

Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Change-Id: I220a23729d0fc6dadce144e476a8b2af727fc6b6
(cherry picked from commit 1abc51555a2b51614682cec1e0c8959d5ed47d8d)
Revert "Input: Use accessor for MT values"

This reverts commit a99ec87b4ddfc81121189606411183d50c364de7.
Revert "Input: Send events one packet at a time"

This reverts commit f9e31088f2189d69a5951b36fa1b1ff2fb198de0.
mmc: msm_sdcc: Power down slots after reboot

Some reboot methods (eg. adb reboot) may not power
down SDCC slots. This can result in cards being
in unexpected states after reboot. Explicitly reset
slot voltage regulator on reboot.

CRs-Fixed: 341840
Change-Id: I8cdb52bc58e34900378af468794760653f3babad
Signed-off-by: Oluwafemi Adeyemi <aadeyemi@codeaurora.org>
mmc: core: Export mmc_set_ios so that host drivers can use it

mmc_set_ios() is used by host drivers during suspend/resume
routines in indirect way i.e., by calling host->ops->set_ios().
But now with MMC_CLKGATE enabled, mmc_set_ios() also updates
host->clk_gated flag. So export this API so that host controller
drivers can use it.

CRs-Fixed: 346559
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit f0410bc6dcacabf599f999f4779091f5cd2c55dc)

Change-Id: Ib7ad7588c1ba4ae5da3ceaaade18caf7c4bdecd1
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
mmc: msm_sdcc: vote for msm bus bandwidth

If there is no voting for the system fabric clock, it may run at the
minimum clock speed. If system fabric is running at lower speed (than
what is needed by SDCC workload), SDCC read & write throughput numbers may be
degraded.

This patch adds the msm bus voting for bandwidth required by SDCC driver
based on card clock speed and bus width.

CRs-Fixed: 355327
Change-Id: I7fbcbe22beb09408f8460f815a6f7d34105e21cb
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
Revert "mmc: sdio: optimized SDIO IRQ handling for single irq"

This reverts commit 06e8935febe687e2a561707d4c7ca4245d261dbe.
With the optimization, the sdio_irq_thread() sends a spurious
interrupt notification to the registered function handler during
ksdioirq thread start up. The function handler may or may not
handle this interrupt gracefully. The correct way to inform
about interrupt is to check CCCR_INTx register for pending
interrupts before calling function driver's irq handler
which is broken with this optimization, hence the revert.

CRs-Fixed: 345547
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit 6e611f2b8655684f578cb975fa0ebfd031b45d69)

Change-Id: I7ea674b7ac343491c4965b5007d4d48696cbfa43
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
pmem: Add back more detailed usage statistics
msm: gemini: Remove PMEM reference for input buffer

Remove PMEM reference for input buffer to prevent PMEM
leak during error case.

CRs-Fixed: 287889
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
(cherry picked from commit f02545235282df44dd808c523d0ec9c04be6d4fe)

Change-Id: I1b7a29873b13b8f161b7fa5d6351edf6ad8eab23
Signed-off-by: Sunil Joseph <sunilj@codeaurora.org>
msm: camera: Remove additional check in msm_queue_drain

Removed additional check in msm_queue_drain to make
sure that the list is getting emptied in all cases.

Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
(cherry picked from commit 33e638a1c229765d06a76bc84351de9407026782)

Change-Id: I6b498241490c4264f93ea37b1fa97ebda4cde910
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
msm: camera: Free buffers from frame queue at open

Free all pending frames in frame queue before cam_frame
thread opens frame device to avoid duplication of buffer
free

CRs-Fixed: 318202
Change-Id: I25d1718a37a94fa83563c4b6e99a1b7560917a7f
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
(cherry picked from commit 5dcbcb9f04a94aa6740718a1b6d39ce4548d869c)
msm: Camera: clear control queue

Clear control queue everytime before entering wait in msm_control as
there might be invalid payloads in the queue and this can lead to
not waiting at all and exit before the valid command completes.

Change-Id: Iee83bc51e0c3568f73c1f900d72df41c63a3ace6
Signed-off-by: Manogna Reddy Alle <cmalle@codeaurora.org>
(cherry picked from commit 008ccc5b4e2b7e05d1dd4d6054c31828ef29d17f)
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
msm: camera: Assign Null to unmapped addresses

Observed unhandled virtual addresses with all the camera drivers
while performing reads and writes to the ioremap addresses in different
scenarios, Hence assigining NULL to all the hardware remapped addresses
immediately after the iounmap calls

Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
(cherry picked from commit 72ee044121488cc9f4cde91c5e3a2b820d7a0fad)

Change-Id: Ia0a74ca35e8575b18da8350cb6de83752ee0b11b
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
ion: Port from CAF kk_2.7_rb1.33

*Patched for 3.0 kernels
*Reverted "gpu: ion: Add support for CMA allocations in cp heap" to avoid a massive update to dma-mapping (we don't use CMA anyway)

Signed-off-by: Sultanxda <sultanxda@gmail.com>
ion: ioctl compatibility with userland using old api

As far as I can tell, flags passed by userland are now used to determine
buffer caching.

Note in ION_IOC_ALLOC_COMPAT we are currently forcing uncached buffer
allocations (needed to make a choice here).  This
may need to change.

Signed-off-by: Flemmard <flemmard@gmail.com>
kgsl: Port from CAF kk_2.7_rb1.33

*Patched for 3.0 kernels

Signed-off-by: Sultanxda <sultanxda@gmail.com>

Conflicts:

	drivers/gpu/msm/kgsl_device.h