msm: vidc: Validate session_id in video hardware response

Validate session_id present in video hardware response
packet before processing it. This will avoid system reset
resulting from invalid session_id returned from video hardware.

Change-Id: I37525a3d10b5efe00734c5533931e2700f3c7513
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: Skip session id validation for HFI_EVENT_SYS_ERROR

When SSR is triggered from driver, firmware is responding with session id
as 0X0000dead. Hence, firmware response is being discarded due to such
invalid session id. Skip session id validation for HFI_EVENT_SYS_ERROR
event type.

Change-Id: I750a7332baab4ebeb7702b49ffb744aae9803a36
CRs-Fixed: 539080
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: reduce clk frquency before disable

The change ensures that the clock frequency is reduced to min
before we disable it.
With just clk_disable, rpm still votes for high voltage on CX
as venus vote is not removed.
To unvote, the frequency is set to min.

CRs-Fixed: 574365
Change-Id: I8e0515b9816f8c451d545443573afaba611aafe7
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: avoid re-initialize of v4l2 spin lock

The fh_lock and fh_list variables are initialized
during probe in video_register_device. This was
re-initialized again when a new video instance was
opened. Since all video instances shared the same
fh_lock and fh_list variable, this gave rise to a race
condition in the v4l2 video driver. Consider the
case of multiple video instances being opened simultaneously.
One video instance has acquired the fh_lock and
calls a v4l2 function which calls v4l2_event_subscribe.
During this time another video instance is opened
and it re-intializes the fh_lock, so the first
instance no longer holds the spin lock and hits
ASSERT in v4l2_event_subscribed. This change
fixes the race condition.

Change-Id: I7af98c8f091cb94e6118c9e2ea1ba5d5d44c6833
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mmc: block: check for NULL pointer before dereferencing

mmc block data can be NULL. Hence, check for NULL before
dereferencing md.

CRs-Fixed: 562259
Change-Id: I0182c216ec73347cdd2ea464f593839fffd242a9
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
3.4.81
fixed 3.4.81 build issue
ftrace have had an unused function
msm: thermal: add back the thermal throttle temperature tunable for userspace.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: thermal: fix a bug that occurs with our OC'ed clock tables. Also change some defaults for smoother throttling.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:
	arch/arm/boot/dts/msm8974.dtsi
msm: thermal: remove unused routines.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: thermal: this latest code from CAF is more agressive so let's increase the throttle point.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Revert bulk of audio patches to test if the reported problems from users (right earbud losing audio while using high volume + after disconnecting/connection HP after a call) are fixed.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:
	drivers/mfd/wcd9xxx-core.c
All these thermal stuff is unused ?
ASoC: wcd: Update of IIR Gain value

IIR Gain has been set after IIR mux setting to make sure the
gain has been properly applied on to the path. This is needed
to set the sidetone gain during voice call.

Change-Id: I13af2c5e9583a597cf774b98b1d3f422a407dea0
CRs-Fixed: 600014
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ion: system_heap: only use low gfp flags for order-0 pages

By trying a little harder to get high-order pages (by virtue of the
liberal gfp flags used for high-order allocations) we can actually
optimize performance since high-order pages seem to help a lot. Only use
the low-order flags as a last resort, when trying to allocate an order-0
page.

Change-Id: If8d8f4b1b4503b0c7546cf5a4bcdcaecd2bb5905
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
usb: misc: mdm_ctrl_bridge: Honor device polling interval

Driver is not using polling interval from device end point
descriptor. Instead driver is using hard coded value which
is inconsistent with the polling frequency required by the
endpoint of the device. If device requires polling interval
shorter than hard coded value it leads to latency to the
end to end communication. Hence use polling interval from
endpoint descriptor of attached device.

Change-Id: Ifdd7c8d6bf7c56c9285bbbd84cd447214b0cf242
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
net: usb: rmnet_usb_ctrl: Honor device polling interval

Driver is not using polling interval from device end point
descriptor. Instead driver is using hard coded value which
is inconsistent with the polling frequency required by the
endpoint of the device. If device requires polling interval
shorter than hard coded value it leads to latency to the
end to end communication. Hence use polling interval from
endpoint descriptor of attached device.

Change-Id: Iefa268ada9c672b5ccd805030b0f813f1ad9f286
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
diag: Add new polling command

Diag driver should now support a new polling command for the tools
to recognize the target.

Change-Id: Ia7966cc74c5c74693cebfd64b178831e5ca6f2dd
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>