Revert "Revert "N9005 MJ6 mdss changes""

* reverted again for EUR and KTT builds (bootloops)

This reverts commit 0ca9982f138a7f9e6a749b5d20162dd0bb117627.
ARM: 7461/1: topology: Add arch_scale_freq_power function

Add infrastructure to be able to modify the cpu_power of each core

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7462/1: topology: factorize the update of sibling masks

This factorization has also been proposed in another patch that has not been
merged yet:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/080873.html
So, this patch could be dropped depending of the state of the other one.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7463/1: topology: Update cpu_power according to DT information

Use cpu compatibility field and clock-frequency field of DT to
estimate the capacity of each core of the system and to update
the cpu_power field accordingly.
This patch enables to put more running tasks on big cores than
on LITTLE ones. But this patch doesn't ensure that long running
tasks will run on big cores and short ones on LITTLE cores.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7482/1: topology: fix section mismatch warning for init_cpu_topology

Get rid of this warning..
arch/arm/kernel/built-in.o(.text+0xac78): Section mismatch in reference
from the function init_cpu_topology() to the function
 .init.text:parse_dt_topology()
The function init_cpu_topology() references
the function __init parse_dt_topology().
This is often because init_cpu_topology lacks a __init
annotation or the annotation of parse_dt_topology is wrong.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
sched: cpu_power: enable ARCH_POWER

Heteregeneous ARM platform uses arch_scale_freq_power function
to reflect the relative capacity of each core

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1341826026-6504-6-git-send-email-vincent.guittot@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
msm: mdss: Fix NULL pointer deference in mdss_mdp_overlay_handle_vsync

Add NULL pointer checks to avoid NULL pointer dereference
resulting in kernel panic.

CRs-Fixed: 573022
Change-Id: Ib7fd1bb75553441c1100a1c2d0cf1ae56108c125
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: Check ctl in mdss_mdp_mixer_get before using

Put NULL check for ctl before using in mdss_mdp_mixer_get.

Change-Id: Ia1bc035df46c9e237c244623e61a6802cf0d9110
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: Fix NULL pointer dereference in sensors ADSP driver.

Memory is allocated on the heap via kzalloc for temp variable.
Then it is passed through error checking. Error checking is
incorrect however, because instead of immediately returning -ENOMEM,
the function continues without returning. temp could be potentially
NULL when passed in to memcpy, causing a NULL dereference and writing
to that location.

Change-Id: Ib9faef2a542d1d8da35e1b3f7292596c9bddadba
CRs-fixed: 563553
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
msm: ocmem: Do not return error when debugfs is disabled

The ocmem driver probe fails, when debugfs is disabled,
as it cannot create a debugfs root node. Do not return
and error, so that ocmem driver can function even when
debugfs is disabled

CRs-Fixed: 548301
Change-Id: I9dca715e9317d481b0dee1c7275c86a10e3cdce1
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
(cherry picked from commit 3c8bdd83bf4dfdd36f5eda00124a737e1df15b0e)
msm: smp2p: fix potential uninitialized variable access

From code inspection, there is a possibility of using variables that
have not been initialized in certain failure scenarios.

Initialize variables to default known values in case the error
conditions are hit.

CRs-Fixed: 505235
Change-Id: I85fbb872573326c853be1f6a7a9a1a62f5636ca1
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Linux 3.4.70
msm: mdss: Add NULL pointer checks in mdss_mdp_wb_set_secure

Null pointer dereference can cause kernel panic, hence add
checks to avoid them.

CRs-Fixed: 553552
Change-Id: Ia854d7b65a5cf6a0fa214c34e658ea0f1380ac2c
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>

Conflicts:

	drivers/video/msm/mdss/mdss_mdp_wb.c
msm: kgsl: Switch to default pagetables in case of NULL context

Switch to default pagetables when context is NULL. This prevents
instances of page faults when switching to default pagetable when
GPU is busy.

CRs-fixed: 550082
Change-Id: I74bab681b823bf50e58b50b6cb819fbf93163bf7
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
(cherry picked from commit e1c7a9fdeb38d37bfe441b73dcfd67298a8f1c23)
cpufreq: ondemand: update sampling rate only on right CPUs

Fix cpufreq_gov_ondemand to skip CPU where another governor is used.

The bug present itself as NULL pointer access on the mutex_lock() call,
an can be reproduced on an SMP machine by setting the default governor
to anything other than ondemand, setting a single CPU's governor to
ondemand, then changing the sample rate by writing on:

> /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate

Backtrace:

Nov 26 17:36:54 balto kernel: [  839.585241] BUG: unable to handle kernel NULL pointer dereference at           (null)
Nov 26 17:36:54 balto kernel: [  839.585311] IP: [<ffffffff8174e082>] __mutex_lock_slowpath+0xb2/0x170
[snip]
Nov 26 17:36:54 balto kernel: [  839.587005] Call Trace:
Nov 26 17:36:54 balto kernel: [  839.587030]  [<ffffffff8174da82>] mutex_lock+0x22/0x40
Nov 26 17:36:54 balto kernel: [  839.587067]  [<ffffffff81610b8f>] store_sampling_rate+0xbf/0x150
Nov 26 17:36:54 balto kernel: [  839.587110]  [<ffffffff81031e9c>] ?  __do_page_fault+0x1cc/0x4c0
Nov 26 17:36:54 balto kernel: [  839.587153]  [<ffffffff813309bf>] kobj_attr_store+0xf/0x20
Nov 26 17:36:54 balto kernel: [  839.587192]  [<ffffffff811bb62d>] sysfs_write_file+0xcd/0x140
Nov 26 17:36:54 balto kernel: [  839.587234]  [<ffffffff8114c12c>] vfs_write+0xac/0x180
Nov 26 17:36:54 balto kernel: [  839.587271]  [<ffffffff8114c472>] sys_write+0x52/0xa0
Nov 26 17:36:54 balto kernel: [  839.587306]  [<ffffffff810321ce>] ?  do_page_fault+0xe/0x10
Nov 26 17:36:54 balto kernel: [  839.587345]  [<ffffffff81751202>] system_call_fastpath+0x16/0x1b

Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Conflicts:

	drivers/cpufreq/cpufreq_ondemand.c
cpufreq: ondemand: use system_wq instead of dedicated workqueues
touchscreen: use system_wq instead of dedicated workqueues
qseecom: Add cache functionality

Flush the buffers to physical memory before invoking
scm_call to ensure data in buffers is not stale.

Change-Id: If756e12e4cceb29f3d0e1a04618a037494f31cf7
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
qseecom: Add new IOCTLs to support secure UI feature

User space sends the buffer to TZ to use it for secure UI features.
Buffer shall be protected based on the use case, two APIs are
introduced to support this feature.

- QSEECOM_IOCTL_SEND_MODFD_RESP: is called to modify the listener
response data with physical address replaced at a mentioned offset,
so as to be usable by TZ. Option to protect &/ unprotect the buffer
is provided from user space (based on use case).

- QSEECOM_IOCTL_UNPROTECT_BUF: is called to explicitly unprotect the
protected buffer (use case specific).

Change-Id: If129e7bc0131eee4ec361923c6c1c74de37be130
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
qseecom: enable ce1 clock when sending RPMB service response to tz

TZ need to do authentication when provisioning RPMB key on secure device,
which requires accessing crypto HW. Hence, the CE clks needs to be enabled
by qseecom prior to sending RPMB response to tz.

Change-Id: I73e3844e758ebddd57639a6d477299fe306bb538
Signed-off-by: Zhen Kong <zkong@codeaurora.org>