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: 507639 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=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 6EF08C433EF 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 5738C61100 for ; Tue, 7 Sep 2021 13:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344760AbhIGNni (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+m6nwYjvpclu?= =?iso-8859-1?q?WHh38K0O81RzhCTGbDTlAOwp6hkF6HwMAwQpfSfOI3vLDESSvKD?= =?iso-8859-1?q?U1nwUnmAlXyGMjhqB3WwrBhbw5sk/WgB0EowYfWHTLkyx38LXoc?= =?iso-8859-1?q?KrfsnV9S2wwXVH5vHVEUvnsDVuP/E+0CMX/t0juhhYS4ZW3xeEt?= =?iso-8859-1?q?4Ng6R6obN+Ln+LaUmwgF8q/gFe9ehxuL8pHTQ/15uRPUiG4pkXW?= =?iso-8859-1?q?0c8wlLr9ZTqjMbiuvcUwhCj2kGDXD0Tbpt2Kdchg3rv0J4DdVOR?= =?iso-8859-1?q?CM/Bka9y+v1tQMVWmoaNpv4GW0t7aI7DfWxrn/Rg+dkrhTTqos7?= =?iso-8859-1?q?Cs2S7I5K3LTCq3eteLn+e1aCok7SsZY4IGBvh6lnsreDfao/wzS?= =?iso-8859-1?q?IOwDSDtTFqqVw+hAbCExryK7YIgrnuSSMOAQw6DJSywUPOzfS66?= =?iso-8859-1?q?hmgcpMeRwuy0G1AaJkBK/qpUUPp0gdfSS1Ic+lxQq21kPU+DFAX?= =?iso-8859-1?q?IO0jDajD7Q0WF6vhFuSbQA6o9aGJvUD662iMVCKHdOq+9jsGRjP?= =?iso-8859-1?q?FXC0lEhMJzrV9LNV4j5GrUDO1l0TVMA3Ra9RbDe6V86O9RZM1h3?= =?iso-8859-1?q?juaH4JyMRcLKDnK+8y6/GjvMWoCLKvAHx+u7E86wUY9hv1z4219?= =?iso-8859-1?q?VRTKujrUJPiieDzPlvJK6pXUNraOeoe9butoTgCHrqSUnsDGYJF?= =?iso-8859-1?q?Ylubq7JIgB2iEBtDIuScat//BgiS5dzERkxe5AYPWw5Izx5GN0v?= =?iso-8859-1?q?lQRaQrduwGEZcnlj82yaRpcQc8Q3bwzqkIaeXshGS7/gYiPJ8wX?= =?iso-8859-1?q?nPV0bKOuBd0xRkmtTXB2nOo4V3w/rRZOC73UBZqR8gTGdbtJUx6?= =?iso-8859-1?q?PonVw/lUkDASUU8FYWY7Rtxr/+fzbIzBXOyY+1PGponxzeDXy/M?= =?iso-8859-1?q?frpO/qd7vDWlNVuFCIAPyZYsVNxFtIQM7eLTutES6H4IlyodYTu?= =?iso-8859-1?q?SG1ivCRB+2yLTmN+ol7kkhUov6hQjYx06VVppVknnpJREJ9UWLX?= =?iso-8859-1?q?31x3p4lL81W9PxJhmHYTsDxFj74Z6X3zFE9Uc6cGtz3/xOiPYik?= =?iso-8859-1?q?mVvBreM0NQj2uJfgoZerPF0crv3ADrcMUUPMuj1hZPn9VgxIzIP?= =?iso-8859-1?q?i/2LRQfiHQ8pYDqGb+xpd3gyCZ4COO8rgNCj6CqsDRWo6wTtIiP?= =?iso-8859-1?q?wtQdMnRgWIr927LG3P84R6grzPcXrRH0sQZtAlaSTK1F3Jh8icI?= =?iso-8859-1?q?Kj7cd72kiuEyLSp6ucn15PLzI3t1XYiFMDwyR9XlJYze1Iuyn2u?= =?iso-8859-1?q?nD1ustSC5BfwsrcsnrpN905ukfRw5uI8SkUpYqT38gZfM5W/3dn?= =?iso-8859-1?q?+YKzWJUNBdLxWKQZX3k0V136LS8L4KvC0DLs160K0SAQu8kNb?= 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: devicetree@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: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: 507638 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 2BD27C433EF 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 1029861102 for ; Tue, 7 Sep 2021 13:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344707AbhIGNoW (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: devicetree@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: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: 507637 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 1F949C433FE for ; Tue, 7 Sep 2021 13:45:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0293D61103 for ; Tue, 7 Sep 2021 13:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344826AbhIGNqQ (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: devicetree@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: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: 507636 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 EBC68C433FE 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 D05AC6105A for ; Tue, 7 Sep 2021 13:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344845AbhIGNrT (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: devicetree@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;