drm/i915/skl: Init cdclk in the driver rather than relying on pre-os
Subsystems (2)
PATCH 1/1 drm/i915/skl: Init cdclk in the driver rather than relying on pre-os
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -4
@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv); }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);
How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Random comment from the back, what about intentional cdclk change on module load? We're supposed to have that for bdw [1] but last I checked it failed... [2].
BR,
Jani.
[1] http://mid.gmane.org/[email protected]
[2] http://mid.gmane.org/[email protected]
Quoted 6 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 29 lines · Jani Nikula
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 3 lines
Random comment from the back, what about intentional cdclk change on module load? We're supposed to have that for bdw [1] but last I checked it failed... [2].
Yes. We will require cdclk change run time as well say if we hot plug a DP 4k@60. So this capability is something that might really be needed.
Regards
Shobhit
Quoted 15 lines
BR,
Jani.[1] http://mid.gmane.org/[email protected]
[2] http://mid.gmane.org/[email protected]Quoted 6 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in skl_init_cdclk. In my tests where BIOS does enable this, I faced no issues in initializing again in driver. I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in get_display_clock_speed instead of bit[28:26] and then if wrong then only do the cdclk init.
Regards
Shobhit
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Quoted 5 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.
I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 15 lines
Regards
ShobhitQuoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.
Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."
Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
Regards
Shobhit
Quoted 11 lines
Quoted 11 lines
Regards
ShobhitQuoted 6 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 57 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 7 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.
Quoted 7 lines
Quoted 4 lines
I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a sanitize_cdclk or similar for this at the very end of the hw state sanitize sequence.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.
Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a calc_cdclk for SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.
Quoted 9 lines
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 72 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.
Quoted 7 lines
Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.
Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 76 lines · Daniel Vetter
Quoted 75 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
Quoted 7 lines
Quoted 4 lines
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
Yes, exactly. How about just adding verify_cdclk and calling in get_display_clock_speed to check if cdclk is programmed correctly along with related DPLL0 VCO settings for now. If all looks good, then skip else initialize. Now in that case if we have to initialize where do we get the cdclock to initialize with at this point ? Any default in VBT ? Or go with minimum by default and it can be bumped up later if needed.
Regards
Shobhit
Quoted 2 lines
-Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 85 lines · Shobhit
Quoted 76 lines · Daniel Vetter
Quoted 75 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
Quoted 7 lines
Quoted 4 lines
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
Quoted 6 lines
Yes, exactly. How about just adding
verify_cdclkand calling inget_display_clock_speedto check if cdclk is programmed correctly along with related DPLL0 VCO settings for now. If all looks good, then skip else initialize. Now in that case if we have to initialize where do we get the cdclock to initialize with at this point ? Any default in VBT ? Or go with minimum by default and it can be bumped up later if needed.
Just initialize to the slowest possible value, once we have dynamic cdclk switching for skl. But that seems to be stuck behind resolving that big confusion around dmc and the sequence for runtime pm. Without dynamic cdclk we have to pick the maximum.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 93 lines · Daniel Vetter
Quoted 85 lines · Shobhit
Quoted 76 lines · Daniel Vetter
Quoted 75 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
Quoted 7 lines
Quoted 4 lines
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
Quoted 6 lines
Yes, exactly. How about just adding
verify_cdclkand calling inget_display_clock_speedto check if cdclk is programmed correctly along with related DPLL0 VCO settings for now. If all looks good, then skip else initialize. Now in that case if we have to initialize where do we get the cdclock to initialize with at this point ? Any default in VBT ? Or go with minimum by default and it can be bumped up later if needed.
Quoted 4 lines
Just initialize to the slowest possible value, once we have dynamic cdclk switching for skl. But that seems to be stuck behind resolving that big confusion around dmc and the sequence for runtime pm. Without dynamic cdclk we have to pick the maximum.
I suppose we could simply disable DC5/6 around the cdclk update if needed. But I'm not sure we'd need to do that since any register access should anyway bring it out of DC5/6, and when it goes back into DC5/6 it'll save the current values and restore them again on the next wakeup.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 82 lines · Shobhit
Quoted 81 lines · Daniel Vetter
Quoted 79 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.
Quoted 6 lines
Quoted 2 lines
Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
Yes, exactly. How about just adding
verify_cdclkand calling inget_display_clock_speedto check if cdclk is programmed correctly along with related DPLL0 VCO settings for now.
I would just keep it somewhere in init/resume path rather than polluting .get_display_clock_speed with it. We should be calling intel_update_cdclk() in those paths somewhere, so doing the fixup just before that should be sufficient.
Quoted 4 lines
If all looks good, then skip
else initialize. Now in that case if we have to initialize where do we get the cdclock to initialize with at this point ? Any default in VBT ? Or go with minimum by default and it can be bumped up later if needed.
Can we figure out the eDP link rate requirements ahead of time from VBT? That should dictate what the VCO frequency has to be. If we get it wrong, then we'd have to change the VCO again after the eDP probe has told us what we actually need. Such a second fixup could actually be left up to the normal modeset calc_cdclk stuff, which shouldn't really need any special handling for it apart from actually updating the DPLL0 settings if needed, in addition to the normal cdclk divider stuff.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 86 lines · Ville Syrjälä
Quoted 85 lines · Shobhit
Quoted 83 lines · Daniel Vetter
Quoted 72 lines · Ville Syrjälä
Quoted 63 lines · Daniel Vetter
Quoted 62 lines · Shobhit
Quoted 36 lines · Imre Deak
Quoted 29 lines · Shobhit
Quoted 16 lines · Imre Deak
Quoted 15 lines · Shobhit Kumar
Mostly reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the default value.
Cc Imre Deak <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2947,10 +2947,8 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2951
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +skl_init_cdclk (dev_priv);How does this prevent changing the clock if BIOS did enable some output? We shouldn't change the clock in that case.
Quoted 5 lines
In that case it will try to re-apply the same clock that BIOS enabled. Not sure if this is allowed, but I checked the cdclock change sequence and it is mostly followed in
skl_init_cdclk.
In my tests where BIOS does enable this, I faced no issues in initializing again in driver.Quoted 3 lines
The first step in that sequence:
"Disable all display engine functions using the full mode set disable sequence on all pipes, ports, and planes."Oh, yeah, I again made mistake of assuming that display is not enabled in the first place. You are right, though it works if I change the clock again.
Quoted 3 lines
So the problem is not that the PLL itself may be enabled here (as BIOS left it), but that some output is also enabled.
Yes.
Quoted 11 lines
Quoted 6 lines
I have noticed on some pre-os this value is programmed correctly except for the decimal part. That causes AUX transactions to fail on SKl. That is what triggered this patch actually. So other way is to completely validate the value in
get_display_clock_speedinstead of bit[28:26] and then if wrong then only do the cdclk init.I think we'd need to detect at this point if outputs are enabled and only attempt to work around the above BIOS problem if this is not the case. Alternatively you could also disable the active outputs as a first step.
Quoted 7 lines
Quoted 2 lines
Ok, let me detect if any output is enabled by BIOS and accordingly initialize cdclk.
These kind of fixiups should be done after the hw state readout. We already have sanitize_crtc/pll/encoder functions, probably best if we add a
sanitize_cdclkor similar for this at the very end of the hw state sanitize sequence.Quoted 7 lines
Can't be done if we already need a somewhat sane cdclk for the eDP AUX probing and whatnot.
For actually enabling the cdclk for pushing pixels, we wouldn't need to do anything except actually plug ia a
calc_cdclkfor SKL. No idea why we're not doing that currently. Some extra care may be needed due to the eDP DPLL0 usag IIRC.Hm right, cdlck is in the top-level power domain. Added fun is that with dmc the firmware is supposed to handle it. Messy :(
Quoted 8 lines
Quoted 3 lines
Yes, exactly. How about just adding
verify_cdclkand calling inget_display_clock_speedto check if cdclk is programmed correctly along with related DPLL0 VCO settings for now.I would just keep it somewhere in init/resume path rather than polluting .get_display_clock_speed with it. We should be calling
intel_update_cdclk()in those paths somewhere, so doing the fixup just before that should be sufficient.
I think, get_display_clock_speed should be okay where it returns valid cdclk if programmed correctly else returns -EINVAL. In case of boot, invalid means pre-OS did not try to enable display and based on the error, during ddi_pll_init, we can safely call skl_init_cdclk.
Quoted 6 lines
Quoted 5 lines
If all looks good, then skip
else initialize. Now in that case if we have to initialize where do we get the cdclock to initialize with at this point ? Any default in VBT ? Or go with minimum by default and it can be bumped up later if needed.
Quoted 9 lines
Can we figure out the eDP link rate requirements ahead of time from VBT? That should dictate what the VCO frequency has to be. If we get it wrong, then we'd have to change the VCO again after the eDP probe has told us what we actually need. Such a second fixup could actually be left up to the normal modeset
calc_cdclkstuff, which shouldn't really need any special handling for it apart from actually updating the DPLL0 settings if needed, in addition to the normal cdclk divider stuff.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915/skl: Init cdclk in the driver rather than relying on pre-os
In reply to Shobhit KumarReuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only do slk_init_cdclk if validation failed else reuse BIOS programmed value
--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +13 -5
@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) { +/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv); + }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
drivers/gpu/drm/i915/intel_display.c +29 -10
@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;
@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }static int broxton_get_display_clock_speed (struct drm_device *dev)
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Shobhit Kumar
Reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valueCc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-1@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq;
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +6
-4-if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) { +/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv);
This would still try to reprogram CDCLK if BIOS enabled an output with an incorrect CDCLK decimal part. Isn't this the exact scenario you're seeing? As said before reprogramming CDCLK in that case would require disabling the outputs first.
We would also need to call skl_init_cdclk if the BIOS hasn't enabled the PLL for some reason. But I guess that could be a separate change.
Quoted 77 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0+ }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +22
-10@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but
drivers/gpu/drm/i915/intel_display.c static int skylake_get_display_clock_speed(struct drm_device *dev) · line 6697
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-0+* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }static int broxton_get_display_clock_speed (struct drm_device *dev)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 34 lines · Imre Deak
Quoted 33 lines · Shobhit Kumar
Reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valueCc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +3
-5@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) {
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv);This would still try to reprogram CDCLK if BIOS enabled an output with an incorrect CDCLK decimal part. Isn't this the exact scenario you're seeing? As said before reprogramming CDCLK in that case would require disabling the outputs first.
I went with the hypothesis that if VBIOS/GOP was loaded it would have to correct the cdclock, with wrong decimal value display cannot be enabled. For example AUX will fail on SKL. So for correct display output enabled cdclock has to be correctly programmed. If it is wrong display was not enabled at all.
The scenario which I am seeing is VBIOS/GOP is not loaded at all, and the pre-os is not leaving cdclock in correct state.
Quoted 90 lines
We would also need to call
skl_init_cdclkif the BIOS hasn't enabled the PLL for some reason. But I guess that could be a separate change.Quoted 86 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0+ }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +29
-10@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skylake_get_display_clock_speed(struct drm_device *dev) · line 6697
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0
-0static int broxton_get_display_clock_speed (struct drm_device *dev)_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 44 lines · Shobhit
Quoted 34 lines · Imre Deak
Quoted 33 lines · Shobhit Kumar
Reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valueCc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +3
-5@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) {Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv);This would still try to reprogram CDCLK if BIOS enabled an output with an incorrect CDCLK decimal part. Isn't this the exact scenario you're seeing? As said before reprogramming CDCLK in that case would require disabling the outputs first.
Quoted 8 lines
I went with the hypothesis that if VBIOS/GOP was loaded it would have to correct the cdclock, with wrong decimal value display cannot be enabled. For example AUX will fail on SKL. So for correct display output enabled cdclock has to be correctly programmed. If it is wrong display was not enabled at all.
The scenario which I am seeing is VBIOS/GOP is not loaded at all, and the pre-os is not leaving cdclock in correct state.
But it still enabled DPLL0? Why does it do that if it doesn't set up cdclk?
Quoted 103 lines
Quoted 91 lines
We would also need to call
skl_init_cdclkif the BIOS hasn't enabled the PLL for some reason. But I guess that could be a separate change.Quoted 86 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0+ }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +29
-10@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skylake_get_display_clock_speed(struct drm_device *dev) · line 6697
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0
-0static int broxton_get_display_clock_speed (struct drm_device *dev)_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 51 lines · Ville Syrjälä
Quoted 50 lines · Shobhit
Quoted 34 lines · Imre Deak
Quoted 33 lines · Shobhit Kumar
Reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valueCc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +3
-5@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) {Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv);This would still try to reprogram CDCLK if BIOS enabled an output with an incorrect CDCLK decimal part. Isn't this the exact scenario you're seeing? As said before reprogramming CDCLK in that case would require disabling the outputs first.
I went with the hypothesis that if VBIOS/GOP was loaded it would have to correct the cdclock, with wrong decimal value display cannot be enabled. For example AUX will fail on SKL. So for correct display output enabled cdclock has to be correctly programmed. If it is wrong display was not enabled at all.
Quoted 5 lines
Quoted 2 lines
The scenario which I am seeing is VBIOS/GOP is not loaded at all, and the pre-os is not leaving cdclock in correct state.
But it still enabled DPLL0? Why does it do that if it doesn't set up cdclk?
So I had discussion with some folks in BIOS team and came to know that on some boards even if higher cdclocks are supported, we might want to limit maximum cdclock. This is done by BIOS programming the cdclock to allowed maximum and VBIOS/GOP uses that as the max value rather than the real possible max. So the BIOS is supposed to program cdclock correctly and hence DPLL0 as well. My only assumption is in this case it has not correctly programmed due to some bug. I know if I work with them and ensure that BIOS programs correctly, the problem will be solved, but do you think it is worth while to remove the tight dependency altogether ?
Quoted 100 lines
Quoted 100 lines
Quoted 100 lines
We would also need to call
skl_init_cdclkif the BIOS hasn't enabled the PLL for some reason. But I guess that could be a separate change.Quoted 77 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0+ }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +22
-10@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but drivers/gpu/drm/i915/intel_display.c static int skylake_get_display_clock_speed(struct drm_device *dev) · line 6697
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-0+* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }static int broxton_get_display_clock_speed (struct drm_device *dev)_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 51 lines · Ville Syrjälä
Quoted 50 lines · Shobhit
Quoted 34 lines · Imre Deak
Quoted 33 lines · Shobhit Kumar
Reuse what is programmed by pre-os, but in case there is no pre-os initialization, init the cdclk with the max value by default untill dynamic cdclk support comes.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valueCc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +3
-5@@ -2946,11 +2946,19 @@ void intel_ddi_pll_init(struct drm_device *dev)int cdclk_freq; cdclk_freq = dev_priv->display.get_display_clock_speed (dev); - dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + +/* Invalid CDCLK from BIOS ? */ +if (cdclk_freq <0 ) {Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2954
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+/* program to maximum cdclk till we have dynamic cdclk support */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv);This would still try to reprogram CDCLK if BIOS enabled an output with an incorrect CDCLK decimal part. Isn't this the exact scenario you're seeing? As said before reprogramming CDCLK in that case would require disabling the outputs first.
I went with the hypothesis that if VBIOS/GOP was loaded it would have to correct the cdclock, with wrong decimal value display cannot be enabled. For example AUX will fail on SKL. So for correct display output enabled cdclock has to be correctly programmed. If it is wrong display was not enabled at all.
Quoted 6 lines
Quoted 2 lines
The scenario which I am seeing is VBIOS/GOP is not loaded at all, and the pre-os is not leaving cdclock in correct state.
But it still enabled DPLL0? Why does it do that if it doesn't set up cdclk?
Okay digging more into FSP code, found a bug where even when display is not initialized in pre-os, still there was an initialization path for enabling display audio for HDMI which was enabling DPLL0. That also should have been not invoked when display itself is not being loaded. Not sure what going on in there !! Will work with FSP team and get this rectified. After that sanitize patch(following up this mail) can check the clock related programming and sanitize if needed as discussed with you Ville on IRC.
Regards
Shobhit
Quoted 99 lines
Quoted 99 lines
Quoted 99 lines
We would also need to call
skl_init_cdclkif the BIOS hasn't enabled the PLL for some reason. But I guess that could be a separate change.Quoted 77 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0+ }else { + dev_priv->skl_boot_cdclk = cdclk_freq; +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +22
-10@@ -6634,12 +6634,15 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)uint32_t lcpll1 =I915_READ (LCPLL1_CTL );uint32_t cdctl =I915_READ (CDCLK_CTL );uint32_t linkrate; +int freq;if (!(lcpll1 &LCPLL_PLL_ENABLE ))return 24000 ;/* 24MHz is the cd freq with NSSC ref */ -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; +if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) { + freq =540000 ; + goto verify; + } linkrate = (I915_READ (DPLL_CTRL1 ) &DPLL_CTRL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ;@@ -6649,30 +6652,46 @@ static int skylake_get_display_clock_speed(struct drm_device *dev)/* vco 8640 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 432000 ; + freq =432000 ; +break ;case CDCLK_FREQ_337_308 : -return 308570 ; + freq =308570 ; +break ;case CDCLK_FREQ_675_617 : -return 617140 ; + freq =617140 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } }else {/* vco 8100 */ switch (cdctl &CDCLK_FREQ_SEL_MASK ) {case CDCLK_FREQ_450_432 : -return 450000 ; + freq =450000 ; +break ;case CDCLK_FREQ_337_308 : -return 337500 ; + freq =337500 ; +break ;case CDCLK_FREQ_675_617 : -return 675000 ; + freq =675000 ; +break ;default :WARN (1 ,"Unknown cd freq selection\n" ); +return -EINVAL ; } } -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; +verify: +/* +* Noticed in some instances that the freq selection is correct but drivers/gpu/drm/i915/intel_display.c static int skylake_get_display_clock_speed(struct drm_device *dev) · line 6697
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-0+* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +return freq; +else +return -EINVAL ; }static int broxton_get_display_clock_speed (struct drm_device *dev)_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 drm/i915/skl: If needed sanitize bios programmed cdclk
In reply to Shobhit KumarEspecially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only do slk_init_cdclk if validation failed else reuse BIOS programmed value
v3: Move the validation logic in a separate sanitize function (Ville)
--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +8 -4
@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);
drivers/gpu/drm/i915/intel_display.c +31 -0
@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 10 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Ville, does this come even close to what you had in mind ?
Quoted 81 lines
Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +8
-4@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" ); +else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +31
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ; +skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h void broxton_ddi_phy_uninit(struct drm_device *dev); · line 1158
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
In reply to Shobhit KumarQuoted 27 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev);
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2956
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-4dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" );
Since skl_sanitize_cdclk() will enable the PLL this shouldn't happen anymore, right?
Quoted 29 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +15
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well.
drivers/gpu/drm/i915/intel_display.c void skl_init_cdclk(struct drm_i915_private *dev_priv) · line 5811
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ;
Should be '= dev_priv->max_cdclk'
I think we end up doing the intel_update_cdclk() before this gets called, so max_cdclk should already contain something sensible. The whole init sequence is a bit messy currently, but I think we can put off cleaning it up after the dc6 stuff gets sorted.
Quoted 23 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);Signature · 1 line
2.4.3
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 27 lines · Ville Syrjälä
Quoted 26 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev)
Quoted 15 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2956
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" );Since
skl_sanitize_cdclk()will enable the PLL this shouldn't happen anymore, right?
Yeah right. Will remove.
Quoted 42 lines
Quoted 29 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +15
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. drivers/gpu/drm/i915/intel_display.c void skl_init_cdclk(struct drm_i915_private *dev_priv) · line 5811
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ;Should be '=
dev_priv->max_cdclk'
Quoted 5 lines
I think we end up doing the
intel_update_cdclk()before this gets called, somax_cdclkshould already contain something sensible. The whole init sequence is a bit messy currently, but I think we can put off cleaning it up after the dc6 stuff gets sorted.
Actually at the end of skl_init_cdclock, intel_update_cdclk will be called and initialize the max_cdclk correctly. In case there was no sanitization needed, the BIOS programmed cdclk is stored in skl_boot_cdclk and that is used inside the skl_init_cdclk. Same is invoked resume time, so we need to update this variable or else change the logic.
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); --2.4.3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 88 lines · Shobhit
Quoted 27 lines · Ville Syrjälä
Quoted 26 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 15 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2956
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" );Since
skl_sanitize_cdclk()will enable the PLL this shouldn't happen anymore, right?Yeah right. Will remove.
Quoted 42 lines
Quoted 29 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +15
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. drivers/gpu/drm/i915/intel_display.c void skl_init_cdclk(struct drm_i915_private *dev_priv) · line 5811
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ;Should be '=
dev_priv->max_cdclk'
Quoted 8 lines
Quoted 5 lines
I think we end up doing the
intel_update_cdclk()before this gets called, somax_cdclkshould already contain something sensible. The whole init sequence is a bit messy currently, but I think we can put off cleaning it up after the dc6 stuff gets sorted.Actually at the end of
skl_init_cdclock,intel_update_cdclkwill be called and initialize themax_cdclkcorrectly.
It gets called already earlier from intel_modeset_init().
Quoted 30 lines
In case there was no
sanitization needed, the BIOS programmed cdclk is stored inskl_boot_cdclkand that is used inside theskl_init_cdclk. Same is invoked resume time, so we need to update this variable or else change the logic.Quoted 24 lines
Quoted 23 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); --2.4.3
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v3] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 95 lines · Ville Syrjälä
Quoted 94 lines · Shobhit
Quoted 27 lines · Ville Syrjälä
Quoted 26 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 40 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2949,10 +2949,14 @@ void intel_ddi_pll_init(struct drm_device *dev)Quoted 15 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2956
Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-4cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); -else -intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" ); +else { +if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) +DRM_ERROR ("LCPLL1 is disabled\n" );Since
skl_sanitize_cdclk()will enable the PLL this shouldn't happen anymore, right?Yeah right. Will remove.
Quoted 47 lines
Quoted 29 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+else +intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); + } }else if (IS_BROXTON (dev)) {broxton_init_cdclk (dev);broxton_ddi_phy_init (dev);drivers/gpu/drm/i915/intel_display.c +15
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. drivers/gpu/drm/i915/intel_display.c void skl_init_cdclk(struct drm_i915_private *dev_priv) · line 5811
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk =675000 ;Should be '=
dev_priv->max_cdclk'I think we end up doing the
intel_update_cdclk()before this gets called, somax_cdclkshould already contain something sensible. The whole init sequence is a bit messy currently, but I think we can put off cleaning it up after the dc6 stuff gets sorted.
Quoted 4 lines
Quoted 2 lines
Actually at the end of
skl_init_cdclock,intel_update_cdclkwill be called and initialize themax_cdclkcorrectly.It gets called already earlier from
intel_modeset_init().
Yeah, I misunderstood your comment earlier.
Quoted 23 lines
Quoted 23 lines
In case there was no
sanitization needed, the BIOS programmed cdclk is stored inskl_boot_cdclkand that is used inside theskl_init_cdclk. Same is invoked resume time, so we need to update this variable or else change the logic.Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); --2.4.3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 1/1 drm/i915/skl: If needed sanitize bios programmed cdclk
In reply to Shobhit KumarEspecially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only do slk_init_cdclk if validation failed else reuse BIOS programmed value
v3: Move the validation logic in a separate sanitize function (Ville)
v4: No need to check LCPLL after sanitize and use max_cdclk_freq instead
of hardcoded value (Ville)
--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 34 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
@@ -2949,8 +2949,8 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" );else intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); }else if (IS_BROXTON (dev)) {
drivers/gpu/drm/i915/intel_display.c +31 -0
@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk = dev_priv->max_cdclk_freq; +skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v4] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 9 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed value
Quoted 8 lines
v3: Move the validation logic in a separate sanitize function (Ville)
v4: No need to check LCPLL after sanitize and use
max_cdclk_freqinstead
of hardcoded value (Ville)Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>
Quoted 77 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 34 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +2
-2@@ -2949,8 +2949,8 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" );else intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); }else if (IS_BROXTON (dev)) {drivers/gpu/drm/i915/intel_display.c +31
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk = dev_priv->max_cdclk_freq; +skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);Signature · 1 line
2.4.3
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedRe: [v4] drm/i915/skl: If needed sanitize bios programmed cdclk
Quoted 12 lines · Ville Syrjälä
Quoted 11 lines · Shobhit Kumar
Especially in cases where pre-os does not enable display, cdclk might not be in sane state. During sanitization initialize cdclk with maximum value till we get dynamic cdclk support.
v2: Check if BIOS programmed correctly rather than always calling init
- Do validation of programmed cdctl and what it is expected
- Only doslk_init_cdclkif validation failed else reuse BIOS programmed valuev3: Move the validation logic in a separate sanitize function (Ville)
Quoted 8 lines
Quoted 6 lines
v4: No need to check LCPLL after sanitize and use
max_cdclk_freqinstead
of hardcoded value (Ville)Cc Imre Deak <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 82 lines
Quoted 78 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 34 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +2
-2@@ -2949,8 +2949,8 @@ void intel_ddi_pll_init(struct drm_device *dev) cdclk_freq = dev_priv->display.get_display_clock_speed (dev); dev_priv->skl_boot_cdclk = cdclk_freq; -if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE )) -DRM_ERROR ("LCPLL1 is disabled\n" ); +if (skl_sanitize_cdclk (dev_priv)) +DRM_DEBUG_KMS ("Sanitized cdclk programmed by pre-os\n" );else intel_display_power_get (dev_priv,POWER_DOMAIN_PLLS ); }else if (IS_BROXTON (dev)) {drivers/gpu/drm/i915/intel_display.c +31
-0@@ -5784,6 +5784,37 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv)DRM_ERROR ("DBuf power enable timeout\n" ); } +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv) +{ +uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); +uint32_t cdctl =I915_READ (CDCLK_CTL ); +int freq = dev_priv->skl_boot_cdclk; + +/* Is PLL enabled and locked ? */ +if (!((lcpll1 &LCPLL_PLL_ENABLE ) && (lcpll1 &LCPLL_PLL_LOCK ))) + goto sanitize; + +/* DPLL okay; verify the cdclock +* +* Noticed in some instances that the freq selection is correct but +* decimal part is programmed wrong from BIOS where pre-os does not +* enable display. Verify the same as well. +*/ +if (cdctl == ((cdctl &CDCLK_FREQ_SEL_MASK ) |skl_cdclk_decimal (freq))) +/* All well; nothing to sanitize */ +return false; +sanitize: +/* +* As of now initialize with max cdclk till +* we get dynamic cdclk support +* */ + dev_priv->skl_boot_cdclk = dev_priv->max_cdclk_freq; +skl_init_cdclk (dev_priv); + +/* we did have to sanitize */ +return true; +} +/* Adjust CDclk dividers to allow high res or save power if possible */ static void valleyview_set_cdclk (struct drm_device *dev,int cdclk) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1152,6 +1152,7 @@ void broxton_ddi_phy_uninit(struct drm_device *dev);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);void skl_init_cdclk (struct drm_i915_private *dev_priv); +int skl_sanitize_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_dp_get_m_n (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config);Signature · 1 line
2.4.3Signature · 2 lines
Ville Syrjälä Intel OTC
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx