From patchwork Wed Nov 4 12:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 11883513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1347FC4741F for ; Thu, 5 Nov 2020 08:20:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CBD4206ED for ; Thu, 5 Nov 2020 08:20:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CBD4206ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB42F6E9AD; Thu, 5 Nov 2020 08:20:03 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 11ABE6E0E3 for ; Wed, 4 Nov 2020 12:52:15 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4CR64F6dy5z1rxXl; Wed, 4 Nov 2020 13:52:13 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4CR64F5JHDz1qwm0; Wed, 4 Nov 2020 13:52:13 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id yRjIT8PYsG6G; Wed, 4 Nov 2020 13:52:12 +0100 (CET) X-Auth-Info: 330ErkJ8ipbWk2iQgph/8v29aMRCJ8Rgq1daKFr7MdI= Received: from localhost.localdomain (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 4 Nov 2020 13:52:12 +0100 (CET) From: Marek Vasut To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] drm/stm: Enable RPM during fbdev registration Date: Wed, 4 Nov 2020 13:52:00 +0100 Message-Id: <20201104125200.259639-1-marex@denx.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 05 Nov 2020 08:20:02 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Alexandre Torgue , Philippe Cornu , dri-devel@lists.freedesktop.org, =?utf-8?q?Yannick_Fertr=C3=A9?= , linux-stm32@st-md-mailman.stormreply.com, Benjamin Gaignard Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Enable runtime PM before registering the fbdev emulation and disable it afterward, otherwise register access to the LTDC IP during the fbdev emulation registration might hang the system. The problem happens because RPM is activated at the end of ltdc_load(), but the fbdev emulation registration happens only after that, and ends up calling ltdc_crtc_mode_set_nofb(), which checks whether RPM is active and only if it is not active, calls pm_runtime_get_sync() to enable the clock and so on. If the clock are not enabled, any register access in ltdc_crtc_mode_set_nofb() could hang the platform completely. This patch makes sure that ltdc_crtc_mode_set_nofb() is called within pm_runtime_get_sync(), so with clock enabled. Signed-off-by: Marek Vasut Cc: Alexandre Torgue Cc: Benjamin Gaignard Cc: Philippe Cornu Cc: Yannick Fertré Cc: dri-devel@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com --- drivers/gpu/drm/stm/drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 411103f013e2..d8921edc83db 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -197,7 +197,9 @@ static int stm_drm_platform_probe(struct platform_device *pdev) if (ret) goto err_put; + pm_runtime_get_sync(ddev->dev); drm_fbdev_generic_setup(ddev, 16); + pm_runtime_put_sync(ddev->dev); return 0;