From nobody Sun Feb 8 13:10:39 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 5681233D6E7; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=ObUYfZSTr6DPLceOwF761JtoCXzGS9akIZ8x2N7ncl7zObSGftWdWF3ew2gicrtVB4gZPid8B99t9fm8uef0GoSrQ/hvn9UncY8Ms+v5n1oXZZycsOVm9Myuq2Adr2ilmXVeyi2UZidmys5KgkWLKhmAI7sjmb5yOMRQY6cPLFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=novVq7mIcfdWOjqb22DZyGsxIxWmlqMMB5fYxdyzH+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mMJx9LHWhG98KJRX2TsT6eWkFclKZG0Bb9f1WiDslgohmBEjXdMaEEfGzGNMOievAjMeGgzYB1wAaxTOFCZBxsOJecoWyHdcLJCUUS3xA1ZmktX//Qq4SbaRRRHaIADuWCgTyVdfQDGjHnxpGfCafIXc2jcoCopGmvelV+aAfYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uCcCNGel; 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="uCcCNGel" Received: by smtp.kernel.org (Postfix) with ESMTPS id E9589C4CEF8; Wed, 12 Nov 2025 14:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=novVq7mIcfdWOjqb22DZyGsxIxWmlqMMB5fYxdyzH+U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uCcCNGel5JAONTbXSmFZv6s6lUS26zOUZ3JsOH2/MgdhJMXRv4N/23RDaC93ct6uv nNgk1LWvMPFj+h0pu5JLgjTccyysBKhD6AuCv2I+mqEJ+xaLK6V2y4Zbp816vBJ1HE GPll3jHNbz63klkJ6xVxkPdWB+C1NZPhDQudARm41tgkNk4GWmf323udVHMlh305b8 tuwvBfGl/fHZoIpAJcicf6IPF5g7YPbo1YYyW3bb2EzcfzlOb/yz/Ce3FzkGqTYY9P NDGHjDOqejSsfQyUSxWObhFz+L55Cjl3SdAyP5Rhiow/vWPKq8nE1gL79BMEssSn2k cDzpgmN694QBw== 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 DCA26CCFA1A; Wed, 12 Nov 2025 14:45:30 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:13 +0530 Subject: [PATCH 1/9] serdev: Convert to_serdev_device() and to_serdev_controller() helpers to macros 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: <20251112-pci-m2-e-v1-1-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1668; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=pMjdMDUJJFdzXcs8r8heXhJAvEfUn5voSIPUccUCX28=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2GiS7ttFmSpXLyf6Ebs4G+J1tZeIesPjGyO Io4W/4qnFSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhgAKCRBVnxHm/pHO 9S3zCACcJTT8QNObEZKWOhlVOpP+8Sdq43NqiYJbUBYuIUI/938PeuVe+p/Eu9tWu4Jx4ld9WLq x7upQxEUF/78BXiJeB/5FQ9S0XNY1qRnZR2IndyMu0EquXXda9XQDoMxY6Xgeo3svQu9oDqZQ46 YaqnVYA2mfopwwCVjTkh4JNy2FGCmSChULV8E3JwBHN5v0UGXSVXfrHodrLB7u/4ySWqn51vWAz wCF2daTzCAZTwT1Je0wMfLvgHK9msYEDJj7Kp/dqojqqcVsIMpkTzCBZHBzv5utYP7EsWD+E+l2 00eA4GYX1ZWoyEYciBFQ6tATdVp8Ogfyl4maX1KkQroPRRTs 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. Signed-off-by: Manivannan Sadhasivam --- include/linux/serdev.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 34562eb99931d808e885ce5022b8aa4577566885..ab185cac556380dfa3cdf94b7af= 6ee168b677587 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(d, struct serdev_device, dev) =20 /** * struct serdev_device_driver - serdev slave device driver @@ -67,10 +64,7 @@ struct serdev_device_driver { void (*remove)(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(d, struct serdev_device_dr= iver, driver) =20 enum serdev_parity { SERDEV_PARITY_NONE, --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 5676823D7CD; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=IUYWAxfoP1LA+OAskdsN92KwrdlCcxo3MEex5VQZSPqDm49uxx2oFlpqVgFuasYwjZD+UBiYI7TUpiCsUkIQss4+rIuOMzVbTPXOQe1poipw1sfcaZlDbPfzdXqcHsNP1iVofHD4LxgHviW7ks993b/bboqU/HhMCHwR1suMjYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=n4VGx5zAuR93d8nYMgZV1H2hgcadDo+HwhKU8BhAt7M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cAw/g+9WMn6tm2sF1JMlluxThhdSC/4eDO4RAEDmySNrsn/TI0EUup9IE3UHVS1gLWCOB4v81oclAzc+gVrx6qKeUWIywauUjBKnH1T0HDl9MlUclGy74JNr6Zn+pAGi70SmDlupw9lEMeq6rPLeRzUhr4j3u5MUTAsMRiKIFeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LYF4kRBA; 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="LYF4kRBA" Received: by smtp.kernel.org (Postfix) with ESMTPS id 0C078C113D0; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=n4VGx5zAuR93d8nYMgZV1H2hgcadDo+HwhKU8BhAt7M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LYF4kRBAPUsb+Lg+VTt5bz1GkokdfnPEyOYmdznIS05xlFl20JoTqmwgleDHEQSGr NSh1bdMzh+dWFY6hTy/cH6hbAbspOmFpjRO6n9INnRTdkUpcIH3FjQ8fh6TiUhtMf4 W1Ghj/c58J+KQoOD9aetpDzt3niBbScoJ02fiL1EtST5HbD5bWQJc/dwHuqEm19d9Y YyPfGRBTtnQxkSsxM/ieDECLJaNc8qv4QpsLgZtSlBOC7Mo3CtrhL2wkGs/z6ld1U7 sCa9WIscQ6msA36uiU9ymwhklUFNadVHtHm+GZxMwGRWd5lFQEBurzGqe/w9rAB6Up iroe+/0HetTkg== 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 EF608CD1297; Wed, 12 Nov 2025 14:45:30 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:14 +0530 Subject: [PATCH 2/9] serdev: Add serdev device based driver match support 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: <20251112-pci-m2-e-v1-2-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4197; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=nlTsT1KuaCByFt+CSA6xTACxTdskiJ12kycskYPPccs=; b=owGbwMvMwMUYOl/w2b+J574ynlZLYsgUmdv29OlUg/BV3A+d6k4uKeJU0Hk27zpng/n/ip/3/ Vty267EdDIaszAwcjHIiimypC911mr0OH1jSYT6dJhBrEwgUxi4OAVgIsYWHAyzO1dLnLyaOKXp A3PP/5YuY9l5uw+I39568paoWoWXylnba4G8J5u09Hf1mD/5Wv5ZoKXx+b0NeuI3s77mPOJKqbw y5xzvLcllfYWSfBufmlzZpGxYf2vuDcvXGSZHMpSbJHy2nrCX5jA+cHjb+hkr2Gs+nA3iizfKeJ xiVKd6ybKOqflv/CO2k6tfOFTXn67QVlWJeHBGhycqYHqligOr+Z9rgl7h3vLSmku5a249UC/nf eaowjspJmFllWdoxnfX5TVitodChToPruS8co3zgG9+TJNdhtyE0Gkdekkf7OpZLVKN5ynomOsn TrZWV/yeHCai/lXuJYvK9asH9rS3rZrb8MbzoujRvlkFAA== 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 to match serdev devices with serdev drivers based on the serdev ID table defined in serdev_device_driver::id_table. The matching function, serdev_driver_match_device() uses the serdev device name to match against the entries in serdev_device_driver::id_table. If there is no serdev id_table for the driver, then serdev_device_match() will fallback to ACPI and DT based matching. Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 23 ++++++++++++++++++++++- include/linux/mod_devicetable.h | 7 +++++++ include/linux/serdev.h | 4 ++++ scripts/mod/devicetable-offsets.c | 3 +++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index b33e708cb2455fc144a9fd4ac40ce9118e1a8faa..2b5582cd5063a87c9a6c99f83a8= ab071637eae57 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -85,12 +85,33 @@ static const struct device_type serdev_ctrl_type =3D { .release =3D serdev_ctrl_release, }; =20 +static int serdev_driver_match_device(struct device *dev, const struct dev= ice_driver *drv) +{ + const struct serdev_device_driver *serdev_drv =3D to_serdev_device_driver= (drv); + struct serdev_device *serdev =3D to_serdev_device(dev); + const struct serdev_device_id *id; + + if (!serdev_drv->id_table) + return 0; + + for (id =3D serdev_drv->id_table; id->name[0]; id++) { + if (!strcmp(dev_name(dev), id->name)) { + serdev->id =3D id; + return 1; + } + } + + return 0; +} + static int serdev_device_match(struct device *dev, const struct device_dri= ver *drv) { if (!is_serdev_device(dev)) return 0; =20 - /* TODO: platform matching */ + if (serdev_driver_match_device(dev, drv)) + return 1; + if (acpi_driver_match_device(dev, drv)) return 1; =20 diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetabl= e.h index 6077972e8b45de3d07881c0226459d815dd1f83d..70c54c4bedba2fcb8f5eb37c2d9= ede05d5d91188 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -976,4 +976,11 @@ struct coreboot_device_id { kernel_ulong_t driver_data; }; =20 +#define SERDEV_NAME_SIZE 32 + +struct serdev_device_id { + const char name[SERDEV_NAME_SIZE]; + kernel_ulong_t driver_data; +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/serdev.h b/include/linux/serdev.h index ab185cac556380dfa3cdf94b7af6ee168b677587..ee42e293445d928a311bd3c120e= 609214f89a5dd 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -39,6 +39,7 @@ struct serdev_device_ops { * @ops: Device operations. * @write_comp Completion used by serdev_device_write() internally * @write_lock Lock to serialize access when writing data + * @id: serdev device ID entry */ struct serdev_device { struct device dev; @@ -47,6 +48,7 @@ struct serdev_device { const struct serdev_device_ops *ops; struct completion write_comp; struct mutex write_lock; + const struct serdev_device_id *id; }; =20 #define to_serdev_device(d) container_of(d, struct serdev_device, dev) @@ -55,11 +57,13 @@ struct serdev_device { * struct serdev_device_driver - serdev slave device driver * @driver: serdev device drivers should initialize name field of this * structure. + * @id_table: serdev device ID table * @probe: binds this driver to a serdev device. * @remove: unbinds this driver from the serdev device. */ struct serdev_device_driver { struct device_driver driver; + const struct serdev_device_id *id_table; int (*probe)(struct serdev_device *); void (*remove)(struct serdev_device *); }; diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-of= fsets.c index d3d00e85edf73553ba3d9b5f9fccf1ff61c99026..c1bfa8eddc4d638c55db54cfd9b= 6407f47594b4c 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -280,5 +280,8 @@ int main(void) DEVID(coreboot_device_id); DEVID_FIELD(coreboot_device_id, tag); =20 + DEVID(serdev_device_id); + DEVID_FIELD(serdev_device_id, name); + return 0; } --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 5688A340293; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=e/58wSYhF7f5lInXxpnd0BQ/UJmSr2TXmaOGnupujCNA9+AqMzJMznaJufAmlRlrvh7vomk8fSeg1Xr1oZLtvI4Lbx9GlZUt/k8uwgU/NFAopZMPQcVut4iQZM6bGRDhEvuoIeR5pl/ktpckXJuqtQqUsC11qqVpCQQbZHf13d4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=L7iVFg7sZFJXM/ApGg4k66iGAwt68odx4+E9YWY+cnY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XMo1SEq0cxZCG5W4lWoIfscAANcAC17G0j3XiOpT/btT+NgRGzbTyJf+R0zpEjVsNyKQ8xRQHJkOTBNUSpF+fcst2RHaMbj+BmeJ7gNo6iRDgyOtdIn4ep4QZ2HiXTG59ZgVuif3hw4LDcrxVI7QepUndKC1fV0nEJOjz8rhiD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jkar5/a0; 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="jkar5/a0" Received: by smtp.kernel.org (Postfix) with ESMTPS id 11EF9C19423; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=L7iVFg7sZFJXM/ApGg4k66iGAwt68odx4+E9YWY+cnY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jkar5/a0xV0XfBYLALRxb9FqHLFMf5G0T3DQfiYdsWHlKfuS0cL/XxFbHk5+ObGUd gWBSf9UXqPiR+AoilYJcC7LbEfmwhBRl/lQo9v+ONpG0cD2lbHxLSMQshPTmRH4LC8 GIP7Lf4PdsHg6La3kq1zJujMZr13SvyKtyWHfu9HEeUdVt0b8GlsZIbGvhRNKQeTe8 xcXBLiFadI1v/lsBhAwXGjoWs/sjMr6x632q0I6REW/RhkXBdYLcbnJHqin13IF1GS +wHGQrsE5/5oBqL3yNyIbuD0ndlnZ0ZxZL76DlWnpYV7WoMicFQm2ELL/c9BQmhEhR yjOrpQsSDW8Sw== 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 0A93BCCF9E3; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:15 +0530 Subject: [PATCH 3/9] serdev: Allow passing the serdev device name to serdev_device_add() 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: <20251112-pci-m2-e-v1-3-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5251; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=c+ZfFChOiwPXrgBo3Hm41yJ4twgPMWwihL2KydIW2hU=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2GuH9bSE/qLpnlL7qfWYHEJ9kMMpDh2IkZg ioAcrCMP6WJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhgAKCRBVnxHm/pHO 9V4xCACpKggi0h5EsAbWmO1W3x1wepvdIQr3nk0oqB8ZQCGLntg+/dBH3YvESuNvQx+eHq1ecDy cJEs6hUol9p8HzY4e/wBOxnCvBmvD0cUlixShwOQUIpKslW2fiIJhdYuXOu1524VGYS85GWtRk2 QT1cJ+1IpsxSmCTXiqPCoAICGWgZ4xU3/K3lIvJlXzGoyew4LMK3K6crX/RCr5B2KYcwfNa2A68 0mP9nGlvNLw+cKNCFfP2jv2rt9HNRAwgdJZYTQoVgn3qbsO/i0Zt5GhuGWqYxd97xkdp78VtW+v NOpygSfJ3jQK71/T0iPfQ1Dm5UDNO0u+7B4QBKl41P6CqrMR 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 Instead of always setting the serdev device name from 'struct device' name, allow the callers to pass an optional name and set it as the serdev device name. This will be used by the future callers passing the serdev device ID as the name. Signed-off-by: Manivannan Sadhasivam Acked-by: Ilpo J=C3=A4rvinen --- drivers/platform/x86/dell/dell-uart-backlight.c | 2 +- .../platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c | 2 +- drivers/platform/x86/x86-android-tablets/core.c | 2 +- drivers/tty/serdev/core.c | 13 +++++++++= ---- include/linux/serdev.h | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/plat= form/x86/dell/dell-uart-backlight.c index f323a667dc2d2c7dec9fb284515bc3b6b984b7b9..f076cfac2bc5ec14899d6622d08= 4bae2ffecfa3c 100644 --- a/drivers/platform/x86/dell/dell-uart-backlight.c +++ b/drivers/platform/x86/dell/dell-uart-backlight.c @@ -354,7 +354,7 @@ static int dell_uart_bl_pdev_probe(struct platform_devi= ce *pdev) if (!serdev) return -ENOMEM; =20 - ret =3D serdev_device_add(serdev); + ret =3D serdev_device_add(serdev, NULL); if (ret) { dev_err(&pdev->dev, "error %d adding serdev\n", ret); serdev_device_put(serdev); diff --git a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c b= /drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c index 8551ab4d2c7dbc3a8d0b2f50071d4460a3ee65e9..5e568fe1162d1563183713f8d5c= 71c59ff7667a1 100644 --- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c +++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c @@ -260,7 +260,7 @@ static int yt2_1380_fc_pdev_probe(struct platform_devic= e *pdev) /* The fwnode is a managed node, so it will be auto-put on serdev_device_= put() */ fwnode_handle_get(dev_fwnode(&serdev->dev)); =20 - ret =3D serdev_device_add(serdev); + ret =3D serdev_device_add(serdev, NULL); if (ret) { serdev_device_put(serdev); return dev_err_probe(&pdev->dev, ret, "adding serdev\n"); diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/plat= form/x86/x86-android-tablets/core.c index 6588fae303562b7dc9a1a8d281b167e44f0d3e84..96140f5d4f79240f44cb4530ee6= 3777f783c6aaf 100644 --- a/drivers/platform/x86/x86-android-tablets/core.c +++ b/drivers/platform/x86/x86-android-tablets/core.c @@ -316,7 +316,7 @@ static __init int x86_instantiate_serdev(const struct x= 86_dev_info *dev_info, in ACPI_COMPANION_SET(&serdev->dev, serdev_adev); acpi_device_set_enumerated(serdev_adev); =20 - ret =3D serdev_device_add(serdev); + ret =3D serdev_device_add(serdev, NULL); if (ret) { dev_err(&serdev->dev, "error %d adding serdev\n", ret); serdev_device_put(serdev); diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 2b5582cd5063a87c9a6c99f83a8ab071637eae57..76b89dd0720f89dbe34e205b905= ef24d9f94d770 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -121,14 +121,19 @@ static int serdev_device_match(struct device *dev, co= nst struct device_driver *d /** * serdev_device_add() - add a device previously constructed via serdev_de= vice_alloc() * @serdev: serdev_device to be added + * @name: name of the serdev device (optional) */ -int serdev_device_add(struct serdev_device *serdev) +int serdev_device_add(struct serdev_device *serdev, const char *name) + { struct serdev_controller *ctrl =3D serdev->ctrl; struct device *parent =3D serdev->dev.parent; int err; =20 - dev_set_name(&serdev->dev, "%s-%d", dev_name(parent), serdev->nr); + if (name) + dev_set_name(&serdev->dev, "%s", name); + else + dev_set_name(&serdev->dev, "%s-%d", dev_name(parent), serdev->nr); =20 /* Only a single slave device is currently supported. */ if (ctrl->serdev) { @@ -544,7 +549,7 @@ static int of_serdev_register_devices(struct serdev_con= troller *ctrl) =20 device_set_node(&serdev->dev, of_fwnode_handle(node)); =20 - err =3D serdev_device_add(serdev); + err =3D serdev_device_add(serdev, NULL); if (err) { dev_err(&serdev->dev, "failure adding device. status %pe\n", @@ -692,7 +697,7 @@ static acpi_status acpi_serdev_register_device(struct s= erdev_controller *ctrl, ACPI_COMPANION_SET(&serdev->dev, adev); acpi_device_set_enumerated(adev); =20 - err =3D serdev_device_add(serdev); + err =3D serdev_device_add(serdev, NULL); if (err) { dev_err(&serdev->dev, "failure adding ACPI serdev device. status %pe\n", diff --git a/include/linux/serdev.h b/include/linux/serdev.h index ee42e293445d928a311bd3c120e609214f89a5dd..3b87909b199af74d619b4fe548c= 5c9c994e7bc15 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -163,7 +163,7 @@ static inline void serdev_controller_put(struct serdev_= controller *ctrl) } =20 struct serdev_device *serdev_device_alloc(struct serdev_controller *); -int serdev_device_add(struct serdev_device *); +int serdev_device_add(struct serdev_device *serdev, const char *name); void serdev_device_remove(struct serdev_device *); =20 struct serdev_controller *serdev_controller_alloc(struct device *host, --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 BB53B34250A; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=qyVWPPRFDwDEDcXPNJBac5P3xFJ6cYGsmQcsTl2i91ux9tRW6iWbukzhrOpiMbwiY4IDQ05xs4UhYkmL4Sq0PE2RAO44MpERmdzirQSWxW51RIIT86KhKvgnRPMnbrquLCxCOaSygtjXzWketQ4/0AVMuBruap1V5e5cWsXz9nA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=rj+IFYGKeJfDzxckX3PGPHFr5wotsP660cnZOKlfZFg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V5pMxrckHTy2rDRqeX9oLlu1H94724JfdhwliQUmsLfYs5dijznfpxZRrLLqgcE/MCa70Y600Z9EFNegfmevUbQdHSnN/bgSb/woohI6LxXzPDZRelWBKH0g/Rry/4yr2/mCPppp2+NwDLe7nwEaycMnqvsNarK0wIvSr92wZjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IzOG/DUc; 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="IzOG/DUc" Received: by smtp.kernel.org (Postfix) with ESMTPS id 20586C4CEF5; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=rj+IFYGKeJfDzxckX3PGPHFr5wotsP660cnZOKlfZFg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=IzOG/DUcctvNONaiWO9ZAUePewvx/rIv57xmb+3pUEGdZnlWE7Ib3qU4/YoaIkNMT XNMhJG/XUFRWs42aFXA8CrZLOy7oe8GTDeTth9NIXZFNX7z9v+jYIoKt+L1Ou6tTkr 75edRpFF/hCtFCBrvSFe0SwvlnBBU0jVBFUEuD9j7eyKyOCkpVw7Ixx+tafb/cF7kw IxkaBjqVjCWvsqPHxyyCo3Jhg/Uf2Etbm9k57WyFrERZxUfl35xGwUjPr7J2OPj4sh oPDd4CwbSI+9SNlWWd4NT5zd4K1gRVgzXk1emSwhYlxo3hN6v2jO9YE4XDVy+QCQ6v UXdJuxcusCg0w== 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 1A19CCD13CF; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:16 +0530 Subject: [PATCH 4/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: <20251112-pci-m2-e-v1-4-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2067; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=3pwzkJmlXdBFxxGS+RaMwatS2zudeS9caO7fvQLIo5w=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2GI3r/6TwqdIifoUBAM4qi4EMRgZaCdsyWL PH1oUP9u8yJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhgAKCRBVnxHm/pHO 9Us5CACN1KOmM1rzu6sdAAnL/OTe84uXCKe+E0PGnLOCIAl6PrhySDsebbMIqIYklB41ba8SbvK FpKt7oODtjLdgzulqVewmUdfOTegPDSmnrG+Fl2U9PYehjU7wIpwaRA/zD9K7p3GMyczrBHYFuk TbwpO49bAKtfeFBhlf4/2D3in0rLgLtTSLDW2WyRic2vlStpo1O8cty0cCOAFjWBDWZGsMOXRjn kQb5lYhds4vksbnQRKpZvMl2erofXcWpfRqqs58TUqiuiIME9sNuYKvKyXk5boI0FbFGifgTJY8 qPFQ+rdrPbrcXWDvumdkRZN3PLpNCOmi+oTleNL3Jn2sY9C4 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. Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 16 ++++++++++++++++ include/linux/serdev.h | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 76b89dd0720f89dbe34e205b905ef24d9f94d770..f90095cb778f2374303f98809d1= 639a000e0d9e0 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -530,6 +530,22 @@ struct serdev_controller *serdev_controller_alloc(stru= ct device *host, } EXPORT_SYMBOL_GPL(serdev_controller_alloc); =20 +/** + * 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. + */ +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); + 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 3b87909b199af74d619b4fe548c5c9c994e7bc15..ee483f6b11b09ef4c8ad6f98718= aa79afda6e826 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -340,4 +340,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 +struct serdev_controller *of_find_serdev_controller_by_node(struct device_= node *node) +{ + return NULL; +} +#endif /* CONFIG_OF */ + #endif /*_LINUX_SERDEV_H */ --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 8C485341642; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=ZWQk9UWlNF3UOZTaGncnNR2O3VARQbaRZSacdFpLAk3JVfXTy+jJsravbEBuLECGCnj9ZxCIPYd0ganCGmHTq92RtvPeuji/0mZ5XZnlkrdHa8hKgO50JRmBYxU+kRzNrVXquxWOeCBXwGAuX1NArmgYZKRmyvrdVZn9mBkYQ7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=ZTNyhNFf+p9S6BsXERBUufVxby0L/rriRpDnCjmebu0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y+HfB4367+6JE4M6txICxo34XPeUx+Bjo6QFObxj/pylCgURepi/rwq+WYC/gF4lMtGI8nyLzd3owH3ARxIqJdgYoAAFhl+h/SPha/g/T0ujmyHpB9aurNCE1ArQJTkSAVJRehyXJOk4Ahd7+xISlNIjq6Zdr86WZij4asE2Df8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c+eWFXLV; 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="c+eWFXLV" Received: by smtp.kernel.org (Postfix) with ESMTPS id 30C6DC4CEF1; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=ZTNyhNFf+p9S6BsXERBUufVxby0L/rriRpDnCjmebu0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=c+eWFXLVVteOvv4fIzjsKblkThHYhc5ibkkgVCrxCYjAbRU9sZvC0W2NsRkPWDD7L wuClsqH0O8DEEqHgFdIYFdlSUl8pHqEd304fkB9tzkRiyoAB3sB227XVjrFfmi+Qfc W6BYl+TaXj5RSovSCewKJgS5/LMm2qCcM7+oVgBhmZMprkoCCcFiahsh7l3EsTaEh5 VILyCGIZl0HDu9lhuqQiv6fwfsI4uhB8L1aV02m+vxyXbd2nlqO9Gjk11WMHjA4kcL 64fIVPVSnsjRLCIoljDLNCShdloLJoEoCYX4DyXAC9QVKtTOC6gSiNl1vsCeeBB57k JVQBrC2Wh7H8g== 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 28BEBCD13D3; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:17 +0530 Subject: [PATCH 5/9] serdev: Add modalias support for serdev client devices 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: <20251112-pci-m2-e-v1-5-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3104; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=d3crWSGCGUGn4wtoYTdDJMgOBARJSAYtgVh6kQhItYQ=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2HLBj0atRdQkoYoEtIlsRq/2nfEpNLLTmK8 0Ee8SHCPp2JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhwAKCRBVnxHm/pHO 9ccoB/9JulXVNBQpte5g04Zu3cGVEtybP7nbcJRotlJ106/5GvyjbUjrShqI832UjbWtjgtNtc3 myVXAVbBbIRPoaVWY356o/T3owMpyRDkiLZk1NFJ0RVInasTwuDM+GXTT3URoLQkCYbusx7nlfn pP+eHsk+ZjcXWswcI+pRcm1d63s65LwpVHyeZlcxQv8r/cg/MbUp/PMEZiSHw/e4Ka3pprDytt7 2Osv6Mynw2x9nJ5M+sb3n1u0NRLnqeM/D5s/sPFAwyMHsCHy2VVabnJSwo7BsY/opFJ4jUa1c/k ryGpgpPFOpTHT7cFdpd8gXslxG4YoRjCn7kZZjis3WqdlDMM 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 modlias support to serdev so that the serdev client driver can be autoloaded by udev when the serdev client device gets created. Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 15 +++++++++++---- include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index f90095cb778f2374303f98809d1639a000e0d9e0..8c2a40a537d93f4b9353a2f128c= df51b521929b1 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -34,7 +34,11 @@ static ssize_t modalias_show(struct device *dev, if (len !=3D -ENODEV) return len; =20 - return of_device_modalias(dev, buf, PAGE_SIZE); + len =3D of_device_modalias(dev, buf, PAGE_SIZE); + if (len !=3D -ENODEV) + return len; + + return sysfs_emit(buf, SERDEV_DEVICE_MODALIAS_FMT "\n", dev_name(dev)); } static DEVICE_ATTR_RO(modalias); =20 @@ -48,13 +52,16 @@ static int serdev_device_uevent(const struct device *de= v, struct kobj_uevent_env { int rc; =20 - /* TODO: platform modalias */ - rc =3D acpi_device_uevent_modalias(dev, env); if (rc !=3D -ENODEV) return rc; =20 - return of_device_uevent_modalias(dev, env); + rc =3D of_device_uevent_modalias(dev, env); + if (rc !=3D -ENODEV) + return rc; + + return add_uevent_var(env, "MODALIAS=3D" SERDEV_DEVICE_MODALIAS_FMT, + dev_name(dev)); } =20 static void serdev_device_release(struct device *dev) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetabl= e.h index 70c54c4bedba2fcb8f5eb37c2d9ede05d5d91188..dad9637cf28552c3423affc4eb2= 49efa6ba05514 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -976,6 +976,7 @@ struct coreboot_device_id { kernel_ulong_t driver_data; }; =20 +#define SERDEV_DEVICE_MODALIAS_FMT "serdev:%s" #define SERDEV_NAME_SIZE 32 =20 struct serdev_device_id { diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index b3333560b95ee998fbe5bdc9ed380847962d1bd1..27e9f7c718c4d48ca5dbd553849= 0529119df9509 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1371,6 +1371,13 @@ static void do_coreboot_entry(struct module *mod, vo= id *symval) module_alias_printf(mod, false, "coreboot:t%08X", tag); } =20 +/* Looks like: serdev:S */ +static void do_serdev_entry(struct module *mod, void *symval) +{ + DEF_FIELD_ADDR(symval, serdev_device_id, name); + module_alias_printf(mod, false, SERDEV_DEVICE_MODALIAS_FMT, *name); +} + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { @@ -1467,6 +1474,7 @@ static const struct devtable devtable[] =3D { {"usb", SIZE_usb_device_id, do_usb_entry_multi}, {"pnp", SIZE_pnp_device_id, do_pnp_device_entry}, {"pnp_card", SIZE_pnp_card_device_id, do_pnp_card_entry}, + {"serdev", SIZE_serdev_device_id, do_serdev_entry}, }; =20 /* Create MODULE_ALIAS() statements. --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 B9642342507; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=A5oYOUt16cDvCPmlhZ+m64HQry+DSQJUZ3dHzaVyTsiBNDaAwdPFejfL1NmKg2LCbOFg9PYhRqD2+aIGho1UAxl5oAoBX/cfZ0T48cf09IK9hzP9+WxnLOpztGUeOuoLpua7UtVbwB9gGt8zWf1af8zAoiQHGiUvhcIdeWjHizg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=BSF6pgHwRJ8wKRNwr418rTD4ufEtxZ2p1Im79cwxzV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oApVg7ajpgxDNOQR1MvB6dRiK8kmQm1WO4gGtwKdHwK4b5jLwg/RmsTAqox+vELACiZhgH9pN4AnM4RgoYPh8w0n4sDd8YhkPr6G7oOhGWU/Ob1yinjGfHiYTrBLLeoWf9mM9bSSflmB7BXevs10/Lf6t/tLJGquaCAR9BsnqyU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z+kgUaAP; 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="Z+kgUaAP" Received: by smtp.kernel.org (Postfix) with ESMTPS id 40F42C19421; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=BSF6pgHwRJ8wKRNwr418rTD4ufEtxZ2p1Im79cwxzV4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Z+kgUaAPEnBSn83dE5sic6dzmfi26DDd05Jb/aMOfrFa02eXfQAaRBR8gJv7wwABK NSeYUVhHujfgfPy65QPOy2aG2xmfxpYZ0mOsVgS2z9Bpb9zMtQZXbA7LQpwV+h1kMA B/BaRARCqz78Wk9Q4+vTkp4wt9HS32wrNtVyTa7itnIfDpNzO8BIdeKYUkbxvlQzwg HOxB8vI8EFMic++Gx08VLXQ6LDTNZfQh+98pYRTaTrHBUwWHP3RHyV55CJRwdSUyxW m/kyRfpddntflRYGcoflMSaG/hf8VgdjM8QhTO6YY7CdG0XnpZGcZNKKO5JPhS5DH4 gkIhXtosM/s5A== 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 37F9DCD1297; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:18 +0530 Subject: [PATCH 6/9] serdev: Skip registering serdev devices from DT is 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: <20251112-pci-m2-e-v1-6-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1489; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=9l0vV6HXXlRQhGb6LPV2j9zLb+eL0Fpf0v/SXfsrOaY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2HYIFtN5v5bNyD8H02BJPR+1uACNYqLJQdu pU9f/L5A+2JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhwAKCRBVnxHm/pHO 9RwgB/47EH+jLOBR8bp8aP5M5wGWY4SysKJtZO4fkj97iCzy/SsK9prWiuuaBDNz/F5VfGuxdtE Kin9UH7qcWGK/P3pKH7xvC9p6Mm8NlJjS6oni2Z3zPLX6VllhharFcxCAoHHjXEvdbaw4EPGomr S7Bq9ooyzXH3s3+GqPs7RdiqKCh3HIEhlt1xa550XiX7bCQDgjrsNVHqLy4jWaCrdWhfQ74eZlV pJaVlLxPif2eLcTh562fAWZ2dA/Oknb7ywQKC0VSBcQyZqRuMwRMHr0eZOkcPwWg8i7QsB5jXun UbBPcW1fXEPr3OZDqWb5SWwrc8t+apPpHsnLxxflovrsrkqs 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 will be created dynamically by the connector driver. So skip registering devices from DT node as there will be no statically defined devices. Signed-off-by: Manivannan Sadhasivam --- drivers/tty/serdev/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 8c2a40a537d93f4b9353a2f128cdf51b521929b1..1378587d386356ca4415fa455b2= ee722b5e44d3e 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -560,6 +561,15 @@ static int of_serdev_register_devices(struct serdev_co= ntroller *ctrl) int err; bool found =3D false; =20 + /* + * When the serdev controller is connected to an external connector like + * M.2 in DT, then the serdev devices will be created dynamically by the + * connector driver. So skip looking for devices in DT node as there will + * be no statically defined devices. + */ + if (of_graph_is_present(ctrl->dev.of_node)) + return 0; + for_each_available_child_of_node(ctrl->dev.of_node, node) { if (!of_property_present(node, "compatible")) continue; --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 A7188341ACA; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=YJAz/qzukTf6kbvScbUC1CHADt9/slbz6c1UOfEqEINf3L/g/RuG3P5df8woYWUFqe/uWPu85lAMBsjdmsvKaYOjYMksrU6LbktZEdXUj6JjLATx0hfGOqa/Z9JizzoHEm9SjJMIbZ3uOAIRocHdVZwtbd1m3RszWe0T6jNWBIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=2UqdtptdBU2Ixkj2Mo9/MHhheDA/CJ3F+dFzasuy1xo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pbmyKaPzBT1++IALrrmR9+yAzdqf30gFnTxm1CEMHjaKfhZ3dZL3jtKyn3FFEOpHMFaPgThjmMkJITKMbcIhzaTdf7uTgSFDdwm2Gnny1MC1Yk5oX/FHqmw45Zty2SYt+rlq959DLnm7hCV+VjGP2bkWk6ur0Um2YiS3XV6hNQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WQA92Js0; 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="WQA92Js0" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4EFF3C19422; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=2UqdtptdBU2Ixkj2Mo9/MHhheDA/CJ3F+dFzasuy1xo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WQA92Js0w72MQOUczTasWwm2xlPxoQQuD9RIkfRgljxRVBgRGO7EqQ+3MaS4tPlbj +WrmcusZwVDML4m1U+Gk2Pcp4OXEJI3y2LL24Wo9pNfEy3jL5/gH3i1QTymgdYpUVM 4CV4pSt0jiANM81if0pkuYihmV1ji8kBWYZ1vlk5KWr8sNaEJoqzeQuMevQ3egUQjI oWiV83tZ05moTpWoa90DGFUJnPg5Olc6nJJf/K8J/xNmqeGZmAOzPeVdeI63d8b3kA 1Z9dpHsYeLwOgxDZQc4kofK2eHAC7lSBU65RinBe9kfeGV6maRk1VTE2kIINqPzCbM OfP/ibbIk3wZQ== 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 4758FCCF9E3; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:19 +0530 Subject: [PATCH 7/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: <20251112-pci-m2-e-v1-7-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7404; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=s83ZX+5+i5VDAPG771sdizpD1jqft8fr1qXw80NJhok=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2HAPeWlv7bxfpUlwZrq2eqL3B2nVw3qpmIH bgfv2cgTneJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhwAKCRBVnxHm/pHO 9e5yB/9c2QjpAQ2X7j7qFmJw54Xgp6/fZhxz1XrqzykT4/6U2xPB6br5UlaEPsdYY0S4tWN/rNl Bdh8O/MXRVpNH62jeumxFECbruUSWlZZcRy7RGtJLF32xcF9yKdeKtWrogWd6BiSL8uIlb2EdK7 Bqyv6K8PCaXmjL6LiY9JD3szgTVH/VGJBbt4n31cboa4/e+yToAKTrpy+ssx0JWtPAq5G2ZObTU U3vttxrc9umk6WzybukzRadJai0JEpfc6RMsU8SJ8481FmJsw1e73JPioel5ZnHNOf0cV5bVjS4 D2+lpTm6sXpYBVRfip9vTMlEH7j+N3GAznvKmzDctuXFnnou 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 along with additional interfaces like I2C for NFC solution. At any point of time, the connector can only support either PCIe or SDIO as the WiFi interface and USB or UART as the BT interface. 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. Signed-off-by: Manivannan Sadhasivam --- .../bindings/connector/pcie-m2-e-connector.yaml | 154 +++++++++++++++++= ++++ MAINTAINERS | 1 + 2 files changed, 155 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 0000000000000000000000000000000000000000..91cb56b1a75b7e3de3b9fe9a753= 7089f96875746 --- /dev/null +++ b/Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml @@ -0,0 +1,154 @@ +# 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. + + 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/SDIO interface + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: USB 2.0/UART interface + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: PCM/I2S interface + + port@3: + $ref: /schemas/graph.yaml#/properties/port + description: I2C interface + + oneOf: + - required: + - port@0 + + 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 controlled connection to W_DISABLE1# signal. This si= gnal + is used by the system to disable WiFi radio in the M.2 card. Refer, = PCI + Express M.2 Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1 + + w_disable2-gpios: + description: GPIO controlled connection to W_DISABLE2# signal. This si= gnal + is used by the 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 + + led1-gpios: + description: GPIO controlled connection to LED_1# signal. This signal = is + used by the M.2 card to indicate the card status via the system moun= ted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + led2-gpios: + description: GPIO controlled connection to LED_2# signal. This signal = is + used by the M.2 card to indicate the card status via the system moun= ted + LED. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.2 for more + details. + maxItems: 1 + + viocfg-gpios: + description: GPIO controlled connection to IO voltage configuration + (VIO_CFG) signal. This signal is used by the M.2 card to indicate to= the + host system that the card supports an independent IO voltage domain = for + the sideband signals. Refer, PCI Express M.2 Specification r4.0, sec + 3.1.15.1 for more details. + maxItems: 1 + + uim_power_src-gpios: + description: GPIO controlled connection to UIM_POWER_SRC signal. This = signal + is used when the NFC solution is implemented and receives the power = output + from WWAN_UIM_PWR signal of the another WWAN M.2 card. Refer, PCI Ex= press + M.2 Specification r4.0, sec 3.1.11.1 for more details. + maxItems: 1 + + uim_power_snk-gpios: + description: GPIO controlled connection to UIM_POWER_SNK signal. This = signal + is used when the NFC solution is implemented and supplies power to t= he + Universal Integrated Circuit Card (UICC). Refer, PCI Express M.2 + Specification r4.0, sec 3.1.11.2 for more details. + maxItems: 1 + + uim_swp-gpios: + description: GPIO controlled connection to UIM_SWP signal. This signal= is + used when the NFC solution is implemented and implements the Single = Wire + Protocol (SWP) interface to the UICC. Refer, PCI Express M.2 Specifi= cation + r4.0, sec 3.1.11.3 for more details. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key E connector for WLAN/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>; + w_disable1-gpios =3D <&tlmm 117 GPIO_ACTIVE_LOW>; + w_disable2-gpios =3D <&tlmm 116 GPIO_ACTIVE_LOW>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + endpoint { + remote-endpoint =3D <&pcie4_port0_ep>; + }; + }; + + port@3 { + reg =3D <3>; + + endpoint { + remote-endpoint =3D <&uart14_ep>; + }; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 9b3f689d1f50c62afa3772a0c6802f99a98ac2de..f707f29d0a37f344d8dd061b7e4= 9dbb807933c9f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20478,6 +20478,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.48.1 From nobody Sun Feb 8 13:10:39 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 BC97E34250C; Wed, 12 Nov 2025 14:45:31 +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=1762958731; cv=none; b=jYqJLEU6tLgkETt7gFFZKkvj8vhGc9wL3Dyb9545rIGO2kswtlarIPZF5UpVO5FjM2o5CzF9+WjMQtSk1/u8e4qFc0OvcEjUu87RHRpwBTXc1nn58VNqlqev4pMmwxrw4a2u6uGDF0CrkrMOTEeqaaDwYV2d/Yhy9ABnVawaE/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958731; c=relaxed/simple; bh=UIyVuuxmdNWaQhSJYIjG9EwjXu8WQiu2r7LNT3ovXmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CZWfiesq46SreJQzVUykxbZtd5zU1CeLkQwWsfqZdYl4ryDmy8jrKbdIFDbrdCDb+LzoEuUMEfYkJ2PwzHHZ565SDnyPjEVfT2FufSOf/n1jfEhtN24z3QZIGLJqu1i0Ywc3OpQsw7zuVJfRBmrd/Mmbdugl0oJIwp3NKU20O4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G7TcIa0M; 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="G7TcIa0M" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5D7D8C19425; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=UIyVuuxmdNWaQhSJYIjG9EwjXu8WQiu2r7LNT3ovXmk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=G7TcIa0M7BgO+w+aWcSqWxEyqms9md1DwXPhJP/8O6lvj0mvncvKeRVkyxOCgc2sA Su5uQY9ylyJCUSMqNMe0Z29Ve/NcaaColnygOl59zZGu6tQpebbwA5VoSgbIrtg3m5 kuu3OXX48sc/IXqXIY7aqe0qhUyrRW8TurOCYASpmM1QqfCCjG0UE7DFf3v+kKnOLq QVCVZSMyS49cNVSiFJRfxBfeLmhowm1ZAwUA6ykTgryFrrghf89fH3tFjEm0BJoDTc eEavvPHlZkpduCwQ8OuDanq9FqVdlrG6WfN9UFYM4moeU88Rd4g3FieNGF4Gg/P/d1 h4RrgNL1G1w5g== 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 56F18CD13CF; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:20 +0530 Subject: [PATCH 8/9] Bluetooth: hci_qca: Add support for WCN7850 PCIe M.2 card 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: <20251112-pci-m2-e-v1-8-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2696; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=BvmMTIXQ1GNDFtswjVs+6kgwmDbVSZjbebNDSNmVGWY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2HGzyZfvK1wWuuh2R0+XpgrtuddR6FBBMSs h9ujHKvehqJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhwAKCRBVnxHm/pHO 9ZJMB/9CsIHjXFLhSxMyD3KH42rNli77Z0cMlgKT76aBTmR1yHjj4rM5kkkP9+YqQAIK9g4dvKj IhkioadhbwsVBbgv0No2SGnsLJesOHwDW1/Q4OebgTR4Osg78Iai2xvxB6ybVmW+J6O3tjaDD0q 9JzWdanKbxsb3neIa4HtYsw9W7ORxGryz49PoqcK5wdXLCaIV64MbruswFeUp8ZG1BA30MgCzT9 y1cCjIgjBov6xWYWpuGK8J7PpHe8NbfwoUfv50vZMwZXTKNS8zVdy7n7LNVNBV9R+NxLK5Xh+2t bGn/mmnez+yaIgjVC7MDJ1nhWAcFKF3DMa2D4HnzUFGqMoje 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 The WCN7850 PCIe M.2 card connected to the UART controller exposes the 'WCN7850' serdev device and is controlled using the pwrseq framework. Hence, add support for it in the driver. It reuses the existing 'qca_soc_data_wcn7850' driver data. Signed-off-by: Manivannan Sadhasivam --- drivers/bluetooth/hci_qca.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4cff4d9be3132561ee9bae4ddf2c8ac0bc13ecd7..09bfb3bba93698f496947775bf6= b31f2f20279f1 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -2344,6 +2345,9 @@ static int qca_serdev_probe(struct serdev_device *ser= dev) =20 qcadev->serdev_hu.serdev =3D serdev; data =3D device_get_match_data(&serdev->dev); + if (!data && serdev->id) + data =3D (const struct qca_device_data *) serdev->id->driver_data; + serdev_device_set_drvdata(serdev, qcadev); device_property_read_string_array(&serdev->dev, "firmware-name", qcadev->firmware_name, ARRAY_SIZE(qcadev->firmware_name)); @@ -2384,6 +2388,15 @@ 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)) + qcadev->bt_power->pwrseq =3D NULL; + else + break; + } + if (!device_property_present(&serdev->dev, "enable-gpios")) { /* * Backward compatibility with old DT sources. If the @@ -2740,6 +2753,12 @@ static const struct acpi_device_id qca_bluetooth_acp= i_match[] =3D { MODULE_DEVICE_TABLE(acpi, qca_bluetooth_acpi_match); #endif =20 +static const struct serdev_device_id qca_bluetooth_serdev_match[] =3D { + { "WCN7850", (kernel_ulong_t)&qca_soc_data_wcn7850 }, + { }, +}; +MODULE_DEVICE_TABLE(serdev, qca_bluetooth_serdev_match); + #ifdef CONFIG_DEV_COREDUMP static void hciqca_coredump(struct device *dev) { @@ -2756,6 +2775,7 @@ static void hciqca_coredump(struct device *dev) static struct serdev_device_driver qca_serdev_driver =3D { .probe =3D qca_serdev_probe, .remove =3D qca_serdev_remove, + .id_table =3D qca_bluetooth_serdev_match, .driver =3D { .name =3D "hci_uart_qca", .of_match_table =3D of_match_ptr(qca_bluetooth_of_match), --=20 2.48.1 From nobody Sun Feb 8 13:10:39 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 D307134252D; Wed, 12 Nov 2025 14:45:31 +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=1762958732; cv=none; b=Ng4VohzEkOrhS6TEcdjvydgBsEohdeTDaMaiKfksAoZxIQ5PuPuEPIopZN+3Y3GJ/mlAoNrbAY7xUY8tIy6c3JdCaIYznXPdi8QjMcEvyMUX8HEluuqWgWP8KyWTtFmTVgEdIqHW0yKVgtl+Pwk0OxtTvKdV3KOl50jIsHepktc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958732; c=relaxed/simple; bh=OPT3HzX6rth7Z03RPDVjbn2yRgXgLFRclo/oMJ75U+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rvveelTFs2eg4H3XeA2YuE4E0Afmekh/lUtiJu2YTNpaqAdEKNi+9vTI28MgezLocaXtj92p9IE3ETj/HFK1vGV+3XIHwmkicyVgFF7xrpe+Wi+BzCzdrc5frVoC3T1/LCWgoVrCz8DxJKHVObsdEmZ7TfosS1BGbtjfRuvMbNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SNthpp5V; 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="SNthpp5V" Received: by smtp.kernel.org (Postfix) with ESMTPS id 856B0C2BCB3; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762958731; bh=OPT3HzX6rth7Z03RPDVjbn2yRgXgLFRclo/oMJ75U+M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SNthpp5V7cfGGwTz4anwMC0G7v25DZuquWbYqV31APrB7pQ3BgUmnB5ugNuS0US8f mBZGClhJmBSYVRAGwCmiXEBuVMghDkWo1dRS3t3LM/NyTfXpA0OET1g0phZnyfgHxT vTFJFXAexfLKgyBlv6udNJweOePTlhL7PzYdVtehdmcs88RZBWs1RoWP4KpxIsk1e/ rRU7+GUhWLy0AFaXDGEXzGDTpzbO5+0sWCX9HrArxOkCAauL6o5PozOW+a89BHIjS0 AADsQ7WB5vh7sLTWnGKwxWUuh+wfrbpg4uKVC1EGVPWhLnwlp3OZiP9sRhZedpqkDd gwckAXGvgoFSA== 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 7EC29CCF9E3; Wed, 12 Nov 2025 14:45:31 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 12 Nov 2025 20:15:21 +0530 Subject: [PATCH 9/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: <20251112-pci-m2-e-v1-9-97413d6bf824@oss.qualcomm.com> References: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com> In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@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 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 , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11328; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=q5uSXLIpfwsDuv0DSFUAwdt87LFm61A3HFbDieiJ1GE=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpFJ2H95ucL4njmYyEkEHnS45DIJdhiGeRjbJqx 893431MtgmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaRSdhwAKCRBVnxHm/pHO 9XMkB/9GSOvGjKw5cEN3vSQkgcFTqgdh9f9qv29g0atX1E3CLGRm9GFbrzPOmx8UtETpuEgn2Cm N6dJaU9OcVXlXJOX8h/d3wyWQdfHA4M4LJjxHMI26Nl8X5Zn60bT4U1O4OffwR4D0Dv4+D+SxTj X9j9dEcTCD43w9ZTHXFsj8JdvzrzWeYHCjkNlZCkbVHGDrJ3at4mJSLoI6fC3lQXvRMb6jAmHRk GsnIG8bQ/SFiKQmXsMAFWVz/Zk9GsyOrn7pKo8fXwYsQppteu2sO4vvWKCdgemNUx4+twNCqVS8 Q6z5VVigobd9Q8SvkdpIVnqvAbe9v5YQ+VDbcPwkVsKANz+v 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. For supporting Bluetooth over the non-discoverable UART interface, the driver currently creates the serdev interface 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. Signed-off-by: Manivannan Sadhasivam --- drivers/power/sequencing/Kconfig | 1 + drivers/power/sequencing/pwrseq-pcie-m2.c | 218 ++++++++++++++++++++++++++= +++- 2 files changed, 213 insertions(+), 6 deletions(-) diff --git a/drivers/power/sequencing/Kconfig b/drivers/power/sequencing/Kc= onfig index f5fff84566ba463b55d3cd0c07db34c82f9f1e31..29bd204319cc1636fb424f2916d= 7f570af905b54 100644 --- a/drivers/power/sequencing/Kconfig +++ b/drivers/power/sequencing/Kconfig @@ -38,6 +38,7 @@ config POWER_SEQUENCING_TH1520_GPU config POWER_SEQUENCING_PCIE_M2 tristate "PCIe M.2 connector power sequencing driver" depends on OF || COMPILE_TEST + depends on PCI 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 15659b009fb3e01227e40f26d633f675bc2af701..4b5adb3f731cd5e0f69344868f8= 8329ceba70539 100644 --- a/drivers/power/sequencing/pwrseq-pcie-m2.c +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c @@ -5,14 +5,17 @@ */ =20 #include +#include #include #include #include #include #include +#include #include #include #include +#include #include =20 struct pwrseq_pcie_m2_pdata { @@ -25,17 +28,20 @@ struct pwrseq_pcie_m2_ctx { const struct pwrseq_pcie_m2_pdata *pdata; struct regulator_bulk_data *regs; size_t num_vregs; + struct gpio_desc *w_disable1_gpio; + struct gpio_desc *w_disable2_gpio; struct notifier_block nb; + struct device *dev; }; =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 @@ -44,18 +50,92 @@ 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); + + gpiod_set_value_cansleep(ctx->w_disable2_gpio, 0); + + return 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); + + gpiod_set_value_cansleep(ctx->w_disable2_gpio, 1); + + return 0; +} + +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); + + gpiod_set_value_cansleep(ctx->w_disable1_gpio, 0); + + return 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); + + gpiod_set_value_cansleep(ctx->w_disable1_gpio, 1); + + return 0; +} + +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 { @@ -63,11 +143,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, }; @@ -95,6 +185,102 @@ static int pwrseq_pcie_m2_match(struct pwrseq_device *= pwrseq, return PWRSEQ_NO_MATCH; } =20 +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 device_node *remote; + struct serdev_controller *serdev_ctrl; + struct serdev_device *serdev; + 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. + */ + remote =3D of_graph_get_remote_node(dev_of_node(ctx->dev), 0, -1); + if (!remote || (remote !=3D pdev->dev.parent->of_node)) { + of_node_put(remote); + return NOTIFY_DONE; + } + of_node_put(remote); + + 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= ) { + remote =3D of_graph_get_remote_node(dev_of_node(ctx->dev), 1, -1); + if (!remote) { + of_node_put(remote); + return NOTIFY_DONE; + } + + serdev_ctrl =3D of_find_serdev_controller_by_node(remote); + of_node_put(remote); + if (!serdev_ctrl) + return NOTIFY_DONE; + + serdev =3D serdev_device_alloc(serdev_ctrl); + if (!serdev) + return NOTIFY_DONE; + + ret =3D serdev_device_add(serdev, "WCN7850"); + if (ret) { + dev_err(dev, "Failed to add serdev for WCN7850: %d\n", ret); + serdev_device_put(serdev); + return NOTIFY_DONE; + } + } + break; + } + + return NOTIFY_DONE; +} + +static bool pwrseq_pcie_m2_check_remote_node(struct device *dev, u8 port, = const char *node) +{ + struct device_node *remote; + + remote =3D of_graph_get_remote_node(dev_of_node(dev), port, -1); + if (remote && of_node_name_eq(remote, node)) { + of_node_put(remote); + return true; + } + + of_node_put(remote); + + 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 void pwrseq_pcie_m2_register_notifier(struct pwrseq_pcie_m2_ctx *ct= x, struct device *dev) +{ + int ret; + + /* + * Register a PCI notifier for Key E connector that has PCIe as Port 0 + * interface and Serial as Port 1 interface. + */ + if (pwrseq_pcie_m2_check_remote_node(dev, 1, "serial")) { + if (pwrseq_pcie_m2_check_remote_node(dev, 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) { + dev_err_probe(dev, ret, "Failed to register notifier for serdev\n"); + return; + } + } + } +} + static int pwrseq_pcie_m2_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -122,6 +308,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 config.parent =3D dev; @@ -137,6 +333,12 @@ static int pwrseq_pcie_m2_probe(struct platform_device= *pdev) "Failed to register the power sequencer\n"); } =20 + /* + * Register an optional notifier for creating protocol devices for + * non-discoverable busses like UART. + */ + pwrseq_pcie_m2_register_notifier(ctx, dev); + return 0; } =20 @@ -145,6 +347,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.48.1