_get_unmapped_area_topdown() subtracts the requested size
from lower entry base without really checking its value.
This leads to overflow while working at boundary conditions.
Add a condition to check entry base with the size and proceed.
Change-Id: Ic695da683b11de35c7c4b8936a35d693dc8fa452
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
Initialize buffer manager spin lock before
using it
Change-Id: Icef09e9d40bbbe66e90c162dd0ae2f1733ae9a06
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
Dispatcher can acquire drawctxt->lock if context is pending
and the fence it is waiting on just got signalled.
Dispatcher acquires drawctxt->lock and tries to delete the
cmdbatch timer using delete_timer_sync(). Delete_timer_sync()
waits till timer and its pending handlers are deleted.
But if the timer expires at the same time, timer handler
could be waiting on drawctxt->lock leading to a
deadlock. To prevent this use spin_trylock_bh() instead of
spin_lock_bh(). spin_trylock_bh() does not wait for the lock
if it does not get it and allows the timer handler to finish.
This prevents the deadlock.
Change-Id: Ic2344fed5fccb581b58ec0b66b45ba68af9f1459
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Hotplug events are particularly interesting from system
point of view and tracing around the hotplug events would
provide essential information that could be used to debug
system issues.
Change-Id: I23e9539a76e04e222a0a05f27be51cb726ab6c33
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
add framework for IPAv2 active clients history logging
logging is enabled by default
cat /sys/kernel/debugfs/ipa/active_clients in order to view logs
echo anything to /sys/kernel/debugfs/ipa/active_clients in order
to clear the history log buffer
Change-Id: I975271798aee56ac9889d34203a32c99a30fc958
Signed-off-by: Valery Gorohovsky <valeryg@codeaurora.org>
Auto-refresh is used on smart displays to refresh display without
SW intervention, similar to dumb displays. So when it is on, display
controller will automatically send new frame every time panel TE signal
is received. Now as per the HW implementation, disabling auto-refresh
requires that display controller is idle and there is no frame transfer
on-going. To achieve this, we need to follow certain disable sequence.
To implement this disable sequence, clean up current implementation and
introduce auto-refresh state machine.
Change-Id: Iac5d76b6431f7ef2fcd68114e19c5cb5fb02577d
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Hardware might return/call the pending interrupt
on one CPU when same interrupt is disabled from other
core. Such parallel processing may lead to unclocked
register access in interrupt context followed by
panic. It is safe to check the interrupt line status
before handling isr to avoid crash in such race
condition.
Change-Id: I460550cb5188c7f77b9f741682917010f9231a50
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Display thread holds ov_lock followed by mutex, while the ESD
check thread for cmd mode panel holds mutex followed by ov_lock.
Fix this deadlock by acquiring mutex before ov_lock in ESD check
thread.
Change-Id: I857f780e14a6ccb679e89ff16b19706d205df4b6
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
Send stream management message to sink after topology update. Poll
for new message or authentication required status after successful
receiver or repeater authentication. Also, DDC hardware polls sink
for a given time. Let the polling complete and do not treat intermediate
DDC errors as failures because DDC transaction can pass in next
iteration. Once polling ends, check for errors and timeouts and reset
polling data. Treat these errors as failure only after polling ends.
Change-Id: I286fb00cf935bff493e108c05df625d5ca3ade26
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
When device enters the idle power collapse mode, the entire
AD HW block is powered down, which will cause the previous
AD settings get lost. So when device exits the idle power
collapse mode, we need to store AD to previous state.
In order to achieve this, we need to switch AD mode to 0x85 first
and manually write the last AD strength value to AD register. Keep
this setting for couple of frames, in the meantime, kick off AD
calculator with t_filter_control value of 0 to ramp up the AD
strength from 0 to current target strength. Then switch the mode
back to auto strength (0x81).
Change-Id: Iddc12dbb0da06675141fa9fe049cfe90110defb9
Signed-off-by: Ping Li <pingli@codeaurora.org>
This change fixes the errors reported in static analysis
of MDSS driver code. These changes include fix for various
potential NULL pointer dereferencing and array index out of
bounds issues in MDP, DSI and PP module of MDSS driver.
Change-Id: I49f65f0b4e5218f9fc90469e9d431a3aec811ee2
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
In current implementation we are always overriding the PHY read
from dt entry with the ones we are calculating in driver. Update
the PHY timing only when there is a change in resolution.
Change-Id: I2ba936af6e55b27c7b28d38990b32e896c877e08
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Use the last backlight sent to AD core for AD backlight filter
threshold comparison.
Change-Id: I8ea26a8a95c700749aa83d5b70a3b16c44258767
Signed-off-by: Ping Li <pingli@codeaurora.org>
Reduce the rounding error during AD backlight linearization and
attenuation.
Change-Id: Ibf181414512d457d3341bbccf8cf9338aef8ac76
Signed-off-by: Ping Li <pingli@codeaurora.org>
Reset the ad_events count in the AD ioctl instead of ad_setup().
There are some time delay between AD ioctl and ad_setup, which is
part of the display commit path, so if we reset the ad_event count
in ad_setup, then it is possible that user space reads the ad_events
sysfs node after the AD ioctl but before the ad_setup(). In that
case, user space may get the incorrect ad_events count, and cause
the gradual AD off fail.
Change-Id: I13f2043a6a21be7e49b44a964b00b0aa4315dc17
Signed-off-by: Ping Li <pingli@codeaurora.org>
Current implementation cannot support multiple registers
in ESD check, and it does not work for many cases. For
example, some panels need check multiple registers to get
its status, and some panels might return several possible
values for one register read.
To support this kind of behaviors, a new property in dtsi
is added as "qcom,mdss-dsi-panel-status-valid-params" which
specifies the valid value length we should check in the
payload returned by panel, and the payload length panel
should return is specified by the property "qcom,mdss-dsi-
panel-status-read-length". "qcom,mdss-dsi-panel-status-value"
is also extended to an array which specifies all the possible
return values from panel.
Change-Id: I098d04281b819581f53c7c509778e7b594aa499a
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
Modify the MDP_CBCR bits to retain the AD RAMs through idle power
collapse(IPC).
Bits setting when device enters IPC:
- MEM_CORE_ON: 1
- MEM_PERIPH_ON: 0
- MEM_PERIPH_OFF: 1
Bits setting when device exits the IPC:
- MEM_CORE_ON: 1
- MEM_PERIPH_ON: 1
- MEM_PERIPH_OFF: 0
Change-Id: I10749312d905eb4629e94e396b1604667738e84f
Signed-off-by: Ping Li <pingli@codeaurora.org>
MDSS needs a min vote on sysmmnoc clk to perform TZ and
IOMMU operations. This vote is needed for few low tier
chipsets.
Change-Id: Iff8c775bfc2001f0bae5118427334793bf392bc0
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Read the PLL/PHY status once during bootup to avoid delays
due to polling. Polling for PLL/PHY status is only required
when handling HDMI use cases in which the cable is connected
after bootup is complete.
Change-Id: Ie1d5983a7784cb5f3472527d1b510f128ae9d325
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Add the xin id information on the dump of the
pipes.
Change-Id: I20d63e02d0f36f1d173185c520b7c448ead7409d
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
The backlight of the display panel will not get turned off during
suspend if there are no display commits between suspend/resume
since allow_bl_update will only be set to 'true' after first
valid display commit after resume. This is possible for power
off charging use-case where there will be only one display
commit initially and later just the content of the buffer gets
updated without anymore display commits across suspend/resume.
Make sure the backlight is turned off during suspend by
explicitly setting allow_bl_update to 'true' before trying to
set the backlight to zero.
Change-Id: I10f39e3913e5b40a61066f0bbce3a7a8f1a9441b
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Avoid moving pipes to destroy list during overlay free based on
the pipe play count as it might not give the actual information.
The play count is set to 0 for all new or config changed pipes
during the validate call. And if we get a fb_release_all request
right after the validate, it would indicate an inconsistent state
for the play count. Instead, move the used pipes to cleanup list,
so that the NULL kickoff would handle the pipes to be unstaged
and destroyed.
Change-Id: I0026d512e92d0d59962ee8114873f7804a31c018
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Remove pingpong interrupt handler when pingpong done interrupt is
not present. This will ensure no unexpected pingpong is reported
which might lead to confliction with the destroying ctx.
Change-Id: I9a7173fb19e55344cedcfeccdaf23efaba11892c
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
In cases of EDID read or parser failures, driver should expose
a default resolution to other modules to continue with the HDMI
initialization. So during bridge chip initialization sequence
update the default resolution.
Change-Id: Ia6a7f8b4d9e3f1650b9c11aafc118a2662801ba0
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
The helper function linear_map would take the integral part
of the calculated map, thereby causing issues with getting
the same value after consecutive map and inverse map calls.
For ex: linear_map(21, out, 255, 4095) would translate to
*out = 21 * 4095 / 255 = 337, whereas inverse case
linear_map(337, out, 4095, 255) would translate to
*out = 337 * 255 / 4095 = 20
Changing linear_map from ((in * out_max) / in_max) to a more
precise ((2 * (in * out_max) + in_max) / (2 * in_max)) for
incorporating rounding in the integral mapping.
Change-Id: I15cd8aa1326813ce3cb3a426cbb4e78374623c72
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
If auto refresh mode is enabled in LK, then it needs be disabled
when kernel loads. Otherwise it might cause display corruption,
when in kernel display again configures tearcheck block.
Change-Id: I0b4dddee25e39cea4f32b8afd537993ad64ea812
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Switch on the mdss clocks while enabling vsync irq.
Since mdss clocks are refcounted and irq is asynchronus
there can be case as clocks are off and irq is triggered.
This change will add a refcount while enabling irq so that
clocks are on when irq is triggered.
Change-Id: I90728f6d94b9d846b2c805a68ee49a6ef2a8ffc3
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Rotator clock and BW votes are updated on each rotator request
during same session. This is not required because rotator source
and destination does not change during session. Ensure that
rotator clocks are on throughout session such that extra overhead
of rpm calls are avoided.
Change-Id: I7a74aa2b8d8556b1d8ee4c52f871b9ebb149764a
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
For dual DSI panels, DFPS mode switch configuration through
sysfs is not properly enabled for the second DSI interface.
Fix this by initializing the mode switch update variable.
While changing the DFPS mode, idle-time should be disabled
and the device should be configured to default FPS. Add
these checks when DFPS mode switch is initiated.
Change-Id: Ib9e67f20758e2fb1c72a747c31109364db1d1160
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
In the current implementation DSI PHY revision is read once
DSI PHY initialization is complete. But this needs to be done
before initializing PHY, so that correct PHY initialization
sequence can be executed.
Change-Id: I6f0cd59d63d0a8c0a5d47284f2e86e72f37d099f
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Currently, DBA (Display Bridge Abstract) related functionality
is being used in DSI files. Carve out DBA related functionality
into a new file which serves as a utility module and can be used
by any MDSS driver.
Define CEC on/enable functions in DBA (Display Bridge Abstract) so that
clients can enable disable CEC based on other dependent CEC modules.
Separate out CEC abstract data with CEC driver data and initialize and
release corresponding modules properly.
Change-Id: I84f53d99547dcd4ce0b8275401b03ed8e96e14d5
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
In command mode static screen usecase if DSI PHY was clamped and
then MDSS was reset by power collapsing it, in that case reconfigure
DSI PHY regulator while coming out of power collapse. This will avoid
DSI PHY stuck issue when there are two independent displays running.
Change-Id: I6c33244c332d97522b66cbb9191fce0a268bf9f4
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
In dual dsi case, if we do DSI PHY sw reset for one DSI controller
then it will reset the DSI PHY regulator also. Since DSI PHY
regulator is shared among both the DSI controllers, it might cause
side effects on the other DSI controller if that is active. So only
reset DSI PHY lane and PHY HW as when one of the DSI controller is
still in active state. Also avoid reconfiguring DSI PHY regulator in
dual dsi case if the other DSI controller is active.
Change-Id: I5ad1251c89e8ad3f521c4e5c11607494e14143cf
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
There can be unclocked register access during DSI FIFO empty
error recovery case in command mode, so enable DSI core clocks
prior to doing SW reset.
Change-Id: Ic48561b979f1a13304dc2fa29f8008e8ff63c8ca
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Sending BTA or other panel check status commands to the
panel, when panel is off might lead to abnormal
behavior. Since client can poll for the panel status
anytime, add necessary checks to avoid sending commands
when panel is off.
Change-Id: I95acc3df464d0a4640b79963b5701fcde79646d5
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
The log message which is only active in modem build is missing
an argument causing build error. This commit fixes it.
Change-Id: I7e66c34c22e13a0063af93cbf725cfd9c24ffb99
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
HDMI driver has compilation issue in 32-bit mode due to incorrect
type casting. This patche fixes the same.
Change-Id: Ie620b1059f37b858beadf61ff8e100312b1bb988
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
The SSC frequency and PPM values are currently hardcoded in the
DSI PLL driver. Add DT properties to specify the SSC frequency
and SSC PPM values for DSI SSC feature.
Change-Id: I0faed9f48694f7407c6855b067ffa4510d7e3fdd
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
In overlay start, currently there is a check that if
splash handoff is pending then fail the overlay start
for that particular fb. Remove this check as this is
not required anymore. HAL should take care that it
calls fb open (for HDMI) only after splash cleanup is
done.
Change-Id: Ie20bd778ba8df2bd54c3804870ad4e8bb45702b8
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
There are two places where the backlight can get updated. Currently, the
sysfs notification only happens in mdss_fb_set_backlight. If the backlight
is restored during the first display commit, the backlight update occurs
in mdss_fb_update_backlight. This change adds the sysfs notification in
update_backlight.
Change-Id: Iffa1e4f0aa0cdc8babb1b6683d3175795f4b4d27
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
CRs-fixed: 949146
Update mdp capabilities with pipe index, type,
handoff status and display interface number information.
Change-Id: I3ff1c66cb20bb1a45a67eb952d7cdaa7e360d377
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
In the current implementation DSI controller version is used to
determine which PHY enable sequence should be used. But this will
fail in case of platforms where DSI controller version is same as
older platforms but PHY version is new. So change the version check
to be based on PHY version instead for controller version.
Change-Id: I636a6442e84f1bd549b6a125cfb991402e53c796
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
When exiting low power state (LP1 of LP2), ensure that the intf_stopped
flag is reset for the secondary ctl as well, otherwise it may result in
the display corruption for that ctl path.
Change-Id: I2ac9cff00e25a3cae6999e33c9f5a7a959413277
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Pipes present in destroy and cleanup list are considers
as used pipes during layer validation. This assumption
is wrong. Async update should not be supported for such
pipes because they are not stagged in current draw cycle.
These pipes should also go through destroy cleanup process
if any layer validation fails during the atomic ioctl check.
Change-Id: I11ba16db40634e32e7f55af4e19f6cb42530b1f4
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
The vsync handler in display thread holds ov_lock followed by
offlock. And the DSI status check thread for cmd mode panel holds
offlock followed by ovlock, causing a clear deadlock scenario.
Fix it by acquiring ov_lock before offlock in DSI status check
thread.
Change-Id: I54ef54b5ca7e4c87e909c510b28ff7770bb20a3b
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Add sysfs node to provide a custome EDID to HDMI driver to
address some special requirements from user applications like
switching to a custom EDID in cases where sink doesn't support
EDID or DDC line to read EDID.
Change-Id: I75726e28722aa128cfc315b3b1b0e97e9a9cde56
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Current driver has various optimizations to skip pipe reprogramming if
certain layer parameters are not changed. However if mixer layout changes
then we need to reprogram all the staged pipes on that mixer. This
scenario can happen when partial update is enabled on a topology with
split layer mixers. Add a logic to find if the mixer layout is changing
between two consecutive updates and if it does, force reprogramming of
all the staged pipes.
CRs-fixed: 946164
Change-Id: I16caa4bb8b9587b804d6543d0bd340df970784ba
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Create a new CEC abstract module which is hardware independent and
interacts with other modules. Make hardware dependent CEC a separate
module and integrate with CEC abstract module. This makes it easy
to integrate multiple CEC hardwares without disturbing other modules
interacting with the abstract module.
Change-Id: I0cf4973e567fe82a1b714c03ae8b18508521260e
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Implement qseecomm API to send command to TZ to enable/disable
encryption based on hdcp status. Enable encryption when hdcp
part 1 is successful and disable it when cable is disconnected
or authentication fails.
Change-Id: Ia5e1a5927dad36abc3093b16638879be823c84df
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>