linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert
@ 2020-02-17 23:46 Chris Packham
  2020-02-17 23:46 ` [PATCH 1/5] dt-bindings: hwmon: Document adt7475 binding Chris Packham
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

I've picked up Logan's changes[1] and am combining them with an old series of
mine[2] to hopefully get them both over the line.

This series updates the binding documentation for the adt7475 and adds two new
sets of properties.

[1] - https://lore.kernel.org/linux-hwmon/20191219033213.30364-1-logan.shaw@alliedtelesis.co.nz/
[2] - https://lore.kernel.org/linux-hwmon/20181107040010.27436-1-chris.packham@alliedtelesis.co.nz/

Chris Packham (2):
  dt-bindings: hwmon: Document adt7475 invert-pwm property
  hwmon: (adt7475) Add support for inverting pwm output

Logan Shaw (3):
  dt-bindings: hwmon: Document adt7475 binding
  dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  hwmon: (adt7475) Add attenuator bypass support

 .../devicetree/bindings/hwmon/adt7475.yaml    |  82 ++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |   8 --
 drivers/hwmon/adt7475.c                       | 100 +++++++++++++++++-
 3 files changed, 179 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adt7475.yaml

-- 
2.25.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] dt-bindings: hwmon: Document adt7475 binding
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
@ 2020-02-17 23:46 ` Chris Packham
  2020-02-17 23:46 ` [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property Chris Packham
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>

Add binding for adi,adt7475 and variants.
Remove from trivial-devices.

Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 .../devicetree/bindings/hwmon/adt7475.yaml    | 57 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |  8 ---
 2 files changed, 57 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adt7475.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
new file mode 100644
index 000000000000..2252499ea201
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/adt7475.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADT7475 hwmon sensor
+
+maintainers:
+  - Jean Delvare <jdelvare@suse.com>
+
+description: |
+  The ADT7473, ADT7475, ADT7476, and ADT7490 are thermal monitors and multiple
+  PWN fan controllers.
+
+  They support monitoring and controlling up to four fans (the ADT7490 can only
+  control up to three). They support reading a single on chip temperature
+  sensor and two off chip temperature sensors (the ADT7490 additionally
+  supports measuring up to three current external temperature sensors with
+  series resistance cancellation (SRC)).
+
+  Datasheets:
+  https://www.onsemi.com/pub/Collateral/ADT7473-D.PDF
+  https://www.onsemi.com/pub/Collateral/ADT7475-D.PDF
+  https://www.onsemi.com/pub/Collateral/ADT7476-D.PDF
+  https://www.onsemi.com/pub/Collateral/ADT7490-D.PDF
+
+  Description taken from onsemiconductors specification sheets, with minor
+  rephrasing.
+
+properties:
+  compatible:
+    enum:
+      - adi,adt7473
+      - adi,adt7475
+      - adi,adt7476
+      - adi,adt7490
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      hwmon@2e {
+        compatible = "adi,adt7476";
+        reg = <0x2e>;
+      };
+    };
+
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 978de7d37c66..57173ec41c30 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -34,14 +34,6 @@ properties:
           - adi,adt7461
             # +/-1C TDM Extended Temp Range I.C
           - adt7461
-            # +/-1C TDM Extended Temp Range I.C
-          - adi,adt7473
-            # +/-1C TDM Extended Temp Range I.C
-          - adi,adt7475
-            # +/-1C TDM Extended Temp Range I.C
-          - adi,adt7476
-            # +/-1C TDM Extended Temp Range I.C
-          - adi,adt7490
             # Three-Axis Digital Accelerometer
           - adi,adxl345
             # Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too)
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
  2020-02-17 23:46 ` [PATCH 1/5] dt-bindings: hwmon: Document adt7475 binding Chris Packham
@ 2020-02-17 23:46 ` Chris Packham
  2020-02-18 20:24   ` Rob Herring
  2020-02-20 20:01   ` Rob Herring
  2020-02-17 23:46 ` [PATCH 3/5] dt-bindings: hwmon: Document adt7475 invert-pwm property Chris Packham
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>

Add documentation for the bypass-attenuator-in[0-4] property.

Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 .../devicetree/bindings/hwmon/adt7475.yaml          | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
index 2252499ea201..61da90c82649 100644
--- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml
+++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
@@ -39,6 +39,17 @@ properties:
   reg:
     maxItems: 1
 
+patternProperties:
+  "^bypass-attenuator-in[0-4]$":
+    maxItems: 1
+    minimum: 0
+    maximum: 1
+    description: |
+      Configures bypassing the individual voltage input attenuator. If
+      set to 1 the attenuator is bypassed if set to 0 the attenuator is
+      not bypassed. If the property is absent then the attenuator
+      retains it's configuration from the bios/bootloader.
+
 required:
   - compatible
   - reg
@@ -52,6 +63,8 @@ examples:
       hwmon@2e {
         compatible = "adi,adt7476";
         reg = <0x2e>;
+        bypass-attenuator-in0 = <1>;
+        bypass-attenuator-in1 = <0>;
       };
     };
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] dt-bindings: hwmon: Document adt7475 invert-pwm property
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
  2020-02-17 23:46 ` [PATCH 1/5] dt-bindings: hwmon: Document adt7475 binding Chris Packham
  2020-02-17 23:46 ` [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property Chris Packham
@ 2020-02-17 23:46 ` Chris Packham
  2020-02-17 23:46 ` [PATCH 4/5] hwmon: (adt7475) Add attenuator bypass support Chris Packham
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

Add binding information for the invert-pwm property.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 Documentation/devicetree/bindings/hwmon/adt7475.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
index 61da90c82649..c11c9a3d9a64 100644
--- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml
+++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
@@ -50,6 +50,17 @@ patternProperties:
       not bypassed. If the property is absent then the attenuator
       retains it's configuration from the bios/bootloader.
 
+  "^invert-pwm[1-3]$":
+    maxItems: 1
+    minimum: 0
+    maximum: 1
+    description: |
+      Configures the pwm output to use inverted logic. If set to 1
+      the pwm uses a logic low output for 100% duty cycle. If set
+      to 0 the pwm uses a logic high output for 100% duty cycle.
+      If the property is absent the pwm retains it's configuration
+      from the bios/bootloader.
+
 required:
   - compatible
   - reg
@@ -65,6 +76,7 @@ examples:
         reg = <0x2e>;
         bypass-attenuator-in0 = <1>;
         bypass-attenuator-in1 = <0>;
+        invert-pwm1 = <1>;
       };
     };
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] hwmon: (adt7475) Add attenuator bypass support
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
                   ` (2 preceding siblings ...)
  2020-02-17 23:46 ` [PATCH 3/5] dt-bindings: hwmon: Document adt7475 invert-pwm property Chris Packham
@ 2020-02-17 23:46 ` Chris Packham
  2020-02-17 23:46 ` [PATCH 5/5] hwmon: (adt7475) Add support for inverting pwm output Chris Packham
  2020-02-18  0:32 ` [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Guenter Roeck
  5 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>

Added support for reading DTS properties to set attenuators on
device probe for the ADT7473, ADT7475, ADT7476, and ADT7490.

Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/hwmon/adt7475.c | 61 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 58 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 01c2eeb02aa9..4a62d633a2f5 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -19,6 +19,7 @@
 #include <linux/hwmon-vid.h>
 #include <linux/err.h>
 #include <linux/jiffies.h>
+#include <linux/of.h>
 #include <linux/util_macros.h>
 
 /* Indexes for the sysfs hooks */
@@ -193,6 +194,7 @@ struct adt7475_data {
 	unsigned long measure_updated;
 	bool valid;
 
+	u8 config2;
 	u8 config4;
 	u8 config5;
 	u8 has_voltage;
@@ -1458,6 +1460,55 @@ static int adt7475_update_limits(struct i2c_client *client)
 	return 0;
 }
 
+static int set_property_bit(const struct i2c_client *client, char *property,
+			  u8 *config, u8 bit_index)
+{
+	u32 prop_value = 0;
+	int ret = of_property_read_u32(client->dev.of_node, property,
+					&prop_value);
+
+	if (!ret) {
+		if (prop_value)
+			*config |= (1 << bit_index);
+		else
+			*config &= ~(1 << bit_index);
+	}
+
+	return ret;
+}
+
+static int load_attenuators(const struct i2c_client *client, int chip,
+			    struct adt7475_data *data)
+{
+	int ret;
+
+	if (chip == adt7476 || chip == adt7490) {
+		set_property_bit(client, "bypass-attenuator-in0",
+				 &data->config4, 4);
+		set_property_bit(client, "bypass-attenuator-in1",
+				 &data->config4, 5);
+		set_property_bit(client, "bypass-attenuator-in3",
+				 &data->config4, 6);
+		set_property_bit(client, "bypass-attenuator-in4",
+				 &data->config4, 7);
+
+		ret = i2c_smbus_write_byte_data(client, REG_CONFIG4,
+						data->config4);
+		if (ret < 0)
+			return ret;
+	} else if (chip == adt7473 || chip == adt7475) {
+		set_property_bit(client, "bypass-attenuator-in1",
+				 &data->config2, 5);
+
+		ret = i2c_smbus_write_byte_data(client, REG_CONFIG2,
+						data->config2);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int adt7475_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -1472,7 +1523,7 @@ static int adt7475_probe(struct i2c_client *client,
 	struct adt7475_data *data;
 	struct device *hwmon_dev;
 	int i, ret = 0, revision, group_num = 0;
-	u8 config2, config3;
+	u8 config3;
 
 	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
 	if (data == NULL)
@@ -1546,8 +1597,12 @@ static int adt7475_probe(struct i2c_client *client,
 	}
 
 	/* Voltage attenuators can be bypassed, globally or individually */
-	config2 = adt7475_read(REG_CONFIG2);
-	if (config2 & CONFIG2_ATTN) {
+	data->config2 = adt7475_read(REG_CONFIG2);
+	ret = load_attenuators(client, chip, data);
+	if (ret)
+		dev_err(&client->dev, "Error configuring attenuator bypass\n");
+
+	if (data->config2 & CONFIG2_ATTN) {
 		data->bypass_attn = (0x3 << 3) | 0x3;
 	} else {
 		data->bypass_attn = ((data->config4 & CONFIG4_ATTN_IN10) >> 4) |
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] hwmon: (adt7475) Add support for inverting pwm output
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
                   ` (3 preceding siblings ...)
  2020-02-17 23:46 ` [PATCH 4/5] hwmon: (adt7475) Add attenuator bypass support Chris Packham
@ 2020-02-17 23:46 ` Chris Packham
  2020-02-18  0:32 ` [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Guenter Roeck
  5 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-17 23:46 UTC (permalink / raw)
  To: jdelvare, linux, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel, Chris Packham

Add a "invert-pwm" device-tree property to allow hardware designs to use
inverted logic on the PWM output. Preserve the invert PWM output bit if
the property is not found to allow for bootloaders/bios which may have
configured this earlier.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/hwmon/adt7475.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 4a62d633a2f5..dccb1c78a57d 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -1509,6 +1509,41 @@ static int load_attenuators(const struct i2c_client *client, int chip,
 	return 0;
 }
 
+static int adt7475_set_pwm_polarity(struct i2c_client *client)
+{
+	char *prop;
+	int ret, i;
+	u8 val;
+
+	for (i = 0; i < ADT7475_PWM_COUNT; i++) {
+		ret = adt7475_read(PWM_CONFIG_REG(i));
+		if (ret < 0)
+			return ret;
+		val = ret;
+		switch (i) {
+		case 0:
+			prop = "invert-pwm1";
+			break;
+		case 1:
+			prop = "invert-pwm2";
+			break;
+		case 2:
+			prop = "invert-pwm3";
+			break;
+		}
+
+		ret = set_property_bit(client, prop, &val, 4);
+		if (ret)
+			continue;
+
+		ret = i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(i), val);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int adt7475_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -1617,6 +1652,10 @@ static int adt7475_probe(struct i2c_client *client,
 	for (i = 0; i < ADT7475_PWM_COUNT; i++)
 		adt7475_read_pwm(client, i);
 
+	ret = adt7475_set_pwm_polarity(client);
+	if (ret)
+		dev_err(&client->dev, "Error configuring pwm polarity");
+
 	/* Start monitoring */
 	switch (chip) {
 	case adt7475:
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert
  2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
                   ` (4 preceding siblings ...)
  2020-02-17 23:46 ` [PATCH 5/5] hwmon: (adt7475) Add support for inverting pwm output Chris Packham
@ 2020-02-18  0:32 ` Guenter Roeck
  2020-02-18  0:43   ` Chris Packham
  5 siblings, 1 reply; 12+ messages in thread
From: Guenter Roeck @ 2020-02-18  0:32 UTC (permalink / raw)
  To: Chris Packham, jdelvare, robh+dt, mark.rutland
  Cc: logan.shaw, linux-hwmon, devicetree, linux-kernel

On 2/17/20 3:46 PM, Chris Packham wrote:
> I've picked up Logan's changes[1] and am combining them with an old series of
> mine[2] to hopefully get them both over the line.
> 

No change log and/or history, so I guess your expectation is that it will be up
to me to figure out what may have changed and if previous comments have been
addressed or not.

Guenter

> This series updates the binding documentation for the adt7475 and adds two new
> sets of properties.
> 
> [1] - https://lore.kernel.org/linux-hwmon/20191219033213.30364-1-logan.shaw@alliedtelesis.co.nz/
> [2] - https://lore.kernel.org/linux-hwmon/20181107040010.27436-1-chris.packham@alliedtelesis.co.nz/
> 
> Chris Packham (2):
>    dt-bindings: hwmon: Document adt7475 invert-pwm property
>    hwmon: (adt7475) Add support for inverting pwm output
> 
> Logan Shaw (3):
>    dt-bindings: hwmon: Document adt7475 binding
>    dt-bindings: hwmon: Document adt7475 bypass-attenuator property
>    hwmon: (adt7475) Add attenuator bypass support
> 
>   .../devicetree/bindings/hwmon/adt7475.yaml    |  82 ++++++++++++++
>   .../devicetree/bindings/trivial-devices.yaml  |   8 --
>   drivers/hwmon/adt7475.c                       | 100 +++++++++++++++++-
>   3 files changed, 179 insertions(+), 11 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/hwmon/adt7475.yaml
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert
  2020-02-18  0:32 ` [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Guenter Roeck
@ 2020-02-18  0:43   ` Chris Packham
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-18  0:43 UTC (permalink / raw)
  To: linux, mark.rutland, jdelvare, robh+dt
  Cc: Logan Shaw, linux-kernel, linux-hwmon, devicetree

On Mon, 2020-02-17 at 16:32 -0800, Guenter Roeck wrote:
> On 2/17/20 3:46 PM, Chris Packham wrote:
> > I've picked up Logan's changes[1] and am combining them with an old series of
> > mine[2] to hopefully get them both over the line.
> > 
> 
> No change log and/or history, so I guess your expectation is that it will be up
> to me to figure out what may have changed and if previous comments have been
> addressed or not.
> 
> Guenter

Yeah sorry about that. I got as far as "is this v3 of Logan's series or
v1 of a new series" and jumped the gun.

Changes since Logan's series.
- Move existing dt-binding in patch 1/5.
- New dt-bindings in patch 2/5 and 3/5
- Patch 4/5:
-- move config2 to struct adt7475_data
-- set_property_bit() new helper function to set/clear bit based on dt
property value.
-- rename to use load_attenuators()
- Patch 5/5 rework older patch on top of this series.

> 
> > This series updates the binding documentation for the adt7475 and adds two new
> > sets of properties.
> > 
> > [1] - https://lore.kernel.org/linux-hwmon/20191219033213.30364-1-logan.shaw@alliedtelesis.co.nz/
> > [2] - https://lore.kernel.org/linux-hwmon/20181107040010.27436-1-chris.packham@alliedtelesis.co.nz/
> > 
> > Chris Packham (2):
> >    dt-bindings: hwmon: Document adt7475 invert-pwm property
> >    hwmon: (adt7475) Add support for inverting pwm output
> > 
> > Logan Shaw (3):
> >    dt-bindings: hwmon: Document adt7475 binding
> >    dt-bindings: hwmon: Document adt7475 bypass-attenuator property
> >    hwmon: (adt7475) Add attenuator bypass support
> > 
> >   .../devicetree/bindings/hwmon/adt7475.yaml    |  82 ++++++++++++++
> >   .../devicetree/bindings/trivial-devices.yaml  |   8 --
> >   drivers/hwmon/adt7475.c                       | 100 +++++++++++++++++-
> >   3 files changed, 179 insertions(+), 11 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/hwmon/adt7475.yaml
> > 
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  2020-02-17 23:46 ` [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property Chris Packham
@ 2020-02-18 20:24   ` Rob Herring
  2020-02-18 20:52     ` Chris Packham
  2020-02-20 20:01   ` Rob Herring
  1 sibling, 1 reply; 12+ messages in thread
From: Rob Herring @ 2020-02-18 20:24 UTC (permalink / raw)
  To: Chris Packham
  Cc: jdelvare, linux, robh+dt, mark.rutland, logan.shaw, linux-hwmon,
	devicetree, linux-kernel, Chris Packham

On Tue, 18 Feb 2020 12:46:54 +1300, Chris Packham wrote:
> 
> From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> 
> Add documentation for the bypass-attenuator-in[0-4] property.
> 
> Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  .../devicetree/bindings/hwmon/adt7475.yaml          | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:maximum: False schema does not allow 1
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:minimum: False schema does not allow 0
Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/hwmon/adt7475.example.dts' failed
make[1]: *** [Documentation/devicetree/bindings/hwmon/adt7475.example.dts] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1239694
Please check and re-submit.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  2020-02-18 20:24   ` Rob Herring
@ 2020-02-18 20:52     ` Chris Packham
  2020-02-18 23:24       ` Chris Packham
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Packham @ 2020-02-18 20:52 UTC (permalink / raw)
  To: robh
  Cc: linux-kernel, Logan Shaw, robh+dt, devicetree, linux, jdelvare,
	mark.rutland, linux-hwmon

On Tue, 2020-02-18 at 14:24 -0600, Rob Herring wrote:
> On Tue, 18 Feb 2020 12:46:54 +1300, Chris Packham wrote:
> > 
> > From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> > 
> > Add documentation for the bypass-attenuator-in[0-4] property.
> > 
> > Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> > ---
> >  .../devicetree/bindings/hwmon/adt7475.yaml          | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:maximum: False schema does not allow 1
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:minimum: False schema does not allow 0
> Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/hwmon/adt7475.example.dts' failed
> make[1]: *** [Documentation/devicetree/bindings/hwmon/adt7475.example.dts] Error 1
> Makefile:1263: recipe for target 'dt_binding_check' failed
> make: *** [dt_binding_check] Error 2
> 

I still must be doing something wrong. I did run 

  make mrproper
  make ARCH=arm defconfig
  make ARCH=arm dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/hwmon/adt7475.yaml

which passes without error.

When I run 

  make mrproper
  make ARCH=arm defconfig
  make ARCH=arm dt_binding_check

I get errors in unrelated files

e.g.

  /home/chrisp/src/linux/Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.yaml: Additional properties are not allowed ('deprecated' was unexpected)
  Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.example.dts' failed
  make[1]: *** [Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.example.dts] Error 1
  Makefile:1262: recipe for target 'dt_binding_check' failed

My local branch is based on commit 0a679e13ea30 ("Merge branch 'for-
5.6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup")
do I need to be running against something else?

> See https://patchwork.ozlabs.org/patch/1239694
> Please check and re-submit.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  2020-02-18 20:52     ` Chris Packham
@ 2020-02-18 23:24       ` Chris Packham
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Packham @ 2020-02-18 23:24 UTC (permalink / raw)
  To: robh
  Cc: linux-kernel, Logan Shaw, robh+dt, devicetree, linux, jdelvare,
	mark.rutland, linux-hwmon

On Wed, 2020-02-19 at 09:52 +1300, Chris Packham wrote:
> On Tue, 2020-02-18 at 14:24 -0600, Rob Herring wrote:
> > On Tue, 18 Feb 2020 12:46:54 +1300, Chris Packham wrote:
> > > 
> > > From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> > > 
> > > Add documentation for the bypass-attenuator-in[0-4] property.
> > > 
> > > Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> > > ---
> > >  .../devicetree/bindings/hwmon/adt7475.yaml          | 13 +++++++++++++
> > >  1 file changed, 13 insertions(+)
> > > 
> > 
> > My bot found errors running 'make dt_binding_check' on your patch:
> > 
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:maximum: False schema does not allow 1
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/hwmon/adt7475.yaml: patternProperties:^bypass-attenuator-in[0-4]$:minimum: False schema does not allow 0
> > Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/hwmon/adt7475.example.dts' failed
> > make[1]: *** [Documentation/devicetree/bindings/hwmon/adt7475.example.dts] Error 1
> > Makefile:1263: recipe for target 'dt_binding_check' failed
> > make: *** [dt_binding_check] Error 2
> > 
> 
> I still must be doing something wrong. I did run 
> 
>   make mrproper
>   make ARCH=arm defconfig
>   make ARCH=arm dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/hwmon/adt7475.yaml
> 
> which passes without error.
> 
> When I run 
> 
>   make mrproper
>   make ARCH=arm defconfig
>   make ARCH=arm dt_binding_check
> 
> I get errors in unrelated files
> 
> e.g.
> 
>   /home/chrisp/src/linux/Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.yaml: Additional properties are not allowed ('deprecated' was unexpected)
>   Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.example.dts' failed
>   make[1]: *** [Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-apb1-clk.example.dts] Error 1
>   Makefile:1262: recipe for target 'dt_binding_check' failed
> 
> My local branch is based on commit 0a679e13ea30 ("Merge branch 'for-
> 5.6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup")
> do I need to be running against something else?
> 

Ah I think I've got it

pip3 install --user git+https://github.com/devicetree-org/dt-schema.git@master

Let's me see the errors. Now I just need to understand them :).

> > See https://patchwork.ozlabs.org/patch/1239694
> > Please check and re-submit.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property
  2020-02-17 23:46 ` [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property Chris Packham
  2020-02-18 20:24   ` Rob Herring
@ 2020-02-20 20:01   ` Rob Herring
  1 sibling, 0 replies; 12+ messages in thread
From: Rob Herring @ 2020-02-20 20:01 UTC (permalink / raw)
  To: Chris Packham
  Cc: Jean Delvare, Guenter Roeck, Mark Rutland, Logan Shaw,
	Linux HWMON List, devicetree, linux-kernel

On Mon, Feb 17, 2020 at 5:47 PM Chris Packham
<chris.packham@alliedtelesis.co.nz> wrote:
>
> From: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
>
> Add documentation for the bypass-attenuator-in[0-4] property.
>
> Signed-off-by: Logan Shaw <logan.shaw@alliedtelesis.co.nz>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  .../devicetree/bindings/hwmon/adt7475.yaml          | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> index 2252499ea201..61da90c82649 100644
> --- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> @@ -39,6 +39,17 @@ properties:
>    reg:
>      maxItems: 1
>
> +patternProperties:
> +  "^bypass-attenuator-in[0-4]$":
> +    maxItems: 1
> +    minimum: 0
> +    maximum: 1

The errors here are because you are mixing array and scalar constraints.

You also need a vendor prefix and a type $ref.

> +    description: |
> +      Configures bypassing the individual voltage input attenuator. If
> +      set to 1 the attenuator is bypassed if set to 0 the attenuator is
> +      not bypassed. If the property is absent then the attenuator
> +      retains it's configuration from the bios/bootloader.
> +
>  required:
>    - compatible
>    - reg
> @@ -52,6 +63,8 @@ examples:
>        hwmon@2e {
>          compatible = "adi,adt7476";
>          reg = <0x2e>;
> +        bypass-attenuator-in0 = <1>;
> +        bypass-attenuator-in1 = <0>;
>        };
>      };
>
> --
> 2.25.0
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-20 20:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 23:46 [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Chris Packham
2020-02-17 23:46 ` [PATCH 1/5] dt-bindings: hwmon: Document adt7475 binding Chris Packham
2020-02-17 23:46 ` [PATCH 2/5] dt-bindings: hwmon: Document adt7475 bypass-attenuator property Chris Packham
2020-02-18 20:24   ` Rob Herring
2020-02-18 20:52     ` Chris Packham
2020-02-18 23:24       ` Chris Packham
2020-02-20 20:01   ` Rob Herring
2020-02-17 23:46 ` [PATCH 3/5] dt-bindings: hwmon: Document adt7475 invert-pwm property Chris Packham
2020-02-17 23:46 ` [PATCH 4/5] hwmon: (adt7475) Add attenuator bypass support Chris Packham
2020-02-17 23:46 ` [PATCH 5/5] hwmon: (adt7475) Add support for inverting pwm output Chris Packham
2020-02-18  0:32 ` [PATCH 0/5] hwmon: (adt7475) attenuator bypass and pwm invert Guenter Roeck
2020-02-18  0:43   ` Chris Packham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).