All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>
To: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-doc@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	 Rob Herring <robh+dt@kernel.org>,
	 Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	 Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andy@kernel.org>
Subject: [PATCH v2 1/2] dt-bindings: hwmon: Add LTC4282 bindings
Date: Fri, 24 Nov 2023 15:18:16 +0100	[thread overview]
Message-ID: <20231124-ltc4282-support-v2-1-952bf926f83c@analog.com> (raw)
In-Reply-To: <20231124-ltc4282-support-v2-0-952bf926f83c@analog.com>

From: Nuno Sa <nuno.sa@analog.com>

Add bindings for the LTC4282 High Current Hot Swap Controller with I2C
Compatible Monitoring.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 .../devicetree/bindings/hwmon/adi,ltc4282.yaml     | 206 +++++++++++++++++++++
 MAINTAINERS                                        |   6 +
 2 files changed, 212 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
new file mode 100644
index 000000000000..6c979f70687e
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
@@ -0,0 +1,206 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/adi,ltc4282.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC4282 I2C High Current Hot Swap Controller over I2C
+
+maintainers:
+  - Nuno Sa <nuno.sa@analog.com>
+
+description: |
+  Analog Devices LTC4282 I2C High Current Hot Swap Controller over I2C.
+
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc4282.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc4282
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+  clocks:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  adi,rsense-nano-ohms:
+    description: Value of the sense resistor.
+
+  adi,vin-mode-microvolt:
+    description:
+      Selects operating range for the Undervoltage, Overvoltage and Foldback
+      pins. Also for the ADC. Should be set to the nominal input voltage.
+    enum: [3300000, 5000000, 12000000, 24000000]
+    default: 12000000
+
+  adi,fet-bad-timeout-ms:
+    description:
+      From the moment a FET bad conditions is present, this property selects the
+      wait time/timeout for a FET-bad fault to be signaled. Setting this to 0,
+      disables FET bad faults to be reported.
+    default: 255
+    maximum: 255
+
+  adi,overvoltage-dividers:
+    description: |
+      Select which dividers to use for VDD Overvoltage detection. Note that
+      when the internal dividers are used the threshold is referenced to VDD.
+      The percentages in the datasheet are misleading since the actual values
+      to look for are in the "Absolute Maximum Ratings" table in the
+      "Comparator Inputs" section. In there there's a line for each of the 5%,
+      10% and 15% settings with the actual min, typical and max tolerances.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [external, vdd_5_percent, vdd_10_percent, vdd_15_percent]
+    default: 0
+
+  adi,undervoltage-dividers:
+    description: |
+      Select which dividers to use for VDD Overvoltage detection. Note that
+      when the internal dividers are used the threshold is referenced to VDD.
+      The percentages in the datasheet are misleading since the actual values
+      to look for are in the "Absolute Maximum Ratings" table in the
+      "Comparator Inputs" section. In there there's a line for each of the 5%,
+      10% and 15% settings with the actual min, typical and max tolerances.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [external, vdd_5_percent, vdd_10_percent, vdd_15_percent]
+    default: 0
+
+  adi,current-limit-sense-microvolt:
+    description:
+      The current limit sense voltage of the chip is adjustable between
+      12.5mV and 34.4mV in 3.1mV steps. This effectively limits the current
+      on the load.
+    enum: [12500, 15625, 18750, 21875, 25000, 28125, 31250, 34375]
+    default: 25000
+
+  adi,overcurrent-retry:
+    description:
+      If set, enables the chip to auto-retry 256 timer cycles after an
+      Overcurrent fault.
+    type: boolean
+
+  adi,overvoltage-retry-disable:
+    description:
+      If set, disables the chip to auto-retry 50ms after an Overvoltage fault.
+      It's enabled by default.
+    type: boolean
+
+  adi,undervoltage-retry-disable:
+    description:
+      If set, disables the chip to auto-retry 50ms after an Undervoltage fault.
+      It's enabled by default.
+    type: boolean
+
+  adi,fault-log-enable:
+    description:
+      If set, enables the FAULT_LOG and ADC_ALERT_LOG registers to be written
+      to the EEPROM when a fault bit transitions high and hence, will be
+      available after a power cycle (the chip loads the contents of
+      the EE_FAULT_LOG register - the one in EEPROM - into FAULT_LOG at boot).
+    type: boolean
+
+  adi,gpio-alert:
+    description: Use the ALERT pin as a GPIO.
+    type: boolean
+
+  adi,gpio1-mode:
+    description: Defines the function of the Pin.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, power_bad, power_good]
+
+  adi,gpio2-mode:
+    description: Defines the function of the Pin.
+          0 - GPIO Mode.
+          1 - Acts as an input pin and it is feeded into the ADC.
+          2 - Pulls Low when the MOSFET is dissipating power (stress).
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, adc_input, stress_fet]
+
+  adi,gpio3-mode:
+    description: Defines the function of the Pin.
+          0 - GPIO Mode.
+          1 - Acts as an input pin and it is feeded into the ADC.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, adc_input]
+
+  gpio-controller:
+    description:
+      This property applies if some of the pins are used as GPIOs.
+
+  '#gpio-cells':
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - adi,rsense-nano-ohms
+
+dependencies:
+  adi,alert-as-gpio: [gpio-controller, '#gpio-cells']
+
+allOf:
+  - if:
+      required:
+        - adi,gpio1-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio1-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio1-mode: [gpio-controller, '#gpio-cells']
+  - if:
+      required:
+        - adi,gpio2-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio2-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio2-mode: [gpio-controller, '#gpio-cells']
+  - if:
+      required:
+        - adi,gpio3-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio3-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio3-mode: [gpio-controller, '#gpio-cells']
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hwmon@50 {
+            compatible = "adi,ltc4282";
+            reg = <0x50>;
+            adi,rsense-nano-ohms = <500>;
+
+            gpio-controller;
+            #gpio-cells = <2>;
+
+            adi,gpio1-mode = "power_good";
+            adi,gpio2-mode = "gpio";
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 97f51d5ec1cf..4a2b84ea1274 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12629,6 +12629,12 @@ S:	Maintained
 F:	Documentation/hwmon/ltc4261.rst
 F:	drivers/hwmon/ltc4261.c
 
+LTC4282 HARDWARE MONITOR DRIVER
+M:	Nuno Sa <nuno.sa@analog.com>
+L:	linux-hwmon@vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
+
 LTC4306 I2C MULTIPLEXER DRIVER
 M:	Michael Hennerich <michael.hennerich@analog.com>
 L:	linux-i2c@vger.kernel.org

-- 
2.41.0


WARNING: multiple messages have this Message-ID (diff)
From: Nuno Sa <nuno.sa@analog.com>
To: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-doc@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	 Rob Herring <robh+dt@kernel.org>,
	 Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	 Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andy@kernel.org>
Subject: [PATCH v2 1/2] dt-bindings: hwmon: Add LTC4282 bindings
Date: Fri, 24 Nov 2023 15:18:16 +0100	[thread overview]
Message-ID: <20231124-ltc4282-support-v2-1-952bf926f83c@analog.com> (raw)
In-Reply-To: <20231124-ltc4282-support-v2-0-952bf926f83c@analog.com>

Add bindings for the LTC4282 High Current Hot Swap Controller with I2C
Compatible Monitoring.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 .../devicetree/bindings/hwmon/adi,ltc4282.yaml     | 206 +++++++++++++++++++++
 MAINTAINERS                                        |   6 +
 2 files changed, 212 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
new file mode 100644
index 000000000000..6c979f70687e
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
@@ -0,0 +1,206 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/adi,ltc4282.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC4282 I2C High Current Hot Swap Controller over I2C
+
+maintainers:
+  - Nuno Sa <nuno.sa@analog.com>
+
+description: |
+  Analog Devices LTC4282 I2C High Current Hot Swap Controller over I2C.
+
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc4282.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc4282
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+  clocks:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  adi,rsense-nano-ohms:
+    description: Value of the sense resistor.
+
+  adi,vin-mode-microvolt:
+    description:
+      Selects operating range for the Undervoltage, Overvoltage and Foldback
+      pins. Also for the ADC. Should be set to the nominal input voltage.
+    enum: [3300000, 5000000, 12000000, 24000000]
+    default: 12000000
+
+  adi,fet-bad-timeout-ms:
+    description:
+      From the moment a FET bad conditions is present, this property selects the
+      wait time/timeout for a FET-bad fault to be signaled. Setting this to 0,
+      disables FET bad faults to be reported.
+    default: 255
+    maximum: 255
+
+  adi,overvoltage-dividers:
+    description: |
+      Select which dividers to use for VDD Overvoltage detection. Note that
+      when the internal dividers are used the threshold is referenced to VDD.
+      The percentages in the datasheet are misleading since the actual values
+      to look for are in the "Absolute Maximum Ratings" table in the
+      "Comparator Inputs" section. In there there's a line for each of the 5%,
+      10% and 15% settings with the actual min, typical and max tolerances.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [external, vdd_5_percent, vdd_10_percent, vdd_15_percent]
+    default: 0
+
+  adi,undervoltage-dividers:
+    description: |
+      Select which dividers to use for VDD Overvoltage detection. Note that
+      when the internal dividers are used the threshold is referenced to VDD.
+      The percentages in the datasheet are misleading since the actual values
+      to look for are in the "Absolute Maximum Ratings" table in the
+      "Comparator Inputs" section. In there there's a line for each of the 5%,
+      10% and 15% settings with the actual min, typical and max tolerances.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [external, vdd_5_percent, vdd_10_percent, vdd_15_percent]
+    default: 0
+
+  adi,current-limit-sense-microvolt:
+    description:
+      The current limit sense voltage of the chip is adjustable between
+      12.5mV and 34.4mV in 3.1mV steps. This effectively limits the current
+      on the load.
+    enum: [12500, 15625, 18750, 21875, 25000, 28125, 31250, 34375]
+    default: 25000
+
+  adi,overcurrent-retry:
+    description:
+      If set, enables the chip to auto-retry 256 timer cycles after an
+      Overcurrent fault.
+    type: boolean
+
+  adi,overvoltage-retry-disable:
+    description:
+      If set, disables the chip to auto-retry 50ms after an Overvoltage fault.
+      It's enabled by default.
+    type: boolean
+
+  adi,undervoltage-retry-disable:
+    description:
+      If set, disables the chip to auto-retry 50ms after an Undervoltage fault.
+      It's enabled by default.
+    type: boolean
+
+  adi,fault-log-enable:
+    description:
+      If set, enables the FAULT_LOG and ADC_ALERT_LOG registers to be written
+      to the EEPROM when a fault bit transitions high and hence, will be
+      available after a power cycle (the chip loads the contents of
+      the EE_FAULT_LOG register - the one in EEPROM - into FAULT_LOG at boot).
+    type: boolean
+
+  adi,gpio-alert:
+    description: Use the ALERT pin as a GPIO.
+    type: boolean
+
+  adi,gpio1-mode:
+    description: Defines the function of the Pin.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, power_bad, power_good]
+
+  adi,gpio2-mode:
+    description: Defines the function of the Pin.
+          0 - GPIO Mode.
+          1 - Acts as an input pin and it is feeded into the ADC.
+          2 - Pulls Low when the MOSFET is dissipating power (stress).
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, adc_input, stress_fet]
+
+  adi,gpio3-mode:
+    description: Defines the function of the Pin.
+          0 - GPIO Mode.
+          1 - Acts as an input pin and it is feeded into the ADC.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [gpio, adc_input]
+
+  gpio-controller:
+    description:
+      This property applies if some of the pins are used as GPIOs.
+
+  '#gpio-cells':
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - adi,rsense-nano-ohms
+
+dependencies:
+  adi,alert-as-gpio: [gpio-controller, '#gpio-cells']
+
+allOf:
+  - if:
+      required:
+        - adi,gpio1-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio1-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio1-mode: [gpio-controller, '#gpio-cells']
+  - if:
+      required:
+        - adi,gpio2-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio2-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio2-mode: [gpio-controller, '#gpio-cells']
+  - if:
+      required:
+        - adi,gpio3-mode
+    then:
+      allOf:
+        - if:
+            properties:
+              adi,gpio3-mode:
+                const: gpio
+          then:
+            dependencies:
+              adi,gpio3-mode: [gpio-controller, '#gpio-cells']
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hwmon@50 {
+            compatible = "adi,ltc4282";
+            reg = <0x50>;
+            adi,rsense-nano-ohms = <500>;
+
+            gpio-controller;
+            #gpio-cells = <2>;
+
+            adi,gpio1-mode = "power_good";
+            adi,gpio2-mode = "gpio";
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 97f51d5ec1cf..4a2b84ea1274 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12629,6 +12629,12 @@ S:	Maintained
 F:	Documentation/hwmon/ltc4261.rst
 F:	drivers/hwmon/ltc4261.c
 
+LTC4282 HARDWARE MONITOR DRIVER
+M:	Nuno Sa <nuno.sa@analog.com>
+L:	linux-hwmon@vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
+
 LTC4306 I2C MULTIPLEXER DRIVER
 M:	Michael Hennerich <michael.hennerich@analog.com>
 L:	linux-i2c@vger.kernel.org

-- 
2.41.0


  reply	other threads:[~2023-11-24 14:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 14:18 [PATCH v2 0/2] Add support for LTC4282 Nuno Sa via B4 Relay
2023-11-24 14:18 ` Nuno Sa
2023-11-24 14:18 ` Nuno Sa via B4 Relay [this message]
2023-11-24 14:18   ` [PATCH v2 1/2] dt-bindings: hwmon: Add LTC4282 bindings Nuno Sa
2023-11-25 11:56   ` Conor Dooley
2023-11-27  7:56     ` Nuno Sá
2023-11-27 17:33       ` Conor Dooley
2023-11-28 15:37   ` Rob Herring
2023-11-28 15:49     ` Nuno Sá
2023-11-24 14:18 ` [PATCH v2 2/2] hwmon: ltc4282: add support for the LTC4282 chip Nuno Sa via B4 Relay
2023-11-24 14:18   ` Nuno Sa
2023-11-24 21:54   ` kernel test robot
2023-11-24 23:39   ` kernel test robot
2023-11-27  7:53     ` Nuno Sá
2023-11-27  8:10       ` Krzysztof Kozlowski
2023-11-27  8:12         ` Krzysztof Kozlowski
2023-11-27  8:44           ` Nuno Sá
2023-11-27 16:03           ` Andy Shevchenko
2023-11-28 16:50             ` Krzysztof Kozlowski
2023-11-28 17:01               ` Andy Shevchenko
2023-11-28 18:03               ` Guenter Roeck
2023-11-29  8:35                 ` Nuno Sá
2023-11-29  8:45                   ` Krzysztof Kozlowski
2023-11-29  8:56                     ` Nuno Sá
2023-11-29 14:10                     ` Linus Walleij
2023-11-29 14:13                       ` Krzysztof Kozlowski
2023-11-29 14:29                       ` Nuno Sá
2023-11-29 14:47                   ` Guenter Roeck
2023-11-29 16:09                     ` Nuno Sá
2023-11-27 10:20   ` kernel test robot
2023-11-29 14:49   ` Linus Walleij
2023-11-29 16:08     ` Nuno Sá
2023-11-29 16:18       ` Andy Shevchenko
2023-11-29 16:21         ` Nuno Sá
2023-11-29 17:07           ` Andy Shevchenko
2023-11-29 20:55       ` Linus Walleij
2023-11-30 10:20         ` Nuno Sá
2023-11-30 13:36           ` Andy Shevchenko
2023-11-30 14:39             ` Guenter Roeck
2023-11-30 15:20             ` Nuno Sá
2023-11-30 16:28               ` Guenter Roeck
2023-11-30 20:15               ` Linus Walleij
2023-12-01 12:34                 ` Nuno Sá
2023-12-01 13:40                   ` Linus Walleij
2023-12-01 15:24                     ` Nuno Sá
2023-12-01 15:47                       ` Andy Shevchenko
2023-12-01 16:04                         ` Guenter Roeck
2023-12-01 16:24                           ` Andy Shevchenko
2023-12-01 16:36                             ` Guenter Roeck
2023-12-01 16:29                           ` Nuno Sá
2023-12-01 16:46                             ` Guenter Roeck
2023-12-02  9:42                               ` Nuno Sá
2023-12-03 23:08                                 ` Linus Walleij
2023-12-04  8:20                                   ` Bartosz Golaszewski
2023-12-01 16:19                         ` Nuno Sá
2023-12-01 16:23                           ` Andy Shevchenko
2023-12-03 23:03                       ` Linus Walleij
2023-12-04  8:53                         ` Nuno Sá
2023-12-14 16:40   ` kernel test robot

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=20231124-ltc4282-support-v2-1-952bf926f83c@analog.com \
    --to=devnull+nuno.sa.analog.com@kernel.org \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nuno.sa@analog.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.