MLK-21506-2: mtd: nand: raw: gpmi-nand: use runtime pm not en/disable clock
authorHan Xu <han.xu@nxp.com>
Fri, 19 Apr 2019 20:00:56 +0000 (15:00 -0500)
committerHan Xu <han.xu@nxp.com>
Fri, 19 Apr 2019 20:10:16 +0000 (15:10 -0500)
use the run-time pm rather than en/disable clock in chip select function.

Signed-off-by: Han Xu <han.xu@nxp.com>
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

index e109160..e8f9084 100644 (file)
@@ -1047,13 +1047,12 @@ static void gpmi_select_chip(struct mtd_info *mtd, int chipnr)
         * die is selected/unselected.
         */
        if (this->current_chip < 0 && chipnr >= 0) {
-               ret = gpmi_enable_clk(this);
-               if (ret)
+               ret = pm_runtime_get_sync(this->dev);
+               if (ret < 0)
                        dev_err(this->dev, "Failed to enable the clock\n");
        } else if (this->current_chip >= 0 && chipnr < 0) {
-               ret = gpmi_disable_clk(this);
-               if (ret)
-                       dev_err(this->dev, "Failed to disable the clock\n");
+               pm_runtime_mark_last_busy(this->dev);
+               pm_runtime_use_autosuspend(this->dev);
        }
 
        /*