ARM: dts: msm: Update device tree node for msm-pcm-dsp

Update the name and properties for msm-pcm-dsp. Use qti instead
of qcom for device node and its properties.

Change-Id: I97d8f336be5e3b6792d99eece27c7d7773e33aa1
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: msm: Update the name for pcm platform driver.

Update the name of pcm platform driver to match with device tree
node.

Change-Id: I37063c7b6aa2a04b31f86754b24f9aa046d4c4a9
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: qdsp6: Add support for post processing on low latency path

Current implementation does not send audio calibration data to
DSP if the playback goes through low latency path. This results
poor quality audio on Speaker if it needs tuning.
Update ADM and RTAC drivers to send audio calibration data
to DSP and update properly in the QACT tool.

Change-Id: Ib4bf612ffd81b63a5e083cae7d7ded5b8239c582
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: qdsp6v2: Add support of ULL and LL

Add support for Low latency pcm and Ultra low latency pcm in
legacy pcm driver. A flag, part of device tree is used to
differentiate low latency and ultra low latency.
Only one ULL stream can be be connected to one ULL COPP.
LL stream can be connected to LL or regular COPP.

Change-Id: I2663ccdb641acc4117d1c0e424a57ed942e78f40
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ARM: dts: msm: Add low latency level to device tree

Add low latency level to device tree. Values for low latency level is
regular and ultra. Regular stands for regular low latency and ultra
stands for ultra low latency. ULL is used on 8x10 and LL is used on
8974/8x26.

Change-Id: I5f87a65ea35218ed1ff35b5fbab394d2574f0576
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ARM: dts: msm: Move data to devicetree for 8926

Move the cpu frequency and voltage data to devicetree.

Change-Id: I69a4cf3a553815a6e687fb8e3009cb31f440e809
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
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: clock-8226: Allow measurement of clocks in the WCNSS

For debugging reasons, it is required that WLAN drivers
be able to measure clocks in the WCNSS subsystem. It is
assumed that the WCNSS debug mux is already programmed
by the WCNSS firmware.

Change-Id: I3e7411021200a96454f37a1d40a17b109be4fc70
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: clock-8610: Add clock lookup entries for clock-a7 driver

Add the clock entries used to control the cpu.

Change-Id: Id0e98ac05203a932f4f92a67cc3afbcb4b95dce9
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: clock-a7: fix memory corruption due to out of boundary write

Out of bounds memory write is seen while reading the "qcom,speed-bin"
property from DTSI. Correct the memory allocation size to fix this
issue.

CRs-Fixed: 594553
Change-Id: Ica250132e9139b874102a7d6c388a76517dea6c3
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
msm: cpufreq: Avoid NULL clock pointer references

The MSM CPUfreq driver defines a mapping from cpu number to clock
pointer. On SOCs with synchronous cpus, only the mapping for cpu#0
is defined, even though there may be more than 1 cpu. Handle this
case by skipping certain unnecessary initialization steps for SOCs
with synchronous cpus.

Conflicts:
	arch/arm/mach-msm/cpufreq.c

Change-Id: Iaeba7a8615e3cb7da2c725250db92595450bfa46
Signed-off-by: Patrick Daly <pdaly@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: smd: Use irq_set_affinity() API instead of the callback in irqchip.

When affinity is set by directly accessing the function pointer via
irqchip, the irq doesn't get migrated during hotplug and could result in
spurious wakeup of offlined cores. Switch to using irq_set_affinity
which ensures that the irq gets migrated during hotplug.

Change-Id: If700323f636d4ee4978b5e168077514e4d142cb9
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
diag: dci: Safeguard to prevent Integer Underflow and Memory Leak

At certain point in diag driver there can be integer underflow
thus can lead to memory leak. Added a safeguard for that.

Change-Id: I2a0304f5b9888fe12ca9ef5fbaa9a68ee4ab9c15
Crs-fixed: 556860
Signed-off-by: Katish Paran <kparan@codeaurora.org>
ion: invalidate buffers before zero'ing

Currently, we invalidate the cache for buffers being zero'd *after* we
zero them. However, this is racey since a dirty cache line from an
earlier mapping could be written out to memory between the zero'ing and
the invalidation. Fix this by invalidating the cache *before* zero'ing
the buffer.

Before this change, I was seeing corruption with:

    $ cat <<EOF | ./memory_prof -e -i -
    simple_alloc,1,ION_SYSTEM_HEAP_ID,ION_FLAG_CACHED,0x100000,1MB
    simple_basic_sanity,1
    simple_profile,1
    simple_free,1
    EOF

After this change, no corruption.

CRs-Fixed: 585524
Change-Id: I1f2603604efc9be4ebf9112b06728e0aeca60ea0
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>

Conflicts:
	drivers/gpu/ion/ion_heap.c
msm: kgsl: Prevent device start after it is already started

Check if device is already started in high priority workqueue thread,
this check prevents calling device start after it is already started,
thereby avoiding unpredictable behavior.

Change-Id: Iffcd065f8c02746d168c8e5779d10d4b0e2404a9
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Fix mem leak when page allocation fails

Page allocation may fail during OOM condition. Update
sglen and size to correct value (allocated) so that
they get freed in kgsl_sharedmem_free().

Change-Id: I1aa0ca77bb767523dfcf0f6cc3a21eac2b6b80e4
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: vidc: fix corruption of registered buffer list

The buffer list for output buffers is accessed from
different threads leading to race conditions. Consider
the case of firmware throwing up a fatal error, which gets
propagated to v4l2 client. The v4l2 client closes the
driver fd, which will trigger msm_vidc_release_buffers
to release all output buffers and free node from
the registered buffer list. During this time, if
firmware sends a release reference event, the buffer
node being accessed in msm_vidc_release_buffers could
be freed, triggering kernel panic.

Change-Id: I522edff06a62dbc2ab60d6cca5990babb18d5c6c
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Send ABORT in FLUSH command from the Client

When session error is sent to the client, client issues FLUSH
and release buffers commands. But as instance state is INVALID,
these commands are never sent to the firmware, instead FLUSH
DONE and Release buffer done are sent back to client even
though firmware might be working on these buffers which may
result into page faults.
This change fixes the issue by sending ABORT command to the
firmware at the time when driver receives FLUSH command. Then
firmware will release all buffers, clean up session and send
ABORT_DONE back to the driver.

Change-Id: Ie4c79a312d2336c68b858f5f5e2a85331cf55f7b
CRs-fixed: 592920
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Fix unsupported codec error from video driver

- Client is getting unsupported codec error for set format
  sometimes after opening the video driver because driver
  was not updated with supported codecs information from
  video hardware.
- The same issue can be fixed by waiting for the driver state
  changed to CORE_INIT_DONE, which ensures the supported codecs
  information will be updated in video driver, before checking
  the supported codecs information.

CRs-fixed: 590158
Change-Id: Ia9132fdc01e4fa53533a3c9d14069d49501fa7d7
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>