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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 02A1BD111A8 for ; Fri, 28 Nov 2025 02:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v6si0wgsJuDHB/2bCyrf1g+bSaTkKDJjp6hSuUhH0K8=; b=OFQxvwodUPKZ+N zhez4HJfuYwinwqS4vopwkJfveuOQF4KguLzQ9ZPubyEutWvHmwcOOSjwvxK7lLk93BnjUUdaMZaK bcol8jKxkK/LIfvUFJWMN7pQPo0/MMq65lS24ZMl0lTmcl0CG+JL758pwuDOd6BHhf167Mv8yx9Aj xo7MGB9fEfg9hYiP5HIU4t8bQcAmrhITEpBvtbA0HeSL8wPmizVIfKLKEJHxLGX1Hl3lXWytyI9rg HCrFbPSIgds+797L0BcLClBszbbi3XmMTjxS+JYMwNdIXx2TjXddrTfxdRSss7rG3McpxPI9G6XnA VWxiuk7Zp0mg7VX1fhAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vOnrq-0000000HQpv-2hnb; Fri, 28 Nov 2025 02:05:50 +0000 Received: from smtpbgbr1.qq.com ([54.207.19.206]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vOnrg-0000000HQIp-1p9T; Fri, 28 Nov 2025 02:05:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1764295468; bh=9oGlaHNtIhbTx7QkJKVpo4Ol7UjzU3rpuzSq9kjRP4w=; h=From:To:Subject:Date:Message-Id; b=hcEdCpsDILu9HZCXdZ1BvOEVGP3xl8o1IJ58I9pXBHPuJfuR4TbFk/Ndhdv7tJCAn 2bnS1339pVo4xZq0n9irEt4gnwaCWmDGYu4R34bo8SAbm0jNj7VXB7Vv1sggfYhyUG nyBiKdGLAuN6a0HIuwFsFFfdIcBnCLIzMR9ck/mc= X-QQ-mid: esmtpsz21t1764295465t7596bef1 X-QQ-Originating-IP: s57CgJLpnxFBXEh8PABts4Hm4Tdr1U3366rUMeJac1Y= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Nov 2025 10:04:22 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 4342192847076017711 From: Chaoyi Chen To: Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Peter Chen , Luca Ceresoli , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Chaoyi Chen , Dragan Simic , Johan Jonker , Diederik de Haas , 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 v11 02/11] usb: typec: Export typec bus and typec altmode device type Date: Fri, 28 Nov 2025 10:03:56 +0800 Message-Id: <20251128020405.90-3-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251128020405.90-1-kernel@airkyi.com> References: <20251128020405.90-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: OAowhIcaKHQtd6oVjnadb7aVeiNtImupbPApnxUpgxM14YWcgK00Wdkk yx7IsaBDZmOLPpHXd5b6sihzwJhEVCxLm+CvEeAsPM/P0ZJ41Uw2p8/oWXlK4e3UxkdBNHI QtDi9xifb7hUbMi4bEQ2EH7PTuqggwOwG23nvh1JR1H6w5c3fcj7KhWq514IegkCN2xncWe poQbMrd5Z/6ETN5a3EfZz/+JE0lHZRSPgaXGYtsoro/z7yUDirLjvyAryURuhK+jTJltvq6 Pi11/8yf+Uy1RQwajuFjXQvsagkdya3nI/6Zz8Ejz24d4oRjt/nWeGyaeuBvFVXHtRn8WmL yWpsR01Nvx9XknRrLX3Jhu2x8/brMA/R7zqbWnPTCOPb9Q1q4Zq2Tcn2geFOX+fort595Gh SG3UOnj6ZrPMMw1E3Bviye+GL8BpSz0uOdyMVzX50SMHPb9X6dNkr1X4sFaDZ0xfAOMe5VK 0FBo+vqZGDwVTtLKcpQ3An1ZEMZ01Jv/xE8Zao/xbcF0+OTheAChGaLf673SE/KZRmz/jym oWMhlOA50uieAIgmzCM9QtGdwkVTIcBT5VHRQiML+Rm12wJRRViEZSGFHIF10Huz2zXhmGD xo/Yxu2XnIlRL6/GYg3GOKO6l2CRAtys87sS/GGTW5L8PgR7cH2EZy9ve/oGiA9iNWFPfnS mp2/Qfbx8B6QZJ2EiNuNnXNSbGVBZMKdp2T3ShFfHaYYq5GOiZU9k/8zDoMVwFed0unqQFf X7vgWKAm+wwEIiuAkLOwPC+IIIyZPopRx8BOYvZaXfq/a1QguTbIwNAM3+HLTUXHfmROu8Q 4N5LQMMIM6b07cSag+1/qvRKQulqV5orqWV5+Vrdo30Zpc+806JTDzNZ3S5+CcOzXBMHSro KTy9zOjNNAklmENPCcZlI3vxwKc7rPyDo8a1xb5AAwjssN/7z3VsTpPXhQMFnsnkfh0lHL2 n1v3Fm420/3dWgVekZl/u5moOtaWCIrvb45t5NDY994BVxQIwvEVh0Kq6nlybFNJfYLBjOi xHPkbikw== X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= X-QQ-RECHKSPAM: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251127_180541_691609_DAC03F6A X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Chaoyi Chen The DRM may want to register a notifier on the typec bus to know when a typec altmode device is added, and distinguish between different types of typec altmode device. Export these things. Signed-off-by: Chaoyi Chen --- Changes in v11: - Also export typec bus. - Add more detailed comments. (no changes since v9) drivers/usb/typec/bus.c | 1 + drivers/usb/typec/bus.h | 10 ---------- drivers/usb/typec/class.c | 3 +++ include/linux/usb/typec.h | 3 +++ include/linux/usb/typec_altmode.h | 8 ++++++++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index a33da7f458a5..e84b134a3381 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c @@ -569,3 +569,4 @@ const struct bus_type typec_bus = { .probe = typec_probe, .remove = typec_remove, }; +EXPORT_SYMBOL_GPL(typec_bus); diff --git a/drivers/usb/typec/bus.h b/drivers/usb/typec/bus.h index b58e131450d1..7df5deb1dd3a 100644 --- a/drivers/usb/typec/bus.h +++ b/drivers/usb/typec/bus.h @@ -5,7 +5,6 @@ #include -struct bus_type; struct typec_mux; struct typec_retimer; @@ -28,13 +27,4 @@ struct altmode { #define to_altmode(d) container_of(d, struct altmode, adev) -extern const struct bus_type typec_bus; -extern const struct device_type typec_port_altmode_dev_type; -extern const struct device_type typec_plug_altmode_dev_type; -extern const struct device_type typec_partner_altmode_dev_type; - -#define is_typec_port_altmode(dev) ((dev)->type == &typec_port_altmode_dev_type) -#define is_typec_plug_altmode(dev) ((dev)->type == &typec_plug_altmode_dev_type) -#define is_typec_partner_altmode(dev) ((dev)->type == &typec_partner_altmode_dev_type) - #endif /* __USB_TYPEC_ALTMODE_H__ */ diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index d6b88317f8a4..c4ff4310ff58 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -537,18 +537,21 @@ const struct device_type typec_port_altmode_dev_type = { .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_port_altmode_dev_type); const struct device_type typec_plug_altmode_dev_type = { .name = "typec_plug_alternate_mode", .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_plug_altmode_dev_type); const struct device_type typec_partner_altmode_dev_type = { .name = "typec_partner_alternate_mode", .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_partner_altmode_dev_type); static struct typec_altmode * typec_register_altmode(struct device *parent, diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 309251572e2e..c6fd46902fce 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -20,12 +20,15 @@ struct typec_port; struct typec_altmode_ops; struct typec_cable_ops; +struct bus_type; struct fwnode_handle; struct device; struct usb_power_delivery; struct usb_power_delivery_desc; +extern const struct bus_type typec_bus; + enum typec_port_type { TYPEC_PORT_SRC, TYPEC_PORT_SNK, diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h index f7db3bd4c90e..9197a4637a93 100644 --- a/include/linux/usb/typec_altmode.h +++ b/include/linux/usb/typec_altmode.h @@ -9,6 +9,14 @@ #define MODE_DISCOVERY_MAX 6 +extern const struct device_type typec_port_altmode_dev_type; +extern const struct device_type typec_plug_altmode_dev_type; +extern const struct device_type typec_partner_altmode_dev_type; + +#define is_typec_port_altmode(dev) ((dev)->type == &typec_port_altmode_dev_type) +#define is_typec_plug_altmode(dev) ((dev)->type == &typec_plug_altmode_dev_type) +#define is_typec_partner_altmode(dev) ((dev)->type == &typec_partner_altmode_dev_type) + struct typec_altmode_ops; /** -- 2.51.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy