Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp451934lqp; Tue, 11 Jun 2024 09:04:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX++U7qPIolfQ8hDgzw9WGhUqd9/+HNAJxjeqyLGzZE0TqOy0+q/otZWxW9iaP1wPtmxZNugm0R/vGwKEbCChpfDNqZ5TAw16NY+irxZQ== X-Google-Smtp-Source: AGHT+IHVC7X6NdOvoy/ZRRSfPR0yC1irzH2bMM4QMzdlMsEspAA3tmY7b/HTL9cKE6vCJPLz1EIv X-Received: by 2002:a05:6808:17a9:b0:3d2:15a3:8481 with SMTP id 5614622812f47-3d215a38747mr14920101b6e.20.1718121885298; Tue, 11 Jun 2024 09:04:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718121885; cv=pass; d=google.com; s=arc-20160816; b=tveHpfTP4Ara9oCFkCOGUvfRJYFI+HYf6jtGIrJ1CqXhHfIT24im7hkN+pH1XLYdzD u+5/yrBxZEL5PDffTvd/p0H2fDKeXOTEGRIVYmd2IOVULCT+FUKJaaKlT1Vqvfp5QKDy 8/XGd7P9Q+h9UuzPKzt3CvlHLhlPp31gHYaeTt7JvHANsHVl5alHfm4SOBEpj4+HE9D6 gIkC7N4StHNddtkd7tI5L3GwMfzJcJvY/RXbajxUhtlJD3MeWNUL/4xReru/esEQ2CdP u+oOJm0JCleWyo84jAODCAHEBEKZ8UpR+qGizKzC6I/OuCxUD2dpU1K6uhpNA3RpwdZv xrVg== 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=0XDwfJc/IwpzEz4wRvrO6aRIQFt9tGAc7Bg1rLoc9K0=; fh=RlYB0Y2md8rdYnrKVoTlrEmdiF5i9yjfnLS+nw4nIUU=; b=XCHXKeJW43MX7DpVdfxGXy53RYl1jrL+FQ74okxND3lFFnNKB9W6bWbVz//tHdz//H an70AARFdTjK4+t3VvFqXKeE9WnSDoXch1sUOh85XwdvFye+Zyf3NX5x2+OrCXGCYzNP YGvem3cTk/966j93BgoqiSBFeupq5KoVB7I88BGqpetYsWIOrW9cb/lIpKaSQOxdhlsH XEFJ1dVTeqC6+Ij7Xp28NZ4eBoWnIP/5oCQo9cNqJ32MDrbLlO10xEo/6u8PdHOKohgD khsNpmCnwRGJDfHbH9KKK5f/gSu8XF1tkTdi2Rj5qQ8Wr8tDaJFYrCyyFeFzrgwmyJPh 7TQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b="vMcuuFt/"; 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-210205-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210205-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 5614622812f47-3d22748b54bsi1942714b6e.316.2024.06.11.09.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210205-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b="vMcuuFt/"; 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-210205-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210205-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E997E285D6D for ; Tue, 11 Jun 2024 16:04:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F8AF6BB39; Tue, 11 Jun 2024 16:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="vMcuuFt/" 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 C27E23FBA4 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=hhk0BCHdTGeSzRgbgB6Vsxkl+KQd2eUOjr9ra8a5zKaMoJZyFxvDOM4ruGxw6Z2qI6UegZwziVzGQsTvp2ML1l2jAJpOm1NEo6yuyt06RGaEVIrxayNuv3E4fLY67d+HHG8VbtkTzQAPDP8rqVwH4PzuD5fDBxu07ZHCWlfwGhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718121764; c=relaxed/simple; bh=mLkItQy6ITMzYQXoDl1EQD0hawEd4UBN77gKWr1dYhM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tsAo71Z2bWIbpY/xfuvgaf13qcneIt5NdpGFJ42iwqqCBoHXnj49fgwYHedDxzdPcj71cwwW0srmfIIquBTExfkjs2+dwVk6EQ4hJe6dmPOT0Nq6pl+6KBlfbQTWs5luZ6iwiFVGeYfgmrKrxMbYszc6YyXFXNVnicDcDdxVDYI= 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=vMcuuFt/; 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=0XDwfJc/IwpzEz4wRvrO6aRIQFt9tGAc7Bg1rLoc9K0=; b=vMcuuFt/b/z+kEgfu2zmt1+8fpY0WtPIfOYAyRfr1ZQFS/XRP/313qGHt1+D5RuiEuC7cm095 HEr/kTQHVeRHhOJKE8xnaLWE/6w476BYT7CibECAJSRjIEVjRvTv4yY59LdZlpEbAfrr/y8lgbo K4uKFPpVySgBrqg6YCrPQZsfLtB8UddLQUHj1RIyXa6FWcLynsULJgqfd/TrNmUvkbtheCst98K JwvPvBTfnCa1YwsUxwDUgplaXueLumTbKo5rVwI6i9wLgHI21A4hpVEs3bHGIflmfySy0nDPOPG LMOq0qXPYf5tsRutdcSS7ohJZHQDib/zvrktMfs3BQBw== 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 1/8] drm: bridge: dw_hdmi: Call poweron/poweroff from atomic enable/disable Date: Tue, 11 Jun 2024 15:50:53 +0000 Message-ID: <20240611155108.1436502-2-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: 66687277b913b04293b6dc30 Change to only call poweron/poweroff from atomic_enable/atomic_disable ops instead of trying to keep a bridge_is_on state and poweron/off in the hotplug irq handler. A benefit of this is that drm mode_config mutex is always held at poweron/off, something that may reduce the need for our own mutex. Signed-off-by: Jonas Karlman --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 33 ++--------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 9f2bc932c371..34bc6f4754b8 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -172,7 +172,6 @@ struct dw_hdmi { enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !disabled) */ bool disabled; /* DRM has disabled our bridge */ - bool bridge_is_on; /* indicates the bridge is on */ bool rxsense; /* rxsense state */ u8 phy_mask; /* desired phy int mask settings */ u8 mc_clkdis; /* clock disable register */ @@ -2383,8 +2382,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) static void dw_hdmi_poweron(struct dw_hdmi *hdmi) { - hdmi->bridge_is_on = true; - /* * The curr_conn field is guaranteed to be valid here, as this function * is only be called when !hdmi->disabled. @@ -2398,30 +2395,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) hdmi->phy.ops->disable(hdmi, hdmi->phy.data); hdmi->phy.enabled = false; } - - hdmi->bridge_is_on = false; -} - -static void dw_hdmi_update_power(struct dw_hdmi *hdmi) -{ - int force = hdmi->force; - - if (hdmi->disabled) { - force = DRM_FORCE_OFF; - } else if (force == DRM_FORCE_UNSPECIFIED) { - if (hdmi->rxsense) - force = DRM_FORCE_ON; - else - force = DRM_FORCE_OFF; - } - - if (force == DRM_FORCE_OFF) { - if (hdmi->bridge_is_on) - dw_hdmi_poweroff(hdmi); - } else { - if (!hdmi->bridge_is_on) - dw_hdmi_poweron(hdmi); - } } /* @@ -2546,7 +2519,6 @@ static void dw_hdmi_connector_force(struct drm_connector *connector) mutex_lock(&hdmi->mutex); hdmi->force = connector->force; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); } @@ -2955,7 +2927,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled = true; hdmi->curr_conn = NULL; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweroff(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, false); mutex_unlock(&hdmi->mutex); @@ -2974,7 +2946,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled = false; hdmi->curr_conn = connector; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweron(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); @@ -3073,7 +3045,6 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) if (hpd) hdmi->rxsense = true; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); -- 2.45.2