From patchwork Fri Jun 16 16:00:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52430EB64DA for ; Fri, 16 Jun 2023 16:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343871AbjFPQAz (ORCPT ); Fri, 16 Jun 2023 12:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjFPQAy (ORCPT ); Fri, 16 Jun 2023 12:00:54 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2103.outbound.protection.outlook.com [40.92.58.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D14A30E1; Fri, 16 Jun 2023 09:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2Ts6HK3zRVRselOactB2t83NYUG9Jyel//UWZUgReY7oShoSLKjLTQwsP0XHj0xQcjR3yP4iH9Jo6/+OhAIFejNDrSaiYxby8Uk42sNnY8aJhjIJNe604yLyIBoUWg4sQ9hWRaydJTdWGVbHtzcSddul/ICTDPFMueFmonjBr9BN7Hioun/9lMqvv75nlK4fLzXC0Wm2+hsTu/VPWDvQFUSZi4ywQJLolX6ybJ+Cebj+y3NeuEMnZ/1Kq07Afy/qynNoynhO4VGPFwBb2jE3gkEhuX/1dKHkYlgSrGC7L3d1hf5i8pK5qMkfD/MaPZDqnB1SHjNS1rtY3dldSJbBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=5BrAIRCuOeDynpskuZWGk3ST1Q83K2Ra3b6M01Mplrk=; b=GLQio8/ehngca0s1gWndf+OgvFkhE1ySj88P9R5JQrf/PPo7F/iqTlzlm+U6vCMS50xOr7RYZAsqZF+FzbHGHYJ8SkoH+dotE5EvQCzg5lMul+vmSBLSeDNu9wfN/JTcgJfellswv/Z8ASvv5naC1md3hGo4QGR5tJbDB2XA44DwIEABCFnJshYYfrzvW3+TYyzO1j0NfZXbHtS8HYKdWgl6RgT9a11L7OPcZJo9r2kn+6GGsuFeA2h8ruy9TMRot2/Mfl08v8LQWG7As/NXlB0MxMQcQUrVucdYkq0l13tgI6YUp1iERZVYCwJhJnVrifyB4/5GFPPq75f8SlTydw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5BrAIRCuOeDynpskuZWGk3ST1Q83K2Ra3b6M01Mplrk=; b=GDrYfJvUFAVFyOABL4VC90q1B28VtWlfe5pBFPEzhvv2+G7hTL7gaHWJsmddR8xyw1vlWcU4bFz+y7tM3BgA5P9yQBDCovRhObBajgfNHWoOTlCKgfoEMS9bMNWcziqJ+qOxQJriJdzZimYgouk8DlBI5X4ZLN9nzCM57VzwU20fF51z8f6nDsU2Mps9OE3Veew+KmCBrEbQt/irnogX80AJdRt/W9swCJNuOfzZrkDx/v7M5jJKTYAtI8kQwp/nH3EP/IVExubc0ugtMdm/2UP8IK40hZSuYIZapxCjofrT07kDjmivcFJEdlwZKYHCpfdOYKVRJl7liK0OnzKz6g== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:00:50 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:00:50 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 1/6] hwmon: (sht3x) remove sht3x_platform_data Date: Sat, 17 Jun 2023 00:00:12 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [qRkT3yNQMXNXYm4KR2fV2kna12xvbb4T] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: 54ed9e3d-eb7d-4e94-5c3c-08db6e82dac7 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrST/aUJU0/QQB6BlKfxJxwRhS+efwxDM36yKh/25osQbTJTDnwhVK/GkeGFJggNiTfO4ncpxmO3oG37yBJkrobIfPAGc0qieiz3tgannIUByEFfZvfkxgQBOt/94O2pjHqyy+ybrY7EHE7m+B42XMp/2+w4dSoV64eqrrflV56nXxjBPZSt+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PkaRYm6Zb2lfDczXLAC0T+gRZb4iFWSb2FPaYdSpAkLERqVW1lMHAmYNLvxEtyYl2gnYv4pT+WVdtJ9KKYW8EHpuaOAZTTl8pnqGC5N5VyyQCDm/anjtVt+NLuUqxTylk5HGzD3iPv2mY0+CtBsnoVWILviLDa/qKMYDqruTdjpv4zentJHqMKupVHWf6z4UJEAjpYYEHQhbAw7G5ILXPjanussEHW+WfyWfO2tJDEf7F8dmub/n/2VsyhSsry/EzF4zHO2tzIBkw0mCUjH25DZqLxz+GxIG8nXgGuXDYjYTGgfYCxkAnaQGTG8fL9y93YUe3tqYPh9098svshMqxX0zbCbVcgASLKmDfM42ypeEWAZn1/oMol/kSlQqu0a+yDtk1k4wOxYe/94gai4SevsnJYojb25atI51/ePBQTiY5fNOrYGSYJEZSMC9JAb0ia9g= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 54ed9e3d-eb7d-4e94-5c3c-08db6e82dac7 X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:00:50.2758 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Since no in-tree driver supports it, sht3x_platform_data has been removed and the relevant properties have been moved to sht3x_data. Signed-off-by: JuenKit Yip --- Documentation/hwmon/sht3x.rst | 2 +- drivers/hwmon/sht3x.c | 20 ++++++++------------ include/linux/platform_data/sht3x.h | 15 --------------- 3 files changed, 9 insertions(+), 28 deletions(-) delete mode 100644 include/linux/platform_data/sht3x.h diff --git a/Documentation/hwmon/sht3x.rst b/Documentation/hwmon/sht3x.rst index 95a850d5b..31fd36b14 100644 --- a/Documentation/hwmon/sht3x.rst +++ b/Documentation/hwmon/sht3x.rst @@ -28,7 +28,7 @@ The device communicates with the I2C protocol. Sensors can have the I2C addresses 0x44 or 0x45, depending on the wiring. See Documentation/i2c/instantiating-devices.rst for methods to instantiate the device. -There are two options configurable by means of sht3x_platform_data: +There are two options configurable by means of sht3x_data: 1. blocking (pull the I2C clock line down while performing the measurement) or non-blocking mode. Blocking mode will guarantee the fastest result but diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index 8305e44d9..580704d93 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -20,7 +20,6 @@ #include #include #include -#include /* commands (high precision mode) */ static const unsigned char sht3x_cmd_measure_blocking_hpm[] = { 0x2c, 0x06 }; @@ -135,8 +134,8 @@ struct sht3x_data { const unsigned char *command; u32 wait_time; /* in us*/ unsigned long last_update; /* last update in periodic mode*/ - - struct sht3x_platform_data setup; + bool blocking_io; + bool high_precision; /* * cached values for temperature and humidity and limits @@ -441,13 +440,13 @@ static void sht3x_select_command(struct sht3x_data *data) if (data->mode > 0) { data->command = sht3x_cmd_measure_periodic_mode; data->wait_time = 0; - } else if (data->setup.blocking_io) { - data->command = data->setup.high_precision ? + } else if (data->blocking_io) { + data->command = data->high_precision ? sht3x_cmd_measure_blocking_hpm : sht3x_cmd_measure_blocking_lpm; data->wait_time = 0; } else { - if (data->setup.high_precision) { + if (data->high_precision) { data->command = sht3x_cmd_measure_nonblocking_hpm; data->wait_time = SHT3X_NONBLOCKING_WAIT_TIME_HPM; } else { @@ -595,7 +594,7 @@ static ssize_t update_interval_store(struct device *dev, } if (mode > 0) { - if (data->setup.high_precision) + if (data->high_precision) command = periodic_measure_commands_hpm[mode - 1]; else command = periodic_measure_commands_lpm[mode - 1]; @@ -690,16 +689,13 @@ static int sht3x_probe(struct i2c_client *client) if (!data) return -ENOMEM; - data->setup.blocking_io = false; - data->setup.high_precision = true; + data->blocking_io = false; + data->high_precision = true; data->mode = 0; data->last_update = jiffies - msecs_to_jiffies(3000); data->client = client; crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL); - if (client->dev.platform_data) - data->setup = *(struct sht3x_platform_data *)dev->platform_data; - sht3x_select_command(data); mutex_init(&data->i2c_lock); diff --git a/include/linux/platform_data/sht3x.h b/include/linux/platform_data/sht3x.h deleted file mode 100644 index 14680d2a9..000000000 --- a/include/linux/platform_data/sht3x.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2016 Sensirion AG, Switzerland - * Author: David Frey - * Author: Pascal Sachs - */ - -#ifndef __SHT3X_H_ -#define __SHT3X_H_ - -struct sht3x_platform_data { - bool blocking_io; - bool high_precision; -}; -#endif /* __SHT3X_H_ */ From patchwork Fri Jun 16 16:00:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA2DEB64D7 for ; Fri, 16 Jun 2023 16:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233472AbjFPQBH (ORCPT ); Fri, 16 Jun 2023 12:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345700AbjFPQBB (ORCPT ); Fri, 16 Jun 2023 12:01:01 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2067.outbound.protection.outlook.com [40.92.58.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D362630E3; Fri, 16 Jun 2023 09:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mV0UG12F2k9aLiDlT6+hcH2jc2H2yD6rKbUNjsFY8wCgTJ4/8P/vxA6UoxnwYwOehc0CYy2epMndkHNMKYUQK0ilU6HuHhhpAN1qe4zgQW4669SabGvq6pFsREgGLZu7IJUiI+wdAPQa3bVxYkambMYQ/mjc7Gc2ZdxKyBzqBmu8ebs6EnVijbzAc5uvB6iK8HZimDrJfajL6HEBLwjVcmYnVMDovPnwadKdYFbb2XcbX1L8PuFdt5+L2WSFt8u/Z3WHlkdM3pgAHsaffkuZlps5RVxySx2VByr9hXXhSxXfoxXUtxh330XYx3zn4yGqUh55LGbe8zuZcav4ti3uVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wUjnQSrCoyHWD5oHNZu1W6aWvRlBuJ/UIoaxRYbWuBI=; b=f6AoY28j8MC4DmXvQJxPnSbQpxo34Z3qcMqTljje8HcDjaeF93sOriIvRai1x6ytHKQY2BxbsF/LQIyTP8roLPT0gFImIMyVUxBYUrHllA3mqXxNXNujb5ZUbFlxa1PoWwEHiCKgdWAGC8P2WV9DDgtmZrypB///lj+OcyH8C8zha06TNJL2/Of8NrOhok8kzLPSR4irFjijnj8Gm66kMihlLOeJm0L6ZqrFNz9YN02cR/ml6qRIjoyODCRto+H8IhA0oes68KcHV7C+fSg3vsOJa8/S68FY3eupznhaMcqEgy4DllzBeHf4oAKx5nJCFGnXf3LxSWC6n/QJ6Rjenw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wUjnQSrCoyHWD5oHNZu1W6aWvRlBuJ/UIoaxRYbWuBI=; b=s37f9VP40Hjh6906o8I36pOt1s4q53x0KtKTtCa5v0qVR5G+NBo8ZeaiAAsYmirD7nUcNLtbD2Mqyorgk5STCq74PK4vdewf1jjZZlhUGrChild1GzkH3dpFCnlUHEmojqOjtvXwirpsKl7F2smuTkEWHSGvYOcezFw+gqP7le3e5vFWnYh8syjah2tMXlH5Ps+KUgTB10W9llSly/hDMtxPXMeKBHEGmxCcXGgU0Ep3rZt9njoeE8mhAoX62MCLGTloBGCvbJ672Atw1e8cZb18TulRkJotJx9xU1iazjYHQsaC5w3xlSkRBQ7cTOiPALltrEDewWuiQTRQbfxebQ== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:00:56 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:00:56 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 2/6] hwmon: (sht3x)remove blocking_io property Date: Sat, 17 Jun 2023 00:00:13 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> References: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> X-TMN: [f8TUa61pu9CL6hb+xCuc4MYEa/ca/+2H] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-2-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: bac18c3f-a56f-457b-c422-08db6e82deca X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrST/aUJU0/QQB6BlKfxJxwtL/a5+V7Wlmi3WmM+yesaGcSi1CYG5tytDB3PyIfnFVav7kv3kkdfWd5qkKpE+4tbOipqdSpYeZJI8qWL3xu39rtxhF9clk08WVj1P4cpioz6To60Ox/yaqVr1BLDU5Rw4lRbpTUJ40Szb85j1pQ9VryUDbWC7rYdBxyhhFcurpQRAQi5WC6pSe12A041WeBc0XgJrzNtuucm3LyQECJYibTwdylyQMjurM9K8M+jz4I4WymvKP6iWjOJ8b3BwJjc4pLTXqo28PpQl7oYx/A5Cd/WNMkZEyP6InJptRVzaAli6AkQMdCY2aon6bgtFBiHuG4/B3mvV5LiKephry/eTIqui8B9tvtPfWRK/PTr0GbjPe7PbY+whyuLGdKbq3Z6Imja3ink6Wut+cAbQJGzqwZWGBWB43t62MQB9+NYtxyZsAgjM0p9Mt8KJD4mMNP6m2FoKyDkaf/7lRS0YuySXeGy46YHZLEo/qn7m2vckhTSWTueRqA5eDkbusvOIbjsX95silZ/dL+ARLYdkwBgpCoM5MGxkv8UHXrowMoGpeILin1I5QZJ0jBAXlJnH+GZ+FlytgIYjeBBm2U/Ff+slvimNiYn9LeLLjZr0tdN6ZAl/+6FPOjLDfYNtPCZOm/hBrW95EcqBstZzdxwbSaWwK9yp7cFPHKe5w4HCERAElkoD/eSl2eE8FyT0o1KvgI9uBbtZhGq5yizYHp/f6pxISggHFJv2J3BwzpAKevEnc= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ynVyVQLVzyhcJ74hqPF1lTKPR+VRhDEyL/mx/jWH4OGuXJx5oKVWpeDQ+k6p9WIDAazzvLCWkjfzWAbWxVN7V7NcFEzlWWUeU1bfsMbaKv1cMYpY0sOWs/mzvaiCybgZ7ULMqFb3vBUtOUf44s3ecP2Cxhf5wejm8w7HHvT/5oclcglgX/BBOHJdybDR2irXw4y5W8kuFltaeaySnez86h3lGYjXGAzvOqCHHu+qSDhwE8opNanxPDqEVZLhdr8Qt1Uua3Y2N+5tz9C9yZnajzF1ZOsWOP4pj88ZAzqK7WV5anvbHgOI3yoMvxC9+9M+VlO4G4fhnQ3pG8P+ZVv1KfLjnZoDFHMPnT0Sa8E/92/bXcfZmTVhlaUMUIwtYzgADMGWEwwf2ro7Tkoz1H67uYbz9Tqyl1o6gCsvBlAeoN0fHd5kWabPSAbE+HqnvGABuPEBKC1BAsT7RIf3Q2BO+MiaN1fJUy2wa2E2mE3OTprUuVTfGxZq7Twc5TiOtDkroYmkepezCWTOmJOpzlojM078Yjd2PxZviZNcgC6HmrN541iIX0HzFpDKuOpo7hT7HHYnGbibkHBQXuHqRZiJegkCPkwJr6SKALNQ6FIXgn9CWwjHMy3R+ZHGzO5TV90v X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fZoUcULFZwZkNkiJri59m45+qRHtDJGtwCoCeZuSdOd19wVkAdIgNstv5vLWfl6lvCikrpzZP3daCaYXdfJWw0NZmTiOq56cS6we0jNf/iKptnQIM8aYSHK6vzlKBCvmGHqkWl6AuBxFen2spiBBKh40nUDTWrVBBoU3spONnC5xspyVUGMpIZEJOn2taOr+NHiS2mh5zia/A9jt+ujr7ujhCBf/rWfNwCLkD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MS-Exchange-CrossTenant-Network-Message-Id: bac18c3f-a56f-457b-c422-08db6e82deca X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:00:56.8462 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Due to no support on clock-strench, blocking mode was removed and now single-shot mode only uses non-blocking mode. Signed-off-by: JuenKit Yip --- Documentation/hwmon/sht3x.rst | 14 ++++++-------- drivers/hwmon/sht3x.c | 33 +++++++++++---------------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/Documentation/hwmon/sht3x.rst b/Documentation/hwmon/sht3x.rst index 31fd36b14..be70e2543 100644 --- a/Documentation/hwmon/sht3x.rst +++ b/Documentation/hwmon/sht3x.rst @@ -28,16 +28,14 @@ The device communicates with the I2C protocol. Sensors can have the I2C addresses 0x44 or 0x45, depending on the wiring. See Documentation/i2c/instantiating-devices.rst for methods to instantiate the device. -There are two options configurable by means of sht3x_data: - -1. blocking (pull the I2C clock line down while performing the measurement) or - non-blocking mode. Blocking mode will guarantee the fastest result but - the I2C bus will be busy during that time. By default, non-blocking mode - is used. Make sure clock-stretching works properly on your device if you - want to use blocking mode. -2. high or low accuracy. High accuracy is used by default and using it is +There is only one option configurable by means of sht3x_data: + + high or low accuracy. High accuracy is used by default and using it is strongly recommended. +Even if sht3x sensor supports clock-strech(blocking mode) and non-strench +(non-blocking mode) in single-shot mode, this driver only supports the latter. + The sht3x sensor supports a single shot mode as well as 5 periodic measure modes, which can be controlled with the update_interval sysfs interface. The allowed update_interval in milliseconds are as follows: diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index 580704d93..bbe556f44 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -22,12 +22,10 @@ #include /* commands (high precision mode) */ -static const unsigned char sht3x_cmd_measure_blocking_hpm[] = { 0x2c, 0x06 }; -static const unsigned char sht3x_cmd_measure_nonblocking_hpm[] = { 0x24, 0x00 }; +static const unsigned char sht3x_cmd_measure_single_hpm[] = { 0x24, 0x00 }; /* commands (low power mode) */ -static const unsigned char sht3x_cmd_measure_blocking_lpm[] = { 0x2c, 0x10 }; -static const unsigned char sht3x_cmd_measure_nonblocking_lpm[] = { 0x24, 0x16 }; +static const unsigned char sht3x_cmd_measure_single_lpm[] = { 0x24, 0x16 }; /* commands for periodic mode */ static const unsigned char sht3x_cmd_measure_periodic_mode[] = { 0xe0, 0x00 }; @@ -41,9 +39,9 @@ static const unsigned char sht3x_cmd_heater_off[] = { 0x30, 0x66 }; static const unsigned char sht3x_cmd_read_status_reg[] = { 0xf3, 0x2d }; static const unsigned char sht3x_cmd_clear_status_reg[] = { 0x30, 0x41 }; -/* delays for non-blocking i2c commands, both in us */ -#define SHT3X_NONBLOCKING_WAIT_TIME_HPM 15000 -#define SHT3X_NONBLOCKING_WAIT_TIME_LPM 4000 +/* delays for single-shot mode i2c commands, both in us */ +#define SHT3X_SINGLE_WAIT_TIME_HPM 15000 +#define SHT3X_SINGLE_WAIT_TIME_LPM 4000 #define SHT3X_WORD_LEN 2 #define SHT3X_CMD_LENGTH 2 @@ -134,7 +132,6 @@ struct sht3x_data { const unsigned char *command; u32 wait_time; /* in us*/ unsigned long last_update; /* last update in periodic mode*/ - bool blocking_io; bool high_precision; /* @@ -432,26 +429,19 @@ static ssize_t humidity1_limit_store(struct device *dev, static void sht3x_select_command(struct sht3x_data *data) { /* - * In blocking mode (clock stretching mode) the I2C bus - * is blocked for other traffic, thus the call to i2c_master_recv() - * will wait until the data is ready. For non blocking mode, we - * have to wait ourselves. + * For single-shot mode, only non blocking mode is support, + * we have to wait ourselves for result. */ if (data->mode > 0) { data->command = sht3x_cmd_measure_periodic_mode; data->wait_time = 0; - } else if (data->blocking_io) { - data->command = data->high_precision ? - sht3x_cmd_measure_blocking_hpm : - sht3x_cmd_measure_blocking_lpm; - data->wait_time = 0; } else { if (data->high_precision) { - data->command = sht3x_cmd_measure_nonblocking_hpm; - data->wait_time = SHT3X_NONBLOCKING_WAIT_TIME_HPM; + data->command = sht3x_cmd_measure_single_hpm; + data->wait_time = SHT3X_SINGLE_WAIT_TIME_HPM; } else { - data->command = sht3x_cmd_measure_nonblocking_lpm; - data->wait_time = SHT3X_NONBLOCKING_WAIT_TIME_LPM; + data->command = sht3x_cmd_measure_single_lpm; + data->wait_time = SHT3X_SINGLE_WAIT_TIME_LPM; } } } @@ -689,7 +679,6 @@ static int sht3x_probe(struct i2c_client *client) if (!data) return -ENOMEM; - data->blocking_io = false; data->high_precision = true; data->mode = 0; data->last_update = jiffies - msecs_to_jiffies(3000); From patchwork Fri Jun 16 16:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 955FFEB64D7 for ; Fri, 16 Jun 2023 16:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345506AbjFPQBW (ORCPT ); Fri, 16 Jun 2023 12:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344193AbjFPQBN (ORCPT ); Fri, 16 Jun 2023 12:01:13 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2035.outbound.protection.outlook.com [40.92.91.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B483AA3; Fri, 16 Jun 2023 09:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luQ01OMzrUkPqfGR8WOhVbon0RFD4aA6rRQSB8IvkUHuy2K70gVS/fBUxR6DR3V0XEeGUmWnlPpqe94tl4m2mB+MEEyRtMxc9VZxMkKOf0s3FelZZ4wHhZRmS7nQzr+80/XFCGbHlENCMbp1bWdh/SvnCjVGUMl2HWxg0eYT4A4HJ8N4O5aOX1ZW0xw3Tb8dmzYG9TmYCsC9oWYNWo2jBRr4QcN0+myjXxkttYVLqR8U+LBkqEIMYHsJDyFGA7K0LXLwJlGXCUu6mhVAJ0UFoBPJ3KC48bTx/VmrYYiSgtBoKYEBFwr389XtdXaX1HpeZppGxCEET99kB0TEyYg+WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Of3MSRoZQsE4iQhpOZGiEcdvt3oFHJp0hiZHk4tIwPA=; b=B0MFOn093sJkn/1BvrcJCPTgeLc1CIs0WJh30Ld/IjiAJJbyiRRgaW8VI2y5N98qRdoatWyOWqfkwRRv4qnFbUOXkyFU6u1qd3hmevkmoFiHwF/vWWZRRZLEF+WxFOx/wN7kwaHa682pnoJPEDI/1PAmWJZ6YEw4Uxyqn60SBFrEP9YJWm1L9Q+IzLUdjZNqVcGygijp5Yb3B6kVlS1g0F5dHbWsClHx4w6Rxv6GitaOQ/OtpVVHqtWcAX2/8glr/f8FD24CFWz+i88JFjGNEMAZrU5YXaTPwB6hoa4IdtPTwFovNE3wprYgMkF/gymAOQW+pqgyHS7p1d/OPo+Xmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Of3MSRoZQsE4iQhpOZGiEcdvt3oFHJp0hiZHk4tIwPA=; b=ZyGCElTQ8QzbWz6DjbeYrG58sVz7IY/d2tcCsIIJ+FkG1zHReaTOwe5m6qOwkQAaYebIRZcxFzl8QJUG7thZjqhcL98TDZr4hJDeKGsCeL6JA1AJFym+2ajIebm5M1E2cVAvzRFwEK5fOyApxSndnZEuyNCayczA5EaHJlmLH+GlvSZKGZ7ljSrszpi1oEDulPHqS+zWien8vczsyih+U0aSNQlFqZGu6sho9UbenDaTcG182tXnTiUgdTEyI7hRe73AxFqgzQP7LJVbDO++LQxTvM14Fpv5NbSDw76LRLeG0Kv+kEjAEDWAUh85FfB+EmFcFwkHBf8B8RF/YzjISA== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:01:04 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:01:04 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 3/6] hwmon: (sht3x)replace "high-precision" property to "repeatability" Date: Sat, 17 Jun 2023 00:00:14 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> References: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> X-TMN: [7yZHOyOLKKKM+A8Y6kXBSA496cuFisWz] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-3-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: d39db6f2-4a1b-42d4-9508-08db6e82e35f X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrST/aUJU0/QQB6BlKfxJxwIUDlqYXA3VDxPZ0UqcuxpJun1s8ED3wRvwfzqA/OCz4lJZXt4vRmC40V3YOkqpxBhq1REbaH/S28u5ZSAiWND2n2acPUecUx2n7c/11ouaLXJ6BLvPUNXIkyYDin/x6Pj1ljiqUsuYSLBUk2yC7i1mlxJDUK2WcBATw+rPbaYvY35/NJEnUlaL5Mha5dUMNpV2l264qxc7zFseqi8MiNLfKLTXAJkPDZ4qIvfl8l42y2JO5jC0xfvq+fy1TqyMVB535yXfNY411I8+RSxCCBfHVGuRr1Zs3LbhWtyC61onvP4V6iXuRq3rIkbPLWXONwJvXtLFr8mHz4dLScsyAx1CWYA/tiib3g61fmw5HSVm6h9PZO0ZyLMw0q4Qz1uDw+7uvQaRG0B1nj6FsUg3nljERmxRNjE8vbeFC8qJU8JoivV8P8XUpHAF9rwqMAID68GSEkBjw5Dx0lMlhi/H+E/UvvmjE/YPSRzkUZMjRtJ3hGClYIC2UZPtvlqlrnAWDSmQ8n50r1igvwfyBML+rN8/4wEgF2E+M+GZMbDja+wmF/vFe/wSN3m7xaOAFSqkeMcT6wI6Npp8R6j66Y5Py6inVOGuXWjqLplrF4MpnmVwV8GCFD8FAaYbumNVTD/w8VC4SBbPSLNmJyH+GpaY7mWJHwa22Uo9/zhwYxNe75rv5PcEfWchQ14/L68GkNVLxxczfPRa1MajyalqziDfs5wp15shKP68xrYc8dntFpjqU= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kmmp4z8Q2NptD+ZmKUCp7Q2+EI1RHAtynwntCOM4cW3bFhFDBLuy3Mfa1M4nrdI9O2q/+nHqSTqCiHGAgg4O7tyYgrQuqyTy6FBJtPGOKDBpMxcUjzHsmhGeWkHh6GQ2pyFD6rguzDv5WIjP0xCGa3pcp0sxZn1pIAosJVEEh89py97f3082Z6z5SKGgNYVI75/9H4j3wo/oN4H/WSwAUbKQoDZx89YouIA/4S6BqQiMQggVLGZo0AFdn1RVTS68+cDynvrO0/TLwbAt7d2jKbjkCKlz3h0BMOUFeHwak5FIkEwes2AY+ws2utmPZXpnGGGv4m80qzjqzgy/+5gP2Xs3TkKoqoL/FgOE0fOmP8abm6NNIjPbJ/XBiIQddAajCniWm+4x2wzeLgo+ccu9czHektGuM+p/QUporWHFlPuG5tjClubnG5+ZtpGU7U89vYn9cHGNGHA0mziWXGpSP/8VrY1HKmjMX7w7C7xqi0uJ82j0xxc3pBFijVp9B4ADMKQQfcX8XepmYnLVB7MSCzCpuO1S5l+/OSTHPTKWaFbhmuYMc+66pP/Nvt3hFcCSdlvP+yB6VF2lLmo++RRBlfMXiGkKRBEv0nD6U95B4Zc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A+WmCzDgpRGdXqZ+EMTcpI0LwjK/OYuBBX/QMEq9dpTLIg6JsjKsRt9vgN0xWt3ccC4g29IdBbggAbbIOrcCvwEN+0rh7yM83b5G6wvXou0cad54b8L4N+/NKVgfmhtfM9De4rg4E+eh+Hp9ui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V91wdxVfMIL5dPy8CB3wvcg0i3FsWSL7PU= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d39db6f2-4a1b-42d4-9508-08db6e82e35f X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:01:04.6662 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Signed-off-by: JuenKit Yip --- Documentation/hwmon/sht3x.rst | 2 +- drivers/hwmon/sht3x.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Documentation/hwmon/sht3x.rst b/Documentation/hwmon/sht3x.rst index be70e2543..b4aa561f0 100644 --- a/Documentation/hwmon/sht3x.rst +++ b/Documentation/hwmon/sht3x.rst @@ -30,7 +30,7 @@ Documentation/i2c/instantiating-devices.rst for methods to instantiate the devic There is only one option configurable by means of sht3x_data: - high or low accuracy. High accuracy is used by default and using it is + repeatability: high repeatability is used by default and using it is strongly recommended. Even if sht3x sensor supports clock-strech(blocking mode) and non-strench diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index bbe556f44..ecc64febc 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -21,10 +21,10 @@ #include #include -/* commands (high precision mode) */ +/* commands (high repeatability mode) */ static const unsigned char sht3x_cmd_measure_single_hpm[] = { 0x24, 0x00 }; -/* commands (low power mode) */ +/* commands (low repeatability mode) */ static const unsigned char sht3x_cmd_measure_single_lpm[] = { 0x24, 0x16 }; /* commands for periodic mode */ @@ -66,9 +66,14 @@ enum sht3x_limits { limit_min_hyst, }; +enum sht3x_repeatability { + low_repeatability, + high_repeatability, +}; + DECLARE_CRC8_TABLE(sht3x_crc8_table); -/* periodic measure commands (high precision mode) */ +/* periodic measure commands (high repeatability mode) */ static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = { /* 0.5 measurements per second */ {0x20, 0x32}, @@ -82,7 +87,7 @@ static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = { {0x27, 0x37}, }; -/* periodic measure commands (low power mode) */ +/* periodic measure commands (low repeatability mode) */ static const char periodic_measure_commands_lpm[][SHT3X_CMD_LENGTH] = { /* 0.5 measurements per second */ {0x20, 0x2f}, @@ -132,7 +137,7 @@ struct sht3x_data { const unsigned char *command; u32 wait_time; /* in us*/ unsigned long last_update; /* last update in periodic mode*/ - bool high_precision; + enum sht3x_repeatability repeatability; /* * cached values for temperature and humidity and limits @@ -436,7 +441,7 @@ static void sht3x_select_command(struct sht3x_data *data) data->command = sht3x_cmd_measure_periodic_mode; data->wait_time = 0; } else { - if (data->high_precision) { + if (data->repeatability == high_repeatability) { data->command = sht3x_cmd_measure_single_hpm; data->wait_time = SHT3X_SINGLE_WAIT_TIME_HPM; } else { @@ -584,7 +589,7 @@ static ssize_t update_interval_store(struct device *dev, } if (mode > 0) { - if (data->high_precision) + if (data->repeatability == high_repeatability) command = periodic_measure_commands_hpm[mode - 1]; else command = periodic_measure_commands_lpm[mode - 1]; @@ -679,7 +684,7 @@ static int sht3x_probe(struct i2c_client *client) if (!data) return -ENOMEM; - data->high_precision = true; + data->repeatability = high_repeatability; data->mode = 0; data->last_update = jiffies - msecs_to_jiffies(3000); data->client = client; From patchwork Fri Jun 16 16:00:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE09EB64DA for ; Fri, 16 Jun 2023 16:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbjFPQBi (ORCPT ); Fri, 16 Jun 2023 12:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345528AbjFPQBY (ORCPT ); Fri, 16 Jun 2023 12:01:24 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2035.outbound.protection.outlook.com [40.92.91.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0866E35B0; Fri, 16 Jun 2023 09:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bfaEVJqF0kSkDgSgShCYI9H8j1xIToK+etQO7qK759MC0BVpWWFYo4k7hF5lnEAWMEa7D391oNTUP+Ox3BojS+9vsreuylyYvVpk2MCrDwSfKj3Dg6RVhUOXKPAxDa67JZEVtZRodCc3tUoh/DvDyQT753zk2DGWpHhlojSENre6ZHPMzz71iQoZw8hUaD+Y5CSmdnqudUvs3WWed7GPHqOrSGmJQhADy8yTyTn0gLr8PJBwD5i5L56A5xs5LvoWepBjENlC0gpRHl7ZCY7vf5SFX6CnLja9ACZATy5ODV3HoQ4mGf6hZI3h7rnIf8TaM1eY8MTj5DYldd/KCWuMqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=1zdgws7rt6JoJa6k9+BbppyJcqXIPw7UktAGi68OcFA=; b=SXy4b/Lnhx3cB77GjxxwiLlu6gii24WFyAycvw/yqFOAQxHwHPPvs8hkFvxjmhM+PGS1NBvqQbOHA5eELFQkN378V3NCls8Ll927q5Qs0j6kPyrNnQRbwMjwgYTvkW6w6gCQkVam+z6cp7RR7ERVDZiJ6YzETWV9zxP55Sb5MGgwZL7ty5xquvY4cJKVGGTVrYbGxw30TqmOpcZ+oV/gczCxRgOaByG8mgIDwLvFnM469ZScKyBFj1MoxpTEhGCQ5vPiyhEVaKWf5k2TCoHLqLErNiFtwlAjtEwxNH8uZBrdFUrwdOrJXtzDw3dbJrQmjjkHN5jbo3gDD9afGFEqUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1zdgws7rt6JoJa6k9+BbppyJcqXIPw7UktAGi68OcFA=; b=XIz9lIVfEhhiFNuM50v5Qf4qtV5e85wgtNOvaW75xk3cHvt/m5N3n5wkdyZGN9IgNRZ/ZrufdXniHd7Og8EyRVEqV+moquO81qnaIAgeyGyKUUpeH+tTJIIn0RHXQECeV1hCgMjZPGS1K4RRmpmi14ikFUpSfmWYABDJlM4Rjf1zne5MNXEgOXkN5rUORmhft6q+339H0tVmY8r0MQerOgp7vpdGG4tKBcqJ1S4EWIjg9L9cu8ufzrE//Nf45iupWGiuIeut52q2JO06gu9zxahtIr+MfR7bO9pPvHZcjTA7PSyDb2A07ME6v0opA/PDy4aO91XMVzw1ZCwgACSbmw== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:01:08 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:01:08 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 4/6] hwmon: (sht3x)add medium repeatability support Date: Sat, 17 Jun 2023 00:00:15 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> References: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> X-TMN: [TR8zRAIgmce0rmx9nljsypsuFfKLdfzJ] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-4-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: 082444e3-e8da-4f59-1e98-08db6e82e5ef X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKzwu8YPsqYDy7f7AA4ui0PNuV6DC7KGvIqRE+OEEWSsMkc3bHafQDQP23sf/qPhROCUEezSvzmS4Xv8xcxt+CDnbgNYE42kZD166W8sEH975ohcOZqALYi0SRJJH8Th8lb6vDAAxzy7Z2MIxywpF3FCbxNvrlvokTPQq/UACLei33aFb0hQo+jycAIAceKBkx3jg+uRS0f1toJrjYIifBuDNb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78VIaTTCkSWPmj0Mv/0hfTUFIgVvhd98En8r8KMt8z27nMdm32dc8VySHHQwV5pOjD0ZcC9MLjEjOtV6/tnfERimGe4fscoQDz4YYcHJqed2p29BpmUW2DYr53+Ddm9E4sYFnVQp5ilxVNp8xRIBpsAAUQCd0PlcCBnYU1HYpKbTKSmf4j7+seKIRTG2ioNmeyvcr58OdnjpE8er8EeP0wJW/wI3aFdIPquabgQflGJklC95teCl50lvFyhLHBCrNtx0b9tP8EnbP+fFFOzsvrM1AWpEuz4niF2J1jAFNbuwRUgyZ3GCt8SYM6J1JyRCiljJ+roa05t0KWqCM7J5+bhaPfjSXA4OTKMMgxFE= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 082444e3-e8da-4f59-1e98-08db6e82e5ef X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:01:08.8060 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org add medium repeatability support for matching datasheet Signed-off-by: JuenKit Yip --- drivers/hwmon/sht3x.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index ecc64febc..6174b8fa7 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -24,6 +24,9 @@ /* commands (high repeatability mode) */ static const unsigned char sht3x_cmd_measure_single_hpm[] = { 0x24, 0x00 }; +/* commands (medium repeatability mode) */ +static const unsigned char sht3x_cmd_measure_single_mpm[] = { 0x24, 0x0b }; + /* commands (low repeatability mode) */ static const unsigned char sht3x_cmd_measure_single_lpm[] = { 0x24, 0x16 }; @@ -41,6 +44,7 @@ static const unsigned char sht3x_cmd_clear_status_reg[] = { 0x30, 0x41 }; /* delays for single-shot mode i2c commands, both in us */ #define SHT3X_SINGLE_WAIT_TIME_HPM 15000 +#define SHT3X_SINGLE_WAIT_TIME_MPM 6000 #define SHT3X_SINGLE_WAIT_TIME_LPM 4000 #define SHT3X_WORD_LEN 2 @@ -68,6 +72,7 @@ enum sht3x_limits { enum sht3x_repeatability { low_repeatability, + medium_repeatability, high_repeatability, }; @@ -87,6 +92,20 @@ static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = { {0x27, 0x37}, }; +/* periodic measure commands (medium repeatability) */ +static const char periodic_measure_commands_mpm[][SHT3X_CMD_LENGTH] = { + /* 0.5 measurements per second */ + {0x20, 0x24}, + /* 1 measurements per second */ + {0x21, 0x26}, + /* 2 measurements per second */ + {0x22, 0x20}, + /* 4 measurements per second */ + {0x23, 0x22}, + /* 10 measurements per second */ + {0x27, 0x21}, +}; + /* periodic measure commands (low repeatability mode) */ static const char periodic_measure_commands_lpm[][SHT3X_CMD_LENGTH] = { /* 0.5 measurements per second */ @@ -444,6 +463,9 @@ static void sht3x_select_command(struct sht3x_data *data) if (data->repeatability == high_repeatability) { data->command = sht3x_cmd_measure_single_hpm; data->wait_time = SHT3X_SINGLE_WAIT_TIME_HPM; + } else if (data->repeatability == medium_repeatability) { + data->command = sht3x_cmd_measure_single_mpm; + data->wait_time = SHT3X_SINGLE_WAIT_TIME_MPM; } else { data->command = sht3x_cmd_measure_single_lpm; data->wait_time = SHT3X_SINGLE_WAIT_TIME_LPM; @@ -591,6 +613,8 @@ static ssize_t update_interval_store(struct device *dev, if (mode > 0) { if (data->repeatability == high_repeatability) command = periodic_measure_commands_hpm[mode - 1]; + else if (data->repeatability == medium_repeatability) + command = periodic_measure_commands_mpm[mode - 1]; else command = periodic_measure_commands_lpm[mode - 1]; From patchwork Fri Jun 16 16:00:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4728EB64D7 for ; Fri, 16 Jun 2023 16:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343593AbjFPQB5 (ORCPT ); Fri, 16 Jun 2023 12:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344193AbjFPQBk (ORCPT ); Fri, 16 Jun 2023 12:01:40 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2035.outbound.protection.outlook.com [40.92.91.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EAE03AA0; Fri, 16 Jun 2023 09:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMVrcMYitCj3nn6p9P1MVBToUIyy+C1tQFJ5s8Qtpe321QtVf9fI+bUlkHb17aCjrKCGZCRkZMXEdjbBoT8s98t/t3FOhQvfGWnb7/74fonIlzXGPyJ7XMzPDQO4aKXKnGVfxK18TBpqgVzXzKtCiUAyjntp3K66JSV6c2g3bOuLkbFSSyVqtqmEV/HOyJM9BC4Byo0a/1SFCO4YXoMqvZFbMVJ/nOTkGesuM0xPbHHp1Ekav0CsgkdM27Xb4QKyTPa8cgmUCdLXAxtyhpsCjjPzUjjRBq+uM/ZtpqKigM9tnZp7lQWKtYz7c8QMJ4b+HcFwmE+UGjEMZ8KxEt5BwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=F7sBpx5tYuT0INxyfCCXPqD+jWkrHq7KTnXrwob1zec=; b=WcrzRVJ3Y6p+VhZ1x0hCMunudiXA0WXqeYXh+I55TNgZi6lscsZnCgQgRecEZ7xY1Q/MT+UgfDy09CYM8U6y3IepcVGaKEaFM2ww0Y9HPOpu8RH5ebSOXzjb+baFrooXf7EkoPIsED95hqjaxQUNvY3WbJPGYGj61PSLzgmhcd8iPJUCEcSsMS7rVkvEmz9RNaMAnTRNm5Ikp+g98Sk2wstwo/ijgF0K/U8RjjBeAN7/s7Cj1DSY4tLb28vTLYzmW8b048JFuJys6465Qhuc5my/hwrfVTgBzxfHEzT7mgpiS1DnYBziudFMleocZcr1ltmaxui1r1Vwm7jVHVRAEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F7sBpx5tYuT0INxyfCCXPqD+jWkrHq7KTnXrwob1zec=; b=dKEa4NyPg+STdU5mnFrqhrLOR9P2UbcxTYBOaF9ERcAiwvYQmOxQYL0RjBGLWh7vsBwsb9D95iaT0rFfFxXw9cvpIWTah+O9UbRlLxb3bwyZdEyht1k2TdIF3Q5hEdeI4nbc8bU2G7wo7mi3LGlOoEjk9Ud/DuessEB+Hv9T/AR6d0O5MHT8WAfcNjQ7z+0bJvBqpObdSdYnpfXlG82ZMMpR6I1kQ7fEu0Uz4raGcvKjkRbq5D8IkukuL9SnRA2mvj29P1sT8avD1T1HNUAyKdAvkb1ZJOqvDuKUni0pOEeXutxfoZvfrCHW97EogIqglrw9/yPHKwYFkg7H9zCIhQ== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:01:14 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:01:14 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 5/6] hwmon: (sht3x)add new non-stardard sysfs interface Date: Sat, 17 Jun 2023 00:00:16 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> References: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> X-TMN: [z/G2p0/A69biVilpR2wJTb8ppR4aRMK8] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-5-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: 57a9fd9e-1f5c-4943-6170-08db6e82e8ff X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKz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EK6EGOGAneKO9slcZato/H90jUo2zK8H/CAc1SY9oBpKulvrbMzzkRClgXIOhSY5+kxWWSHnmVyX7yyXYRektfek5cJaJRq7yNkqhCvejFH1jrQK/xZHlAeBR1HqhpM/xpyZiKB3UUzjOc7EFtiVS99jG4wVKyG5wP/UWHd33+CDT0meucc7lxE5df0xF0FNlr8olTKnSvJL/2DvFL9bNUBAdQchWwMoAScE66ZT+QIynthw5Xct6h8YsihVJWPgmKjxiD4fupQiFQHzMBsJDVw926nLR6NyzTctx0azDoj+TcOMfxSm/zlUpPqYm+3ak9b1rYGPdBkuw9TKzepaRneUEVEi1Yl0uI0INFtbWtGVrhlZvLwd71xA/GNavEO6sip1MmfdHkfy/FKoU2ntl1Z9lRa7MXiSk0nBeSp6HQSUmW3FdZ9Vrk6gR8SvDhPe8nSc3Aj545BbCC8cUj/FauRPynS/ZYcfgeFm+E9pMyYSUKcxscr6Gl7KVwqGF2ZbFFjQmIDmg/4X4Q/AMtQ119kCKwgFyaNEm9b1UDTZrZO+LlEIHc4yNZwY= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 57a9fd9e-1f5c-4943-6170-08db6e82e8ff X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:01:13.9938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org add "repeatability" interface to sysfs, it could be read or written to control the sensor. Signed-off-by: JuenKit Yip --- Documentation/hwmon/sht3x.rst | 12 +++++++----- drivers/hwmon/sht3x.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Documentation/hwmon/sht3x.rst b/Documentation/hwmon/sht3x.rst index b4aa561f0..87864ffd1 100644 --- a/Documentation/hwmon/sht3x.rst +++ b/Documentation/hwmon/sht3x.rst @@ -28,11 +28,6 @@ The device communicates with the I2C protocol. Sensors can have the I2C addresses 0x44 or 0x45, depending on the wiring. See Documentation/i2c/instantiating-devices.rst for methods to instantiate the device. -There is only one option configurable by means of sht3x_data: - - repeatability: high repeatability is used by default and using it is - strongly recommended. - Even if sht3x sensor supports clock-strech(blocking mode) and non-strench (non-blocking mode) in single-shot mode, this driver only supports the latter. @@ -83,4 +78,11 @@ heater_enable: heater enable, heating element removes excess humidity from update_interval: update interval, 0 for single shot, interval in msec for periodic measurement. If the interval is not supported by the sensor, the next faster interval is chosen +repeatability: write or read repeatability, higher repeatability means + longer measurement duration, lower noise level and + larger energy consumption: + + - 0: low repeatability + - 1: medium repeatability + - 2: high repeatability =================== ============================================================ diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index 6174b8fa7..adfc11c12 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -637,6 +637,37 @@ static ssize_t update_interval_store(struct device *dev, return count; } +static ssize_t repeatability_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct sht3x_data *data = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", data->repeatability); +} + +static ssize_t repeatability_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count) +{ + u8 val; + int ret; + + struct sht3x_data *data = dev_get_drvdata(dev); + + ret = kstrtou8(buf, 0, &val); + if (ret) + return ret; + + if (val < 0 || val > 2) + return -EINVAL; + + data->repeatability = val; + + return count; +} + static SENSOR_DEVICE_ATTR_RO(temp1_input, temp1_input, 0); static SENSOR_DEVICE_ATTR_RO(humidity1_input, humidity1_input, 0); static SENSOR_DEVICE_ATTR_RW(temp1_max, temp1_limit, limit_max); @@ -653,6 +684,7 @@ static SENSOR_DEVICE_ATTR_RO(temp1_alarm, temp1_alarm, 0); static SENSOR_DEVICE_ATTR_RO(humidity1_alarm, humidity1_alarm, 0); static SENSOR_DEVICE_ATTR_RW(heater_enable, heater_enable, 0); static SENSOR_DEVICE_ATTR_RW(update_interval, update_interval, 0); +static SENSOR_DEVICE_ATTR_RW(repeatability, repeatability, 0); static struct attribute *sht3x_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, @@ -669,6 +701,7 @@ static struct attribute *sht3x_attrs[] = { &sensor_dev_attr_humidity1_alarm.dev_attr.attr, &sensor_dev_attr_heater_enable.dev_attr.attr, &sensor_dev_attr_update_interval.dev_attr.attr, + &sensor_dev_attr_repeatability.dev_attr.attr, NULL }; From patchwork Fri Jun 16 16:00:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JuenKit Yip X-Patchwork-Id: 13282928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2951CEB64D7 for ; Fri, 16 Jun 2023 16:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbjFPQCK (ORCPT ); Fri, 16 Jun 2023 12:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345781AbjFPQB4 (ORCPT ); Fri, 16 Jun 2023 12:01:56 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2035.outbound.protection.outlook.com [40.92.91.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1027E35A6; Fri, 16 Jun 2023 09:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KOpZAPShBW3w5SckE2p9wLlA3a+hpnc4/aHV3wPjnQxQXTiG0Wp4vygjOIZq12LehyRKbcp7X/dOJzlNzIx3LNIYw6hVPgSQ8RdhzI8t5DYj9WrFxnhTOg1JKnfAwmICv8sxoORSc1OwVhpJ5ieyXKZe3hKQEMzHrvnB2brAZJk27Jnjy0nuugwnu1NyCceNe0PjLIFtdff8j/pGPoabhprXRY5AMgRyanURGSkRjNyA5lNkUcQmK7JkYNr/6uTObMOZ3oTmMMaF0Y2O0hIUUOPvGvSGdA+0Bi4mrgv1KqqCcg305LfPU4qlcG6Plq/fWiI4sjRF6CcdPcmTAvFJxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=vZSjapdVjZVj0bWCTKjxCgRkFqSFvPX9XHSxOUu5Awk=; b=W9lU2scaT2pALF8LPw2fLoIu45/ZgzssaAUudnRSn4Wfcjv9eKWvKLbk3j5+XCu8NNftpdSGNs0UavGqkay/K3Go9sXWNowv1rSQIfrl6AsZ353LAMUqyEDlC0crA4u8KLbII0kVLZuPI2A3g4RsZZvZoFCYFi9K2f3ryZMfXKwrMRebflI7ut969o7chTUa+fbV4rR4SKUtQhdKADg7IJqNGBTLS6+sN/AV6LalfSJ1h8Bj7ma20BtDB66Jt4eMeWONGyGFZwwzQ/LgYCrEpWN4X9dBMhxYMMosR7ic1sZAzVwzxUEmcVlI/ZlB3oIUSRBaf4uMJnZtCQRfRT5Jlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vZSjapdVjZVj0bWCTKjxCgRkFqSFvPX9XHSxOUu5Awk=; b=YamZZQZR4IMZWAu9gtp/xfjwwhD8C+10fqCinuQW8LzXG5TFEIhqgNX9D5Y6dMYAFzlGr4rQvMM+wYa0F2Em0QCtdpGIlpzEGrX2UDqbx6S+vmnUNEzbv3i2TN97VnHeOPyXdOE8G1on7pcWJBxKA7Nb31XiXGHc12bs04XO8myBBsd9OS8f0jJ8MQNSsob4mEykXxVJhAGJLcC4cz7k2upJO0AZWrDl58xYkyS53vPkReiwa085ojzRitHdhevvSQJ2IG5mXAg1KFRlrA4mfwGhzO0YyEPESzJ6Ghy3VmI3CnNlAaZ2UbXoV8qvV2+cE07SbZDGW0jF7HTPZwzsNA== Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) by AS1PR10MB7959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:471::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:01:17 +0000 Received: from DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88]) by DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM ([fe80::628a:d617:46f:2a88%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 16:01:17 +0000 From: JuenKit Yip To: linux@roeck-us.net, jdelvare@suse.com Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, JuenKit Yip Subject: [PATCH v2 6/6] hwmon: (sht3x) complement sysfs interface for sts3x Date: Sat, 17 Jun 2023 00:00:17 +0800 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> References: <20230616160017.21228-1-JuenKit_Yip@hotmail.com> X-TMN: [AT3G0djnuRdrcONJf57lmpxNJkYiKOCB] X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:383::21) X-Microsoft-Original-Message-ID: <20230616160017.21228-6-JuenKit_Yip@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB4PR10MB6261:EE_|AS1PR10MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: d20ff2f7-e032-4962-0df6-08db6e82eae8 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrST/aUJU0/QQB6BlKfxJxwnjHkkJa2LdIc0PMZ2Gs687d1ToFcU0kKJrNBjb/s13yKQi+5kFeu1eGgKSVaysLsseebnHZvEVKvnrusjPFT2qGbMZnSpZ0Ayx5I/7sT6iTp43y/Hn/rGDjNUUue5PPQ48Qq0CFqoDaFo8oSNiXxQeE6XcbPjyamNg6dG7Fb192n/dAiwVZ1xG9x+apLuP8z56drISaJTl0ILqXW0s6qVA3gL9ziCYAFzNY2S53Pk5sbzKpi9Z9eP7dxdexSeIg0Rvaux2QtSLlo+uQ7OrubUtnBaP6vn0qOtraek0lxP/oF34BCIeS4Nv2aMqCyqs23ZUoywO93D6bfEQgEz0CqfPyUlC9I7lCAYl0s52635Jxos8ZolAq74N5bSeTQDgyUDrdawR4RCVooO//qiSRsCXQdgcJLXHg0lixgwWQ80ZaGLAy43C3Mj/HczpJGf0cm6gyMfBjPeNGGWyNoUFhpJOrta8AqLHt8gE0MhMjdFhveeUlO5ctK/S5kJ2aNlF5/uqSS6jClPDIB2JN3/TiMdZylsGTthxe2EomEi2kVRwvzBAlWXLwmrYup2803cjOubnpFjevs7aRkLo2rSovkxLg6Y9Np9L1gs6F9PtXZWu6lGpO6e436rXR47kaF/f0gBtRrMzhg7RhMO6Pyr0Ly/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ossTenant-Network-Message-Id: d20ff2f7-e032-4962-0df6-08db6e82eae8 X-MS-Exchange-CrossTenant-AuthSource: DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:01:17.3092 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB7959 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Compared to sht3x, sts3x has the similiar functions and operations but it has no humidity sensor. Signed-off-by: JuenKit Yip --- drivers/hwmon/sht3x.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index adfc11c12..ae384ced7 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -707,6 +707,14 @@ static struct attribute *sht3x_attrs[] = { static struct attribute *sts3x_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + &sensor_dev_attr_temp1_min.dev_attr.attr, + &sensor_dev_attr_temp1_min_hyst.dev_attr.attr, + &sensor_dev_attr_temp1_alarm.dev_attr.attr, + &sensor_dev_attr_heater_enable.dev_attr.attr, + &sensor_dev_attr_update_interval.dev_attr.attr, + &sensor_dev_attr_repeatability.dev_attr.attr, NULL };