From nobody Fri Dec 19 20:36:35 2025 Received: from smtpbgbr1.qq.com (smtpbgbr1.qq.com [54.207.19.206]) (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 2B74E309DD2; Thu, 4 Dec 2025 06:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.207.19.206 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764829915; cv=none; b=RZIo+PDdf97ACeiL665yZ7s1asBAmX836Qi1iu8/8kShtp5Fl+D3VGaI0zNHVeKtc9ADgPqrUJyOkDbMLMZdzhbETw8yHR43oEKp64/Xxx5PmAJ4FASjWkAh1W8iEzaVlJ2whWj2ysvzXjQZr+fuWaFz27FLcyg4lh5k4JgDmTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764829915; c=relaxed/simple; bh=PexoXmWg23hcyQh6xegMZaQldNlfZLe4vqudyTtbacw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=YgbBuGa8Pt30PRTefya37z3ahxnSxm3GDkc+k9hDt5UvoIFWBO6B8w86uwE+K+u9p9t13kgrbUjkxKSjlXRdqU1si82zJ4hscE6foEqq2CvgYaaxfnHkJg2z9BHoWpBucXDAG6zcWnT5BeSqTdlT5m5A3ARWVvkg/KOd23GIYbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=airkyi.com; spf=pass smtp.mailfrom=airkyi.com; dkim=pass (1024-bit key) header.d=airkyi.com header.i=@airkyi.com header.b=eeMnGU3j; arc=none smtp.client-ip=54.207.19.206 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=airkyi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=airkyi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=airkyi.com header.i=@airkyi.com header.b="eeMnGU3j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1764829891; bh=9oGlaHNtIhbTx7QkJKVpo4Ol7UjzU3rpuzSq9kjRP4w=; h=From:To:Subject:Date:Message-Id; b=eeMnGU3jK8jtn9w8UQOkBCGqSy2kaUb2KZDynNxn5Gk9u87Zuu0fRZWtHflPr2pXa eGdJMVVrlyDoeCdqG9FxKIgYYzsb4vIl/eQ3KMmOl1FiPDDtiYnwVSACWiYIf+lsIX tF8coF75Py/S/8Xp2QOH6qLFaqXrj8PcpA9kf7IM= X-QQ-mid: esmtpsz21t1764829888t35ff679a X-QQ-Originating-IP: kpCg3rmbDMu7YW/T8tSReERndLggkBplSug+8Go0WqA= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 04 Dec 2025 14:31:25 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17088035227337033504 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: [RESEND PATCH v11 02/11] usb: typec: Export typec bus and typec altmode device type Date: Thu, 4 Dec 2025 14:31:00 +0800 Message-Id: <20251204063109.104-3-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251204063109.104-1-kernel@airkyi.com> References: <20251204063109.104-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: N3p64rE3gZ/Y+/ygFEr+1anFuHJ70URX6h6yW3A6/nbJ+BMQbwte5ixW n1vLH++sFdbAYOHjAAONEsXoLAHyFhsO8CDSKXPTvOTokCo3UamM7iAwKTGLOCceQs7kb94 7fXROR9arDuIvQNUnIrnIs5MgJ5V1ibxWB0OI7mrYW0bIczAEvLLCfuerlM4xt+BCYm7Mst dcY293QgfCIUa1HdInE0MtT7bguc9Pm9irhqAU1m9gQlooiDP7kHnvyGUIsZoY5Cqluyvde 2cDPlsgEtF6AoWUxWqv4SWBsRHQ939LtIOhVPa3/33xGbl3eBug74Wy4wNHiSsoTPlHL1d7 Xq04PEn8FdVb4bFK2BlwJE1F9VrtuUHrt2+JLNdz9j4GjGK7RsVLPZZGiSMGw1YkWN9zV5O +oIKduaf3tMY58INjaF7Xz3HKHJIiRSJ0T3aYoQ9MHl2TAYS+wFdu+pa0FAL00W3hkltzuD 8vSFSEkd91oy6MGoEUm67UPocwBK5XsxrpHRVxAkWG90a6rO40mKROCRaL1igI0FsK/ydue hYA1++Q+pCw+ztOH4nqfvr9EdpjqZ5owF2P26IY95wwx1v6EKi7sqqrx/YDG2cI2fvfjobP ufJhLgHQyktDEKDV1zTnOqlsbxJNSHxoB7M3KRdt3uwZhn6mm5U3hqR5P8ZVhTBJ45ptW/v lWqIBzaD8ZQkv6Frc9Cahjzz6//RvH1VCYfzlTraleVuYRbkgoo+LLKuQyxTYHbc+a+F1jp WZra/QXztcTZAEMt68ErGS6DGm5IBZjaZ7E9pBslzpD0SNnJJ7Fq+PoTLhWMCXFlIeQqUUn Sw1PXlo+T4MGpoDXIyzcoJE5n7YWfmLzeFSQATMm4JZiPxbFBSwX57nzaR1LQg4uhbTq8zc 7WYibzDZZCD1mkS0oV0fqCeHorCD5+apeFMWRQrR3vxHJ8Tb0/Telef0miBgL2OE0MXWRpV LgdFMS4CTr8wKKlT1MAdpY26nMz+8D9x1GrO6UR0OOSnDCmTVDfmGGO0+V2n9jS9nl0o= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= X-QQ-RECHKSPAM: 0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Heikki Krogerus --- 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 =3D { .probe =3D typec_probe, .remove =3D 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 @@ =20 #include =20 -struct bus_type; struct typec_mux; struct typec_retimer; =20 @@ -28,13 +27,4 @@ struct altmode { =20 #define to_altmode(d) container_of(d, struct altmode, adev) =20 -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 =3D=3D &typec_port_altmode= _dev_type) -#define is_typec_plug_altmode(dev) ((dev)->type =3D=3D &typec_plug_altmode= _dev_type) -#define is_typec_partner_altmode(dev) ((dev)->type =3D=3D &typec_partner_a= ltmode_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 = =3D { .groups =3D typec_altmode_groups, .release =3D typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_port_altmode_dev_type); =20 const struct device_type typec_plug_altmode_dev_type =3D { .name =3D "typec_plug_alternate_mode", .groups =3D typec_altmode_groups, .release =3D typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_plug_altmode_dev_type); =20 const struct device_type typec_partner_altmode_dev_type =3D { .name =3D "typec_partner_alternate_mode", .groups =3D typec_altmode_groups, .release =3D typec_altmode_release, }; +EXPORT_SYMBOL_GPL(typec_partner_altmode_dev_type); =20 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; =20 +struct bus_type; struct fwnode_handle; struct device; =20 struct usb_power_delivery; struct usb_power_delivery_desc; =20 +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_al= tmode.h index f7db3bd4c90e..9197a4637a93 100644 --- a/include/linux/usb/typec_altmode.h +++ b/include/linux/usb/typec_altmode.h @@ -9,6 +9,14 @@ =20 #define MODE_DISCOVERY_MAX 6 =20 +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 =3D=3D &typec_port_altmode= _dev_type) +#define is_typec_plug_altmode(dev) ((dev)->type =3D=3D &typec_plug_altmode= _dev_type) +#define is_typec_partner_altmode(dev) ((dev)->type =3D=3D &typec_partner_a= ltmode_dev_type) + struct typec_altmode_ops; =20 /** --=20 2.51.1