From patchwork Wed Oct 25 22:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 737931 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B104C0032E for ; Wed, 25 Oct 2023 22:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbjJYWaf (ORCPT ); Wed, 25 Oct 2023 18:30:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjJYWae (ORCPT ); Wed, 25 Oct 2023 18:30:34 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B6990 for ; Wed, 25 Oct 2023 15:30:31 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c50906f941so3574221fa.2 for ; Wed, 25 Oct 2023 15:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698273030; x=1698877830; 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=mzM/s3QFeCJxxTk8M20oowbvJAmjAHB6oasYtF2H1f0=; b=ClcVbxOSEf4hZlWKdSWQ5rjfJ1g5Oee79jmy7r+jfTnBEyupyzW6xltKofbYhj4voA MbyTNGoyuTUFaN1bU2VU/0ZBzw1vMqoYYHyjz5IoB3Fkq6lj7xQmKY0jj9enBJqMvdyZ Cdi4q/Ard71oy9t9olkvAPynbsb6VcpJKl50O7h83TcLZoPTGhEECZe0cN2GZ4XFWorF kvz1jyBiicniLONoloL8KObpR5iknQS50eCHJN55ThbKNlWcdqvflvKwLWVZwNxUy0ob rFJPTyUwXTDcTIMfHHfZv04TWnygEeToo3NwZF8F0FaI8n1n9FZDTnbyEygbymXUxKGt 4+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698273030; x=1698877830; 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=mzM/s3QFeCJxxTk8M20oowbvJAmjAHB6oasYtF2H1f0=; b=NGkaTPHZaRF3yQ2zWq/WdVa/23yrrhrduM6DO6qCX4dtX1o0UEYyHgi3SV3QVJb11o 4fhc6G6+V7rH29EwD5c55TKBlByWOqwivk+t3lAP2pkAWpJgNBTFEvwIMP1dnP39fr7m mbqJbRgChKTi/bTiArKq9K5CyyrC4CKuBl1kNzHszWf0zBJk9qE0iTf80CNmOe+JmPXJ Sx8AwF4pYji58bQdNPsywe7qcH2NERqMt/RbNuAdlTKkNwwbwat4mJveczUfX2LXB/SG ChE9PHF3dkJk5vURNIKxTKaHwVMfhxa2SVusBVHNxIWIRgCWFo5Mtm/rCNlyIfgfV4vO oQxQ== X-Gm-Message-State: AOJu0YzntDUUYmRLs6WyCyGTDfRWSMjrYHfCVP3Qf/uWM0c7j7RIDYga RXikG7nzdnPHL/LF8JP5hDJvqQ== X-Google-Smtp-Source: AGHT+IE80qJBvoknc8MJoPYBc+MJgH2P0PJwGZo6QC/PZct9VXHGi7xuXRbkjbNG/YWYXz51jiD1cg== X-Received: by 2002:a05:651c:1695:b0:2c5:1a89:41c6 with SMTP id bd21-20020a05651c169500b002c51a8941c6mr11515534ljb.33.1698273029414; Wed, 25 Oct 2023 15:30:29 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a36-20020a05651c212400b002bcbae4c21fsm2612543ljq.50.2023.10.25.15.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 15:30:28 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Heikki Krogerus , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v5 0/6] drm: simplify support for transparent DRM bridges Date: Thu, 26 Oct 2023 01:28:01 +0300 Message-ID: <20231025223027.943563-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 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 Reviewed-by: Bjorn Andersson Acked-by: Bjorn Andersson