From patchwork Thu Oct 14 13:00:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B62A3C433F5 for ; Thu, 14 Oct 2021 13:00:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8EAF1610CC for ; Thu, 14 Oct 2021 13:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231281AbhJNNCh (ORCPT ); Thu, 14 Oct 2021 09:02:37 -0400 Received: from mail-eopbgr40091.outbound.protection.outlook.com ([40.107.4.91]:63838 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230373AbhJNNCh (ORCPT ); Thu, 14 Oct 2021 09:02:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjzvU84KpARBUsxqIlZ5NVdg+84QSP0Gg3hxKYr4zaxdKaDG8J4LW64rTXLwnjOZ58zdr66WGoyuG+FP9nF19u96qjRUdq4pO9t9tMX99u37/1ETnAUMStk3ZZ5kh+s040d/hdW4CygPuHGPuiMKkWrBrHqD5GYG+ciRx94IbzigP4sMBmlhpVMX4wmmLeyYFVE6XJQW9vIPhryW7/lq5E/pu/N4w2BYCh6QdPUYucVb89QAbiL/lso1aNpSSDnIhupDncK9KfdasKF7vzp353uvZ7ksOr40aIbSS0klapRkXhHFIyWETDPBs9g7o3XGsxxh9+3BJS1wRIkwpv++Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7JnMgallAEVSahvEuRRsw1xv5Qb1jfBdoRGTH1oFWw4=; b=je1W1uQI3rO/l14hrw4fuzO9Erna2KDNm4Hmy0CJxR1H7+UDnMA0JLveg5YFHdQl1Ujn0+5gFvBzgmADYFDwhjcqGDnnEwBD8M+CtA2oogHffDoB1/YaN7a229U1uecMJxVh2OhxWZmzJXb9aecblOoZtv8dZnoov7lQlQhFjEUIREepuEFBApN6G2+HD5lAaGh30+mctuK+WJfZVmxVzUdKGZ1YvoyIPfmPMNcxPqjyE3Oo6cA9o1U6XsWhDxEgjRfuImuerJB+0YRYZ30lps/Oin78IdjtG6rLNzWpoCq68j56hCmnUMlEQ/1x/GBf8jrl2fCIsqKkngYCPnFVoQ== 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=7JnMgallAEVSahvEuRRsw1xv5Qb1jfBdoRGTH1oFWw4=; b=rCvGnpV5y5TuiEdz+COwq2cLTLB+kXCK6TksLJ+2/Y6CKv6r1DaDZo/w1xdJv0IvXxhyufRGcsCD+6DQS5+2MYcQyo6iRzERrbh/XgP3k+C7baalezLX0x8IUzy94kAxyfBq17pT09tJ9CyH+OfOC+/HnOkQ4qhdYBcGJMAytBY= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8233.eurprd07.prod.outlook.com (2603:10a6:20b:378::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4; Thu, 14 Oct 2021 13:00:30 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:00:30 +0000 Date: Thu, 14 Oct 2021 15:00:25 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 1/9] dt-bindings: hwmon: add missing tmp421 binding Message-ID: <84ac871e30a406a1613d140a084b4f3390753099.1634206677.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: DB8PR03CA0027.eurprd03.prod.outlook.com (2603:10a6:10:be::40) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by DB8PR03CA0027.eurprd03.prod.outlook.com (2603:10a6:10:be::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 13:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54f2943e-69f3-4f69-72ec-08d98f1299fe X-MS-TrafficTypeDiagnostic: AS8PR07MB8233: 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: cvfB4/lnGiPOsA+TdsXfgR3cvPYyZotytxYJ2Qa0B3OPM/TDGMTr/l66nGziZaPwS5Zf/pWYuMW3ILK7DQKNiyrBCfVuwkFKqZvv8VVfSp5If/Oxu+0fbBlfvc+r6eEIUjE4QgSR54hTb5RCS2idtIDRSGEboKMTE8jcy3MO/dHinzrfGQrOiOQP60QhIaYDryWf4wJWsL9Y/gQy2MGFO1auebVutbFnMQWu/FaX19m02PKndyYv6qE5j5jalYxHz17tXaVc4+6bH8q9MOMetrTIFsnUiTenbZ2aVe5cj3CmUKjVA1yYEa848FRhUWV24WlucA5HQPHmzFZy2lFUj13bdSlIYpBOQkAXPuHDFm3lTquEsG1eZ3jgCZ6ESZFw3R8HQtiJ0KPRSZ5Oeztu3e4j/KQC3ulZnwTN9j4Mm4d9Zjq9rBC1c6nC4T8bf/9NwxIBCCD0z5xPAr9FfeDXS+VPLIm+9NKoRbwGz6mGk6X0eEua+IKz0pJNbIwf53/9ZC7yU+XDyzssp+V+cjsPX3WQ2MqKN8CKMxmOs7bnanREBx3ix89X3lhqJZ7PiC8Kx3aMC3gnFYk4+CLsos/5/1xqnEbUMO0eplKRV8dCD5fGvxTdAIZHOu5HDPoOsGMVtpFLCXsc6HwJXxA1r7lV51xdGGxu6BIfxZCwE8Mm5Lx9szUH8F5lftseeWABlRQB36O0VcHK/+ZbTubZ8LauYEmQg6rufUYOQKeTbJcpRRAFXBoJwFEtbWuVlty87UYXbEH5e/YM/RZk40Po5/AQHy+jmDXGKGDtCLulkjPqNps= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(110136005)(38350700002)(6486002)(38100700002)(52116002)(8676002)(316002)(5660300002)(508600001)(6512007)(44832011)(2616005)(82960400001)(26005)(86362001)(6506007)(4326008)(6666004)(8936002)(186003)(66476007)(2906002)(36756003)(956004)(66556008)(966005)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?q?WRRbexncg/x5jtGHwd7DO2n?= =?iso-8859-1?q?qpO4BAQgrW5GZSDKLGowRooYx0szl255R+/At/vXaI/yS5O0POFhT+uQ0Z6p?= =?iso-8859-1?q?BCu2pnlvfg16A0f3XgzHXN8ijL8LnsYdhFmFg9TkG3FoRAtj2BGb/fkckAmc?= =?iso-8859-1?q?EyNP4TuhUGto/cSzYyZ1sJzixhodEcySdMJcGgBo0b9o9qqB1HoFci+96E4V?= =?iso-8859-1?q?0OPY9C9p/E6QHKmRFAc1uF0+UJqQiBze6vK33za1ZT6RQWSDmy+zJ4zX3X7Q?= =?iso-8859-1?q?qTA5IeFT//nzF+XmnGZQ2zT4B+rQnt3x5HoXrdReesuYqdKmb26dIuUo5Jmv?= =?iso-8859-1?q?CbdkvnH3bgC/ZlNJuYUaj5JGeiZWdyMUvXbCJailB+WwTtgEcZ4hvlbrDcTH?= =?iso-8859-1?q?pDvGJJpvNeKrh/Bx1+Hy/jEoYtd92NTXoHDND4kIfUAD0zQ/MdQSVdEp2q1B?= =?iso-8859-1?q?UAjdztFwzYuiQLufnVOJmJ+q50FVGfVGDIXAO820icks4svJDCHoGdwQDWXZ?= =?iso-8859-1?q?/qphDER8reFpXPzCXEfWduT7alU2ayCzx7Yj+lrvOArh8k0XBFN3K0SxxsE3?= =?iso-8859-1?q?5LjwyjDZWRqrHQeWwLojO2HxIibYSiLdXet0XiV9VVZeJk9+DOZ4jXb28vHk?= =?iso-8859-1?q?NaUk+un7cqazPz48aSNfPjmcckDZ2OT+Jm+mZKEsOZJ5JzYyEHaQuGdgBepT?= =?iso-8859-1?q?HaGpJk16NyMrOHAuJGxdEJ6yeaGUOQNQCWVU5SJJBZ+9a9jXqE//jWrICyHr?= =?iso-8859-1?q?7xglBmmrXy0dpsENTgdMryVYrSIaF9I/HsJS8w4vWR8Lrygkq1voUcQ2NayZ?= =?iso-8859-1?q?E2sAMkkk+c7YPzlwn1S1BaV3c1u+CNIevHx3Q5v9GMoceBAudoZ2IAI9pYVe?= =?iso-8859-1?q?fh6/U61ekV3Ya289K8Q7ffbyQmnRU6pfrA/JP5Na+G6EvDESC/Z9A+x4wHpr?= =?iso-8859-1?q?PJrnlTd3liTIfQbHyrRxmOmYqTRgZb71mZqOpFHhKWYkiawU+qwntRsDl5b5?= =?iso-8859-1?q?O0gRn91U4H5NEOLmtF5YREQKolU0TGkjipIc+Tv+GTZTtUjkrMRXhIMVxqnt?= =?iso-8859-1?q?FQFuSz+eD1Ss7QZz4kP/8xqTVJ3oX0lEiZ7SuS8ffYG13PNwxXlhYHRfNeez?= =?iso-8859-1?q?jmqW8ItVunWUfMEmGoK/83MkCv0hlamCKkQReD4rm5c6iZSu5mLwSb3DD1bK?= =?iso-8859-1?q?LKxM2oerkSAkntSfLmgnzfpfbvb6KWzCo5LnGoYwA0uNR7w0OLhOcSxJxvSG?= =?iso-8859-1?q?Im/JiDikvgYRPM1mWxJ15dZ8Br4Qy1Ba8zh2NCnKDcysJafsRfXTxdfzzs90?= =?iso-8859-1?q?Yes1dGH2FFrHVNDcT+XpbiNlhKkokNaPLJf3S4UTg9iE9zjXY/EcM/zVDLR6?= =?iso-8859-1?q?o?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54f2943e-69f3-4f69-72ec-08d98f1299fe X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:00:30.6354 (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: eE7GiGTxuGPbQk3Z3SJO4qdlBWyfMwlWAfVU2siuVd3NFMuuHdLZIkj+HBq2iMH15yMnXJAHYoX8b8G+ZKrczjDPiwqSV5/AwSACpr/4nak= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8233 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/ti,tmp421.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml b/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml new file mode 100644 index 000000000000..47040ace4f73 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ti,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/ti,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 Thu Oct 14 13:00:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D261C433F5 for ; Thu, 14 Oct 2021 13:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 350D5610CC for ; Thu, 14 Oct 2021 13:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbhJNNDD (ORCPT ); Thu, 14 Oct 2021 09:03:03 -0400 Received: from mail-db8eur05on2092.outbound.protection.outlook.com ([40.107.20.92]:1761 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230307AbhJNNDC (ORCPT ); Thu, 14 Oct 2021 09:03:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRX8vgdnGKTZUDtAg3XbmF5biTlYSqBminK2JUSdvxv0Hwe7F+NeM1vmoLOPxk2Zc5G7OE4yZefYBmtBYABZd+iU2DTMdurkwWTAYK7FiWHq1dCvj4o/USt/ZQ2Wk0zFcfZlaTEXnCwgUq4C6tJtIOecR6ySDnRUCwtEbSinXHsv74M+whejDd3/sjUhEcrTjCrz01pnlYjggqAHYvfEEan9VLNGhbOvwBYZ4Z0/eQt8+g9wQroymsjZT+IZ8mh1puL31Ab1wcgShZJYM4wWbvhdixvHCk2uMM7hb3b5AZy6ur53fIHPje5lJoklOZUPHU5UlPGzhDG3Nor9Iq4wOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J6aUp2jPlV0q3I67jTGHGPbJGKJ5qwjzJwqHl9eSLaE=; b=KXVoEPfdU+yYnW62hBdHyU3hyIa18Jl0hsNe/zW/csaVP4R7rEvPiAoN9KMg9mWfMDvMw27Y2Y9NnVNkIv0nQn3UXdSV4seWjKOFU5beZcypCM0zF3vwQFgAxmwKwMJn9dHnGleLvDl0dmYaRWcEIEpJMi71ds0lblyOncVHPbasSRcE2hLlYA+1++qZNrxMltGZ0H6i6ZndI199zwWe4b/lv32moDXO6+roy1dc7nblTq2J2Kba+nxQ1jfoqQBqEKOoyKAsv1Zj4DfQEC09XvkbtJ3An5ULG9BC6TpA8lu3cXO76WM1R9op1zBZWVxODeuFONZleHHoATVwF3eYBw== 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=J6aUp2jPlV0q3I67jTGHGPbJGKJ5qwjzJwqHl9eSLaE=; b=JeZaYMAcYWJg800J3t54RXhuClHXoLPLhfa87z6jA/Kversq+kDAnYYhv0MWu3LM8sxHGaTLnyG+id5UX4yeJiuVnij8AYiYciy/3a/dG9U6l618JJSt0dGOC6qFqpuCcGnW2MxkQTLyMI8uAOQvU0rXkxix1fqk/Ph+rCWZFmQ= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8072.eurprd07.prod.outlook.com (2603:10a6:20b:35b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.16; Thu, 14 Oct 2021 13:00:56 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:00:56 +0000 Date: Thu, 14 Oct 2021 15:00:49 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 2/9] hwmon: (tmp421) add support for defining labels from DT Message-ID: References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR07CA0012.eurprd07.prod.outlook.com (2603:10a6:7:67::22) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR07CA0012.eurprd07.prod.outlook.com (2603:10a6:7:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.9 via Frontend Transport; Thu, 14 Oct 2021 13:00:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25bd2c87-bd71-4e43-4ab0-08d98f12a942 X-MS-TrafficTypeDiagnostic: AS8PR07MB8072: 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: ExPEbrwy5C9xRj3cwo7eph7BUvRProfU7wrRrbiVH3lZYNZaeo3HaVJQ4BdXx/CDRSU2Bx/sF580HQKZia1wBpogHYQHthemvxdw0jPaKmPOz2BiPdIprW8DwMsGBgA2Pen7mcoav2AGwm0gfAHOWNr4lNCcbmSckxkmoFrSoYAyAlOcIrWR2ZT+mxKn+UQN8ZAa1ePxNRYMaYpQ5vrZI14v1IFFGxgsPpQVL+Xecg9oKeE+wMe1xoakZnVUIAKKkkYN7codaSVlOS73mB0cA8VQjxYSEVf2WyKOpnwrU+4LaKiHwSRr41Gt38quvITXVkZ4kwxZeoXQWbSILyKHPgic7l6eMwT8kMdIbC3tCR5PWOh7jfMFGhXexJH8TVuZazGKTM+fnieOXiYTvQeziL+KQZ2aDJxWm+i8dHhvF5JUmk6YZrUiwVy5lAmNwYhg0wKVI691S+phHgTr8tesLMK8QjwIjkoC06TQg8QiZ3wTQecH+1TrADTQzivmjtwa+HLp4BuuZvRWnCzy2T08nlioukx4HLmRY73vHNlbPxgvjzfu72YZlUMUGG9ZNkDKC8LR6NMEiyhJ7H8sZ1wLrUJN8a7H0ls1htqZB6UtSpMiJ4AI43Kgp8pJpuTwt4cdg2rHlfxOVNtEn7/TquRhu8KMo94FnvtO9gNImj2Hs7HiIfIMiStxTUtq4DgdqumtRURS7XWinVc1x/noy8YfUA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(36756003)(66476007)(316002)(6666004)(4326008)(110136005)(8676002)(44832011)(6486002)(186003)(5660300002)(66946007)(6512007)(956004)(2616005)(66556008)(38350700002)(52116002)(86362001)(83380400001)(8936002)(508600001)(26005)(2906002)(82960400001)(6506007)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nBjvrx58AjAL0OvJHHHHjjJgOcrhz516b8ekOOMs9vMsHpiN7ydeSINnlbfhDOCl9mCPd8lp91Y0Dcq+3hTivSQsJdkmxouq+O6ayR+6rvZthZHMlBBwFMTCSZ4dE6HnR7J1SqVB+EYLHOMFAnI+Jfn/EVnrzYG7mNxkFu0bYSS4i6Gv6DoZw7fM1hDXIjBlVmXj/cvQYvCD4IHWA4LtqKLPgQ3TvYFpZgya89xHZ5HrRLGxbBndLLQu2t4OVrq400vZMuxP+uk2Azfz8MUQEGf62CoeKkx1JtX0ImVR5IZjZiTF3IvCjM/cth/CySSj/Hc2BlwJS+LOKP4nfN4ERC7Jh36JW5V1knm01lwssyOCdAJUa4DUMOyTAf3iNh2x82sDFOk4ZcHufYQWEaIEvFVuqe6lyuCFaqzTBCnWBdu/IBpb0GH9TOC/jjOgutGRkB3TXuy3Vj8JafFVrm/TiV7R3l6IlxIww+7sRiZPkBzYcrRBei9q6HaJcwzKo+CUmVa1q8MK73QfFuyjBgn0LKB6fwyl71706KeAVHQw4xAXHaZ8jUfbDiAeyim8KrmDFu7LguiLEQS/pPYntBPRvh3VVakTVErQnfSX61QRZEKQvrEVKZ+giFLIxm9usizq3na+iVy+JwlVQGrhMT8Ab2jRVg3McQ+1D2vLJtCktSlTI62TaezPfCMBGnYt62maOERv432IgZ1WqAjzUinD7c6wVvq5ZCoerYnlTI7Kc8lZLPVmgiSwcf/1fxJcXqw3icGWQKdC4SdLFRaLunfS/aNHb34L/SxNAg7dsaEe7zEZega6E/8I2438d3Gv6EiNhggalgwPPV9xeQSGsGLkpTbIj1N3IWWBtdiSk0Ett1f130tU/voANjm7QCwRa6xeAWJ2JCkbauH+BfyPxVi5okqHBIvn4Q1/HhHo64F5yb27FRzJ6VnrHVSfBMA2DdShLre5h2Jl9URAkIzYbKeKIKlF59SyvLJ82wvEdFC2QvX4cvvzewCe40TjFG4i+IR3n5uvxCblVv3bdaByoWhK3xCIJY2sKttitR1uBNwZlxRhlYuMKzHq+mkgMaiJMKUbH/zLWw46C3OnPgtVZAWv2iMQ/QwmQXjFgu2nRhTKGnK5Ii9yfKrHT7mTA2PZAJPf4XF1SYvY7r+yFGsElcUSjdFwVQwUhfpDkLQi6xWOop9hM35xsROhGD41f55+4UiMNY9hu7IdpN4Z8qMAtkjkk5g4Ubck4M5N2bD6vVIbn0RlH0cm/d8g6hxwQ7r504MciYC1f7JomTNwci92bOn8U9odmBZGFY8L7u/tkxKnl37Ji8kzFT7/6x/SFXaITenK X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25bd2c87-bd71-4e43-4ab0-08d98f12a942 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:00:56.2458 (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: vqWgcjrMFqkf8nLixTjH0h3Hp2mCoXBKmYArNVClVvPPRIf9HNU2IQJ1VBNAULKCSXxV9LKntcYuy0KyQH/nByf4kO9AZGPVm6LEXWO9clw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8072 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 --- drivers/hwmon/tmp421.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 707310d616a4..89346ca6c9a9 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; }; @@ -187,6 +188,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) { @@ -194,6 +205,8 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, case hwmon_temp_fault: case hwmon_temp_input: return 0444; + case hwmon_temp_label: + return 0444; default: return 0; } @@ -286,9 +299,53 @@ static int tmp421_detect(struct i2c_client *client, return 0; } +static int 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 err; + } + + if (i >= data->channels) { + dev_err(dev, "invalid reg %d of %pOFn\n", i, child); + return -EINVAL; + } + + of_property_read_string(child, "label", &data->channel[i].label); + if (data->channel[i].label) + data->temp_config[i] |= HWMON_T_LABEL; + + return 0; +} + +static int 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; + int err; + + for_each_child_of_node(np, child) { + err = tmp421_probe_child_from_dt(client, child, data); + if (err) + return err; + } + + return 0; +} + 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) @@ -317,6 +374,10 @@ 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; + err = tmp421_probe_from_dt(client, data); + if (err) + return err; + data->chip.ops = &tmp421_ops; data->chip.info = data->info; From patchwork Thu Oct 14 13:01:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ADB2C433F5 for ; Thu, 14 Oct 2021 13:01:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 465FA61056 for ; Thu, 14 Oct 2021 13:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbhJNNDZ (ORCPT ); Thu, 14 Oct 2021 09:03:25 -0400 Received: from mail-db8eur05on2103.outbound.protection.outlook.com ([40.107.20.103]:61153 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231308AbhJNNDX (ORCPT ); Thu, 14 Oct 2021 09:03:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZM8PohYkK2JmC+U3Qjw6U6lIBYIiB7pAWo6FJvjsOtGW99uz3lVooJgSAgxwDK726zbX+6TGjua8psxMQddDiqx4ChNFfaRryQlVOithbsEUL6qmhiUDNokcq9S9gp9jqjeO4ED0sD8JSBeOmBKsSMvUwg03XSk+UXXp/Tx6v3eNAfGioTJuIkJmFyd/uGz53iXA4aNvJY6UPvEU7RsWbkrnQiMtP+Kvq8WeA2bz0CIKPoRbDK3Pqx/vEnE9TDobDlIMFf57In70yqCgVkOrilCq9CpuASqsWaSwxHj/4qY/k8ozCUJjJsaskiym4GzUPJXdczGc3uhZYnZgBPBrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rRXSAuC/1/Eg3ZZvXEe4H9c+w5YM6cShbTJdO1H1RgE=; b=Nd8jrIyEMPorOox057UaX74eNDmZWqwLm06wsf9gKg2vkO/Zt620oOvdt4ztReQHyswhK9eytDxxo+s2aCjcKUPIbvHWtTIrCicJRP4n9gq9Y90xtmGFEYSjkv2gSl5Bv1sAAiq9cTkR/wFRoeklFD+Yo0RD8S76cyRVd3pKtWeai/dEC1lZNtUY9TzCYibmvfwhMZ69e93hm9yodlpKiKgHslsDxqgOE/EFIrBl6qbzAe3giM4g0j3IV7bhhFhgBenhEKoW/AdfBYcHMclgigjn55XMIYKQvBRPdtOJLrxQsZhqWA7jHMfVqAY3QFdQ+NvJkR79KyH00E2yBzWTBQ== 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=rRXSAuC/1/Eg3ZZvXEe4H9c+w5YM6cShbTJdO1H1RgE=; b=d/7ROG0COhQeNilauH4Fm2fhtFw2KfFjbfvwCeuaLQicDy3RCX4nOgaIHKloFnQuVOXU/shRaDExQYB4lvnLk5XSAfo9RyqlcHNMybKFfSc0LMYYmFziFbJ37xL73PG3tzL2J6xD81kfFQqirCUN7uki9/RMGx5lIpuYtopxDxE= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8072.eurprd07.prod.outlook.com (2603:10a6:20b:35b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.16; Thu, 14 Oct 2021 13:01:16 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:01:16 +0000 Date: Thu, 14 Oct 2021 15:01:09 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 3/9] hwmon: (tmp421) support disabling channels from DT Message-ID: References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR0802CA0018.eurprd08.prod.outlook.com (2603:10a6:3:bd::28) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR0802CA0018.eurprd08.prod.outlook.com (2603:10a6:3:bd::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 13:01:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 801f562f-0c65-4e26-2ed7-08d98f12b4f4 X-MS-TrafficTypeDiagnostic: AS8PR07MB8072: 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: Y1tacQ7Mnzu6NGnd07pJ9kCSxreHFDe1Q6Y3AO+txke1sq2BNgswyer3k5DmC86vM+9WRwK5AT6oUi5+Ym9g4tkR+HnBRW0/BnGxj29SV/r6gviXxAKTbd5cbGbY6YT9sVAhTfLiN5GxgGEWbf3OBxK3GrLhVdL/J1L8oD7oFeUhzh+9wBHE0+K+NynIlForbi23pIcL6CpLonVN8PfXufxxZT8ZWXoBgNqsqjNQzZpSafaSFheSRW8rxTR2AyOVVEqpTI2g9OE4M//k4HG2U9Gop3YVSGKgnUCkmPWexiyNe4yHyqcgAZ0BF9l8mWvdxwcRocWhtGiFbMsy9uIAWkTW/7bigLdtopKAZeySES/cUvFn3XFwDANNPUXAGFudnM3lELr5Zy3MeA6SkdSHUkNKkjVMUo1bG1ykDHXmWAmwF+EzCHe9mCv/tz4bj7DTN5IjDGNuDjqhkPoqa7PPPc6KxR+XNzC21d2CkwqdkKDP8aoYUSyNnN3NZctj7jxjvpUHnSRqAl4cNfwsfKC/ccGXXa7mg7X5NSIM8XCBGY4CGWzzqX7upz11ghYyE4fkzpl+2Xp4FZh87TJjYNsb6U9CXRmCOb6Dtx3UyPuoMcx+ydgQ8wDbyyAXJBB5wE+QEcgUkEUbs1ntpoxJMapv/YyRKOEwooJDhTWQ9i2O2LpdD5AGpeqVdcd4CtChsZ74OrSY7JtVu7w0j653UpMG4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(36756003)(66476007)(316002)(6666004)(4326008)(110136005)(8676002)(44832011)(6486002)(186003)(5660300002)(66946007)(6512007)(956004)(2616005)(66556008)(38350700002)(52116002)(86362001)(83380400001)(8936002)(508600001)(26005)(2906002)(82960400001)(6506007)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z3FAkjJAuajJXMb02a3XJi2QIG1aN7O54sy2Xke2jTc+3m+pJTVyY65w3jErG0xF6lXtRJMoQwNvGAtqLD1nfiVjDGJf+fp8RzZk5+SKvW/K7QzV0UrM+7dYfy3PgYI87YYdQdBL+A4X63qTtOWwlkM6m+JvesJ94sja43FktMfmlEZGsVFuVdWsewhBJCjm12iIOoZTCwPSEqeVOK9MtixKJjI6dYy9XSSztTszX9NrDcCRUkwm7NPaQVqHwDu2KORJQs6jcbVe6N3zD9oo7Y8v1G+8GBcEMK6qmGlBCCLRbhZI3FQ60hANKDmVNW9ORN9w4yVmuBViPF0dQVsv0V9PQIgX/aCYkYl/kre+fmxjZklfWSTuom6bF6MdBNm+LsC5Obd35J1JGJisosTyVXU3o+iVc85HRbI8VJakkVtO8xGPh9LT0UzUUoZEisVfXKnr3dDt4EuM2gM2PI56L0MUm1EzQHVhHi0rj3xvJEb+O58irMka269IcAki94m3g7F93qfIcKwDNA3osGAhaP3qotooSJoyXcVDlJX7GoI4Eo1wj14hdg6TNM7akWYuR6xeOorpwjK/b1zqolXgBh65heiFWyafYceokOAfjl2yXafq4rGEY+VwRaM4bogZE+K7yMiFLIM2AINBKxTkA4HlSkIOeptDCMdCw385++oc1e1K0/bsXzaQnelOmIqV31dn2FY6/w0mvTf7x0p9OGEjMEEIPl50qoAw1QpZTvFhQv0+0UuKFGfCDPXDbjKZ2f1XbtYgDhzF55Efod6dsc6ZGFUysLDH3sUtl9btfXKd3dhp0KaY4A5AuiuYwS6cSUyamlJi/Sa/VrD8mgtDskHmmV5ECINv9G1OV5tvzkLvWM74oJ2fcsBGtUSWuMWjduUM1Ocb1bE5CDQ3BUHucMCEREyUWAwbeGfhb+9ylNPRlEeLIewBMNbRiD0BwoFo7BsKcttwjqANdoPhq0J0uuqMhQne30hOmIvjRDeMrPv9t8pNDoIZT3Gam4W2HVcPiHw6XR3qnaq1gU4qsTdDTjrzzuwX5skof+ce6jercHdBnsrZcruar1Hf0N9G9seKlIBWS2ygRVwr7JC9uouGYQ8WiMpkC8uL0+BPmvmaI7HaUTlGXmq2Wv+tzcltehfkDz+yvcHwu6+g0+0w0gQwSS20oCDEm9dUCWVFvpuYB+hto/mhcyLcp99TpVDO6TRBKVv7lWFap9VLxFqQHYiODqszp3xibi2nQNNWTQofyDtYaLlExZ/IO+03ThNXqAcMxZrKkXBxsOsuCurygzFY2WO9Zlb8tmzduiuPZOvac8SxDOWlH1IFeY0N+yRNCEvz X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 801f562f-0c65-4e26-2ed7-08d98f12b4f4 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:01:15.9592 (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: 0+J0tUyzLnnh85xrqqJ9jt36rjdz7QhhZijUT8llIpB2W2EyPi+6TD0NNmpcOtclE903MAhGxg9npPcTYjYs4hWlsRBKhmf08j3RKanipi8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8072 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 89346ca6c9a9..af08bc985a13 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 enabled; s16 temp; }; @@ -170,6 +171,9 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, if (ret) return ret; + if (!tmp421->channel[channel].enabled) + return -ENODATA; + switch (attr) { case hwmon_temp_input: *val = temp_from_raw(tmp421->channel[channel].temp, @@ -323,6 +327,8 @@ static int tmp421_probe_child_from_dt(struct i2c_client *client, if (data->channel[i].label) data->temp_config[i] |= HWMON_T_LABEL; + data->channel[i].enabled = of_device_is_available(child); + return 0; } @@ -371,8 +377,10 @@ static int tmp421_probe(struct i2c_client *client) if (err) return err; - for (i = 0; i < data->channels; i++) + for (i = 0; i < data->channels; i++) { data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT; + data->channel[i].enabled = true; + } err = tmp421_probe_from_dt(client, data); if (err) From patchwork Thu Oct 14 13:01:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 306E0C433F5 for ; Thu, 14 Oct 2021 13:01:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0A36610E7 for ; Thu, 14 Oct 2021 13:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231292AbhJNNDp (ORCPT ); Thu, 14 Oct 2021 09:03:45 -0400 Received: from mail-eopbgr150119.outbound.protection.outlook.com ([40.107.15.119]:29412 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230307AbhJNNDp (ORCPT ); Thu, 14 Oct 2021 09:03:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cp00YkEXEdaCitVWK+HVUeXCgQAl54tHWDn1VLj6Wy3kCGO6SeFAoTwrw+nXA73SO3dyMhHdxMnNLzgbP6nMo3gPNw4AJinkU0+HRCohCQdalcRoZjAniv1apgh1POVte11xVwYqxN1BX7uL0x0yzLTAEJ7dQXXAWqGDJktQ3T94T7XKwU4u+pykAD2cvWSyJRgTPd0/GfiYzf/146Ksh0HpQ4/D5Y7FJe0qJbFpln8+cOhfTHGzb0UGpl7htDWmXVg+vUQcw0dh6lgZ0NYkWG50egrH0uw7BpDtxqucspSozch2RYZvqoxpW3ocPnYgMiRbYZLU2xTtZiSPIFfiNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nIYrIf+W+tvjdfDmlyOf7ACqK9HAcH3VqCvgvd3CNjc=; b=f+aoKpOyPBJfY7QOY4M5nJKvie9SawfAlJlyZXF0H2sCoiCxNywnTSHjLyNidBD7KV+1zaHJVpCwMohLNcUJit0xy92IbN2y+BsGIv1stTX4gIS9BZ8Sj3uJwTRxblokCrjKqMbKEErIw04/IUzEKON16Z7gWDMazZmrUTnXNnKGjqQNSZ34H0XWwy06YE1ah/VNzHSsS8gxOSNOsYPtlie2SaPJHkXZYsJdmQeHGnwCduWyotTlD2GK/UdryTv1ewHjlXkWSdehTC7+2Yxqm9Rv72wyJeX4vKpZHDGyIH/FP0H9kQl54RKAU8U8AQEvlb8ZkK+/XabJCjsjNIFFSA== 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=nIYrIf+W+tvjdfDmlyOf7ACqK9HAcH3VqCvgvd3CNjc=; b=d+yXlbP598wNo1dnn5PiXGzVTbo2YRDcHJwqWWOjmDxgEC+ps9dSODlyoQSP1oaaeQ4UV2iG3heHb2zEhc3rocjP4bYif9hbcmUAC8b/N+c2bg+TE9C4ypf/IdEc3CTWxKUd+eE8Ia6iqhYeYLSggUt5eev6qEYyBoJmXVsSHBw= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8167.eurprd07.prod.outlook.com (2603:10a6:20b:376::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5; Thu, 14 Oct 2021 13:01:36 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:01:35 +0000 Date: Thu, 14 Oct 2021 15:01:28 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 4/9] hwmon: (tmp421) support specifying n-factor via DT Message-ID: <69d0bfcc5ba27c67f21d3eabfb100656a14c75b9.1634206677.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR0102CA0054.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::31) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR0102CA0054.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 13:01:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71c796c5-6b85-40c6-45e2-08d98f12c0e5 X-MS-TrafficTypeDiagnostic: AS8PR07MB8167: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +FPGg3iiTsVi/oUOisFZDffF/wv1gN5UCpuOYHLV21oxlvZXnemPN9jkn545LCWVa0/WQLaTBX6OuIhBIA7+0iP20xz8len8ChIARhW/IJAychHOXXwvB03B0KAK5bdcPadDO6SI/FY0URlxBE7kRvtOPLALoeYq5x26kIp1NfMkAKFZepYRyaYdUmCB07wDKU9ONB5u+AO8ZEVGmvu5MEvWVtRv1AdPmTvWNwZOfPyqYBj9g/bv7r2s1q5RTN46zuGGBjCI951xiv9XaGw3x+27U+P48TeSJqm7iTuy19zF1CqRogTUfJ9YrD7mK0nAJlL9/aPSdDMWXk180TtczjGFdxi/oy9ZaQcE0jQW/OeBmxu6J5Co9KPTJuUd+yZte64I0KhqW/7IjGE6K6jdrDTeWCPw2kpwUsjHV8duT6kJ8vK1WTfZRsiEhiAl1gkMKI6a9ysM/dt3q3Dajkh0r3wJxIa0WlsFJxUc6wwStGXnRUgTL3zG583CZ7zBgGbZw+JTxOkD7XqItdeBruwxPnYseJsADx123xY2Fl2/fLxzj8ubGRxmRM8r7ARyKx7nWrloORydKzSimoyM6YaqS6JHi1Q0+Pv6qAOblNfi+rFZCOVEHCTmO549lJEi+VIFAwxKt+yET8Dz5PMi3MhPS1OlRv8dTBPj5N94V87A0VYkn0vqxTRc31QFedo5qX8vS00Xv3RlBI7C8K58z4Jh8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(6486002)(36756003)(8676002)(956004)(38350700002)(2616005)(6666004)(2906002)(186003)(4326008)(86362001)(508600001)(38100700002)(6506007)(82960400001)(6512007)(66476007)(66946007)(66556008)(5660300002)(8936002)(110136005)(316002)(26005)(44832011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MTGB2y4x7q7wqkaNLqymJu5Uxn6WLbiU+piCcDrqRu58W7vrkd/wQPEA/6D+l0142Nl4k+UFudu9NBFT/NSCbo3LC2P+9Sz30HA0n/wa9L81Xpkzb7xy/k6T2vVS/dcAQDeVfaG+e5UJF53GY/gyrojVdFgUKwkzZkvu/61n/FDhNC6XV2F7BySlbICXYYCP/YCe2oO9AqYUox1J69hzuuGx3IGDf+hrlzBtB942IUE7wfrba2013jilckm/Sr/TGY8NX5gcfJ6QbAkpMZTGqF5bUgmiYOy1tB+0XGiwjbTtTXDvEiuKqlMjO4ULd2nFQqznTB5HWWJzVPYfe5hCOjv2pv3IozcnHxx0CkSjbK5jiwM3mIzWFqGxCC78H/fM8LbqrOUzrP8kJp2h01ZyxwJdQ47ldToDtc6+nxHqeRXcBDkIp43wBKbTbQ+EdjoHFlKMfQfH/fv3OAQ2cKIXKQ+PlyemLdlF14jHCvKHl4l1syKiUcg/+yoT8LGnGzhoo8xmZDHrVn/x4Ib8VUIcnJYeqLB/7/sarbYW4TLOH+fdKAON2k1WvAetHaAgg4HpZd1X7Qflf5dOGCsAEwnR2386IOmufiUIh1NigG3wTkiSfLvlUqKWJZJJTB8Bt55Xj6LESa8ygtZCvLqptG8WDhRU7rSoY7cHMMypAWWBKZUDhiCOykNxSqsQlE8BNODvR54q/pvkxSIWl7ylERjAXz8pNoHYNShLlxchU3ONEWz4EyFP3kJqs1/8Ai1Gw87fRnLHLrmFpQ5e62wIQQqt6kAcIphU2x8pQoTDwSDUyyJz1aPWkQBvW/JvE7ZAa9LDAiROh3zlf2bHD9qgETFGKSM0+ysoe+RQlSABoHulwgkP4oI7jOQY+r1iBdTdaDjTw/t1MheeBAHUiwJO1UsP3ynSQ68Z50RTuez/5zLBCTqpgooj4sV1Ft2Ui41sLVt0yCnPnuDspKTvpRj8Lhx5gw12Y8wc9rMank7GIbtk7i3RGJ968PMXuxCL2jMJVtCneP9pQUjoUHW7cdPDo1lP27ffYzceZqcWhjzv/atSN4bw9R6lsjBSGv8ibROUHHTBMo5ob4KzlgC6E8wwLPx9FmeEXfMUGnINm6aq0a9gYRvibW+tUlMoJvh56kgMeewLqSrERpFA1z7W0riHQg40i1dQ7R5TqvWMk9PyDJpQAcJVMKI/mLtDH0XI00zS9sP29gPpwcAQEypWKHgADOn9vu/KjM5NvDerdXS63t6z6uO3PVJI/HwGLlr57vLmjudFLUo7GJX8bQ2LPY2t8YIuv375MmEROfFrECnRbpO1e/x85kf8zvV3siKtejo9+IVi X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71c796c5-6b85-40c6-45e2-08d98f12c0e5 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:01:35.8976 (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: qvI91kGdYLW37+3SnUBVJFIvh+O3wAf8nsZpPsXWoTNbtHeu+q0ew5NsaageWqkCXXhRv3qwaCiNTx7n+mDQ9NqqB4Jele5BOHa63uwYBFk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8167 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index af08bc985a13..606914f20910 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 @@ -310,6 +311,7 @@ static int 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); @@ -329,6 +331,22 @@ static int tmp421_probe_child_from_dt(struct i2c_client *client, data->channel[i].enabled = of_device_is_available(child); + err = of_property_read_s32(child, "ti,n-factor", &val); + if (!err) { + if (i == 0) { + dev_err(dev, "n-factor can't be set for internal channel\n"); + return -EINVAL; + } + + if (val > 127 || val < -128) { + dev_err(dev, "n-factor for channel %d invalid (%d)\n", + i, val); + return -EINVAL; + } + i2c_smbus_write_byte_data(client, TMP421_N_FACTOR_REG_1 + i - 1, + val); + } + return 0; } From patchwork Thu Oct 14 13:09:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99235C433EF for ; Thu, 14 Oct 2021 13:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D43F60EDF for ; Thu, 14 Oct 2021 13:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbhJNNLW (ORCPT ); Thu, 14 Oct 2021 09:11:22 -0400 Received: from mail-db8eur05on2103.outbound.protection.outlook.com ([40.107.20.103]:18913 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231248AbhJNNLW (ORCPT ); Thu, 14 Oct 2021 09:11:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MhbNYWjW/DV8jImVaJgD6KPcMNSA+WiBLixnKB8VW6YMuVxd1sGTG+4QKDaokyfw6uM1NKb40xK1uzu6Y9KRvxYnaZ3DUj2/oBSLEIDSytWNmxH0rWFvVfz+adaUSt6ANEthqWYfI10DAb0E/qG8OSn+zezw5nOS5jqRMDdfP+26b2cnIMEwTmhWPK25rTg4KxaKEUhj+Kq7OkjO8h87peS3P6jr/II7UhY40iekgazMZ38Qi7lC1TKIbwtk3AbebGYFLqwpYPetqQ/Xj/imbp9J9ig7mWfj4wexGIn7k0Gdyf+Nt+7rTgiKrTeDvmRgE4AObh6WGOMkmPtPu6feOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gP1hdt1dn3lfgcRmhJ2wGMm1v21zPrYmvy48SdggZXQ=; b=JVIdoXYuwld9LTi840O/MvU/DvnwH7ZyY5qjnwXZ//oWOK/z2Mku93NuJurJfgMM+I/7E3IWtifo3WFrMJiCVk7gsF4WD3y9h87jF7oovwhtcFAAMDYDH7pZWNDN2sdsPZ3a1BixTMwKkQx0U8pHN0A7ACL2hUZZpa3bvV9TLCqzPX588dh1bREDrZcGAaUISi3qun9q/yxTHF0CxJq5PoSd0/jmaDuFkcLR5WWPpg3IqaD9VxpAjiWah5D+pho3CuQGeSxHTYzkdfpd2oZsoori/EJDjBiDO64fgX1BrMcq05OjYgho1rWmPpD5EPLTJx9MFaSYMpY/wW2JxaACcQ== 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=gP1hdt1dn3lfgcRmhJ2wGMm1v21zPrYmvy48SdggZXQ=; b=kNNNMdbQPCa1uCLf8xLiNk7NBLT7IAtTkgWyXAgzkSBy9+3GpeMBcblQrEr29DWAszc9783xlhM06xjDDdE00u6ufqJF6bhvAp9Covtp0xS5sklrfbyGUCeM/0U0j9fJcvA0NZoY85xPWPNTS6Q7ulrfYUT7sgaKPOUsRRGgJOE= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8251.eurprd07.prod.outlook.com (2603:10a6:20b:37a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.8; Thu, 14 Oct 2021 13:09:15 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:09:15 +0000 Date: Thu, 14 Oct 2021 15:09:08 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 5/9] hwmon: (tmp421) really disable channels Message-ID: References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1P190CA0012.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::22) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1P190CA0012.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 13:09:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1232777c-abd8-49d6-c252-08d98f13d2ed X-MS-TrafficTypeDiagnostic: AS8PR07MB8251: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w1yG5dfT9lNi48HB6j90NO0fd+/FRgACJlbcgXMHHrJrGdVw4+l9aTOpXelqWm/x8A6ZgE1N8UiO1PjhxTURAk5zHoR8RlKQ7Awe7/4JPLW14ACjWJqbll1TPFoNQTJ9J9RQq7BqBcz5+mxZ+YS+6SAXEqO/Rc3qORU8LRGjG0F2beNZ2tDtadXwSmEATwZWve0odHYNNbnUE47zbk3D59p8TwbbCi0CdYg2v+qJe9cX3TuoV5n48KZJaV5ptzcc0NiXVQ+uCikLHywQusrmH0mLetnBoLXJWuCzTAPfdic1tjSr/ncjfNHJViKjDFHbbzl3ef94BIUOmTtI2FLflbU37tHT10q+DYE57wwEfyr1ZrulsoFa9wjWMNbSNNcqdM/lfv9BXdSncikmZZ4Byx+JvlXlmnX9OidQBbeD8AOAiEf0HDo5VNm1GJ7n5rdJ9kGRqWie3swmrULk1agmozmaKyXoewiUX+v2BpV9QwtPqivdG1/rjxvgq5YL+0cYJ+XzC2gjqFw8TSRzd/Oy9F/E8O1FpP1Weo3hQ54yeEB7k7m3ZA9lPgz4ek4MnuYAQE1qKZ/wnKTQJaucWU04n9WwfH27dcPNB0aAHxcHUy/51irsmpmfSRlvqbhKtx32odJm6yj2B+mtS2BbgYA8Dqr3DZ4e6Jb2BGrubzaItwDTUMnmSEw2rixhq/ZZ5jwFcarhTfgoat7q7Lm1Hj25zA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(44832011)(6666004)(6506007)(66946007)(316002)(186003)(26005)(38350700002)(110136005)(2906002)(5660300002)(8936002)(36756003)(4326008)(38100700002)(6512007)(66556008)(86362001)(508600001)(8676002)(2616005)(6486002)(66476007)(83380400001)(82960400001)(52116002)(956004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q3eeps5WkYunKHpxORtrj4BGJMxHQMlIC136Hs5FQsb+734ggvOl9EV6eg0DTMwYvRaR0YC1wLzC+Iqdz2VT387fBxo8XpXUvmOC9P5tbzwgl3ff9Na82FE6HXxt4Sj4tsEmOix3cw9vvK1dBLOi8iXftSQ8OXOHKu7S28jmgUFpTk+iuHnilZzx208K+BS+w7LjySvnwTIbA89euqenIPiTnYn/ieTCFgMl+EEwAK57vH4WDV8cb9eQ6nJaSjhRQxfMSIYuLMNmzp4rq6YFAsw0KyIEdlCy7Tjq/kX6c2KumN7kWlH4Hlq5Qtu9NpVXaVDSQdfAKkG7xjvZRLihNoteumqeJdW8F+j7ACJNXOS8w2u1Wz9x4fAHM7jDOFh1ssK35MbISl2O5mfNeeCySFu/KOyxQO/K5BGXWdynUmfSHj4LZ6JD9SPftUmbBytlZ4YDRaIGpBf+FXDIFTrVLY3WlGJyl6eYWsDBNnJ/SthR/HKpqqkdsDgiO0zNXd8f5q2wjCBFNNTe2Rq8yjv/nHMUH80wkyDH4pMWrR7BNhOTkGbaJF+bsw2FyjUOVGg3g85DpkyGg0ALg7GOZcOCyYhQtqLWfjeY/ZVBPHnyQiN44u2a44gVkF79H7O6wu2SYIfFbqMqrvJx3hTj5l+9FDH+hflmGzgiF8ZATwnWCEblVUHH6y3V9oW7kHNt0/L2O8vpZlKmGSgkLl/loCcTBcusC+boRkq08Xy3FDx9kQ8CBtSkKo+/2GR02lMQCEtLUArdVvh43JkOYhh3BCAohS2gAuLjsdNrFfqtIkUvWPNnaNjbwmyCYjM4i43IOEA1K569YFlWghUJwPQyaUgFAuKa9nYjxjeMUBxR58AtXJtNzjZc59CDJyE8ewPAZuka6Hj7U2v2QtblvQqiKENveH0NsLkplVCHkR1Ri18I9e3mWLtKs22z6d2yIQAYH1UbKbIf8rQwNHUYkQbdG01lqyUyhYrOOyOyMbIfnhdqciW0ZVSVcZ6M9XlLmJY/fdnqLLpqlB8C7mg/8jr+LbA6wuuAzxJzA4fTJs4VdL9ZWnbIFyZpxbjkqzhGNv3iOfskjlGBeON1qxVK79MginbDpZN7HOsjSuW/7i+YncLDbu1UYhQyp9IirvBLP4YlWqQ/D30RmmWN6GGAoQAUNdFYQl8oW4W7Av6PrNIsXnWU0GIgqgWuVqnj30Z0fOuQ3uPxOXNW85Z4+FssF83wsqR89BV9jJXm/KDm9r07ymeiKjF6qCvIHQUQtaRIrX9qdM9rk88LV8L69GGSoKe/9D5DSyRGpAa/f5MBkuaTBoqYWGaVNKj8LxgQftY0TW8EgN4L X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1232777c-abd8-49d6-c252-08d98f13d2ed X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:09:15.6559 (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: jU/jT3KP6ppH7w0Vro0fvCpOSW2webEtp63+zx4Oltmn2nOEWfIwkiOdX5N6zeBaULRmVkspfGdTz04UL770qty7RnyuQ8HCNBDgpi2ZCfY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8251 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 --- drivers/hwmon/tmp421.c | 44 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 606914f20910..b402e81ae5d5 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -33,6 +33,9 @@ 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_CONFIG_REG_REN_MASK GENMASK(6, 3) #define TMP421_CONVERSION_RATE_REG 0x0B #define TMP421_N_FACTOR_REG_1 0x21 #define TMP421_MANUFACTURER_ID_REG 0xFE @@ -162,6 +165,34 @@ static int tmp421_update_device(struct tmp421_data *data) return 0; } +static int tmp421_enable_channels(struct tmp421_data *data) +{ + int err; + struct i2c_client *client = data->client; + struct device *dev = &client->dev; + int old = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_2); + int new, i; + + if (old < 0) { + dev_err(dev, "error reading register, can't disable channels\n"); + return old; + } + + new = old & ~TMP421_CONFIG_REG_REN_MASK; + for (i = 0; i < data->channels; i++) + if (data->channel[i].enabled) + new |= TMP421_CONFIG_REG_REN(i); + + if (new == old) + return 0; + + err = i2c_smbus_write_byte_data(client, TMP421_CONFIG_REG_2, new); + if (err < 0) + dev_err(dev, "error writing register, can't disable channels\n"); + + return err; +} + static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { @@ -217,9 +248,10 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, } } -static int tmp421_init_client(struct i2c_client *client) +static int tmp421_init_client(struct tmp421_data *data) { int config, config_orig; + struct i2c_client *client = data->client; /* Set the conversion rate to 2 Hz */ i2c_smbus_write_byte_data(client, TMP421_CONVERSION_RATE_REG, 0x05); @@ -240,7 +272,7 @@ static int tmp421_init_client(struct i2c_client *client) i2c_smbus_write_byte_data(client, TMP421_CONFIG_REG_1, config); } - return 0; + return tmp421_enable_channels(data); } static int tmp421_detect(struct i2c_client *client, @@ -391,10 +423,6 @@ static int tmp421_probe(struct i2c_client *client) data->channels = i2c_match_id(tmp421_id, client)->driver_data; data->client = client; - err = tmp421_init_client(client); - if (err) - return err; - for (i = 0; i < data->channels; i++) { data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT; data->channel[i].enabled = true; @@ -404,6 +432,10 @@ static int tmp421_probe(struct i2c_client *client) if (err) return err; + err = tmp421_init_client(data); + if (err) + return err; + data->chip.ops = &tmp421_ops; data->chip.info = data->info; From patchwork Thu Oct 14 13:09:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52F7DC433F5 for ; Thu, 14 Oct 2021 13:10:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36DAD60EDF for ; Thu, 14 Oct 2021 13:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbhJNNM1 (ORCPT ); Thu, 14 Oct 2021 09:12:27 -0400 Received: from mail-eopbgr80105.outbound.protection.outlook.com ([40.107.8.105]:1349 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230049AbhJNNM0 (ORCPT ); Thu, 14 Oct 2021 09:12:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Li4faiW6VC71igq9hW3p20ow+c/HGtYWDrivAZsiNYiyi8mkAFMAq4/niIUhG6U8lEAvZiheDOFTyq1V0trEF8ZyZkTbxd5uAVvTLLxFR412OS4SMpClqEkXcpm8UoryRRzO76Gc6+8DZAamyHfPQObzjyaBSTjvP3EZ/5UKhCRIJonaFpnOMxSGuZNg02Vwc2wIgTqhv3btU5mJhfUyfFFHxSUakm/DxjOHGMoGQlYp8A/EAPFrUiu6GNwj36E5p6brvAi5wBCOuC97hbkpBF42rAhSqs3d6bnv8bNHf8Rjn8Dv9duEYIf/9nfjJ7PqZOCFyymhZYrfmEZeeJIC5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lqhMO8SYni2T+kQRvYHQ8NkPp0I+ix6v3luDqt9+XXA=; b=K6rf+Je8+ZYpqyRMpQAq9YSx6lC4/SQd2i5Wu9tZZk3oT3h1ngCGGPuWu9TGa5pzhJTeIF80yzRvofeNHTsAoQZy/uIqkjgkbQFE8d1djipY81b18qhS3/WBYMUDeVe3pmqZec0dPyNPHNceYgvzVXh73IXf/ITZrFQsdXj2yika5zCmMzVCUhyojhUZiZxwWLMUYTRjSwxzyVEXJ97BS3k4DBEvbd6PJ6L1R1fw03VzQu8KdCfYp4lOMI7s6Yv1R2eICQG7nZp/EpOw4bM5lgAB096dezM+rq/SOWoCRQVJCeEYLgsFGimA0gNVAa9WVx7DB3D/XL/0mdGtvF5sKg== 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=lqhMO8SYni2T+kQRvYHQ8NkPp0I+ix6v3luDqt9+XXA=; b=r+bYNQ8z5ydIkXtKsFOdNBKlNMpRgoBlZDRnjZ4pLGgVs694DVOdP4r2Yev2e8Ovkk12huX6Na5rRObciio1vVoFYAcZWfTSacRVJplwUvJy3mF7j8bShVw9NDw+0sA1tpMR4/sChxA5MEOHwZgSkWcD6MFsSrIbp/778OGxbFY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8154.eurprd07.prod.outlook.com (2603:10a6:20b:375::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.8; Thu, 14 Oct 2021 13:10:18 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:10:18 +0000 Date: Thu, 14 Oct 2021 15:09:58 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 6/9] hwmon: (tmp421) support HWMON_T_ENABLE Message-ID: References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR06CA0149.eurprd06.prod.outlook.com (2603:10a6:7:16::36) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR06CA0149.eurprd06.prod.outlook.com (2603:10a6:7:16::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 13:10:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3144731b-8837-459a-ff27-08d98f13f876 X-MS-TrafficTypeDiagnostic: AS8PR07MB8154: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: InVc5/8kCVGu/uZSPaltpBwybfSB7kF3rscrO7ExfopmWFTPN8FIh+b+P1wQKkXegnX81PoyVCz3/8yX2LiokjrlHcTCFNfmwaVbG4r5V5YWkwcP9WnhsFwQxpSH00ASV4n+CrtmfN5lzhZvYO2Aw+teRYb0aMXD2pSf2Z00XZi+ZXKpvRd1/vgMyAMX1SD77rJ39XdcBUZkBUCUQT1bKMS6QdYlXWmAc5Pc0jTldPZQxO2LRgpvztZWQoMLJZD4RY4w03jKx2jx+Kd2bXB58a90JauhHJoF3Vj+tdX7Av6kGvyKPU70n5XERPpPevZfxnx/NmtZduYbTWA+5m0X6NqqdJK4HbPqNj9ZELKtepNUi41smI3GNvZRcV8BO+NCWe0TT5A2x9Tg6mrRrWZI2ldEr1Q44GPIXj8OkXnuZwRybyVib3smpet7IWSPrYPMKoP7FUfG21Fnr+UKHFWto58zPtJAswFoJVfuCgPJnKcg/YhJVgN5DG+VT7SOyluZ8FSzv03rGvV+g3GApkDw4sOiT754o1FABw+GrpZATG9bS60wVCdifDRvJuq6yT7aA7nkDa3wH5pdsVGZThodo+EyqlJJiR7/8BjafAJfIanm8a4I36Oo+2EUVOAhjbXVTRUHANF14fA7bTjtf+gcBBuGnsA3Ge958NJDf8tv5Bre+uQlMp+zRQYTtPja5/mpaVTzJtCwvTGkzrGJKIYToQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(66476007)(66556008)(82960400001)(66946007)(83380400001)(44832011)(956004)(2906002)(5660300002)(2616005)(52116002)(86362001)(6512007)(186003)(38350700002)(316002)(110136005)(26005)(508600001)(36756003)(8676002)(38100700002)(8936002)(6506007)(6666004)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MdA5nc4NfqBhj+vlwlmbn/yyFG7X5mLGlV+yC0cJvLWw87CamfL8bNUGmUd4lhlRcU1WPuJ9vOi80mbAgSCG1dEFsJw8Nd6cCnTME75XorEGyDIeiGTp88C4SQBKKtboNChIj+a1i6n/hN3PEKbh9S7h+sR0mbk1rNEG1VuibrTL0CwICo4bN5mg6qT5XFJtr3DqYi5xJ1n542UXcBWmmK3tzACIOs7ItvNoDuFmLknP9sbI4nerDDUZEJv3U84ze13z0mIviGmzhOYWCNGQs9XuHyqV3HeFiVSToPee3BoVCrfwajqTZ6BDlooWRibCxvQJGqzFAGvQs0Bte8FtFickrivZtfA8k33lIYIBvcJX0oZoy91WlpK8M+HzCzHj6PEYVcdDrObApkVSc6q/8LprH1zz1W3aYgNRiCcf/wKACf6vI1rQJAtCKkPQZn+tk3x9mANzatjqSgUHvVvfrNPcZZhfiTdkH7qEbDOluHCcIKLRdzApAbZ1W/hlJzQLjLThRs2r4j8qmECDHG7AN7lQJ/A2dTT4U8Po38Dgnc5g+ChOprAFSyWO2iqYVHjOazLEOGQ/9AKmd6Y2AI0Tu6kXkIYNwLMHZbvrQj+4wJG39sqtxGLUvpGTMAb7VTkIITBqYcby0WWiQy+HwMMJnSkU8Cc1JG/gjvVJsUCbJ/O48NTdYDRwnKwDV+/NUuoHOz9YANyH1WHLJ349yGuTLIcvWB+X++5W7qG0846/EaHzt62YcKbr6YIKMIKs/WBb15D6h2KY9Pzr49mfOSZIqY/3BHGfTcnEIT4tq55ZWJCegwewtdOp/r1JlxgedblNCexcAgVg05VKezAAflLUBxaZl/4Er58nT/+gIyM4DVmQdiPJ+WT8VKMGhEmioycQzSGlQQzMErFjowwdGhXLQZTEBcCRJ2cfrhHNNjwbZ0/wjpRN8t35iqnKOGmRoU31kX0PrF/a0/977HiXsMBZW6dT2HOWUTTCWRO8HKkei9VfAPQ6SahBsGXgjNZfLjOcqe9fZMMdk1R672fU79XANtm+eNuDuklxXMxP4fLFm4N7TauHwfX95erN6ARqnAvec6sw/+h2YYbxnsFY7O6ggpcdVyDW2fH06ib3HJwDBJW4TS/Bep7RAenLx8yQTRl5CF6GiXGuwWmtrHb0DH6sX4vnzruw6okvPSEbBbtGtLBXxhzw4is3Qp/6PtUu0m34kJeRB3P8PpmP82Nkn6fytgOK3srSqhFGxTV/C7VqgmEn0fBstuhiJI/WDmWmIdn5/fUq+gmxYxm34/kSbhBPY7MOdA3vtpWkqIgMNJADQP47cKgZnUXfS6CDXczir/ILwHHZdRt1JjTsxfk6wUM11XXtjhUph63U8qRuGCd2Fs3187W8FJLfMWxdHn2yHqfBEtYBMZwxbbWktGeflbbPAEjsMp3ikU4T/PVuNfuQeMbg0xNy6wM/jP43ZL4yqW4oSAElutlooCFRP1Tfk3OfR41qU36FQfbf7zKoJcTzt8rDFi3yd/X9ZHlsfI7MeT1Tzo9it1qHjLqeINWjxlNeAVqlSvvMpjfXniS8wTVrytm+bkMkqhIpP+UUpJixnGwpIP9w7usNKg9F0b4qFRCakPDtXfMOY8eZ5tP1hmzL2DNF7cY6F2sS9tqlquD2LtaAQsaSu5Ux1yUeQey4z8t1tQ== X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3144731b-8837-459a-ff27-08d98f13f876 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:10:18.6180 (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: TK8x7Hrk+PzBLcHORnqA358+xW4rl2pqFOTyoyGCC0eB4P+IZ85a2iEfEfvUUQTZ1biq+rAKq5fSUsbjiPVyFv80+crqJThGBfFD6uNCgE4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8154 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Since the recent patches added possibility of disabling sensor channels via DT, it only make sense to allow controlling that from userspace via HWMON_T_ENABLE mechanism. This patches adds support for that. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index b402e81ae5d5..2e20c558fcb0 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -203,21 +203,25 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, if (ret) return ret; - if (!tmp421->channel[channel].enabled) - return -ENODATA; - switch (attr) { case hwmon_temp_input: + if (!tmp421->channel[channel].enabled) + return -ENODATA; *val = temp_from_raw(tmp421->channel[channel].temp, tmp421->config & TMP421_CONFIG_RANGE); return 0; case hwmon_temp_fault: + if (!tmp421->channel[channel].enabled) + return -ENODATA; /* * Any of OPEN or /PVLD bits indicate a hardware mulfunction * and the conversion result may be incorrect */ *val = !!(tmp421->channel[channel].temp & 0x03); return 0; + case hwmon_temp_enable: + *val = tmp421->channel[channel].enabled; + return 0; default: return -EOPNOTSUPP; } @@ -234,6 +238,24 @@ static int tmp421_read_string(struct device *dev, enum hwmon_sensor_types type, return 0; } +static int tmp421_write(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long val) +{ + struct tmp421_data *data = dev_get_drvdata(dev); + int ret; + + switch (attr) { + case hwmon_temp_enable: + data->channel[channel].enabled = val; + ret = tmp421_enable_channels(data); + break; + default: + ret = -EOPNOTSUPP; + } + + return ret; +} + static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr, int channel) { @@ -243,6 +265,8 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, return 0444; case hwmon_temp_label: return 0444; + case hwmon_temp_enable: + return 0644; default: return 0; } @@ -402,6 +426,7 @@ static const struct hwmon_ops tmp421_ops = { .is_visible = tmp421_is_visible, .read = tmp421_read, .read_string = tmp421_read_string, + .write = tmp421_write, }; static int tmp421_probe(struct i2c_client *client) @@ -424,7 +449,7 @@ static int tmp421_probe(struct i2c_client *client) data->client = client; for (i = 0; i < data->channels; i++) { - data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT; + data->temp_config[i] = HWMON_T_INPUT | HWMON_T_FAULT | HWMON_T_ENABLE; data->channel[i].enabled = true; } From patchwork Thu Oct 14 13:10:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49F2BC433F5 for ; Thu, 14 Oct 2021 13:10:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3449660EDF for ; Thu, 14 Oct 2021 13:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbhJNNM5 (ORCPT ); Thu, 14 Oct 2021 09:12:57 -0400 Received: from mail-eopbgr40117.outbound.protection.outlook.com ([40.107.4.117]:19878 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231380AbhJNNM4 (ORCPT ); Thu, 14 Oct 2021 09:12:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UYiyWXMoQGCPvZ5vPEJc0hDDvjSRl33I0UKmR16cJ5mUX8D3UqcBJzyMstNjEQb1nTy3Dt1lffE/+rVcMUN02BF4hwnJ2jZdmwlVOaKrmlIBlqsbsZ3+A55jPcVrlcmyZBQ4ucmsJcPZ14A40Cg/XVUPL++fSBOlxyVAvPEPEMK29HF5YCv9BtRkClXbT2b2WyXxbxjQ50j+j4RzCGTJ7LrOlqO1RQt/Y3UvyiePETpKQXGH1PTjWvqEskvdUifu+ls0YhkJ0VH9uL3nwh4IxGHsWTQKQtLkKdEw7ewGF/6mdtswmSyJiBcgAocZKguvtQWM65B47m1cczGMm/D5eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=avRR6d0VWmsySOvz3RnVrcJ1LnT/zSsQ7X0Wec0Ag5c=; b=Kd1riJfEBmp+3Qauurvxk7MlH2LG1q14Oze59l1huev6kePm6lIfjnZ16u6ikEYTNkwOLobWjbNBfHogz2PeMFMkM8YIV5LNzppPhgIbdVOj5QaqZLJpVO+qLvo7OXS4ucKdOfwXFAeqSJ9u0BNSUzKgNGkm/MySWxB422ABVbYKzASI46RxEnc1jux2bE4rcz/CHT/VAFLjl0CHZLIotUbKI91pOrG/N58d+ZBOK9JIOafhN3KUIzmqmT+ZV87ksKCfweZRTUjjM4eaRsYFWw6v7c9u20ZHl8dLueOf7CQU0amvmB7NdoGydeC1n8SS1JK1lZMoKUiTr6tL1cpspw== 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=avRR6d0VWmsySOvz3RnVrcJ1LnT/zSsQ7X0Wec0Ag5c=; b=oVP9LyKUiaoobD3RYHYvCUJmRQxEAQXpmajANOdX8HTs8ksJt7prkcnRLyMgLROypBfZuUKvKa9Z+IEG18pF17O4QdI5SioiBa5YwIeZPslFypIQeuveF29lEVNqrtPyqpdW85nEWT7CiB8F434gwlgIA8ExKOeDhRdtauj7biI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8268.eurprd07.prod.outlook.com (2603:10a6:20b:37b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.8; Thu, 14 Oct 2021 13:10:50 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:10:50 +0000 Date: Thu, 14 Oct 2021 15:10:44 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 7/9] hwmon: (tmp421) update documentation Message-ID: <6ae22fdf18513ddd09f430ef9c5e46c17e27886b.1634206677.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14 via Frontend Transport; Thu, 14 Oct 2021 13:10:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e17b6127-b70d-4892-ea12-08d98f140b66 X-MS-TrafficTypeDiagnostic: AS8PR07MB8268: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OBJX3RYHdXwOaesobiG1SJvHlL/sMdx94OnwBoWzvQ+3oHSm054g3hEUIOyM28YJx/3BjF/mU3bvyG3/kr8P6+LA/VNadr1tThVre1vq9asWwSdy5eko33hYR5hjPzR6ASyAfTimGndqntauGYzOAoBCtNAxkTeFUJLlOcPlD/nwAPXTF6Z+G5FZOQCCiMtN1hw6+rtOgKxvztibCNA8uhPkkLyDXXUPFk//Ku4dNf6L5+MIDn308m0i2fePXxMbhuOPflBKSjugXa9J0VxNLsSbToVTJhykhlYD3ySQBstR1IrydfF6nz/MLOydfocoTqPoy/BEaBZcqwxZcPX2X9FcUlr64paWf516QV8H86cJ8VPbVSxyrS5dpq1soyWFaG2OEbtLiZp3DMNFNi7FFdu8SCjn4IxWT5rnRwdBkNdEfj3FPFUKUoUv/Koammu/Ok3HrWKUJJYwDhIeuU4Juze3k7Q/KI9rnoWqkg/+vDyF88sdkUg2uB/voT/WxeJVhb3s3eBvUt6E03sOl+DIzvDhzHcSAYu4uMop6E7Eu1Tj0FAkCgP9u3HQTyV6QM69xA/cv0nW9FmG/CJPs4L4SMVc3eH1/EF5gy9gRqhcvqJb6z45/Ah7qSXyK6EIptnM2ehlw2YqnvE/cX7a7dGmAKSIFd08XsSNxngTJb3O9ziEEWl/JMR2msPq56okM4Kxvxlk8FcTlU/Xp0pd9pGg6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(316002)(110136005)(186003)(38350700002)(508600001)(6506007)(38100700002)(8936002)(6666004)(8676002)(26005)(36756003)(6512007)(956004)(4326008)(66476007)(66556008)(6486002)(4744005)(66946007)(82960400001)(15650500001)(2616005)(44832011)(52116002)(83380400001)(86362001)(2906002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i6PauwedxFfmlNLHtC7pNTPt+Ud3OnNuCMQ+6nbjkvgPBmwFyh1TCQSgD6lzaKhFCFQlC6KOvmL8RTRWeqcE+RkIvbU5qPE5GDhqg3r8CBIPYDfTtbF1JMeyI47i8HGE1cNITDkj/5eCyZO6NiEwpj5OBlJ8pkRVMl/wUQrQrQz29WT5K2mP6KjuCD+9VwinCRhuraW/W4x+HvILHLrHMirv+RBuHWXeVpsReANXiPGGWqW3JtYECwPQ5yMhLlE3y8zmFHwHo7jSSRw4uYZU9UYG3aA1pdLWXhs7yVy9koGkAYeNwgPQXr5JUUZ9tYT4cFUNn2EYYJsUcE5l0JJK3nVIYsZhO9KHBIlTalsW7sKs2cOp144mUu+6YWQVToNKbscBZMnEiU9aY5HglqIbLR32pwd/MrZ1V3ZJPRu3mOdzrlsj/ZbpzV9bDCBvsjdC+Hhg1jJPYShBRIkq+2ARZoP4dmHWEGZNxSzHTozQ922Ueti23iEfTlOc7KjegxJ9MqZ6IYzuTiyYIs3SYaRzzYiK/a7X1Ot2RE/CtN+mvFow1D7H1zi4xYs9GXtM/zirwKcUR7xjzHDsDLh9Z7p0DxqACZB4tvF4aQrUHW4dNtcDR8QFok0nCbbTo8GcLm7TBmXekkLvqegTwOnAV68Z0r7I6xVAHYDp1GBvt6XRMlzSqQ3H9qOkDkY/6fk94AE5pfJ3XOq22gD322K14dOCVPt+jqcA6UcD8NgR/Oskx/PgWyGzW7kZ/R8aARuSJZcR49pSE61Nkq41FmOjbv5gDbUSMoCAmIlfmxUnJzsBxXx+huDK37fD3bx23bfhqTQ/lgxHK9ILT5dzpVgrLQTSUFw49MJBfGCG5EGsvrdso7U2wCWald0t+0C4y/jZ5RyRsIVXUvtcfcpkLRw6BGEK85uBpb6jRkprtf9HqVuc2Bq15mFEuLlLCX4z2IjXcpKpyyzE/I0w60bugduUUTNBD0GDXN8euUkKwTx997tXhlXzyhRXQV0UYawPKb16/16ExnR3Iw0IduB8XqBMHfj8cmDHfe+WoM9+RDAtWb3qHRVtuW8yhp+n2m2TCxC28zO/ew0yMW0KyjbcY66b1+FdSxwTp6sSMTx8Bi+3Zdu3+rxyphDc2vZasiYDfsyxqAjl0Z4NhRbvXaEkNmKpWxs8moHK0po0hqj2qAxyW2NmgkiO0g9S4AOCHnqEx/BpD40Ic5Vl3AQ1Dn67fsHrY9InMCXJJGiLaMm8hW2wiZAVao6OtwjWbwXd160aBwvZwJj9KbKEHDeF/JztlPkD/XwWQyNUM6q1OWEIKtvwS34V6XvuJlq2ideOYl8c5iDn2pYvz9o/7+3TC7i1NNYppA86yI6Te3ZgkHwTrZC0d65PpDKLGS9lePSVwIqTzO+ZZah9GlyU3EfzcBYCUtDLWavOrfKVboKzqoJhD40WJNhi1bl9amfLIQG/ZRw1Nvf44qKHW42nLlxqJm+5k8rBaZHEtymYOxTfxTq8JlAVYemlX2A2dN/p07p52I6KFrpAbN4ticOrKy7F9vXufgkTbLsoUsVwESg+tnrfsC0j4IlUluUWVdjJu7Z+tFjVzmqi8jIh2LWMOk3DCSj2cUl4ZSssOoaPnNVTxz9aqFo0P6xWPnkENTW6gKjemE78I6idugC/t4ARzwLDNYOaQG6Qcnm/qQ== X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e17b6127-b70d-4892-ea12-08d98f140b66 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:10:50.3844 (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: EzWYm4cgvmzqm/ylZ28C25BPQW5zirOiVx7T8BKAHfoRooTDbv1lUGF5NpWjvwZx1olsYZ/G+qL85wro2PJjw6qCmrXwC9+MzeYOTCaPwl8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8268 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Sysfs interface of the tmp421 driver was extended in the recent patches so lets update the documentation to reflect that. Signed-off-by: Krzysztof Adamski --- Documentation/hwmon/tmp421.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/hwmon/tmp421.rst b/Documentation/hwmon/tmp421.rst index ddcd5159c75d..a3002117bbd7 100644 --- a/Documentation/hwmon/tmp421.rst +++ b/Documentation/hwmon/tmp421.rst @@ -64,3 +64,13 @@ the temperature values via the following sysfs files: **temp[1-4]_input** **temp[2-4]_fault** + +Each sensor can be individually disabled via Devicetree or from sysfs +via: + +**temp[1-4]_enable** + +If labels were specified in Devicetree, additional sysfs files will +be present: + +**temp[1-4]_label** From patchwork Thu Oct 14 13:11:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5DB4C433F5 for ; Thu, 14 Oct 2021 13:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE2A9610E7 for ; Thu, 14 Oct 2021 13:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231318AbhJNNNP (ORCPT ); Thu, 14 Oct 2021 09:13:15 -0400 Received: from mail-eopbgr70131.outbound.protection.outlook.com ([40.107.7.131]:21271 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230257AbhJNNNP (ORCPT ); Thu, 14 Oct 2021 09:13:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LUu9rfYOXk3mnC55Jiy0vzF45Y+eCL4od7IYhXVeoVVNqOA1wquWhbjoQpf/snLmHi88qyG8sHBTmD1raE5Hn0TDNr6O5zS+EHGvUkhtmp8FD0hqUUTYo4BvVZHUd9ay1Ixg59WaT6QY9i0CjAaxEQPNWyKBBKHVrWbP4VmE4Ll/gQgmyZZ4AlA+RGpV0nK58KECva5edrl+nBaQcwRcrkTtZNQ9cRXZ2luQ0iKP+25t5VetA9YdJ0G32YchYQulDE66olPnWX9NHu62PYK/8OjYYwjUKCQu27R8tFthI3b3w8UT2Yyz6wvwGJxBi5CGStyy9mXng44D2tIn0/lhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/xl+94h1cHon91TeyFU17pCgPBzPStvzPaxgLwGbYLE=; b=cn3m+RWlRimTo7OY7M6hOJdqXtaQATMUZe2wKtwoC8ZHZnbUdCYzu2xJrardh0DPZuBvYYLxmCgE2W/I8CLvBQlbCHZSXWA/X5DTNTyroPW4Hjo3DdXTZc4Q0sWxonFwT00ZHIJSuQVK/n5M63yuClM8Rc/bbOlQpiQglV5JQEwTHCfH9jL1vkb6m68kRStCKxuRN0caBxKpIJdsmUSOAJKaaDCEshe5diwzczFu+s2ZN/ViOTnVqUtiXFvo+XhSbLUF2Ndh9zFhfosDypJo5dBPNHho7/paw2fe/wiTmx69YqT1mwA7jcsz4AKr2KcpfePM72YpocOyJUUcc/OSAg== 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=/xl+94h1cHon91TeyFU17pCgPBzPStvzPaxgLwGbYLE=; b=KIBrss06ibis0O/c1emeNDyRNpnDApxW9ysWnBaPtNyZ6Gha6HRoSIeeNe0kBKpLI66zuWCQMxV8MwmUSpzyUBZrcKePkwvxEnz15ZPVADbzSieTpL+p+enEKb++Sn3Mc1VdAO3sFWNVAq1aubhuQfSgTdAlF2PqOI81hroHj2g= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8282.eurprd07.prod.outlook.com (2603:10a6:20b:37a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Thu, 14 Oct 2021 13:11:08 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:11:08 +0000 Date: Thu, 14 Oct 2021 15:11:02 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 8/9] hwmon: (tmp421) ignore non-channel related DT nodes Message-ID: <8e9e332b18dc2cf545f8e8255157e408d356f916.1634206677.git.krzysztof.adamski@nokia.com> References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR08CA0077.eurprd08.prod.outlook.com (2603:10a6:7:2a::48) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR08CA0077.eurprd08.prod.outlook.com (2603:10a6:7:2a::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 13:11:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06d02bd9-045e-4aad-6ac7-08d98f141644 X-MS-TrafficTypeDiagnostic: AS8PR07MB8282: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VfwSCg8FLW80q5Xs6670YdDb3omFV3Z6eqvzCuoBNrIJKBb956LDjoKE/qXMd/wsQMXZv32yNFQbsyg8qr8yBPqBEvfGbLEsrCwBTYBL0XNtgJ74auujg9TBCnaajDrgL1mqGC8UfFrsVTKXNg6Fqj40QTj4Ku+Hs/TfGmsDQP+MPaCQ08n+DGk9HBaFlTtqO1OduEVHmDnuaVUv/cnOP0KKInz/6oexC74z7DRLhhhwcHxvrZtV8KCbCUgkVBLGX1Xj00mivSq/4qNHUdwo1Qlv7aecNDHVAYQk5Nzh3YOl55j2343YgXQqLpJ6RfaSjgyRwJXq9+qlodGHubQDRucExOP5xHKhKFFaNHuf8ADXJ3X0wcyjftnviHXXbm8LqFUc1eA0Hsry+T+0CeNB3tX6xvARbjnN0BTeQFs9q49MbSZqQf06/JRc9naUEg4CWCpgIbAx6dAXYREQEO9sY9hkBiFMH/s19mutLJZAwDrlUi+ibeZevZj4mOdaEMpBOZsIrBjPtt88cYqt+EnO14ZDIslP6nRVe0XtutFeYsvw1RUXkdxH3MVCTopCl+l1c3S9P7SasClo5xRRbYcqkvt9KDy/wRUqn9O6Pz6rP1AhJI5GQw+pdzoXRyuK27vkt8H06XMSsL9CRZupWvUEbZYYNtS0zFUUuCgo2LciTfpt+vNiBvozuOKqFBXNxf1BlaxGRAnE1y9FUL3H1tKm1A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(2906002)(4744005)(38100700002)(26005)(66476007)(82960400001)(2616005)(52116002)(6666004)(86362001)(36756003)(38350700002)(5660300002)(66556008)(110136005)(956004)(6512007)(6506007)(316002)(508600001)(44832011)(8676002)(8936002)(66946007)(6486002)(186003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G5gvMOArokRfO/WNi3uqiQou4zphOVWA22f9tVrM7ibvEnTnn9D99soT9DoFg4LyziDaO9VbDvPaMrvSnclQyWfXxFL7hlHixJOjDwifXKcbR/AmNlgdNaWQ7xasIk6YgC4GQ8p6UjC2FRduibVBx1fZ3ZdTx3rAuAPTldGtDfXIKDxLbYpsWHOBS+t+6JxZbH2KqPU4ZkiAqj/BSVHt36JB4P5qhtMNNomDRMBuCIu6rrp/tCjJWN3eDYS/3yzaxZVNAfgPZZcVq4u+IokuxyNIKJhZqQWRQIc3yqvo+oRU0zHvi/8Unv2hxmT5ucA8XFEmwnoPqQ2UM7EaQkGyihnGpyksvjHpKNhq/zE64qNknFdlAhv/SLOs+87K5jwSIOGITkH9h6kLhOTzEbnxvvBQzQ7JhU4IIvPqxrGPIFMnKWPsD62FVQh+dXGvgD2xtLKF3iE/aJGEbLA+d3ZgFjjNB1+QbloA+bKN3Zq3YKEMbvURAKR7Gui60d628nyivQjP1cM0piToC/RQojAiLz2VTd4AvkBr0QT42AElGqjg7WzruoRC5kanI67fVdLGjtsdgJcg6i8Q+c12t/KhM3DZ8BzeAXo2IKkZdFI82UHDYiXNqyTEkShJ50+JhhUqgXeYDnP7c6fx3QLWS8jb2Rft3vfxkw5hpidhZkLtSHOaMRYAMCaC05aMV63reyMWpgTw11PJ8Fkb/owsOsp5Qc934lcbN8l+H1fVpj6K7vby3maes01p12hLKXa7sT7HcksbfIe+rTckMYRDx1G1ZztYoyB/VSK3BNJEF5/Ij6hDHcF6YWLcwwvGYTPnC22j1Hnwgf2SAKytTevLoKckh3Fu7Okje9OlUm0EwqeV1Ow4rOPq9hXTsy4fdvTYoxRTzPnz/D7Mkt2wh9kSAfdFT/PNbybx1j5PpPOCClR/aHpvfRpv7AIZGWxQVdroYzcUe4uuJBo/75ufMIUKHJvm3mBUSmFEBLs6wjWf3csX1XVBJkA4VR8RbZf5vXmv34XxhCTnXXjbnT0ILqFQl2lWUqHhcYYpqADSguOdNgqL6sVCF0H8ZRXfXN3aBi+ZdUSAt8i8Z7XMAOfZuOwVmREBjF3rfAtoSqywFPJly6nd+aD6+bsVV//YLWVMqRvsLFk43gCxD7u60J3JQp+PcKqzoUcRs2VYqpGcE3OKl5LUNfwYa/4JITdQwtI7LboWPRKSq8RPV6gl3+eY+SCbZTK9NQsqBER5SdIbmMRFfcrH/qZBL0uvp9jwHzbGzDeV9pk/n4+mGj7EFvjTqsBm2xX6FuoTLYIBoDLw/htD6zsYhmKiUY8XtNGH2gywnXXdIgHz X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06d02bd9-045e-4aad-6ac7-08d98f141644 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:11:08.6053 (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: 65a/cPKQVM4qUOmh/iw5APdsy5iktcD2n1M3Bxni0M3VoZErpCHrd7KK01FwVl9HuNPmLUBR0Hvb8V7FRS8cXpTmO+8ef3jJvWX3EbylWsg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8282 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org In case the DT contains some nodes not describing the input channels, ignore them instead of exiting with error. Signed-off-by: Krzysztof Adamski --- drivers/hwmon/tmp421.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 2e20c558fcb0..493a24cdfca2 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -414,6 +414,9 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d int err; for_each_child_of_node(np, child) { + if (strcmp(child->name, "channel")) + continue; + err = tmp421_probe_child_from_dt(client, child, data); if (err) return err; From patchwork Thu Oct 14 13:11:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 12558463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E497C433EF for ; Thu, 14 Oct 2021 13:12:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FAFF60C4A for ; Thu, 14 Oct 2021 13:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbhJNNOU (ORCPT ); Thu, 14 Oct 2021 09:14:20 -0400 Received: from mail-eopbgr80118.outbound.protection.outlook.com ([40.107.8.118]:8003 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230407AbhJNNOT (ORCPT ); Thu, 14 Oct 2021 09:14:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIZ6WUKXW75+e5o+K4phUFmmniY7KItHkYYoEyFUNqrSwLnLi6hEJrl7K8EdZ8znOQ15+dShwvBk0GSX6dHwXBFeGheUq3RvZ1UQWjJcQJdX+ay0gdYkw/YSh67Ntfy3T/zGSNsXskqbqZh6wNBoKai7qX77HMyRDFwzAHr5E15WhrrlUg+zcaLOlqs9J+yk761XMEM3NUESUJSyRz7GHAi0Gv/PCTxVD765Pm8BXU9VNUrBaO1bMC+pLiT/cUd5V7z1Dj+BNwjp3aNa7/iqwT5mnnDhNYZP4VJgxLI3+1pEBR38t+4pIs8Iq1i/fI6bBheicbRXe3w2lPDec5Hl1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/HW7MvCvkbWKARFWbaqT5XpatFvbmhHgkUkm9/u5nTI=; b=E6yc0B7HEGF8UtQaB6dHptfWepnJlw8EwztZcE8L5PQ0y1aFe1Fn9+RkqZVWR8ZY/wv6QEAjT+mJm5aB3I1gtamyczpM7nWXSLlJgB+ZCZozffvYTzzR+zWkb0uHMdh38UHGOOq7ESD1YT7dNNRt+46whmAyXSnMcAYVFLdJI9eVLv5KLn+aJ8OYGXT51hDMJKO/EoHOz58lNZV3XXFlwMwWQ0zTzgUjkL+zi5NUEkYkOyMIAzXCQtHSQL1O7zpLyYHmiDfSllM5AwQO7kf3EvwE3ZmUTsxqpXEantPasoQh+3PWiYFHVjpnSu1gPjmRCThr2XLA4+RoYx80whhwuQ== 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=/HW7MvCvkbWKARFWbaqT5XpatFvbmhHgkUkm9/u5nTI=; b=EVyZnklcq4/1YEk6MGlEVIYL7iiipmJ3m6xywORSOl5nkaB9Ika67zk+rDa+Z6o3f4OdAG3cq/6cJHCG1hdLYU6RTqQJSivHzE4IYeV38S1emyZ7JeF3yqYGcplSNeI06zcr9g2T3lqvm+9pqwjjtpt4P+4XtU3D13rWC7QJ+Q0= 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 AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) by AS8PR07MB8187.eurprd07.prod.outlook.com (2603:10a6:20b:376::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.15; Thu, 14 Oct 2021 13:12:12 +0000 Received: from AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342]) by AS8PR07MB8104.eurprd07.prod.outlook.com ([fe80::bd6d:55f0:170c:e342%6]) with mapi id 15.20.4523.026; Thu, 14 Oct 2021 13:12:12 +0000 Date: Thu, 14 Oct 2021 15:11:49 +0200 From: Krzysztof Adamski To: Guenter Roeck , Jean Delvare Cc: Rob Herring , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 9/9] dt-bindings: hwmon: allow specifying channels for tmp421 Message-ID: References: Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-ClientProxiedBy: HE1PR08CA0067.eurprd08.prod.outlook.com (2603:10a6:7:2a::38) To AS8PR07MB8104.eurprd07.prod.outlook.com (2603:10a6:20b:373::6) MIME-Version: 1.0 Received: from wrlinb104.emea.nsn-net.net (131.228.32.176) by HE1PR08CA0067.eurprd08.prod.outlook.com (2603:10a6:7:2a::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 13:12:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6198b3e5-5783-4578-1fb9-08d98f143c59 X-MS-TrafficTypeDiagnostic: AS8PR07MB8187: 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: Z6TZ3pd9TstBp6XgOTh/4xm75G6ZFFhrEj+pFooYz4pGflRbjTpmKOQAgagnajI7q85AByWzCY3O+4KlpaKmVRH3e1DUDJfnQ6f/bys7zGiifK1nNbqhtUJORyq1X6w0VQtdlZVFBzzOdP5DMvCqztSfwR2XG7ArZmw3FcuNQ9YQ98pFs0McBgS9zRCx4sW+ZF6OXjh/UYb+lvDu8vHPf/U26jROHyBnMQt3YsSolSY3J/fy9bl2ALvPD09CTfB4RsEa7jBQ6UuS3CvToTtIAUXqkZzuPkuXL1guS05Z1rIc5AeYrdj5VezRzAkqwxKwOozEWKoINN7rVlEnW/sGMluqcI4y1ymKVpqfxkv51RWOQC69+S7Xzvuaw1kQxxJM2s//698RY8W3v5DtwzxYOrWslFhaStUWJ90hCcZ2mEtgemDLkxq8TbhFTE8YcXXtmQZ/kmn9AadZODbCSjzTbXIW++RbjaKqK9y6mhoTgrfmj5r+sWwX4iNM1PqupOcC0Wr+BymknECIv5uc+j4aSsUtvuyfcKWd1sq09OQ8bzdjTxXEAOG0PX3RTociwXMaqO4RmxbwtIHcL3Zj8JqOfHbxqhCh1dIaqPYIOBj68WII7DGnP7hRs9iVQ0NfAQ39JM+7Gl+a4cQEtqsL/+DfVI98j/J4yu3jbNWNj7xbErD1UjULI5XGriIvVHxHVYrZMS3AdSuewlGiw4YdSXx7yQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR07MB8104.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66556008)(38100700002)(38350700002)(6506007)(44832011)(110136005)(6512007)(8936002)(2616005)(83380400001)(66946007)(66476007)(508600001)(82960400001)(52116002)(6666004)(316002)(8676002)(186003)(36756003)(5660300002)(4326008)(956004)(2906002)(26005)(86362001)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E8JnexfASX2XuzTE0oxuvYM2MQnWVKxdnbSp2uHl0Nrpou8RL0oB7UY1TMslXrwb6/RNwi1PnkLL0ZUW3eXY1X372KQglsP/p6MEMMSaku+s4TB8oZRzf6JgAfyOTTVxCWkcp5zzv5OUXva08wudb0PeNKfJHlwcmwTTaF4Du8XkOKgjTxWX/rAqhc0Zd2aB9xMfkXNgIp+PJERqCajJIY7UTKzLbnPmrSmQAt8a27BBc42k3v4wNd2SatB5cFqi8GBowVND7NSvEgbwD5AnHVPWnuP8N51CL3WGeypcfC3NIqbq8J8lUuakPUudVlQDPDRpmNqyJsPUXoPVHKMLaIqgInkQHFqUy0lB1i52O2ukJaP+50WwQvw/uzsRlqRZE6CdDUnzl4if8XwBkHia8EBPORGZC2kMfh+UEu3nG/xEok8RYv/21k3Eilec9irJK4YAAXE3YDPaUQhinjLh1ODB/b4bscFei0DeJY8g1akIJjB28nQjpyq0FG0d7HG1n3W+5NiyhDbMMyNsK3mw9oDLfy7XZAO/xHlZggZ5cYWSObpdkj37Kr6zVKDfF1u5Go+9eeKFXvMNkiBoF4yVL6Rn9ybdiycnQ83gdWdKBUmBTGW8xPx+7Fx/5doRMsg5Gb3JnOCSGjEwbFHW0fKTS+8VDTCUJTpEGLEI5No2Mj6gdO/bSIy7t8GJ2i+XeI9sJdILvxTTpD0eq0DwRlusIZD3uffTGBSEfGNon32itSqDK6XtzMNGe+BvL7PELFkdf1RaN2CS7eJre5xp+ps+mF5IlZY/cbWMKpO6DEFx8iY/n7Ta28SZKX4RjdgZE2rYEOklGB4plh7NtCeWIyWF7h/Rm98rDLQz8FM98GDZVMTBnCaFngq+Y+zBSGS7WNPLSuevLpcmz8Thia8HgJOkJeMQYlY9tH6xhJh6NzhI16uSuVl1MJwHiisTiNBdPCxpw603PD0Jef7hGMRAwqT4s41zz1R8jA3jQdTO4ozFnCZoG/IaGqrlW1731L8jHCpA7PORztOu4x6AObUunXkhnGxYrVnfyaqXF60VpIDSQM05MDdH3iAdjGFmmh4ydHqhLOaO8w4OtRvGr2FMURaA0TE00BzuMYGdvfvrzuzGLVJCEJ/lwyrNDGgXMQYSq9KnBzTsQG1FN28PeUDhicc1OSTPZ9eyhTOTFYP3nd4vvUn4TmwfnKktItKuI5VDXya5MEDuqN6Rp8/W5HHhF523RvLUFbxOCsnE6NZqLm7EgMB+K0eEQ64+ic2yAzzHUBvwIJZZpiXk5jDMwUEwP+gIvpWYIn7umcb683rpwbojpXQLpT2+BnwgTjHSzVryVAJF X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6198b3e5-5783-4578-1fb9-08d98f143c59 X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB8104.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 13:12:12.5093 (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: edw0A1Als8DIgbElTaT4rd7ZeJdDkLWjMtyjQQJTZ+rie5bB1PPRM4KwSvsVcn5yHQi+JTbhUwJuHf5E2rQCguopg5OOoz/DeBOj1JpSp2E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8187 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 Reviewed-by: Rob Herring --- .../devicetree/bindings/hwmon/ti,tmp421.yaml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml b/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml index 47040ace4f73..36f649938fb7 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,tmp421.yaml @@ -24,12 +24,50 @@ properties: reg: maxItems: 1 + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + required: - compatible - reg additionalProperties: false +patternProperties: + "^channel@([0-3])$": + type: object + description: | + Represents channels of the device and their specific configuration. + + properties: + reg: + description: | + The channel number. 0 is local channel, 1-3 are remote channels + items: + minimum: 0 + maximum: 3 + + label: + description: | + A descriptive name for this channel, like "ambient" or "psu". + + ti,n-factor: + description: | + The value (two's complement) to be programmed in the channel specific N correction register. + For remote channels only. + $ref: /schemas/types.yaml#/definitions/uint32 + items: + minimum: 0 + maximum: 255 + + required: + - reg + + additionalProperties: false + examples: - | i2c { @@ -41,3 +79,32 @@ examples: reg = <0x4c>; }; }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + sensor@4c { + compatible = "ti,tmp422"; + reg = <0x4c>; + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0x0>; + ti,n-factor = <0x1>; + label = "local"; + }; + + channel@1 { + reg = <0x1>; + ti,n-factor = <0x0>; + label = "somelabel"; + }; + + channel@2 { + reg = <0x2>; + status = "disabled"; + }; + }; + };