Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3690824pxb; Mon, 24 Jan 2022 15:28:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoQuROosxVbl6RpljozVUop2w4is50W6zXkAj+XUGKEboYfmtWb5txInRiecpDVJtFPn6r X-Received: by 2002:a17:902:6844:b0:14a:1da5:88dc with SMTP id f4-20020a170902684400b0014a1da588dcmr16678183pln.30.1643066935611; Mon, 24 Jan 2022 15:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066935; cv=none; d=google.com; s=arc-20160816; b=VRozftLEueQIGB+DqQ0f7LsxzeiFmyeS6MXqwPB7BfuIZl4hpwLBPDb309+JF1AIT3 sRY/d8Ppv64NvTherEBMuQU3FN6gRPBzacN5NSPm1PPEofOyCzbj4I7n8OIqJ7dvvoDQ FhHxSFVqpI1lJaqnDt5nv4dihlQxNuDFt2Pp5qpCE0ml8b++c/WkjFFbEgOWAZIunE1/ 4lWgKuFSzGkN3SksbH43lUlOPWS2PY2hf1lBW98UsC06EDOrPtP6c65PONvlzKEkV/QE 6Z4/MYezhlwpBxnIIa1q47xfYLsfkcYVV9n4Y6w9KtUfrljO5jhoyi7rIsSZYxmYnptJ pm2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ItAi3LQDn1HuIAguDqRzMTqIH66goiTGT5haCZfgXYM=; b=hqHjh4pIqQaerJtouL6JG30GO0UBp28hKvzMc3NfxWbY2dUOUCHi8C8bKJEwu4oUO2 9frIxyXP320TZbE16u+7XBCImxKuzSDPNpfcxsKs+3bAdl+TjRAy10SlJZYK20XDpwR+ wbjeVMl7yRvgbL48xNv0D5Mz9dxumtC3mNolLsOx8A2AzCFItrCfuxc0PDrP7BycCaZs EzuOpUp67jrmjkHC0La1qsbWFwvo1WmMZnErpix4JzfxqbBv9YGjFcH/aLM0nmXlIAxx 9mNTiYizgLRZaBBVWal1Ly3dyqwQ5A04bWWfUXoq4od/xRFUh8ah2wz8nuHRU7tD85lc iJFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LcCTIDah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si14248869pgm.407.2022.01.24.15.28.44; Mon, 24 Jan 2022 15:28:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LcCTIDah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848755AbiAXXXO (ORCPT + 99 others); Mon, 24 Jan 2022 18:23:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588608AbiAXWdl (ORCPT ); Mon, 24 Jan 2022 17:33:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C60C095436; Mon, 24 Jan 2022 12:57:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89AD9B812A4; Mon, 24 Jan 2022 20:57:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A931AC340E5; Mon, 24 Jan 2022 20:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057853; bh=6yOJ5HGX4s/hvqyokoZbRAiRTadbNajAI/pYKePkIRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcCTIDahSKjKEgmr9AqftfevBc+keTUyqM9wi3Gaey7KUwNev6MiKt6jIs3F/H++s Q0w1EU3BjQuRw5c4tEeOW8l2+CPu5RNQGNBiIt0C6FOlYjxB3qYqLH8feIxDRoLH04 HzMnNnQjNdryNVhZ6EflT+51v9JjtaidPLbdKJzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Nicolas Saenz Julienne , Sasha Levin Subject: [PATCH 5.16 0101/1039] drm/vc4: crtc: Make sure the HDMI controller is powered when disabling Date: Mon, 24 Jan 2022 19:31:30 +0100 Message-Id: <20220124184128.559489885@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard [ Upstream commit bca10db67bdaf15997a5a2a276e7aa9b6eea1393 ] Since commit 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time"), during the initial setup of the driver we call into the VC4 HDMI controller hooks to make sure the controller is properly disabled. However, we were never making sure that the device was properly powered while doing so. This never resulted in any (reported) issue in practice, but since the introduction of commit 4209f03fcb8e ("drm/vc4: hdmi: Warn if we access the controller while disabled") we get a loud complaint when we do that kind of access. Let's make sure we have the HDMI controller properly powered while disabling it. Fixes: 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time") Signed-off-by: Maxime Ripard Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Link: https://patchwork.freedesktop.org/patch/msgid/20210923185013.826679-1-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_crtc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 18f5009ce90e3..c0df11e5fcf2b 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include "vc4_drv.h" +#include "vc4_hdmi.h" #include "vc4_regs.h" #define HVS_FIFO_LATENCY_PIX 6 @@ -496,8 +498,10 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) enum vc4_encoder_type encoder_type; const struct vc4_pv_data *pv_data; struct drm_encoder *encoder; + struct vc4_hdmi *vc4_hdmi; unsigned encoder_sel; int channel; + int ret; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || @@ -525,7 +529,20 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (WARN_ON(!encoder)) return 0; - return vc4_crtc_disable(crtc, encoder, NULL, channel); + vc4_hdmi = encoder_to_vc4_hdmi(encoder); + ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + ret = vc4_crtc_disable(crtc, encoder, NULL, channel); + if (ret) + return ret; + + ret = pm_runtime_put(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + return 0; } static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, -- 2.34.1