msm: kgsl: fix leak in mem entry deletion

Always start back at the beginning, to iterate
over list and safe against removal of list entry.

CRs-fixed: 585363

Change-Id: I88835e2e2a211fbea7cc498d8598103abf34cfa7
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
clock-mdss-8974: Switch HDMI clocks to use the new PLL implementation

This change cleans up the HDMI VCO/PLL implementation. It implements
the HDMI VCO clock and uses generic div and mux clocks to align to
the HDMI PLL architecture.

CRs-Fixed: 456315
Change-Id: I19ef344aafc954935cd6d236f3725bf168658ec9
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
wcnss: Download NV during SSR

If CAL data is already available, then based on the intial design it is
belived that only CAL needs to be downloaded to WCNSS during SSR.
However that design was incorrect, FW always needs the NV after a
reset. So download NV (and CAL if available) during SSR.

Change-Id: I624d40ac3e195997c9638f62fcdb0e88f0cc749e
CRs-Fixed: 557561
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm: clock-mdss-8974: Enable AHB clock before register access

Enable the MDSS AHB clock for proper HDMI PHY PLL register
access. Disable the MDSS AHB clock after register access.

Change-Id: Ice8e723333f3c041bc1cffa2ebc8d7d40a8817d2
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: Fix MDP hang issue for H2V1 interleaved formats

MDSS HW with decimation block present, uses two SMP clients, Y and UV,
regardless of YUV surface is interleaved or planar. Current code takes
care of planar format but not interleave YUV. Fix this by temporarily
converting those formats to pseudo-planar while calculating SMP
requirements.

CRs-Fixed: 568011
Change-Id: I917f7dfd848144bcc4a6c463cd20fb302c432cc5
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: clock-mdss-8974: Proper hdmi set rate

Do not call set rate if the rate is zero. Reset the flag which sets
the rate on cable disconnect so that next cable connect can set the
rate again.

Change-Id: Ieb8eed3760c4b285182ae47d732352771d13b020
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: clock-mdss-8974: Dynamic HDMI PHY-PLL configuration

Implement the  HDMI PHY PLL calculator to dynamically configure the
HDMI PLL VCO to any supported pixel rate within the supported range.

Change-Id: I5665509aeaf54132ae711e3c4c9be542b25b8241
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: net: add the fix for the skb data alloc fail case

In some cases, the skb->data alloc fail, then it will get a wrong
point value from the kmalloc_caches array. The value is little then
0x10,but in the slab reference, these value are all zero value. So
change the zero judgement.

CRs-Fixed: 573650
Change-Id: Iba138838821f515b131029cf240a5a99959bb2ff
Signed-off-by: Pan Fang <fangpan@codeaurora.org>
msm: mdss: fix sw calculation of interlace x offset

Interlacing is handled in software by changing the original height to
half which would become the width after rotation. In cases of 90 degree
rotation the height becomes the displayed width so in that case the
source x offset needs to be updated to half of intended similar to
source width.

CRs-Fixed: 545926
Change-Id: I0de9adb243d6162f5387b1ebc2821141eea4b111
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
idr: fix a subtle bug in idr_get_next()

The iteration logic of idr_get_next() is borrowed mostly verbatim from
idr_for_each().  It walks down the tree looking for the slot matching
the current ID.  If the matching slot is not found, the ID is
incremented by the distance of single slot at the given level and
repeats.

The implementation assumes that during the whole iteration id is aligned
to the layer boundaries of the level closest to the leaf, which is true
for all iterations starting from zero or an existing element and thus is
fine for idr_for_each().

However, idr_get_next() may be given any point and if the starting id
hits in the middle of a non-existent layer, increment to the next layer
will end up skipping the same offset into it.  For example, an IDR with
IDs filled between [64, 127] would look like the following.

          [  0  64 ... ]
       /----/   |
       |        |
      NULL    [ 64 ... 127 ]

If idr_get_next() is called with 63 as the starting point, it will try
to follow down the pointer from 0.  As it is NULL, it will then try to
proceed to the next slot in the same level by adding the slot distance
at that level which is 64 - making the next try 127.  It goes around the
loop and finds and returns 127 skipping [64, 126].

Note that this bug also triggers in idr_for_each_entry() loop which
deletes during iteration as deletions can make layers go away leaving
the iteration with unaligned ID into missing layers.

Fix it by ensuring proceeding to the next slot doesn't carry over the
unaligned offset - ie.  use round_up(id + 1, slot_distance) instead of
id += slot_distance.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: David Teigland <teigland@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Change-Id: Ifb6d64747e7f08e2f5d7609bd66a48405f0c9b95
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: mdss: Fix under run on interlace clip play in landscape

Rotator src rect y co-ordinate is getting odd after de-interlace
calculation but mdss expects even.

Change-Id: I124d059c89c51126208ad1de02a9d34d87b0f553
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Merge "wcnss: Download NV during SSR" into jb_3.2.1_rb4.6
Merge "msm: clock-mdss-8974: Enable AHB clock before register access" into jb_3.2.1_rb4.6
Merge "msm: mdss: Fix MDP hang issue for H2V1 interleaved formats" into jb_3.2.1_rb4.6
Merge "msm: clock-mdss-8974: Proper hdmi set rate" into jb_3.2.1_rb4.6
Merge "msm: clock-mdss-8974: Dynamic HDMI PHY-PLL configuration" into jb_3.2.1_rb4.6
Merge "msm: net: add the fix for the skb data alloc fail case" into jb_3.2.1_rb4.6
Merge changes I124d059c,I0de9adb2 into jb_3.2.1_rb4.6

* changes:
  msm: mdss: Fix under run on interlace clip play in landscape
  msm: mdss: fix sw calculation of interlace x offset
Merge "idr: fix a subtle bug in idr_get_next()" into jb_3.2.1_rb4.6
Revert "msm: kgsl: fix leak in mem entry deletion"

This reverts commit bc907e7bab48655bd61dfb1e5b99976fcc8d8e03

Rebert : Requested by "Mugata, Sreenivasa Rao <c_smugat@qti.qualcomm.com>"

Change-Id: I945fe4b3af8200043e35f779b77835617a488db4