msm: cpr-regulator: change device tree vendor prefix to 'qti'

New policy requires changing device tree vendor prefix from 'qcom'
to 'qti'. Also change device tree files for msm8610, msm8226 and msm8926.

Change-Id: I57c8c9d14ffa3ddd3671f406cfa2011eb23e66e4
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit 098f1ae38782290aabc11307f684bf055dee47e0)
msm: cpr-regulator: change cpr_read_efuse_row api

Add a flag in cpr_read_efuse_row api to make it choose
to read register directly or read through SCM.

Change-Id: I3031dfd1c7cfffb880c49e5f1708b1436fdd2897
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit 074001ecaa931aa502d64f69703b22cd4666865e)
msm: cpr-regulator: add support for conditional minimum voltage

Certain targets have VDD_APC minimum voltage constraints which are
imposed if the mem-accel fuse has not been programmed. Add two new
device tree properties to capture the row offset and expected value
of the mem-accel fuse as well as to capture the minimum VDD_APC voltage
to enforce if the mem-accel fuse has not been programmed with the
expected value.

CRs-Fixed: 580585
Change-Id: Ifd770b33d74b2bc9cf37dd2b1817e1424a5ee8f3
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit a819253a496870a8dfbafb020f16bb8183ee985c)
ARM: dts: msm: specify conditional VDD_APC minimum voltage for msm8226

Restrict the minimum APC voltage to 1.14V when the mem-accel fuse has not
be programmed as expected.

CRs-Fixed: 580585
Change-Id: Ia506efb15c7599d79c5561163879d82910db84f8
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit 783230be2a98a932437873bf3bffd5809c4af502)
ARM: dts: msm: reduce CPR turbo floor voltage for msm8226

The device tree property qti,cpr-cond-min-voltage = <1140000> along with
an appropriate qti,cpr-cond-min-volt-fuse property value ensure that the
CPR turbo floor voltage is restricted to 1.14 V on devices that cannot
operate at lower voltages.

Therefore, reduce the default CPR turbo floor voltage to 1.1 V in order
to save power on devices that can operate at the lower voltage.

Change-Id: Ic939d4a7b1c4da0a28dd779fe6a900310ae9fab7
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit cb3b958479130b1229c934e1405244f7d5d491cf)
msm: cpr-regulator: modify the dts definition for cond-min-volt

Previously, cpr-cond-min-volt-fuse defined the fuse row number and the
value used to compare with the whole row efuse value. The cpr-regulator
driver would then conditionally apply a higher CPR floor voltage for all
voltage corners if the efuse value differed from the expected value.

However, only a subset of the bits in the efuse are used for the
cond-min-volt feature. If any of the other bits in the fuse are set, then
the cpr-regulator driver incorrectly applies the higher floor voltage even
if the cond-min-volt bits are set correctly.

Modify the cpr-regulator driver and the cpr-regulator device tree
properties so that only specific bits in the fuse are compared to the
expected value. If the value of the cond-min-volt bits in the fuse is
not equal to the value defined in device tree, then set the MIN_VOLTAGE
flag.

Change-Id: I7de04e17dfa93fcb638e29a1dcc5e9072de26cb8
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit 0ec7fc93482a7b8505f6c42e3093fa2ff96a0a71)
msm: cpr-regulator: add pvs voltage uplift workaround

There are some parts which require higher than expected voltage. Add a
workaround to check the condition in fuse and uplift the voltage and
quotient accordingly.

Change-Id: I59f821320e5e97fc2334ae7617a0045edb5cc970
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
Signed-off-by: Ke Liu <keliu@codeaurora.org>
(cherry picked from commit 8a82877d54a240c3d0847b9ef5f17575738af303)
ARM: dts: msm: enable pvs voltage uplift workaround for msm8226

Some 8x26 parts have lower pvs voltage than expected. Enable uplift
workaround of 50 mV on those parts under the specified conditions.

Change-Id: I3d8689ca0c5d576b1dd9057e36f67ea3622b80a1
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
(cherry picked from commit 29038e82483ea7693bea90abdc044e8645293745)
mm: change freepage state correctly in __isolate_free_page

Commit 2e30abd1730751d58463d88bc0844ab8fd7112a9
(mm: cma: skip watermarks check for already isolated blocks
in split_free_page()) changed the ordering of where the watermark
checks go for isolated pages. There was already an 'enhancement'
present in __isolate_free_page to skip the watermark checks for
CMA pages to increase success. The merging of the enhancment and
the aforementioned commit was done incorrectly, resulting in
the free page state never being modified for CMA pages even if
the CMA page was removed from the free list. Add the enhancement
properly by only checking for CMA pages at the watermark level
and allow the page state to be modfied for CMA pages as well.

Change-Id: Iabea982108d98150f54e5c42b7dbf30f0743653a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit abb07e497da72c4355616d38747cec99fb0ddaf3)
qseecom: Copy userspace buffer into kernel space before dereferencing

ION memory is used for user space to kernel space data passing.
This is directly accessible in kernel. But, if the IOCTL is called
from user space without using User space library, then data might
be pointing to some other memory location, in which case, it would
not be possible to dereference this location in kernel & hence it
would be accessing invalid memory.

Change-Id: Ic50c76ee8b2a696dbb786fce3a68cdc782e15268
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit 7c60c7c404ed8d1f88838460ec7fb31e2cceea72)
fbcmap: prevent memory overflow

Add bounds check before copying data to prevent
buffer overflow.

Change-Id: I47b9685b1ab13c4863fb6db62bbb9497a00b36da
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
(cherry picked from commit 0adfd1dad70ccd8f399113aea72c7445274d55b9)
msm: ADSPRPC: Add checks for erroneous values

Check for invalid parameters passed in user invocation
and validate the return values using appropriate macros.

Change-Id: If529873d025ac0c13725efbedda5a58fae327722
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
(cherry picked from commit 2277ce45f8f65c0d8749681072b62f7edd56baf8)
qseecom:  Check for case where listener service is not found

When listerner service is not in the list of registered listeners,
the resulting ptr will a NULL. Check for this case of NULL ptr
to indicate missing listener service.

Change-Id: I0d2c7b01143c40711f71bf434493ac5301314cf2
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
(cherry picked from commit 72aad6196ab9a3c993821430746c7598b2d7dc24)
qseecom: Remove debug  messages

Remove unnecessary debug  messages.

Change-Id: Ida80fbc1376f15753f8329c44550b14d8f4de163
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
(cherry picked from commit 667c0a9dba310670aa7e5df132a3568e2ee2af3b)
Merge "msm: cpr-regulator: change device tree vendor prefix to 'qti'"
Merge "msm: cpr-regulator: change cpr_read_efuse_row api"
Merge "msm: cpr-regulator: add support for conditional minimum voltage"
Merge "ARM: dts: msm: specify conditional VDD_APC minimum voltage for msm8226"
Merge "ARM: dts: msm: reduce CPR turbo floor voltage for msm8226"
Merge "msm: cpr-regulator: modify the dts definition for cond-min-volt"