MLK-20181-1: drm/mxsfb: Move axi clk enable/disable to crtc enable/disable
authorLeonard Crestez <leonard.crestez@nxp.com>
Mon, 17 Sep 2018 13:42:11 +0000 (16:42 +0300)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
The main axi clk is disabled at the end of mxsfb_crtc_mode_set_nofb and
immediately reenabled in mxsfb_enable_controller.

Avoid this by moving the handling of axi clk one level up to
mxsfb_crtc_enable. Do the same for mxsfb_crtc_disable for symmetry.

This shouldn't have any functional effect.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/985c1f1cad250bd9ca154b3e4b3f913c310eeabd.1537191359.git.leonard.crestez@nxp.com
drivers/gpu/drm/mxsfb/mxsfb_crtc.c

index 942c037..224f57c 100644 (file)
@@ -230,7 +230,6 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
        if (mxsfb->clk_disp_axi)
                clk_prepare_enable(mxsfb->clk_disp_axi);
        clk_prepare_enable(mxsfb->clk);
-       mxsfb_enable_axi_clk(mxsfb);
 
        if (mxsfb->devdata->ipversion >= 4) {
                writel(CTRL2_OUTSTANDING_REQS(REQ_16),
@@ -281,11 +280,9 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
        reg &= ~VDCTRL4_SYNC_SIGNALS_ON;
        writel(reg, mxsfb->base + LCDC_VDCTRL4);
 
-       mxsfb_disable_axi_clk(mxsfb);
-
+       clk_disable_unprepare(mxsfb->clk);
        if (mxsfb->clk_disp_axi)
                clk_disable_unprepare(mxsfb->clk_disp_axi);
-       clk_disable_unprepare(mxsfb->clk);
 }
 
 /*
@@ -330,7 +327,6 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
         * running. This may lead to shifted pictures (FIFO issue?), so
         * first stop the controller and drain its FIFOs.
         */
-       mxsfb_enable_axi_clk(mxsfb);
 
        /* Mandatory eLCDIF reset as per the Reference Manual */
        err = mxsfb_reset_block(mxsfb->base);
@@ -405,7 +401,6 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
                mxsfb->gem = NULL;
        }
 
-       mxsfb_disable_axi_clk(mxsfb);
 }
 
 void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb)
@@ -416,6 +411,7 @@ void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb)
        if (mxsfb->devdata->flags & MXSFB_FLAG_BUSFREQ)
                request_bus_freq(BUS_FREQ_HIGH);
 
+       mxsfb_enable_axi_clk(mxsfb);
        writel(0, mxsfb->base + LCDC_CTRL);
        mxsfb_crtc_mode_set_nofb(mxsfb);
        mxsfb_enable_controller(mxsfb);
@@ -429,6 +425,7 @@ void mxsfb_crtc_disable(struct mxsfb_drm_private *mxsfb)
                return;
 
        mxsfb_disable_controller(mxsfb);
+       mxsfb_disable_axi_clk(mxsfb);
 
        if (mxsfb->devdata->flags & MXSFB_FLAG_BUSFREQ)
                release_bus_freq(BUS_FREQ_HIGH);