devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwmon: max31790: support to config PWM as TACH
@ 2023-09-15  6:29 Delphine CC Chiu
  2023-09-15  6:29 ` [PATCH v2 1/2] " Delphine CC Chiu
  2023-09-15  6:29 ` [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790 Delphine CC Chiu
  0 siblings, 2 replies; 8+ messages in thread
From: Delphine CC Chiu @ 2023-09-15  6:29 UTC (permalink / raw)
  To: patrick
  Cc: Delphine CC Chiu, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree,
	linux-kernel

Support to config PWM as TACH in MAX31790 driver.
Add binding document for MAX31790 driver.

---
Changelog:
v2 - Remove unnecessary parentheses.
   - Add more error handling.
   - Change the type of "pwm-as-tach" from u8 to u32 to match binding
     document.
   - Add dt-bindings for the MAXIM MAX31790.
v1 - Support to config PWM as TACH

Delphine CC Chiu (2):
  hwmon: max31790: support to config PWM as TACH
  dt-bindings: hwmon: add MAX31790

 .../bindings/hwmon/maxim,max31790.yaml        | 59 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 drivers/hwmon/max31790.c                      | 58 ++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml

-- 
2.25.1


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

* [PATCH v2 1/2] hwmon: max31790: support to config PWM as TACH
  2023-09-15  6:29 [PATCH v2 0/2] hwmon: max31790: support to config PWM as TACH Delphine CC Chiu
@ 2023-09-15  6:29 ` Delphine CC Chiu
  2023-09-15  6:29 ` [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790 Delphine CC Chiu
  1 sibling, 0 replies; 8+ messages in thread
From: Delphine CC Chiu @ 2023-09-15  6:29 UTC (permalink / raw)
  To: patrick, Delphine CC Chiu, Jean Delvare, Guenter Roeck
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon,
	devicetree, linux-kernel

The PWM outputs of max31790 could be used as tachometer inputs by
setting the fan configuration register, but the driver doesn't support
to config the PWM outputs as tachometer inputs currently.

Add a function to get properties of the setting of max31790 to config
PWM outputs as tachometer inputs before initializing max31790.
For example: set `pwm-as-tach = <2 5>` in DTS for max31790 and
the driver will config PWMOUT2 and PWMOUT5 as TACH8 and TACH11.

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
---
Changelog:
v2 - Remove unnecessary parentheses.
   - Add more error handling.
   - Change the type of "pwm-as-tach" from u8 to u32 to match binding
     document.
v1 - Support to config PWM as TACH
---
 drivers/hwmon/max31790.c | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c
index 0cd44c1e998a..7826d94306c5 100644
--- a/drivers/hwmon/max31790.c
+++ b/drivers/hwmon/max31790.c
@@ -480,6 +480,60 @@ static const struct hwmon_chip_info max31790_chip_info = {
 	.info = max31790_info,
 };
 
+static int max31790_config_pwm_as_tach(struct device *dev,
+				       struct i2c_client *client)
+{
+	struct device_node *np = dev->of_node;
+	int i, ret, size, channel;
+	u32 pwm_index[NR_CHANNEL] = { 0 };
+	u8 fan_config;
+
+	size = of_property_count_u32_elems(np, "pwm-as-tach");
+
+	if (size > 0 && size <= NR_CHANNEL) {
+		ret = of_property_read_u32_array(np, "pwm-as-tach", pwm_index,
+						 size);
+		if (ret) {
+			dev_err(dev,
+				"Property 'pwm-as-tach' cannot be read.\n");
+			return ret;
+		}
+
+		for (i = 0; i < size; i++) {
+			if (pwm_index[i] == 0 || pwm_index[i] > NR_CHANNEL) {
+				dev_err(dev, "Not support to config PWM %x.\n",
+					pwm_index[i]);
+				return -EOPNOTSUPP;
+			}
+
+			channel = pwm_index[i] - 1;
+			ret = i2c_smbus_read_byte_data(
+				client, MAX31790_REG_FAN_CONFIG(channel));
+			if (ret < 0) {
+				dev_err(dev,
+					"Read fan config for channel %d failed.\n",
+					channel);
+				return ret;
+			}
+			fan_config = ret;
+			fan_config |= (MAX31790_FAN_CFG_CTRL_MON |
+				       MAX31790_FAN_CFG_TACH_INPUT);
+
+			ret = i2c_smbus_write_byte_data(
+				client, MAX31790_REG_FAN_CONFIG(channel),
+				fan_config);
+			if (ret < 0) {
+				dev_err(dev,
+					"Write fan config for channel %d failed.\n",
+					channel);
+				return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
 static int max31790_init_client(struct i2c_client *client,
 				struct max31790_data *data)
 {
@@ -521,6 +575,10 @@ static int max31790_probe(struct i2c_client *client)
 	data->client = client;
 	mutex_init(&data->update_lock);
 
+	err = max31790_config_pwm_as_tach(dev, client);
+	if (err)
+		dev_crit(dev, "Config PWM as TACH failed.\n");
+
 	/*
 	 * Initialize the max31790 chip
 	 */
-- 
2.25.1


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

* [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-15  6:29 [PATCH v2 0/2] hwmon: max31790: support to config PWM as TACH Delphine CC Chiu
  2023-09-15  6:29 ` [PATCH v2 1/2] " Delphine CC Chiu
@ 2023-09-15  6:29 ` Delphine CC Chiu
  2023-09-15 14:50   ` Conor Dooley
  1 sibling, 1 reply; 8+ messages in thread
From: Delphine CC Chiu @ 2023-09-15  6:29 UTC (permalink / raw)
  To: patrick, Delphine CC Chiu, Jean Delvare, Guenter Roeck,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, devicetree, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2723 bytes --]

Add dt-bindings for the MAXIM MAX31790.

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
---
Changelog:
v2 - Add dt-bindings for the MAXIM MAX31790.
---
 .../bindings/hwmon/maxim,max31790.yaml        | 59 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
new file mode 100644
index 000000000000..2bd455b36b3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/hwmon/maxim,max31790.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim max31790
+
+maintainers:
+  - Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
+
+description: |
+  The MAX31790 controls the speeds of up to six fans using
+  six independent PWM outputs. The desired fan speeds (or PWM duty cycles)
+  are written through the I2C	interface.
+  The outputs drive “4-wire” fans directly, or can be used to modulate
+  the fan’s power terminals using an external pass transistor.
+
+  Datasheets:
+    https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf
+
+properties:
+  compatible:
+    enum:
+      - maxim,max31790
+
+  reg:
+    maxItems: 1
+
+  pwm-as-tach:
+    description: |
+      There are 6 PWM output channel in MAX31790 that allows to be configured
+      as a TACH input by setting the Fan Configuration register.
+      Config PWM output channels in the array as tachometer inputs.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 6
+    items:
+      enum: [1, 2, 3, 4, 5, 6]
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pwm@20 {
+        compatible = "maxim,max31790";
+        reg = <0x20>;
+        pwm-as-tach = <2 5>;
+      };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index c8fdd0d03907..97e13b6bf51d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1371,6 +1371,12 @@ F:	Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
 F:	Documentation/hwmon/max31760.rst
 F:	drivers/hwmon/max31760.c
 
+ANALOG DEVICES INC MAX31790 DRIVER
+M:	Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
+S:	Odd Fixes
+F:	Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
+F:	drivers/hwmon/max31790.c
+
 ANALOGBITS PLL LIBRARIES
 M:	Paul Walmsley <paul.walmsley@sifive.com>
 S:	Supported
-- 
2.25.1


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

* Re: [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-15  6:29 ` [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790 Delphine CC Chiu
@ 2023-09-15 14:50   ` Conor Dooley
  2023-09-15 15:20     ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2023-09-15 14:50 UTC (permalink / raw)
  To: Delphine CC Chiu
  Cc: patrick, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3258 bytes --]

Yo,

On Fri, Sep 15, 2023 at 02:29:24PM +0800, Delphine CC Chiu wrote:
> Add dt-bindings for the MAXIM MAX31790.
> 
> Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
> ---
> Changelog:
> v2 - Add dt-bindings for the MAXIM MAX31790.
> ---
>  .../bindings/hwmon/maxim,max31790.yaml        | 59 +++++++++++++++++++
>  MAINTAINERS                                   |  6 ++
>  2 files changed, 65 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> new file mode 100644
> index 000000000000..2bd455b36b3f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/hwmon/maxim,max31790.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim max31790
> +
> +maintainers:
> +  - Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> +
> +description: |
> +  The MAX31790 controls the speeds of up to six fans using
> +  six independent PWM outputs. The desired fan speeds (or PWM duty cycles)
> +  are written through the I2C	interface.
> +  The outputs drive “4-wire” fans directly, or can be used to modulate
> +  the fan’s power terminals using an external pass transistor.
> +
> +  Datasheets:
> +    https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max31790
> +
> +  reg:
> +    maxItems: 1
> +
> +  pwm-as-tach:

I don't see any other users of this in-tree, so you'd need a vendor
prefix. That said, I'm once bitten, twice shy about fan related
properties in hwmon, so I would definitely like Rob to comment on this
whole binding.

> +    description: |
> +      There are 6 PWM output channel in MAX31790 that allows to be configured
> +      as a TACH input by setting the Fan Configuration register.
> +      Config PWM output channels in the array as tachometer inputs.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 1
> +    maxItems: 6
> +    items:
> +      enum: [1, 2, 3, 4, 5, 6]
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      pwm@20 {
> +        compatible = "maxim,max31790";
> +        reg = <0x20>;
> +        pwm-as-tach = <2 5>;

This would be <2>, <5>; no?

> +      };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c8fdd0d03907..97e13b6bf51d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1371,6 +1371,12 @@ F:	Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
>  F:	Documentation/hwmon/max31760.rst
>  F:	drivers/hwmon/max31760.c
>  
> +ANALOG DEVICES INC MAX31790 DRIVER
> +M:	Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> +S:	Odd Fixes

This is a pretty odd status for something you're newly adding.
How come it's not going to be maintained?

Thanks,
Conor.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-15 14:50   ` Conor Dooley
@ 2023-09-15 15:20     ` Rob Herring
  2023-09-22  2:33       ` Delphine_CC_Chiu/WYHQ/Wiwynn
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2023-09-15 15:20 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Delphine CC Chiu, patrick, Jean Delvare, Guenter Roeck,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree,
	linux-kernel

On Fri, Sep 15, 2023 at 9:50 AM Conor Dooley <conor@kernel.org> wrote:
>
> Yo,
>
> On Fri, Sep 15, 2023 at 02:29:24PM +0800, Delphine CC Chiu wrote:
> > Add dt-bindings for the MAXIM MAX31790.
> >
> > Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
> > ---
> > Changelog:
> > v2 - Add dt-bindings for the MAXIM MAX31790.
> > ---
> >  .../bindings/hwmon/maxim,max31790.yaml        | 59 +++++++++++++++++++
> >  MAINTAINERS                                   |  6 ++
> >  2 files changed, 65 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > new file mode 100644
> > index 000000000000..2bd455b36b3f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > @@ -0,0 +1,59 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +
> > +$id: http://devicetree.org/schemas/hwmon/maxim,max31790.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Maxim max31790
> > +
> > +maintainers:
> > +  - Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> > +
> > +description: |
> > +  The MAX31790 controls the speeds of up to six fans using
> > +  six independent PWM outputs. The desired fan speeds (or PWM duty cycles)
> > +  are written through the I2C        interface.
> > +  The outputs drive “4-wire” fans directly, or can be used to modulate
> > +  the fan’s power terminals using an external pass transistor.
> > +
> > +  Datasheets:
> > +    https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - maxim,max31790
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  pwm-as-tach:
>
> I don't see any other users of this in-tree, so you'd need a vendor
> prefix. That said, I'm once bitten, twice shy about fan related
> properties in hwmon, so I would definitely like Rob to comment on this
> whole binding.

Please see this[1] and comment on it to ensure it meets your needs.
Otherwise, omit any fan related properties for now.

Rob

[1] https://lore.kernel.org/all/20230830123202.3408318-2-billy_tsai@aspeedtech.com/

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

* RE: [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-15 15:20     ` Rob Herring
@ 2023-09-22  2:33       ` Delphine_CC_Chiu/WYHQ/Wiwynn
  2023-09-22  9:53         ` Conor Dooley
  0 siblings, 1 reply; 8+ messages in thread
From: Delphine_CC_Chiu/WYHQ/Wiwynn @ 2023-09-22  2:33 UTC (permalink / raw)
  To: Rob Herring, Conor Dooley
  Cc: Delphine_CC_Chiu/WYHQ/Wiwynn, patrick@stwcx.xyz, Jean Delvare,
	Guenter Roeck, Krzysztof Kozlowski, Conor Dooley,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org


> > Yo,
> >
> > On Fri, Sep 15, 2023 at 02:29:24PM +0800, Delphine CC Chiu wrote:
> > > Add dt-bindings for the MAXIM MAX31790.
> > >
> > > Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
> > > ---
> > > Changelog:
> > > v2 - Add dt-bindings for the MAXIM MAX31790.
> > > ---
> > >  .../bindings/hwmon/maxim,max31790.yaml        | 59
> +++++++++++++++++++
> > >  MAINTAINERS                                   |  6 ++
> > >  2 files changed, 65 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > > b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > > new file mode 100644
> > > index 000000000000..2bd455b36b3f
> > > --- /dev/null
> > > +++
> b/Documentation/devicetree/bindings/hwmon/maxim,max31790.yaml
> > > @@ -0,0 +1,59 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
> > > +---
> > > +
> > > +$id:
> > > +http://de/
> > >
> +vicetree.org%2Fschemas%2Fhwmon%2Fmaxim%2Cmax31790.yaml%23&dat
> a=05%7
> > >
> +C01%7CRicky_CX_Wu%40wiwynn.com%7C5cef527f44254a3b08d708dbb5ff
> 64b4%7
> > >
> +Cda6e0628fc834caf9dd273061cbab167%7C0%7C0%7C63830388164599049
> 9%7CUn
> > >
> +known%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI
> 6Ik1
> > >
> +haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Wp%2Bu9QyFyjv8bh
> ZRGoK8gaj
> > > +S7hikXbxNoehdOzLBD%2FI%3D&reserved=0
> > > +$schema:
> > > +http://de/
> > >
> +vicetree.org%2Fmeta-schemas%2Fcore.yaml%23&data=05%7C01%7CRicky_
> CX_
> > >
> +Wu%40wiwynn.com%7C5cef527f44254a3b08d708dbb5ff64b4%7Cda6e0628
> fc834c
> > >
> +af9dd273061cbab167%7C0%7C0%7C638303881645990499%7CUnknown%7
> CTWFpbGZ
> > >
> +sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
> Mn
> > >
> +0%3D%7C3000%7C%7C%7C&sdata=uyqp2bRI%2BTWNwiloKf76R6TiL61OiW
> 2aqxgZkN
> > > +%2B78mg%3D&reserved=0
> > > +
> > > +title: Maxim max31790
> > > +
> > > +maintainers:
> > > +  - Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> > > +
> > > +description: |
> > > +  The MAX31790 controls the speeds of up to six fans using
> > > +  six independent PWM outputs. The desired fan speeds (or PWM duty
> cycles)
> > > +  are written through the I2C        interface.
> > > +  The outputs drive “4-wire” fans directly, or can be used to
> > > +modulate
> > > +  the fan’s power terminals using an external pass transistor.
> > > +
> > > +  Datasheets:
> > > +
> > > + https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > +
> datasheets.maximintegrated.com%2Fen%2Fds%2FMAX31790.pdf&data=05%
> 7C
> > > +
> 01%7CRicky_CX_Wu%40wiwynn.com%7C5cef527f44254a3b08d708dbb5ff64
> b4%7
> > > +
> Cda6e0628fc834caf9dd273061cbab167%7C0%7C0%7C638303881645990499
> %7CU
> > > +
> nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI
> 6I
> > > +
> k1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KrmGiJ2VFoJE5%2
> B%2FeyW
> > > + hrCqIXbcSMZk5ToCiiUHUQCRs%3D&reserved=0
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - maxim,max31790
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  pwm-as-tach:
> >
> > I don't see any other users of this in-tree, so you'd need a vendor
> > prefix. That said, I'm once bitten, twice shy about fan related
> > properties in hwmon, so I would definitely like Rob to comment on this
> > whole binding.
>
> Please see this[1] and comment on it to ensure it meets your needs.
> Otherwise, omit any fan related properties for now.
>
This property could only be used in max31790 driver. Would it be ok if we add
vendor prefix like "maxim, pwm-as-tach"?

> Rob
>
> [1]
> https://lore.ker/
> nel.org%2Fall%2F20230830123202.3408318-2-billy_tsai%40aspeedtech.com
> %2F&data=05%7C01%7CRicky_CX_Wu%40wiwynn.com%7C5cef527f44254a3
> b08d708dbb5ff64b4%7Cda6e0628fc834caf9dd273061cbab167%7C0%7C0%7
> C638303881645990499%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C
> %7C&sdata=1dre05mnoY9Y2%2FdQ2%2B2nVq6wRufembfxEHAMg1BXsMc%3
> D&reserved=0


> > +examples:
> > +  - |
> > +    i2c {
> > +      #address-cells = <1>;
> > +      #size-cells = <0>;
> > +
> > +      pwm@20 {
> > +        compatible = "maxim,max31790";
> > +        reg = <0x20>;
> > +        pwm-as-tach = <2 5>;
>
> This would be <2>, <5>; no?
>
I refer to the other binding documents in hwmon and most of them were using
the format like <2 5> as an array.


> > diff --git a/MAINTAINERS b/MAINTAINERS index
> > c8fdd0d03907..97e13b6bf51d 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1371,6 +1371,12 @@ F:
>       Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
> >  F: Documentation/hwmon/max31760.rst
> >  F: drivers/hwmon/max31760.c
> >
> > +ANALOG DEVICES INC MAX31790 DRIVER
> > +M: Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> > +S: Odd Fixes
>
> This is a pretty odd status for something you're newly adding.
> How come it's not going to be maintained?
>
We are not the authors of this driver but we want to add a feature to
config PWM as TACH that was descripted in the datasheet of MAX31790.
Should we set the status to maintained?


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

* Re: [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-22  2:33       ` Delphine_CC_Chiu/WYHQ/Wiwynn
@ 2023-09-22  9:53         ` Conor Dooley
  2023-09-22 14:42           ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2023-09-22  9:53 UTC (permalink / raw)
  To: Delphine_CC_Chiu/WYHQ/Wiwynn
  Cc: Rob Herring, patrick@stwcx.xyz, Jean Delvare, Guenter Roeck,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

On Fri, Sep 22, 2023 at 02:33:06AM +0000, Delphine_CC_Chiu/WYHQ/Wiwynn wrote:
> > > On Fri, Sep 15, 2023 at 02:29:24PM +0800, Delphine CC Chiu wrote:

> > > > +  pwm-as-tach:
> > >
> > > I don't see any other users of this in-tree, so you'd need a vendor
> > > prefix. That said, I'm once bitten, twice shy about fan related
> > > properties in hwmon, so I would definitely like Rob to comment on this
> > > whole binding.
> >
> > Please see this[1] and comment on it to ensure it meets your needs.
> > Otherwise, omit any fan related properties for now.
> >
> This property could only be used in max31790 driver. Would it be ok if we add
> vendor prefix like "maxim, pwm-as-tach"?

I think the answer to this is a pretty straightforward no. The goal is
to create a set of common fan properties that works for multiple
usecases, not create one specifically for each user...

> > > +examples:
> > > +  - |
> > > +    i2c {
> > > +      #address-cells = <1>;
> > > +      #size-cells = <0>;
> > > +
> > > +      pwm@20 {
> > > +        compatible = "maxim,max31790";
> > > +        reg = <0x20>;
> > > +        pwm-as-tach = <2 5>;
> >
> > This would be <2>, <5>; no?
> >
> I refer to the other binding documents in hwmon and most of them were using
> the format like <2 5> as an array.

Which also makes this moot, since it'll be going away.

> > > diff --git a/MAINTAINERS b/MAINTAINERS index
> > > c8fdd0d03907..97e13b6bf51d 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -1371,6 +1371,12 @@ F:
> >       Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
> > >  F: Documentation/hwmon/max31760.rst
> > >  F: drivers/hwmon/max31760.c
> > >
> > > +ANALOG DEVICES INC MAX31790 DRIVER
> > > +M: Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
> > > +S: Odd Fixes
> >
> > This is a pretty odd status for something you're newly adding.
> > How come it's not going to be maintained?
> >
> We are not the authors of this driver but we want to add a feature to
> config PWM as TACH that was descripted in the datasheet of MAX31790.
> Should we set the status to maintained?

It's really up to you. I just found it curious & wanted to ask why it
was that way.

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790
  2023-09-22  9:53         ` Conor Dooley
@ 2023-09-22 14:42           ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2023-09-22 14:42 UTC (permalink / raw)
  To: Conor Dooley, Delphine_CC_Chiu/WYHQ/Wiwynn
  Cc: Rob Herring, patrick@stwcx.xyz, Jean Delvare, Krzysztof Kozlowski,
	Conor Dooley, linux-hwmon@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org

On 9/22/23 02:53, Conor Dooley wrote:
> On Fri, Sep 22, 2023 at 02:33:06AM +0000, Delphine_CC_Chiu/WYHQ/Wiwynn wrote:
>>>> On Fri, Sep 15, 2023 at 02:29:24PM +0800, Delphine CC Chiu wrote:
> 
>>>>> +  pwm-as-tach:
>>>>
>>>> I don't see any other users of this in-tree, so you'd need a vendor
>>>> prefix. That said, I'm once bitten, twice shy about fan related
>>>> properties in hwmon, so I would definitely like Rob to comment on this
>>>> whole binding.
>>>
>>> Please see this[1] and comment on it to ensure it meets your needs.
>>> Otherwise, omit any fan related properties for now.
>>>
>> This property could only be used in max31790 driver. Would it be ok if we add
>> vendor prefix like "maxim, pwm-as-tach"?
> 
> I think the answer to this is a pretty straightforward no. The goal is
> to create a set of common fan properties that works for multiple
> usecases, not create one specifically for each user...
> 

Another chip with configurable channel configuration is nct7802, where
individual channels can be configured as temperature or voltage sensor.
We are using sensor-type to select the mode in that driver. Maybe something
similar would make sense / be acceptable here.

>>>> +examples:
>>>> +  - |
>>>> +    i2c {
>>>> +      #address-cells = <1>;
>>>> +      #size-cells = <0>;
>>>> +
>>>> +      pwm@20 {
>>>> +        compatible = "maxim,max31790";
>>>> +        reg = <0x20>;
>>>> +        pwm-as-tach = <2 5>;
>>>
>>> This would be <2>, <5>; no?
>>>
>> I refer to the other binding documents in hwmon and most of them were using
>> the format like <2 5> as an array.
> 
> Which also makes this moot, since it'll be going away.
> 
>>>> diff --git a/MAINTAINERS b/MAINTAINERS index
>>>> c8fdd0d03907..97e13b6bf51d 100644
>>>> --- a/MAINTAINERS
>>>> +++ b/MAINTAINERS
>>>> @@ -1371,6 +1371,12 @@ F:
>>>        Documentation/devicetree/bindings/hwmon/adi,max31760.yaml
>>>>   F: Documentation/hwmon/max31760.rst
>>>>   F: drivers/hwmon/max31760.c
>>>>
>>>> +ANALOG DEVICES INC MAX31790 DRIVER
>>>> +M: Delphine CC Chiu  <Delphine_CC_Chiu@wiwynn.com>
>>>> +S: Odd Fixes
>>>
>>> This is a pretty odd status for something you're newly adding.
>>> How come it's not going to be maintained?
>>>
>> We are not the authors of this driver but we want to add a feature to
>> config PWM as TACH that was descripted in the datasheet of MAX31790.
>> Should we set the status to maintained?
> 
> It's really up to you. I just found it curious & wanted to ask why it
> was that way.
> 

It is misleading because it downgrades the driver from "supported"
(like all other hwmon drivers) to "odd fixes".

Guenter


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

end of thread, other threads:[~2023-09-22 14:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15  6:29 [PATCH v2 0/2] hwmon: max31790: support to config PWM as TACH Delphine CC Chiu
2023-09-15  6:29 ` [PATCH v2 1/2] " Delphine CC Chiu
2023-09-15  6:29 ` [PATCH v2 2/2] dt-bindings: hwmon: add MAX31790 Delphine CC Chiu
2023-09-15 14:50   ` Conor Dooley
2023-09-15 15:20     ` Rob Herring
2023-09-22  2:33       ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-09-22  9:53         ` Conor Dooley
2023-09-22 14:42           ` Guenter Roeck

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).