msm: video: wfd: Move domain specific mappings into subdevices

Move the domain specific mappings into subdevices to abstract away iommu
from wfd-ioctl.c.  This is especially needed as the encoder subdevices
for MSM8x60 and MSM8x74 differ in the iommu domain to which they map the
buffer to.  This target specific handling needs to taken care of by the
respective subdevices rather than by wfd-ioctl which should be target
agnostic.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>

Conflicts:

	drivers/media/video/msm_wfd/mdp-4-subdev.c
Change-Id: I83b2cbcff2b86b0f9cce9844b1e3b1607f5881ca
Signed-off-by: Neha Pandey <nehap@codeaurora.org>

Conflicts:
	drivers/media/video/msm_wfd/mdp-4-subdev.c
msm: vidc: Adds VUI timing info support for AVC encoding.

Poor video quality is observed as VUI fps information is not present in
the encoded bit stream. Add support for VUI timing info in video driver
and an additional V4L2 control to set from user space.

CRs-Fixed: 399017
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Conflicts:

	include/linux/videodev2.h

Change-Id: I970d4c479009da2d08531a9e9b8489a84cc5d44c
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: vidc: Separate meta buffers support in secure mode

Extradata is appended at the end of each output buffer
in non secure video use case but in secure video playback,
the client/CPU don't have access to the output buffer
to parse the extradata. This change allows the client/CPU
to parse the extradata by allocating separate buffers for
video hardware to store extradata.

Change-Id: I12927ea3d142b9cecd6fb1ae1086c5624d0e08d6
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Add a check for separate metadata buffers

Added a check for separate metadata buffers based on
the board specific platform data.

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

Conflicts:

	drivers/video/msm/vidc/1080p/resource_tracker/vcd_res_tracker.c

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

Conflicts:
	drivers/video/msm/vidc/1080p/resource_tracker/vcd_res_tracker.c
msm: vidc: add support for the bitstream_restrict flag

Adds support for the MFC core to add the bitstream_restrict flag in the
sps/pps for H264 codecs.  This allows for the decoder to determine how
many frames to buffer when decoding.

Change-Id: I30dc17a29b9fcc1ee76265f0318a0a581316dd49
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>

Conflicts:
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl.h
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_properties.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_shared_mem.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_shared_mem.h
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_vidc.c
	include/media/msm/vcd_property.h
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>
asoc: msm: Add flexible period count to pcm record driver

 In pcm recording, if buffers are not requested from dsp at real
 time then dsp drops the buffers and sends partial buffers. This
 is causing record failures. Pcm record platform driver has two
 periods. If system is loaded, read request will not be at real
 time. Add flexible period count to pcm record platform driver
 so client can configure the period count.

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

Conflicts:
	sound/soc/msm/msm-pcm-q6.c
ASoC: msm: Register restart api for under run issue.

Update compressed platform driver to register an restart callback.
Implementation of the restart callback is to issue an pending buffer
Written by application to restart the session when  the de queue
Process is stopped due to underrun issue.

Restart callback is triggered from the ALSA core framework when
Framework detects that the render stopped pulling the data
And application is writtig the data.

This callback will be running in atomic context.

Change-Id: Iada382f39bd052beeb0b1d165959d510fa51ff7c
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
ASoC: msm: Modify min and max period bytes and num periods

Modify min and max period bytes and number of periods in
compressed driver so as to be consistent with lpa and to
meet ION memory requirements. This avoids using huge
buffer sizes for tunnel decode.

Change-Id: Ib71da4cebfc097e7aeaf0ca0e65ee847ba7cceb7
Signed-off-by: Phani Kumar Uppalapati <phanik@codeaurora.org>
ASoC: compr: change sequence of softvol

As the ASM session is opened in hw_param the soft volume does
not take effect. Hence move it to hw_param so its applied after
asm open.

CRs-Fixed: 434323
Change-Id: I1ce24d74382bd2c1926df2d63ff2eb40b0652f95
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
ASoC: msm: proper error code for drain ioctl

If a drain ioctl on a compressed driver has been interrupted
by a reset ioctl, we need to return a proper error code for the
drain ioctl

Change-Id: I15f42a22b1cc13b3a0e2ae873adfcd1db2ac1e53
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
CRs-Fixed: 445370
ASoC: msm: Allow drain only if a write was called

For compressed drivers, allow the drain ioctl only if
there are pending writes. Return a proper error (-EWOULDBLOCK) otherwise.

Change-Id: I4799351a8930c44d88d6968802df98896fc1531a
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
CRs-Fixed: 445370
ASoC: msm: Resume writes only for start command

For compressed and LPA drivers, set pending_buffers flag to 1 only if the client
issues a trigger_start command, not a pause_release command. This flag
is used to initiate writes to the dsp.

Change-Id: I503156863646210b460613a0b9a26a6bfb8854ed
CRs-Fixed: 442269, 449126
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-compr-q6.c
ASoC: msm: skip sending volume in compressed pass through playback

For the playback use of compressed pass through on HDMI device,
post processing features are not supported and should not be sent to
DSP. Hence the change is now to send the volume only for the playback
of decode and render in DSP and skip for compressed pass through

CRs-Fixed: 442140
Change-Id: I2125f08baf1676f6bb1d13463a1f01dfe280963f
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
ASoC: msm: avoid negative time stamp check

Time stamp is unsigned. There is no need to check for
negative value.

Change-Id: I15e380f81e46908f6a9fe8d29c174de1b7c33173
CRs-fixed: 423372
Signed-off-by: Patrick Lai <plai@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/qdsp6v2/audio_lpa.c
	include/sound/q6asm-v2.h
	include/sound/q6asm.h
	sound/soc/msm/msm-pcm-lpa.c
	sound/soc/msm/qdsp6/q6asm.c
	sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c
	sound/soc/msm/qdsp6v2/msm-pcm-lpa-v2.c
	sound/soc/msm/qdsp6v2/q6asm.c
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>
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>
ASoC: msm: flush if prior and current backends rate not matching

It is found that during device switch from one backend
with one sample rate to another backend with another sample rate,
the command to QDSP6 ADM which maps audio stream session to a
particular backend would not get carried out until pending
data of audio stream session from previous backend is either
read out or flushed. This scenario occurs when application
stops providing more buffers to retrieve captured data.
Remedy is to flush upon detection of rate mismatching

Change-Id: I2c01c036d9bb71f938a6795337f08948bd986553
CRs-fixed: 422205
Signed-off-by: Patrick Lai <plai@codeaurora.org>
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: msm: Add support for external EC reference point

Add mux to sound card topology with output of mux routed
to CS voice uplink front-end as way to indicate external
EC reference point. Currently, MI2S_TX is the only
AFE input port defined for this MUX.

Change-Id: I0c81c579cc01bf92e743eda0e8dee15be2a8c01f
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
ASoc: msm: update the pending buffer flags in underrun

Update the pending buffer flag on a driver underrun.
This causes a drain call to be rejected if the underrun
happens immediately after an EOS buffer has been given to the DSP
following a flush

CRs-Fixed: 463332
Change-Id: I2ba224a49e5af14ca909300afc0788cb4b21eb16
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>

Conflicts:
	sound/soc/msm/msm-compr-q6.c