From patchwork Sun Dec 3 11:43:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13477268 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J4QyUmie" Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F382CC0 for ; Sun, 3 Dec 2023 03:43:35 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c09fcfa9fso2671605e9.2 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=H7Y8gLjCHGjyccZryXw+mp00Cqy0RDERnIulYC2PGYF3HFRsbpWoCu2lkmdwBxDzpd IUmQb9aVe3R5twG2QLZGdlgb5zAtKp1hhR9KbkDKJ3G0Bh5cLfG/J8KGHdscCX5f23rH 6CtBAg05pGRmMdE/sRB5KLIkHwa/KBa9mH2xtyqU5N9KUnx5oKsA8ivCufbyVkSxJfxl kmnknSCEy6KjpOYfeT+yXuVLEQEGR9L5wXvFc41nEEAL4QTPpBUsi5slBwzyemu2Lgbo euieB5bgXQtAsd1A5LglvYLq9Onk+9V+1do6AT0O+DWmhZFm1ZP348DvfVhl4O4wusMA njVw== X-Gm-Message-State: AOJu0Yx6AdgXT1D8tK5WSDrdMezFJ3iAvAVYUGY7NRNNAunMew0zN1+x Rt/mZc1MB03u9oNFbWZ8AD9HGQ== X-Google-Smtp-Source: AGHT+IFdlXbi66bdK9azUEA/kFeRtMy70HvUZr1Nq1VwrzdZy0ztuHZBa7GKWBHTMGCpnYETs9x7YA== 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 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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