/* DRM encoder functions */
 
-static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
+static void tda998x_enable(struct tda998x_priv *priv)
 {
-       struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
-       bool on;
-
-       /* we only care about on or off: */
-       on = mode == DRM_MODE_DPMS_ON;
-
-       if (on == priv->is_on)
-               return;
-
-       if (on) {
+       if (!priv->is_on) {
                /* enable video ports, audio will be enabled later */
                reg_write(priv, REG_ENA_VP_0, 0xff);
                reg_write(priv, REG_ENA_VP_1, 0xff);
                reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2);
 
                priv->is_on = true;
-       } else {
+       }
+}
+
+static void tda998x_disable(struct tda998x_priv *priv)
+{
+       if (priv->is_on) {
                /* disable video ports */
                reg_write(priv, REG_ENA_VP_0, 0x00);
                reg_write(priv, REG_ENA_VP_1, 0x00);
        }
 }
 
+static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+       struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+       bool on;
+
+       /* we only care about on or off: */
+       on = mode == DRM_MODE_DPMS_ON;
+
+       if (on == priv->is_on)
+               return;
+
+       if (on)
+               tda998x_enable(priv);
+       else
+               tda998x_disable(priv);
+}
+
 static void
 tda998x_encoder_mode_set(struct drm_encoder *encoder,
                         struct drm_display_mode *mode,