msm: venc: Initialize all encoder V4L2 custom control to proper type

If control type is not initialized properly, there can be a chance
default garbage values make custom control type as private.
Initialize all encoder V4L2 custom control type with proper type.

Change-Id: Ibab590d527e33642a1efffc07d57490d8390040b
CRs-Fixed: 550808
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: mdss: hdmi: Add MHL handshake

Add HPD (Hot Plug Detect) on/off and HPD line high or low pull
handshake between MHL (Mobile High-Definition Link) and HDMI
so that both the drivers are in sync on cable connect and
disconnect.

Change-Id: Ia3264983ba3b81c499e287fa6922e1511bdf65a7
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
zram: fix invalid memory access

[1] tried to fix invalid memory access on zram->disk but it didn't
fix properly because get_disk failed during module exit path.

Actually, we don't need to reset zram->disk's capacity to zero
in module exit path so that this patch introduces new argument
"reset_capacity" on zram_reset_divice and it only reset it when
reset_store is called.

[1] 6030ea9b,  zram: avoid invalid memory access in zram_exit()

Change-Id: I6616ac8f82aab6d03a47f3cfb91d28a825e6e3a6
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 2b86ab9cc29fcd435cde9378c3b9ffe8b5c76128
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
zram: don't grab mutex in zram_slot_free_noity

[1] introduced down_write in zram_slot_free_notify to prevent race
between zram_slot_free_notify and zram_bvec_[read|write]. The race
could happen if somebody who has right permission to open swap device
is reading swap device while it is used by swap in parallel.

However, zram_slot_free_notify is called with holding spin_lock of
swap layer so we shouldn't avoid holing mutex. Otherwise, lockdep
warns it.

This patch adds new list to handle free slot and workqueue
so zram_slot_free_notify just registers slot index to be freed and
registers the request to workqueue. If workqueue is expired,
it holds mutex_lock so there is no problem any more.

If any I/O is issued, zram handles pending slot-free request
caused by zram_slot_free_notify right before handling issued
request because workqueue wouldn't be expired yet so zram I/O
request handling function can miss it.

Lastly, when zram is reset, flush_work could handle all of pending
free request so we shouldn't have memory leak.

NOTE: If zram_slot_free_notify's kmalloc with GFP_ATOMIC would be
failed, the slot will be freed when next write I/O write the slot.

[1] [57ab0485, zram: use zram->lock to protect zram_free_page()
    in swap free notify path]

* from v2
  * refactoring

* from v1
  * totally redesign

Change-Id: Ic69dce098c89bb7cb5563566b802375320b90a76
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: a0c516cbfc7452c8cbd564525fef66d9f20b46d1
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
mm: remove compressed copy from zram in-memory

Swap subsystem does lazy swap slot free with expecting the page would be
swapped out again so we can avoid unnecessary write.

But the problem in in-memory swap(ex, zram) is that it consumes memory
space until vm_swap_full(ie, used half of all of swap device) condition
meet.  It could be bad if we use multiple swap device, small in-memory
swap and big storage swap or in-memory swap alone.

This patch makes swap subsystem free swap slot as soon as swap-read is
completed and make the swapcache page dirty so the page should be
written out the swap device to reclaim it.  It means we never lose it.

I tested this patch with kernel compile workload.

1. before

   compile time : 9882.42
   zram max wasted space by fragmentation: 13471881 byte
   memory space consumed by zram: 174227456 byte
   the number of slot free notify: 206684

2. after

   compile time : 9653.90
   zram max wasted space by fragmentation: 11805932 byte
   memory space consumed by zram: 154001408 byte
   the number of slot free notify: 426972

Change-Id: Ida7dcf6fbd67408e2429483c28c75f59f83310d3
[akpm@linux-foundation.org: tweak comment text]
[artem.savkov@gmail.com: fix BUG due to non-swapcache pages in end_swap_bio_read()]
[akpm@linux-foundation.org: invert unlikely() test, augment comment, 80-col cleanup]
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: b430e9d1c6d416306d44dbf3aa3148be7af78abc
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[ohaugan@codeaurora.org: Resolved merge issues]
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
ARM: dts: msm: Update ldo-delta for 8974Pro and APQ8084 based devices

The procedure of generating the voltage frequency table has changed in
a way such that we could potentially undervolt the CPU while in LDO mode.

Change the ldo-delta-voltage parameter for these devices from 50mV to
25mV.

CRs-Fixed: 569190
Change-Id: Ic814ac449a8a7f1ba41462127aa43153bef67441
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: mdss: hdmi: Avoid unnecessary BCAPS read

Don't read BCAPS (downstream device's capability register) in second
part of authentication to check if the attached downstream device is
a repeater or not. BCAPS register is already read in first part of
authentication. Reuse it's value for this purpose. This avoids any
unnecessary delays and possible arbitration for DDC line between
hardware (for third part of authentication) and software which
sometimes results in HDCP compliance 1A-07 failure or not judged.

Change-Id: I19a95e029aa31168382926f7d43920e6e24a917b
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: expose MDP capabilities through sysfs on 8x10

Currently, MDP capabilities are exposed to the client via
a dedicated ioctl.  As more capabilities are added, it becomes
difficult to have to extend and maintain header file compatibility.
This change is to add a sysfs node which can be used to get the
MDP capabilities.

Change-Id: I9eb2e5546f708eb3f46c61f9abe4f25f23cd64aa
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: camera: Check length of cmd_len to zero in isp driver

Validate the length of cmd_len not to be zero
in ISP driver which is from a userspace argument.

Change-Id: I3238cd7426c5315e49c5ac7b453156e0b3d48ec0
CRs-Fixed: 548804
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
msm: mdss: hdmi: Proper length check for EDID data block

Check for the invalid lenght of EDID (Extended Display Identification
Data) data blocks while parsing the blocks. For a valid data block,
length should not be zero or should not exceed max size.

Change-Id: I4e83b07689d2c3161048efabbad35a0ad00e371a
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: update for error logging

Use pr_err instead of pr_debug for DSI error status logging.

Change-Id: I9f2a21ada466681844f3c7d3e5a6545126ecba2b
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: vidc: Amend Q6 HFI session id entry to session list

Add session id to the session list before sending the
APR packet to avoid race conditions in APR.

CRs-Fixed: 546384
Change-Id: I10ba5afdcbb9c1bd778049c7d39b03cba045a576
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
msm:cpp: Set inst_info before send it to userspace

If IOCTL command VIDIOC_MSM_CPP_GET_INST_INFO is
called, inst_info structure must be initilaized before
it is sent to userspace.

Change-Id: I4936ae31ecd19cfd25cf22de32101fe3257889d6
Signed-off-by: Iliya Varadzhakov <ivarad@codeaurora.org>
ARM: dts: msm: add device info for reducing power stage

B-family PMIC can optionally support reducing power stage
for improving IADC accurancy. This work around occupies while
charging under high load during low battery voltages. In case
board has a bad layout, customer can enable it manually.

CRs-Fixed: 549835
Change-Id: I6c11cddfb92c657f8cbbbf9d77d30af44ba80b70
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
msm: mdss: Fix under run on HDMI on adb shell stop

Wait for at least one vsync on HDMI interface for
proper TG OFF. Calculate wait time based on hdmi
refresh rate.

Change-Id: Ia935886ba4cce9cf8d6ce994143b07060f648620
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
mdss: fb: Unblock blit ioctl calls when commit is occuring

Since BLIT calls have no effect on the frame being commited it
does not need to block in pan_idle.

Change-Id: Ic0cfa7c0c275ddc051b60ff8823fcd7299cb8b57
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
ARM: dts: msm: 8x26: add support for 1080p panel boards

Display panels often do not support run time detection. To support
different types of display, we need to create different boards. This
is currently being handled by using the platform subtype field in
socinfo. Create new files for the new panel and rename the old ones
accordingly in preparation for this new platform subtype.

Change-Id: I77d6fdaad24cce6edefeb379cf4da9a3595218da
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
ASoC: msm: Change ACDB driver to use mutex

Remove all atomic variables and provide greater
safety with mutex. Lock mutex for every access
from userspace to ensure that multiple threads
do not concurrently alter data in shared memory
which is used for Audio & Voice calibration. Also
use mutex to protect from concurrent read and write
for calibration that does not used shared memory.

Change-Id: Ib3f2e46805a83ed7e81d0abae1dde32d610b2ba9
CRs-Fixed: 555762
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
msm: vidc: Fix image version sys property processing

Venus image version is now reported through sys
property message which has different packet
structure and requires new processing.

CRs-fixed: 543466
Change-Id: I0083e1f5146d59eb311aa8e1b9b82ac5c777bbfc
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Merge "mdss: fb: Unblock blit ioctl calls when commit is occuring"