From patchwork Fri Nov 5 14:35:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Tanislav X-Patchwork-Id: 1551417 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=J3pNpFWt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4Hm33v1sP0z9s0r for ; Sat, 6 Nov 2021 01:36:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233300AbhKEOjV (ORCPT ); Fri, 5 Nov 2021 10:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233265AbhKEOjQ (ORCPT ); Fri, 5 Nov 2021 10:39:16 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 417AAC061208; Fri, 5 Nov 2021 07:36:36 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id y84-20020a1c7d57000000b00330cb84834fso9706284wmc.2; Fri, 05 Nov 2021 07:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwp18HYRNQm3V+K7xa64jnXRpM28p05LHw/YArESkSg=; b=J3pNpFWtTXs5QZA8aoclE5F+ogQIGvWe8wmHBlF/WljAhiuVKKzInw8arxkn2XnhtA Wxmq3Os4z9eDNEj+VzcmfNvZ02uDR2hW5GTtrth1ConuBB/OEb+7Xj4VNimE2y7pEG+z ksfe+yXPHSDKrMDd08NmMfLovYEtg0JhYVGHn4AkydA7M34sAI7uezQR5q+uxsVLakG1 DqFRY3WL7NeZ+0HHoMAvSy0HJaQ0CmeTtB+Gj+YX4wB2+PEUDKw8bF9l2M9i8w1z/xnT 8GYbBzrwaQrxH2q6eeK+OQMUPbd66GICWkC+fp7rdQQg9eOB9CC5G/V4/kHD2aEGs70X t5XQ== 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=lwp18HYRNQm3V+K7xa64jnXRpM28p05LHw/YArESkSg=; b=od9nFyH3es0RWabUFjO/gdjTLnoE95Moi3mg8o/MOZlk9t4vQpcgBB7uaMc6wcU8gz XezouplL/TR5WUsffs9+VDjbVI/dNJJIJuAlSchH/ZAOkMUSK3HdsmmXohfSzw9T3WRH TBFjJlp12WRMYbZf1vnc4C3URCsc7dqk5QVCKIMerldhexUmxn1awwAONH+yXTEYok7A HRWIqBV6hPisV/MUuD/j9FSFGMghBlcfjz55hrksJBFp8bwYHt/0fCN5W1dBc1vWdBSd R2G+nSiV1QqYp6p7dA+qOfkZZmQpMv7wqpOViv6z6FVJ4OwgSSzuowka4yogU6JEhWm1 uoLw== X-Gm-Message-State: AOAM530HZV+ara8R1l0UWKhYEPsIMcxqpMym1FqTwcwQoxdHp/rtsjy2 JaudRk8/lENegKhDn8oMAmS0eYFti/7Law== X-Google-Smtp-Source: ABdhPJw8PJZjl/hly7ND0UVzcOI9VcZYYItilLcCAZkC8SmFYjD/ONKXP7/tbXGWnea8nY4dswL56w== X-Received: by 2002:a7b:c359:: with SMTP id l25mr30713679wmj.84.1636122994849; Fri, 05 Nov 2021 07:36:34 -0700 (PDT) Received: from demon-pc.localdomain ([188.24.96.74]) by smtp.gmail.com with ESMTPSA id z5sm15140839wmp.26.2021.11.05.07.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 07:36:34 -0700 (PDT) From: Cosmin Tanislav Cc: demonsingur@gmail.com, cosmin.tanislav@analog.com, Lars-Peter Clausen , Michael Hennerich , Rob Herring , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Subject: [PATCH v3 2/3] dt-bindings: iio: add AD74413R Date: Fri, 5 Nov 2021 16:35:49 +0200 Message-Id: <20211105143550.1783528-3-demonsingur@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211105143550.1783528-1-demonsingur@gmail.com> References: <20211105143550.1783528-1-demonsingur@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add device tree bindings for AD74413R. Signed-off-by: Cosmin Tanislav --- .../bindings/iio/addac/adi,ad74413r.yaml | 153 ++++++++++++++++++ include/dt-bindings/iio/addac/adi,ad74413r.h | 21 +++ 2 files changed, 174 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml create mode 100644 include/dt-bindings/iio/addac/adi,ad74413r.h diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml new file mode 100644 index 000000000000..a1add5a2bce2 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml @@ -0,0 +1,153 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/addac/adi,ad74413r.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD74413R/AD74412R device + +maintainers: + - Cosmin Tanislav + +description: | + The AD74413R and AD74412R are quad-channel software configurable input/output + solutions for building and process control applications. They contain + functionality for analog output, analog input, digital input, resistance + temperature detector, and thermocouple measurements integrated + into a single chip solution with an SPI interface. + The devices feature a 16-bit ADC and four configurable 13-bit DACs to provide + four configurable input/output channels and a suite of diagnostic functions. + +properties: + compatible: + enum: + - adi,ad74412r + - adi,ad74413r + + reg: + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + spi-max-frequency: + maximum: 1000000 + + spi-cpol: true + + interrupts: + maxItems: 1 + + refin-supply: true + + adi,rsense-resistance-ohms: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + RSense resistance values in Ohms. + +required: + - compatible + - reg + - spi-max-frequency + - spi-cpol + - refin-supply + - adi,rsense-resistance-ohm + +additionalProperties: false + +patternProperties: + "^channel@[0-3]$": + type: object + description: Represents the external channels which are connected to the device. + + properties: + reg: + description: | + The channel number. It can have up to 4 channels numbered from 0 to 3. + minimum: 0 + maximum: 3 + + adi,ch-func: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Channel function. + HART functions are not supported on AD74412R. + 0 - CH_FUNC_HIGH_IMPEDANCE + 1 - CH_FUNC_VOLTAGE_OUTPUT + 2 - CH_FUNC_CURRENT_OUTPUT + 3 - CH_FUNC_VOLTAGE_INPUT + 4 - CH_FUNC_CURRENT_INPUT_EXT_POWER + 5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER + 6 - CH_FUNC_RESISTANCE_INPUT + 7 - CH_FUNC_DIGITAL_INPUT_LOGIC + 8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER + 9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART + 10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART + minimum: 0 + maximum: 10 + default: 0 + + adi,gpo-comparator: + type: boolean + description: | + Whether to configure GPO as a comparator or not. + When not configured as a comparator, the GPO will be treated as an + output-only GPIO. + + required: + - reg + +examples: + - | + spi0 { + #address-cells = <1>; + #size-cells = <0>; + + cs-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + status = "okay"; + + ad74413r@0 { + compatible = "adi,ad74413r"; + reg = <0>; + spi-max-frequency = <1000000>; + spi-cpol; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&gpio>; + interrupts = <26 0>; + + refin-supply = <&ad74413r_refin>; + adi,rsense-resistance-ohm = <100>; + + channel@0 { + reg = <0>; + + adi,ch-func = ; + }; + + channel@1 { + reg = <1>; + + adi,ch-func = ; + }; + + channel@2 { + reg = <2>; + + adi,ch-func = ; + adi,gpo-comparator; + }; + + channel@3 { + reg = <3>; + + adi,ch-func = ; + }; + }; + }; +... diff --git a/include/dt-bindings/iio/addac/adi,ad74413r.h b/include/dt-bindings/iio/addac/adi,ad74413r.h new file mode 100644 index 000000000000..a43b010f974f --- /dev/null +++ b/include/dt-bindings/iio/addac/adi,ad74413r.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _DT_BINDINGS_ADI_AD74413R_H +#define _DT_BINDINGS_ADI_AD74413R_H + +#define CH_FUNC_HIGH_IMPEDANCE 0x0 +#define CH_FUNC_VOLTAGE_OUTPUT 0x1 +#define CH_FUNC_CURRENT_OUTPUT 0x2 +#define CH_FUNC_VOLTAGE_INPUT 0x3 +#define CH_FUNC_CURRENT_INPUT_EXT_POWER 0x4 +#define CH_FUNC_CURRENT_INPUT_LOOP_POWER 0x5 +#define CH_FUNC_RESISTANCE_INPUT 0x6 +#define CH_FUNC_DIGITAL_INPUT_LOGIC 0x7 +#define CH_FUNC_DIGITAL_INPUT_LOOP_POWER 0x8 +#define CH_FUNC_CURRENT_INPUT_EXT_POWER_HART 0x9 +#define CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART 0xA + +#define CH_FUNC_MIN CH_FUNC_HIGH_IMPEDANCE +#define CH_FUNC_MAX CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART + +#endif /* _DT_BINDINGS_ADI_AD74413R_H */