Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp517583rdb; Thu, 22 Feb 2024 10:30:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWE/r+gRsrE/SgCmAwyoJc3OXxHp+rrYkCzfvzgqwTgjnSjoRQlDAdSmMaUlXh/IHPeoSD0tX7OSt99FPXPoeMm678yI7y9NoNeoyMadA== X-Google-Smtp-Source: AGHT+IG2yvDUZfvZDn4iAnZElSV+SnpN+6aeqLw6flN6pfOSlTszcNigd+XEteN9luuQhKNfKGkX X-Received: by 2002:a17:906:d043:b0:a3d:a63f:2db0 with SMTP id bo3-20020a170906d04300b00a3da63f2db0mr14559893ejb.28.1708626642614; Thu, 22 Feb 2024 10:30:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708626642; cv=pass; d=google.com; s=arc-20160816; b=nbVBrUH+GPolSWvVo1v8EoMIMCHEy1sKN/Qc6EIgo4tUvs/chkgIhVXwb8mZ1pIC2O NsDGk/EE7ETeH3mhAPzCIdT9fn/PRKn1l7tdB3m5UYgaq7odVEru0oTjQe/fzjhy+rFP lA22u7Vg5KLGTZCnPUDPkMhni7gRUU0bngsUEO7dfWnH4brJIAWEKoGw5LfQEuNDPJbG lCFP/JAcfxq4+kxLnUONnp+J8DOqPoUrOBu8CgL8vyBJKxJjWgobQacaglvaXNb3wuNt smfn5+7Wq1Re8/qgbGXuHDSx/I0y8Jsr9JnkXQRpTVR6GeU7JNISbx5ff1FA1VWqGCpU FIHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=nX6MiQJkkAEZl/HPfoeELHO6SyEOrvctmQOjhIz8+Rs=; fh=jHlABrYnApVt5KJlrthitgyo0hqpWWrdlN0oFT+yLLg=; b=jo1MxKV3/8gPmtZrww0u8JtmLZtfCiiWzYNuo26IHlyk6DDw9kpAXjUQ8NmJ6R0cfc NrahEks8+uY+ammQxEe5v5Na0OrI/uxTQqqIHMdKYH2QcOphS97Ss6E1fYS1bS+b91MU bIO+JG45RV8apxYK8j1gu2x9hPTJcZuRhC/mWG254knKrZaA3KX7etCTlDAtpAj6NNtC eGLUxmHmcdIJT0L/FjOE76bjPop3MfAw36YVU7ZFf2aeaZZLkmg6ePqp7BssRckXNFWB 04mOsYEODLc97Eqyi23Oct0OXKZFhZjLRZXpP//38XnvNkjTPapQBshjyY9knEuqTDN6 cXsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o/2jN3Oc"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id sd16-20020a170906ce3000b00a3e9fec0245si3966388ejb.431.2024.02.22.10.30.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:30:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o/2jN3Oc"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1BBD91F2340F for ; Thu, 22 Feb 2024 18:30:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E14314DFF5; Thu, 22 Feb 2024 18:16:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o/2jN3Oc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B9C514DFD0; Thu, 22 Feb 2024 18:16:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625761; cv=none; b=ELRTK8Qz6ra7ARlXK3JscKGmJvuvCxOpej5WJoUctVDeGfm3UxVUP//f8FJOrKj4smr+Enb7xN3b1Pws3V3HyJOXVzoElpDOj12jOIlolUK8cubrDd6R74soHFm7jzLJ8cseTe/d5CgYcmysaxPWICrFFT2LtZo/DP3KXvQhFvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625761; c=relaxed/simple; bh=06Y9bTrXk/Zk/AbVbMU7GmJ4QmvebUl1g2EB4tW+8+Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UwYC0LQx4HD5LSO+Q3iIQDRPHgOFCKOQzP2vVlLqGTBZjxxise3mD2VjD2KE1lclU6zrk8Z0H4qBHAecA6CqUh9DYH6TDiQfK49gxtP/ULIAwRX1cjXH2meZP/LiOVkDR1XQtmABX6XX4NBiKb6xmvcXmxdUcDe0BO+iBcGKZg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o/2jN3Oc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DAB7C433F1; Thu, 22 Feb 2024 18:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708625760; bh=06Y9bTrXk/Zk/AbVbMU7GmJ4QmvebUl1g2EB4tW+8+Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o/2jN3OcW2EHEuhgApfFwexvsxu24F6mDo3xTlm5P5n0dYYsGhwUtDPI8hrjXhRBQ v0X2n88pj2d7iB7OVwpYNybk546AvqFvCTIe6uvKxYSDSudW3MzkIH6giFRsqEtehe 9wJXC/RFsRwp2s1hHm4/vz5zakhx540MBvwpSdmWdHLL4YLqW0BPR7QufjJ04Ipeme SHV98ayR1euxJvpLnerk5O4wsbEgTXNSTgLfbxbR/kcL2RCkRkW8RtKqR8gbQmab2O 2euu17XWbEgn3L4iekLP6XfFkXUw9eA2S2wKA/dLBQoQRcZtsS6iQE9o2Ghwt31VpD m3LiNucktuV2Q== From: Maxime Ripard Date: Thu, 22 Feb 2024 19:14:19 +0100 Subject: [PATCH v7 33/36] drm/sun4i: hdmi: Move mode_set into enable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240222-kms-hdmi-connector-state-v7-33-8f4af575fce2@kernel.org> References: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> In-Reply-To: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , Sebastian Wick , =?utf-8?q?Ville_Syrj=C3=A4l=C3=A4?= , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard , Sui Jingfeng X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2857; i=mripard@kernel.org; h=from:subject:message-id; bh=06Y9bTrXk/Zk/AbVbMU7GmJ4QmvebUl1g2EB4tW+8+Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKnX+/4933Hnf92ptXcjNhkouzH3NuQwhs9/YmSuVxqwc PGjc+e7OkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRFE5GhmXXxGSSfV2OzZ4f 6nS4zjV8Tumb2Tfe97KGtl8977ewfBfDP4vVfHcfXU9XPBU088R+vs9XX1eu61p5KeN4pB3Tvs1 f9zADAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D We're not doing anything special in atomic_mode_set so we can simply merge it into atomic_enable. Acked-by: Sui Jingfeng Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 38 +++++++++++++--------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 799a26215cc2..bae69d696765 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -103,33 +103,11 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder); struct drm_display_info *display = &hdmi->connector.display_info; + unsigned int x, y; u32 val = 0; DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); - clk_prepare_enable(hdmi->tmds_clk); - - sun4i_hdmi_setup_avi_infoframes(hdmi, mode); - val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); - val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); - writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0)); - - val = SUN4I_HDMI_VID_CTRL_ENABLE; - if (display->is_hdmi) - val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE; - - writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); -} - -static void sun4i_hdmi_mode_set(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - const struct drm_display_mode *mode = &crtc_state->mode; - struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder); - unsigned int x, y; - u32 val; - clk_set_rate(hdmi->mod_clk, mode->crtc_clock * 1000); clk_set_rate(hdmi->tmds_clk, mode->crtc_clock * 1000); @@ -181,6 +159,19 @@ static void sun4i_hdmi_mode_set(struct drm_encoder *encoder, val |= SUN4I_HDMI_VID_TIMING_POL_VSYNC; writel(val, hdmi->base + SUN4I_HDMI_VID_TIMING_POL_REG); + + clk_prepare_enable(hdmi->tmds_clk); + + sun4i_hdmi_setup_avi_infoframes(hdmi, mode); + val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); + val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); + writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0)); + + val = SUN4I_HDMI_VID_CTRL_ENABLE; + if (display->is_hdmi) + val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE; + + writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); } static enum drm_mode_status sun4i_hdmi_mode_valid(struct drm_encoder *encoder, @@ -206,7 +197,6 @@ static const struct drm_encoder_helper_funcs sun4i_hdmi_helper_funcs = { .atomic_check = sun4i_hdmi_atomic_check, .atomic_disable = sun4i_hdmi_disable, .atomic_enable = sun4i_hdmi_enable, - .atomic_mode_set = sun4i_hdmi_mode_set, .mode_valid = sun4i_hdmi_mode_valid, }; -- 2.43.2