Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3599809pxb; Mon, 24 Jan 2022 13:12:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+4jdrF3KN2tUex+6uFU3cr4NZx6kBZN+PvOFeJw0VI/t4S9bgsjtAawfbOx1/2VkEj9oH X-Received: by 2002:a63:191a:: with SMTP id z26mr13071313pgl.593.1643058774005; Mon, 24 Jan 2022 13:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058774; cv=none; d=google.com; s=arc-20160816; b=DfvkbeDxfWxk1ta9YJeGkLj505dNHa4cIxGlV6InNoY72HZb/jljLmKqun4buqhipj cr8MG5ZA+62OB4a3tT1T1N8i6sXGIVMP9pLKDnZfoAt3Ufs+06++0gKg+d9bFHYFeQ2v VIW2SgLkGfhmo2lr/YDeOTB7f4sLmRgda1oR0bP1qfFEag+YFuMIgDeXbPR8WaLafhPA bFz8Ezj+MtS08caNcrIRFS/mFKNsg4rzfn3unycV8QIV8+WGR9q3kZFItsEHylJVAT9M ++GW2m1FU3szd9PWofcKUUX4dyBX5TvjnaSte1k9soMElvKdExpLCGd+Fy0Fg2AVL/3O /Axg== 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=FcHfG8OeUwkyxCNUjqvpxuCXWdrf/GaHJs7bCZn1tJo=; b=WrQKq9DeX/0E4PpUDJmMjZBHOJTmG/KEinETmCQNXTD+hdQ63P0e/i5rRxfZagzLJB +O4yB8hZv/mzr3jb8lHRmpNUJ89ZSpnzrIdUc0GBErWID/2GKYORfjBvjTPFCxqVGWU9 mE9GwSOyV6+3EpPvn7YU5yjFUjDtyXN37x5CbQ0tDHnCeSc0qd2PmkX43hmRvKl00QQK 3G/zLk6WXOyBt2KGe9BdOHBU/XQpSOTGKSLqOeM406tNP943cS8njVp/fO3s+kfx3nwn 4tCYPItPvcTpvsmXg3jbTM1kX0y+Le37GtCe422MdCyY3wTtsAP2Xro6Mg1z2ENd9W0d mdkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H3wI++9e; 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 j37si17308727pgl.665.2022.01.24.13.12.41; Mon, 24 Jan 2022 13:12:53 -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=H3wI++9e; 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 S1386862AbiAXUgD (ORCPT + 99 others); Mon, 24 Jan 2022 15:36:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41064 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348467AbiAXUOH (ORCPT ); Mon, 24 Jan 2022 15:14:07 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 07BE5611CD; Mon, 24 Jan 2022 20:14:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D757FC340E5; Mon, 24 Jan 2022 20:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055246; bh=7qanzDnN7eNEgxgtzBO5i6iPcUJCL9BcsN+rhJvQ00E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3wI++9eCl/abWo7CVH6jBRa7S5uMT09JAmRIEVbFr4+k0PcPi19iRx5SHDskcz4J GzjPs8avoQLUHTrdjwCbVxHmbJwCHqR4Bt8Dq5A3vg8JWAziltLtl+K66IKT55D4il ZZhlDavMz+4sv5y01ORLHqysGcmvkgi5zk+J1oYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.15 089/846] drm/vc4: hdmi: Set a default HSM rate Date: Mon, 24 Jan 2022 19:33:26 +0100 Message-Id: <20220124184104.060739850@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 3e85b81591609bb794bb00cd619b20965b5b38cd ] When the firmware doesn't setup the HSM rate (such as when booting without an HDMI cable plugged in), its rate is 0 and thus any register access results in a CPU stall, even though HSM is enabled. Let's enforce a minimum rate at boot to avoid this issue. Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver") Signed-off-by: Maxime Ripard Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-4-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_hdmi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ed8a4b7f8b6e2..623a4699bd212 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -94,6 +94,7 @@ # define VC4_HD_M_SW_RST BIT(2) # define VC4_HD_M_ENABLE BIT(0) +#define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 #define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) @@ -2161,6 +2162,19 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->disable_4kp60 = true; } + /* + * If we boot without any cable connected to the HDMI connector, + * the firmware will skip the HSM initialization and leave it + * with a rate of 0, resulting in a bus lockup when we're + * accessing the registers even if it's enabled. + * + * Let's put a sensible default at runtime_resume so that we + * don't end up in this situation. + */ + ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); + if (ret) + goto err_put_ddc; + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); -- 2.34.1