msm: bam_dmux: tune downlink polling parameters

This change disables the BAM DMUX adaptive timer - this is to address
concerns about drops in TCP throughput for some use cases with the timer
enabled.  It also sets the aggregation to 3ms to save power while not
compromising performance. Power tests show a savings of 3-4% (compared to
having the timer poll the BAM pipe every 1 ms) for LTE (40Mbps downlink and
25Mbps uplink) and HSPA (7Mbps downlink and 384Kbps uplink) with no
degradation in performance.

Change-Id: Ia51eae773723e60d8b051766ad80bfb0a16f5f6d
Signed-off-by: Anurag Singh <anursing@codeaurora.org>
msm: bam_dmux: add loopback support

Bam dmux is currently very difficult to isolate and provide measurements
for common metrics, such as throughput and latency.

Add hooks into bam_dmux to allow for a seperate dynamically
loadable loopback module. This allows bam dmux to be isolated, and to
provide more accurate measurements of the above metrics.

Change-Id: I174d900dea73cca27d32a54a908f43728059be30
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
msm: bam_dmux: Fix race condition during SSR

BAM DMUX drivers set the global flags to identify the SSR during
SUBSYS_BEFORE_SHUTDOWN notification, but the flags change is not reflected
in some code paths like msm_bam_dmux_write().

Add the SSR flag check and SRCU locking to complete all pending bam dmux
writes before returning the control in SSR call back function for
SUBSYS_BEFORE_SHUTDOWN notification.

CRs-Fixed: 584805
Change-Id: I26647b485977943f272c44f7450ed6c4a4aa62f3
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
msm: bam_dmux: modify DL low memory algorithm

Bam_dmux maintains a pool of dynamically allocated buffers for the BAM DMA
engine to use as destination memory for Downlink (DL) data.  The allocation
requests for the buffers are done using flags to indicate delays are
tolerable and either the memory or an error should be returned immediately
to bam_dmux as the buffers are normally allocated within various hot paths
inside of the driver.  If a low memory allocation failure is encountered
when attempting to replenish the pool of buffers, bam_dmux will either
attempt the memory allocations later when the next scheduled pool refilling
occurs if there is at least one buffer remaining in the pool, or will
schedule a delayed task to retry the buffer allocation until atleast one
buffer can be put into the pool.

This mechanism of handling low memory situations has two flaws.  First, the
allocation type used by bam_dmux does not trigger the standard low memory
recovery mechanism within the memory management subsystem.  Second, the
peripeheral on the otherside do the DMA engine has a limited hardware based
flow control mechanism that will not release flow control with only one
buffer queued to the DMA engine.

To assist in system recovery, and avoid a data stall, create a cold path
that is tolerant of memory allocation delays and is triggered when the hot
path encounters an allocation failure.

CRs-Fixed: 589665
Change-Id: If72b0eaef285ac6dfd99e97bef1cd7df154e3a48
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
qseecom: Validate the incoming length from user space

Check if there is no integer overflow before using req_len and
resp_len (received from user space). If an overflow is detected
then exit the operation.

Change-Id: I0459a6992bb3b280db42be63a275c55fa6105b1c
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
ASoC: wcd9xxx: Don't change button threshold registers

If registers which effect button detection are changed
when mbhc is still in recovering state, sometimes release
interrupt is not getting triggered.So don't modify registers
which effect button detection.

CRs-Fixed: 576855
Change-Id: I307ea4a112d81fecfe23eb58733913b4453284cd
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
msm: ipc: Possible memory corruption due to Sign Conversion

msm_ipc_router_skb_to_buf() takes an unsigned argument and assigns the
same to a signed local variable. This might cause issues when the value
of the argument is too high.

Change the datatype of the local variable to unsigned.

CRs-Fixed: 550606
Change-Id: I257a095681dd82fba05367fd6faf25820e95c719
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
msm: Remove old unused sdio related code

Cleanup mach-msm by removing unused sdio related code.

Change-Id: I485deb7d6499771294b494f5542ba510c10255cb
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
msm: qdsp6v2: NULL pointer check on userspace data argument in kernel

The null pointer check is required to ensure that userspace data
in kernalspace is not null.

Change-Id: I9e522c393ae643626a4bae03731a73f5d6db6458
CRs-Fixed: 563752
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
mmc: card: fix arbitrary write via read handler in mmc_block_test

In mmc_block_test, the debug_fs based read function handlers write to an
arbitrary buffer which is given by any user. We add an access_ok check
to verify that the address pointed by *buffer is not in kernel space.
Only if the buffer is valid, do we continue the read handler.

Change-Id: I35fe9bb70df8de92cb4d3b15c851aa9131a0e8d9
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
ARM: dts: msm: Add NFC device for PVT device

Add nfc nci device to the device tree for PVT device

Change-Id: Ib582efaead9a6dba038b332f30ef8e3a40211fd4
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Merge "msm: Remove old unused sdio related code"
msm: gpiomux: add the hisense nfc gpio

Add the nfc gpio for the hisense device, and add the
compatibility of mtp device.

Change-Id: I40f5a2aad3ea682ad553b5974c1cc34803cff842
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Signed-off-by: Pan Fang <fangpan@codeaurora.org>
msm: gpiomux: remove conflict between nfc and camera on Hisense

stop camera from holding pin8 low
enable nfc to use pin8 for i2c

Change-Id: I0cb9e1fbc9de40fdac728cb66d9a0bc422c98e22
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
ARM: dts: msm: remove dtsi entry for hisense v1 device

This entry generates kernel error messages on PVT devices

Change-Id: Ieeeb77a9e406330b7503113848784942f7a70777
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
NFC: Implement GP clock for 8610 qrd V2 skuaa devices

Enable General purpose clock 1 for 8610 qrd skuaa V2 devices from nfc-nci device.

Change-Id: Ia4f88b670d691d0202f452b3228eacf333b4e812
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
msm: clock-8x10: Update lookup table for NFC clocks for PVT

I2C clock and GP clock configuration
for QCA199x NFCC on PVT devices.

Change-Id: Ie9bee72e0b62255e3d2610c60f5f69fcdf69bfdc
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
csdio: Remove the driver

The driver is a legacy driver that is not used any longer
and its implementation is neither correct nor compiles.

Change-Id: I9862c0f93ccad6079a616f6997987d4e187a137c
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
Merge "csdio: Remove the driver"
msm: rpm-smd: use data type correctly for a variable

Change variable data type from signed int to unsigned int.

CRs-fixed: 556055
Change-Id: I6bb363b31d4fab26d84f89e775101c6051fe9e10
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>