Skip to content

Commit

Permalink
target/display_cont_splash_mdp5: Check if MDP GDSC is enabled
Browse files Browse the repository at this point in the history
Otherwise we might crash while attempting to read the MDP registers.
This fixes lk2nd rebooting on DragonBoard 410c (apq8016-sbc).
  • Loading branch information
stephan-gh committed Feb 11, 2021
1 parent 080c54f commit bf17e06
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion target/target_display_cont_splash_mdp5.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <dev/fbcon.h>
#include <mdp5.h>
#include <platform.h>
#include <platform/clock.h>
#include <platform/iomap.h>
#include <platform/timer.h>

Expand Down Expand Up @@ -68,7 +69,7 @@ static int mdp5_read_config(struct fbcon_config *fb)
break;
}
if (pipe == pipe_end) {
dprintf(CRITICAL, "Continuous splash does not appear to be enabled\n");
dprintf(CRITICAL, "No continuous splash: cannot find active pipe\n");
return -1;
}

Expand Down Expand Up @@ -123,6 +124,18 @@ static int mdp5_read_config(struct fbcon_config *fb)

void target_display_init(const char *panel_name)
{
/*
* Reading MDP registers will fail if necessary clocks/power domains
* are not enabled. Check if the MDP power domain (GDSC) is enabled
* to try to avoid crashing if the clocks are disabled.
*/
uint32_t val = readl(MDP_GDSCR);

if (!(val & GDSC_POWER_ON_BIT)) {
dprintf(CRITICAL, "No continuous splash: MDP GDSC is not enabled\n");
return;
}

if (mdp5_read_config(&fb))
return;

Expand Down

0 comments on commit bf17e06

Please sign in to comment.