From patchwork Mon Oct 4 18:16:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1536319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ZJnC7JCK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNTT62pt4z9t1C for ; Tue, 5 Oct 2021 05:17:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mXSWK-0007Yc-Dt; Mon, 04 Oct 2021 18:17:00 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mXSWF-0007Xd-K0 for kernel-team@lists.ubuntu.com; Mon, 04 Oct 2021 18:16:55 +0000 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 79DBA3F32F for ; Mon, 4 Oct 2021 18:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1633371415; bh=JhpUguATONiY85PgrGjqbVRY5ZP1yMWT76G9Y5KBYf8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZJnC7JCKpH02olR0s962ymknGQRZQFZmv8hXaRuSn0bgl3QvXqVJgc3EmVHc3CBro c4iTgSwoTKdR9VxYiOGCpBvR70sWX+v8/PC1BmGEcgtVXpNo6S2N5FA2m/RQ81TwIN sZR6HgkHg4aZ1axEdttwxR1OSLqHMMa0vuvXYhRofayTUIQJKu5KCTNjoB3Q6p/1VC 7v0f+bhGWTjxT7LJCp5FLUmB97pyfBPSUnAMDDztiVZLLiAZgzJ/F/q0bxAUVmmDzI bOVM2vnSs2vw8pPyeCHpYUkjRoGYKQTFqGRE8nZ+73pcu1TLVyMhCeMSwF9gJaALQH DU7EJ0/jemtrA== Received: by mail-ed1-f71.google.com with SMTP id 1-20020a508741000000b003da559ba1eeso18125112edv.13 for ; Mon, 04 Oct 2021 11:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JhpUguATONiY85PgrGjqbVRY5ZP1yMWT76G9Y5KBYf8=; b=tmevQviDE0XgHBRvTI3z8XvFo2FKrwSu8vVOh03WGAhumpvLf1Nfy2/rBSkFHpKrW5 g/HVoT7Mf7B4zvgp0Hg3c32HeVcm8havYI7e5H0PwuR9R/1xP6hr6jCjUR9qZ1YInOR8 FjNfy+Lnnbo71MqSa7oYTPiJbizNnym0dCIf6+zw6yEV2gv03bpazkyU+DmekOWwnrOe G2vI/gL2ngWnKRD6rK7/MBwTug8tB5ZOFsuzCA7Lk+YZ4HHAVvR90N7GZpvanQZQN4rQ XkSxXjG6j4EanPRwbsEQf6+Cnptnhji3B22ZcvadYxHviRQ/f1DCa7AAWc2h7/em5s2J 80jA== X-Gm-Message-State: AOAM533BbP3u0Y89dUV50T5VY8Ln0O411KpT6/FakZpMbGD78z31+MtS MUeWlnGWqEfibsS5qxuZqCyBVYwjj9KNW41TC86I4AEebV5nOjfUqpwk4BsaxXBZmKoyuq1LrLH 83TECMLJ+9kKWxGWijpMxG1EM/OPegLwfNgktA4OKcw== X-Received: by 2002:a50:e18f:: with SMTP id k15mr20015114edl.48.1633371415232; Mon, 04 Oct 2021 11:16:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/08+YV5FVj1bIfl3D+0gy4SQBebNX1wlnJSKwzVKc0dakVFLMC9eyxkrCtgtKABZpFIjgaQ== X-Received: by 2002:a50:e18f:: with SMTP id k15mr20015095edl.48.1633371414993; Mon, 04 Oct 2021 11:16:54 -0700 (PDT) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id h9sm6862428ejx.78.2021.10.04.11.16.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 11:16:54 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][H/raspi][PATCH 1/7] drm/vc4: hdmi: Make sure the controller is powered up during bind Date: Mon, 4 Oct 2021 20:16:47 +0200 Message-Id: <20211004181653.8298-2-juergh@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211004181653.8298-1-juergh@canonical.com> References: <20211004181653.8298-1-juergh@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Maxime Ripard BugLink: https://bugs.launchpad.net/bugs/1944397 In the bind hook, we actually need the device to have the HSM clock running during the final part of the display initialisation where we reset the controller and initialise the CEC component. Failing to do so will result in a complete, silent, hang of the CPU. Fixes: 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm") Signed-off-by: Maxime Ripard (backported from commit 142a6a7f0e8223bd0f591ba67e33868f9ab6ed43 linux-rpi) [juergh: Adjusted context.] Signed-off-by: Juerg Haefliger --- drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 16a3b9696410..ccc1ef339e4c 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2337,6 +2337,18 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) if (ret) goto err_put_ddc; + /* + * We need to have the device powered up at this point to call + * our reset hook and for the CEC init. + */ + ret = vc4_hdmi_runtime_resume(dev); + if (ret) + goto err_put_ddc; + + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); @@ -2348,8 +2360,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); } - pm_runtime_enable(dev); - drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs); @@ -2373,6 +2383,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi_debugfs_regs, vc4_hdmi); + pm_runtime_put_sync(dev); + return 0; err_free_cec: @@ -2383,6 +2395,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi_connector_destroy(&vc4_hdmi->connector); err_destroy_encoder: drm_encoder_cleanup(encoder); + pm_runtime_put_sync(dev); pm_runtime_disable(dev); err_put_ddc: put_device(&vc4_hdmi->ddc->dev);