From nobody Tue Oct 7 16:53:45 2025 Received: from mail-m3281.qiye.163.com (mail-m3281.qiye.163.com [220.197.32.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6133C26E6E7; Wed, 9 Jul 2025 07:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.32.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752044874; cv=none; b=F2nh8xI9oq+8qy90etdhr/k+u4kpMGOG86aomaccx7sIlvE9oI1JHKtz977nukZdJ2KDb1ujvvOBDty5WBEKtwbQ+iFPlQXtdDebplMvJtaAUQVZts4XvyitcubgAfLQHcxaLiaEs0wWWIIqrHBtobAXJDxDlvVq1Keha9/tEDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752044874; c=relaxed/simple; bh=QaSxYc4IgfF7uBebiuJsU2S0CbdS8UPS719SJJXoUmc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=B7U/8yww7jwpsU1HV0aayN2GgmVnI7IF9Z7nfJhB2yYscjCazrjLbLkoTCwBNztFhQbqZ5v7Ak5qVROqZyor1pXweFyAqh25Ul+dIQUyDnfntQ/lgPlJeVBd/JdecLFmxjG5JRf4m4sSwFcNqKXbV0VOykCwt6K/A8WnBKpA9CM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=XdyGplKK; arc=none smtp.client-ip=220.197.32.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="XdyGplKK" Received: from zyb-HP-ProDesk-680-G2-MT.. (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 1b69b7a0f; Wed, 9 Jul 2025 15:02:33 +0800 (GMT+08:00) From: Damon Ding To: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org Cc: Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jingoohan1@gmail.com, inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, krzk@kernel.org, alim.akhtar@samsung.com, hjc@rock-chips.com, heiko@sntech.de, andy.yan@rock-chips.com, dmitry.baryshkov@oss.qualcomm.com, l.stach@pengutronix.de, dianders@chromium.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Damon Ding Subject: [PATCH v2 07/12] drm/bridge: analogix_dp: Add support to find panel or bridge Date: Wed, 9 Jul 2025 15:01:34 +0800 Message-Id: <20250709070139.3130635-8-damon.ding@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250709070139.3130635-1-damon.ding@rock-chips.com> References: <20250709070139.3130635-1-damon.ding@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGRgeHlYeSUkZSUoaTB5OTUpWFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSU9PT0 hVSktLVUpCS0tZBg++ X-HM-Tid: 0a97edfe43a803a3kunm3a7bcd50c83aac X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NQg6PAw4TDE6DS9WShYIIjgR ThAKCS1VSlVKTE5JS09PTk5OTkxMVTMWGhIXVR8aFhQVVR8SFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlOQ1VJSVVMVUpKT1lXWQgBWUFOS09INwY+ DKIM-Signature: a=rsa-sha256; b=XdyGplKK88WCMv25zUU03Vzz/3V8/WEsEZO2zJ5NvT76Dz4N8LnFf5bVb88GVrIJJFYlJDnaiOARlWZZcHSNsS7+U0mq9TxlrPtFEoti7k0JnNmnZVIx0gNVj9EINfD+BHwMW12BP6ZvFRe0iOWXg4gHBX605CRVZT3cNXACpLo=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=LW2h9nJKg9Aawmrb76/zi4Gng/uV3PfR7/nXS/EIWaw=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" Since the panel/bridge should logically be positioned behind the Analogix bridge in the display pipeline, it makes sense to handle the panel/bridge parsing on the Analogix side. Signed-off-by: Damon Ding --- .../drm/bridge/analogix/analogix_dp_core.c | 48 +++++++++++++++++++ include/drm/bridge/analogix_dp.h | 2 + 2 files changed, 50 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/g= pu/drm/bridge/analogix/analogix_dp_core.c index 78d68310e4f6..660f95e90490 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -19,12 +19,14 @@ #include =20 #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -1707,6 +1709,52 @@ struct drm_dp_aux *analogix_dp_get_aux(struct analog= ix_dp_device *dp) } EXPORT_SYMBOL_GPL(analogix_dp_get_aux); =20 +static int analogix_dp_aux_done_probing(struct drm_dp_aux *aux) +{ + struct analogix_dp_device *dp =3D to_dp(aux); + struct analogix_dp_plat_data *plat_data =3D dp->plat_data; + int port =3D plat_data->dev_type =3D=3D EXYNOS_DP ? 0 : 1; + int ret; + + /* + * If drm_of_find_panel_or_bridge() returns -ENODEV, there may be no vali= d panel + * or bridge nodes. The driver should go on for the driver-free bridge or= the DP + * mode applications. + */ + ret =3D drm_of_find_panel_or_bridge(dp->dev->of_node, port, 0, + &plat_data->panel, &plat_data->bridge); + if (ret && ret !=3D -ENODEV) + return ret; + + return component_add(dp->dev, plat_data->ops); +} + +int analogix_dp_find_panel_or_bridge(struct analogix_dp_device *dp) +{ + int ret; + + ret =3D devm_of_dp_aux_populate_bus(&dp->aux, analogix_dp_aux_done_probin= g); + if (ret) { + /* + * If devm_of_dp_aux_populate_bus() returns -ENODEV, the done_probing() = will + * not be called because there are no EP devices. Then the callback func= tion + * analogix_dp_aux_done_probing() will be called directly in order to su= pport + * the other valid DT configurations. + * + * NOTE: The devm_of_dp_aux_populate_bus() is allowed to return -EPROBE_= DEFER. + */ + if (ret !=3D -ENODEV) { + dev_err(dp->dev, "failed to populate aux bus\n"); + return ret; + } + + return analogix_dp_aux_done_probing(&dp->aux); + } + + return 0; +} +EXPORT_SYMBOL_GPL(analogix_dp_find_panel_or_bridge); + MODULE_AUTHOR("Jingoo Han "); MODULE_DESCRIPTION("Analogix DP Core Driver"); MODULE_LICENSE("GPL v2"); diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix= _dp.h index 202e5eafb2cc..0b6d85f1924e 100644 --- a/include/drm/bridge/analogix_dp.h +++ b/include/drm/bridge/analogix_dp.h @@ -30,6 +30,7 @@ struct analogix_dp_plat_data { struct drm_bridge *bridge; struct drm_encoder *encoder; struct drm_connector *connector; + const struct component_ops *ops; =20 int (*power_on)(struct analogix_dp_plat_data *); int (*power_off)(struct analogix_dp_plat_data *); @@ -52,5 +53,6 @@ int analogix_dp_stop_crc(struct drm_connector *connector); =20 struct analogix_dp_plat_data *analogix_dp_aux_to_plat_data(struct drm_dp_a= ux *aux); struct drm_dp_aux *analogix_dp_get_aux(struct analogix_dp_device *dp); +int analogix_dp_find_panel_or_bridge(struct analogix_dp_device *dp); =20 #endif /* _ANALOGIX_DP_H_ */ --=20 2.34.1