Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2122901rdb; Sun, 3 Dec 2023 03:43:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpMEv0lIYQzl1q3tPoDUv+xqxv2OxCZPZR3CU+FW/1Z5TOUw57cy5/gUtJ1U7EeWiG3Xm2 X-Received: by 2002:a92:d20d:0:b0:35d:59a2:2d3 with SMTP id y13-20020a92d20d000000b0035d59a202d3mr3572623ily.115.1701603823530; Sun, 03 Dec 2023 03:43:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701603823; cv=none; d=google.com; s=arc-20160816; b=rUX9ImaS3jxYkDXWGBr+OPy7xCPF3EGNxjgCqpAyp8j8Xo9ws0cVkYk4rERfQMIrmQ pF/XQTgetNKDP7jrL0IK2kSXp8HJ5aUwSUyaFxV2ceRzf3VHCAD/VzMbr1XbG7TjUsEU 8vgg7r0xMKnMslQ9DuGhA4va7JDtV9sbbHFfOhOTy1wOonnvUGygPcqF+PUYJyPcPt9d D94c4A9FgitM1OuK1/19E048nFs+iJMClND3V5qWeGDfnOM6WrGsv+0eoxNsFzpCBWQP 55OGDsCNcwDiSE9i2aGZ0UZNKrqtrVurGzLoYh3bwKhm2CrAiIIpoSgHIn7kGr521AY9 YuPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SxbKBXKaOzx3/nX++/IEYvlJe8A11NOZYUGsnN9FBBY=; fh=WDFPvueeU8NMCVIXdba5cD9ZhiaQah2KG+InBXx7Yw4=; b=nHRUlLkiFCE3VhKYEujKh8OTYFgvOtEXS5chHZYElbAsiZQq7223ST2lAa4yTg2uqw viG2E+zfjai4r/LznbGK/x0LjOaI6247tQ/wbB0rx4emRuGA6fXizCpfGdriK3Cytrk8 +4zwPSJgANj83rPFGNjecvOAYmObwq+B/77GJcdu4ECRtsrgxkfmBwBfriR3kOJLW6tB uBEvZRO5RPBkpaiM8CYpCf+boCdO15iN+pShSgWgkTXUVHqPUT3zTmH8udpkIlPR/o1h 24/Nr1UZJi2qoQh2d8/un7HtQw7KaQ8WyKz6I5h+jqASc+Tp9pni29RDIPeIUpgdy73y c7nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J4QyUmie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f27-20020a631f1b000000b005b9519d9e3esi687159pgf.242.2023.12.03.03.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J4QyUmie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 26783809788F; Sun, 3 Dec 2023 03:43:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbjLCLnb (ORCPT + 99 others); Sun, 3 Dec 2023 06:43:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCLna (ORCPT ); Sun, 3 Dec 2023 06:43:30 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3883CB for ; Sun, 3 Dec 2023 03:43:35 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40bda47b7c1so14844235e9.1 for ; Sun, 03 Dec 2023 03:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603814; x=1702208614; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SxbKBXKaOzx3/nX++/IEYvlJe8A11NOZYUGsnN9FBBY=; b=J4QyUmievc3DypbSeJhaPO6naFODZztsy6yYCn17mZ/k/AO7OVPok7s3rBfr3nPBnl P2Ke/mhkRG7lI7G1omKBUsocdoCPXYdYMWKlK61b9EDfIozm6N0m1PRmhxnwLsBiR3jy h8TpMcpHsh8yMJ65MCYc8bzi+DOUnQQ9e7aPFwiHNl1yUmfy5tEwvWayIVFfp62sQ19s HrPDwp4jN5zsKhA5NKuzbT5v3NjHas0Xub5mqGL2inX2BjNHb5BRRdyFO4+qIBi7Hfu0 6i94/7l0+x+OkJum+8n0rrqCHRNA97PKj9sV6LIV1QtgO577WokSYFcUnkypw5aGiQkC rj6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603814; x=1702208614; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SxbKBXKaOzx3/nX++/IEYvlJe8A11NOZYUGsnN9FBBY=; b=AU2dOj7Ye34s2Yr8jhb2IGTEl6GTVcDepY4Ha+jyWqiIge3ZECD0VfW+P2dNjQJezv 3Fv5mevH8gT4ce+wlFWfjzbcQHWhqSXWtmwvSaheo/TQM1Ox5+ZvsAS2m8YVFIgwD0Ph KZqT4dCcJet5xdCUukSLqddQsy6Mz6Ak/GikjsfYqy4lrSHJGOqiEEeS3c+odp/0FFhA dXSJVmru153Q2MfDMNRomLwN7joM8kXcpzP3U0Ep41AGzE6l3Mar0IHXG3D7i3omO7jM t6+soCPA3Kjsu02nVB9AJG3OEJojmr7jDzKRrxqR3KBiTGD4aEoJJ5d/EJEZtYnExYLw MSKw== X-Gm-Message-State: AOJu0Yw2jMsX40Pv2dUKk8SOQ1y6/ThJKfZy9kM5+OGeGtiEU+9DnMm0 D5MkqW65WA+2hsG7zpiTCrdWBw== X-Received: by 2002:a05:600c:2d4c:b0:40b:5f03:b428 with SMTP id a12-20020a05600c2d4c00b0040b5f03b428mr914549wmg.330.1701603814301; Sun, 03 Dec 2023 03:43:34 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o17-20020a2e90d1000000b002c993c5d4c6sm894666ljg.105.2023.12.03.03.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:33 -0800 (PST) From: Dmitry Baryshkov To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH RESEND 0/6] drm: simplify support for transparent DRM bridges Date: Sun, 3 Dec 2023 14:43:27 +0300 Message-Id: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 03 Dec 2023 03:43:42 -0800 (PST) Greg, could you please ack the last patch to be merged through the drm-misc tree? You have acked patch 3, but since that time I've added patches 4-6. Supporting DP/USB-C can result in a chain of several transparent bridges (PHY, redrivers, mux, etc). All attempts to implement DP support in a different way resulted either in series of hacks or in device tree not reflecting the actual hardware design. This results in drivers having similar boilerplate code for such bridges. Next, these drivers are susceptible to -EPROBE_DEFER loops: the next bridge can either be probed from the bridge->attach callback, when it is too late to return -EPROBE_DEFER, or from the probe() callback, when the next bridge might not yet be available, because it depends on the resources provided by the probing device. Device links can not fully solve this problem since there are mutual dependencies between adjancent devices. Last, but not least, this results in the the internal knowledge of DRM subsystem slowly diffusing into other subsystems, like PHY or USB/TYPEC. To solve all these issues, define a separate DRM helper, which creates separate aux device just for the bridge. During probe such aux device doesn't result in the EPROBE_DEFER loops. Instead it allows the device drivers to probe properly, according to the actual resource dependencies. The bridge auxdevs are then probed when the next bridge becomes available, sparing drivers from drm_bridge_attach() returning -EPROBE_DEFER. Changes since v5: - Removed extra semicolon in !DRM_AUX_HPD_BRIDGE stubs definition. Changes since v4: - Added documentation for new API (Sima) - Added generic code to handle "last mile" DP bridges implementing just the HPD functionality. - Rebased on top of linux-next to be able to drop #ifdef's around drm_bridge->of_node Changes since v3: - Moved bridge driver to gpu/drm/bridge (Neil Armstrong) - Renamed it to aux-bridge (since there is already a simple_bridge driver) - Made CONFIG_OF mandatory for this driver (Neil Armstrong) - Added missing kfree and ida_free (Dan Carpenter) Changes since v2: - ifdef'ed bridge->of_node access (LKP) Changes since v1: - Added EXPORT_SYMBOL_GPL / MODULE_LICENSE / etc. to drm_simple_bridge Dmitry Baryshkov (6): drm/bridge: add transparent bridge helper phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE usb: typec: nb7vpq904m: switch to DRM_AUX_BRIDGE drm/bridge: implement generic DP HPD bridge soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE drivers/gpu/drm/bridge/Kconfig | 17 ++ drivers/gpu/drm/bridge/Makefile | 2 + drivers/gpu/drm/bridge/aux-bridge.c | 140 +++++++++++++++ drivers/gpu/drm/bridge/aux-hpd-bridge.c | 164 ++++++++++++++++++ drivers/phy/qualcomm/Kconfig | 2 +- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 +---- drivers/soc/qcom/Kconfig | 1 + drivers/soc/qcom/pmic_glink_altmode.c | 33 +--- drivers/usb/typec/mux/Kconfig | 2 +- drivers/usb/typec/mux/nb7vpq904m.c | 44 +---- drivers/usb/typec/tcpm/Kconfig | 1 + drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 41 +---- include/drm/bridge/aux-bridge.h | 37 ++++ 13 files changed, 383 insertions(+), 145 deletions(-) create mode 100644 drivers/gpu/drm/bridge/aux-bridge.c create mode 100644 drivers/gpu/drm/bridge/aux-hpd-bridge.c create mode 100644 include/drm/bridge/aux-bridge.h -- 2.39.2