@@ -537,6 +537,16 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
not_suspended++;
}
+ /*
+ * If the power domain is enabled by the bootloader (for example
+ * display enabled by bootloader), but no devices attached yet
+ * (perhaps because driver built as kernel module), then do not
+ * suspend.
+ */
+ if ((genpd->flags & GENPD_FLAG_INHERIT_BL) &&
+ list_empty(&genpd->dev_list))
+ not_suspended++;
+
if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on))
return -EBUSY;
@@ -575,7 +575,7 @@ static struct gdsc mdss_gdsc = {
.name = "mdss_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = HW_CTRL | POLL_CFG_GDSCR,
+ .flags = HW_CTRL | POLL_CFG_GDSCR | INHERIT_BL,
};
static struct clk_regmap *disp_cc_sdm845_clocks[] = {
@@ -331,6 +331,11 @@ static int gdsc_init(struct gdsc *sc)
if ((sc->flags & VOTABLE) && on)
gdsc_enable(&sc->pd);
+ if ((sc->flags & INHERIT_BL) && on) {
+ pr_debug("gdsc: %s is enabled from bootloader!\n", sc->pd.name);
+ sc->pd.flags |= GENPD_FLAG_INHERIT_BL;
+ }
+
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
if (sc->flags & ALWAYS_ON) {
if (!on)
@@ -49,6 +49,7 @@ struct gdsc {
#define AON_RESET BIT(4)
#define POLL_CFG_GDSCR BIT(5)
#define ALWAYS_ON BIT(6)
+#define INHERIT_BL BIT(7)
struct reset_controller_dev *rcdev;
unsigned int *resets;
unsigned int reset_count;
@@ -55,6 +55,9 @@
*
* GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain
* powered on except for system suspend.
+ *
+ * GENPD_FLAG_INHERIT_BL: The bootloader has already enabled this power
+ * domain.
*/
#define GENPD_FLAG_PM_CLK (1U << 0)
#define GENPD_FLAG_IRQ_SAFE (1U << 1)
@@ -62,6 +65,7 @@
#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3)
#define GENPD_FLAG_CPU_DOMAIN (1U << 4)
#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
+#define GENPD_FLAG_INHERIT_BL (1U << 6)
enum gpd_status {
GPD_STATE_ACTIVE = 0, /* PM domain is active */