Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp194822pxb; Fri, 29 Oct 2021 08:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNCCgSPyHxupgX8+IYqDw3j2avGPWkwLk+rLH03OwGonfx0botol/uQ9vb0R9TnPaNjS6M X-Received: by 2002:a02:950e:: with SMTP id y14mr7775196jah.88.1635520299280; Fri, 29 Oct 2021 08:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635520299; cv=none; d=google.com; s=arc-20160816; b=M/FJg/VBFYWN3F75MYuYk40BANh8VJSc0DdjGtJcd3qPXwjucQA2zcDdh9orBxucXr 9b5239x4g8e/k2pGth0MMrA66wPnFiqcUcaqMAgygt98tPb7Q/0sfiZR3BjEr5kY3e0D 5CqJamz2dx3MDG2pM4yCNmMs5/k4MR0rlAAnHg7LKBLpbX4cOCmSCSOeYmCC6ku/Gnld 7O15ctliSW5rcVmvdGglAH4w00svBXRPoqRa3ab2h1U9uONbwsNyJxsom4ZuT55eaNeK 1fQrZ839/+epNaEth1VzoRFQ00TNQMxzYsQ4Nx5G0a4lCW+3mtRl4i0rpinJ8an6hMtR ivTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=65re5EzQGAdkPLN7hMXkAQ3icqHMSFGYa86wA7lZ4I4=; b=MCni7GgQzDps7alMYr6quLyxHEbHtZFfFH18/56ImTb/WqeoLdV/B7t4vb9lQAvGB7 fmN9Roa/o2YspQRexhvHos6oq5mvpU05gHIzZNHRYZnB5aEJ1tRR3AkG8+u/ds/b5gx6 wTIPJvwyeXWrMVZkZv2MnwEAl3EZMbdwVO6R0gZ7XXELNZwxEYfvXXihEfHmB+H+3Vkt zJOIs9FUE2G8ujlyKcycwP5dkVbSXRKousFTqR0Yhekqdbe51lDcI8FA7PhK20B5Tm3j 0yXZLspWqOTs2EcDTblFClCYQHoFtokn2iIGM5ziyzL1Hwoz7VzcqHzGAZjF9O6jxYjh u/8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=CurLuYaI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si10120123iow.34.2021.10.29.08.11.26; Fri, 29 Oct 2021 08:11:39 -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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=CurLuYaI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbhJ2PMQ (ORCPT + 99 others); Fri, 29 Oct 2021 11:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbhJ2PMP (ORCPT ); Fri, 29 Oct 2021 11:12:15 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 446CDC061766 for ; Fri, 29 Oct 2021 08:09:46 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id k7so16534357wrd.13 for ; Fri, 29 Oct 2021 08:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=65re5EzQGAdkPLN7hMXkAQ3icqHMSFGYa86wA7lZ4I4=; b=CurLuYaIzEDUCOQi6MO3LpgAu+Rq7qgusjDId7KoyBNvGUd0F8Imz4KY4UCI+Ei1Ab u6HJaz5XGEEFZVdEARrs+enVicemGaqtMqiOeqt0z4kUz9j9z5bRGxkgc2elTwgwTabh XND9fPrjF07QQn7me+SNUqE1o81A/6d25wOTBuZoAA+/X1nxxwhUUGiKtcATGtnTx0ZX UUIYTKphbBEcXdRLOF5i+exLJ3jGCoO+tfogT8fjWvVSAPbiM0PL7DCvKVdnIM224Maq 42Fl5HyJnF0ceyewZR6LFQWMcgk9h8KSYTAp+LO9P0dcL2cLswttpUrHv5U6TZtwozkM UEDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=65re5EzQGAdkPLN7hMXkAQ3icqHMSFGYa86wA7lZ4I4=; b=5Xduuspw8ZPrqTFo3Mxz08GEKlhhoQg2iZ7JA4Roh1bfRFvbBDqiqVy4/GZw0L4dfO sBX4Gu2os07An8rHiOlqCcIlYdqtBc/U+L1J3mvK2CbJ5kRI9pR2l9nhBQAwBQeqj5wi 98rzbidnGJXNaHZNwU/Kp3QiIkD6mvIpNgXLtZIr00Kppa2f1eC0iNE3W4NZ0UT2mRSQ Vmi3kYCMjV448DMLObzwcZvmvTi2KvTZ/yHMCYOyeWITM7qzAPGPMLJoh31/nE5DiLRc gq7bXh1wa7/gu9XFRUGtyWpmj22fvmZ8ba6bc1hTF+03++Zto9uCFkwhrpS56Q9dBz/U rZNA== X-Gm-Message-State: AOAM530GPqMRMhaUTMDSQ0S9QOCE8rT3j2Isc7iot37pXBExDx/2w61G v2cNaGMUhZkqSye0RkI/ckDcKHW9C6Wc50m+ X-Received: by 2002:a5d:400e:: with SMTP id n14mr2205973wrp.368.1635520184729; Fri, 29 Oct 2021 08:09:44 -0700 (PDT) Received: from xps-9300.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id b7sm7091906wrv.72.2021.10.29.08.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 08:09:44 -0700 (PDT) From: Alexandre Bailon To: rafael@kernel.org, rui.zhang@intel.com, daniel.lezcano@linaro.org, amitk@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ben.tseng@mediatek.com, khilman@baylibre.com, mka@chromium.org, Alexandre Bailon Subject: [PATCH v3 1/2] dt-bindings: Add DT bindings for the DT-based virtual sensor driver Date: Fri, 29 Oct 2021 17:08:56 +0200 Message-Id: <20211029150857.504891-2-abailon@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211029150857.504891-1-abailon@baylibre.com> References: <20211029150857.504891-1-abailon@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the DT bindings for the DT-based virtual sensor driver. This driver provides a way, using DT, to aggregate the temperature of multiple thermal zones and get some useful data from it. Signed-off-by: Alexandre Bailon --- .../thermal/virtual,thermal-sensor.yaml | 86 +++++++++++++++++++ include/dt-bindings/thermal/virtual-sensor.h | 15 ++++ 2 files changed, 101 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/virtual,thermal-sensor.yaml create mode 100644 include/dt-bindings/thermal/virtual-sensor.h diff --git a/Documentation/devicetree/bindings/thermal/virtual,thermal-sensor.yaml b/Documentation/devicetree/bindings/thermal/virtual,thermal-sensor.yaml new file mode 100644 index 000000000000..b404fd4b2b38 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/virtual,thermal-sensor.yaml @@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021 BayLibre +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/virtual,thermal-sensor.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtual thermal sensor binding + +maintainers: + - Alexandre Bailon + +description: | + The virtual thermal sensor device provides a way to aggregate the temperature + from multiple thermal zones. Basically, this could be used to get the + maximum, minimum or average temperature. + +allOf: + - $ref: thermal-sensor.yaml# + +properties: + compatible: + const: virtual,thermal-sensor + + aggregation-function: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Used to select the operations to perform on the sensors to get the virtual + sensor temperature. + enum: + - VIRTUAL_THERMAL_SENSOR_MIN_VAL + - VIRTUAL_THERMAL_SENSOR_MAX_VAL + - VIRTUAL_THERMAL_SENSOR_AVG_VAL + + thermal-sensors: + $ref: /schemas/types.yaml#/definitions/string-array + description: + The names of the thermal zone to aggregate. + +required: + - aggregation-function + - thermal-sensors + +additionalProperties: true + +examples: + - | + #include + #include + #include + #include + + lvts: lvts@1100b000 { + compatible = "mediatek,mt6873-lvts"; + reg = <0x1100b000 0x1000>; + clocks = <&infracfg CLK_INFRA_THERM>; + clock-names = "lvts_clk"; + #thermal-sensor-cells = <1>; + interrupts = ; + }; + + cpu_max_sensor: cpu_max_sensor { + compatible = "virtual,thermal-sensor"; + #thermal-sensor-cells = <1>; + aggregation-function = ; + thermal-sensors = "cpu1", "cpu2"; + }; + + thermal_zones: thermal-zones { + cpu1 { + polling-delay = <0>; /* milliseconds */ + polling-delay-passive = <0>; /* milliseconds */ + thermal-sensors = <&lvts 0>; + }; + cpu2 { + polling-delay = <0>; /* milliseconds */ + polling-delay-passive = <0>; /* milliseconds */ + thermal-sensors = <&lvts 1>; + }; + cpu_max { + polling-delay = <0>; /* milliseconds */ + polling-delay-passive = <0>; /* milliseconds */ + thermal-sensors = <&cpu_max_sensor 0>; + }; + }; +... diff --git a/include/dt-bindings/thermal/virtual-sensor.h b/include/dt-bindings/thermal/virtual-sensor.h new file mode 100644 index 000000000000..6254b2aa8f5c --- /dev/null +++ b/include/dt-bindings/thermal/virtual-sensor.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * This header provides constants for virtual thermal sensor bindings. + * + * Copyright (C) 2021 BayLibre + */ + +#ifndef _DT_BINDINGS_THERMAL_VIRTUAL_SENSOR_H +#define _DT_BINDINGS_THERMAL_VIRTUAL_SENSOR_H + +#define VIRTUAL_THERMAL_SENSOR_MIN_VAL 0 +#define VIRTUAL_THERMAL_SENSOR_MAX_VAL 1 +#define VIRTUAL_THERMAL_SENSOR_AVG_VAL 2 + +#endif /* _DT_BINDINGS_THERMAL_VIRTUAL_SENSOR_H */ -- 2.32.0