mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chegbeli <ciprian.hegbeli@analog.com>
To: <jic23@kernel.org>, <robh+dt@kernel.org>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: chegbeli <ciprian.hegbeli@analog.com>
Subject: [PATCH 2/3] dt-bindings: iio: add ADE9078
Date: Thu, 17 Feb 2022 15:51:39 +0200	[thread overview]
Message-ID: <20220217135140.5658-3-ciprian.hegbeli@analog.com> (raw)
In-Reply-To: <20220217135140.5658-1-ciprian.hegbeli@analog.com>

Added device tree bindings for the ADE9078

Signed-off-by: chegbeli <ciprian.hegbeli@analog.com>
---
 .../bindings/iio/meter/adi,ade9078.yaml       | 153 ++++++++++++++++++
 include/dt-bindings/iio/meter/adi,ade9078.h   |  21 +++
 2 files changed, 174 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/meter/adi,ade9078.yaml
 create mode 100644 include/dt-bindings/iio/meter/adi,ade9078.h

diff --git a/Documentation/devicetree/bindings/iio/meter/adi,ade9078.yaml b/Documentation/devicetree/bindings/iio/meter/adi,ade9078.yaml
new file mode 100644
index 000000000000..e27d52e06e32
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/meter/adi,ade9078.yaml
@@ -0,0 +1,153 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2021 Analog Devices Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/iio/addac/adi,ade9078.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADE9078 High Performance, Polyphase Energy Metering driver
+
+mainterners:
+  -Ciprian Hegbeli <ciprian.hegbeli@analog.com>
+
+description: |
+  The ADE9078 1 is a highly accurate, fully integrated energy
+  metering device. Interfacing with both current transformer
+  (CT) and Rogowski coil sensors, the ADE9078 enables users to
+  develop a 3-phase metrology platform, which achieves high
+  performance for Class 1 up to Class 0.2 meters.
+
+properties:
+  compatible:
+    enum:
+      - adi,ade9078
+
+    reg:
+      maxItems: 1
+
+    '#address-cells':
+      const: 1
+
+    '#size-cells':
+      const: 0
+
+    spi-max-frequency:
+      maximum: 1000000
+
+    interrupts:
+      maxItems: 2
+
+    reset-gpios:
+      description: |
+        Must be the device tree identifier of the RESET pin. As the line is
+        active low, it should be marked GPIO_ACTIVE_LOW.
+      maxItems: 1
+
+    interrupt-names:
+      description: |
+        Names to be attributed to the interrupts of the device. Should be "irq0"
+        or "irq1"
+
+    adi,wf-cap-sel:
+      description: |
+        This bit selects whether the waveform buffer is filled with resampled
+        data or fixed data rate data
+        0 - WF_RESAMPLED_DATA
+        1 - WF_FIXED_DATA_RATE
+      maxItems: 1
+      minimum: 0
+      maximum: 1
+
+    adi,wf-mode:
+      description: |
+        Fixed data rate waveforms filling and trigger based modes.
+        0 - WFB_FULL_MODE (Stop when waveform buffer is full)
+        1 - WFB_EN_TRIG_MODE (Continuous fill—stop only on enabled trigger events)
+        2 - WFB_CENTER_EN_TRIG_MODE (Continuous filling—center capture around enabled trigger events)
+        3 - WFB_SVAE_EN_TRIG_MODE (Continuous fill—save event address of enabled trigger events)
+      maxItems: 1
+      minimum: 0
+      maximum: 3
+
+    adi,wf-src:
+      description: |
+        Waveform buffer source and DREADY, data ready update rate, selection.
+        0 - WFB_SRC_SINC4 (Sinc4 output, at 16 kSPS)
+        1 - Reserved
+        2 - WFB_SRC_SINC4_IIR_LPF (Sinc4 + IIR LPF output, at 4 kSPS)
+        3 - WFB_SRC_DSP (Current and voltage channel waveform samples,processed by the DSP
+            (xI_PCF, xV_PCF) at 4 kSPS)
+      maxItems: 1
+      minimum: 0
+      maximum: 3
+
+    adi,wf-in-en:
+      description: |
+        This setting determines whether the IN waveform samples are read out of
+        the waveform buffer through SPI.
+        0 - WFB_IN_DISABLE
+        1 - WFB_IN_EN
+      maxItems: 1
+      minimum: 0
+      maximum: 1
+
+  required:
+    - compatible
+    - reg
+    - reset-gpios
+    - interrupts
+    - interrupt-names
+    - adi,wf-cap-sel
+    - adi,wf-mode
+    - adi,wf-src
+    - adi,wf-in-en
+
+patternProperties:
+  "^phase@[0-3]$":
+    type: object
+    description: |
+      Represents the external phases which are externally connected. Each phase
+      has a current, voltage and power component
+
+    properties:
+      reg:
+        description: |
+          The phase represented by a number
+          0 - Phase A
+          1 - unused
+          2 - Phase B
+          3 - unused
+          4 - Phase C
+        maxItems: 1
+        minimum: 0
+        maximum: 4
+
+    required:
+      - reg
+
+examples:
+  - |
+    ade9078@0 {
+	compatible = "adi,ade9078";
+	reg = <0>;
+	spi-max-frequency = <7000000>;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reset-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+	interrupts = <2 IRQ_TYPE_EDGE_FALLING>, <3 IRQ_TYPE_EDGE_FALLING>;
+	interrupt-names = "irq0", "irq1";
+	interrupt-parent = <&gpio>;
+
+	adi,wf-cap-sel = <WF_FIXED_DATA_RATE>;
+	adi,wf-mode = <WFB_FULL_MODE>;
+	adi,wf-src = <WFB_SRC_DSP>;
+	adi,wf-in-en = <WFB_IN_DISABLE>;
+
+	phase@0 {
+	    reg = <0>;
+	};
+	phase@1 {
+	    reg = <4>;
+	};
+    };
diff --git a/include/dt-bindings/iio/meter/adi,ade9078.h b/include/dt-bindings/iio/meter/adi,ade9078.h
new file mode 100644
index 000000000000..85004251a36b
--- /dev/null
+++ b/include/dt-bindings/iio/meter/adi,ade9078.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _DT_BINDINGS_ADI_ADE9078_H
+#define _DT_BINDINGS_ADI_ADE9078_H
+
+#define WF_RESAMPLED_DATA	0x0
+#define WF_FIXED_DATA_RATE	0x1
+
+#define WFB_FULL_MODE		0x0
+#define WFB_EN_TRIG_MODE	0x1
+#define WFB_CENTER_EN_TRIG_MODE	0x2
+#define WFB_SVAE_EN_TRIG_MODE	0x3
+
+#define WFB_SRC_SINC4		0x0
+#define WFB_SRC_SINC4_IIR_LPF	0x2
+#define WFB_SRC_DSP		0x3
+
+#define WFB_IN_DISABLE		0x0
+#define WFB_IN_EN		0x1
+
+#endif /* _DT_BINDINGS_ADI_ADE9078_H */
-- 
2.34.1


  parent reply	other threads:[~2022-02-17 13:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 13:51 [PATCH 0/3] Add ADE9078 Driver chegbeli
2022-02-17 13:51 ` [PATCH 1/3] iio: add meter subdirectory chegbeli
2022-02-17 15:33   ` Krzysztof Kozlowski
2022-02-17 18:34   ` Jonathan Cameron
2022-02-17 13:51 ` chegbeli [this message]
2022-02-17 15:44   ` [PATCH 2/3] dt-bindings: iio: add ADE9078 Krzysztof Kozlowski
2022-02-21  2:36   ` Rob Herring
2022-02-17 13:51 ` [PATCH 3/3] iio: meter: add ADE9078 driver chegbeli
2022-02-17 18:33   ` Jonathan Cameron
2022-04-07 12:56     ` Hegbeli, Ciprian
2022-04-10 15:42       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217135140.5658-3-ciprian.hegbeli@analog.com \
    --to=ciprian.hegbeli@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®