From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 483CB359A8F; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=NyVkT0gY0Mfw/hUOliolS4kuwpatdDd7sqA1GvUa4D8WvyfsJtAlHvb8PVp5MQM6Tbo7vOdaFv/eIaiZ9rfY9WtnauVoASIj/TS/cXbJEJQ0ez4IvLppyE8NfNTP1gQWtF03exOUGiVuVgv5fXxOlGzG5e8vUEJka3KitoarJSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=ul9pqll2OSaIKRropAAhp3YOqELMgU3KZnuLR8PCb0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F6Nq5ghWoeGmJniju/Y5VDEhmzVj32dlRWpP4o2zJMhRNRyhJcgUkenhzTv81XN3AvtH3ev2dnfLvuSFzcIquJIMFRuEjuKsf6nYZOfeEUxY42mMw1ZhbNgZI8pZb6VInAW3/f/+xhO28MLUqxHSJC7zDo0MWIRsdhsl2jpC4gE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iZRxnQq6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iZRxnQq6" Received: by smtp.kernel.org (Postfix) with ESMTPS id D3239C2BC86; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721802; bh=ul9pqll2OSaIKRropAAhp3YOqELMgU3KZnuLR8PCb0A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=iZRxnQq6kHPy8LH3qDYtqHCcdrxj1UFqbIJBW8LnWHRRRwmUUvgLynpEEFRKUHNiy 0Cil9aMpE0OnV3b6mENgiOB1u5UpGN5HBYEQQO0Kh4GSnR5bXUJCWcDhmHEDho9BF9 5J1ER163kbqxvkQfgiQrmdqV9pCytWOUkJ3Safl+Qd+SwmbR4vv/D8Hl0iHoaqURe7 niKbGnw4PT6PkpEZ3UZ3P3l9tOGtkEKbGARq8193GhAXZvWSoDRPgRkIEynkYjWFNt UUavuHmo5BXanIfhtQasEAlnkyJLS07GenBlhMdlCF2scMlhElSmCM+2Kzucx8/cqf FEez92BKF1zMw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9009FB5EB2; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:51 +0530 Subject: [PATCH v6 1/9] serdev: Convert to_serdev_*() helpers to macros and use container_of_const() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-1-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2281; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=jiQzAn5Z8SWByOSZJxw8qqvki+Y9WdMaik55wmM6Ke4=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHwuJFA1dPQTJH6LbPjiT5vRdRFNwUVP8Fe TSJXC2EPGiJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9XOWB/4mAGk+oVE4NGv7T0zySPzX/h//9aeuUfqfQP0GrKtcV3D51LxzRIdlx39eNkuB2JPDINk vTszFOoLbtTE6f++gfTA9FzIgv5vURENzPlhRotgxFyDtcdJAR3mIsFuX9Vgusz855SSEpajm7P 81WG8Bg/kk6GUdznjURFb+/Dzi9i4OSLWCdKgJoT/EvpTqAHI8/Y+gL9Q61NMgni26EkxTBERXk 4TIs/taMqGCW68Ef2D0Weueg3vhLb3yV0Ayv8xZf7VeYNQVwJ84EQ2QQ6Rgq3GuL9x1rmLT0LpJ eEasYWtHxyVBxyUZnNDKmZ2v9Blv30RgHZtdxK60csOQTaso X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam If these helpers receive the 'const struct device' pointer, then the const qualifier will get dropped, leading to below warning: warning: passing argument 1 of =E2=80=98to_serdev_device_driver=E2=80=99 di= scards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] This is not an issue as of now, but with the future commits adding serdev device based driver matching, this warning will get triggered. Hence, convert these helpers to macros so that the qualifier get preserved and also use container_of_const() as container_of() is deprecated. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- include/linux/serdev.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 5654c58eb73c..0c7d3c27d1f8 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -49,10 +49,7 @@ struct serdev_device { struct mutex write_lock; }; =20 -static inline struct serdev_device *to_serdev_device(struct device *d) -{ - return container_of(d, struct serdev_device, dev); -} +#define to_serdev_device(d) container_of_const(d, struct serdev_device, de= v) =20 /** * struct serdev_device_driver - serdev slave device driver @@ -68,10 +65,7 @@ struct serdev_device_driver { void (*shutdown)(struct serdev_device *); }; =20 -static inline struct serdev_device_driver *to_serdev_device_driver(struct = device_driver *d) -{ - return container_of(d, struct serdev_device_driver, driver); -} +#define to_serdev_device_driver(d) container_of_const(d, struct serdev_dev= ice_driver, driver) =20 enum serdev_parity { SERDEV_PARITY_NONE, @@ -112,10 +106,7 @@ struct serdev_controller { const struct serdev_controller_ops *ops; }; =20 -static inline struct serdev_controller *to_serdev_controller(struct device= *d) -{ - return container_of(d, struct serdev_controller, dev); -} +#define to_serdev_controller(d) container_of_const(d, struct serdev_contro= ller, dev) =20 static inline void *serdev_device_get_drvdata(const struct serdev_device *= serdev) { --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4850736D4FC; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=R7B1W5yeUZVRHM1ShHYeB4z3QLFRuYAp3Vh+nENYwFz1qz3PuAIu30JdvmIZB8FqocOcywU9IapYbQ4mw9l10AUVJaHQvzBAPf7QS/obuQ6nFoz0mnAqV69Ar4JMHX7o4IeZwez5Fvkrl3xGR4VR7pD5RSyFX3y0fN/D0jUwj9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=90rMoHNtpikEEOX4hxu7KxohYPZTjuhD8cCrdkwCho4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PhtqGCkrn9LI9Y+kYef3a8bDUuR1OmygU2krd4BZCxgapE9FOa3InxJodchcr+9FfSWph+JPexhhW6QkpPMk0NZuqKogFr4i1KmJFEebowW61WXSDfuibOwcPiGv943f6MU7qPNmkbHAAoOMrB/5WlF1J20wKYegcyZdXy4frGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IRsSVi1g; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IRsSVi1g" Received: by smtp.kernel.org (Postfix) with ESMTPS id E18DDC2BC9E; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=90rMoHNtpikEEOX4hxu7KxohYPZTjuhD8cCrdkwCho4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=IRsSVi1g7WlEkI8pVUKi9MtaGzLiC7I8sSTHvz48V2YOrK/KM9FE22hQBcbPbryT8 yA+xtK3RoFt9b0q5UmlDSbflPzrNMW0y5XkJ5RvTyh0SDZ96Q2P3LhnG4EDV16ZlXb QkRSFYlyRgZT8msPmVaN9VKkPaVrIQn51JmraxmNY6sg/4murMKamcLcQlRPVEmL3X MquB+oKcFCiXEKF9GMKGaJKDY93UvyC3loIEr8gpGuEKa68efLsBhQZtzr7k6b/BLC qDqJeIp/8w3C+JzRXTnHlZUuEzZO68q+z+h+VniCM7D2BO651XS1uqTTO7GdJWEGOc MXMenGv8zVNkg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCDADFB5EAF; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:52 +0530 Subject: [PATCH v6 2/9] serdev: Add an API to find the serdev controller associated with the devicetree node Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-2-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2248; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=rr2lmVP0IC6lUnB67NHw0qDXlaCs5LnvUTeOalg9qug=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHP7OTLCI2v2JEVO7b4GY8c87LN9vRLUsYb MkGvu6rvciJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9ZAHB/4rn5Keq3wWhvaowq3W9YqMd9yLEZHQV886wlmogjs0wgzzh5fJUBMd3yGfKKvdjklZ/NF W/hl8xIId+94P5p3blvB1vN/jSKEd2eOfPveBS+ThJ3ayG8UN6cS4gen7hHfv6aVfH49jeq8cMv WNCnmLGtS46/uxBpjJTI2Px2y3P3N6qxUZGJ3Bz4YBBJ+fTplV0mjkr9or9oveKKSnJox08CkJx Xj0FOj0AzGycp8KZUOu470j3cOn60Gj8h9c708Xyd7RolCH1sx82JIYdNgh+fnVRXsyYvWwUd/q jk9buKNVQVfoMZwNcZBda0Ge5kv6fSdI78HEiJQWZjrTYopO X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Add of_find_serdev_controller_by_node() API to find the serdev controller device associated with the devicetree node. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 19 +++++++++++++++++++ include/linux/serdev.h | 9 +++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 8f25510f89b6..bf88b95f7458 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -514,6 +514,25 @@ struct serdev_controller *serdev_controller_alloc(stru= ct device *host, } EXPORT_SYMBOL_GPL(serdev_controller_alloc); =20 +#ifdef CONFIG_OF +/** + * of_find_serdev_controller_by_node() - Find the serdev controller associ= ated + * with the devicetree node + * @node: Devicetree node + * + * Return: Pointer to the serdev controller associated with the node. NULL= if + * the controller is not found. Caller is responsible for calling + * serdev_controller_put() to drop the reference. + */ +struct serdev_controller *of_find_serdev_controller_by_node(struct device_= node *node) +{ + struct device *dev =3D bus_find_device_by_of_node(&serdev_bus_type, node); + + return (dev && dev->type =3D=3D &serdev_ctrl_type) ? to_serdev_controller= (dev) : NULL; +} +EXPORT_SYMBOL_GPL(of_find_serdev_controller_by_node); +#endif + static int of_serdev_register_devices(struct serdev_controller *ctrl) { struct device_node *node; diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 0c7d3c27d1f8..188c0ba62d50 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -334,4 +334,13 @@ static inline bool serdev_acpi_get_uart_resource(struc= t acpi_resource *ares, } #endif /* CONFIG_ACPI */ =20 +#ifdef CONFIG_OF +struct serdev_controller *of_find_serdev_controller_by_node(struct device_= node *node); +#else +static inline struct serdev_controller *of_find_serdev_controller_by_node(= struct device_node *node) +{ + return NULL; +} +#endif /* CONFIG_OF */ + #endif /*_LINUX_SERDEV_H */ --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4BE4E36E477; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=Gefb8AigL8ESDUKHy9YCe/0Fj7FKt7c/NOhe4/8W6lgDaNrWH6zvEnjYHpnkTKXE4lE5L5aetYMF/AtpXRAqja7RVbtS63jyUUdMkOAvfemCGYWz9nNfWMgGTtwisre8lly2C55akgze1OGttv82Gu2c23KkF1CjdopWdSGbcLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=JoCqd4qTmhZAw9Ra/kUSAYchs5sr6tzJ0I7Nt266T1c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FO0qnqhU+OGqByebql6Wt4vPtL7bm0iN2RTkGs4kHONbD2mqPctE67+I1TVSNGruzexV59vF1yE5ggF9CeYDwpka80Dm0CuoJURE1EX7J5NfDW/6oJHjL5Xg18CWyTlTB0D+T7OUc1U4y0SFfuSzaOEn9mg3Vo6QRvrrcKFMPLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AksK2gIg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AksK2gIg" Received: by smtp.kernel.org (Postfix) with ESMTPS id F2FFCC4AF09; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=JoCqd4qTmhZAw9Ra/kUSAYchs5sr6tzJ0I7Nt266T1c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=AksK2gIgIPyYByAvwm5WugRT610NCVqFuKYafU0bCYZ60gDnWGeXiwVHFVaL6YGSn ow/8WubzwXhqDGYFdnjaLEfYYlg4aU+ewNE46ahRmPYXzDEH1Cap6d1WSKemLhu+Yd bwrMz806TDOcyCJRmyIHxAvopcxXA3F/FThclIdlxaJFVHKgK9030FvtcCjOFhg+0r P6C8nfw7r68JrCEWlYugAWkjmBIiUYq+KeR3+8RQ2TliARhyEi3BKcg14g73oIY83g NkajgP7LXWoKW2Oin66UgAnFgYHrDbg+oKoRR9SCykp594TNrdMUrq6O9gE3MIsysM mu6PtPTZB7QMw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE445FB5EB6; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:53 +0530 Subject: [PATCH v6 3/9] serdev: Do not return -ENODEV from of_serdev_register_devices() if external connector is used Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-3-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1461; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=9JYNk+DMPq2LlZQfTiexJ4EeAYXDboalcaCh+TYovs0=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHCVxcR2eU20/cYNvdftr00vaJ2V7UvPmaH ymEVn5El6iJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9ciYB/97N4zLhjZr8iceNjwbuRKrCaK0uDrMyc88oKP1joAcuT6eaUaj9C4ac965XDtFjvjgQcd HuwZVvPK4edCTJ07RJUPS/RII7SYHgt1Qp8I6dgYWfHD+zpYh1AtJQ8h4rZ1SL6HnMX3FPKAoOc +juE9NbztuXO6VsYVDmE3OPHix3rydnJf4nJKmI0Vzfdw2NZJOoUUaheS+m3P21exNVYXN4PyZr Fbx8q8CPiqbYDQ8A3ghk65Fy5xPFJfpoLEVq1y9Q0bRNiYFgj5OxjuT7FhchuSArGheEnntt+T4 oiqiSZt1qADyi4zQnyeOBcuo4wbY2gNTewEHkCOn25cCPAN8 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam If an external connector like M.2 is connected to the serdev controller in DT, then the serdev devices may be created dynamically by the connector driver. So do not return -ENODEV from of_serdev_register_devices() if the static nodes are not found and the graph node is used. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index bf88b95f7458..e9d044a331b0 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -561,7 +562,13 @@ static int of_serdev_register_devices(struct serdev_co= ntroller *ctrl) } else found =3D true; } - if (!found) + + /* + * When the serdev controller is connected to an external connector like + * M.2 in DT, then the serdev devices may be created dynamically by the + * connector driver. + */ + if (!found && !of_graph_is_present(dev_of_node(&ctrl->dev))) return -ENODEV; =20 return 0; --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4834232B9A9; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=Cml4BS77KBAvg61uCcFMThQMqRJOWKUFOMOctzrnICC3HFarcxLTsVGDZdZqr8Uw6wx2mGMkiWM2+C/V9YqqzXl6EqIFDKJbHS3cAhDtL9FjKX8RZxL7B9nLlhJYqdMdCb4NnO7Alc09E9h1p1WNJbhWPnLxgwgo2yp6JOTxCb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=X52v0ldx2BiySSXfXiJ1VT8igCvrWnyeybx/I/10gkg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tbkm4Va6e9UH2iOUNHENRTvq8HP/JVeiM6zEEI0rLuElFdhseb5IHu/Pt01FlAi3UxhvDb+nL6dgXdwBNxI7Rm4Z92qTrNrlT55FjaTYMs/Dx5jDWelaBJqYweV7U+TfnRpskSJsbTqbQnowyEs+hY0Joea44vozPyxUXn0dwJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FiSsisi0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FiSsisi0" Received: by smtp.kernel.org (Postfix) with ESMTPS id 10849C4AF0E; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=X52v0ldx2BiySSXfXiJ1VT8igCvrWnyeybx/I/10gkg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=FiSsisi04CjGpPT540X5+yjxvQtyM7S0Zj7hCr/RE0DrY4RBfMX1Pq9ng+ArdhpNf IBecBnhkQgyQklz9mP7wWgXcQvHR4nKo8lFVf4z33BAFqNEavsKhsgn+UP5vmz12gZ hKvGV3aW2aPubkniqwlc3dNOy5ERati0S2RU1IuVa0qorEcAdsQpdOwg/biNpLBdLK j/YJREjWGIzLfc8Y0H3D2oIDigKWrGiuj9pQm/eSNkl7STqPvxqxSpWH6mJYmLjHAD nodctrTi3B0mIN91yXTmZjzIZDqnFx5dnTuoJybeGIBfydJ1g8HomfG/HMWVjDK+Bs lBaUGCJCEJU6g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EECFFFB5EB8; Tue, 17 Mar 2026 04:30:02 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:54 +0530 Subject: [PATCH v6 4/9] dt-bindings: serial: Document the graph port Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-4-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1047; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=qc2byN8fzCzHCp/R/TbHmtEA/yB09rfLEQZF1FIZXLk=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHzIlkekCrgGWcamJjp5Bq6wTTkw6dTyt+H X3gw2G7SNOJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9XJGB/9ZxYiHOampZxJrCmyhY9H1GJN7K3WEXr1m9d6VtZqZg+8N6b41wlGb4ITXKf4xpe24euM y8z8pHsP6U3xi37uvgcjt+NgxNMXvMS1IOUZk+CYpiFXnAQXJxD1cUYFTa5PttTX1HUBmmNhQvJ uEJ4H/xWRhtAyzSNhs63upcGC/ScQ3FasLHmEJRX62C5O3uxPgm2gIrlkAtOLsn/pB9JsrA+gJJ DCLkdXm5HBTURYxMQBpsl682DemPNhr1h9AHZpND7zvdkL9iMOdW09Wn6hLUW8A5f26/VjObWr4 rGTyXjE04zLvxhEWKVgW9f/E7528wwPdoGkTuTo79WzuiZT1 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam A serial controller could be connected to an external connector like PCIe M.2 for controlling the serial interface of the card. Hence, document the OF graph port. Reviewed-by: Rob Herring (Arm) Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- Documentation/devicetree/bindings/serial/serial.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/serial.yaml b/Documen= tation/devicetree/bindings/serial/serial.yaml index 6aa9cfae417b..96eb1de8771e 100644 --- a/Documentation/devicetree/bindings/serial/serial.yaml +++ b/Documentation/devicetree/bindings/serial/serial.yaml @@ -87,6 +87,9 @@ properties: description: TX FIFO threshold configuration (in bytes). =20 + port: + $ref: /schemas/graph.yaml#/properties/port + patternProperties: "^(bluetooth|bluetooth-gnss|embedded-controller|gnss|gps|mcu|onewire)$": if: --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 79F20374E73; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=RhG6RGmX45fhyeudQFsr480w6hhVumeGCPcr+aDKZMfWBA8bShJc6JTyUITUucvEGsKDoF7kL0YP+TKM77yNrDLnZ+ukU9p3eqfodc/Dl0QPwo3Fuokjv5i2Iyxq3HWzbgsAJ8GhyJsdI6wV5FK2FxMEXitKRRed39eU/irACbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=KEHRuQXTgrOKQFXJBk6d+nUf4A2TRz1DD0R55yMs2zE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qrJQ6uwqnS7rFQa9DZX7bNlGv2ByOvanYS2J2BkiHRPNB5QoorjlRSaUM0xWp8azYtRuMFPoK7E30heYJQV/GKkQDP/6+QxQ81upGQtxzX81e0olM4yrPmlC690SUCR/pvlmiIdhp269prkDYjARA+KPilQP8I+F2FbWpMjKM5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P8L6Qodh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P8L6Qodh" Received: by smtp.kernel.org (Postfix) with ESMTPS id 205FBC2BCF7; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=KEHRuQXTgrOKQFXJBk6d+nUf4A2TRz1DD0R55yMs2zE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=P8L6QodhaqUtjsYjX6fJnaUSfbiAKpWyvT4f/MT9SqoYx0KDTDWML4sxYie3Y9Fqj FypThZ7XgYZ4KUJ9SL8RmwlgRJOaMXpqggau6/VD9AW8fJobCoDaJ7tN9du0BXSpo8 WVT1Si3a4BMh4qKTIyPQ7W5hIhhyyD5un6IP3ikAngnqg5ezHoeeXgze+9Dori1mBf gYgDtv2+MRxenRoMd8+mVNIY2unmO8Ns7hh+ZgSEQMMAYuW+ZwA+BlBq6rfQileZK5 fPwQ7q2AntmdMP2DXCjvot3FfPwdsBLolcu9x1diYIkM+rC6LT0LJL8p1agCm3CSU6 wHE6pOz7Sl7JA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D649FB5EB3; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:55 +0530 Subject: [PATCH v6 5/9] dt-bindings: connector: Add PCIe M.2 Mechanical Key E connector Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-5-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=8239; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=ucsfrtxSU4fN4pYd3XMP8FLE2lLgcpnrofJ4vw1Qbzw=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHmbb21IoOkX/TiCPD4iY/t169IZoLQ16T9 U+cv6xy1keJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9Z7/B/wNYsHClmf8dED8oAe1qYL6EDK+kOYMGAvcAhMhfth91vCRPuFZ2+eI36QZT/860ThTZOW WBE+uMqxpr3ntlX4DytsY41Azp5g46S26lAx8KQ3bnffTeuFBqH+zYYM49KLk0//6XiK2ZyqDxW 3ICU/QN6sLEVaTISylxHuHvk8atx+pbQluto3SResgmN7nfgO9ju1Wi5UXHvWru/q+t0v2YgVHF 83F6qPygIgOkj/vdTo/m1b8WhCSbHAx3A1VCUlRWszNTUPQA16Ycd3YzHE7RijmLBEIuU8Ls0fM R8ybCWr+vS4eClQ8uk/TNnamYhBFiqfSv0QBtdfz2Z+D6ti6 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Add the devicetree binding for PCIe M.2 Mechanical Key E connector defined in the PCI Express M.2 Specification, r4.0, sec 5.1.2. This connector provides interfaces like PCIe or SDIO to attach the WiFi devices to the host machine, USB or UART+PCM interfaces to attach the Bluetooth (BT) devices. Spec also provides an optional interface to connect the UIM card, but that is not covered in this binding. The connector provides a primary power supply of 3.3v, along with an optional 1.8v VIO supply for the Adapter I/O buffer circuitry operating at 1.8v sideband signaling. The connector also supplies optional signals in the form of GPIOs for fine grained power management. Reviewed-by: Rob Herring (Arm) Signed-off-by: Manivannan Sadhasivam --- .../bindings/connector/pcie-m2-e-connector.yaml | 184 +++++++++++++++++= ++++ MAINTAINERS | 1 + 2 files changed, 185 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-e-connecto= r.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.ya= ml new file mode 100644 index 000000000000..f7859aa9b634 --- /dev/null +++ b/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml @@ -0,0 +1,184 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-e-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key E Connector + +maintainers: + - Manivannan Sadhasivam + +description: + A PCIe M.2 E connector node represents a physical PCIe M.2 Mechanical Ke= y E + connector. Mechanical Key E connectors are used to connect Wireless + Connectivity devices including combinations of Wi-Fi, BT, NFC to the host + machine over interfaces like PCIe/SDIO, USB/UART+PCM, and I2C. + +properties: + compatible: + const: pcie-m2-e-connector + + vpcie3v3-supply: + description: A phandle to the regulator for 3.3v supply. + + vpcie1v8-supply: + description: A phandle to the regulator for VIO 1.8v supply. + + i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle + description: I2C interface + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host sys= tem to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.= 1 for + more details. + maxItems: 1 + + w-disable1-gpios: + description: GPIO output to W_DISABLE1# signal. This signal is used by= the + host system to disable WiFi radio in the M.2 card. Refer, PCI Expres= s M.2 + Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1 + + w-disable2-gpios: + description: GPIO output to W_DISABLE2# signal. This signal is used by= the + host system to disable BT radio in the M.2 card. Refer, PCI Express = M.2 + Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1 + + viocfg-gpios: + description: GPIO input to IO voltage configuration (VIO_CFG) signal. = The + card drives this signal to indicate to the host system whether the c= ard + supports an independent IO voltage domain for sideband signals. Refe= r, + PCI Express M.2 Specification r4.0, sec 3.1.15.1 for more details. + maxItems: 1 + + uart-wake-gpios: + description: GPIO input to UART_WAKE# signal. The card asserts this si= gnal + to wake the host system and initiate UART interface communication. R= efer, + PCI Express M.2 Specification r4.0, sec 3.1.8.1 for more details. + maxItems: 1 + + sdio-wake-gpios: + description: GPIO input to SDIO_WAKE# signal. The card asserts this si= gnal + to wake the host system and initiate SDIO interface communication. R= efer, + PCI Express M.2 Specification r4.0, sec 3.1.7 for more details. + maxItems: 1 + + sdio-reset-gpios: + description: GPIO output to SDIO_RESET# signal. This signal is used by= the + host system to reset SDIO interface of the M.2 card. Refer, PCI Expr= ess + M.2 Specification r4.0, sec 3.1.7 for more details. + maxItems: 1 + + vendor-porta-gpios: + description: GPIO for the first vendor specific signal (VENDOR_PORTA).= This + signal's functionality is defined by the card manufacturer and may be + used for proprietary features. Refer the card vendor's documentation= for + details. + maxItems: 1 + + vendor-portb-gpios: + description: GPIO for the second vendor specific signal (VENDOR_PORTB)= . This + signal's functionality is defined by the card manufacturer and may be + used for proprietary features. Refer the card vendor's documentation= for + details. + maxItems: 1 + + vendor-portc-gpios: + description: GPIO for the third vendor specific signal (VENDOR_PORTC).= This + signal's functionality is defined by the card manufacturer and may be + used for proprietary features. Refer the card vendor's documentation= for + details. + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Since a single connector can have multiple interfaces, ev= ery + interface has an assigned OF graph port number as described below. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: PCIe interface for Wi-Fi + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: SDIO interface for Wi-Fi + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: USB 2.0 interface for BT + + port@3: + $ref: /schemas/graph.yaml#/properties/port + description: UART interface for BT + + port@4: + $ref: /schemas/graph.yaml#/properties/port + description: PCM/I2S interface + + anyOf: + - anyOf: + - required: + - port@0 + - required: + - port@1 + - anyOf: + - required: + - port@2 + - required: + - port@3 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key E connector for Wi-Fi/BT with PCIe/UART interfaces + - | + #include + + connector { + compatible =3D "pcie-m2-e-connector"; + vpcie3v3-supply =3D <&vreg_wcn_3p3>; + vpcie1v8-supply =3D <&vreg_l15b_1p8>; + i2c-parent =3D <&i2c0>; + w-disable1-gpios =3D <&tlmm 115 GPIO_ACTIVE_LOW>; + w-disable2-gpios =3D <&tlmm 116 GPIO_ACTIVE_LOW>; + viocfg-gpios =3D <&tlmm 117 GPIO_ACTIVE_HIGH>; + uart-wake-gpios =3D <&tlmm 118 GPIO_ACTIVE_LOW>; + sdio-wake-gpios =3D <&tlmm 119 GPIO_ACTIVE_LOW>; + sdio-reset-gpios =3D <&tlmm 120 GPIO_ACTIVE_LOW>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + endpoint@0 { + reg =3D <0>; + remote-endpoint =3D <&pcie4_port0_ep>; + }; + }; + + port@3 { + reg =3D <3>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + endpoint@0 { + reg =3D <0>; + remote-endpoint =3D <&uart14_ep>; + }; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 55af015174a5..565198d3b500 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21044,6 +21044,7 @@ PCIE M.2 POWER SEQUENCING M: Manivannan Sadhasivam L: linux-pci@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml F: Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml F: drivers/power/sequencing/pwrseq-pcie-m2.c =20 --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 742DA373C1F; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=qWCQDxehT6YNZAjcZSP0PzSYpG5E9Vf0MiQrlmj67KF/QS3BmNWj0EMyELUxN8SPQFHT53jrnvs4KtpNUc3cLie97KrUfQ2ECoxPm9Po1Dr6zvu934kA64PSZw5CEox9cRE49uY62L1jl5Sqyt8mb6j+nhr/knd7KJNGODFT7no= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=Q2Im0iGsNsncd/5YyM8GmD6VBXA5pHhVatfrX9sHrzs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ot4saPkMH/TH22wd7SN1t1BpeOha5dzvB/9zXzPECgn5lqWtQCazP9zSJAymqi2+987ORYmeiPP6NszB3xtR4lmx9iJ+j+XfcKs/98B/Af55oz3kZ0eR7qxxN2/dAU0P6chqBHAU6Sv/lThZiD4CBvMVrGF+NhYPZPu0OZIbCo8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k9Mo4wif; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k9Mo4wif" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2B294C2BCFB; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=Q2Im0iGsNsncd/5YyM8GmD6VBXA5pHhVatfrX9sHrzs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=k9Mo4wifBARL1VCcVkOvUyVGdmtwyhGKj8TSHcmDLonGA0wTY4gszhvO0jY16xa1t 7eeYAgOVN10l5WGLt0WOy7RGjPLB9Qo8Dvd3mpHXP/Ondzor28evNKqvk6YQ58fzC1 0WyL8t777DT6cbgNLfwVnzx3gUuwjajc4SRrO1XrCbHZPOJJkJF8kzpgUbUQVblCiH sSLN9UxqVq8e8p0hp+GTAjr9z8zQTlCFdARU19dUtp3xDAyuzXltfO8vSZ5ZW5D25e tcvV2jCG8PxyLG7zvyJUoWB5r+P6fqeAE823V97NJFSaOVp73PwS2osimT5dJQr2kU 15hb/QLZDY+RQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EF37FB5EB2; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:56 +0530 Subject: [PATCH v6 6/9] dt-bindings: connector: m2: Add M.2 1620 LGA soldered down connector Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-6-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1302; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=HWiEJKBm63OoIEmGwLG8KtD+FwdBq3l9mjxxZvfnxq4=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjHuG6zami5UgFS0L37Wphd4RdB0VR7Q3rF/ e4gj78TW16JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYxwAKCRBVnxHm/pHO 9Xw3CACTsjM19XPUGHDmrcCsQWKDWFue5w5+1nU8rSJUWhKwotoaSalsnsuXV7kGjNyqG+JCA+m g+r6iV23/G8dUOPE3nPzKvO4kavQGg/f45Xk8Bkq9FF1WlNJ/P0DPZnqEtp7KEn03QqQcYsOvo0 fe5tqtU5pOxTK2THt0y1qo5p/AjynWyw2xvSlJJcfSVIxMCwVlyJJbsAvdOORpxqoyt60r9yK4U +pKhsnyqM5Mj40Rd+fwGkII7eIMwZyRU143kWqLSSa7ZWjIgRmli6QvnTfJG7p0se9ydivkkGem Yh2p4Fq0zTjWfXoRsySEr9xhJffEyUhgHnz68nDcXYYLbHud X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Lenovo Thinkpad T14s is found to have a soldered down version of M.2 1620 LGA connector. Though, there is no 1620 LGA form factor defined in the M.2 spec, it looks very similar to the M.2 Key E connector. So add the "pcie-m2-1620-lga-connector" compatible with "pcie-m2-e-connector" fallback to reuse the Key E binding. Signed-off-by: Manivannan Sadhasivam --- .../devicetree/bindings/connector/pcie-m2-e-connector.yaml | 9 +++++= +++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/connector/pcie-m2-e-connecto= r.yaml b/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.ya= ml index f7859aa9b634..d8cf9a9ec7d0 100644 --- a/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml +++ b/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml @@ -17,7 +17,14 @@ description: =20 properties: compatible: - const: pcie-m2-e-connector + oneOf: + - items: + - enum: + - pcie-m2-1620-lga-connector + - const: pcie-m2-e-connector + - items: + - enum: + - pcie-m2-e-connector =20 vpcie3v3-supply: description: A phandle to the regulator for 3.3v supply. --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7B5DE375AA2; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=QAfpn5Mb7jPDV5Iqe6uYYjLTbMPyke73hyLpA+57hWmD+RAfZ3UzOi5OzUeWHW/6hUSUk8DPiwwLhSBkpHHb+1xAnM+N8Sav8S3aHfISAsSXQZWXMe9wgUP5ADecD8qBb3hKzIO2CMuivpnx2cxwXBKp2LF+8SZKe8HY+jU7sIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=xvJdFB9vxMSBN+U1jZgkkmd/Zx+jTJimCm+f0cyrTkg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dyJ+S/dkVZuA0+MgDQ9xVf181Qg9NN8wwUT4DGYDLFL6n5rFDOPMAtgODySJ4ctidgBLmnUSLbbjA/vqB8xcZDJR+PE+1YpDhhZHe7zIo0gOOr7pfQ8SPaU07xm9wODcIY4sqwccznEG29fnSuTiFfwKe4rCuCVsJaWL3rADIs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SUFaHqdh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SUFaHqdh" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3AA37C2BD01; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=xvJdFB9vxMSBN+U1jZgkkmd/Zx+jTJimCm+f0cyrTkg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SUFaHqdhG7mXWAPba66RMlMQlmuXQF/BYj1OpMxffEFOlEpBY1wfj2vh4VLQ7K8q+ e457m+l3MLFFmeWupfBR6EwFKkofhHwbgssWoi8+SdpnLOzVO8AK/hJX9mvey/Dny8 feQKChby9+WzRwRpFGauA6QNG1gyN/7L2exYB2VnQBp2eUZvobCu4yQlvWuWiUE8wj ZLavo9alIU2HGweKYXy3lTgbb2Nu7/7yyqNMKiXkgrcjsyrgi3Z4HhPtp4bla1IS9N XAkEOb5AXAhHN4vq67b7N9shy5lXkuntG2snItjjDoio0+ONThIoWsvvBvCp84sesS Bu8dqdLXS7MFQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EFB2FB5EBA; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:57 +0530 Subject: [PATCH v6 7/9] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-7-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede , Bartosz Golaszewski X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1618; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=ufAjqbjVnkw5Wp64hBIBNRpJbSZpySlLbuaUxcUM4UA=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjI/fWp1VvvtoZmDOj7GoNdTjpzGVusgoyp6 YwFkmDMUnmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYyAAKCRBVnxHm/pHO 9aZcB/4+9qsDw7oVh6OpXwS8kRCci9gubV2KHYgbpsMTh/qOeGFKG5Fdwe1IL2GKDYyC5reMVIo wGPatXmtyNloYGk3guu+bmiv0/JZ+wDxt8OaoW44zH5eIcfs17pvplWqKo+oJVLzwTfUfZWy9i9 Rx7FGIOh79iampCMwCacZROhykXGUtdZ0pvwvF2R5ftGWPMH3QBSYSEsvL1myL3aNCaw4UkicnJ ayQWrQ332UUlcdNosnKmX7rusrH1oBEEdjrSyasG/d4rMWwQfuxIGhcjqtH9oV81Cq111EnEAVT i7svUUG7cmhG8BAdk30HqrnyimHxmZRApL7IonECIZwyvlUY X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Power supply to the M.2 Bluetooth device attached to the host using M.2 connector is controlled using the 'uart' pwrseq device. So add support for getting the pwrseq device if the OF graph link is present. Once obtained, the existing pwrseq APIs can be used to control the power supplies of the M.2 card. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/bluetooth/hci_qca.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 5b02e7c3f56d..0454c2318461 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -2421,6 +2422,14 @@ static int qca_serdev_probe(struct serdev_device *se= rdev) case QCA_WCN6855: case QCA_WCN7850: case QCA_WCN6750: + if (of_graph_is_present(dev_of_node(&serdev->ctrl->dev))) { + qcadev->bt_power->pwrseq =3D devm_pwrseq_get(&serdev->ctrl->dev, + "uart"); + if (IS_ERR(qcadev->bt_power->pwrseq)) + return PTR_ERR(qcadev->bt_power->pwrseq); + break; + } + if (!device_property_present(&serdev->dev, "enable-gpios")) { /* * Backward compatibility with old DT sources. If the --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 749CB374734; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=V42x0IfrQU7JX5YOemdn4du6V9D0SkYQ9Z9wjzdtsaFp5XFg94rlzEYS+mg0IgWiz5ftjmgGgRlrwKtJ16XUm2/SXoQwTQrS9AqYoo3QY4GjqTsVTMfXAcvV5NBmhPS+6R9QoRGLt9pN6/YypNawTquODZwBaB8R5y7mPmWLI3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=QPg5ucT2J9JR6E3rS7caTqzm372tAM2YlgwRdg7/hwg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eiJKbpKhmBtDeGYJGLKsJ+m6qaSmBqBlREVxyS9UshXz3xym40m4U/uCIh+voXHnUNNcWa+m3qy3cu9MNxvEbix4kAQKUa9Yi2VpaqoI1BdFgvz68mqzi+pYa5IW5kJALAzxKa+e3+mbSKudwHbOAvSFJB4SVgQ276/VwLh9yus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QBWia1kv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QBWia1kv" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4D6FEC4AF60; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=QPg5ucT2J9JR6E3rS7caTqzm372tAM2YlgwRdg7/hwg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=QBWia1kvU0hzr9/IIMmiMugwqXQui+E5Zx0jATpiYOwYOK0lAS8n/RLftJg5KaA14 7VZQOVGDiQyxORYefUTsU1j9P18wxbOL8wxqtXnZmG2hFAuZpr5YdG+ADjgYoZ1ceP q+e9Njs6j5DnE2G6/sBBB+VqXUuaRGp7NK2QIrlBtYfxQZgtivjpGAMOwOOKMLlLQm 2O6djr56VWXvd4czVXlyqSIO8+HLfJ77KUD2sjkv3bjlJUvgR7hlnAnY4DzkfNTkaw bRuj2DMujfRs3Bf0maFHBe1Q5jHSe1YnHyMsSNzC8Wb4uLCcXq3Ncaxa+3qOQqjwLa u4KYFagK0jgvw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4137FFB5EAF; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:58 +0530 Subject: [PATCH v6 8/9] power: sequencing: pcie-m2: Add support for PCIe M.2 Key E connectors Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-8-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6901; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=HRGptE1JIyA395dlxkM3raRO8gPG2oSfeqDUBhjL6YY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjI88cHDGNTObFzDe79dog7fTAXqu7YQQQfm kCHUeJi2vGJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYyAAKCRBVnxHm/pHO 9S/FB/9gtY/+oWrElNEe20sUpacFpvS2nuWpFnoOKST0NqPD5ea7OCiFxB5Vsv725QmDRpfGjPO mdpEPBabPEbHLoRm55+doWY4j8e1EMpk8mObda+e1ALD2Hqrbl3G8Rw3g4g0ZHNK/l+jPW2wKem pZO9EqEko9yPk9pAE29G+xQrW8zMIiI7Fi/kN0gtiL3GkDr0RXIxInGcARFLuQeGycJch5qYWpM uqcUgk+94ysca0G2SRWqdBmMZVXJBFGlVoM7u5vbm2JV4vsOQCl5kl03xQbgYQ8gIqsSzQ5ERt6 I8/oNDhLugHePcQ3fI2o8+QhYNI2hszIQRe491uGcFC56XUa X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Add support for handling the power sequence of the PCIe M.2 Key E connectors. These connectors are used to attach the Wireless Connectivity devices to the host machine including combinations of WiFi, BT, NFC using interfaces such as PCIe/SDIO for WiFi, USB/UART for BT and I2C for NFC. Currently, this driver supports only the PCIe interface for WiFi and UART interface for BT. The driver also only supports driving the 3.3v/1.8v power supplies and W_DISABLE{1/2}# GPIOs. The optional signals of the Key E connectors are not currently supported. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Signed-off-by: Manivannan Sadhasivam --- drivers/power/sequencing/pwrseq-pcie-m2.c | 107 ++++++++++++++++++++++++++= ++-- 1 file changed, 101 insertions(+), 6 deletions(-) diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequ= encing/pwrseq-pcie-m2.c index d31a7dd8b35c..3507cdcb1e7b 100644 --- a/drivers/power/sequencing/pwrseq-pcie-m2.c +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c @@ -5,10 +5,13 @@ */ =20 #include +#include +#include #include #include #include #include +#include #include #include #include @@ -25,16 +28,18 @@ struct pwrseq_pcie_m2_ctx { struct regulator_bulk_data *regs; size_t num_vregs; struct notifier_block nb; + struct gpio_desc *w_disable1_gpio; + struct gpio_desc *w_disable2_gpio; }; =20 -static int pwrseq_pcie_m2_m_vregs_enable(struct pwrseq_device *pwrseq) +static int pwrseq_pcie_m2_vregs_enable(struct pwrseq_device *pwrseq) { struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); =20 return regulator_bulk_enable(ctx->num_vregs, ctx->regs); } =20 -static int pwrseq_pcie_m2_m_vregs_disable(struct pwrseq_device *pwrseq) +static int pwrseq_pcie_m2_vregs_disable(struct pwrseq_device *pwrseq) { struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); =20 @@ -43,18 +48,84 @@ static int pwrseq_pcie_m2_m_vregs_disable(struct pwrseq= _device *pwrseq) =20 static const struct pwrseq_unit_data pwrseq_pcie_m2_vregs_unit_data =3D { .name =3D "regulators-enable", - .enable =3D pwrseq_pcie_m2_m_vregs_enable, - .disable =3D pwrseq_pcie_m2_m_vregs_disable, + .enable =3D pwrseq_pcie_m2_vregs_enable, + .disable =3D pwrseq_pcie_m2_vregs_disable, }; =20 -static const struct pwrseq_unit_data *pwrseq_pcie_m2_m_unit_deps[] =3D { +static const struct pwrseq_unit_data *pwrseq_pcie_m2_unit_deps[] =3D { &pwrseq_pcie_m2_vregs_unit_data, NULL }; =20 +static int pwrseq_pci_m2_e_uart_enable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + + return gpiod_set_value_cansleep(ctx->w_disable2_gpio, 0); +} + +static int pwrseq_pci_m2_e_uart_disable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + + return gpiod_set_value_cansleep(ctx->w_disable2_gpio, 1); +} + +static const struct pwrseq_unit_data pwrseq_pcie_m2_e_uart_unit_data =3D { + .name =3D "uart-enable", + .deps =3D pwrseq_pcie_m2_unit_deps, + .enable =3D pwrseq_pci_m2_e_uart_enable, + .disable =3D pwrseq_pci_m2_e_uart_disable, +}; + +static int pwrseq_pci_m2_e_pcie_enable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + + return gpiod_set_value_cansleep(ctx->w_disable1_gpio, 0); +} + +static int pwrseq_pci_m2_e_pcie_disable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_pcie_m2_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + + return gpiod_set_value_cansleep(ctx->w_disable1_gpio, 1); +} + +static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data =3D { + .name =3D "pcie-enable", + .deps =3D pwrseq_pcie_m2_unit_deps, + .enable =3D pwrseq_pci_m2_e_pcie_enable, + .disable =3D pwrseq_pci_m2_e_pcie_disable, +}; + static const struct pwrseq_unit_data pwrseq_pcie_m2_m_pcie_unit_data =3D { .name =3D "pcie-enable", - .deps =3D pwrseq_pcie_m2_m_unit_deps, + .deps =3D pwrseq_pcie_m2_unit_deps, +}; + +static int pwrseq_pcie_m2_e_pwup_delay(struct pwrseq_device *pwrseq) +{ + /* + * FIXME: This delay is only required for some Qcom WLAN/BT cards like + * WCN7850 and not for all devices. But currently, there is no way to + * identify the device model before enumeration. + */ + msleep(50); + + return 0; +} + +static const struct pwrseq_target_data pwrseq_pcie_m2_e_uart_target_data = =3D { + .name =3D "uart", + .unit =3D &pwrseq_pcie_m2_e_uart_unit_data, + .post_enable =3D pwrseq_pcie_m2_e_pwup_delay, +}; + +static const struct pwrseq_target_data pwrseq_pcie_m2_e_pcie_target_data = =3D { + .name =3D "pcie", + .unit =3D &pwrseq_pcie_m2_e_pcie_unit_data, + .post_enable =3D pwrseq_pcie_m2_e_pwup_delay, }; =20 static const struct pwrseq_target_data pwrseq_pcie_m2_m_pcie_target_data = =3D { @@ -62,11 +133,21 @@ static const struct pwrseq_target_data pwrseq_pcie_m2_= m_pcie_target_data =3D { .unit =3D &pwrseq_pcie_m2_m_pcie_unit_data, }; =20 +static const struct pwrseq_target_data *pwrseq_pcie_m2_e_targets[] =3D { + &pwrseq_pcie_m2_e_pcie_target_data, + &pwrseq_pcie_m2_e_uart_target_data, + NULL +}; + static const struct pwrseq_target_data *pwrseq_pcie_m2_m_targets[] =3D { &pwrseq_pcie_m2_m_pcie_target_data, NULL }; =20 +static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_e_of_data =3D { + .targets =3D pwrseq_pcie_m2_e_targets, +}; + static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_m_of_data =3D { .targets =3D pwrseq_pcie_m2_m_targets, }; @@ -125,6 +206,16 @@ static int pwrseq_pcie_m2_probe(struct platform_device= *pdev) return dev_err_probe(dev, ret, "Failed to get all regulators\n"); =20 + ctx->w_disable1_gpio =3D devm_gpiod_get_optional(dev, "w-disable1", GPIOD= _OUT_HIGH); + if (IS_ERR(ctx->w_disable1_gpio)) + return dev_err_probe(dev, PTR_ERR(ctx->w_disable1_gpio), + "Failed to get the W_DISABLE_1# GPIO\n"); + + ctx->w_disable2_gpio =3D devm_gpiod_get_optional(dev, "w-disable2", GPIOD= _OUT_HIGH); + if (IS_ERR(ctx->w_disable2_gpio)) + return dev_err_probe(dev, PTR_ERR(ctx->w_disable2_gpio), + "Failed to get the W_DISABLE_2# GPIO\n"); + ctx->num_vregs =3D ret; =20 ret =3D devm_add_action_or_reset(dev, pwrseq_pcie_m2_free_regulators, ctx= ); @@ -150,6 +241,10 @@ static const struct of_device_id pwrseq_pcie_m2_of_mat= ch[] =3D { .compatible =3D "pcie-m2-m-connector", .data =3D &pwrseq_pcie_m2_m_of_data, }, + { + .compatible =3D "pcie-m2-e-connector", + .data =3D &pwrseq_pcie_m2_e_of_data, + }, { } }; MODULE_DEVICE_TABLE(of, pwrseq_pcie_m2_of_match); --=20 2.51.0 From nobody Tue Apr 7 01:03:01 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D722837AA7D; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; cv=none; b=ZgTOCQ2B16e7d+qkw+9GHnzxNY7yzb+3ZKWiaUsm4dQqLdZhwVehEUHSCcjUkJ9amuyNStFbOGSuG5bDv9gH0u456yc7V5UQgK59m8TCxw+b8BRP73hTyBmO8bxF8/W/Ol+0wKh0GYqV8DhEId+sbZnSD+tGFh0DvCbUo5HVWCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773721803; c=relaxed/simple; bh=FGC9LWLO/iZZl3RDOr0DZ0Oj7UolFVMpekayrfC/uhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UmzPUJZz4UMECRe1Q0iXN5lQYElJ+4bG23f1xzxCSLPLQjyf5KoHSkDl0RhoZZYk6FUSJxdTP/Vxf/SVrpO2wFIOMgM/HHPgvgY+0TR15JvlhFB0yCZGscB5F16cBYiyu4pgB2+p/HpjT0cj/zS1YAKLBYLM1kAtfJxEwFHDGlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FIU3h1MJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FIU3h1MJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5DF09C4DDE0; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773721803; bh=FGC9LWLO/iZZl3RDOr0DZ0Oj7UolFVMpekayrfC/uhE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=FIU3h1MJ0eZVjzbUf1D65LD/5262QNsEIyCC1KQjTPzFziR+W/NCryG3K2nEDXYww Ft4bjvW+JBon535MtrnaQoE8H7kieNmPtO713EZo9VCvaEiLRFYQAeaPXSXm3P4ipm IXXt/XYecYk42xOTAY+aHhy9wNsD94+1zCUoNMBifZZ/0jvDUjJm9aYl+3vHEB//j1 4zsTZ+QaksKZ5uPh3aJpTheFJ6hdr3ckbaP687OMhhUvLRm0nFKrNVm9KGpfUBSo/T INqsN1gAb9+88sLmutgZ+MWOzUk6SKT+/3078N8RzV4vyMCf//z8qy3qfCF6odk70R 24GPqSKamt3Rg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5246EFB5EBB; Tue, 17 Mar 2026 04:30:03 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 17 Mar 2026 09:59:59 +0530 Subject: [PATCH v6 9/9] power: sequencing: pcie-m2: Create serdev device for WCN7850 bluetooth Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-pci-m2-e-v6-9-9c898f108d3d@oss.qualcomm.com> References: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> In-Reply-To: <20260317-pci-m2-e-v6-0-9c898f108d3d@oss.qualcomm.com> To: Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org, Stephan Gerhold , Dmitry Baryshkov , linux-acpi@vger.kernel.org, Manivannan Sadhasivam , Hans de Goede X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=8414; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=jB5KOLhGbLaiLJ4bcpaZm55gn4tJXN7qNgKfcUISnKw=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpuNjIclrkVvBY7VCoaNyWVWquJ6Yx78vByyqxa bF7t7cJibWJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabjYyAAKCRBVnxHm/pHO 9SrXB/0fRpzVbNwF7ayQBLRN8x0cWOsEnBURnG6hWB5LmQUReHrHKokOZ+5aZe3U5b08g4J3hHb 3R7mzPgZ/U4hna3SS+5LIY9wyaoqqiE9/UGApFkcYQJLAmaeNxgjZLswyKVbC1/kb3nVtPir9p2 G1aegl+fvPxPhvjzhAJLXlaSlE4yYRYOcGh3LvLzYtaf/Jf+/s5O4wYlxluyD2BCqx2rkmjmHON E/wJeMi7eLTByKKzJyPRfxl7NlLQ0CjlhHniu4S7PIuooFI6mmdC+YC3NUHJjQ/C5PeSqYGwcYZ sl+GvhX03jHygI8TtWZ+AzsIKtPO1sNlnBk1xVmxjago0zG9 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam For supporting bluetooth over the non-discoverable UART interface of WCN7850, create the serdev device after enumerating the PCIe interface. This is mandatory since the device ID is only known after the PCIe enumeration and the ID is used for creating the serdev device. Since by default there is no OF or ACPI node for the created serdev, create a dynamic OF 'bluetooth' node with the 'compatible' property and attach it to the serdev device. This will allow the serdev device to bind to the existing bluetooth driver. Tested-by: Hans de Goede # ThinkPad T14s = gen6 (arm64) Signed-off-by: Manivannan Sadhasivam --- drivers/power/sequencing/Kconfig | 3 +- drivers/power/sequencing/pwrseq-pcie-m2.c | 178 ++++++++++++++++++++++++++= +++- 2 files changed, 177 insertions(+), 4 deletions(-) diff --git a/drivers/power/sequencing/Kconfig b/drivers/power/sequencing/Kc= onfig index f5fff84566ba..55aeef125e6f 100644 --- a/drivers/power/sequencing/Kconfig +++ b/drivers/power/sequencing/Kconfig @@ -37,7 +37,8 @@ config POWER_SEQUENCING_TH1520_GPU =20 config POWER_SEQUENCING_PCIE_M2 tristate "PCIe M.2 connector power sequencing driver" - depends on OF || COMPILE_TEST + depends on (PCI && OF) || COMPILE_TEST + select OF_DYNAMIC help Say Y here to enable the power sequencing driver for PCIe M.2 connectors. This driver handles the power sequencing for the M.2 diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequ= encing/pwrseq-pcie-m2.c index 3507cdcb1e7b..77357439ba81 100644 --- a/drivers/power/sequencing/pwrseq-pcie-m2.c +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c @@ -12,9 +12,11 @@ #include #include #include +#include #include #include #include +#include #include =20 struct pwrseq_pcie_m2_pdata { @@ -30,6 +32,9 @@ struct pwrseq_pcie_m2_ctx { struct notifier_block nb; struct gpio_desc *w_disable1_gpio; struct gpio_desc *w_disable2_gpio; + struct serdev_device *serdev; + struct of_changeset *ocs; + struct device *dev; }; =20 static int pwrseq_pcie_m2_vregs_enable(struct pwrseq_device *pwrseq) @@ -172,13 +177,176 @@ static int pwrseq_pcie_m2_match(struct pwrseq_device= *pwrseq, return PWRSEQ_NO_MATCH; } =20 -static void pwrseq_pcie_m2_free_regulators(void *data) +static void pwrseq_pcie_m2_free_resources(void *data) { struct pwrseq_pcie_m2_ctx *ctx =3D data; =20 + serdev_device_remove(ctx->serdev); + bus_unregister_notifier(&pci_bus_type, &ctx->nb); + of_changeset_revert(ctx->ocs); + of_changeset_destroy(ctx->ocs); regulator_bulk_free(ctx->num_vregs, ctx->regs); } =20 +static int pwrseq_m2_pcie_create_bt_node(struct pwrseq_pcie_m2_ctx *ctx, + struct device_node *parent) +{ + struct device *dev =3D ctx->dev; + struct device_node *np; + int ret; + + ctx->ocs =3D devm_kzalloc(dev, sizeof(*ctx->ocs), GFP_KERNEL); + if (!ctx->ocs) + return -ENOMEM; + + of_changeset_init(ctx->ocs); + + np =3D of_changeset_create_node(ctx->ocs, parent, "bluetooth"); + if (!np) { + dev_err(dev, "Failed to create bluetooth node\n"); + ret =3D -ENODEV; + goto err_destroy_changeset; + } + + ret =3D of_changeset_add_prop_string(ctx->ocs, np, "compatible", "qcom,wc= n7850-bt"); + if (ret) { + dev_err(dev, "Failed to add bluetooth compatible: %d\n", ret); + goto err_destroy_changeset; + } + + ret =3D of_changeset_apply(ctx->ocs); + if (ret) { + dev_err(dev, "Failed to apply changeset: %d\n", ret); + goto err_destroy_changeset; + } + + ret =3D device_add_of_node(&ctx->serdev->dev, np); + if (ret) { + dev_err(dev, "Failed to add OF node: %d\n", ret); + goto err_revert_changeset; + } + + return 0; + +err_revert_changeset: + of_changeset_revert(ctx->ocs); +err_destroy_changeset: + of_changeset_destroy(ctx->ocs); + + return ret; +} + +static int pwrseq_m2_pcie_notify(struct notifier_block *nb, unsigned long = action, + void *data) +{ + struct pwrseq_pcie_m2_ctx *ctx =3D container_of(nb, struct pwrseq_pcie_m2= _ctx, nb); + struct pci_dev *pdev =3D to_pci_dev(data); + struct serdev_controller *serdev_ctrl; + struct device *dev =3D ctx->dev; + int ret; + + /* + * Check whether the PCI device is associated with this M.2 connector or + * not, by comparing the OF node of the PCI device parent and the Port 0 + * (PCIe) remote node parent OF node. + */ + struct device_node *pci_parent __free(device_node) =3D + of_graph_get_remote_node(dev_of_node(ctx->dev), 0, 0); + if (!pci_parent || (pci_parent !=3D pdev->dev.parent->of_node)) + return NOTIFY_DONE; + + switch (action) { + case BUS_NOTIFY_ADD_DEVICE: + /* Create serdev device for WCN7850 */ + if (pdev->vendor =3D=3D PCI_VENDOR_ID_QCOM && pdev->device =3D=3D 0x1107= ) { + struct device_node *serdev_parent __free(device_node) =3D + of_graph_get_remote_node(dev_of_node(ctx->dev), 1, 1); + if (!serdev_parent) + return NOTIFY_DONE; + + serdev_ctrl =3D of_find_serdev_controller_by_node(serdev_parent); + if (!serdev_ctrl) + return NOTIFY_DONE; + + /* + * Bail out if the device was already attached to this + * controller. + */ + if (serdev_ctrl->serdev) + return NOTIFY_DONE; + + ctx->serdev =3D serdev_device_alloc(serdev_ctrl); + if (!ctx->serdev) + return NOTIFY_BAD; + + ret =3D pwrseq_m2_pcie_create_bt_node(ctx, serdev_parent); + if (ret) { + serdev_device_put(ctx->serdev); + return notifier_from_errno(ret); + } + + ret =3D serdev_device_add(ctx->serdev); + if (ret) { + dev_err(dev, "Failed to add serdev for WCN7850: %d\n", ret); + of_changeset_revert(ctx->ocs); + of_changeset_destroy(ctx->ocs); + serdev_device_put(ctx->serdev); + return notifier_from_errno(ret); + } + } + break; + case BUS_NOTIFY_REMOVED_DEVICE: + /* Destroy serdev device for WCN7850 */ + if (pdev->vendor =3D=3D PCI_VENDOR_ID_QCOM && pdev->device =3D=3D 0x1107= ) { + serdev_device_remove(ctx->serdev); + of_changeset_revert(ctx->ocs); + of_changeset_destroy(ctx->ocs); + } + break; + } + + return NOTIFY_OK; +} + +static bool pwrseq_pcie_m2_check_remote_node(struct device *dev, u8 port, = u8 endpoint, + const char *node) +{ + struct device_node *remote __free(device_node) =3D + of_graph_get_remote_node(dev_of_node(dev), port, endpoint); + + if (remote && of_node_name_eq(remote, node)) + return true; + + return false; +} + +/* + * If the connector exposes a non-discoverable bus like UART, the respecti= ve + * protocol device needs to be created manually with the help of the notif= ier + * of the discoverable bus like PCIe. + */ +static int pwrseq_pcie_m2_register_notifier(struct pwrseq_pcie_m2_ctx *ctx= , struct device *dev) +{ + int ret; + + /* + * Register a PCI notifier for Key E connector that has PCIe as Port + * 0/Endpoint 0 interface and Serial as Port 3/Endpoint 0 interface. + */ + if (pwrseq_pcie_m2_check_remote_node(dev, 3, 0, "serial")) { + if (pwrseq_pcie_m2_check_remote_node(dev, 0, 0, "pcie")) { + ctx->dev =3D dev; + ctx->nb.notifier_call =3D pwrseq_m2_pcie_notify; + ret =3D bus_register_notifier(&pci_bus_type, &ctx->nb); + if (ret) + return dev_err_probe(dev, ret, + "Failed to register notifier for serdev\n"); + } + } + + return 0; +} + static int pwrseq_pcie_m2_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -218,7 +386,7 @@ static int pwrseq_pcie_m2_probe(struct platform_device = *pdev) =20 ctx->num_vregs =3D ret; =20 - ret =3D devm_add_action_or_reset(dev, pwrseq_pcie_m2_free_regulators, ctx= ); + ret =3D devm_add_action_or_reset(dev, pwrseq_pcie_m2_free_resources, ctx); if (ret) return ret; =20 @@ -233,7 +401,11 @@ static int pwrseq_pcie_m2_probe(struct platform_device= *pdev) return dev_err_probe(dev, PTR_ERR(ctx->pwrseq), "Failed to register the power sequencer\n"); =20 - return 0; + /* + * Register a notifier for creating protocol devices for + * non-discoverable busses like UART. + */ + return pwrseq_pcie_m2_register_notifier(ctx, dev); } =20 static const struct of_device_id pwrseq_pcie_m2_of_match[] =3D { --=20 2.51.0