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 D9955CCD1A5 for ; Fri, 24 Oct 2025 08:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RH2NlzNlRH6Qm36O2iembVJRO/1z40r93HOB3pnGou4=; b=TT1joLi805KmsKsivel85MSsCG L4BXF+F7x949+2cVdqJHWacGn5Ul0TkqsmlZmjjSyn/ZGWLOgsq5c8k2UiwTn9kauFXSOVPSNilzI 6HqW/5UvGLyfr5t9IvGloZYDrKWb1kl4fiL6geWfthmkCGGSauuxu/P0pw+T2rJA1x2iE/sVhh2Iq T4EQt0bcKuTd5c9XiDvfrAa/3M3Mq1pfvDVeVkBtbglDfZn3R1oVKTHgbDxwIyl+mzTfyDs50FHQa 0BgmwVdPYc1Bd+20CFd4gTFUJtKXO1PjrDn/yGBPIRBuDehQSglNXSD2MqxG/QhX1JFNaX2oB7Puh KTETHL0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vCCjd-00000008bee-2g10; Fri, 24 Oct 2025 08:01:17 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vCCja-00000008bdA-3cm9; Fri, 24 Oct 2025 08:01:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761292874; x=1792828874; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CGY+HamhDTKURHEEexwE/uBroX7btVboVSsi2Zp/HY8=; b=MziDbpXC8d/1bFd8+3ki2LDh6nJtbyG7b0kDkxIinLRNZ3sliUt1BHx7 1nah+GLTNW2iAK/jtdBCzNRzfB9saQ3Prqxv8Ubqaedfg3MAmwhymuvNA E5ukrJ2HhnhwKBe5QxaRad9AYzxHdUrZdiSG62fgTXK7V9uQKWlLpo6Na fZETPvQlia61EpT2TamzWkhWzAqK+rbueZejr7lq+POzlhX2resJW1bvd O/Kg7hOFKZRSZTMcJeSN3HQIYwxWjT8HzQ5g3q3HLODDq1WJWFvHKOptx 3ZVFzvbQTIMUmr5DsE2aZHZM59W2lg2pA/fLAzQix2jzsu1fryeAguVRU A==; X-CSE-ConnectionGUID: 02DS9gdrSoqgk4eYYEn/2A== X-CSE-MsgGUID: pYZwfPY9SMSzXKdOgPSq4g== X-IronPort-AV: E=McAfee;i="6800,10657,11586"; a="74143758" X-IronPort-AV: E=Sophos;i="6.19,251,1754982000"; d="diff'?scan'208";a="74143758" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2025 01:01:12 -0700 X-CSE-ConnectionGUID: IeQ4sBMtS2S+NYvMhImcIQ== X-CSE-MsgGUID: bredYxHwRhWB5tb5izbjLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,251,1754982000"; d="diff'?scan'208";a="184292516" Received: from mjruhl-desk.amr.corp.intel.com (HELO kuha.fi.intel.com) ([10.124.221.255]) by fmviesa006.fm.intel.com with SMTP; 24 Oct 2025 01:01:02 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 24 Oct 2025 11:01:01 +0300 Date: Fri, 24 Oct 2025 11:01:01 +0300 From: Heikki Krogerus To: Chaoyi Chen Cc: Greg Kroah-Hartman , Dmitry Baryshkov , 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 , 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: Re: [PATCH v7 2/9] drm/bridge: Implement generic USB Type-C DP HPD bridge Message-ID: References: <20251023033009.90-1-kernel@airkyi.com> <20251023033009.90-3-kernel@airkyi.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="smIXmptATQs5fCq1" Content-Disposition: inline In-Reply-To: <20251023033009.90-3-kernel@airkyi.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251024_010114_952914_139641E0 X-CRM114-Status: GOOD ( 17.07 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org --smIXmptATQs5fCq1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 23, 2025 at 11:30:02AM +0800, Chaoyi Chen wrote: > +static int drm_typec_bus_event(struct notifier_block *nb, > + unsigned long action, void *data) > +{ > + struct typec_altmode *alt = (struct typec_altmode *)data; > + > + if (action != TYPEC_ALTMODE_REGISTERED) > + goto done; > + > + if (alt->svid != USB_TYPEC_DP_SID) > + goto done; > + > + /* > + * alt->dev.parent->parent : USB-C controller device > + * alt->dev.parent : USB-C connector device > + */ > + drm_dp_hpd_bridge_register(alt->dev.parent->parent, > + to_of_node(alt->dev.parent->fwnode)); Okay, this explains it. So you do need the port altmode. So you'll need to export the device types and check that the parent of the altmode is the port instead of partner. if (!is_typec_port(alt->dev.parent) || alt->svid != USB_TYPEC_DP_SID) return NOTIFY_DONE; I think we might as well export all the types while at it. Check the attachment. thanks, -- heikki --smIXmptATQs5fCq1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=export_typec_dev_types.diff diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 9b2647cb199b..f0704d605595 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -790,6 +790,7 @@ const struct device_type typec_partner_dev_type = { .groups = typec_partner_groups, .release = typec_partner_release, }; +EXPORT_SYMBOL_GPL(typec_partner_dev_type); static void typec_partner_link_device(struct typec_partner *partner, struct device *dev) { @@ -1144,6 +1145,7 @@ const struct device_type typec_plug_dev_type = { .groups = typec_plug_groups, .release = typec_plug_release, }; +EXPORT_SYMBOL_GPL(typec_plug_dev_type); /** * typec_plug_set_num_altmodes - Set the number of available plug altmodes @@ -1292,6 +1294,7 @@ const struct device_type typec_cable_dev_type = { .groups = typec_cable_groups, .release = typec_cable_release, }; +EXPORT_SYMBOL_GPL(typec_cable_dev_type); /** * typec_cable_get - Get a reference to the USB Type-C cable @@ -2031,6 +2034,7 @@ const struct device_type typec_port_dev_type = { .uevent = typec_uevent, .release = typec_release, }; +EXPORT_SYMBOL_GPL(typec_port_dev_type); /* --------------------------------------- */ /* Driver callbacks to report role updates */ diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h index db2fe96c48ff..f04f6987bed8 100644 --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h @@ -87,16 +87,6 @@ struct typec_port { #define to_typec_cable(_dev_) container_of(_dev_, struct typec_cable, dev) #define to_typec_partner(_dev_) container_of(_dev_, struct typec_partner, dev) -extern const struct device_type typec_partner_dev_type; -extern const struct device_type typec_cable_dev_type; -extern const struct device_type typec_plug_dev_type; -extern const struct device_type typec_port_dev_type; - -#define is_typec_partner(dev) ((dev)->type == &typec_partner_dev_type) -#define is_typec_cable(dev) ((dev)->type == &typec_cable_dev_type) -#define is_typec_plug(dev) ((dev)->type == &typec_plug_dev_type) -#define is_typec_port(dev) ((dev)->type == &typec_port_dev_type) - extern const struct class typec_mux_class; extern const struct class retimer_class; extern const struct class typec_class; diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 309251572e2e..02fed8293415 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -56,6 +56,16 @@ enum typec_role { TYPEC_SOURCE, }; +extern const struct device_type typec_partner_dev_type; +extern const struct device_type typec_cable_dev_type; +extern const struct device_type typec_plug_dev_type; +extern const struct device_type typec_port_dev_type; + +#define is_typec_partner(dev) ((dev)->type == &typec_partner_dev_type) +#define is_typec_cable(dev) ((dev)->type == &typec_cable_dev_type) +#define is_typec_plug(dev) ((dev)->type == &typec_plug_dev_type) +#define is_typec_port(dev) ((dev)->type == &typec_port_dev_type) + static inline int is_sink(enum typec_role role) { return role == TYPEC_SINK; --smIXmptATQs5fCq1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy --smIXmptATQs5fCq1--