mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled.
@ 2017-11-01 14:16 Liviu Dudau
  2017-11-01 14:42 ` Brian Starkey
  0 siblings, 1 reply; 2+ messages in thread
From: Liviu Dudau @ 2017-11-01 14:16 UTC (permalink / raw)
  To: Brian Starkey; +Cc: Mali DP Maintainers, David Airlie, DRI-devel, LKML

Some clock providers (clk-vexpress-osc) trigger a WARN() when the
requested rate falls outside its capabilities, as is the case when
a CRTC gets disabled. Check if the CRTC's new state is enabled and
skip the clk_round_rate() call if it is not.

Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 drivers/gpu/drm/arm/hdlcd_crtc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412b..a1387a8bf78c4 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -193,6 +193,10 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
 	struct drm_display_mode *mode = &state->adjusted_mode;
 	long rate, clk_rate = mode->clock * 1000;
 
+	/* if the crtc is disabled, skip the clock check */
+	if (!state->enable)
+		return 0;
+
 	rate = clk_round_rate(hdlcd->clk, clk_rate);
 	if (rate != clk_rate) {
 		/* clock required by mode not supported by hardware */
-- 
2.14.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled.
  2017-11-01 14:16 [PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled Liviu Dudau
@ 2017-11-01 14:42 ` Brian Starkey
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Starkey @ 2017-11-01 14:42 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Mali DP Maintainers, David Airlie, DRI-devel, LKML

On Wed, Nov 01, 2017 at 02:16:25PM +0000, Liviu Dudau wrote:
>Some clock providers (clk-vexpress-osc) trigger a WARN() when the
>requested rate falls outside its capabilities, as is the case when
>a CRTC gets disabled. Check if the CRTC's new state is enabled and
>skip the clk_round_rate() call if it is not.

In itself, this seems like a fine patch. However, the motivation
maybe isn't.

IMO the WARN() in clk-vexpress-osc is bogus and should be removed -
the clk_round_rate() API is intended to convert from a desired rate to
something the clock actually supports - so it's basically expected
that the input rate might not be achievable.

Spewing a WARN when the API is used as-intended seems a little off :-)

Cheers,
-Brian

>
>Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
>Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
>Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
>---
> drivers/gpu/drm/arm/hdlcd_crtc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
>index 72b22b805412b..a1387a8bf78c4 100644
>--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
>+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
>@@ -193,6 +193,10 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
> 	struct drm_display_mode *mode = &state->adjusted_mode;
> 	long rate, clk_rate = mode->clock * 1000;
>
>+	/* if the crtc is disabled, skip the clock check */
>+	if (!state->enable)
>+		return 0;
>+
> 	rate = clk_round_rate(hdlcd->clk, clk_rate);
> 	if (rate != clk_rate) {
> 		/* clock required by mode not supported by hardware */
>-- 
>2.14.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-01 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-01 14:16 [PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled Liviu Dudau
2017-11-01 14:42 ` Brian Starkey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®