* [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
@ 2018-03-10 11:05 ` megous at megous.com
0 siblings, 0 replies; 6+ messages in thread
From: megous @ 2018-03-10 11:05 UTC (permalink / raw)
To: dev
Cc: Ondrej Jirman, Jernej Skrabec, Maxime Ripard, David Airlie,
Chen-Yu Tsai, open list:DRM DRIVERS FOR ALLWINNER A10,
moderated list:ARM/Allwinner sunXi SoC support, open list
From: Ondrej Jirman <megous@megous.com>
Currently the exclusivity is enabled when the rate is set by
the mode setting functions. These functions are called by
mode_set_nofb callback of drm_crc_helper. Then exclusivity
is disabled when tcon is disabled by atomic_disable
callback.
What happens is that mode_set_nofb can be called once when
mode chnages, and afterwards the system can call atomic_enable
and atomic_disable multiple times without further calls to
mode_set_nofb.
This happens:
mode_set_nofb - clk exclusivity is enabled
atomic_enable
atomic_disable - clk exclusivity is disabled
atomic_enable
atomic_disable - clk exclusivity is already disabled, leading to WARN
in clk_rate_exclusive_put
Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
Signed-off-by: Ondrej Jirman <megous@megous.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index d4a29847dadd..cc29daa062f7 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -104,6 +104,7 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
if (enabled) {
clk_prepare_enable(clk);
+ clk_rate_exclusive_get(clk);
} else {
clk_rate_exclusive_put(clk);
clk_disable_unprepare(clk);
@@ -263,7 +264,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
const struct drm_display_mode *mode)
{
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
/* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -428,7 +429,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1);
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
--
2.16.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
@ 2018-03-10 11:05 ` megous at megous.com
0 siblings, 0 replies; 6+ messages in thread
From: megous at megous.com @ 2018-03-10 11:05 UTC (permalink / raw)
To: linux-arm-kernel
From: Ondrej Jirman <megous@megous.com>
Currently the exclusivity is enabled when the rate is set by
the mode setting functions. These functions are called by
mode_set_nofb callback of drm_crc_helper. Then exclusivity
is disabled when tcon is disabled by atomic_disable
callback.
What happens is that mode_set_nofb can be called once when
mode chnages, and afterwards the system can call atomic_enable
and atomic_disable multiple times without further calls to
mode_set_nofb.
This happens:
mode_set_nofb - clk exclusivity is enabled
atomic_enable
atomic_disable - clk exclusivity is disabled
atomic_enable
atomic_disable - clk exclusivity is already disabled, leading to WARN
in clk_rate_exclusive_put
Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
Signed-off-by: Ondrej Jirman <megous@megous.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index d4a29847dadd..cc29daa062f7 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -104,6 +104,7 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
if (enabled) {
clk_prepare_enable(clk);
+ clk_rate_exclusive_get(clk);
} else {
clk_rate_exclusive_put(clk);
clk_disable_unprepare(clk);
@@ -263,7 +264,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
const struct drm_display_mode *mode)
{
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
/* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -428,7 +429,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1);
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
--
2.16.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
@ 2018-03-10 11:05 ` megous at megous.com
0 siblings, 0 replies; 6+ messages in thread
From: megous via linux-sunxi @ 2018-03-10 11:05 UTC (permalink / raw)
To: dev-3kdeTeqwOZ9EV1b7eY7vFQ
Cc: Ondrej Jirman, Jernej Skrabec, Maxime Ripard, David Airlie,
Chen-Yu Tsai, open list:DRM DRIVERS FOR ALLWINNER A10,
moderated list:ARM/Allwinner sunXi SoC support, open list
From: Ondrej Jirman <megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org>
Currently the exclusivity is enabled when the rate is set by
the mode setting functions. These functions are called by
mode_set_nofb callback of drm_crc_helper. Then exclusivity
is disabled when tcon is disabled by atomic_disable
callback.
What happens is that mode_set_nofb can be called once when
mode chnages, and afterwards the system can call atomic_enable
and atomic_disable multiple times without further calls to
mode_set_nofb.
This happens:
mode_set_nofb - clk exclusivity is enabled
atomic_enable
atomic_disable - clk exclusivity is disabled
atomic_enable
atomic_disable - clk exclusivity is already disabled, leading to WARN
in clk_rate_exclusive_put
Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
Signed-off-by: Ondrej Jirman <megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org>
Cc: Jernej Skrabec <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index d4a29847dadd..cc29daa062f7 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -104,6 +104,7 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
if (enabled) {
clk_prepare_enable(clk);
+ clk_rate_exclusive_get(clk);
} else {
clk_rate_exclusive_put(clk);
clk_disable_unprepare(clk);
@@ -263,7 +264,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
const struct drm_display_mode *mode)
{
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
/* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -428,7 +429,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1);
/* Configure the dot clock */
- clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000);
+ clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
--
2.16.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
2018-03-10 11:05 ` megous at megous.com
(?)
@ 2018-03-12 9:44 ` Maxime Ripard
-1 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2018-03-12 9:44 UTC (permalink / raw)
To: megous
Cc: dev, Jernej Skrabec, David Airlie, Chen-Yu Tsai,
open list:DRM DRIVERS FOR ALLWINNER A10,
moderated list:ARM/Allwinner sunXi SoC support, open list
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
On Sat, Mar 10, 2018 at 12:05:11PM +0100, megous@megous.com wrote:
> From: Ondrej Jirman <megous@megous.com>
>
> Currently the exclusivity is enabled when the rate is set by
> the mode setting functions. These functions are called by
> mode_set_nofb callback of drm_crc_helper. Then exclusivity
> is disabled when tcon is disabled by atomic_disable
> callback.
>
> What happens is that mode_set_nofb can be called once when
> mode chnages, and afterwards the system can call atomic_enable
> and atomic_disable multiple times without further calls to
> mode_set_nofb.
>
> This happens:
>
> mode_set_nofb - clk exclusivity is enabled
> atomic_enable
> atomic_disable - clk exclusivity is disabled
> atomic_enable
> atomic_disable - clk exclusivity is already disabled, leading to WARN
> in clk_rate_exclusive_put
>
> Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
>
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Applied, thanks!
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
@ 2018-03-12 9:44 ` Maxime Ripard
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2018-03-12 9:44 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Mar 10, 2018 at 12:05:11PM +0100, megous at megous.com wrote:
> From: Ondrej Jirman <megous@megous.com>
>
> Currently the exclusivity is enabled when the rate is set by
> the mode setting functions. These functions are called by
> mode_set_nofb callback of drm_crc_helper. Then exclusivity
> is disabled when tcon is disabled by atomic_disable
> callback.
>
> What happens is that mode_set_nofb can be called once when
> mode chnages, and afterwards the system can call atomic_enable
> and atomic_disable multiple times without further calls to
> mode_set_nofb.
>
> This happens:
>
> mode_set_nofb - clk exclusivity is enabled
> atomic_enable
> atomic_disable - clk exclusivity is disabled
> atomic_enable
> atomic_disable - clk exclusivity is already disabled, leading to WARN
> in clk_rate_exclusive_put
>
> Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
>
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Applied, thanks!
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180312/ea213dee/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks
@ 2018-03-12 9:44 ` Maxime Ripard
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2018-03-12 9:44 UTC (permalink / raw)
To: megous
Cc: Jernej Skrabec, dev, open list,
open list:DRM DRIVERS FOR ALLWINNER A10, David Airlie,
Chen-Yu Tsai, moderated list:ARM/Allwinner sunXi SoC support
[-- Attachment #1.1: Type: text/plain, Size: 1183 bytes --]
On Sat, Mar 10, 2018 at 12:05:11PM +0100, megous@megous.com wrote:
> From: Ondrej Jirman <megous@megous.com>
>
> Currently the exclusivity is enabled when the rate is set by
> the mode setting functions. These functions are called by
> mode_set_nofb callback of drm_crc_helper. Then exclusivity
> is disabled when tcon is disabled by atomic_disable
> callback.
>
> What happens is that mode_set_nofb can be called once when
> mode chnages, and afterwards the system can call atomic_enable
> and atomic_disable multiple times without further calls to
> mode_set_nofb.
>
> This happens:
>
> mode_set_nofb - clk exclusivity is enabled
> atomic_enable
> atomic_disable - clk exclusivity is disabled
> atomic_enable
> atomic_disable - clk exclusivity is already disabled, leading to WARN
> in clk_rate_exclusive_put
>
> Solution is to enable exclusivity in sun4i_tcon_channel_set_status.
>
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Applied, thanks!
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-12 9:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-10 11:05 [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks megous
2018-03-10 11:05 ` megous via linux-sunxi
2018-03-10 11:05 ` megous at megous.com
2018-03-12 9:44 ` Maxime Ripard
2018-03-12 9:44 ` Maxime Ripard
2018-03-12 9:44 ` Maxime Ripard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.