msm: vidc: Enable clocks before iommu attach

Change the fw load sequence to match the opposite of
unload sequence. This makes sure all clocks are on before calling
iommu attach.

Change-Id: I1113357c37158da5889f26da8fd4a74d0d170c07
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: compr: Ensure drain sequence is executed

This change ensures drain sequence is executed even if
a pause/resume commands are sent from userspace while
the control thread is waiting for all buffers to be consumed
by DSP.

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: storage: ene_ub6250: fix warning for the frame size

[-Wframe-larger-than=]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
vfs: fix bad hashing of dentries

Josef Bacik found a performance regression between 3.2 and 3.10 and
narrowed it down to commit bfcfaa77bdf0 ("vfs: use 'unsigned long'
accesses for dcache name comparison and hashing"). He reports:

 "The test case is essentially

      for (i = 0; i < 1000000; i++)
              mkdir("a$i");

  On xfs on a fio card this goes at about 20k dir/sec with 3.2, and 12k
  dir/sec with 3.10.  This is because we spend waaaaay more time in
  __d_lookup on 3.10 than in 3.2.

  The new hashing function for strings is suboptimal for <
  sizeof(unsigned long) string names (and hell even > sizeof(unsigned
  long) string names that I've tested).  I broke out the old hashing
  function and the new one into a userspace helper to get real numbers
  and this is what I'm getting:

      Old hash table had 1000000 entries, 0 dupes, 0 max dupes
      New hash table had 12628 entries, 987372 dupes, 900 max dupes
      We had 11400 buckets with a p50 of 30 dupes, p90 of 240 dupes, p99 of 567 dupes for the new hash

  My test does the hash, and then does the d_hash into a integer pointer
  array the same size as the dentry hash table on my system, and then
  just increments the value at the address we got to see how many
  entries we overlap with.

  As you can see the old hash function ended up with all 1 million
  entries in their own bucket, whereas the new one they are only
  distributed among ~12.5k buckets, which is why we're using so much
  more CPU in __d_lookup".

The reason for this hash regression is two-fold:

 - On 64-bit architectures the down-mixing of the original 64-bit
   word-at-a-time hash into the final 32-bit hash value is very
   simplistic and suboptimal, and just adds the two 32-bit parts
   together.

   In particular, because there is no bit shuffling and the mixing
   boundary is also a byte boundary, similar character patterns in the
   low and high word easily end up just canceling each other out.

 - the old byte-at-a-time hash mixed each byte into the final hash as it
   hashed the path component name, resulting in the low bits of the hash
   generally being a good source of hash data.  That is not true for the
   word-at-a-time case, and the hash data is distributed among all the
   bits.

The fix is the same in both cases: do a better job of mixing the bits up
and using as much of the hash data as possible.  We already have the
"hash_32|64()" functions to do that.

Reported-by: Josef Bacik <jbacik@fb.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
build: Enable unsafe-math-optimizations

* If the selected floating-point hardware includes the NEON extension
  (e.g. -mfpu=‘neon’), note that floating-point operations are not
  generated by GCC's auto-vectorization pass unless
  -funsafe-math-optimizations is also specified. This is because NEON
  hardware does not fully implement the IEEE 754 standard for
  floating-point arithmetic (in particular denormal values are treated
  as zero), so the use of NEON instructions may lead to a loss of precision.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: Export user_policy min/max

Add sysfs nodes for user_policy min and max settings.

Bug 888312

Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: 7415/1: vfp: convert printk's to pr_*'s

This is mainly to get rid of the "vfp_pm_suspend: saving vfp state"
message flooding the kernel message ring by default.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: ondemand: Resolve deadlock when waking up sync thread

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: add tracing events in mdss driver

Add tracing points in key points in driver.

Change-Id: Ie31e27be4890e2e7cd573c00dbf3f66fa9c62060
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss add bw related events for command mode panels

Add events to observe when bandwidth is requested,
when bandwidth is needed and when bandwidth is released
for command mode panels.

Change-Id: I56b8ce28683696bee50e9cd10351076c49e4a84c
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: add systrace begin/end trace events

Adding trace points for systrace at various points in
the driver.

Change-Id: I4783fd2982bddb7f111de9e064bcaff153eb1ce1
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Issue ctl sw reset when underrun happens

If underrun occurs in dual pipe mode (edp, or HDMI) then
there is a chance the 3d_mux will get confused and route
right to left and left to right. This will happen if it
is on the right side when the underrun condition happens.
To fix this following steps are required:

 - Disable HW recovery
 - When underrun is detected, wait for vsync.
 - Issue sw_reset to the ctl path.

This is required to cleanly reset the 3d_mux in case the
swap has occurred.

Change-Id: I8fbf747da4720c12d48bc1ee431bab6224148e31
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mdss: dsi: Fix null dereferences

Fix potential null dereferences in driver.

Change-Id: Idd8d4eb16bb1b9562da1f5225d91cf90d8230bfe
Signed-off-by: Charles Bin <cbin@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Check ctl power on status before BTA status check

Control path power on status should be checked before BTA status
check else command sending failure and IOMMU page faults during
bootup can be observed if ESD is enabled for device. Currently
IOMMU is not powered on when commands are being sent.

Change-Id: Ice66f38e79755eb14843fc63afe058e4bab2f0e2
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Wait for vsync before iommu attach during cont splash

During first borderfill commit in splash cleanup, wait for vsync
before iommu attach to prevent IOMMU page faults during bootup.

Change-Id: I68b7162d090513b082cbd4c0013731cedc0ebdbe
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: dsi: Share panel alignment restrictions through sysfs node

Read panel alignment restrictions on left, top, width and height values of
the updating ROI from the dtsi file and share through sysfs node.
Framework needs these details for configuring MDP for certain
features (e.g. Partial frame update).

Change-Id: Ibe6973b721bb20120a6d7a217bad2d0d159cc836
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Share minimum width and height limitations on panel ROI

Add panel ROI limitations on minimum width and height values
to the panel info sys_fs node.

Change-Id: I3297beb20e7f207a296e6cec114daf2305324898
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: add support to validate pixel extension calculations

If a layer needs a scaling than its pixel extension values are calculated
in the user-space library and passed down to driver. Currently driver
blindly programs these settings to HW without validating for correctness.
This leads to HW hangs and stability issues. Add a proper sanitization
checks for pixel extension and report error back to user-space if any.

Change-Id: I086cf0b23fbccd37a23bb509f067bffdf396c247
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: fix bug for validating pixel extension calculations

While validating pixel extension calculations from user space,
validate the over fetch pixels with image dimentions in both
horizontal and vertical directions

Change-Id: I8e39e89d9ace8e26237b3b23ca375456abd804a1
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mdss: mdp: reset init phase and phase step to default

reset the init phase and phase step registers to default
when the pixel extension are not calculated in userspace.

Change-Id: I876f1628fb46901a07deb1b97a4ab55f924612b0
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>