MLK-16676-3 soc: imx: pm-domains: add debug console power management
authorAnson Huang <Anson.Huang@nxp.com>
Fri, 20 Oct 2017 15:52:41 +0000 (23:52 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:57 +0000 (15:38 -0500)
On i.MX8QM/i.MX8QXP, when "no_console_suspend" is added,
need to keep debug uart power on for debug message output,
support this case by reading debug uart resource from
dtb and checking console suspend settings.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
drivers/soc/imx/pm-domains.c

index a3bd4f2..2c9c90c 100644 (file)
@@ -37,6 +37,7 @@ static sc_rsrc_t early_power_on_rsrc[] = {
        SC_R_LAST, SC_R_LAST, SC_R_LAST, SC_R_LAST, SC_R_LAST,
        SC_R_LAST, SC_R_LAST, SC_R_LAST, SC_R_LAST, SC_R_LAST,
 };
+static sc_rsrc_t rsrc_debug_console;
 
 static int imx8_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
@@ -48,6 +49,11 @@ static int imx8_pd_power(struct generic_pm_domain *domain, bool power_on)
        if (pd->rsrc_id == SC_R_LAST)
                return 0;
 
+       /* keep uart console power on for no_console_suspend */
+       if (pd->rsrc_id == rsrc_debug_console &&
+               !console_suspend_enabled && !power_on)
+               return 0;
+
        sci_err = sc_pm_set_resource_power_mode(pm_ipc_handle, pd->rsrc_id,
                (power_on) ? SC_PM_PW_MODE_ON :
                (pd->runtime_idle_active) ? SC_PM_PW_MODE_LP : SC_PM_PW_MODE_OFF);
@@ -266,6 +272,8 @@ static int __init imx8_add_pm_domains(struct device_node *parent,
                                sizeof(sc_rsrc_t))) {
                                early_power_on_rsrc[index++] = imx8_pd->rsrc_id;
                        }
+                       if (of_property_read_bool(np, "debug_console"))
+                               rsrc_debug_console = imx8_pd->rsrc_id;
                }
                INIT_LIST_HEAD(&imx8_pd->clks);
                pm_genpd_init(&imx8_pd->pd, NULL, true);