From: Maxime Ripard <maxime@cerno.tech>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Maxime Ripard <maxime@cerno.tech>,
Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>
Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
Mike Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Nicolas Saenz Julienne <nsaenz@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Michael Stapelberg <michael@stapelberg.ch>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3/5] drm/vc4: hdmi: Set a default HSM rate
Date: Wed, 22 Sep 2021 14:54:17 +0200 [thread overview]
Message-ID: <20210922125419.4125779-4-maxime@cerno.tech> (raw)
In-Reply-To: <20210922125419.4125779-1-maxime@cerno.tech>
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 <maxime@cerno.tech>
---
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 b4b4653fe301..74222b12f8c8 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)
@@ -2169,6 +2170,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.31.1
next prev parent reply other threads:[~2021-09-22 12:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 12:54 [PATCH 0/5] drm/vc4: hdmi: Remove CPU hangs, take 2 Maxime Ripard
2021-09-22 12:54 ` [PATCH 1/5] clk: bcm-2835: Pick the closest clock rate Maxime Ripard
2021-09-28 16:26 ` nicolas saenz julienne
2021-09-30 18:08 ` Stephen Boyd
2021-10-13 12:59 ` (subset) " Maxime Ripard
2021-09-22 12:54 ` [PATCH 2/5] clk: bcm-2835: Remove rounding up the dividers Maxime Ripard
2021-09-28 16:26 ` nicolas saenz julienne
2021-09-29 13:27 ` Maxime Ripard
2021-09-30 18:09 ` Stephen Boyd
2021-10-13 12:59 ` (subset) " Maxime Ripard
2021-09-22 12:54 ` Maxime Ripard [this message]
2021-09-30 15:51 ` [PATCH 3/5] drm/vc4: hdmi: Set a default HSM rate nicolas saenz julienne
2021-10-13 12:59 ` (subset) " Maxime Ripard
2021-09-22 12:54 ` [PATCH 4/5] drm/vc4: hdmi: Move the HSM clock enable to runtime_pm Maxime Ripard
2021-09-30 15:54 ` nicolas saenz julienne
2021-10-13 12:59 ` (subset) " Maxime Ripard
2021-09-22 12:54 ` [PATCH 5/5] drm/vc4: hdmi: Make sure the controller is powered in detect Maxime Ripard
2021-09-30 15:55 ` nicolas saenz julienne
2021-10-13 12:59 ` (subset) " Maxime Ripard
[not found] ` <CANnVG6kFC7q_dDDp4rRZsJz=paHKy2STn9127LE=JJOf2kW2TA@mail.gmail.com>
2021-09-23 7:05 ` [PATCH 0/5] drm/vc4: hdmi: Remove CPU hangs, take 2 Michael Stapelberg
2021-09-24 7:40 ` Maxime Ripard
2021-09-28 13:05 ` Maxime Ripard
2021-09-30 18:09 ` Stephen Boyd
2021-09-30 18:39 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210922125419.4125779-4-maxime@cerno.tech \
--to=maxime@cerno.tech \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michael@stapelberg.ch \
--cc=mturquette@baylibre.com \
--cc=nsaenz@kernel.org \
--cc=sboyd@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).