USB: Prevent system suspend when HSIC device is active

Some buses like HSIC would like to keep device in suspend state after system resume. The
remote wakeup or interface activity later will auto resume the device. This will work only
if the device is auto suspended before system suspend. If the device runtime state had been
active during system suspend and system suspend routine put the device in suspend, it will
not be resumed during system resume. When remote wakeup happen for this device, the runtime
resume will not bring the device to active as runtime core think it is already active. The
HSIC bus ensure that device is auto suspended prior to system suspend by holding a wakelock
till the bus is suspended. HSIC bus is not handling the case where device is auto resumed
immediately after system suspend begins. HSIC bus simply put the device into suspend in
system suspend routine. This patch fixes above issue by returning an error code if the
device is not auto suspended during system suspend. Also add a safe guard check in HSIC
system resume routine to skip device resume only if it is auto suspended prior to system
suspend.

Change-Id: I363c9c10dff9801fcc4d700a56d5a796f5f533cd
msm: vidc: Remove kernel mapping on input/output buffers

This change will remove the kernel mapping of input and
output buffers for both video encoder and decoder to
avoid the errors resulting from ion_map_kernel() for
high resolution video concurrency use cases due to the
limited vmalloc space. It also removed the metadata
processing in kerner video driver as kernel virtual
address is removed. The metadata processing can be
done in user space video component.

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

Conflicts:
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c
msm: vidc: Fix metadata buffer size issue

- Metadata buffer size is being set to zero when
  client calls set buffer requirements to video driver.
  This change fix it by properly assigning the
  metadata buffer size to video driver.
- When continuous mode enabled, do not get min_dpb
  from resource tracker for non-H264 codecs,
  for H264 codec get min_dpb from resource tracker.

Change-Id: Ie16bc47605edc6f67dbf3ae77290d4d764c5c613
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Memset and flush codec context buffers

This change will memset and flush the codec context
buffers for non-secure case to resolve video driver
timer expire issues.

Change-Id: I6669481da3076a392061868475fc9844f2c41064
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Free buffer pool entry and then delete address table

Free the buffer pool entry first and then delete the
address table (which will unmap the buffer with iommu)
else we might get a corner case where the entry was not
freed but the buffer is unmapped and the next buffer is
mapped with the same physical address which is still
available in the buffer pool entry, which results in
video recording failure.

Change-Id: I6978d5e5de35db63f43a7f38c58940216217b676
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Correct log tagging for kernel messages

This change amends the log tagging in kernel.

CRs-fixed: 478607
Change-Id: I2c7056d8fc9ec82ffbc6824790c064033481a9af
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
msm: vidc: Update sub_anchor_mv buffer size

The sub_anchor_mv size is not sufficient if the height
is more than 1088 in video clips, this change will amend
the buffer size to avoid video hardware resulting iommu
crash failures for such clips.

Change-Id: Ie59f04b9edaa9d2364d4e5014d2eb6f882728c76
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Fix compilation errors

This change removes the compilation error in kernel
if ddl logs are enabled.

CRs-Fixed: 483776
Change-Id: Iffc37fcdd4e5ce7ddcd8560d432af5c3f3e6c433
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
msm: vidc: Do not reset VCD_FRAME_FLAG_DATACORRUPT flag for VC1

- To propagate VCD_FRAME_FLAG_DATACORRUPT flag to IL client, dont reset.

Change-Id: I68bf4c953c02a2a4327fe6e875863853cb4e0bf8
CRs-Fixed: 472798
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: vidc: Set extradata flag properly

Extradata flag is not set to output buffer header's flag in
case when a Mpeg2 clip is played and extenstion and user data
extradata is not enabled.
This change fixes the issue and set extradata flag properly
if extradata is enabled and extradata is available with the
the buffer.

CRs-fixed: 490067
Change-Id: I029dadb17d98dd37388eee34f51bd0dfaf56d14a
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Remove unwanted error message

This change removes unwanted error message about video
clock settings.

Change-Id: I49f30d681366e07a2e002a9df58460962fd12318
CRs-Fixed: 488058
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Optimize IOMMU map size for H264 decoder

IOMMU map size is not required to be double the actual
buffer size for H264 decoder. So reducing IOMMU map
size for H264 format which will enable support for
two H264 decoder instances in parallel in smooth streamig
mode where the number of output buffers equal to 18 with
each buffer size equal to 1080p buffer size.

CRs-fixed: 491718
Change-Id: Ie6782b2ff58667000213f25482eea151b849762b
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Remove unncessary unmap function calls

Calling unncessary unmap function resulting in
target reset. This change resolves the issue by
removing unncessary unmap functions in video driver.

Change-Id: I0b501f0a7115bba085b067a5e78172df210da8f1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: Add indicator for separate metadata buffers support

Add variable to check if separate metabuffers can be
enabled in video driver for specific targets.

Change-Id: I0ab3be7077d7d8286bfaa37be63705992939b72d
Signed-off-by: Deepak Verma <dverma@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/devices-8064.c
	arch/arm/mach-msm/devices-8930.c
	arch/arm/mach-msm/devices-8960.c
	arch/arm/mach-msm/devices-msm8x60.c
msm: Add support for ION Flushing without virtual address

Video has very large buffers to be flushed. Due to lack of
vmalloc space, ion_map_kernel cannot be called on each of
the video buffers. With this change the ion handle can be
flushed without the need of the kernel mapping.

Change-Id: If026f21e44a2cce6c2b8c232fc80a69d0dabcd14
Signed-off-by: Neeti Desai <neetid@codeaurora.org>

Conflicts:

	drivers/gpu/ion/ion_cp_heap.c
	drivers/gpu/ion/msm/msm_ion.c

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
gpu: ion: Use correct type for variables

Use correct type for variables to prevent overflow of signed
type when assiging from an unsigned type.

Change-Id: I0055d35c7310d111de590db3798950fd98f1b298
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
ion: remove ION audio heap ID hack

Change-Id: I9b455b409046f6e080e4333006526e5fcd9caa6d
Revert "soc msm: lowering gain level and steps to avoid distortion"

This reverts commit 26ac4ec25b7d991b47e4a9bce9d8e53fb20daad9.
ASoC: msm: Add metadata mode changes to LPA driver

Playback hangs for three seconds on seeking to EOS. This is
because the lpa driver works on period size. Partial buffers
are not handled. Add metadata mode changes to LPA Driver to
support partial frames.

CRs-Fixed: 458904
Change-Id: Ieb89b59dbca4b40ec0915a286d53c4617c23c471
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-pcm-lpa.c
	sound/soc/msm/msm-pcm-q6.h
ASoC: msm: Support independent left-right channel volume control

The current volume sent to DSP is averaged between left and
right channels. As a result with volume level as zero on one
channel and non zero on the other channel results to playback on
both channels. Add support to send left and right volumes to DSP

Change-Id: Icc5f182d138c841607ea356ec37a7f78b4ba770d
CRs-Fixed: 449284
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Jay Wang <jaywang@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-compr-q6.c
	sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c
	sound/soc/msm/qdsp6v2/msm-pcm-lpa-v2.c
	sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c