ASoC: msm: Fix ADM GET PARAM callback

Add size check on inband get param call and do
not process inband if RTAC is active.

Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: update format during downscaling

When downscaling is enabled, update the port format
parameters based on port type.
Avoid updating the instance property during reconfig event
with sufficient resource. IL Client expects downscaled
parameters rather than reconfig parameters.

Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: ensure venus clocks are enabled while release buffer

While interframe clock gating, venus clock are gated ON and
OFF based on firmware response. It may happen that venus
clocks are disabled while iommu driver unmaps output buffers.
This may lead to unclocked memory access.
Venus clocks should be enabled while releasing output buffers.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Increase I-frame period to INT_MAX

There is no restriction on I-frame and IDR period
values, so set them to INT_MAX.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: configure and set hier-p layers

Firmware requires the max number of hier-p layers
to be used during the encode session to be set
in load resources state. Without this change,
firmware will not enable hier-p encoding. Also
switch to using HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER
to set the number of hier-p layers.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add NULL pointer check before deiniting controls

Add NULL pointer check in deinit function, and return -EINVAL
when NULL pointer is found.
Without this change, accidentally, msm_venc_ctrl_deinit() will be called
with a null pointer parameter, which will cause kernel panic.

Signed-off-by: huiy <huiyQuic@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: remove non fatal error messages

V4L2 core fails reqbufs ioctl if file IO is in
progress. This message is non fatal, so avoid
logging it as a error message in the video driver.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for setting initial qp

Adds support to set initial qp, thereby allowing the client to set
initial qp for I,P, and B frames.

Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: fix failure to set LTR with index value

When MARKLTR/USELTR was set with a index value the value never
propagated to firmware resulting in failure to set the property.

Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add AFD and CC metadata support to extradata

Add support and control for setting Active format
description and closed caption meta data in the
extradata. FW parses metadata and adds it to the
extradata. Client can use control to parse extradata
for the metadata information.

Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Advertise extradata size in queue_setup()

If extradata is enabled, the correct size must be advertised as part of
queue_setup().  Prior to this commit, the output buffer size was taken
to be the extradata size.

In order to make sure that we aren't advertising stale buffer sizes,
query the core for both CAPTURE and OUTPUT planes.

Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Fix race condition during concurrent sessions

The core->instances list structure is guarded by
mutex core->lock, whenever a new video instance is added
or deleted from the list. However this list was accessed
from certain functions without acquiring the lock, which
resulted in race condition, causing the device to crash.
Also clean up the core locking mechanism.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: change concealment color

0x8080 is gray color concealment, changing it to
black color, which is 0x8010.

Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Change in input buffer size calculation

Right now, input buffer size is calculated based on
maximum supported height and width returned from FW.
These values are not true representation as they are
calculated for rotation usecase. Driver needs to use
max MB supported from FW. This change fixes the same.

Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: add new control for limiting i/p buffer size

Take the minimum of the size calculated by driver using
max width and height supported and the size set by client
for input buffers. Change interface to get input and
output buffer sizes.

Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: remove fw version condition for core capabilities

Different core capabilities are supported from fw version
1.4 onwards, so removing fw version condition from driver.

Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for different errors

When hardware is overloaded or when max number of clients are
reached in driver or firmware, hardware error is sent to video
client. This change is to replace hardware error with actual
errors.

Signed-off-by: Deepak Verma <dverma@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: do not check for session supported in executing state

The v4l2 video driver should check if the video session is supported
only prior to entering the executing state. Once video session is
in executing state, the session should be always honored.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Print out the proper height and width in debugfs

The driver was printing out the width and height from the OUTPUT port by
default, which is controlled from the client.  If the client doesn't
know any better and sets a bogus width and height, we would mirror that
in debugfs.  The width and height on the CAPTURE port is something we
receive from Venus and is guaranteed to be correct.

Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: avoid setting smoothstreaming for Q6

Smoothstreaming is not a tested functionality on Q6.
This change will return error to all clients trying
to configure Q6 in smoothstreaming mode.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>