From patchwork Mon Nov 11 17:32:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13871024 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) (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 52D561BC088; Mon, 11 Nov 2024 17:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731346377; cv=fail; b=sKA0BsvnVYMfjaC9zYkBoCiyNdqBXf/wrbtyMZB4eC0wJtUQ6Gkri746nqA5Kyjo+bxf0XiqO8JiZRa65A23XacIiLvAVUpqIVs2UToHyR+CDHgqK4mhUSPqvpEaVMzBIwLCrUiv90PFFG5TVUL82hAE9+8WZQ92zE+gw4Xj5Fg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731346377; c=relaxed/simple; bh=SpDIWQ//2vxQS6+qCcRIjEy3XtKoUdTil4zQhY1xDPU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=l812DMrEw/qsLyMZUeYsCVNhIvFtPA5Dq0CiW9WSYImISCa4fPDmtbGCtLEojtpvLdk/CGZrxKpVSuPF38XAJoE4ounA4UkF1ZhM6+L8EwGM3cnABgGrIbC3uxGqaLQ/69B5axWFG3d4UgO5HB40Ja74BUjD2GjdfdURCXNO5Wo= 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=c/Bp9Lzg; arc=fail smtp.client-ip=40.107.20.70 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="c/Bp9Lzg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DC+EaNe/2k0IoC3LkpgiWqSqe0QAT8J0F3bs0lepvspKIqyWqSC7AV4wXvs4Vrhk5CX/kPqz+5r4JORuIHMoSWbOtQ0WBE/KvJcb86xLJUkHbYFu1Nv9KoYIfw0mb3f8p9b4txeqTh33Pk6jsXmnIvcSKplf9bXoSvbFTBzvMAY51s42zw0eEiYB+CUWhXs2N3gS3Vx7Xr4kO1iziKtjwKQcibBmGUK4G6LlTqcbTyh1jh09Eo7xA018i2ylRaprkCgnpjz6mqqSYSGuHSXgTqcgNieLB++I6PrVw1BMXiR0xmzpug/Zf+vp/TCngyYiZvM/IAk+bV7E5SfBJbl1Jg== 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=yT6CdsGvDvMzmPjYkwFsjKh3un4BoK0qxjjXVW4EnQE=; b=D+Hohx72lBuqCymZ7CdkjVsyhJ5EC5DX6L93yd4cLeL8ItlUHBJxyrvWjCueij8g3yNR1nT855PBeOelUGcgmE6O6GE12Kp71xwlpvcxDRgBhEqgNExB+xVOONFRSisyc32WmTYYch1Lg3WSGNcLiAm3mLN4uikGX90uKQo3ZCqeCsW9Ky89wLBBpqunRZkC536vOxNx2G9znHuwEwkc5E3Y4buOXFwJUa4nLu8bkCfqpyKnnp916jH1Tnb0+I5velabS3hW2YuTb/uPjneB2QtJm+8Qkd1P+Tf+zci+tdaB+zRZxoPcP5FUOEOCBB3p8Saq/B1Zxyv8o4L6buVswQ== 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=yT6CdsGvDvMzmPjYkwFsjKh3un4BoK0qxjjXVW4EnQE=; b=c/Bp9LzgGSHlMujWX6qF4Kcc0mIed0V+h5RkvjR7RSBra5vkSwtcv6ThWe8oqixJAzY3HRdnG7/cNLMe0Vu3dJzpX7MfzubdRD1JfBF58gvBWKdK5bZgESx4UWPbtG8FWKAvjcpWtRkUl3Z4HzyTu9th8wytD/K8rTd8C9aN0MIt0ASs0s3UXUGSLte/JAOwafyakt2mmPIYjDP0TWVkLajGTel3uAU2KCE/BxbRT2YdfOCRH0adLvJTf8fGBX83WcGssPKs9qqcvB0dzHjzYZlpqY75sQcrYSrrr56sAE5iMOFD6/pDMuygTlLLx6bnh7BGFKr+oq1eCKjfsEt9Kw== 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 PA2PR04MB10086.eurprd04.prod.outlook.com (2603:10a6:102:40d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 17:32:52 +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; Mon, 11 Nov 2024 17:32:52 +0000 From: Frank Li Date: Mon, 11 Nov 2024 12:32:01 -0500 Subject: [PATCH v3 4/5] hwmon: tmp108: Add support for I3C device Message-Id: <20241111-p3t1085-v3-4-bff511550aad@nxp.com> References: <20241111-p3t1085-v3-0-bff511550aad@nxp.com> In-Reply-To: <20241111-p3t1085-v3-0-bff511550aad@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=1731346348; l=2554; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=SpDIWQ//2vxQS6+qCcRIjEy3XtKoUdTil4zQhY1xDPU=; b=oIpjlN20VXx6nYjN61WgpNP1tIR1QU/UWuieY8UlbQO25JrulQUoP9XG0cmluT7dyOPAW0YOJ nB0SNpeYDbLC/f386DFQ0SKe8kKngqrX68F3QpJJlnsJ6D1jKJ502Pv X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR01CA0044.prod.exchangelabs.com (2603:10b6:a03:94::21) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|PA2PR04MB10086:EE_ X-MS-Office365-Filtering-Correlation-Id: 52f05c4c-3b86-4301-5d9d-08dd0276de7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eokNpSklzeUAGG9avCnBlHpjYPmPzc2?= =?utf-8?q?M3y5jm5mGiIUMhsiPOwZfAEprM8xBny5HxMzjBF4Qiy0hmVAyd3EVpGAbfc95ko2h?= =?utf-8?q?SIwOCItna406naYs0BRwbkThYQoPa6Tr87b1vRmg/+qDLbCv3n6Xz/cT3caii83+f?= =?utf-8?q?kAG+r3ysL4tm+ICSLGTbgf/fbI9OFJEvE5a/9MhdaJLqeTUsO8SXJObiIHAxRuT1T?= =?utf-8?q?ZZ0Xp5KSKrOr71fV7jTq5gW5gve5n0uvIUpBML6AExAc8W9W8GddG47GaKChYC0XC?= =?utf-8?q?gk6aKcQntEBYF/hcthT8K3Wg/ID3DdDsKy5raNTibHmCBYKsK59DMbBIOYSrtx7W3?= =?utf-8?q?xNA5ccxa+texfGVJ3+xT0lZQ3qfk8VxhjOWKpaNTYK43QyxqJyNpA2x0J2k6yHLhY?= =?utf-8?q?Cd/Hz6WSmB3gxyKeFpCC6cYAFpo4BBA6x1VuvtsPZRtcxVwp3L618bcMU/i0E8EUS?= =?utf-8?q?G5pcnNhx9x7ZfNveFk6aMBvI46cC6g6jDYHkFlKBj7bNNLINAXxV5KEmcQQfDgqgd?= =?utf-8?q?dAhAiT2phzxiHdvdMqdicBqXxXxXjL3cu0cX7VZaAibt8MPF9A3J5ykR93Av0NVGV?= =?utf-8?q?RqMF/rcbD68gOf69hbPP1XvoWO7z9ziA67P26F/5QszoTIQ+wDXcxSibdsRC3ckO4?= =?utf-8?q?LmOarh1KHdgX01Yt9uSR14n/hkp9ihfI8RqF4O3UQFqGkcU1dbUc7pK/CmCJsYGzX?= =?utf-8?q?7nBxggVr6izZc+ILe6KliASpmgoQbJFIahEKF9l6sftAtwCwouErQ1kMaMX1ZjuiF?= =?utf-8?q?NgAXQQVnZahZTWFg9pVRUQVOXzTQccSQ2ViV2EJNBI2j25ECXuVT7S3v7GB4T+Hlt?= =?utf-8?q?RMv6n0Ym4bswC9/Bkq79WKqqz1v0RvdRmzaTuQS73CLnQ3P2xTeWqvk5bnXkhFO2k?= =?utf-8?q?oqsJ0PyTuYqxJa1bSEIzqaT2itlE52+tIUzEcaFxjknkDS4rpHCC6kHk6i4w+0/ah?= =?utf-8?q?P4+Lz9zf+betgxGuBCSzI/c7fUYxdC0qMbvIvdVmlb6s1ms4ZrDvXJtdGvUtH+4U6?= =?utf-8?q?B4vvXVVzBFNXZU5ynhzWY+c3bsxZb7Lp/SRShvQ/HOU/3d6GHpUTlYB9p13CJ+QXs?= =?utf-8?q?5p0SF8+Cyv0Qnoh0aQptXPp0k/o3Oz51rwkXGZY4w7ckP6H71kms1j8I1etmxmCYP?= =?utf-8?q?m+fr0PCdkP6adP2S8TvPLSqWyQPdZnUU02jpS+WIZCaUHKNTxps+1plK/sxlmiiRU?= =?utf-8?q?MSfwLtrMuDMo1l3RrbLlPCr89EmIAwLF3YjmLZ7n6FC/998tXJ2imhtiZyn/N/QEt?= =?utf-8?q?cneLxe/TywLZRP82Ylk009wbWyDUz+Gy1aGZICWJTUvKZSccOQGQgl6zIzv9z0I3T?= =?utf-8?q?S6VfIuF8mGPe?= 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)(7416014)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?e3wTBg62VHz7S4QUcRAr9YxVJeeE?= =?utf-8?q?Vn7Gjl7lMRySK6uuSDHbZ7npD+8CKrKsC5M8vMJH+Wd/o13DWrQ01mvqfFLGJ3C/8?= =?utf-8?q?azw6Ny8dTrKHip3HUbr7q8ELhE88Y2MpHUjtKy4gwZwEt6UsCq7J3ef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GAp?= =?utf-8?q?8wdOWBnrWFU9/BvOlZ+IPJ5vLnqaLqKKkcFWVpmP719LhIUtP9J+uTMjOwXgxmDED?= =?utf-8?q?SuzTnvrbHnplx0cqhWFr0d3UEGvDhWFiuG/UwEfl3qfM8S/JbHrvMIhkUUymMk5Fr?= =?utf-8?q?lo6DpzSUhkRxTYBj0KC/JAvBtDIWif8gXNiDCvQ0xfNbT0Voa0yBmIuXVCVpjKESS?= =?utf-8?q?vkpBhyANqMVnrXDVLdphwMiZ83B9+RgyoaiuUgmdNCo8gKFNPQjZ+ufZBTvdoYYcv?= =?utf-8?q?uwHIe+qRmp261O6BBznuE5TmnDTr7boLijWZWo0dzPilLSRkyJhM9WZmfaKNVvkvC?= =?utf-8?q?+9qU/Vlz5AS9TS9LCF7qxEhN4xQUi8//dNzzxBmP+hAknDs+mPE86t0Bz3j+5NoU9?= =?utf-8?q?JNt0X8AcrCuG4F0xjh7Eq/ku8ym5jgHN6vaZCfYQcSPtaxXTI7Sf8HtMx+Y0AASWd?= =?utf-8?q?86HurAgm7sufztAEgC2zhaYaztbV2Qnhk6MLycLAu0zdE9gTJsTJ4cYxDN6nvz0Ye?= =?utf-8?q?KBgDIvPCLWM3?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52f05c4c-3b86-4301-5d9d-08dd0276de7c X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 17:32:52.1775 (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: AGjZxn2whdG1axEBtNPWu33HEX2oqfJv3lxFSgYkc5+g4GNq6cGk/Vz0rSElFBb3FwSSPdcV2phE/5g4O3CTvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10086 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 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 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) 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..deb1505321335 100644 --- a/drivers/hwmon/tmp108.c +++ b/drivers/hwmon/tmp108.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -442,6 +443,36 @@ static struct i2c_driver tmp108_driver = { module_i2c_driver(tmp108_driver); +#ifdef CONFIG_I3C +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; + + regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config); + 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_driver(p3t1085_driver); +#endif + MODULE_AUTHOR("John Muir "); MODULE_DESCRIPTION("Texas Instruments TMP108 temperature sensor driver"); MODULE_LICENSE("GPL");