drm/i915/cnl: Add power wells for CNL
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 6 Jun 2017 20:30:39 +0000 (13:30 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Wed, 7 Jun 2017 14:30:07 +0000 (07:30 -0700)
CNL power wells are very similar to SKL, with the exception that the
misc IO well has been split into separate AUX IO wells.

Not sure if DMC is supposed to manage the AUX wells for us or not.
Let's assume so for now.

v2: DDI A power well wants DDI A domains, not DDI B domains
v3: s/BIT/BIT_ULL and add proper Aux IO domains. (Rodrigo)
v4: Remove PW_DDI_E. Not supported on Current CNL SKUs. (Rodrigo).
v5: Removed DDI_E_IO_DOMAINS and moved PORT_DDI_E_IO to DDI_A_IO
    for the same reasons as v4 when we found out that current CNL
    SKUs don't have the full port E split.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1496781040-20888-10-git-send-email-rodrigo.vivi@intel.com
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_runtime_pm.c

index ac0bf2364efa1b177e998480f3bd2548a8011238..45e887742339a4bf7db326a1950929ca55a39c7c 100644 (file)
@@ -1065,6 +1065,7 @@ enum skl_disp_power_wells {
        SKL_DISP_PW_MISC_IO,
        SKL_DISP_PW_DDI_A_E,
        GLK_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
+       CNL_DISP_PW_DDI_A = SKL_DISP_PW_DDI_A_E,
        SKL_DISP_PW_DDI_B,
        SKL_DISP_PW_DDI_C,
        SKL_DISP_PW_DDI_D,
@@ -1072,6 +1073,10 @@ enum skl_disp_power_wells {
        GLK_DISP_PW_AUX_A = 8,
        GLK_DISP_PW_AUX_B,
        GLK_DISP_PW_AUX_C,
+       CNL_DISP_PW_AUX_A = GLK_DISP_PW_AUX_A,
+       CNL_DISP_PW_AUX_B = GLK_DISP_PW_AUX_B,
+       CNL_DISP_PW_AUX_C = GLK_DISP_PW_AUX_C,
+       CNL_DISP_PW_AUX_D,
 
        SKL_DISP_PW_1 = 14,
        SKL_DISP_PW_2,
index f8a375f8dde6680ba5b82f31895dcf1ea7c8a7af..0b3cacd29baca2ebb42e21ed8a273848791dfdc1 100644 (file)
@@ -494,6 +494,55 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv,
        BIT_ULL(POWER_DOMAIN_AUX_A) |                   \
        BIT_ULL(POWER_DOMAIN_INIT))
 
+#define CNL_DISPLAY_POWERWELL_2_POWER_DOMAINS (                \
+       BIT_ULL(POWER_DOMAIN_TRANSCODER_A) |            \
+       BIT_ULL(POWER_DOMAIN_PIPE_B) |                  \
+       BIT_ULL(POWER_DOMAIN_TRANSCODER_B) |            \
+       BIT_ULL(POWER_DOMAIN_PIPE_C) |                  \
+       BIT_ULL(POWER_DOMAIN_TRANSCODER_C) |            \
+       BIT_ULL(POWER_DOMAIN_PIPE_B_PANEL_FITTER) |             \
+       BIT_ULL(POWER_DOMAIN_PIPE_C_PANEL_FITTER) |             \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_B_LANES) |                \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_C_LANES) |                \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_D_LANES) |                \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_E_LANES) |                \
+       BIT_ULL(POWER_DOMAIN_AUX_B) |                       \
+       BIT_ULL(POWER_DOMAIN_AUX_C) |                   \
+       BIT_ULL(POWER_DOMAIN_AUX_D) |                   \
+       BIT_ULL(POWER_DOMAIN_AUDIO) |                   \
+       BIT_ULL(POWER_DOMAIN_VGA) |                             \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_DDI_A_IO_POWER_DOMAINS (           \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_A_IO) |           \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_E_IO) |           \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_DDI_B_IO_POWER_DOMAINS (           \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_B_IO) |           \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_DDI_C_IO_POWER_DOMAINS (           \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_C_IO) |           \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_DDI_D_IO_POWER_DOMAINS (           \
+       BIT_ULL(POWER_DOMAIN_PORT_DDI_D_IO) |           \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_AUX_A_POWER_DOMAINS (              \
+       BIT_ULL(POWER_DOMAIN_AUX_A) |                   \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_AUX_B_POWER_DOMAINS (              \
+       BIT_ULL(POWER_DOMAIN_AUX_B) |                   \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_AUX_C_POWER_DOMAINS (              \
+       BIT_ULL(POWER_DOMAIN_AUX_C) |                   \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_AUX_D_POWER_DOMAINS (              \
+       BIT_ULL(POWER_DOMAIN_AUX_D) |                   \
+       BIT_ULL(POWER_DOMAIN_INIT))
+#define CNL_DISPLAY_DC_OFF_POWER_DOMAINS (             \
+       CNL_DISPLAY_POWERWELL_2_POWER_DOMAINS |         \
+       BIT_ULL(POWER_DOMAIN_MODESET) |                 \
+       BIT_ULL(POWER_DOMAIN_AUX_A) |                   \
+       BIT_ULL(POWER_DOMAIN_INIT))
+
 static void assert_can_enable_dc9(struct drm_i915_private *dev_priv)
 {
        WARN_ONCE((I915_READ(DC_STATE_EN) & DC_STATE_EN_DC9),
@@ -762,13 +811,14 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv,
                }
                break;
        case SKL_DISP_PW_MISC_IO:
-       case SKL_DISP_PW_DDI_A_E: /* GLK_DISP_PW_DDI_A */
+       case SKL_DISP_PW_DDI_A_E: /* GLK_DISP_PW_DDI_A, CNL_DISP_PW_DDI_A */
        case SKL_DISP_PW_DDI_B:
        case SKL_DISP_PW_DDI_C:
        case SKL_DISP_PW_DDI_D:
-       case GLK_DISP_PW_AUX_A:
-       case GLK_DISP_PW_AUX_B:
-       case GLK_DISP_PW_AUX_C:
+       case GLK_DISP_PW_AUX_A: /* CNL_DISP_PW_AUX_A */
+       case GLK_DISP_PW_AUX_B: /* CNL_DISP_PW_AUX_B */
+       case GLK_DISP_PW_AUX_C: /* CNL_DISP_PW_AUX_C */
+       case CNL_DISP_PW_AUX_D:
                break;
        default:
                WARN(1, "Unknown power well %lu\n", power_well->id);
@@ -2275,6 +2325,82 @@ static struct i915_power_well glk_power_wells[] = {
        },
 };
 
+static struct i915_power_well cnl_power_wells[] = {
+       {
+               .name = "always-on",
+               .always_on = 1,
+               .domains = POWER_DOMAIN_MASK,
+               .ops = &i9xx_always_on_power_well_ops,
+       },
+       {
+               .name = "power well 1",
+               /* Handled by the DMC firmware */
+               .domains = 0,
+               .ops = &skl_power_well_ops,
+               .id = SKL_DISP_PW_1,
+       },
+       {
+               .name = "AUX A",
+               .domains = CNL_DISPLAY_AUX_A_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = CNL_DISP_PW_AUX_A,
+       },
+       {
+               .name = "AUX B",
+               .domains = CNL_DISPLAY_AUX_B_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = CNL_DISP_PW_AUX_B,
+       },
+       {
+               .name = "AUX C",
+               .domains = CNL_DISPLAY_AUX_C_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = CNL_DISP_PW_AUX_C,
+       },
+       {
+               .name = "AUX D",
+               .domains = CNL_DISPLAY_AUX_D_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = CNL_DISP_PW_AUX_D,
+       },
+       {
+               .name = "DC off",
+               .domains = CNL_DISPLAY_DC_OFF_POWER_DOMAINS,
+               .ops = &gen9_dc_off_power_well_ops,
+               .id = SKL_DISP_PW_DC_OFF,
+       },
+       {
+               .name = "power well 2",
+               .domains = CNL_DISPLAY_POWERWELL_2_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = SKL_DISP_PW_2,
+       },
+       {
+               .name = "DDI A IO power well",
+               .domains = CNL_DISPLAY_DDI_A_IO_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = CNL_DISP_PW_DDI_A,
+       },
+       {
+               .name = "DDI B IO power well",
+               .domains = CNL_DISPLAY_DDI_B_IO_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = SKL_DISP_PW_DDI_B,
+       },
+       {
+               .name = "DDI C IO power well",
+               .domains = CNL_DISPLAY_DDI_C_IO_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = SKL_DISP_PW_DDI_C,
+       },
+       {
+               .name = "DDI D IO power well",
+               .domains = CNL_DISPLAY_DDI_D_IO_POWER_DOMAINS,
+               .ops = &skl_power_well_ops,
+               .id = SKL_DISP_PW_DDI_D,
+       },
+};
+
 static int
 sanitize_disable_power_well_option(const struct drm_i915_private *dev_priv,
                                   int disable_power_well)
@@ -2369,6 +2495,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
                set_power_wells(power_domains, bdw_power_wells);
        } else if (IS_GEN9_BC(dev_priv)) {
                set_power_wells(power_domains, skl_power_wells);
+       } else if (IS_CANNONLAKE(dev_priv)) {
+               set_power_wells(power_domains, cnl_power_wells);
        } else if (IS_BROXTON(dev_priv)) {
                set_power_wells(power_domains, bxt_power_wells);
        } else if (IS_GEMINILAKE(dev_priv)) {