From patchwork Sat Mar 10 11:05:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 10273429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA706602BD for ; Sat, 10 Mar 2018 11:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9275299DE for ; Sat, 10 Mar 2018 11:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD36E299F4; Sat, 10 Mar 2018 11:05:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=2.0 tests=BAYES_00, DKIM_ADSP_DISCARD, DKIM_SIGNED,DKIM_VALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B8B7299DE for ; Sat, 10 Mar 2018 11:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=W16L+hWO0gnVr9W3GOsCbxOt67uHqLKv6tlkWAnAG7Y=; b=OF9 9hMaLl5O2U/UWmoId7CwShQDiObntMnGoWkm3YoRZwYf0ep64YatoAQ1FO5SzcvLPcPhFqHt/R9Py BzTSvKxHZkLI37/UqzRUigSn1vLJ/DtOCZ3A0nxg2p4WKixRmORclyPCofNi/LRxRtE9SgQFnfk4r m0P8z+jF8bR5/TZEfJCkb7CnAAKIruclU4bgj7CADyAH+v6lWGWTfLV1ieho+cFBPFy/xWHDiqZdX mDICNDhT84Zv+si6uQgUacMFZgRyYo2SkPPp2e26myWQEBj+RJXWuXmeFl0GofqouXoWTWZiAtNbM 2IewnP87G8CqUpqSOqKDdlsjlH+OsKg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eucJx-0006JD-6V; Sat, 10 Mar 2018 11:05:49 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eucJs-0006H6-Ry for linux-arm-kernel@lists.infradead.org; Sat, 10 Mar 2018 11:05:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1520679930; bh=fYYSFDbUgUw1uHlBpoQwKef0R2ws7SYp9oH9EC9xIds=; h=From:To:Cc:Subject:Date:From; b=AEEqUrwczsAmReEpT9yzEfHRm+RULZUqY3iIQ+gopdblN0oR/dXDfoeZ8R771yNr5 N0eF4chPjmpAkRnTD927A8ty1ArGdsO47cX+XA56opeVb6s1Vj0RGxA01Wbhjl/5Iw oiSXrcHWsm6AqHnrliCqQPJ1bQTV4yKQqj7pmFvo= From: megous@megous.com To: dev@linux-sunxi.org Subject: [PATCH] drm/sun4i: Fix exclusivity of the TCON clocks Date: Sat, 10 Mar 2018 12:05:11 +0100 Message-Id: <20180310110511.14697-1-megous@megous.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180310_030545_229678_295F19CA X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , Jernej Skrabec , David Airlie , open list , "open list:DRM DRIVERS FOR ALLWINNER A10" , Chen-Yu Tsai , Maxime Ripard , "moderated list:ARM/Allwinner sunXi SoC support" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ondrej Jirman 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 Cc: Jernej Skrabec --- 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);