Skip to contentSkip to conversation

drm/i915: Update RAWCLK_FREQ register on VLV/CHV

PATCH In review [email protected] 3 participants 6 messages Apr 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Update RAWCLK_FREQ register on VLV/CHV

From: Ville Syrjälä <[email protected]>

I just noticed that VLV/CHV have a RAWCLK_FREQ register just like PCH platforms. It lives in the display power well, so we should update it when enabling the power well.

Interestingly the BIOS seems to leave it at the reset value (125) which doesn't match the rawclk frequency on VLV/CHV (200 MHz). As always with these register, the spec is extremely vague what the register does. All it says is: "This is used to generate a divided down clock for miscellaneous timers in display." Based on a quick test, at least AUX and PWM appear to be unaffected by this.

But since the register is there, let's configure it in accordance with the spec.

Note that we have to move intel_update_rawclk() to occur before we touch the power wells, so that the dev_priv->rawclk_freq is already populated when the disp2 enable hook gets called for the first time. I think this should be safe to do on other platforms as well.

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_reg.h         | 2 ++
 drivers/gpu/drm/i915/intel_display.c    | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h        | 1 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++
 5 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 5c7615041b31..fd1260d2b6ec 100644
@@ -454,6 +454,9 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	if (ret)
 		goto cleanup_vga_client;
 
+	/* must happen before intel_power_domains_init_hw() on VLV/CHV */
+	intel_update_rawclk(dev_priv);
+
 	intel_power_domains_init_hw(dev_priv, false);
 
 	intel_csr_ucode_init(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 25e229b609a7..0a2fd3000f94 100644
@@ -2449,6 +2449,8 @@ enum skl_disp_power_wells {
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT	0
 
+#define RAWCLK_FREQ_VLV		_MMIO(VLV_DISPLAY_BASE + 0x6024)
+
 #define _FPA0	0x6040
 #define _FPA1	0x6044
 #define _FPB0	0x6048
drivers/gpu/drm/i915/intel_display.c +2 -2
index b7cb632a2a31..eb7cb9431209 100644
@@ -185,6 +185,7 @@ intel_pch_rawclk(struct drm_i915_private *dev_priv)
 static int
 intel_vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
+	/* RAWCLK_FREQ_VLV register updated from power well code */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",
 				      CCK_DISPLAY_REF_CLOCK_CONTROL);
 }
@@ -218,7 +219,7 @@ intel_g4x_hrawclk(struct drm_i915_private *dev_priv)
 	}
 }
 
-static void intel_update_rawclk(struct drm_i915_private *dev_priv)
+void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
 	if (HAS_PCH_SPLIT(dev_priv))
 		dev_priv->rawclk_freq = intel_pch_rawclk(dev_priv);
@@ -15455,7 +15456,6 @@ void intel_modeset_init(struct drm_device *dev)
 	}
 
 	intel_update_czclk(dev_priv);
-	intel_update_rawclk(dev_priv);
 	intel_update_cdclk(dev);
 
 	intel_shared_dpll_init(dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index cb89a35a6755..ce78afefe3cd 100644
@@ -1110,6 +1110,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
 
 /* intel_display.c */
+void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
 		      const char *name, u32 reg, int ref_freq);
 extern const struct drm_plane_funcs intel_plane_funcs;
drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
index 7fb1da4e7fc3..b69b935516fb 100644
@@ -948,6 +948,11 @@ static void vlv_init_display_clock_gating(struct drm_i915_private *dev_priv)
 	 */
 	I915_WRITE(MI_ARB_VLV, MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE);
 	I915_WRITE(CBR1_VLV, 0);
+
+	WARN_ON(dev_priv->rawclk_freq == 0);
+
+	I915_WRITE(RAWCLK_FREQ_VLV,
+		   DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 1000));
 }
 
 static void vlv_display_power_well_init(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: Update RAWCLK_FREQ register on VLV/CHV

== Series Details ==

== Series Details ==

Series: drm/i915: Update RAWCLK_FREQ register on VLV/CHV
URL : https://patchwork.freedesktop.org/series/6410/
State : success

== Summary ==

Series 6410v1 drm/i915: Update RAWCLK_FREQ register on VLV/CHV
http://patchwork.freedesktop.org/api/1.0/series/6410/revisions/1/mbox/

Test drv_module_reload_basic:

                skip       -> PASS       (bdw-nuci7)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (bdw-ultra)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                dmesg-warn -> PASS       (snb-dellxps)
bdw-nuci7        total:200  pass:188  dwarn:0   dfail:0   fail:0   skip:12 
bdw-ultra        total:200  pass:175  dwarn:0   dfail:0   fail:0   skip:25 
bsw-nuc-2        total:199  pass:158  dwarn:0   dfail:0   fail:0   skip:41 
byt-nuc          total:199  pass:158  dwarn:0   dfail:0   fail:0   skip:41 
hsw-brixbox      total:200  pass:174  dwarn:0   dfail:0   fail:0   skip:26 
hsw-gt2          total:200  pass:178  dwarn:0   dfail:0   fail:1   skip:21 
ilk-hp8440p      total:200  pass:139  dwarn:0   dfail:0   fail:0   skip:61 
ivb-t430s        total:200  pass:169  dwarn:0   dfail:0   fail:0   skip:31 
skl-i7k-2        total:200  pass:173  dwarn:0   dfail:0   fail:0   skip:27 
skl-nuci5        total:200  pass:189  dwarn:0   dfail:0   fail:0   skip:11 
snb-dellxps      total:200  pass:158  dwarn:0   dfail:0   fail:0   skip:42 
snb-x220t        total:200  pass:158  dwarn:0   dfail:0   fail:1   skip:41 

Results at /archive/results/CI_IGT_test/Patchwork_2093/

e6c43160f35ad64114e1156e3f995e5dabe74835 drm-intel-nightly: 2016y-04m-27d-13h-17m-05s UTC integration manifest db80506 drm/i915: Update RAWCLK_FREQ register on VLV/CHV

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 47 lines · On Wed, 2016-04-27 at 17:43 +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

I just noticed that VLV/CHV have a RAWCLK_FREQ register just like PCH platforms. It lives in the display power well, so we should update it when enabling the power well.

Interestingly the BIOS seems to leave it at the reset value (125) which
doesn't match the rawclk frequency on VLV/CHV (200 MHz). As always with
these register, the spec is extremely vague what the register does. All
it says is: "This is used to generate a divided down clock for miscellaneous timers in display." Based on a quick test, at least AUX and PWM appear to be unaffected by this.

But since the register is there, let's configure it in accordance with
the spec.

Note that we have to move intel_update_rawclk() to occur before we touch the power wells, so that the dev_priv->rawclk_freq is already populated when the disp2 enable hook gets called for the first time. I think this should be safe to do on other platforms as well.

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_reg.h         | 2 ++
 drivers/gpu/drm/i915/intel_display.c    | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h        | 1 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++
 5 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +1 -0
index 5c7615041b31..fd1260d2b6ec 100644
@@ -454,6 +454,9 @@ static int i915_load_modeset_init(struct
 drm_device *dev)
 	if (ret)
 		goto cleanup_vga_client;
 
+	/* must happen before intel_power_domains_init_hw() on

VLV/CHV */

drivers/gpu/drm/i915/i915_dma.c static int i915_load_modeset_init(struct drm_device *dev) · line 458

Quoted 1 line
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	intel_update_rawclk(dev_priv);

separated patches since this affects all platforms?!

anyways I checked CHV spec here so feel free to ignore me and use

Quoted 85 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+
 	intel_power_domains_init_hw(dev_priv, false);
 
 	intel_csr_ucode_init(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 25e229b609a7..0a2fd3000f94 100644
@@ -2449,6 +2449,8 @@ enum skl_disp_power_wells {
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT	0
 
+#define RAWCLK_FREQ_VLV		_MMIO(VLV_DISPLAY_BASE +
 0x6024)
+
 #define _FPA0	0x6040
 #define _FPA1	0x6044

#define _FPB0 0x6048

drivers/gpu/drm/i915/intel_display.c +1 -0
index b7cb632a2a31..eb7cb9431209 100644
@@ -185,6 +185,7 @@ intel_pch_rawclk(struct drm_i915_private
 *dev_priv)
 static int
 intel_vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
+	/* RAWCLK_FREQ_VLV register updated from power well code */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",
 

CCK_DISPLAY_REF_CLOCK_CONTROL);
}

drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -218,7 +219,7 @@ intel_g4x_hrawclk(struct drm_i915_private
 *dev_priv)
 	}
 }
 
-static void intel_update_rawclk(struct drm_i915_private *dev_priv)
+void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
 	if (HAS_PCH_SPLIT(dev_priv))
drivers/gpu/drm/i915/intel_display.c +0 -1
 		dev_priv->rawclk_freq = intel_pch_rawclk(dev_priv);
@@ -15455,7 +15456,6 @@ void intel_modeset_init(struct drm_device
 *dev)
 	}
 
 	intel_update_czclk(dev_priv);
-	intel_update_rawclk(dev_priv);
 	intel_update_cdclk(dev);
 
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_shared_dpll_init(dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index cb89a35a6755..ce78afefe3cd 100644
@@ -1110,6 +1110,7 @@ void i915_audio_component_init(struct
 drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private
 *dev_priv);
 
 /* intel_display.c */
+void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_drv.h +0 -0
 		      const char *name, u32 reg, int ref_freq);
 extern const struct drm_plane_funcs intel_plane_funcs;
drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
index 7fb1da4e7fc3..b69b935516fb 100644
@@ -948,6 +948,11 @@ static void vlv_init_display_clock_gating(struct
 drm_i915_private *dev_priv)
 	 */
 	I915_WRITE(MI_ARB_VLV, MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE);
 	I915_WRITE(CBR1_VLV, 0);
+
+	WARN_ON(dev_priv->rawclk_freq == 0);
+
+	I915_WRITE(RAWCLK_FREQ_VLV,
+		   DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 1000));
 }
 
Quoted 2 lines

static void vlv_display_power_well_init(struct drm_i915_private
*dev_priv)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 46 lines · Rodrigo
Quoted 45 lines · On Wed, 2016-04-27 at 17:43 +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

I just noticed that VLV/CHV have a RAWCLK_FREQ register just like PCH platforms. It lives in the display power well, so we should update it when enabling the power well.

Interestingly the BIOS seems to leave it at the reset value (125) which
doesn't match the rawclk frequency on VLV/CHV (200 MHz). As always with
these register, the spec is extremely vague what the register does. All
it says is: "This is used to generate a divided down clock for miscellaneous timers in display." Based on a quick test, at least AUX and PWM appear to be unaffected by this.

But since the register is there, let's configure it in accordance with
the spec.

Note that we have to move intel_update_rawclk() to occur before we touch the power wells, so that the dev_priv->rawclk_freq is already populated when the disp2 enable hook gets called for the first time. I think this should be safe to do on other platforms as well.

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_reg.h         | 2 ++
 drivers/gpu/drm/i915/intel_display.c    | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h        | 1 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++
 5 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index 5c7615041b31..fd1260d2b6ec 100644
@@ -454,6 +454,9 @@ static int i915_load_modeset_init(struct
 drm_device *dev)
 	if (ret)
 		goto cleanup_vga_client;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_dma.c static int i915_load_modeset_init(struct drm_device *dev) · line 458

Quoted 3 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	/* must happen before intel_power_domains_init_hw() on

VLV/CHV */

drivers/gpu/drm/i915/i915_dma.c +1 -0
+	intel_update_rawclk(dev_priv);

separated patches since this affects all platforms?!

I was going to do that originally, but then I thought that if we have to revert due to some other platform, it's likely VLV/CHV would be forgotten and only later someone would start to complain about the WARN_ON() I added. So if this change needs to reverted, the VLV/CHV stuff needs to be redone anyway, so having it in the same commit seems like the slightly better option to me.

Quoted 92 lines

anyways I checked CHV spec here so feel free to ignore me and use

Quoted 87 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+
 	intel_power_domains_init_hw(dev_priv, false);
 
 	intel_csr_ucode_init(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 25e229b609a7..0a2fd3000f94 100644
@@ -2449,6 +2449,8 @@ enum skl_disp_power_wells {
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT	0
 
+#define RAWCLK_FREQ_VLV		_MMIO(VLV_DISPLAY_BASE +
 0x6024)
+
 #define _FPA0	0x6040
 #define _FPA1	0x6044

#define _FPB0 0x6048

drivers/gpu/drm/i915/intel_display.c +1 -0
index b7cb632a2a31..eb7cb9431209 100644
@@ -185,6 +185,7 @@ intel_pch_rawclk(struct drm_i915_private
 *dev_priv)
 static int
 intel_vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
+	/* RAWCLK_FREQ_VLV register updated from power well code */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",
 

CCK_DISPLAY_REF_CLOCK_CONTROL);
}

drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -218,7 +219,7 @@ intel_g4x_hrawclk(struct drm_i915_private
 *dev_priv)
 	}
 }
 
-static void intel_update_rawclk(struct drm_i915_private *dev_priv)
+void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
 	if (HAS_PCH_SPLIT(dev_priv))
drivers/gpu/drm/i915/intel_display.c +0 -1
 		dev_priv->rawclk_freq = intel_pch_rawclk(dev_priv);
@@ -15455,7 +15456,6 @@ void intel_modeset_init(struct drm_device
 *dev)
 	}
 
 	intel_update_czclk(dev_priv);
-	intel_update_rawclk(dev_priv);
 	intel_update_cdclk(dev);
 
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_shared_dpll_init(dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index cb89a35a6755..ce78afefe3cd 100644
@@ -1110,6 +1110,7 @@ void i915_audio_component_init(struct
 drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private
 *dev_priv);
 
 /* intel_display.c */
+void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_drv.h +0 -0
 		      const char *name, u32 reg, int ref_freq);
 extern const struct drm_plane_funcs intel_plane_funcs;
drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
index 7fb1da4e7fc3..b69b935516fb 100644
@@ -948,6 +948,11 @@ static void vlv_init_display_clock_gating(struct
 drm_i915_private *dev_priv)
 	 */
 	I915_WRITE(MI_ARB_VLV, MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE);
 	I915_WRITE(CBR1_VLV, 0);
+
+	WARN_ON(dev_priv->rawclk_freq == 0);
+
+	I915_WRITE(RAWCLK_FREQ_VLV,
+		   DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 1000));
 }
 

static void vlv_display_power_well_init(struct drm_i915_private
*dev_priv)

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#4 lore raw
Quoted 62 lines · Ville Syrjälä
Quoted 55 lines · Rodrigo

On Wed, 2016-04-27 at 17:43 +0300, [email protected] wr ote:

Quoted 53 lines

From: Ville Syrjälä <[email protected]>

I just noticed that VLV/CHV have a RAWCLK_FREQ register just like PCH
platforms. It lives in the display power well, so we should update it
when enabling the power well.

Interestingly the BIOS seems to leave it at the reset value (125) which
doesn't match the rawclk frequency on VLV/CHV (200 MHz). As always
with
these register, the spec is extremely vague what the register does.
All
it says is: "This is used to generate a divided down clock for miscellaneous timers in display." Based on a quick test, at least AUX
and PWM appear to be unaffected by this.

But since the register is there, let's configure it in accordance with
the spec.

Note that we have to move intel_update_rawclk() to occur before we
touch the power wells, so that the dev_priv->rawclk_freq is already
populated when the disp2 enable hook gets called for the first time.
I think this should be safe to do on other platforms as well.

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_reg.h         | 2 ++
 drivers/gpu/drm/i915/intel_display.c    | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h        | 1 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++
 5 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index 5c7615041b31..fd1260d2b6ec 100644
@@ -454,6 +454,9 @@ static int i915_load_modeset_init(struct
 drm_device *dev)
 	if (ret)
 		goto cleanup_vga_client;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_dma.c static int i915_load_modeset_init(struct drm_device *dev) · line 458

Quoted 3 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	/* must happen before intel_power_domains_init_hw() on

VLV/CHV */

drivers/gpu/drm/i915/i915_dma.c +1 -0
+	intel_update_rawclk(dev_priv);

separated patches since this affects all platforms?!

Quoted 8 lines

I was going to do that originally, but then I thought that if we have to
revert due to some other platform, it's likely VLV/CHV would be forgotten and only later someone would start to complain about the WARN_ON() I added. So if this change needs to reverted, the VLV/CHV stuff
needs to be redone anyway, so having it in the same commit seems like the slightly better option to me.

oh! makes a lot of sense indeed!

Quoted 97 lines
Quoted 97 lines

anyways I checked CHV spec here so feel free to ignore me and use

Quoted 91 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+
 	intel_power_domains_init_hw(dev_priv, false);
 
 	intel_csr_ucode_init(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 25e229b609a7..0a2fd3000f94 100644
@@ -2449,6 +2449,8 @@ enum skl_disp_power_wells {
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT	0
 
+#define RAWCLK_FREQ_VLV		_MMIO(VLV_DISPLAY_BASE +
 0x6024)
+
 #define _FPA0	0x6040
 #define _FPA1	0x6044

#define _FPB0 0x6048

drivers/gpu/drm/i915/intel_display.c +1 -0
index b7cb632a2a31..eb7cb9431209 100644
@@ -185,6 +185,7 @@ intel_pch_rawclk(struct drm_i915_private
 *dev_priv)
 static int
 intel_vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
+	/* RAWCLK_FREQ_VLV register updated from power well code
 */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",

CCK_DISPLAY_REF_CLOCK_CONTROL);
}

drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -218,7 +219,7 @@ intel_g4x_hrawclk(struct drm_i915_private
 *dev_priv)
 	}
 }
 
-static void intel_update_rawclk(struct drm_i915_private
 *dev_priv)
+void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
drivers/gpu/drm/i915/intel_display.c +0 -0
 	if (HAS_PCH_SPLIT(dev_priv))
 		dev_priv->rawclk_freq =

intel_pch_rawclk(dev_priv);

drivers/gpu/drm/i915/intel_display.c +0 -1
@@ -15455,7 +15456,6 @@ void intel_modeset_init(struct drm_device
 *dev)
 	}
 
 	intel_update_czclk(dev_priv);
-	intel_update_rawclk(dev_priv);
 	intel_update_cdclk(dev);
 
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_shared_dpll_init(dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index cb89a35a6755..ce78afefe3cd 100644
@@ -1110,6 +1110,7 @@ void i915_audio_component_init(struct
 drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private
 *dev_priv);
 
 /* intel_display.c */
+void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_drv.h +0 -0
 		      const char *name, u32 reg, int ref_freq);
 extern const struct drm_plane_funcs intel_plane_funcs;
drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
index 7fb1da4e7fc3..b69b935516fb 100644
@@ -948,6 +948,11 @@ static void

vlv_init_display_clock_gating(struct
drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
 	 */
 	I915_WRITE(MI_ARB_VLV,

MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE);

drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
 	I915_WRITE(CBR1_VLV, 0);
+
+	WARN_ON(dev_priv->rawclk_freq == 0);
+
+	I915_WRITE(RAWCLK_FREQ_VLV,
+		   DIV_ROUND_CLOSEST(dev_priv->rawclk_freq,

1000));
}

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

static void vlv_display_power_well_init(struct drm_i915_private
*dev_priv)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author Applied
#5 lore raw
Quoted 72 lines · Rodrigo
Quoted 62 lines · Ville Syrjälä
Quoted 55 lines · Rodrigo

On Wed, 2016-04-27 at 17:43 +0300, [email protected] wr ote:

Quoted 53 lines

From: Ville Syrjälä <[email protected]>

I just noticed that VLV/CHV have a RAWCLK_FREQ register just like PCH
platforms. It lives in the display power well, so we should update it
when enabling the power well.

Interestingly the BIOS seems to leave it at the reset value (125) which
doesn't match the rawclk frequency on VLV/CHV (200 MHz). As always
with
these register, the spec is extremely vague what the register does.
All
it says is: "This is used to generate a divided down clock for miscellaneous timers in display." Based on a quick test, at least AUX
and PWM appear to be unaffected by this.

But since the register is there, let's configure it in accordance with
the spec.

Note that we have to move intel_update_rawclk() to occur before we
touch the power wells, so that the dev_priv->rawclk_freq is already
populated when the disp2 enable hook gets called for the first time.
I think this should be safe to do on other platforms as well.

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_reg.h         | 2 ++
 drivers/gpu/drm/i915/intel_display.c    | 4 ++--
 drivers/gpu/drm/i915/intel_drv.h        | 1 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++
 5 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index 5c7615041b31..fd1260d2b6ec 100644
@@ -454,6 +454,9 @@ static int i915_load_modeset_init(struct
 drm_device *dev)
 	if (ret)
 		goto cleanup_vga_client;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_dma.c static int i915_load_modeset_init(struct drm_device *dev) · line 458

Quoted 3 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	/* must happen before intel_power_domains_init_hw() on

VLV/CHV */

drivers/gpu/drm/i915/i915_dma.c +1 -0
+	intel_update_rawclk(dev_priv);

separated patches since this affects all platforms?!

Quoted 8 lines

I was going to do that originally, but then I thought that if we have to
revert due to some other platform, it's likely VLV/CHV would be forgotten and only later someone would start to complain about the WARN_ON() I added. So if this change needs to reverted, the VLV/CHV stuff
needs to be redone anyway, so having it in the same commit seems like the slightly better option to me.

Quoted 6 lines

oh! makes a lot of sense indeed!

Quoted 4 lines
Quoted 4 lines

anyways I checked CHV spec here so feel free to ignore me and use

Pushed to dinq. Thanks for the review.

Quoted 96 lines
Quoted 96 lines
Quoted 95 lines
Quoted 95 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+
 	intel_power_domains_init_hw(dev_priv, false);
 
 	intel_csr_ucode_init(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 25e229b609a7..0a2fd3000f94 100644
@@ -2449,6 +2449,8 @@ enum skl_disp_power_wells {
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
 #define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT	0
 
+#define RAWCLK_FREQ_VLV		_MMIO(VLV_DISPLAY_BASE +
 0x6024)
+
 #define _FPA0	0x6040
 #define _FPA1	0x6044

#define _FPB0 0x6048

drivers/gpu/drm/i915/intel_display.c +1 -0
index b7cb632a2a31..eb7cb9431209 100644
@@ -185,6 +185,7 @@ intel_pch_rawclk(struct drm_i915_private
 *dev_priv)
 static int
 intel_vlv_hrawclk(struct drm_i915_private *dev_priv)
 {
+	/* RAWCLK_FREQ_VLV register updated from power well code
 */
 	return vlv_get_cck_clock_hpll(dev_priv, "hrawclk",

CCK_DISPLAY_REF_CLOCK_CONTROL);
}

drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -218,7 +219,7 @@ intel_g4x_hrawclk(struct drm_i915_private
 *dev_priv)
 	}
 }
 
-static void intel_update_rawclk(struct drm_i915_private
 *dev_priv)
+void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
drivers/gpu/drm/i915/intel_display.c +0 -0
 	if (HAS_PCH_SPLIT(dev_priv))
 		dev_priv->rawclk_freq =

intel_pch_rawclk(dev_priv);

drivers/gpu/drm/i915/intel_display.c +0 -1
@@ -15455,7 +15456,6 @@ void intel_modeset_init(struct drm_device
 *dev)
 	}
 
 	intel_update_czclk(dev_priv);
-	intel_update_rawclk(dev_priv);
 	intel_update_cdclk(dev);
 
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_shared_dpll_init(dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index cb89a35a6755..ce78afefe3cd 100644
@@ -1110,6 +1110,7 @@ void i915_audio_component_init(struct
 drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private
 *dev_priv);
 
 /* intel_display.c */
+void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_drv.h +0 -0
 		      const char *name, u32 reg, int ref_freq);
 extern const struct drm_plane_funcs intel_plane_funcs;
drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
index 7fb1da4e7fc3..b69b935516fb 100644
@@ -948,6 +948,11 @@ static void

vlv_init_display_clock_gating(struct
drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
 	 */
 	I915_WRITE(MI_ARB_VLV,

MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE);

drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
 	I915_WRITE(CBR1_VLV, 0);
+
+	WARN_ON(dev_priv->rawclk_freq == 0);
+
+	I915_WRITE(RAWCLK_FREQ_VLV,
+		   DIV_ROUND_CLOSEST(dev_priv->rawclk_freq,

1000));
}

static void vlv_display_power_well_init(struct drm_i915_private
*dev_priv)

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx