Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp279305pxb; Sat, 9 Oct 2021 20:33:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtvOV2OsPVWPFUef4tkHDyns5daRIBKTrf3suBdUGFAiJHAEJ4oRuf+bSXIVvukhlOGdnv X-Received: by 2002:a17:907:118d:: with SMTP id uz13mr16486240ejb.382.1633836789384; Sat, 09 Oct 2021 20:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633836789; cv=none; d=google.com; s=arc-20160816; b=Qilr2K9k+HppGtmPZSI6dEAqkZAidcVLXrRXYT1YIYF+YHgoSkiDcopMQbusySghXx 4CNiCOj2fatEyXlpIyXM6BGi1D8g/F4SoL0OwkI3JvMBzjtZYZ/lYXhwTDGmT7iNW8zR krhA0mmPfsSEJWPX8nh4S4SxHL4FRGTSmoZyFhCMVVhf/oqfje74VFxyOS9eVwdAIfYq 1kUjTFeAUCPd7Q7OTa3U1U8acEUQymilkORaYXBuhG1coQ8CoZRwUM/cJ7S5boQjDQEO 2YQ2ui/wHllhPUy98/068bYSluPa8VUTiyXmNt08K9/KU9x/yZxVCUZisznmL6cVmMdk mZtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=g7EJveLFxokNEPlL/tBARdXLFCbt2zr2sbuE+aH5gDg=; b=buPkzPCnd3d/OfIUmPHFYtpEnE7VFt1ayrpbqVoP8YIxUGWtLoKYaHZ+oAS1nA+QrB fv8nOBW7tRfdXHI0AlmBRuh9ZpbhYT2YMh4TU1+FyhVHxKoRl7PSh6hC6mMt4mFZB8Ui N20GJobWqKPkxWS6yGhvae2gMs5xQEUgFi+p4/abwVyM0smAyBoi8vMGakuAwTbnSAzw ZiIKei8gjH/RTyTTtuZtzqXjsveJjqarQ7SwqoiDov3bmnvdyaCO9GwF/+PfYDWilxKQ f8Vrd3n79S08iyLYFLjhv9K7Ovehdmo+eI0Xx0vCmEhnhJsjvVaCHBmCg40cuWK+KYzX Oi/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KvmF4L7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de1si5243040edb.375.2021.10.09.20.32.45; Sat, 09 Oct 2021 20:33:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KvmF4L7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbhJJDdU (ORCPT + 99 others); Sat, 9 Oct 2021 23:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbhJJDdQ (ORCPT ); Sat, 9 Oct 2021 23:33:16 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BE65C061764 for ; Sat, 9 Oct 2021 20:31:18 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id c65-20020a251c44000000b005ba81fe4944so8226856ybc.14 for ; Sat, 09 Oct 2021 20:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=g7EJveLFxokNEPlL/tBARdXLFCbt2zr2sbuE+aH5gDg=; b=KvmF4L7GCUkYpLZnh/RhRG8DOvChmVQLOZS3IRfJqUg2JS7re7EKuMcJUtSZvo2Ke9 DyZ1/eDFu1lbQG7j3JimTxNQbDpf83AdUlxOKq2E2H40NZVfnhHgj7EbnQ3/TvDBIwiq /Nzv841D1Zwl7uRs4KXke+l2kwUjcd5XK3dqYg+C808QhtLeDxunFo4yzDF3H80Et9lN LSkO+762F8e7UIzwrmGgjjlfEksmPBpDrpOHWDd4HInGbADJymkutMU75dGa7DFYVCY5 u8VbdEWnOUe6CPKXujrLzEQ5QidtJRAjumcmX6RdIdemT11A+MgDRsuaBFrnlXhf6iae rjdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=g7EJveLFxokNEPlL/tBARdXLFCbt2zr2sbuE+aH5gDg=; b=V3abbvpENFgPptyl9lbDQTmPcSQndCAbn0bzIf70sIwyOrHjgNYDHtlux2I23Wmzn1 enA6msjLhz5hPDOe0UOUjrRg3CJR6PFzi81Z4LVuSfXj6588VGSXgIsxnFp4DmLdRLmO 05ucdagiIHEcHxBX7zhlJHEjSXkLD04zELu9hfId8v0PoySD7LWMPvXDbuSLGZwayhBh EdDhRXjgOWmo8esJLOLZmlr3E91Q2iOJoKNdm3OuESDi1hTY0WgrEcM3BC1yaozgBv6n xe85vd/q00Tr/M82Yu1qvl4ZktP6cXjVFlccE4jlm2D/kn0kPmRpZ+kR9dyvmAjv57X0 rkxg== X-Gm-Message-State: AOAM530ko8pf+0OjDmjrV5EyhZOv/LjqU4qCSpwRvoej3cK2r3YD/l+x weRU6QoFOqDLUsmUK3bBYalUWh8= X-Received: from osk.cam.corp.google.com ([2620:0:1004:1a:cf37:dd81:3340:f4a7]) (user=osk job=sendgmr) by 2002:a25:2286:: with SMTP id i128mr12286454ybi.76.1633836677363; Sat, 09 Oct 2021 20:31:17 -0700 (PDT) Date: Sat, 9 Oct 2021 23:31:11 -0400 Message-Id: <20211010033112.3621816-1-osk@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.882.g93a45727a2-goog Subject: [PATCH v6 1/2] dt-bindings: hwmon: Add nct7802 bindings From: Oskar Senft To: Jean Delvare , Guenter Roeck , Rob Herring , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Oskar Senft Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change documents the device tree bindings for the Nuvoton NCT7802Y driver. Signed-off-by: Oskar Senft --- Changes from PATCH v5: - Refactored to use patternProperties. - Added validation for sensor-type and temperature-mode. --- .../bindings/hwmon/nuvoton,nct7802.yaml | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/nuvoton,nct7802.yaml diff --git a/Documentation/devicetree/bindings/hwmon/nuvoton,nct7802.yaml b/Documentation/devicetree/bindings/hwmon/nuvoton,nct7802.yaml new file mode 100644 index 000000000000..73fffd661f0a --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/nuvoton,nct7802.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/nuvoton,nct7802.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton NCT7802Y Hardware Monitoring IC + +maintainers: + - Guenter Roeck + +description: | + The NCT7802Y is a hardware monitor IC which supports one on-die and up to + 5 remote temperature sensors with SMBus interface. + + Datasheets: + https://www.nuvoton.com/export/resource-files/Nuvoton_NCT7802Y_Datasheet_V12.pdf + +properties: + compatible: + enum: + - nuvoton,nct7802 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^channel@[0-3]$": + type: object + properties: + reg: + items: + - enum: + - 0 # Local Temperature Sensor ("LTD") + - 1 # Remote Temperature Sensor or Voltage Sensor 1 ("RTD1") + - 2 # Remote Temperature Sensor or Voltage Sensor 2 ("RTD2") + - 3 # Remote Temperature Sensor or Voltage Sensor 3 ("RTD3") + sensor-type: + items: + - enum: + - temperature + - voltage + temperature-mode: + items: + - enum: + - thermistor + - thermal-diode + required: + - reg + allOf: + # For channels RTD1, RTD2 and RTD3, require sensor-type to be set. + # Otherwise (for all other channels), do not allow temperature-mode to be + # set. + - if: + properties: + reg: + items: + - enum: + - 1 + - 2 + - 3 + then: + required: + - sensor-type + else: + not: + required: + - sensor-type + + # For channels RTD1 and RTD2 and if sensor-type is "temperature", require + # temperature-mode to be set. Otherwise (for all other channels or + # sensor-type settings), do not allow temperature-mode to be set + - if: + properties: + reg: + items: + - enum: + - 1 + - 2 + sensor-type: + items: + - enum: + - temperature + then: + required: + - temperature-mode + else: + not: + required: + - temperature-mode + + additionalProperties: false + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + nct7802@28 { + compatible = "nuvoton,nct7802"; + reg = <0x28>; + + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { /* LTD */ + reg = <0>; + status = "okay"; + }; + + channel@1 { /* RTD1 */ + reg = <1>; + status = "okay"; + sensor-type = "voltage"; + }; + + channel@2 { /* RTD2 */ + reg = <2>; + status = "okay"; + sensor-type = "temperature"; + temperature-mode = "thermal-diode"; + }; + + channel@3 { /* RTD3 */ + reg = <3>; + status = "okay"; + sensor-type = "temperature"; + }; + }; + }; -- 2.33.0.882.g93a45727a2-goog