From mboxrd@z Thu Jan 1 00:00:00 1970 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 A177CCCD185 for ; Thu, 16 Oct 2025 02:28:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 10A6410E916; Thu, 16 Oct 2025 02:28:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=airkyi.com header.i=@airkyi.com header.b="SNne4gc9"; dkim-atps=neutral Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.74.132]) by gabe.freedesktop.org (Postfix) with ESMTPS id C16E110E913 for ; Thu, 16 Oct 2025 02:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1760581699; bh=nQG0w7dhU7Aew5bKV30plkPn0nBnVdgTnfwSbxYLntU=; h=From:To:Subject:Date:Message-Id; b=SNne4gc91WMHhHaAMz5+5NArjkkA9rgz4oHbFGTmOuhEyAVgjQqDOWxF8EavmrFT4 YnKt/YqhmrgQkiETHxldz81QW2vt/kYR0AVK3fdR7ESZzEgSww3ZRJfJq/b4bPVxu/ n3AoE5MCxRvDPITq0aMwfCYQoyACSXLuzSNu800E= X-QQ-mid: zesmtpgz1t1760581697tf65e1f89 X-QQ-Originating-IP: 6NbQJeS/+dGFQkjM52rtrshJx1shko+6S27zLhjeTRw= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 16 Oct 2025 10:28:14 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6632506262232562505 From: Chaoyi Chen To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Heikki Krogerus , Greg Kroah-Hartman , Chaoyi Chen , Dragan Simic , Johan Jonker , Diederik de Haas , Dmitry Baryshkov , Peter Robinson Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 5/8] drm/rockchip: cdn-dp: Support handle lane info without extcon Date: Thu, 16 Oct 2025 10:27:38 +0800 Message-Id: <20251016022741.91-6-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251016022741.91-1-kernel@airkyi.com> References: <20251016022741.91-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpgz:airkyi.com:qybglogicsvrsz:qybglogicsvrsz4a-0 X-QQ-XMAILINFO: NgiXOM0lDIKdrUz8Xn2TAZUxzCFgerj1En3BR464Xu7KFGCGjAxlMA8m a2euzpTQjINOONAWPJmVoq8NPFh37MpvLpIsKzkpvBFbdr8+F8s/6cqoHzp8crw4nMa8e2Y IivVd8KT8TN2wj6Wj5eGG5A4+P+BVKjoFIB7KX4fthvS1xVeh9xsIn5qy6Rc5OpVqxPjVcT vQwMsRhlxXu3rS/FrlQap3AXFIIS0wQuvV3XbkM5DYo9jnJmh3NEPSLcZJ8b7GRzCa0c3AP nnPE7j5aZQTuKrvtoZeLEMKHxBAFEpo3L3jyyRJ0HKkzPo5XQH329uKmnz/ZzAoxSGS+OtT DTXQQrm0YHaqoAHdTsR2Kz33kOtubxRddJIqxhqjlksgoAfQkUvKZZ7wBTpZOFKELWpiJ/D KLu6+l/fXxL1ZMgqoCtj5PAn6eBEqv+QsRVXw4V9vf04rj0nBDFLbBBSdv0csBWjnQNAv32 tXAlsKl34t7dbLF82CcZGTc8H5fjssVzuKct2e4PHTtA/ym6EooTOMcuO1Fhw+ptLjS73so B1vBomw5T/zngFwlJOn4s4Ku86wVVt5KDrYe92yJwxQcrKFcuye6AzaEEILBqu/qKn0IC0I +fpKcBAfAcNNbUW4eyX9iEO3NtMWWIK7S+qpG3mALBXPMaah/9evMcVkW38H/m7ObUuP/Hv gN8eQSHTAuknyt+4Jc5AqGH7VkkNtHQ5v7Z64Q6fp/+gmEg4AWrZ6DJWrJabM67m6bLjh27 0Ct+ADwdp8xOKicp1vAsLYTZE4VGc9Uei3yBhtsuJ3VrfgQ5Txs/ypq4cBp4COiwolDdlv0 hq0dsVM/9laq+icmoBg9i+8oSpdfN031PeI8AAs91KKsOcASxKeWM45I+wrvWdDmFI3CYFm MVP/v8oAUIQ8biDcFM6hi/YL8zOHLFBoNHfWvnEtk/6TtnsmPSeJNTjCPc/v70fyHOm5Z4D N76qfvZez0t6vcMxw5PDdkJblZOASstV9bCZeQ01WzEO9/ASk5TJLts0IcpN9YE6rYkQ7Nz 1YWZWoGksC+GeZNa8v+RgUcY8PoN27AvMsjf6SPQ== X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= X-QQ-RECHKSPAM: 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" From: Chaoyi Chen This patch add support for get PHY lane info without help of extcon. There is no extcon needed if the Type-C controller is present. In this case, the lane info can be get from PHY instead of extcon. The extcon device should still be supported if Type-C controller is not present. Signed-off-by: Chaoyi Chen --- (no changes since v5) Changes in v4: - Remove cdn_dp_hpd_notify(). (no changes since v3) Changes in v2: - Ignore duplicate HPD events. drivers/gpu/drm/rockchip/cdn-dp-core.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index b7e3f5dcf8d5..1e27301584a4 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -156,6 +156,9 @@ static int cdn_dp_get_port_lanes(struct cdn_dp_port *port) int dptx; u8 lanes; + if (!edev) + return phy_get_bus_width(port->phy); + dptx = extcon_get_state(edev, EXTCON_DISP_DP); if (dptx > 0) { extcon_get_property(edev, EXTCON_DISP_DP, @@ -219,7 +222,7 @@ static bool cdn_dp_check_sink_connection(struct cdn_dp_device *dp) * some docks need more time to power up. */ while (time_before(jiffies, timeout)) { - if (!extcon_get_state(port->extcon, EXTCON_DISP_DP)) + if (port->extcon && !extcon_get_state(port->extcon, EXTCON_DISP_DP)) return false; if (!cdn_dp_get_sink_count(dp, &sink_count)) @@ -385,11 +388,14 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) goto err_power_on; } - ret = extcon_get_property(port->extcon, EXTCON_DISP_DP, - EXTCON_PROP_USB_TYPEC_POLARITY, &property); - if (ret) { - DRM_DEV_ERROR(dp->dev, "get property failed\n"); - goto err_power_on; + property.intval = 0; + if (port->extcon) { + ret = extcon_get_property(port->extcon, EXTCON_DISP_DP, + EXTCON_PROP_USB_TYPEC_POLARITY, &property); + if (ret) { + DRM_DEV_ERROR(dp->dev, "get property failed\n"); + goto err_power_on; + } } port->lanes = cdn_dp_get_port_lanes(port); @@ -1028,6 +1034,9 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data) for (i = 0; i < dp->ports; i++) { port = dp->port[i]; + if (!port->extcon) + continue; + port->event_nb.notifier_call = cdn_dp_pd_event; ret = devm_extcon_register_notifier(dp->dev, port->extcon, EXTCON_DISP_DP, @@ -1120,14 +1129,14 @@ static int cdn_dp_probe(struct platform_device *pdev) PTR_ERR(phy) == -EPROBE_DEFER) return -EPROBE_DEFER; - if (IS_ERR(extcon) || IS_ERR(phy)) + if (IS_ERR(phy) || PTR_ERR(extcon) != -ENODEV) continue; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); if (!port) return -ENOMEM; - port->extcon = extcon; + port->extcon = IS_ERR(extcon) ? NULL : extcon; port->phy = phy; port->dp = dp; port->id = i; -- 2.49.0