Revert "msm: camera_v2: Create jpeg debugfs"

This reverts commit 6838e3b0216a5364afe7ced27c0daaf7ccb1251a.
Revert "msm: camera_v2: Handle vfe camif irq before axi irq"

This reverts commit c3a13bc11ca65c16f894d7c5f7621dc4ce7a43a1.
Revert "msm: camera: Do not ignore ERESTARTSYS return from wait function"

This reverts commit b91ef45e778b7f9537c635f4a0e366c7a528a12c.
Revert "msm: camera: return -EIO if daemon hasn't fully launched"

This reverts commit 92ee05280bb0072b15473aee9eff08fdd8bba40a.
Revert "msm: camera2: cpp: Set exact size for firmware loading."

This reverts commit fbead4dc0cac98c20478ca3c20d8ff0dcc958947.
Revert "msm: camera_v2: Don't touch CCI if camera daemon crashed."

This reverts commit f4803c32b77fe5455a2f7f4e07004cabc8d28585.
Revert "msm: camera: Exit gracefully while camera daemon crashes"

This reverts commit 199bf3e43fb2af8777a871217a5677ce8a96ab08.
Revert "RIL: Fix RIL on AOSP roms using CONFIG_AOSP"

This reverts commit 22dda243c4cc8e5abe48fcf06668991b0c9f0dba.
msm: vidc: initialize venus hfi locks during hfi creation

Venus hfi locks were initialized during core init,
which is invoked when the first video instance is
created. If a debugfs command is executed before
starting the first video instance, then video driver
crashes trying to lock an uninitialized mutex.

Change-Id: I472e9de91dada94a2728dd02c747e7fde63e3e4f
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Add entry to scale buses for True 4k @ 24 fps

We weren't asking for enough bandwidth for 4k (3840x2160) @ 30 fps
sessions because we were missing an entry for True 4k @ 24 fps (which
requires less bandwith).  Now sessions of the former type are mapped to
the right ab-ib values.

Also get rid of some unused macros in msm_vidc_common.c

Change-Id: I40d3f8d079ffba586d96e8042b40bb0648ba7ae2
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Revert "[media] videobuf2-core: Use current->mm_active when locking USERPTR"

Reverting commit 705d2156b85febeb47509e9d955052790b9025e0 because using
mm_active seems too unreliable. When current is a kthread, there's no
guarantee that there will not be a context switch between down_read and
up_read, which causes panic due to mismatched up/down_reads.

CRs-Fixed: 623719
Change-Id: Ibfb1ad81fbe30be88ccc5f38482578fee09dd83a
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Free smem client after moving core to UNINIT

If userspace crashes prematurely, there will be a good chance that the
driver hasn't unmapped or freed certain buffers.  These buffers will be
freed in the state transition to UNINIT.  At that point the smem client
needs to be valid for the free/unmaps to be valid.

CRs-Fixed: 611946
Change-Id: I089dcbd1e79f1c2a8671e5719d3a5dbc9926b252
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Re-program the vbif settings post-power collapse

As part of power collapse we turn off the venus GDSC. When we turn it
back on, we need to re-program the VBIF registers to overwrite the
reset values.

CRs-Fixed: 585609
Change-Id: Ic2ac40274773f9592f510ccb573b9d4920a8647f
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Add min resolution check for video session

Add a check for minimum supported video resolution, based
on firmware capabilities and reject unsupported video sessions.

Change-Id: Ib5a4eb6e6ab66408cf13829e20d3933138f357c1
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Update vb2q buffer sizes

Currenttly is updating vb2q buffer size on CAPTURE port.
only.This change will update the buffer size on OUTPORT port
along with CAPTURE port.

Change-Id: Ieb0a898ae5b012f3bf1a1073d2ddf5ce72647252
CRs-Fixed: 621134
Signed-off-by: Prasad Nallani <pnalla@codeaurora.org>
Revert "msm: wfd: Restart hrtimer after forwarding it"

This reverts commit Ia8e82a6ad327acddc135835268a755e3646d2ee8.
Calling hrtimer_forward_now() outside of the hrtimer callback context
and not restarting it seems to be a misuse of the hrt APIs.

Change-Id: Idd3f967d8037435ec43bbd843ce122d989aa838a
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: wfd: Add timeouts to completions

In the case of Venus going into a bad state and not returning buffers,
timeout of the completion so that the driver isn't stuck perpetually
waiting for a buffer.  This at least gives the driver a chance to clean
up and exit gracefully.

Change-Id: I05dd1e2977999bd17bd79e78eb8882fddf6a4aa4
CRs-Fixed: 589645
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: wfd: Lock the state in vsg_start

Protect the state in vsg_start with a mutex as it can be accessed from
other threads.

CRs-Fixed: 634425
Change-Id: I823b34f1b310092ea100d366d92a3293a0c74e6d
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
videobuf2-core: Avoid locking userpages if no current->mm

If vb2_qbuf is called within the context of a kthread with no "user
memory map", current->mm will be NULL causing a fault when attempt to
lock the non-existent pages.

As such, perform a cursory check for a non-NULL current->mm before
locking the userspace pages.

CRs-Fixed: 623719
Change-Id: I138ba4d1611fae821e723a11b01046e5fc4f9092
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: send release buffers cmd during instance clean up

During instance cleanup, if internal or output buffer
list is not empty, respective buffers are unmapped.
Modify the cleanup instance to send release buffers to
video core if internal or output buffer list is not
empty and then unmap the respective buffers.

CRs-Fixed: 619239
Change-Id: I56bd4248173992dedfb36098dfa9ddf35fc12a4e
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>