From patchwork Tue Sep 7 13:42:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65401C433F5 for ; Tue, 7 Sep 2021 13:42:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49A1A610FE for ; Tue, 7 Sep 2021 13:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344772AbhIGNni (ORCPT ); Tue, 7 Sep 2021 09:43:38 -0400 Received: from mail-eopbgr80091.outbound.protection.outlook.com ([40.107.8.91]:29734 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344667AbhIGNni (ORCPT ); Tue, 7 Sep 2021 09:43:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SASuh5fvENbReTL0T3w3/H/No05KLRGH/pqGzyIM8M17PiVwxunLQJshBUM6xbJeh6Po7q/aN5XcmF9e0wJNZLOUnFy41ilzovBqrSXBV1GnVUnxct4SNt1kSo52ormoVtKgJ2Y5Whh44IzKMBifDzR2Sll9fGu5qr1pAMhd/IBM/EGZYlmt9FaHY7xPKtGg4hmgIbfBjDefYfhPzbZrZ0cq0LGu1LAzajnRDrbIRvp0CmgknYLWdysIMtgUCkaeJCzKbT0agh9Pxf+Tr3/Rmso0aEiiLXruCjNLHxE6Un8b/DaTM9AeBgosYGnxTatgtQD/WWiUzoBWpgwrvl5RrA== 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-SenderADCheck; bh=+stPsjZi9lzZmkF8ntKLZfNauWSfzcoK5fPmguFMGVM=; b=E09m6fw91QLSmTNtlIUCA79qaQde4XBz/KLQ4Uz5JfHm4SiWOXtfXTY9EjusbM1m+88gYlIz/uFMbvEg7XS0bJ32sbmzyg9ecmNinFSFm1Ylzfw7cchoWwYWN0YxpqBU3QeXGEfPkwOfCwAyQjFQnklzEg34OdiDpBRwfQ8lDYEmAQ6TOD4+NkS1gbxNY5QQx1Ms2fKIIpInD1wVbgdroNtJWYcFWan0y0ECP3zNfBNuJNoFjnZDsbut9sT2KFAxrN9GLUuKA6KiTDW6fRgJEL3IRCEc6TS7GpXsoTVmyCkA3nQ//oOFB8gTXwx/SvRKbclQHLUcjS8+wIGcUPqFHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+stPsjZi9lzZmkF8ntKLZfNauWSfzcoK5fPmguFMGVM=; b=oSFbigA52jvGzGrZF6oZ7aD4HEcnrLVL2mSp52Mrp72SACHxdAQCMIh/2et60QHnXWcNQ0U9uBGlU+8+y+qEG9G7O6qe8gUOrhnqz2WzbJ6KEw1etmkgTbJaXBRKRvdrz0kMFlsb0oOR6ykucgpuAein2e2gzS9jK/FGZoKLoNA= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8127.eurprd07.prod.outlook.com (2603:10a6:10:270::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Tue, 7 Sep 2021 13:42:30 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:42:30 +0000 Date: Tue, 7 Sep 2021 15:42:24 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/8] dt-bindings: hwmon: add missing tmp421 binding Message-ID: <08a5f07c635ec09a0852ba5e2c7332c4d8794798.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0016.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::26) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0016.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 7 Sep 2021 13:42:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3928ac1-d6ba-43df-9b4e-08d972055606 X-MS-TrafficTypeDiagnostic: DU2PR07MB8127: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KBwvB4z+kzwqyN5R3A5a9SyMQsZrdV4Vw3hCt5SNXKf1n4HWisnD68BrtlX1d6XQwmlmC++lD5Qll5sEbCb8PCVGgUW7wIy0/jRaZro90rUw4tzLxj+Z6l6ONUAb4qnpB+jvLegsbdsoTj4CLFurv+EWOY7pn75hUlUZGqXxg7yoeNcW8jWJHPi/jRETIrtgwXpXuUxCYpOALBlaau1jXfnJy/DuONEKnLS2q8Inb53jNfB5nD3wSoDJfwlb/9VSs865Hn+RBVrSRt5d3Zbu0i2ukwrgj9/u3G4qiYD0kl88p8GxjCD9JYLjP6/HoBrvL9IFF0nQALsIMhWf3b4s6luUP6Ppm2XiE9L6bGa8YBZv0n+NNmqOZ34tfN4K8vtl3pR0dWJdYXXFbT48SoyiGY0/DUXmEwafHyQ5WlLVUbYwSjn15jFa5kYHle+/4rJg26qxmCZAICcfKIr5pRmMlnmvBlRAYxCYUtdXWPEQapqaLfFUAvfRaBcIYvA2KEKGzgjfpjI34wbcSvYCVz84bsKOzrHnTkUiHLaQgDpRLBVX7I+kG9+8tPSQtxUY6gmej07gj+rNO2qizg0n6Vbyb94iY6kurgEONaHAkU8yVcw81M/c9ABUiG7tFwTVB2ek4AZUpwmmThONLNRk88LAfgM/W9m1H7uvqWZDfhmEEvJUQOtyvAgCusz15M8Zjyxwsn7BFU23IBf/9MlIJUa12I4p3DtMYrPA/dp8I7XmZxHaA/ObguWWfcLCmKEZAIR/q55cyv4wfAlNtnvlJQo5MlaPfh2QA1M/Jxe7jWU4ZFM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(5660300002)(956004)(8936002)(26005)(2906002)(6506007)(66476007)(66946007)(8676002)(4326008)(38100700002)(316002)(38350700002)(86362001)(36756003)(52116002)(966005)(508600001)(2616005)(66556008)(6486002)(110136005)(6512007)(44832011)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?q?InC4Ynm3+m6nwYjvpcluWHh?= =?iso-8859-1?q?38K0O81RzhCTGbDTlAOwp6hkF6HwMAwQpfSfOI3vLDESSvKDU1nwUnmAlXyG?= =?iso-8859-1?q?MjhqB3WwrBhbw5sk/WgB0EowYfWHTLkyx38LXocKrfsnV9S2wwXVH5vHVEUv?= =?iso-8859-1?q?nsDVuP/E+0CMX/t0juhhYS4ZW3xeEt4Ng6R6obN+Ln+LaUmwgF8q/gFe9ehx?= =?iso-8859-1?q?uL8pHTQ/15uRPUiG4pkXW0c8wlLr9ZTqjMbiuvcUwhCj2kGDXD0Tbpt2Kdch?= =?iso-8859-1?q?g3rv0J4DdVORCM/Bka9y+v1tQMVWmoaNpv4GW0t7aI7DfWxrn/Rg+dkrhTTq?= =?iso-8859-1?q?os7Cs2S7I5K3LTCq3eteLn+e1aCok7SsZY4IGBvh6lnsreDfao/wzSIOwDSD?= =?iso-8859-1?q?tTFqqVw+hAbCExryK7YIgrnuSSMOAQw6DJSywUPOzfS66hmgcpMeRwuy0G1A?= =?iso-8859-1?q?aJkBK/qpUUPp0gdfSS1Ic+lxQq21kPU+DFAXIO0jDajD7Q0WF6vhFuSbQA6o?= =?iso-8859-1?q?9aGJvUD662iMVCKHdOq+9jsGRjPFXC0lEhMJzrV9LNV4j5GrUDO1l0TVMA3R?= =?iso-8859-1?q?a9RbDe6V86O9RZM1h3juaH4JyMRcLKDnK+8y6/GjvMWoCLKvAHx+u7E86wUY?= =?iso-8859-1?q?9hv1z4219VRTKujrUJPiieDzPlvJK6pXUNraOeoe9butoTgCHrqSUnsDGYJF?= =?iso-8859-1?q?Ylubq7JIgB2iEBtDIuScat//BgiS5dzERkxe5AYPWw5Izx5GN0vlQRaQrduw?= =?iso-8859-1?q?GEZcnlj82yaRpcQc8Q3bwzqkIaeXshGS7/gYiPJ8wXnPV0bKOuBd0xRkmtTX?= =?iso-8859-1?q?B2nOo4V3w/rRZOC73UBZqR8gTGdbtJUx6PonVw/lUkDASUU8FYWY7Rtxr/+f?= =?iso-8859-1?q?zbIzBXOyY+1PGponxzeDXy/MfrpO/qd7vDWlNVuFCIAPyZYsVNxFtIQM7eLT?= =?iso-8859-1?q?utES6H4IlyodYTuSG1ivCRB+2yLTmN+ol7kkhUov6hQjYx06VVppVknnpJRE?= =?iso-8859-1?q?J9UWLX31x3p4lL81W9PxJhmHYTsDxFj74Z6X3zFE9Uc6cGtz3/xOiPYikmVv?= =?iso-8859-1?q?BreM0NQj2uJfgoZerPF0crv3ADrcMUUPMuj1hZPn9VgxIzIPi/2LRQfiHQ8p?= =?iso-8859-1?q?YDqGb+xpd3gyCZ4COO8rgNCj6CqsDRWo6wTtIiPwtQdMnRgWIr927LG3P84R?= =?iso-8859-1?q?6grzPcXrRH0sQZtAlaSTK1F3Jh8icIKj7cd72kiuEyLSp6ucn15PLzI3t1XY?= =?iso-8859-1?q?iFMDwyR9XlJYze1Iuyn2unD1ustSC5BfwsrcsnrpN905ukfRw5uI8SkUpYqT?= =?iso-8859-1?q?38gZfM5W/3dn+YKzWJUNBdLxWKQZX3k0V136LS8L4KvC0DLs160K0SAQu8kN?= =?iso-8859-1?q?b?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3928ac1-d6ba-43df-9b4e-08d972055606 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:42:29.9077 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aMYAFne4MsQo+Yonbgsln+bP5bTQ5gCWu/9GLtuXvGADFShtetw6ma1wyZG84i7/HsdbmOfwU+WNRAPDvKimN/ltrvP76cI+R6RldU+Oyps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8127 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add basic description of the tmp421 driver DT bindings. Signed-off-by: Krzysztof Adamski Reviewed-by: Rob Herring --- .../devicetree/bindings/hwmon/tmp421.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/tmp421.yaml diff --git a/Documentation/devicetree/bindings/hwmon/tmp421.yaml b/Documentation/devicetree/bindings/hwmon/tmp421.yaml new file mode 100644 index 000000000000..53940e146ee6 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/tmp421.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/tmp421.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TMP42x/TMP44x temperature sensor + +maintainers: + - Guenter Roeck + +description: | + ±1°C Remote and Local temperature sensor + https://www.ti.com/lit/ds/symlink/tmp422.pdf + +properties: + compatible: + enum: + - ti,tmp421 + - ti,tmp422 + - ti,tmp423 + - ti,tmp441 + - ti,tmp442 + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + sensor@4c { + compatible = "ti,tmp422"; + reg = <0x4c>; + }; + }; From patchwork Tue Sep 7 13:42:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D2CDC433F5 for ; Tue, 7 Sep 2021 13:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0295561100 for ; Tue, 7 Sep 2021 13:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344269AbhIGNoE (ORCPT ); Tue, 7 Sep 2021 09:44:04 -0400 Received: from mail-eopbgr70125.outbound.protection.outlook.com ([40.107.7.125]:21476 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344638AbhIGNoE (ORCPT ); Tue, 7 Sep 2021 09:44:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dcfE12/98Q1d7TvQeC25s/8PihzkdR5OxmZKqmXFE99Di6fLB5gbo3KdSXnx/hqSRr8Gpa9rd8+bQipirrbQtbrfdVFV0M1+uqKPRu46o6hRrCc6//Jnc5z40OaFF5Yxybx8kv7BWk9AXzN+tUpdy4SI0LY+pELJqIJOd22nCTrB6BqW/vA5Yws7J0H8bfYKcO6L7Xs534cBteV3yM/RsA8TkLH6+1aeNIkpxun7/JhrNyeG8c4IqELsaZ6SB06cnyvHXnG0AbKppaiX4R9NqIO5RJnWM8bwFLUXcusMS6bcY1mwDzmUplI8wxMyKDXuQWyDoQwmeZK7Xf7KpZbZjA== 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; bh=oJw0UupXIputVH7hbfREtC003S+N9JoS9YRbn0pt8sc=; b=FAH8mzGOC1F8hXTLE8ELcDYoJ3IdEBI3ArW4iUb5+GxltJpWtqiTAU/TxU7pKPwPwzYdU91j7HzvsV9F7bcAdJl4AKmTGOo1df1n9+tmhwf/tk+ACmhJFAgPDa4pYK8M9HqXE1/GTfnUcAPPbNC97lLlFb0P8gijiJT9sN8axERA131Pzl/acnRMq18JS+/AXbdDII5/scNM3UMEOZ41JYs6WT6kz75MS383hs1SxgQdaf57DpPScNsuWTHRZt3qXGomW48L60xBYe8vH01Jhw0tZBZmUCv+memrTQL+zhjeEKkwtz0mDv8eueIiDgbiiO7QzUbaWFvNzccGVlL8NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oJw0UupXIputVH7hbfREtC003S+N9JoS9YRbn0pt8sc=; b=LP3f24u3r5RDd2w9xbUDjHCJineN+4bHxE07L66gOCDaF8dGEDWPLaEAdLEaNypqWiAO2EUmQUIhKHs2jz0BV7DeSbMnkI4fCF54pywIq13lhjN0IVL9ry8DqL2jGNe5OjUc0iHfR64AQ+dfDTLRVVAFpgLrm3a1JlkGGiI4qNo= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8269.eurprd07.prod.outlook.com (2603:10a6:10:276::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.14; Tue, 7 Sep 2021 13:42:55 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:42:55 +0000 Date: Tue, 7 Sep 2021 15:42:50 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/8] hwmon: (tmp421) introduce MAX_CHANNELS define Message-ID: References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0003.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::13) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0003.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 7 Sep 2021 13:42:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67ab7ac6-72f2-41ca-b4ec-08d972056550 X-MS-TrafficTypeDiagnostic: DU2PR07MB8269: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:386; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nJMWu9Q1vAxgDis3G198FAqEmQZQ2LmzluoNBYmD+nQHWhDOa8JAaxAKJxyTvqawcA3je0kEfCuPHfM/geryz9UCMbhWFi6slisIny9ZBGt2XhMogiI2oh331mAUrL5UKz6PX6GFgyeZgtB0wGlbPIlRlEEmYE/qGYCBd3/Kkm+KsS+jhXvxqS4XdWYB5VJ8Csx7KPObECmatYeMFYzNs654y67JnTga+/3j/nh6l4peVpXYUA4DXNhftMu2pQE71P+AOqE9B72lAeBd+HmgIN7ZeWowTzGgWnQsGEYNQK9DF1FKqqN6rpY9eK+5feJSSq4PcREU7k+rcTxsQ1/38u8z2lQ2E56Nr3zIJM4T0S962RkyVLEp7dzl9o9MG/hfJoonZ/A2Kaw595te73BdBdvy/vvsnuLRV6oylByHFJwOyQghUjIUJvAmuwA9Ry+qu/xfG9sym8/+btgiCi4D5bseHzRo0W5gSUg3g0WrvaSvcplIZ0qLXlsD5Z1tanycoenv4RGnat4k/+KOvMwj8BRBYNRLu5tYLuLHSFgBNdZwgFb7KprFaD7pNdIrUF8pxi3t8pKp9ggIRZdWFdeEIyfAIwGbN5WHnKsHMm55v4y9WN9bhS7Pk40LyDu5VpL8WzkTxNqEhW1FWpMUtu4ErrXf8cYNxmpaTWtBhbIdF02tFvSG5N6IFkzSeS+ae/y/qDwx4E5QxY7Czg9C20ueoA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(44832011)(26005)(110136005)(186003)(956004)(2616005)(2906002)(6486002)(66946007)(66476007)(5660300002)(36756003)(38100700002)(66556008)(316002)(6506007)(8676002)(83380400001)(8936002)(38350700002)(86362001)(6512007)(4326008)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HyfZHprNGupgacHRofQ53esmTvt8IUSu8BRJZhVETnmeW1MAq4yQ8uu7zchOYOWhWIW99jpeyBtLP1zh0uTkQBhaiSTXngCNjiw/tCcu4ToaKaZU5iXJyPuGIzJaUBir99URAYnStWBID3GcXP2xcVytllchdd133VZI3HsGWeEgJBFoYqiZjCUFUvg73dqMOWT1bv0K/ItxgbjH5DiDn5Qa55XiprERW5oCXqZELVaw5FsvSPblzBTjue7wvEmfe4i0vZNotxwXa4Awt02fvbaQNddPzVxukkdoOvcZh88WgCOb5EbTsWwnmEuHAQBtVdz9VSaKF7kXx4bLV3FcdHLPbuEC4ZTRH4bwinyGrK+TRjEi/BlKjtB0kiLG3+SSksdLauShC2RVkDdgK8WMPQdOvPZ3fE5Uu0HXBbOQ+dPxLOi9IJ7StsDl9N/IwTCApqbxOt6UrdMouxWhEXWXBoN6ABEymEZFw2+894ZxlG4Ns4X6C0VeyyQfco6yMFGXpvdodinHyin2FaBLbH1dTt8Q8Ei4vnjKOKPc/VEs3lfz8lK2Tq7GF+gu1yGa+2iMusCa0Ht4Ls+N6TwKj/yB/gLv0rdf1W/hK+Pvwx1T6PiykuYHeHEocFOb/Iu9ZrpfKPVZ/IEtnKtel3acSEGwz1PFz0fzngpZ8obbvoCjXqOmHF2tPucbObZdJEaTeCuaVH6/AHK8LAr9xTvyZ0nzijqeXtUNIVUqSfmIhMoTz8lcMJHYkzdjtjovnmOtwgiBO+9qmVPCuV86py3gJJQy/1OaeosOsT92Nukpi8XsIyLDD6BWC+x1omwNb7hiC6e65Q8LLRg3Ab5/zCcE35VmFQS+P/s+c3DSgnZc1p2P3qqkBniTA2jxQONAilAB61wIw/mkEJUiV9UiU8q5QRG5LjCmZsl3FD1G+AWSkOo3RnO3QpEd1ajlyJC0BTU54D37hvTDZINFpPxn/3on70RZdx//W4X9NHmZ5+ulP4miFxM0pD8Ah3gRDL+CUhjmu+IGtaDCqJYLP0wkkBg/rDtYPScAQ+PE4MBdNpmWIaQGYStKK54a25JFTo4rZfP1gNAp3BGKFbaxhh8cU28OAP54tA18d9KK8AxynTd3BchUOqZM4D3Me9bdhDjmygzGQqcqvDc/GQKvOBf5ntTtU+u/p9V6InEH/ezrfIhcwJQAkNcYLOCL6OwiVh3tTQsCseHq1FVU1OITCyP3bm5TIaImEvT9wU30WScEhfFjBLPTcwZr6mPOhR2pXIMaYXzFeJt+sKeGQxb4ipM3GX6xZ7XWhdMYC7YA+tMVKcWuttFeHB7kxcg57nddjZ+WVjEq1xxx X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67ab7ac6-72f2-41ca-b4ec-08d972056550 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:42:55.2047 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6dhRwpykIgftUHAzbQow3+8/FSyM2TRJ0+93pHWPqjMm1xTUDw5UaRUA3WOPyPyg7nT7GMRKrc9zbhVigwEUoK4RntYLyp2pfotWkBzsNKo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8269 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org There are few places where the maximal number of channels is used define the size of arrays but when raw number is used it is not clear that they really related to this quantity. This commit introduces MAX_CHANNELS define and uses it those places to give some context to the number. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index ede66ea6a730..2c9ba5fe5f2a 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -29,6 +29,7 @@ static const unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f, enum chips { tmp421, tmp422, tmp423, tmp441, tmp442 }; +#define MAX_CHANNELS 4 /* The TMP421 registers */ #define TMP421_STATUS_REG 0x08 #define TMP421_CONFIG_REG_1 0x09 @@ -36,8 +37,8 @@ enum chips { tmp421, tmp422, tmp423, tmp441, tmp442 }; #define TMP421_MANUFACTURER_ID_REG 0xFE #define TMP421_DEVICE_ID_REG 0xFF -static const u8 TMP421_TEMP_MSB[4] = { 0x00, 0x01, 0x02, 0x03 }; -static const u8 TMP421_TEMP_LSB[4] = { 0x10, 0x11, 0x12, 0x13 }; +static const u8 TMP421_TEMP_MSB[MAX_CHANNELS] = { 0x00, 0x01, 0x02, 0x03 }; +static const u8 TMP421_TEMP_LSB[MAX_CHANNELS] = { 0x10, 0x11, 0x12, 0x13 }; /* Flags */ #define TMP421_CONFIG_SHUTDOWN 0x40 @@ -89,7 +90,7 @@ MODULE_DEVICE_TABLE(of, tmp421_of_match); struct tmp421_data { struct i2c_client *client; struct mutex update_lock; - u32 temp_config[5]; + u32 temp_config[MAX_CHANNELS + 1]; struct hwmon_channel_info temp_info; const struct hwmon_channel_info *info[2]; struct hwmon_chip_info chip; @@ -97,7 +98,7 @@ struct tmp421_data { unsigned long last_updated; unsigned long channels; u8 config; - s16 temp[4]; + s16 temp[MAX_CHANNELS]; }; static int temp_from_s16(s16 reg) From patchwork Tue Sep 7 13:43:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EF8CC433F5 for ; Tue, 7 Sep 2021 13:43:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB657610FE for ; Tue, 7 Sep 2021 13:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344269AbhIGNoW (ORCPT ); Tue, 7 Sep 2021 09:44:22 -0400 Received: from mail-eopbgr70137.outbound.protection.outlook.com ([40.107.7.137]:39330 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344885AbhIGNoW (ORCPT ); Tue, 7 Sep 2021 09:44:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IBYZ+Uqq+9qSqIfWa5qqv3EsZFEYPAf0KX4XcmoAE/rofKK87IMmBLUE7NTt2tSFtzQN2gkK9tHFQN6pwVBaffTlN3fW4TN6oYeF9KkAxVYIIEB4WItUFAV9jNFJRgvDGaAYeWOLw3jdxKsXr0CcCfBILRBkR1QKEoBfU99q7XNQWOyHKHJilIJjJB+QmRTvxHopcsjq6Y2jNNFDgxlm/TWtLQwy3yYMbUdVux/3P8xQllzR/eOtznXYz5H35QTPn0VoNzb8juzLyCc65ykBvTB37KrAX+/rtM0DyGuMF9nvoifxX4+JxwIH8uKK/KBTCjxSQcLH0DLtpHKY3GcY9g== 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; bh=Hsj5n4wvnvZuHYbuN4wMAzJ/LItONO01vRymeWvP6K0=; b=PFa+h8kInLUEMK/eKyO6FUrTyTJZ7pxrfZu20Ipfrj0es81pvqQm+b3xrp9XuFmFf25oq42eeW4yAzCTGAKehP9ulZ6+6XxaHwuHZqAE7cYrMaVpOA5SsbodwohF+kJlvwlNz1N4WHQGySl2VYuPkY54u7yqKyFaLoFzHM5mI1jWFkFS6qGrXY0okg4c6yglpcBpGib8luhWX90IINsHn8ROIWbUmCzowfDpdKqgZTrnPmUdkEk8e8x3N3hmYWpYbmKBrUcKIkD1PSGbtkZQMGcMlanp9/2VlKxX9SMMoua1M0ApIbPxeqKCrXkR98Icm/xIraoVZ6blGktTtGyJTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hsj5n4wvnvZuHYbuN4wMAzJ/LItONO01vRymeWvP6K0=; b=Mua+t4ZP1c8vMOU3eERYA8r0fDGCXvT1ua0e8F+YTyi0keYLOCERDpaIMGUkan3t+OHZEcy5RoQXJgFlgrOWzseKaG/B8iSK9Tclv3P9iRm8eUkqkgId2vufeKuvukO4JL5KPfPJiA2zmg01J6eff6sRujiZ1xSMPcl4LFdlE0s= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8269.eurprd07.prod.outlook.com (2603:10a6:10:276::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.14; Tue, 7 Sep 2021 13:43:10 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:43:10 +0000 Date: Tue, 7 Sep 2021 15:43:05 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 3/8] hwmon: (tmp421) introduce a channel struct Message-ID: <36491db30779131ec67ddd06f3c2bf457a37a16d.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0005.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::15) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0005.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 13:43:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3eb802cc-780d-44d0-9dce-08d972056e42 X-MS-TrafficTypeDiagnostic: DU2PR07MB8269: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cKjwxhDjw+ECXhL7sc10FHp5GiYa/Zjew5rtAYgYfd2zAPG9ZWN2ltRet6YwvFhQHfuYLA1AS+MGqsHwmnZ66qBJ4wBShEwKcqZSkQ3Os/hmjzoFeQqj6ugueOr9JP0vflEKY8XRzHMtNYgT1wGxadG825pwlBsvfyaUElAxeFQJltyQ7UIBfShmw2EvSZQLfsKuBYZw29SWxIjNsrokdj3mczdTLvYycFQj94FVVtXYE3P0inzVsuSUEMQ2iubcDQQZgQEPaj+/dvT2hEuHMvVsHaNn9uhl4tcBoS7JQz9VCKEsGbktusVoLriYKydydYs0YFDW0p5/SRyF9yld0PuKF7ppfkJzwPPPjDSU3VkFvw+nJ9hE3BEPPF6DypY3VX3azBW8v8k4zUob27sJtgIGStwyulqL5C0Tp5yn0p4VCy0IvUOhiLt4Sm/INKzUZpvqKn3GWULy//iFDtrSSZbgsIQy6xhy6Cp4UT2j5veT3aQXXJE4ZeGfaj7wVVF7vLhOzB9u5x40313WQyx/40UpwdvmC4VjJYb+qDw3ScjeUtQT6onCJAbh4qvba3HHy1zLD7JLRKfwE8ptBHszDwylFXeAdAaWjc0YOFEby1FkLd0dTL7gM0t8JU160wSU85OXHYVRxs7etX4dDVsJmHLKBOoYA+U8VTqmCAWBWLi6GvHw6LOY+euYdp0e28t8/zkDrJfrH/cl07Jnzvs+VQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(6666004)(44832011)(26005)(110136005)(186003)(956004)(2616005)(2906002)(6486002)(66946007)(66476007)(5660300002)(36756003)(38100700002)(66556008)(316002)(6506007)(8676002)(83380400001)(8936002)(38350700002)(86362001)(6512007)(4326008)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6HxlrbUxTqdi9B2RN0mxzOZDgLQzEbSd7DJdJK3Y8wTkq8+JBIzNUQ/Dq/46kgzIAc1tcqsagm07adr8UPtS9ECV8IP7s0aW+cTI+2KQZsE6MpuGOxDjlsCmKCe4O3+RB1oKkknuk29TI/CKmz4WWvNfK1p0vfzB1ascH+ANN/PIx4bose4epMX8VyCgsaxLSYN/foTnzXtBSihQh91pCBM3P71kO/Gq5pA+4FYGUBqDoE50wWnpWK8hkOXKbwY68HYeZjtyJYMtp/tavgb90urSN99upxMBQ8bhmpzdJ0m7gRjVpFcQTU1j2jow+KS7tjDzlmYQdUXBwxllLoT7Ufw2QH+yOmVpCBx15ll1+ypt/xEi5f+d298gA0CmdP1Ozgbl/bYe+RrePfWNda0EYezY/d0NTYtmhr+ECJZ4ztyfnu+9UhUP5Ns579VAq98fuq8QOXBosMLepxldC7M1XEf2jBM0wdeGBWx0LYPE5Se65TPxIjJZrbT3bNJw0BX2CHUWRjebwoS9W6xpVgRkpCaSh6G17Rp853Eu/abv0WurHSQ4K3bwTtiYtrhNqfrYr5pnEfJW0nNqlLuLeq7hN4IdSt0IKN6rbsuX/AoNYAekYM88IU+yrUZyJEOhLZOK5wOnvBEpBFZAPPEWbwXpPUPbC+eH+pQvJiuRew1ZSVOUqUQu22NIdONNp/nP+h8A0rKW/QDG5Unh1qvXzCr0dBcFAf63VzDDxhKO8DNn6wbcPLX3ORZlZfPh/+1ZAVYvld9150BpiJSEI7v2CeElUbP+5QW11I2GL3xw647yvXY2U8TIg442HcdMuV37Da4z9ZuUWl2/a2ZejBzhBRuJ+bnpIjMSAv+M0P/Vwch1eefeVbxc8y0OGuiW3KqOBQbsypH0lh02xAC0mv9JHU2V90ARW8qIzMs6qbNYlcXHd3QEg1s7z2lDGQzZVYT6xkLfRYv4qAZu6V3ye1PxaMjHH6p/uUGobpWR7z9r9vVpgZ/sfMXRmrTIZdqWN3NwlvT7CVA/uxmCEjqnTJG/h9waBaGbFc+kLpdLu/LnFBNTySg7SFrIs92BLgcg5MeUVVa7twidLV1zcG2qRBjl6blqGHl/wyaZUUMTe99glOqu1vBSgagPAa5nSxppEmNupHexgKdKLWvOWdDPXYOtL/CB7jknO0EhHlLdx8gbW/vc2OPgtb35qRrz9ojDVK0Qr966BbLJJorQhy0+L5uAVggucRM/kQNBXvc3bv1lB4KeD4Fgb/qPWtAhq0CWsMW1C1Eg/QNgmdNkLWVWepE9o0+xWjgD3dkPxhlHa1f1/qDENDXoa47MAU76ZidtJxa9x2OR X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3eb802cc-780d-44d0-9dce-08d972056e42 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:43:10.1132 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /FT0kWVc6VsHW0DpJy3eNLuyryeX0Z2j8sDhCsHj7+BokxNT705DP6EK4Np0BB+28u440SC7Mk0pvJPsUqKtbLYcA3nlpSRiilqtJGEVqoY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8269 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This is a preparatory change. Upcoming patches will introduce more per-channel parameters so it's worth organizing them into a struct. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 2c9ba5fe5f2a..1068fe59df0b 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -87,6 +87,10 @@ static const struct of_device_id __maybe_unused tmp421_of_match[] = { }; MODULE_DEVICE_TABLE(of, tmp421_of_match); +struct tmp421_channel { + s16 temp; +}; + struct tmp421_data { struct i2c_client *client; struct mutex update_lock; @@ -98,7 +102,7 @@ struct tmp421_data { unsigned long last_updated; unsigned long channels; u8 config; - s16 temp[MAX_CHANNELS]; + struct tmp421_channel channel[MAX_CHANNELS]; }; static int temp_from_s16(s16 reg) @@ -134,9 +138,9 @@ static struct tmp421_data *tmp421_update_device(struct device *dev) TMP421_CONFIG_REG_1); for (i = 0; i < data->channels; i++) { - data->temp[i] = i2c_smbus_read_byte_data(client, + data->channel[i].temp = i2c_smbus_read_byte_data(client, TMP421_TEMP_MSB[i]) << 8; - data->temp[i] |= i2c_smbus_read_byte_data(client, + data->channel[i].temp |= i2c_smbus_read_byte_data(client, TMP421_TEMP_LSB[i]); } data->last_updated = jiffies; @@ -156,16 +160,16 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, switch (attr) { case hwmon_temp_input: if (tmp421->config & TMP421_CONFIG_RANGE) - *val = temp_from_u16(tmp421->temp[channel]); + *val = temp_from_u16(tmp421->channel[channel].temp); else - *val = temp_from_s16(tmp421->temp[channel]); + *val = temp_from_s16(tmp421->channel[channel].temp); return 0; case hwmon_temp_fault: /* * The OPEN bit signals a fault. This is bit 0 of the temperature * register (low byte). */ - *val = tmp421->temp[channel] & 0x01; + *val = tmp421->channel[channel].temp & 0x01; return 0; default: return -EOPNOTSUPP; From patchwork Tue Sep 7 13:43:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A52BC433F5 for ; Tue, 7 Sep 2021 13:43:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21CA761102 for ; Tue, 7 Sep 2021 13:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344726AbhIGNom (ORCPT ); Tue, 7 Sep 2021 09:44:42 -0400 Received: from mail-eopbgr70109.outbound.protection.outlook.com ([40.107.7.109]:17134 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344752AbhIGNol (ORCPT ); Tue, 7 Sep 2021 09:44:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KscfeUPqGXyQaF6U/2AiGelowBHfPhLueYoYRZtJfIjNjgJ4CqFxVJ5x0dlNinOrd6Ss2DbxFZ2lnJ5L+qdAnyeqiKIcNtIxK+6LoZisV51CcVX6e1gbjb0Dywl31aKUNSKH1LMqQqNqff8YH2fzCvll7Mv1CgmcyV3hZPMTAMMAYJC5uzIOuGE476XCjbrFEIPlCdBpUouAnz/hTDZIKNJTTG4jt8QSvZox9rduHon4u8ci5Y+sUxVUN65FRhyCwhPrQyoTgyFdWtPp8sm8srWc8C4GHK+Xtx63rFynriOoJbpuR0c4DWZKiBk91HCj1Tf5eFL94YsJa6WXvUmnSA== 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-SenderADCheck; bh=xj5my7WxshMC3K9ru11z6QN/OTS4xYdeuLRftLc929Q=; b=fzgJp2fhb+LTeQOvJQAhTNz6qRIVZyGo4uGtCwfkrEYbGzvfuEWCz6f2u9oqRYXQZByaVok7yroDk3TZrrGzrKQ+OQlDtYQCk7qMIjHukrwpMf0NxS3NEpZCWuYEzHZBhz9fRWvw/nKz1nb3C7KsLnuWUOdtvR5A8f7cmwd2eN+4HMDbOyNFPvW90AKJp/zmaufGoSS7z8HmzOy82yjHDi9dhrP5Xd63LA6I8SAozTr//S+OU1N/0+Mau+ARV6hTN3CzbaPY/PlrYaCveZ5TM14irf3hkg+Cx/lXykoiAxMm3FQfxJDp/DAQ3fC+jVwtkshYxUt19u2NHe3VRUt5mQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xj5my7WxshMC3K9ru11z6QN/OTS4xYdeuLRftLc929Q=; b=XGq8pK5lB0gz3oO+bSOWbWH5TVIxw2l8Pm59+hIIm6Bi+2RxqEjhvJ1bLhfBQmqQ29ENEV3cuWp+BaqIPdoy1nzxdePkQ+HXe/cmioyqgeaYW+fNtQ+ayn7m5dtseqmG/XiqzWBQZjzDq8FPkTjFfHDpPcb0RcPqPy3AcdcuN44= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8239.eurprd07.prod.outlook.com (2603:10a6:10:278::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.12; Tue, 7 Sep 2021 13:43:29 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:43:29 +0000 Date: Tue, 7 Sep 2021 15:43:24 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 4/8] hwmon: (tmp421) add support for defining labels from DT Message-ID: <22639314543a98b4c24e55b7e5a803325ad9e568.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0015.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::25) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0015.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 13:43:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5932794a-d568-4615-4b78-08d9720579ca X-MS-TrafficTypeDiagnostic: DU2PR07MB8239: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1122; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z4FeFaf4rhjeV93cqd+MNjRDvcGj2oQg4rA0XRg7BUxPfE9TtavSzV5faUDAZMtX//mRdYEj5QFe+Pc+rJ4t0523bDz1rgsruyOp2o7c7A3AGTAeNOmlIW91mun6eIuMTk/Ap7YSdr85eIbUVytmVQyqWusV2NuGoIgz3cA4gbMj1umIYfIu+zo/IeAGnNv7/hGh3ISHXrfGqZTd/iMO4Smz2tNNw5FY5EtN+k17MLL3IpiXkhmPJlyUJr+dkFzNe3mSBRIRDdXNmwLywRBThGd7ZZtKmdpjp0n4VvyD+Lmkqa31R+DIlp5IbXGpBK2/9ESaHhYEs3NYpcZ5PIflqdB/2S4ah4yLD0CD1uSph6d/YjYbkU11e51ULOyACiRMvYx8Pygf+Dna/9xf2A5ItAjL20oeP15s4tB0N8VBXqt4NW4bQr9vBrAj2N/PBRNeQgKxHCyX9ecAYURJZwv2ovJbs+EqQfkUY96RwfBtu0PbrHY3oDLTJk3m/Qg3cRePvy9EIM0Xfrud8weLtad9xyQrIRDOYLPZw9Z5TcVTqa6reMfiZr8bmBHZkupulvl4vL8PMnGV3ABWICxVLfInLTHbrI/ECpTOx+ERnDf/JOaRQ9KsmDh2gBIkB3T3+1yGqTXpdmrw9lJ0d/lOMr/EsR7cA8Zgj0OerwnSeCVgxMqwgEDn+OtX/+jxqFJFTSbP+c+vj/2ctXd9gxvVjxacHg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(376002)(39860400002)(366004)(86362001)(26005)(6666004)(83380400001)(66946007)(4326008)(36756003)(38350700002)(6512007)(8676002)(8936002)(66556008)(5660300002)(66476007)(44832011)(478600001)(186003)(52116002)(2616005)(956004)(6486002)(110136005)(2906002)(316002)(38100700002)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cI+P4uW/P8smRLhUwpgJNytQlBuHuAZEOM/0LTlQ5YMDSPEUxxkO/yq94NkUClkcb40c+w2dzRUv/I2P52KhdJ6ENQdx3nURYszPdPVaHs2lkZbkcRheWiNqq6Vk3sw3n6z8MWtaYMW2gyW2qAmQtHDrIMuMnWkiTh0fMAkQE+bzO5ay9+0iGJE0YxbSALiZgnDDPcDZ4YIUEk6D9VdBf3SJxXBWLcDq1NVV0ZCW6vy5etcIl4b1JvhDjmNP7nvuo7AIF2rLHPryU0B3bq6/mnMzYg9rkj7vz6Nqz4QgAIXaocUxofzxIEjD8ZRnH291H/f03ZkyLmK8qwB4al8C95rCjAQGjBlGxHMtQVmsuX+BfTk7QaA4UjtlWaAOlcyWcKnkuX0ui7UYEImmEAlZZDU2Itwzgtbww2PGvPIMOzWvBSk2ZcirOrJBsIplFxAxrKowpFDV1fTLpHPolmv8yYuSyQ2VOEwq9ooLVXAVij35WdeLeJfQda5kYrZVvYGmBrpvdL8K5d9kJWT5B0cJp9+Ssd4ZymfjfYdsz1H2O3lYHMMmiUlRHa8MAgYXRSpm09RjfvXmCAlflXN+n2P0+eB3boN3h7EbzspYnr55xRW9K3hdYZn5gJJ2/38g3qov7J1sZcf3W+eDdVKQ2QLdhcomyDSvjrrHjuWnma0yncCjN8liwiruxFWZJmP0x2zrC0IJf4G2WjSq5JaU3thIpgNPQbMSKwjYF+h7FjvGapRZ+q7gtuA/p4G+Uc24tbfMQphjKxzy5yo3qdFM/YYH6yEQ7ytvvcHhOrRG2qPbJpoz0p5DV9a8W6zJcfTsW3yf8hkvYfEKUUeHAeWJtYlDH36OV51971Fpl7jqHfxKojmbl7TNvCi8vSwYr0wP2cdxzx+gxwhWi0DHwM2RUzyGqizY1EQ5VKsc6rFi8iv7unCa/dfTyuNqD3nIJinE9SkCwtmo1oUWsge9KmisRdYW0dMJmxay7OIUecJuThplMHTTt6irBPMiKd3MkR/AfNW8iXUrM8ls9uFKjJydD4eCamU/ETaxNxiPlDJ4p5RZYOLkLGZOB4Xar3zX/jyIxBuS1wvBJMgYTyla5HL9QNI98IyVdXebCa6mSij70cr+6OF0ReaSD7viBfBnQyZps1xutg6K6AMhauaV7SFv64rKj7iw9PtND8A8DyelPZ2RBTSD0RRS60sM2+hMSzBkRQnnuTYwqTVh2WNuqK9FVWM9Zo2eU6ccTXy72oE5q5mafaPyW7yLM6+dPOkgi64Q/hhyw4WzVA+UhgPaw0uJZbG0mcaFLNUaRVXcIEMuuS8blZy5VlFCJAUrrMeBsHy0JDJK X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5932794a-d568-4615-4b78-08d9720579ca X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:43:29.7083 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6+fn4Mz/ZxnJDiWaZ4Lxx1ys7Eo2qdvzqwIw9wxfLuLmOipoLg+L/QcSCbI0DubNCWZaXehckRW0Q7V6eyqa4nE9f9dpHV/yUXJD4N+x2FI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8239 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org tmp42x is a multichannel temperature sensor with several external channels. Since those channels can be used to connect diodes placed anywhere in the system, their meaning will vary depending on the project. For this case, the hwmon framework has an idea of labels which allows us to assign the meaning to each channel. The similar concept is already implemented in ina3221 - the label for each channel can be defined via device tree. See commit a9e9dd9c6de5 ("hwmon: (ina3221) Read channel input source info from DT") This patch adds support for similar feature to tmp421. Signed-off-by: Krzysztof Adamski Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/hwmon/tmp421.c | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 1068fe59df0b..a1dba1d405ee 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -88,6 +88,7 @@ static const struct of_device_id __maybe_unused tmp421_of_match[] = { MODULE_DEVICE_TABLE(of, tmp421_of_match); struct tmp421_channel { + const char *label; s16 temp; }; @@ -177,6 +178,16 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, } +static int tmp421_read_string(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, const char **str) +{ + struct tmp421_data *data = dev_get_drvdata(dev); + + *str = data->channel[channel].label; + + return 0; +} + static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr, int channel) { @@ -187,6 +198,8 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, return 0444; case hwmon_temp_input: return 0444; + case hwmon_temp_label: + return 0444; default: return 0; } @@ -279,9 +292,45 @@ static int tmp421_detect(struct i2c_client *client, return 0; } +void tmp421_probe_child_from_dt(struct i2c_client *client, + struct device_node *child, + struct tmp421_data *data) + +{ + struct device *dev = &client->dev; + u32 i; + int err; + + err = of_property_read_u32(child, "reg", &i); + if (err) { + dev_err(dev, "missing reg property of %pOFn\n", child); + return; + } else if (i > MAX_CHANNELS) { + dev_err(dev, "invalid reg %d of %pOFn\n", i, child); + return; + } + + of_property_read_string(child, "label", &data->channel[i].label); + if (data->channel[i].label) + data->temp_config[i] |= HWMON_T_LABEL; + +} + +void tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *data) +{ + struct device *dev = &client->dev; + const struct device_node *np = dev->of_node; + struct device_node *child; + + for_each_child_of_node(np, child) { + tmp421_probe_child_from_dt(client, child, data); + } +} + static const struct hwmon_ops tmp421_ops = { .is_visible = tmp421_is_visible, .read = tmp421_read, + .read_string = tmp421_read_string, }; static int tmp421_probe(struct i2c_client *client) @@ -310,6 +359,8 @@ static int tmp421_probe(struct i2c_client *client) for (i = 0; i < data->channels; i++) data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT; + tmp421_probe_from_dt(client, data); + data->chip.ops = &tmp421_ops; data->chip.info = data->info; From patchwork Tue Sep 7 13:43:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00388C433F5 for ; Tue, 7 Sep 2021 13:45:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2A6E61100 for ; Tue, 7 Sep 2021 13:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344824AbhIGNqQ (ORCPT ); Tue, 7 Sep 2021 09:46:16 -0400 Received: from mail-eopbgr20131.outbound.protection.outlook.com ([40.107.2.131]:47779 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344822AbhIGNqP (ORCPT ); Tue, 7 Sep 2021 09:46:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJ6zjlw10x13RMcqyMSmtXoOtdynqY1/yHYcfOH1OyTfvoygw65u/XEmLnAQJndkUVUqPrF1Wcu7rl0W9HeeqxQ1YH1beWF7mu9s1i0pnp+GIFkTRxmTYoyiwzuGeOJlNYrHUHd9r8jK1Q59+xStoh80ItAo+FIZxDo0jjmC4fWu14+U6sG1IMicTj8NxvhAB2qoWdjhAK52l9F3AOA/cSE8kFU5alkWLuC+54w+0qzsFEDsuARj1WuMlA9613EmnXdQ0GuI86N/TaNYJYw7TO44IKE/XmuFPqZziSOFQVylVF0o1ZPz251cNYZk/3do1a7HeaoyaWgo/7F5AgT26w== 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; bh=DakFl7vq3D1fjzo5pbNgWp+j4UgLrRLR4GmNJSs2nz8=; b=auaHjfdAglCiPyn1I7ZdIvK3sIV0xRTumNnutaSMOalDvp3C1ZXyoxdko292DW4aE6ph9v/v6gFu4muOvKOJQv4RKlmW16touGAJ/pHnkmMOJ9/TCDiahkh8GCDTzj6L1yOK0YadH5TfSTDMTHxh1pJn6NKDxJK3FLobIL8vjaMqiVDFYEOaFex1StprfIwCnXplJvDzZhogdQZbwzdtGCmBGMryvfkGbEC/td2hxBW4Q7d1Ff6cMVrapEmmzZN054+PTrIZWDRkfxF3pC04FlAnj0xDX6zhWmbync52o/W7BO+tc/p/skkjClvrGZ2Hl2S/au3ukoGkkZRCCt/BXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DakFl7vq3D1fjzo5pbNgWp+j4UgLrRLR4GmNJSs2nz8=; b=HJtpEM0NxLZYBFiEgNimrsrFW9JIbdHm142/hSHeSZCWPXyCPmzpvonnthWClS6znROIimA2P8jYC8ENB5HdEnwzP1hGCS7zX8Q3TDPPEcGuc86m5QZIkQ31Tig60c8mnKJQ0vJjoWE19hPoC5Ig4+F4QNtda+L6sF20FDpmBck= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8286.eurprd07.prod.outlook.com (2603:10a6:10:278::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.16; Tue, 7 Sep 2021 13:45:07 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:45:07 +0000 Date: Tue, 7 Sep 2021 15:43:46 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 5/8] hwmon: (tmp421) support disabling channels from DT Message-ID: <1a2aa678c5a6261a1c096702f2e314e701533660.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0010.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::20) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0010.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 7 Sep 2021 13:45:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8225ce0-7306-4ea7-929c-08d97205b41d X-MS-TrafficTypeDiagnostic: DU2PR07MB8286: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BikP2oOI2TlACIq0JKB0/6jAuqFr1Ge3SdfnsmuOnaBY1R3bbHe2vvwdOsqyOAEJNsyHt3maSFSCoWbGDTAxRxr/uK1NH81+Kw/sMaombOLmsuNFQpRHRy1lkReGMT7SlAbqCA4STLVAqly4e8mhizvyPNNDz+d7U5K29vTKI0AEoC+9kn44/F+bRS0ewlXd0PowIqMfdkUEDaEc5A4vsgAE5ithDtt2CuZ7NE9+tHGeCKFKnNB+R3lBvkJPcohv3OL5a6P4Bi79wRq0wCslt16TSCPPfvvCcJF9R/t5urDt9hnykg9+sfCxD5aKWLgYoXJ9ChvJDf7BmfWW3mNrPKNYjnTgWC7pdxqy2dvrsiP/yrmcrBikiiiGXWve1JsMauKsCf+4SP6iIlt2PSHNMcRXFQ1Tc6Y0whqKk64wCA+fAT5MZHDx2kaacTmo5TUMU1u8r07dSoB9eNvWkBMb+WcCCjWJavp9CY3s0N5cFZzeSfI2lmccLu7qu32us95X+cP9bljPJmujfprlVcSZoqGxm7C5RTEr1L85QZ1Q2WQ95tpBELiHnQVS4GAne+5rC5EGeVY6SEzvCleo+PIl5iPZTKIjGIXBVlkHqnNzWdsNdaYRcktV5a16OXq7ClyC+WpET2Qbon8/GjOMKZgKCKbYRiplDModDpF3L6OiAsU3+t33X87IHbVyvordFgBCeAXgfHMUeGk891HWNSpO/Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(376002)(366004)(39860400002)(136003)(396003)(110136005)(4326008)(8936002)(6666004)(316002)(36756003)(8676002)(38350700002)(186003)(66476007)(44832011)(66556008)(38100700002)(86362001)(52116002)(26005)(83380400001)(6486002)(2906002)(6512007)(5660300002)(6506007)(478600001)(956004)(66946007)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4hVjJqk74KvpYBRmiBzxJQ4/Ijz48ta72Wgf1v1HySe84FzkqWXrTL7VYyoqIf7+DtkMnRmaAI+2Xxq5LmkrHJDkXwmxkKkEdgqK0dI6pe1rBjkCax9GKcWrI9kgfmFXGPIXp+pu9700lUfeZhky94mSdIKqOvfcrw3u+yJnuxCNW3y6eoVlfFFH3FN6kkgTCYTcpClX7Lg5zjz8B3IKEhjAU/no3eR4mNo0JKcnl28mPZ5OEDoOhEsCsovu6XaOWCk+FwplowVNyMM+O0q4Len8NcbmpmblOpW2yf0AAnYABdGhNtcGCKT90vnMxX2bztJb4umHuw/rpp5stmlLVGwzbDrBJwalTMNe0PYkGhwp58/lKOw197XmbOxqNFgzO4gvn4FhZGOCmocm3lXBmHwjHhvCsyahhWhVaahzXy8M74Y7+neGp75yCYcu3VXsguleAfpKV4meq80W6ahmXKjIdPuZs9Yrk9TBd6MR/sOGHwOXZXfiynQUqNDXHAbASad6dcNqR7lJVzJSun33B1NbbKI1ve97MtH6cBxk+R5BS3K1/4KoBz57oMFsoVfe9Ca+JunAcGrjt+GZhP80yt3CIPCaQDA2VtoRfH6FtXgwqopLmYzLYFhL36/mpFVHuwyY5zcyAYhmSRd6Ti9gH6aMcYfE/tWo6iCVpigkP5OA1BrOsa9Tp6/HxV5+D90jpB3OyRwDGe/v1qjPg2JwRXBNZW313JfM41lyVwLI06w0FaEjZM9EvQ4v/CIQBeA6FZ0NU6VfH04CGQcK07yVu49w2HwTw6dKT95QEMKXGez9WDgVO1Zbmw5vIdkokJ+D/YcjuYp9dxKqMlMt45ebgwjcWxORb9i+EwjIuQpXXcTI85XtmXZVukvCRJEEJ6NhSAKmIuZZfpVql2fmOg64bBaT2d8198ekjQvy6Xx888WVQycMyZEbk5gaI+mLWZxYxVf8u60g0GOOQ793s8jt7MdqYDwci1gMeje+0skCiAILLxy8afAz9km5n+mIdMgu7kqEp5ojAiL1oGOrUt/pBQj2wIhc8prCtA54PFGwImxVcp7KoQm7EE4tLIOgaYt2mh7sYZuK2c3GdzQnYlRkuuKfQU/9lMFjUDNGeQrWqrqMbNZ4Br3/o9YlQL726ayLibAhZNEMpX1yt4wbWzdOYZNi8AJlQpXgVGmH7x4w9YTV1yI0nyfyVJENPxS2fI0T48MQvhoLYPnIXmnsuHw6E1Eyv1bcw2ROtk7CQOwSMCbu1PIctQipLfh7e++/4ompK/PjDvyFriD8qbIVcpAalxTSG1rfWU+7k+rzWLdIKMUYMSDKS5CyfXcCXxpAhMm2 X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8225ce0-7306-4ea7-929c-08d97205b41d X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:45:07.3847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W9dEnfJVfPb0YwSVS4/1jWi+hXyLW56bWhxFlm3d+fFQWWhqn3Ki3xAnRP1+3efgVuEIpfRvOGpERSF7lPJVmWq4qj4GKVbWtn0LjNiKsUc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8286 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The previous patch introduced per channel subnodes in DT that let us specify some channel specific properties. This built a ground for easily disabling individual channels of the sensor that may not be connected to any external diode and thus are not returning any meaningful data. This patch adds support for parsing the "status" property of channels DT subnodes and makes sure the -ENODATA is returned when disabled channels value is read. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index a1dba1d405ee..a41d7935acb9 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -89,6 +89,7 @@ MODULE_DEVICE_TABLE(of, tmp421_of_match); struct tmp421_channel { const char *label; + bool disabled; s16 temp; }; @@ -125,9 +126,8 @@ static int temp_from_u16(u16 reg) return (temp * 1000 + 128) / 256; } -static struct tmp421_data *tmp421_update_device(struct device *dev) +static void tmp421_update_device(struct tmp421_data *data) { - struct tmp421_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; int i; @@ -149,14 +149,17 @@ static struct tmp421_data *tmp421_update_device(struct device *dev) } mutex_unlock(&data->update_lock); - - return data; } static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { - struct tmp421_data *tmp421 = tmp421_update_device(dev); + struct tmp421_data *tmp421 = dev_get_drvdata(dev); + + if (tmp421->channel[channel].disabled) + return -ENODATA; + + tmp421_update_device(tmp421); switch (attr) { case hwmon_temp_input: @@ -314,6 +317,10 @@ void tmp421_probe_child_from_dt(struct i2c_client *client, if (data->channel[i].label) data->temp_config[i] |= HWMON_T_LABEL; + if (!of_device_is_available(child)) { + data->channel[i].disabled = true; + return; + } } void tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *data) From patchwork Tue Sep 7 13:45:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11893C433FE for ; Tue, 7 Sep 2021 13:45:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5E0361100 for ; Tue, 7 Sep 2021 13:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344824AbhIGNqu (ORCPT ); Tue, 7 Sep 2021 09:46:50 -0400 Received: from mail-eopbgr30092.outbound.protection.outlook.com ([40.107.3.92]:58745 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344814AbhIGNqt (ORCPT ); Tue, 7 Sep 2021 09:46:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hidxxc9Wg0EIBTtzWHzN0rCURaldE7n1ztihppcoGDKuPZSn/QQVgjTjzVfIWSvRulxmOx86Qm2oPMYMyix0mrCHKxlw1AM3zK9pa/9+mUWcCynjbMr+7OxS3lFWuJzFf0swJSmFuCDbKSG9mg4cC/Lu09C1oVIFTs5q8uSF3HOEMXZPqFJodDQFNTXWfvRqzw1+FYpYXA+NPQCmfDwF8quhRBvtSMuKQ7Q+wSDW5oh9bLtVD36zZ7vG6umu5FuedMWKJENtG4ZTPXIYPjU+2w+/Z6nJPj50afDI9QTC+Qxp1tQP1EullVwhc8e1RKMWVEVNHT8iU0gtae1lcVbsMA== 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-SenderADCheck; bh=tlrgkwfyZ4T769jKIA/bOWIXkKz7D4o7VAUEA4lOzuo=; b=D0tXGkSf/tCc1B6FA24+hTrHz8nBDffM1rsQB3OfebbMoQl2jKH8eCgI54Ra5XHFPbjRdKqIBbHr+Hg9jCYEaWRKuzXbmQbKrPTrTk7sbRiomZ1lAMUcwUhQcZZ7vI0ZJgfT9V3Gdxlm0IiD0Q7IPPyVTQYPN6drJkI6WWc4Cpl9oHW/P8sfxelyne+FvQwUiaPRe918wz8UoXwDx0jnNybL3jTaz6ema4mipi26MoZFCw3LvRS64Gj9SdlMkdqApD6le44JqrDtdp/yW+CNPmFFJIBGG3flsTw4UPcI+OZNkftYXfS4w7OGsxyqzNENYXBQ4vwGqMTRa/jXZ7IXjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tlrgkwfyZ4T769jKIA/bOWIXkKz7D4o7VAUEA4lOzuo=; b=tsKxdl1ftTvb3mC/7Qt6NFR7+feY+pV7EegKHldBFNUjMTBN0aWw5Z+iIa3n+fKVSlquSxItTdl7t1zIWf7sovkA0DaS5Af86B/TpcU+FUsoeVHVytR6l/yUHL5THaZFrxUQeToPw78NT4K/rzgpUDP9BuCBXzUSV/+nEIY8dCM= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8221.eurprd07.prod.outlook.com (2603:10a6:10:272::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.13; Tue, 7 Sep 2021 13:45:41 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:45:41 +0000 Date: Tue, 7 Sep 2021 15:45:36 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 6/8] hwmon: (tmp421) support specifying n-factor via DT Message-ID: <546898c479414a00e9caf8902d8d8db082a02668.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0013.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::23) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0013.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 7 Sep 2021 13:45:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5eac74a5-5d33-4371-cae3-08d97205c7eb X-MS-TrafficTypeDiagnostic: DU2PR07MB8221: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: esYD7Jpu5quGxBTfqdDC1R6kZfDWp6JZUVroPp+DCYNJ7bEzwAOm00R+lfpgcBkJl9tQUXZhbhsaDwGOct8aEmoQJGK0/DgThOQqk13Wq0EOBac6mU50OL8kdEZFFPtZ8TSVCEZwU4XLXqQ02PjYwwF/jTG3MaRnsVpK0RhSIZ6uf7jQhzg+KrYI9qbF77aJiOAIo33ZFfB8krCoMHLS07PhHhETxGPOBjxnnUKs6T9cTy3UEzeJ+qmQBeBNm2WV34v76euHrk5FsWRirwPPdrowSHktsAX3GOZjPCm01yeY9fmq5Brk3VgJaM1h8Q70p6dY3ZK8ktcKp3lkmHxpEnA2OOQF9WvTF7mRKaKu47EDwicxZITzxMRhIs2r44J6af/KbAgd6zV7HoxZVl6pr/5rIeNGL187NGC4rCv25s2LrQr4icZAZl5AJ27gSoUNeEGulPhyVyJg3TjPFLCo5f/jM2bo5iaT91xPBs6wBtPr7Oo5VWQaR2H9MWMw9HdnQ8dzr/6auHdi78RjXfvXm1M++RV5t5GiXrO/ECY2mAvM/awayyuK5RXN89Ud1Aki0cMpdcVudsl6IPpOEb6K5maU4pyUhVs37H5w5XRVCmXZ0ZMtFvzo6hd6P1raJxKKjiXr2bcCVfP/AVxBRlwp9s3xfVWa/2DejFujLAlkBbeyRzpK1Hizql2EA+VPsaaojm3fH4xEd3LjkmuAMzfViw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(83380400001)(186003)(38350700002)(6486002)(8676002)(66476007)(8936002)(86362001)(110136005)(956004)(66946007)(508600001)(36756003)(2906002)(316002)(6666004)(44832011)(38100700002)(4326008)(52116002)(6512007)(6506007)(5660300002)(26005)(66556008)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MXxnLHTO8eEyX+oSrpw1SpU4cD45ojPvUVOdEw9X8zQV5CLUFXXhoxmT5eUH+Zyj5jyFCwLZaagx7IIPcvIh5O7WAFUxPj4ie3M2ZK6mRPE2/3D3GpZBBOlHmueEUXvOaPbdmwJSCalfOWgpESrGguaG+rLDMRTx9wkoJODEUjSQxzUL6grfFEWz2UUmAO6rscXNaqchXZMgjLV/6Q46TlUXwVYzGFrt2nFpxbI/T5vZAA2htd/mDNmPJS9gaHBDxUy5Cn777fVq9tIHtL66jHFbIra/R1zQAnVbcFUDXVrmah1TMOP7xzwhoGT10vosrKH7joDAg5fOARLNZbO01LsNfSJLGWe+iJ3DhfboN9h38slRd9f4Jgqqyi0Mau5X4ZLFVzM0+jIsGONGA4jaDa2WYmUwR6pNLFIW+EbAy9pEu68pNCeq+TGj/sIecKqqlkdCJdS0pNOJNV8ALYIeKNxIBXFu8DfvbsGhfw9cl5h+mhdJziecyfxmlGkUbsAj9pJrU0QNULP24SZNhT+8vcwAWUSjcbBGNeGV8r7R+P4xyWocShtq5g2Tm+InJ9HYNP7BxQ1YRKSQKR7Cipj7Iar36r1LEnPr0qSxEBnuXY+ye3IJgH9tHPIEDZ0CAkHlCfnqIEj+5Q6pfMmapCPBd9oeDBcbReB7lWRT2buGiAnxYbAC64cEGEcZF6S+nJzFlAHvw8c76ym2pla2Uu6D0glGeYy4S0r84zflaeRuF69KOEyR3qWb4y7V2FhrYA2ETtK4wiuTZfrhqEReN7aSuUkKHAovcqqPh9UIMgPsa1yRx2hojAWC2XamYTcYRbGbyXLpjK1KoGk2/MmC98+BJFL2AGi2BMi+puB9q3t8nRuYjFe5UPKCWxCbDMWmgwc+Ih25Qyid8Orn7Kk6g4YXvDfg5AoeLNrJYRvDWg/Da4DBUMkf8gve9VVLhyKbzQKiBr9YG70z9pbC0yrhURa/wdC5+QaEweWnqisyK4O6CZVzPDx4LBbKjd4IqHzIeb8KB5xnAtImVb+l3xK5YYqOn8NNyQ7Lc7lxCOxkKZ65WP7vv1HrKDkoQw9s447sFKAPGaoW5oPcMA48tNptD5bLEaDj3NZ98EXPu7P6//4GJozArpr/bdvUwT8YCbA5aJiAC7udziA4POKSA0hnMo1hdrYj4rUWPaINaMV1DRKspv5I+i2Tiw9lqMZ+GlU5q/4g5usPl/yO1vG+zvuePU/PI7delKxhiTg5qw8ExwkmdngsB4VMOoftZOFXCNcWD4eGz/BOyqGMOYhWQc0k9wvezw1Jc11aMuDTVcqMGfAl42KP42/hypCZbp7qJXHClaAN X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5eac74a5-5d33-4371-cae3-08d97205c7eb X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:45:41.8016 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gGQSndYaSuTMyHjdHYhv9Y1Wi4TD1Jg24/XMyUXvUMOD2CVJj/S8Hpd/3+RyH/JuQx3fa1Y2CXvhs6isW7rMr+lur2i1PMP5AEkp6LXT+5Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8221 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Previous patches added a way to specify some channel specific parameters in DT and n-factor is definitely one of them. This calibration mechanism is board specific as its value depends on the diodes/transistors being connected to the sensor and thus the DT seems like a right fit for that information. It is very similar to the value of shunt resistor that some drivers allows specifying in DT. This patch adds a possibility to set n-factor for each channel via "n-factor" DT property in each channel subnode. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index a41d7935acb9..90c6b094785e 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -34,6 +34,7 @@ enum chips { tmp421, tmp422, tmp423, tmp441, tmp442 }; #define TMP421_STATUS_REG 0x08 #define TMP421_CONFIG_REG_1 0x09 #define TMP421_CONVERSION_RATE_REG 0x0B +#define TMP421_N_FACTOR_REG_1 0x21 #define TMP421_MANUFACTURER_ID_REG 0xFE #define TMP421_DEVICE_ID_REG 0xFF @@ -302,6 +303,7 @@ void tmp421_probe_child_from_dt(struct i2c_client *client, { struct device *dev = &client->dev; u32 i; + s32 val; int err; err = of_property_read_u32(child, "reg", &i); @@ -321,6 +323,21 @@ void tmp421_probe_child_from_dt(struct i2c_client *client, data->channel[i].disabled = true; return; } + + if (i == 0) + return; /* input 0 is internal channel */ + + err = of_property_read_s32(child, "n-factor", &val); + if (!err) { + if (val > 127 || val < -128) + dev_err(dev, "n-factor for channel %d invalid (%d)\n", + i, val); + else + i2c_smbus_write_byte_data(client, + TMP421_N_FACTOR_REG_1 + i - 1, + val); + } + } void tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *data) From patchwork Tue Sep 7 13:46:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D07CCC433EF for ; Tue, 7 Sep 2021 13:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE063610FF for ; Tue, 7 Sep 2021 13:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344844AbhIGNrT (ORCPT ); Tue, 7 Sep 2021 09:47:19 -0400 Received: from mail-am6eur05on2116.outbound.protection.outlook.com ([40.107.22.116]:27361 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344814AbhIGNrR (ORCPT ); Tue, 7 Sep 2021 09:47:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MUw2yOd1gzkxksVlWNslHjQfmMQWtpebO0gPn7jcqbbSo7Q8R5HohZAgRLggoOnPPoMRSUsSCZvBi+uJEFNSDUCf+BkaPHt96in6OqrK9c8Rvi49EScT/6bP2cFpQB7ytpZehBeRK+YCNCv9N9RymvPu+INTlrwwnMAk9Jw/D/wKZxHd1Uy66UHaN2FCRdUVtzjHFeAQ6GzZi2lQKZ3B+YjpP9VQzzIlTpq9nlNeIHNqrl3sklmOUWIdTQcJk1Y21EmAb34rmRY5wRTLhTKsIdSgSNigmeaq4aQMY934glmmnE3Lyfgin19iQZJIDQvsPnz0cNzmaFkhNfzU+QPL1w== 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; bh=O6SdkTVIKhbyDQHQPQaG259ifhNybU44H7mclDhDEaY=; b=JgqTqSevRMRPjEUfK/B5zo1Vx07TLz3t0BhLnp8PJycv+7NDBKbqVDNW1rA9OG2SZ02DGKTjycPI0VfFDpv5+wi/XQRPk6M2byWuMosNXZxh36VrHyBVaQQF51KN9EXYdYzHi8wXnpy1R4L2CxMeJLR4DlRQcHualGmfPz2Elk4GswYK7zAC5o6SMtFsJgUyVog+sb5d89Q1XQmnM1kMe1OIa1WpjCTYdIxYgO5/g/5SWJNTvFPITV80d4hQ/oYyHaECJNxMACvKjVf1sqaBhUeWgbcQxhPcgA46VZHumAIXnVNBejVoTnc+7hyfLVB2xMIBvp3wG9XZSu43ZJdsYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O6SdkTVIKhbyDQHQPQaG259ifhNybU44H7mclDhDEaY=; b=a+pSNp5XKc/fZzs7+sAEoUQyuq4pmLrhddYrwgRxN/lGKLZZK4Zj4vM5BE+sYSzPa/ayLFhd8SQjT6scXGWqawME8F0ZIBBuvk9ohmFULpdHWk6pSxCKmoa9XH68FBoUPSWc8si2MoaEWQEUJE4OslgG8FeXksFRX88YePh1QXA= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8303.eurprd07.prod.outlook.com (2603:10a6:10:27c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.14; Tue, 7 Sep 2021 13:46:04 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:46:04 +0000 Date: Tue, 7 Sep 2021 15:46:00 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 7/8] hwmon: (tmp421) really disable channels Message-ID: References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0001.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::11) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0001.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 7 Sep 2021 13:46:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16b78887-2f8a-40e6-e2b8-08d97205d60c X-MS-TrafficTypeDiagnostic: DU2PR07MB8303: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uLEUzq4QRNdutS6dqOTdFobdOC/hoGVQKHsbTU0Kxk1kXSgEWhAogBHcfW/U02E0UvtI31JpUs+5cdxyiR65rQ6Pq1Y2/mhTKVhduuyzTLFT7z/njhRhXOyk28iwPla5y2JOm6m2Ml1tCtL0cySF6z/JAiyNXSG63RD0B6Ae8Cfnj/jLFkqJIzXnt2U9uHoKsG4sM9f2B2BrA8gZYpMlDx3/UVC7ecHqz0d9q/PSUtToXpOZYyu2FKchZ/bzceF/Hcfz75xcZ/RcE9piIA3JnVFzAxfT6m4rFdDnTzIEZ5Nc1V7WH/nsgkL3zgE7rKD1mvS62dYtRIT+s6Qv3A+2SbH8gXK4dNc7MMYVfoeSIcuTaf+qDbBr+ng4ytUtv+fjRbuMq+5RRyyQPibQce/S2ffQ4PsgJoLrXppKXtjskK6+ito12+6hKNBFAhgVLuZrqcACMZYP57WCjz3Uirg51CETUwW69rJlt3lYqg94t5yITfBWEA5ziMthdvmBJr19Bri9ryK9X7bAVSpNyaD49TSDzpETkudbS5TZQqDlx3mC7liSsRs/nlhzJIx2Ce1sD8b6gUBRitgMnThRHlZvERCykbERj4/M2NE9Vptw+OJ34SXViV/b1HVMEEX26VWMlK2tkhJmEvuoGyo9g21X8YNfLj6b2YKrgfdgvripqi1Cz1KoGIMnsHvmBtbnpSKKLGLoqceYyMJTE/PnSj4jtA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(396003)(366004)(346002)(136003)(376002)(6506007)(110136005)(44832011)(6512007)(6486002)(186003)(4326008)(478600001)(8936002)(38350700002)(8676002)(66476007)(52116002)(316002)(66946007)(2906002)(5660300002)(36756003)(956004)(2616005)(38100700002)(26005)(83380400001)(66556008)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 39SQBu2R73tj1eWX/alrhdE0w859+d4ISbN8bgiaUZM/agW+6vQ/sDelIZoqWF+iqZ56bXFP3lFEBy/WOrRx5JtIZU4sjl62vNfase4OV7c2haRGDroLmStb0A97Zqs8RdH2jdcL3Tl6jW3DWLydiCH4at2dJxp9XJMkNkuM4ObulPCC729Q1z4LqFOG/pN56g2QLFqoDocEs31JhS3PnG/4I3UM6gnS12lMVfr9and8SmYN9xDHDAOFZ+roQrb7Vz+TvGOOnwR0g1CUpo4lAAe57r1B0v9gIzteOYkOtEWuaD8t6dA150cP2OmZJNX7iiDlnj9neKfD1WSbnMKEys+Na+dGhWKuzubC1fv2VSmb8NhSA9NEmBxxv8VtYNIy9krVx+dqeZbwzY/EOND6J4KULOjIJXPByk5J63SwdhFw80IjEsd8Csay4Vqr7YGxH1Oh09jCN5F7BGXl7abWwVKXgWHnDAH41D+JjhHCf/1Y8J5/KvFUnAYQQTyEpy2+VTX37Ezphw7LaP+762Lj/F04jJZcNCqrpttUYtoMIKbPvyQK/qYDxrXRHh0vC+aRuzadudX6eAmok8UFx+cNIMDPbTNmCsahChN9oZaIgfe7dJUIozOZ2hPeXVEA1HRYk/TlsA0bbzxWqwU4K5bnhjPaESd2dUDYqI2kR8h8ET0+94ltXrtSaJv4iMTlleVjK5to/WigtL7Qr4WPB5O4AEZW59MvPA4Z+DZXG6nYtbEDp7yKtU8gfUrK4Tx0ABSW057AP5xSz1MXmCxeQ3ZD6tYLWt8DSr/We3ne3JYkBmIR6LZK4BDG8yt1xdzo9wnm8qEpT4utZFKszdJRpKISABa8yhyaQl5q6D3zdipkL5hjBROXNQDBR3x/h8EjgxctSHYWO4t3WVOk4a5HKM6dA+X+646bB6P4nudr6c43DcfkrG5eu76J2pjKaRPawtwc+ZZ4FfuNiteIGCEtulz9zNYqXcYmLdHoXn+jlp/uvhpiqJ9EeF8Im2w1H0DF0kZm/s/Lyrz1ATzj8zOMOeSTNMsKogy1uiOHM1/6OtBeznXAbvrD3Fd8GAI8zwKT0tqTNb5e60E+3xDBo2JBp2uQ667h1oixOhfgH4CKQm15NVOE+0+XO0atH8efW68nt87ipGqTYJKbklEgHoDw1UbbaiDvxJPg5XStvpGNmLPCwiAR4fPS26fm/tO7dOSWm6R+YKx6Fw99s0f3KueaRV2s6olUNqYrfogwPxfEvdyOcR60lfBa3jQ/a6gnaM+SKPFJmFciwKzZ5NB2YKhJVmCGmp1CxbefdiN94syeZu/Dj0CIymq+1k4z40bTzInvQdQK X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16b78887-2f8a-40e6-e2b8-08d97205d60c X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:46:04.3427 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GMqjRYzdC8L9/Top1IGzLXhCQir2dM56TckIOp6DYo4eDJ4RNZC1GgMh1ETP2nM9jveZd25+q8/SwuefvEkW8XVNA2zuFe56mzboijtLLNE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8303 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Recent patch added possibility to disable selected channels. That would only make sure that the ENODATA is returned for those channels but would not configure the actual hardware. With this patch, the config register is written to make sure the channels are disabled also at hardware level. Signed-off-by: Krzysztof Adamski Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/hwmon/tmp421.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 90c6b094785e..cec25fb1c771 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -33,6 +33,8 @@ enum chips { tmp421, tmp422, tmp423, tmp441, tmp442 }; /* The TMP421 registers */ #define TMP421_STATUS_REG 0x08 #define TMP421_CONFIG_REG_1 0x09 +#define TMP421_CONFIG_REG_2 0x0A +#define TMP421_CONFIG_REG_REN(x) (BIT(3 + (x))) #define TMP421_CONVERSION_RATE_REG 0x0B #define TMP421_N_FACTOR_REG_1 0x21 #define TMP421_MANUFACTURER_ID_REG 0xFE @@ -351,6 +353,25 @@ void tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *data) } } +void tmp421_disable_channels(struct i2c_client *client, uint8_t mask) +{ + int err; + int cfg = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_2); + + if (cfg < 0) { + dev_err(&client->dev, + "error reading register, can't disable channels\n"); + return; + } + + cfg &= ~mask; + + err = i2c_smbus_write_byte_data(client, TMP421_CONFIG_REG_2, cfg); + if (err < 0) + dev_err(&client->dev, + "error writing register, can't disable channels\n"); +} + static const struct hwmon_ops tmp421_ops = { .is_visible = tmp421_is_visible, .read = tmp421_read, @@ -363,6 +384,7 @@ static int tmp421_probe(struct i2c_client *client) struct device *hwmon_dev; struct tmp421_data *data; int i, err; + u8 disable = 0; data = devm_kzalloc(dev, sizeof(struct tmp421_data), GFP_KERNEL); if (!data) @@ -380,11 +402,18 @@ static int tmp421_probe(struct i2c_client *client) if (err) return err; - for (i = 0; i < data->channels; i++) - data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT; - tmp421_probe_from_dt(client, data); + for (i = 0; i < data->channels; i++) { + data->temp_config[i] |= HWMON_T_INPUT | HWMON_T_FAULT; + if (data->channel[i].disabled) + disable |= TMP421_CONFIG_REG_REN(i); + + } + + if (disable) + tmp421_disable_channels(client, disable); + data->chip.ops = &tmp421_ops; data->chip.info = data->info; From patchwork Tue Sep 7 13:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12478781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6188C433EF for ; Tue, 7 Sep 2021 13:46:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD2146105A for ; Tue, 7 Sep 2021 13:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234939AbhIGNr3 (ORCPT ); Tue, 7 Sep 2021 09:47:29 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:21848 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234990AbhIGNr2 (ORCPT ); Tue, 7 Sep 2021 09:47:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IA3hTHdvCpfZVABYFSA2dCINk9DNqyHPjMqPBV9TsgX1yZ0W9RCK+tbmTEMlLBaz+cvDbmNlhRbDGLNPGb/yFFywLAKd8OIx/0WuDl2cHktRb9Bwcd8rE0ZwGhDRFfqgY4ET75mQN5/pNi0D9SiuGOuT9/hWYn/1NdC9Xg8J197PaMp0hLOQRjEX9nrDtMWKH4CRw9C+zYKmNfJI45KsyK2Fe5mVpWPfg1iYXxRcEx+fCutW+fY1cVliJUpXvnbw0dJt4OrtonjZtvEZ7oVnIiqLJCxxglvhblvJmaDhBuwR5mXC6HxLPJxXqKcEjlBOl2zI78kypXMfGZsBeIzBhA== 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; bh=lv7hZhYztViyKlP3U/a4yhf6YWbwFK+bPwcE83UQy2A=; b=O+1z4EtLwn3XzgLqBPBk48ycD/wtcDadL7RG+pWv9834LxtyrZ/zcpdLkt2AosNXG8QMbmGzDI4fom7fZvXgCslQVE5gAcECSr0zA6rvhQkr6lPDQ+moHZrAGsn4AaecommrPDXSVD9dFvZbTsEwqqTlabBMC5mqZ3cyuWzNTNfe66ke5lsrinWKiHQY6tRRaCuEkYsIz5qALU9EuchuV8rU/xR1dy0i6qzEzWnlnxpXbO3CoQEVNSu83hfPxkGkgVM5xFOTT2khLuqmQVV1f19eQIYMu/7ati6zK+PoZw1sHzM/OWH6hyfJPkut1DyholChlZIQ7vSl6JyrZolVHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lv7hZhYztViyKlP3U/a4yhf6YWbwFK+bPwcE83UQy2A=; b=U/klyc3r6fr8j5pePr2q17zEvGv6pChx5oSUDJodLloVFJ/fBCKC4xIVtzl3Kb1r37CEBPt62hyM8JksQxZoCQWOqj4zgbHAYkZg1LfQMwmLRHpHNClZr4G4+Rfh1n0cbgjRF49vTRRk6Y6wu9Zv91U45ojKo4a6myXkg5d6UD0= Authentication-Results: roeck-us.net; dkim=none (message not signed) header.d=none;roeck-us.net; dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by DU2PR07MB8128.eurprd07.prod.outlook.com (2603:10a6:10:271::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.10; Tue, 7 Sep 2021 13:46:20 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::c47f:b569:ac76:9feb%6]) with mapi id 15.20.4478.014; Tue, 7 Sep 2021 13:46:20 +0000 Date: Tue, 7 Sep 2021 15:46:14 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 8/8] dt-bindings: hwmon: allow specifying channels for tmp421 Message-ID: <12984255aac11a3edfc0e6278e1a1cac70ce97ec.1631021349.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: HE1P18901CA0011.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::21) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 Received: from localhost.localdomain (131.228.2.20) by HE1P18901CA0011.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 13:46:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e88d41f-7d9a-45fb-84bb-08d97205df63 X-MS-TrafficTypeDiagnostic: DU2PR07MB8128: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IZURI2f3rWqui/hGX7HrJGs0uk+gBozuBaY8S9A64TzloVAgGJz8QfKuCrnnxuNGCi9Ar1gczIKlfM6sFvjhJJwN42iBZcjP19abL9KKoUh0eMyjGRdW6FUmBxmFj/+4gdAY+UsHkdtanADuO+qca23B/G0W7NJPVhdVobjw6jkJmb9VcDKG4dFcTAerhsc6XnIkwePNACPnCndJLCGFBjTHoN1HPDuB7rHeYat1rIikeEZ2JMTRpHCJmmh1mpMEoVISGz2wcM9hk7t7z94iKR4Zs36JBYSkbOfBGR4wG9N/Q8V8KeHp63vXQBqN6BBKgV1TVqG7/seJQKq+QZKudaV75xLGug2IDf9XO8XeF/ZgfzqfebXJHg3za5oJBX+E5c7HQhbPUbKBRgqxyVRgbE9SGv16upbNNq20eMqi+ymwXoushjZZ+VLu25JbeUsRZ1W0wy7stmrZvbn4YwXwAvHsc1fndDcOQvwtDVJKfdUYx0VWLB9+YWvCVlEJedVlf4wYd9CZtGqzJGpxCXI4yt2OqRI6QDKVdYFaKO+SAvKK4uyeDewOh9l6sBcYtguRMjxskJQpaOAovfQjg1aNtayst33ROeF8njFW5IObavX2Mmq4Uy1luAyC0PoFx3yEnxFQqJ/zMeP+CYyEiry+rUXo8zfCFvjjS07/vFrxQYaI7b1qBAeRzuu5WhhIcMjv09ZFDF5G8q367XqKDqYj/A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(4326008)(6666004)(2616005)(956004)(44832011)(2906002)(52116002)(38100700002)(38350700002)(66476007)(66556008)(316002)(8936002)(66946007)(6506007)(83380400001)(26005)(186003)(110136005)(5660300002)(86362001)(6512007)(36756003)(478600001)(6486002)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tuXjFmF6m56keMur6f5pzAIWhWJ+GUiPQklcImQyHarbLkanImur/RZP6Nld2QT676pkJvjj1snB9586JIopbIwnd9OpLvqsbeVT/0hYEvEWxne6kstL0i70lZGpR7kFz/LDFYweQuG+NwdSZGnPUbsVHiFOQXbaaq4VPRRrVLwvIEuHM9pR6QeDZPpBSgsnSPBFuqZAvh3VMdzB8k1e38UFmzf/sUqNORQxGAFc2RqvL/t1gHdG77nlzAhYbIG7JObYMke0a+1O2IWf4ZSjGYqJk3G8v5rGAmL+oGUazqW7/2aSwnNHmVqLYEAoRyOqTJQ6j/Nro99SSJ20HQdnBEgsbXDsA611iLx8B626y2lf8PS6qhFtOWK8bDGdGdngALoKqty/n8fqcPrtJiSncHOztr3vpPP7onMuu+247MV+2akDw0Y2VCVC3XrilvOr2JZUikxCE0Yj/zaCIU9d45mjsIzk1SBXyyzbas3tLMDvBV1poa3R3h9tK+8kMbFkcsegN9agxo4DX4IN9NlksBpQcD1ROxri0UsaTCcX12cflwB8v5tdVrzbzQ69igECD7Uu5Lix7suFHDstlrPbSkIqBuNsmDdy79xlHhc8xBIee9cFNaQh7NaRFlrrkHN9YbLnlx8XxZJsAVuvpVih7VOy/2IJoZihNCY/kV2oZBOZtIkMLuil57H8/S0xsi1nUq9xT0XDeggaY2jvHtZt8bcbgFJgcP5iA8AIxqldjlGu6iPirLdYHRoZGsyg+4Ucm5aY79rm9RhSt6KeLSPOkJCzP1ewy3bKdh32Ve7kI/31HpKe6Nbz6z24fKMcIZMJAmQ39nuVpMX9TUq5nwtroW0VyPyinLMI9TpjMCI5y/+cTArgiNu+/C+WZjrWpMjPkUqFJHPVUIg3OI0gmshz+p2Wpdnt0Ia23ZG/Pq6QerEuBhCwhGaHdJFjVKSvne5yTHIYm+Rn4Ne912GBUvwTvxfgW/U/HZo6bUx2g0+IIyQM2D9XcizFNAT8upW5JskZ1RdlyzIJ6T4k+cx9WwbDJISfIEaRzA/yWXRz7s2yejfpxS0Q/YzqvFG4HczbTlJ7sZp16PB7we7CWTqCXNcQet5Vx8/eH+TBz1ot6sqateLLExo7TfHMRWJuNwjFSf68q3dsRONIknjUUK5g8Ab7KCklhXKufQmEdRKvcXhwHDSEg2aMxAL2NvT7QqP092ugtKUSIJI2Mj487GSR5yQ/io5+bPAt4vh5mOelcUngGZomKyIMIVogULn8xejGy2cCALOzedx+HYOBkdc3Pf54gew9L1Al2/81lw6OmGWdewdjhjx+WTTi08fHEYEcrsmw X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e88d41f-7d9a-45fb-84bb-08d97205df63 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 13:46:20.0817 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d9dqueqPG4eELkG8mlpMLiM8uj8hIbCabdzecAZiMeqwfUm33bnnoExK4Vxj9UddfLdvDee4vgpcv7d/OmnOyELgQstVfuAfjqPqrpyHk+c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8128 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add binding description for the per temperature channel configuration like labels and n-factor. Signed-off-by: Krzysztof Adamski --- .../devicetree/bindings/hwmon/tmp421.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/tmp421.yaml b/Documentation/devicetree/bindings/hwmon/tmp421.yaml index 53940e146ee6..56085fdf1b57 100644 --- a/Documentation/devicetree/bindings/hwmon/tmp421.yaml +++ b/Documentation/devicetree/bindings/hwmon/tmp421.yaml @@ -24,12 +24,49 @@ properties: reg: maxItems: 1 + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + required: - compatible - reg additionalProperties: false +patternProperties: + "^input@([0-4])$": + type: object + description: | + Represents channels of the device and their specific configuration. + + properties: + reg: + description: | + The channel number. 0 is local channel, 1-4 are remote channels + items: + minimum: 0 + maximum: 4 + + label: + description: | + A descriptive name for this channel, like "ambient" or "psu". + + n-factor: + description: | + The value (two's complement) to be programmed in the channel specific N correction register. + For remote channels only. + items: + minimum: 0 + maximum: 1 + + required: + - reg + + additionalProperties: false + examples: - | i2c { @@ -41,3 +78,32 @@ examples: reg = <0x4c>; }; }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + sensor@4c { + compatible = "ti,tmp422"; + reg = <0x4c>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + n-factor = <0x1>; + label = "local"; + }; + + input@1 { + reg = <0x1>; + n-factor = <0x0>; + label = "somelabel"; + }; + + input@2 { + reg = <0x2>; + status = "disabled"; + }; + }; + };