From patchwork Sun Sep 1 04:06:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13786257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BCC4DCD342A for ; Sun, 1 Sep 2024 04:07:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3832E10E179; Sun, 1 Sep 2024 04:07:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="GhFq1mw0"; dkim-atps=neutral Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1497E10E17C for ; Sun, 1 Sep 2024 04:07:20 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-6e7b121be30so1850895a12.1 for ; Sat, 31 Aug 2024 21:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1725163639; x=1725768439; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dihu8n2PjcWrFXOuwWbECc9MpTZcbkDtMAPCx56QCc0=; b=GhFq1mw0BgbTrZ9Od/vTxW58a6JqlKx9u+29ON6kvmXURLnbFgg/swEhMSUUBqP5+7 EiI6SGVADrXu07/sD1QTOsY+n+CzkWWMd0yNRYGfrJRfgEQcT6oUN517T0ZplIeyRFZ2 gdepHqxy85LeyKRcobeQloH074j6iERQ27AMs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725163639; x=1725768439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dihu8n2PjcWrFXOuwWbECc9MpTZcbkDtMAPCx56QCc0=; b=tdNr901Ektl1nvMqa1ceOK4X2FblRU5r7OGkkBGUqaMun6fXeiDinPjYM7qL8U9JNl BRx3d+q4Swc6GQhyLxwx9T85iMjEi4BYoWhRvp73NznxgHruIcPWlpOBOUl4V9kpaPtu DVED4JHkP7CtVlDWmr202zdaEVPMjtN/3WOuscDiJwCvSIA5v87E41lnHMY8hISW9itX EAzlOywpgrTptiy2Wv+Qo8Y+z96QG+XPAIPTGrwPl0SExPPkTGjWfHLDf0ZAUuZNEENY 2KBzhs7jqEZ5JQmhAUB9XkCxZdiMOJiWcgeTIvIza68Rgb1QwdPqy0vhCKLMocmzPWGi N+fQ== X-Forwarded-Encrypted: i=1; AJvYcCXmmJKc9WM8kd37zcxciefhabu/oDx8YZoijHCe7Sbho6zNg2Zsk0dO4sAm31qTd+v70av+0eGz0oA=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwcGVcNKhcjjO2k9lEvP22X5qpxGASC6rCt3fDpcItzhgMmH8bS ofo4MNk5dTzPDT695isMPhpmeGCEucapluVYaUJaU/OQXrbIntbbk1fegXVveA== X-Google-Smtp-Source: AGHT+IGUB6+86RHnw08wq757NS4DSJb/B5ixBOuB5HoLx7W2xOHzGQ0pL/7XrZLrWwYk0S+0GfQauw== X-Received: by 2002:a05:6a21:3213:b0:1c4:a8a6:a85f with SMTP id adf61e73a8af0-1ced62a2b24mr2056687637.30.1725163639331; Sat, 31 Aug 2024 21:07:19 -0700 (PDT) Received: from localhost (210.73.125.34.bc.googleusercontent.com. [34.125.73.210]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2d8aba505bfsm1381042a91.8.2024.08.31.21.07.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 31 Aug 2024 21:07:19 -0700 (PDT) From: Stephen Boyd To: chrome-platform@lists.linux.dev Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, devicetree@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Andrzej Hajda , Benson Leung , Conor Dooley , Daniel Vetter , David Airlie , Dmitry Baryshkov , dri-devel@lists.freedesktop.org, Guenter Roeck , Jernej Skrabec , Jonas Karlman , Krzysztof Kozlowski , Laurent Pinchart , Lee Jones , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Prashant Malani , Robert Foss , Rob Herring , Thomas Zimmermann , Tzung-Bi Shih , Alexandre Belloni , Andy Shevchenko , Daniel Scally , Greg Kroah-Hartman , Heikki Krogerus , Ivan Orlov , linux-acpi@vger.kernel.org, linux-usb@vger.kernel.org, Mika Westerberg , "Rafael J . Wysocki" , Sakari Ailus , Vinod Koul Subject: [PATCH v4 08/18] drm/bridge: dp_typec: Add "no-hpd" support Date: Sat, 31 Aug 2024 21:06:46 -0700 Message-ID: <20240901040658.157425-9-swboyd@chromium.org> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240901040658.157425-1-swboyd@chromium.org> References: <20240901040658.157425-1-swboyd@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add support for HPD coming from somewhere else in the drm_bridge chain. Skip signaling HPD sate when "no-hpd" is present in the DT node backing the dp_typec bridge. Add this support because some EC firmwares on Trogdor/Strongbad boards don't properly indicate the state of the DP HPD level on a type-c port. The EC only indicates that DP mode is entered or exited for a type-c port. The HPD level is expressed to the DP controller via a pin on the AP that the EC drives high or low when the type-c port partner (i.e. monitor) asserts or deasserts HPD. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Cc: Dmitry Baryshkov Signed-off-by: Stephen Boyd --- drivers/gpu/drm/bridge/aux-hpd-bridge.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c b/drivers/gpu/drm/bridge/aux-hpd-bridge.c index d2832e6481d7..52db36aa190b 100644 --- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c +++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c @@ -22,6 +22,7 @@ static DEFINE_IDA(drm_aux_hpd_bridge_ida); struct drm_aux_hpd_bridge_data { struct drm_bridge bridge; struct device *dev; + bool no_hpd; }; enum dp_lane { @@ -355,6 +356,8 @@ void drm_aux_hpd_bridge_notify(struct device *dev, enum drm_connector_status sta if (!data) return; + if (data->no_hpd) + return; drm_bridge_hpd_notify(&data->bridge, status); } @@ -672,6 +675,7 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device *auxdev, return -ENOMEM; bridge = &hpd_data->bridge; bridge->funcs = &drm_aux_hpd_bridge_funcs; + bridge->ops = DRM_BRIDGE_OP_HPD; } else if (id->driver_data == DRM_AUX_TYPEC_BRIDGE) { typec_data = devm_kzalloc(dev, sizeof(*typec_data), GFP_KERNEL); if (!typec_data) @@ -680,6 +684,9 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device *auxdev, bridge = &hpd_data->bridge; bridge->funcs = &drm_dp_typec_bridge_funcs; typec_bridge_dev = to_drm_dp_typec_bridge_dev(dev); + hpd_data->no_hpd = of_property_read_bool(np, "no-hpd"); + if (!hpd_data->no_hpd) + bridge->ops = DRM_BRIDGE_OP_HPD; memcpy(typec_data->dp_lanes, dp_lanes, sizeof(typec_data->dp_lanes)); ret = drm_dp_typec_bridge_probe_typec_ports(typec_data, typec_bridge_dev, np); if (ret) @@ -689,8 +696,7 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device *auxdev, } hpd_data->dev = dev; - bridge->of_node = dev_get_platdata(dev); - bridge->ops = DRM_BRIDGE_OP_HPD; + bridge->of_node = np; bridge->type = DRM_MODE_CONNECTOR_DisplayPort; auxiliary_set_drvdata(auxdev, hpd_data);