These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / msm / mdp / mdp5 / mdp5_encoder.c
index 1188f4b..c9e32b0 100644 (file)
@@ -27,6 +27,8 @@ struct mdp5_encoder {
        spinlock_t intf_lock;   /* protect REG_MDP5_INTF_* registers */
        bool enabled;
        uint32_t bsc;
+
+       struct mdp5_ctl *ctl;
 };
 #define to_mdp5_encoder(x) container_of(x, struct mdp5_encoder, base)
 
@@ -36,7 +38,7 @@ static struct mdp5_kms *get_kms(struct drm_encoder *encoder)
        return to_mdp5_kms(to_mdp_kms(priv->kms));
 }
 
-#ifdef CONFIG_MSM_BUS_SCALING
+#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING
 #include <mach/board.h>
 #include <mach/msm_bus.h>
 #include <mach/msm_bus_board.h>
@@ -144,10 +146,14 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
                        mode->type, mode->flags);
 
        ctrl_pol = 0;
-       if (mode->flags & DRM_MODE_FLAG_NHSYNC)
-               ctrl_pol |= MDP5_INTF_POLARITY_CTL_HSYNC_LOW;
-       if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-               ctrl_pol |= MDP5_INTF_POLARITY_CTL_VSYNC_LOW;
+
+       /* DSI controller cannot handle active-low sync signals. */
+       if (mdp5_encoder->intf.type != INTF_DSI) {
+               if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+                       ctrl_pol |= MDP5_INTF_POLARITY_CTL_HSYNC_LOW;
+               if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+                       ctrl_pol |= MDP5_INTF_POLARITY_CTL_VSYNC_LOW;
+       }
        /* probably need to get DATA_EN polarity from panel.. */
 
        dtv_hsync_skew = 0;  /* get this from panel? */
@@ -218,14 +224,15 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
 
        spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
 
-       mdp5_crtc_set_intf(encoder->crtc, &mdp5_encoder->intf);
+       mdp5_crtc_set_pipeline(encoder->crtc, &mdp5_encoder->intf,
+                               mdp5_encoder->ctl);
 }
 
 static void mdp5_encoder_disable(struct drm_encoder *encoder)
 {
        struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
        struct mdp5_kms *mdp5_kms = get_kms(encoder);
-       struct mdp5_ctl *ctl = mdp5_crtc_get_ctl(encoder->crtc);
+       struct mdp5_ctl *ctl = mdp5_encoder->ctl;
        int lm = mdp5_crtc_get_lm(encoder->crtc);
        struct mdp5_interface *intf = &mdp5_encoder->intf;
        int intfn = mdp5_encoder->intf.num;
@@ -260,7 +267,7 @@ static void mdp5_encoder_enable(struct drm_encoder *encoder)
 {
        struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
        struct mdp5_kms *mdp5_kms = get_kms(encoder);
-       struct mdp5_ctl *ctl = mdp5_crtc_get_ctl(encoder->crtc);
+       struct mdp5_ctl *ctl = mdp5_encoder->ctl;
        struct mdp5_interface *intf = &mdp5_encoder->intf;
        int intfn = mdp5_encoder->intf.num;
        unsigned long flags;
@@ -290,6 +297,7 @@ int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
                                        struct drm_encoder *slave_encoder)
 {
        struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
+       struct mdp5_encoder *mdp5_slave_enc = to_mdp5_encoder(slave_encoder);
        struct mdp5_kms *mdp5_kms;
        int intf_num;
        u32 data = 0;
@@ -304,20 +312,21 @@ int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
         * to use the master's enable signal for the slave encoder.
         */
        if (intf_num == 1)
-               data |= MDP5_SPLIT_DPL_LOWER_INTF2_TG_SYNC;
+               data |= MDP5_MDP_SPLIT_DPL_LOWER_INTF2_TG_SYNC;
        else if (intf_num == 2)
-               data |= MDP5_SPLIT_DPL_LOWER_INTF1_TG_SYNC;
+               data |= MDP5_MDP_SPLIT_DPL_LOWER_INTF1_TG_SYNC;
        else
                return -EINVAL;
 
        /* Make sure clocks are on when connectors calling this function. */
        mdp5_enable(mdp5_kms);
-       mdp5_write(mdp5_kms, REG_MDP5_MDP_SPARE_0(0),
-               MDP5_MDP_SPARE_0_SPLIT_DPL_SINGLE_FLUSH_EN);
        /* Dumb Panel, Sync mode */
-       mdp5_write(mdp5_kms, REG_MDP5_SPLIT_DPL_UPPER, 0);
-       mdp5_write(mdp5_kms, REG_MDP5_SPLIT_DPL_LOWER, data);
-       mdp5_write(mdp5_kms, REG_MDP5_SPLIT_DPL_EN, 1);
+       mdp5_write(mdp5_kms, REG_MDP5_MDP_SPLIT_DPL_UPPER(0), 0);
+       mdp5_write(mdp5_kms, REG_MDP5_MDP_SPLIT_DPL_LOWER(0), data);
+       mdp5_write(mdp5_kms, REG_MDP5_MDP_SPLIT_DPL_EN(0), 1);
+
+       mdp5_ctl_pair(mdp5_encoder->ctl, mdp5_slave_enc->ctl, true);
+
        mdp5_disable(mdp5_kms);
 
        return 0;
@@ -325,7 +334,7 @@ int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
 
 /* initialize encoder */
 struct drm_encoder *mdp5_encoder_init(struct drm_device *dev,
-                               struct mdp5_interface *intf)
+                       struct mdp5_interface *intf, struct mdp5_ctl *ctl)
 {
        struct drm_encoder *encoder = NULL;
        struct mdp5_encoder *mdp5_encoder;
@@ -341,6 +350,7 @@ struct drm_encoder *mdp5_encoder_init(struct drm_device *dev,
 
        memcpy(&mdp5_encoder->intf, intf, sizeof(mdp5_encoder->intf));
        encoder = &mdp5_encoder->base;
+       mdp5_encoder->ctl = ctl;
 
        spin_lock_init(&mdp5_encoder->intf_lock);