msm: clock-8226: Fix compile errors when CONFIG_DEBUG_FS is removed

Declare variables used only if CONFIG_DEBUG_FS is defined within ifdef
statements.

CRs-fixed: 554999
Change-Id: I28d2104ebd7baba8a151fc34946463f2429709b1
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
(cherry picked from commit 54a5c2f76041b7e1fdeb1851216a814fc316c74d)
msm: mdss: release all overlay resources on last fb release

There are cases where the last frame buffer reference is released from a
different pid than the one who originally allocated the resource.
In these cases we can still deallocate all resources currently allocated
as we know that all references on fb dev have been released.

CRs-Fixed: 552960 555976
Change-Id: Ice2ca8df765cb8c4537a89fec887cb125d820d7a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
(cherry picked from commit 3cbaae5125357c0ae26295e3dd8da6c5588c71d5)
power: qpnp-charger: add charger OVP status monitor

Enable coarse-det-usb irq for charger OVP monitor. When insert a
high voltage charger, coarse-det-usb irq trigger, after wait for
usb valid debounce time, check the OVP condition, and report usb
health state; When an OVP happened in the process of charging, a
falling usbin valid_irq trigger, check OVP condition in usb plug
out condition, and report the usb health state.

Userspace can use the charger health state change to pop up
warning message when a charger, which exceeds the OVP threshold,
is connected.

Change-Id: Idedcdd7084aa24505675cf016d869444a89ca46c
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
(cherry picked from commit 04ae6de0e92db1253d6aee1da91480ae823d7d87)
power: qpnp-charger: add ext ovp support

Some platform configurations require an
external OVP when using a DCP charger and
fast charging. This external OVP is connected
in parallel to reduce the input resistance
of the charge path to allow more current
to be pumped into the battery.

This additional external ovp needs to be
communicated to userspace services since
the input current limit only impacts the
USBIN charge path and not the newly added
path added by the external OVP. To allow for
userspace binaries to adjust the input current
limit correctly also expose the usb trim register
via the power supply framework.

CRs-Fixed: 532962
Change-Id: I4734f4734f89d8c26508e543398b4b291f1bed29
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit 2586f0a6c26bb8574413caca54501684f8428886)
ARM: dts: msm: Add support for Dynamic Fps

Add properties to DSI panel node to support
dynamic FPS. One property is to enable this feature and the
second property is the control when frame rate will be changed.

CRs-Fixed: 488453
Change-Id: I24f6fe88eece327f97212d2aff06100e83164383
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
(cherry picked from commit 46e66af67512719c36e26cf880397fef91da0cd1)
mdss: display: Add support for dynamic FPS

Add sysfs entry for dynamic FPS update mode. Add support to
change FPS in the following scenarios:
1. Store the FPS and change the clocks only when Suspend/resume
   happens. This is the default configuration.
2. Change the FPS immediately by updating the clocks. Video
   mode engine is disabled and then enabled when clock rate
   is updated.

CRs-Fixed: 488453
Change-Id: I1722d54d9fbfdfbd7d22e02d8776a0f60dc86141
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
(cherry picked from commit 834d483949d2b98ac5491d669032fcb5656fee08)
mdss: dsi: Add support to partial update

Add support to send DCS commands to set the partial update region
of interest(ROI) size. These commands will set the column/row start and end
coordinates based on the ROI size.

Change-Id: I1b5944ca057bb082caa70b8c2ad39e11fe418756
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
(cherry picked from commit 9a5098ddafa8a99e3d8721707e9979c4683a5b58)
msm: mdss: request and free gpio at display on and off

This fixes a power leakage due to gpio is not put into
the suspended mode at display off.

Change-Id: If37426b821cdf08e207888ac84a2afbcbc011451
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
(cherry picked from commit 91718995b99ccc76004c0c31ca9fd79b7c61923a)
mdss: display: Move reset sequence from dsi controller to panel dtsi

Parse the reset sequence from the panel dtsi instead of the dsi
controller to support different reset sequences for different panels.

Change-Id: I55835c919e2cb3537d41da4b4dcb0b9a9dfb5c72
CRs-Fixed: 528698
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
(cherry picked from commit 4cff3a39a596a0a160bac93d93443cc2754635bb)
msm: mdss: remove cleanup done during overlay kickoff

Remove kickoff done from overlay kickoff, this was done to clear
potentially stale handles when the process using it has crashed. However
this case is handled in commit a3b3d215 by handling per process
resources.

Change-Id: I9c060b107c004c6cfb726ad84ae69d77461ed74f
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit 9a31140643ce4a6bd6f4cd5a71e3c481ec67222d)
mdss: mdp: Add support for partial panel updates

This change programs MDP only for the output resolution (ROI)
set by the client. All staged pipes are cropped to fetch data
only for the resolution programmed.

Change-Id: If06fb36c6ebe167ba369b11a622ab5feaf52172a
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
(cherry picked from commit b826f33ae3930159611807b0b6a27c0156844a50)
msm: mdss: Make mdp sync point generic to use

Currently mdp sync point supports buf sync ioctl for
normal mdp overlay operation. So making it more generic
such that it can be used for rotator also.

Change-Id: I04c5f29a5259238ef1de26f6e801269b89cf5fed
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
(cherry picked from commit 45330cc2328b02e522d4e4a09d5df75279a08536)
msm: mdss: fix double sync fence put in buf sync function

If an error occurs after setting acquire fds, the list of sync fences
will be put for cleanup. However if mdss_fb_wait_for_fence() is called
this will also wait and clear the list of fences, since we are relying
on local variable for cleanup, it may not reflect the state after the
function call. Fix this by maintaining the proper state of the list.

CRs-fixed: 548042
Change-Id: I4885eb393ac9bd2b4818292b9a60f53fb4baacc8
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
(cherry picked from commit 420d6aa766e6ebfa48504320610781bc5e2f6ad5)
qseecom: Fix issues with failure to release client handle

There exists scenarios when qseecom_release is called,
the client handle type is incorrect; hence proper cleanup
is not done with regards to unloading app or cleaning up
memory allocated for the device handle.
This change addresses all cleanup issues related to qseecom
client in qseecom_release call by ensuring the handle type is
set correctly and cleanup is done properly based on client type.

Change-Id: I126aa431ce635ae98100b774e3d92b704635d199
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit 492530fe6777c498d8d3674d1157a35f79991667)
qseecom: Validate the incoming length from user space

Check if there is no integer overflow before using req_len and
resp_len (received from user space). If an overflow is detected
then exit the operation.

Change-Id: I0459a6992bb3b280db42be63a275c55fa6105b1c
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit 528400ae4cba715f6c9ff4a2657dafd913f30b8b)
qseecom: Change __copy_from_user to copy_from_user

__copy_from_user does not do address check, so use
copy_from_user instead.

Change-Id: I575c0f3c44b55a521c0d42828988c518c0640a29
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit e201495764bc06dea6d11a328f4a32c35e832212)
qseecom: Check for invalid registration of secapp region

Check the validity of response result field returned by QSEE
when issuing a request to register the secure app region
information.

Change-Id: Idc5ee7cf3c0a25ca37f23ef9d1718fdb05af6533
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
(cherry picked from commit 32deb98d2dcf35bfc14751cf0c17594538ea63e0)
qseecom: Add frequency scaling in send_service_cmd()

Addes DFAB and SFAB bus frequency scaling in qseecom send_service
command function. This is required for RPMB listener services

Change-Id: I7496dfafe1fa571de68b30529ee6db49c8200232
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
(cherry picked from commit 80f1d1bd4b52fa78c2472bb2d461ffacfe3e0b28)
qseecom: Add checks for API called in IOCTL

Validate the caller is the right type for the IOCTL being
issued and inputs are valid.

Change-Id: Iad71f0f5ed4d53c5d011bd55cdf74ec053d09af5
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit a1124defc680055e2f2a8c8e3da4a94ca2ec842e)
qseecom:  Validate inputs from user space

Validate send_cmd, send_modfd_cmd and send_mdfd_resp
input parameters: cmd and response pointers and buffer
lengths and offsets  issued to modify data.

Change-Id: I381836d08aaa48357486fbdc6a122eb5b42bfa0b
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
(cherry picked from commit dddf444041397a6c966b8b38856218f1424f6c8d)