From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 D9B6CC49EB7 for ; Mon, 28 Jun 2021 12:43:21 +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 AAED361C75 for ; Mon, 28 Jun 2021 12:43:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAED361C75 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech 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 DC7066E452; Mon, 28 Jun 2021 12:43:20 +0000 (UTC) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBEE46E44D for ; Mon, 28 Jun 2021 12:43:17 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 67FA15803A8; Mon, 28 Jun 2021 08:43:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 28 Jun 2021 08:43:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=x2tlRFbGfDp+O 7Jr7iVRw/9te19SjRMwYbKakmaMmOo=; b=SpbCGh+YyFIrVk6hZbZdMcVZFH+Ma u98kq+nunT+PjhlV1jHzrx+3t9I2Y1H300r2nZYAEIWlwwOHSXo7K4iVNNe9+6rt auLqNy6qk5neJnl4QZ1CXz6+xjRV7ItQw0eMZrDK/WRtX2bNy0AZ0JMRl1W/9rIY 3zt1Leit0DSld7Wu75twXkVSNeQehqQME+09vc2tHrEtIgclo4cghFYNcU4x/k0J Aeh+12vhT37saCo+7aNiUQNZI24J6XRBp2r/WU1OiYiTj9tT5AF7Vw2ZpZ29hDY8 tUMHRL5RfwqCvIHvj9xw40il8r9L0dhTccMMOY8/erfKbsqGQp6YRzXHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=x2tlRFbGfDp+O7Jr7iVRw/9te19SjRMwYbKakmaMmOo=; b=MnTYlQhw 2arshvQ4lwD1fT93xFV5mQD/3c+tTU28omfcfxco7Cn0swztu3icBLx59ZNAbEFt oT0T8JZkEXAnn2ALeOB+VkJTV1LdMkwy55Tar84CSQDL3Suuapr/qunBf2dtIvp1 joCZ0QN9cjBk3RZQF10D6anlIWt3kkIUE6tH3iGRi/cYI1B02qk6ssaOi6peTYSi nsUzQuhp9oAPJr9gFJT0lGbIu29qv9c+f2Ww0zwKnYAq5xmpwDGFUm4Pj4LkCXkr /XzXyX+cLcw5XAebRPgtrbl3NKhhrgYtMTu3yj6Cy4uqqXPAjQdBxiW3D8fVptKf WN/rhhf/npL9Ew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeehgedgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Jun 2021 08:43:16 -0400 (EDT) From: Maxime Ripard To: Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Subject: [PATCH v5 09/10] drm/vc4: hdmi: Enable the scrambler on reconnection Date: Mon, 28 Jun 2021 14:42:56 +0200 Message-Id: <20210628124257.140453-10-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210628124257.140453-1-maxime@cerno.tech> References: <20210628124257.140453-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Nicolas Saenz Julienne , Dom Cobley , Tim Gover , Dave Stevenson , linux-kernel@vger.kernel.org, Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Emma Anholt , Phil Elwell Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If we have a state already and disconnect/reconnect the display, the SCDC messages won't be sent again since we didn't go through a disable / enable cycle. In order to fix this, let's call the vc4_hdmi_enable_scrambling function in the detect callback if there is a mode and it needs the scrambler to be enabled. Fixes: c85695a2016e ("drm/vc4: hdmi: Enable the scrambler") Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 46f656fd31b9..7efafc893920 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -161,6 +161,8 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {} #endif +static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder); + static enum drm_connector_status vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -185,6 +187,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) } } + vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base); + return connector_status_connected; } @@ -535,9 +539,13 @@ static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder, static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; + struct drm_display_mode *mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); + if (!encoder->crtc || !encoder->crtc->state) + return; + + mode = &encoder->crtc->state->adjusted_mode; if (!vc4_hdmi_supports_scrambling(encoder, mode)) return; -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 1CBBAC2B9F4 for ; Mon, 28 Jun 2021 12:43:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05E2D61C71 for ; Mon, 28 Jun 2021 12:43:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233143AbhF1MqQ (ORCPT ); Mon, 28 Jun 2021 08:46:16 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:57193 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbhF1Mpn (ORCPT ); Mon, 28 Jun 2021 08:45:43 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 67FA15803A8; Mon, 28 Jun 2021 08:43:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 28 Jun 2021 08:43:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=x2tlRFbGfDp+O 7Jr7iVRw/9te19SjRMwYbKakmaMmOo=; b=SpbCGh+YyFIrVk6hZbZdMcVZFH+Ma u98kq+nunT+PjhlV1jHzrx+3t9I2Y1H300r2nZYAEIWlwwOHSXo7K4iVNNe9+6rt auLqNy6qk5neJnl4QZ1CXz6+xjRV7ItQw0eMZrDK/WRtX2bNy0AZ0JMRl1W/9rIY 3zt1Leit0DSld7Wu75twXkVSNeQehqQME+09vc2tHrEtIgclo4cghFYNcU4x/k0J Aeh+12vhT37saCo+7aNiUQNZI24J6XRBp2r/WU1OiYiTj9tT5AF7Vw2ZpZ29hDY8 tUMHRL5RfwqCvIHvj9xw40il8r9L0dhTccMMOY8/erfKbsqGQp6YRzXHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=x2tlRFbGfDp+O7Jr7iVRw/9te19SjRMwYbKakmaMmOo=; b=MnTYlQhw 2arshvQ4lwD1fT93xFV5mQD/3c+tTU28omfcfxco7Cn0swztu3icBLx59ZNAbEFt oT0T8JZkEXAnn2ALeOB+VkJTV1LdMkwy55Tar84CSQDL3Suuapr/qunBf2dtIvp1 joCZ0QN9cjBk3RZQF10D6anlIWt3kkIUE6tH3iGRi/cYI1B02qk6ssaOi6peTYSi nsUzQuhp9oAPJr9gFJT0lGbIu29qv9c+f2Ww0zwKnYAq5xmpwDGFUm4Pj4LkCXkr /XzXyX+cLcw5XAebRPgtrbl3NKhhrgYtMTu3yj6Cy4uqqXPAjQdBxiW3D8fVptKf WN/rhhf/npL9Ew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeehgedgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Jun 2021 08:43:16 -0400 (EDT) From: Maxime Ripard To: Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , linux-rpi-kernel@lists.infradead.org, Maxime Ripard , Emma Anholt , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Eric Anholt , linux-kernel@vger.kernel.org Subject: [PATCH v5 09/10] drm/vc4: hdmi: Enable the scrambler on reconnection Date: Mon, 28 Jun 2021 14:42:56 +0200 Message-Id: <20210628124257.140453-10-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210628124257.140453-1-maxime@cerno.tech> References: <20210628124257.140453-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we have a state already and disconnect/reconnect the display, the SCDC messages won't be sent again since we didn't go through a disable / enable cycle. In order to fix this, let's call the vc4_hdmi_enable_scrambling function in the detect callback if there is a mode and it needs the scrambler to be enabled. Fixes: c85695a2016e ("drm/vc4: hdmi: Enable the scrambler") Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 46f656fd31b9..7efafc893920 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -161,6 +161,8 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {} #endif +static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder); + static enum drm_connector_status vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -185,6 +187,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) } } + vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base); + return connector_status_connected; } @@ -535,9 +539,13 @@ static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder, static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; + struct drm_display_mode *mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); + if (!encoder->crtc || !encoder->crtc->state) + return; + + mode = &encoder->crtc->state->adjusted_mode; if (!vc4_hdmi_supports_scrambling(encoder, mode)) return; -- 2.31.1