From patchwork Tue Nov 12 16:52:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13872534 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012034.outbound.protection.outlook.com [52.101.66.34]) (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 C05902141A8; Tue, 12 Nov 2024 16:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.34 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731430353; cv=fail; b=QdQNmxEEvHqXMDXDpYfxyM7irXdeVKSwCphkXLwvxgx1Attm4cAC0EUcPm2+bkfTMnf99r6urE75TUdzhQFY6H9H8J/IoMmb/Jz8ymWsmy36a7XT9O1jUG6ll+oYZLMJss1hx39yQz86SkluL/tY5IW4n8cn+057taqd07Y8sMI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731430353; c=relaxed/simple; bh=JAPK3bGdhfGqrsoR9koYophADpQ1m2fjbRKgX4s6sn0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=dn5a51fOmIKmQDQRZbLi4pKfFPG4bJNb0ibGaP0RK4KQ9EvD+Hhoify8kxIAJ8o6NKBM97M0PQgkrkltCCV1hOvfyYfT2Hr0kUbzaOt3Ktp15wEXBaOMwakR7xJHC/1X6uf4q7uKqnKD0Bqftcpu/2XchlwVZo/QgMuDH4FDbl8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=SBcnmAwJ; arc=fail smtp.client-ip=52.101.66.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="SBcnmAwJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PpmWm6l04moXBed8Z+gpjAlaXKtleJluJVm3eFJde39a6mDj7mrhUyIFJwV32QtrDbQYqOOlDT7LhNyABzr7oMfaegbqmzTQNnFxHSlZheUwhClnTxSnB1Dr2fEISCbeagNml95Lh+7W/xEYwMpK+3IidHvXcmFbx8xqr3Yf36oAdT5zkiN1y2jb9OuTkp0Wl+0wQovfDsNMY/bJr0pASYdr8BJ7NLuYNsxiTK84jWX8w64A66BQOw2xzAq5sRdxaCOI7yspBm6u+OFuXCHvrUcrhl/7TJmSOSAaQHhy06uhUgUi/1JSCPVPKV7qqiOvou/LlVVTd878qtc9q6+u/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BjnOm9DtrWDtfEbRBI7BNxeeiqhv9ulpfh970Uk//hA=; b=qDGQjf/a3HpjdziSIJQ4xBLuJQgPvpSmaj3uh7iqo5rtnD11RBydaUz9r8hG3naLGW5ILvvnYLiL2JsXNANZX8ZTFXFF3+OM5ZxX2Rbddd0swPbuIBI2RNrCUosPpUKGtUAiL2P3ATkQgpzpLv4482xdAZJVHSp+9Qm/OcSo/g+bhy7ycPl3npkCAX7GIkr+OVaoICaVG5YhzgGqxcS4tkPHyBF6ZJ60FcARb3E/BS8ZSQP8SgXYYvn7dSFzHbFnTMCWdtGAJkIUtrnDB1BvoCyB+KxgZG7oYBQ/+/TAGVIb600299gr5fgt8AFN257SnapB5fu4B8M22u9BrNygHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BjnOm9DtrWDtfEbRBI7BNxeeiqhv9ulpfh970Uk//hA=; b=SBcnmAwJuFVRzmJIrFmYdRPQ7iBXaTp593xwadYQ78VoLnZ8qwcaRLNKR3gqfDs8MSAT8Rjuwt4ASagpG8BLzt0kk5Puqpuh5JAvn9VixXbMX+a4eoqOMRXJXuLNdmEMNF9QJhULt7/XYZ/C2Ip8R4M66Y6HP4BqI8zF9/GTAWw+nAW09lXj36RLaIXMXfvD2yxqCYNsG/+0uCq0QbhOLbt5sbR0ZH991knqrFlhjN9PPlhQKIJa1CpS2VI86R2Kc1QZxGVlWwCdASKfR2qP3IpV5LpsGWRG89+tLQaVTlXN+s5F7YWF2eI7AJrfZow0JyioVpKGoGYPkSVtQgNh+g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DBBPR04MB7897.eurprd04.prod.outlook.com (2603:10a6:10:1e7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 16:52:27 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 16:52:27 +0000 From: Frank Li Date: Tue, 12 Nov 2024 11:52:00 -0500 Subject: [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device Message-Id: <20241112-p3t1085-v4-2-a1334314b1e6@nxp.com> References: <20241112-p3t1085-v4-0-a1334314b1e6@nxp.com> In-Reply-To: <20241112-p3t1085-v4-0-a1334314b1e6@nxp.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Lars-Peter Clausen , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jean Delvare , Guenter Roeck Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski , linux-hwmon@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1731430334; l=2704; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=JAPK3bGdhfGqrsoR9koYophADpQ1m2fjbRKgX4s6sn0=; b=lytpmW9PjE3AkoFvOTWvM3IbqWbrv1N7NfI/qTCQWlF1CE4LMKyXOmZwRtpM/cw4IQmXbMMBd 1XjbgdgZLbNAfsAhSK4FQd1yjk4d890ThdOdV5K7mWlF8CbUa4tXCFP X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR07CA0066.namprd07.prod.outlook.com (2603:10b6:a03:60::43) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7897:EE_ X-MS-Office365-Filtering-Correlation-Id: 596a0b0f-e4ec-466f-3144-08dd033a6404 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?QKarmznPkxjHfMfsN2XcN0I2TMJ+WcV?= =?utf-8?q?627k7Y90ysD/I3Kz8uLQlyEkGXs6e7uvepNGQFLtJ2KFiG4gQj6DIzDLYK0Bp0mPb?= =?utf-8?q?qzIEvUFRzN6LqzjU36RHcSVJUPGfh4HmOhy+IZwaqLlRETXMFQnuvFSpfkVP0uImz?= =?utf-8?q?df45R8OHfFMGfWPiNaGM0Z4gFaeh6M2IthvFQUYfkIUCeqe4Oi5F4lCNizAIqABqh?= =?utf-8?q?qjAXuM726qnDzItrO/f4XsNgaPH9v7+Y3XlfjADMJ5IvvCex6U6FkACKvrq4NXp+t?= =?utf-8?q?l6UYYO4ako/8hPPlfIjeH5SvQfLTKYEXSuQFJQy7XxGngiSxZYCZM5bHS8zZrvVTk?= =?utf-8?q?v3/mX2aU0i1posejOQgOTz2hotTdyn3cBgx3C+FcH/PTa2ytU7/Kf7Xl/6c9IugAE?= =?utf-8?q?l2mW5wJRsodTebA66n0VKsZy+64NjOnogu2fnnP+mwCdyFV35xFrEbg9XTg+tMLHB?= =?utf-8?q?DY3r2KUWc0brcApOE9ZnE2/XzKOabpNxy/+u0NX3THDGJ6Zv6/xaBSG6GUINpgkQ5?= =?utf-8?q?qnbBe5dPu1jUtQqOO4ri3BioSMdsiM76XEBLWc98e2rTAE7OON/ZFOTVTBHpt60g0?= =?utf-8?q?hTBncgk0nKG4e6H7mgYhvH6Bmq9xWkcShdPK9Acg2fTzraKAa7GkTBCpKZTLyWR9A?= =?utf-8?q?3FVvLJyiRl+P1gPFOHfKzYP5HkkJdCSNi2ZfnOAUt7tG3rRkXyJj95PcynaGRRgZv?= =?utf-8?q?uUsbC/ovF7vXo0o+MWJXV4EQZROyMSpB7MRgTChI5Tv8r6N7vE7HUklKP5LagBqR3?= =?utf-8?q?4ljFrYfTnUHCdJGo0MfSEy5NdTux3FykrpJFy9qpIE+Xi619B/X1tUntHy9k6xWqK?= =?utf-8?q?q6oRHJbVc5t8fGHmn1Mm/Iz4wsQduVHoj0Hveqftv113ZNdc6xhtKmIyMCtPXyKrY?= =?utf-8?q?xBUnGIEOzOCT9Z+W8F/3l9Pz4LsgYiMaYxaaMojcEo6si+Avzep2CaIdDt7+V0n4Y?= =?utf-8?q?YhehLbWyTEa1xDXfqKyRCsdH+Sw5jJjHP2YtZeBmgvm/qtQYeR18weUxeofgyxdQl?= =?utf-8?q?JLfVYRHu7VrFmEbOWPBspzsQizvdUxZIdJNhpSx/XaeJDSnzc6ysPKmmTJxLwTkfp?= =?utf-8?q?fAHfx8DD9ITKCMSTXi12kTRq425TvLlu7RsNlaAOBBxq410i+4oYRzMmAL7zOOa8h?= =?utf-8?q?63OW6t+Z/ycG/Cs+sWItSWgncjCzhL4IijL0kwjO3sJ1AeF7PoCeDaQ+i0SfugCFk?= =?utf-8?q?X38koVVWmmXDxyUgg7uLNDcypIi98qJAJ+lWoahl52hisBXumI69ksGqq4RgQD93Y?= =?utf-8?q?2rmgKl3apJOMK+7wllKCFpXwIZFr4+zyaQ1hcDlMTPbddnknKrqkPP9XcSH3I+9UN?= =?utf-8?q?i6sY6YM/3GLx?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fstmQaoV3WeuVhozrB2n+arZkzGp?= =?utf-8?q?dMv55Sj247YNYZojGeHsqeh0MGUFvQKje3Z4gwoZrQk/WCwzESxehkCLeDLwn2Oj9?= =?utf-8?q?eBp4Rd7GvMj8pIcA7YsBFJEPd9P177aHiM8DGiKiFAad0/zoR65+UTQoD6FDmjoEN?=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?utf-8?q?JcmQoXL5G7E1+OCWBaNwiJmGtagu/oysX0JVyucXl7EDKLHvrQucdqyVlJDwV/uWm?= =?utf-8?q?4iG9mUdvZLPSpE2FejuPsPuMWpXHrynAZkwZmYNVPbawKWKAo+T3N42JRzyv2t7GN?= =?utf-8?q?bBWs4glI60BAksF9nOcLRKjcKFWEkBJWSelvV/fkjSljQYF5NI5B+NRrCNHFpuTJx?= =?utf-8?q?uaQSIrrEscpjO7z92hxrJ6p6SeXy9yV37Hq5woos0R/p44Fof1jJT4Q53Pn8DRN2L?= =?utf-8?q?3vFR9UwElpHwVT9Q5CfhAhDKeKnhSgrarke/DgDXloyG0hTOGrh0dl0z68RTofi+L?= =?utf-8?q?3HAnSh4sIXeMacJ/eD4xB0mhtJXbUSeAPCOOwinB0AVsGQk6iiPTkx6lwyLPL1xfE?= =?utf-8?q?E5Xe6RcU5vZNwZ+VQRx18A9/2Smz35Ey71pHmBzlIWGzOXWYefhZMA2FA56oxfS39?= =?utf-8?q?rg16bPkHcYFBpXKjgWmEMGpMPYgmk3yESu5LZkRcInHj3QDhRJr88dSfLT+Ddbpc2?= =?utf-8?q?J3J/u2ZMgHCL?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 596a0b0f-e4ec-466f-3144-08dd033a6404 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 16:52:27.8568 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X59XdbkZSIbi55LLe40AMkfV/nBSIbVHIlvs+8cGMHdMpF2+/ib/zQ2f72g6/QvG9tlCUzmjzDCI9Dllp/LquQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7897 Add support for I3C device in the tmp108 driver to handle the P3T1085 sensor. Register the I3C device driver to enable I3C functionality for the sensor. Signed-off-by: Frank Li --- change from v3 to v4 - use module_i3c_i2c_driver change from v2 to v3 - change kconfig to select REGMAP_I3C if enable i3c - remove i3c/master.h - remove , after {} - use #ifdef CONFIG_I3C about i3c register code I2C I3C Y Y support both Y N i3c part code will not be compiled N Y whole TPM108 will not be compiled N N whole TPM108 will not be compiled --- drivers/hwmon/Kconfig | 1 + drivers/hwmon/tmp108.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index d43ca7aa4a548..9579db7849e1f 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -2298,6 +2298,7 @@ config SENSORS_TMP108 tristate "Texas Instruments TMP108" depends on I2C select REGMAP_I2C + select REGMAP_I3C if I3C help If you say yes here you get support for Texas Instruments TMP108 sensor chips and NXP P3T1085. diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c index bfbea6349a95f..1f36af2cd2d94 100644 --- a/drivers/hwmon/tmp108.c +++ b/drivers/hwmon/tmp108.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -440,7 +441,39 @@ static struct i2c_driver tmp108_driver = { .id_table = tmp108_i2c_ids, }; -module_i2c_driver(tmp108_driver); +static const struct i3c_device_id p3t1085_i3c_ids[] = { + I3C_DEVICE(0x011b, 0x1529, NULL), + {} +}; +MODULE_DEVICE_TABLE(i3c, p3t1085_i3c_ids); + +static int p3t1085_i3c_probe(struct i3c_device *i3cdev) +{ + struct device *dev = i3cdev_to_dev(i3cdev); + struct regmap *regmap; + +#ifdef CONFIG_REGMAP_I3C + regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config); +#else + regmap = ERR_PTR(-ENODEV); +#endif + + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), + "Failed to register i3c regmap\n"); + + return tmp108_common_probe(dev, regmap, "p3t1085_i3c"); +} + +static struct i3c_driver p3t1085_driver = { + .driver = { + .name = "p3t1085_i3c", + }, + .probe = p3t1085_i3c_probe, + .id_table = p3t1085_i3c_ids, +}; + +module_i3c_i2c_driver(p3t1085_driver, &tmp108_driver) MODULE_AUTHOR("John Muir "); MODULE_DESCRIPTION("Texas Instruments TMP108 temperature sensor driver");