]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genpd: imx: scu-pd: do not power off console if no_console_suspend
authorPeng Fan <peng.fan@nxp.com>
Mon, 14 Aug 2023 10:41:23 +0000 (18:41 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 17 Aug 2023 09:33:54 +0000 (11:33 +0200)
Do not power off console if no_console_suspend, this will leave
the serial device's corresponding PM domain on during system suspend,
which is useful for debug system suspend.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/genpd/imx/scu-pd.c

index 08583a10ac62f0ef9f95ef9f0b555470b2afc6ec..d69da79d3130e52612d166a06ab21dcb9b4faf59 100644 (file)
@@ -52,6 +52,7 @@
  */
 
 #include <dt-bindings/firmware/imx/rsrc.h>
+#include <linux/console.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/firmware/imx/svc/rm.h>
 #include <linux/io.h>
@@ -324,6 +325,10 @@ static int imx_sc_pd_power(struct generic_pm_domain *domain, bool power_on)
        msg.resource = pd->rsrc;
        msg.mode = power_on ? IMX_SC_PM_PW_MODE_ON : IMX_SC_PM_PW_MODE_LP;
 
+       /* keep uart console power on for no_console_suspend */
+       if (imx_con_rsrc == pd->rsrc && !console_suspend_enabled && !power_on)
+               return -EBUSY;
+
        ret = imx_scu_call_rpc(pm_ipc_handle, &msg, true);
        if (ret)
                dev_err(&domain->dev, "failed to power %s resource %d ret %d\n",