Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp454636lqp; Tue, 11 Jun 2024 09:08:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVTOFLCHyN/4izhFQ+d1A2+jVDDwYxhoknuB7UocoODbTXwLKdZ+AQqjAxprs+WkrweHPU9EUSodEiPgbqAZdZ/i8/MbqzPfJnqvgpAg== X-Google-Smtp-Source: AGHT+IHi9q1uTkswZTkE0cAhUswcvdblJ6A3XpqyDhdk/eYzo0rplhYr11r6c38Jsob5U7wquV6G X-Received: by 2002:a05:6a00:18a2:b0:704:32bb:1eb3 with SMTP id d2e1a72fcca58-70432bb21c3mr7208262b3a.1.1718122083829; Tue, 11 Jun 2024 09:08:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718122083; cv=pass; d=google.com; s=arc-20160816; b=IcUXeCpQKOAL+uz7bDEQJdAfHqbX9v02U4i+nr+9wrW1WMjR19VKU4wsUFXh1XTHpe GTq0SP5GiIjKH5JQjQgpCyLBJ4GfAF4dDfoLjPEkuswzmfNHcjVvAQi+EkcJ6QRhUIDT C+kLvchO7zLp/ZM37qAoufiGrGc7snLW74dr9HdIGhPG4+bamVbrZBBWsAYVOBh65Nlx luykSuOH1KUg1eIlp11nHws3LDS32wBTzHhJSaJCWGvVAI8nSm4cyIV2vvAWcMK4PKci heebyO2LYFAp+WkR6/r+WbRW23kMSUXcis9Hx02eC6fLnH+dk/iYlK0NeNiS6CDqyjRs UIFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LpvhwWAJQLNJrsCq2KZZwYoHxw+es+q1tbpvJoFJzrs=; fh=RlYB0Y2md8rdYnrKVoTlrEmdiF5i9yjfnLS+nw4nIUU=; b=RS2wNDe+0T16x2ebqGZjVyItrBpuYNZT6Ptl0A9h0+KEl9Ocf8OsHWkqpsUv32UniK /HUblaVRUp93WZvs0ZX6TXpf3b33xMaAjZ2I2ovmRfyMUYCtW9BVd1QA1f9/G/3vHKKp o0hnYWGu/O0bP8kfcJx82Jn3nUdiy3vlIh6kFAm/5yypYYmlPLJgKZdUoJ8edNKgKCXM wG1M+RS32iQvS4KhLUGgyA3bXxRyDLxh0sEPjnZ0sX6qhcilHr2Yx+newmFfkFvwowvC SzWixT/SN+xUWbgZUPR1y+CngOGteqUdpuAAx31hgETG22vv8grN29v1BUgwi++Q8dOo Rm5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=XFi45RR6; arc=pass (i=1 spf=pass spfdomain=fe-bounces.kwiboo.se dkim=pass dkdomain=kwiboo.se dmarc=pass fromdomain=kwiboo.se); spf=pass (google.com: domain of linux-kernel+bounces-210204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7042f39705esi5430111b3a.11.2024.06.11.09.08.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:08:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=XFi45RR6; arc=pass (i=1 spf=pass spfdomain=fe-bounces.kwiboo.se dkim=pass dkdomain=kwiboo.se dmarc=pass fromdomain=kwiboo.se); spf=pass (google.com: domain of linux-kernel+bounces-210204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 51BB5B2585E for ; Tue, 11 Jun 2024 16:04:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E190761FC4; Tue, 11 Jun 2024 16:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="XFi45RR6" Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C27B13B192 for ; Tue, 11 Jun 2024 16:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718121764; cv=none; b=XpEwvTTcG70BZdQfUebS2LjoFdUYtBlEA5jWjg13JPlmTOz/uQ4msN94ntpMjGDZBCTX8AkEdvovwPkidokaZEUutymog+KZ/whUgX6yxscx91EcnAu5Yq/Lto8M/e8KHJmIA1JREyv+rGQbV2i62kb9FqmIlJgGpWE5cOpAgkM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718121764; c=relaxed/simple; bh=Owz/NxfbT/z+E4gk38walpj5V8cX1E68vfjbKeWyo1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZLUlVQAk+5NOl+P2R9GF26zj5MhgIJsR0R9UO5svhYfYD0/xrrZESqB1eg3H+BI3AAnECUXN1GVkq+11FM/SXIlm3mGIHPD7+yj3I5iSHuCtcrT5uzYir072guDeMR398CN3feEHpbFG1ddPG1F84jVJVagV1zdscPqMLIBds2o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=XFi45RR6; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1718121749; bh=LpvhwWAJQLNJrsCq2KZZwYoHxw+es+q1tbpvJoFJzrs=; b=XFi45RR6MplbHfJZ29XlthdVri2CewLfjCRXXQTnZqF8Ox94CFe3vcbR17zw8LXUpOy6rwmzw 6+5iiNBd1iWHPbTyvvDl7JDxWm4T0+NlbzjidnHEvKQarWpxM5rarHJYaXWz7V3sOoNZrcB9BiX BdcKg/IzsIrS1MQII9VpeUNPrAOtB+cNUhbWPsx6ZAVdVPYDYq6a5tJrMGO/XqIkkzF7hzrryrp yykEqmcgaS3PqxNZemEi6cYaQq4Pe7a7s8N7n3SmRMf/hI5uNwn4QAY6ggC7Cmp6M5NhDAT42sn PATMdb//pLevqmeXTZC/eB3c4dl655Ejom0hHu09hVGg== From: Jonas Karlman To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] drm: bridge: dw_hdmi: Fold poweron and setup functions Date: Tue, 11 Jun 2024 15:50:55 +0000 Message-ID: <20240611155108.1436502-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240611155108.1436502-1-jonas@kwiboo.se> References: <20240611155108.1436502-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-ForwardEmail-ID: 66687281b913b04293b6dc54 Fold the poweron and setup functions into one function and use the adjusted_mode directly from the new crtc_state to remove the need of storing previous_mode. Signed-off-by: Jonas Karlman --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ce4d4d06f758..76048fc9fd14 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2237,9 +2237,9 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } -static int dw_hdmi_setup(struct dw_hdmi *hdmi, - const struct drm_connector *connector, - const struct drm_display_mode *mode) +static int dw_hdmi_poweron(struct dw_hdmi *hdmi, + const struct drm_connector *connector, + const struct drm_display_mode *mode) { const struct drm_display_info *display = &connector->display_info; int ret; @@ -2379,15 +2379,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); } -static void dw_hdmi_poweron(struct dw_hdmi *hdmi) -{ - /* - * The curr_conn field is guaranteed to be valid here, as this function - * is only be called when !hdmi->disabled. - */ - dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode); -} - static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) { if (hdmi->phy.enabled) { @@ -2937,15 +2928,19 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, { struct dw_hdmi *hdmi = bridge->driver_private; struct drm_atomic_state *state = old_state->base.state; + const struct drm_display_mode *mode; struct drm_connector *connector; + struct drm_crtc *crtc; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + crtc = drm_atomic_get_new_connector_state(state, connector)->crtc; + mode = &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; mutex_lock(&hdmi->mutex); hdmi->disabled = false; hdmi->curr_conn = connector; - dw_hdmi_poweron(hdmi); + dw_hdmi_poweron(hdmi, connector, mode); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); -- 2.45.2