Update the max31790 driver
Subsystems (2)
cover Update the max31790 driver
Add the max31790 driver binding document and support pwmout-pin-as-tach-input property for the max31790 driver.
Chanh Nguyen (3):
dt-bindings: hwmon: Add maxim max31790 driver bindings
hwmon: (max31790): Support config PWM output becomes TACH
dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
.../devicetree/bindings/hwmon/max31790.yaml | 55 +++++++++++++++++++ drivers/hwmon/max31790.c | 31 +++++++++++ 2 files changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml
Signature · 1 line
2.17.1
PATCH 1/3 dt-bindings: hwmon: Add maxim max31790 driver bindings
Add a device tree bindings for max31790 device.
--- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +44 -0
@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/max31790.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: The Maxim MAX31790 Fan Controller + +maintainers: + - Jean Delvare <[email protected]> + - Guenter Roeck <[email protected]> + +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. + + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf + +properties: + compatible: + const: maxim,max31790 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + max31790@20 { + compatible = "maxim,max31790"; + reg = <0x20>; + }; + };
Signature · 1 line
2.17.1
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 1 line · Chanh Nguyen
Add a device tree bindings for max31790 device.
Subject: drop "driver", bindings are about hardware.
It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.
Documentation/devicetree/bindings/hwmon/max31790.yaml
Quoted 12 lines
Signed-off-by Chanh Nguyen <[email protected]>--- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yamlDocumentation/devicetree/bindings/hwmon/max31790.yaml new file +0
-0
Filename like compatible.
Documentation/devicetree/bindings/hwmon/max31790.yaml line 11
Quoted 12 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +11
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/max31790.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: The Maxim MAX31790 Fan Controller + +maintainers: + - Jean Delvare <[email protected]> + - Guenter Roeck <[email protected]>
You should have here someone responsible for hardware, not subsystem maintainers.
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +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.
Documentation/devicetree/bindings/hwmon/max31790.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +10
-0+ + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf + +properties: + compatible: + const: maxim,max31790 + + reg: + maxItems: 1
That's weirdly empty.
Documentation/devicetree/bindings/hwmon/max31790.yaml line 31
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +required: + - compatible + - reg +
You miss allOf: with $ref to fan controller schema.
Documentation/devicetree/bindings/hwmon/max31790.yaml line 40
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +9
-0+additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + max31790@20 {
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 5 lines · Krzysztof Kozlowski
Quoted 1 line · Chanh Nguyen
Add a device tree bindings for max31790 device.
Subject: drop "driver", bindings are about hardware.
Yes, I'll drop "driver" at v2 updating.
Quoted 5 lines
It does not look like you tested the bindings, at least after quick look. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions). Maybe you need to update your dtschema and yamllint.
I tested the binding, I didn't see any warning/error log. Please review my logs as below
=> make dt_binding_check DT_SCHEMA_FILES=/hwmon/max31790.yaml make[1]: Entering directory '/DISK4T/work/community/linux/out'
DTEX Documentation/devicetree/bindings/hwmon/max31790.example.dts
DTC_CHK Documentation/devicetree/bindings/hwmon/max31790.example.dtb
make[1]: Leaving directory '/DISK4T/work/community/linux/out'
Quoted 7 lines
Quoted 7 lines
Signed-off-by Chanh Nguyen <[email protected]>--- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)create mode 100644
Documentation/devicetree/bindings/hwmon/max31790.yaml
Quoted 7 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +0
-0Filename like compatible.
Yes, I'll update that in v2
Quoted 17 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 11
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +11
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/max31790.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: The Maxim MAX31790 Fan Controller + +maintainers: + - Jean Delvare <[email protected]> + - Guenter Roeck <[email protected]>You should have here someone responsible for hardware, not subsystem maintainers.
Hi Krzysztof,
I checked the history of the drivers/hwmon/max31790.c and see Guenter Roeck <[email protected]> as an important maintainer. I saw many commits from him. So, I add him to maintainer list.
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +9
-0+ +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. + + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf +
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 26
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +6
-0+properties: + compatible: + const: maxim,max31790 + + reg: + maxItems: 1That's weirdly empty.
Hi Krzysztof,
I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof!
Quoted 8 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 31
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +required: + - compatible + - reg +You miss allOf: with $ref to fan controller schema.
Thank Krzysztof,
I'll add the allOf at v2.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+additionalProperties: false + +examples: + - | + i2c {
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 40
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + + max31790@20 {Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
I suggest some node names, such as "i2c-fan" or "fan-controller" . Can you please share your ideas with me!
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 10 lines · Chanh Nguyen
Quoted 6 lines
It does not look like you tested the bindings, at least after quick look. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions). Maybe you need to update your dtschema and yamllint.I tested the binding, I didn't see any warning/error log. Please review my logs as below
Hm, I don't remember what brought my attention to possible error. Maybe I mistyped my template.
Quoted 42 lines
=> make
dt_binding_checkDT_SCHEMA_FILES=/hwmon/max31790.yaml make[1]: Entering directory '/DISK4T/work/community/linux/out'
DTEXDocumentation/devicetree/bindings/hwmon/max31790.example.dts
DTC_CHKDocumentation/devicetree/bindings/hwmon/max31790.example.dtb
make[1]: Leaving directory '/DISK4T/work/community/linux/out'Quoted 7 lines
Quoted 7 lines
Signed-off-by Chanh Nguyen <[email protected]>--- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)create mode 100644
Documentation/devicetree/bindings/hwmon/max31790.yamlQuoted 7 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +0
-0Filename like compatible.
Yes, I'll update that in v2
Quoted 17 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 11
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +11
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/max31790.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: The Maxim MAX31790 Fan Controller + +maintainers: + - Jean Delvare <[email protected]> + - Guenter Roeck <[email protected]>You should have here someone responsible for hardware, not subsystem maintainers.
Quoted 4 lines
Hi Krzysztof,
I checked the history of thedrivers/hwmon/max31790.cand see Guenter Roeck <[email protected]> as an important maintainer. I saw many commits from him. So, I add him to maintainer list.
OK
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +9
-0+ +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. + + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf +Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 26
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +6
-0+properties: + compatible: + const: maxim,max31790 + + reg: + maxItems: 1That's weirdly empty.
Quoted 3 lines
Hi Krzysztof,
I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof!
I expect many more properties of a fan controller. Resources (clocks, PWMs, supplies) and FAN specific properties.
Quoted 27 lines
Quoted 8 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 31
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +required: + - compatible + - reg +You miss allOf: with $ref to fan controller schema.
Thank Krzysztof,
I'll add the allOf at v2.Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+additionalProperties: false + +examples: + - | + i2c {Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 40
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + + max31790@20 {Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Quoted 2 lines
I suggest some node names, such as "i2c-fan" or "fan-controller" . Can you please share your ideas with me!
Look at recent commits and patches for similar type of a device.
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 84 lines · Krzysztof Kozlowski
Quoted 10 lines · Chanh Nguyen
Quoted 6 lines
It does not look like you tested the bindings, at least after quick look. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions). Maybe you need to update your dtschema and yamllint.I tested the binding, I didn't see any warning/error log. Please review my logs as below
Hm, I don't remember what brought my attention to possible error. Maybe I mistyped my template.
Quoted 42 lines
=> make
dt_binding_checkDT_SCHEMA_FILES=/hwmon/max31790.yaml make[1]: Entering directory '/DISK4T/work/community/linux/out'
DTEXDocumentation/devicetree/bindings/hwmon/max31790.example.dts
DTC_CHKDocumentation/devicetree/bindings/hwmon/max31790.example.dtb
make[1]: Leaving directory '/DISK4T/work/community/linux/out'Quoted 7 lines
Quoted 7 lines
Signed-off-by Chanh Nguyen <[email protected]>--- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)create mode 100644
Documentation/devicetree/bindings/hwmon/max31790.yamlQuoted 7 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +0
-0Filename like compatible.
Yes, I'll update that in v2
Quoted 17 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 11
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +11
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/max31790.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: The Maxim MAX31790 Fan Controller + +maintainers: + - Jean Delvare <[email protected]> + - Guenter Roeck <[email protected]>You should have here someone responsible for hardware, not subsystem maintainers.
Quoted 4 lines
Hi Krzysztof,
I checked the history of thedrivers/hwmon/max31790.cand see Guenter Roeck <[email protected]> as an important maintainer. I saw many commits from him. So, I add him to maintainer list.OK
Quoted 20 lines
Quoted 19 lines
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +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.Documentation/devicetree/bindings/hwmon/max31790.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +10
-0+ + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX31790.pdf + +properties: + compatible: + const: maxim,max31790 + + reg: + maxItems: 1That's weirdly empty.
Quoted 7 lines
Quoted 3 lines
Hi Krzysztof,
I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof!I expect many more properties of a fan controller. Resources (clocks, PWMs, supplies) and FAN specific properties.
Hi Krzysztof,
I'm creating a base binding document for the max31790 driver. I'm basing it on the drivers/hwmon/max31790.c. Currently, the max31790.c driver has not yet implemented other properties, such as clocks, fan-supply, pwms, etc. So I just introduced the "compatible" and "reg" properties.
In the near future, if any other properties are necessary, I think we will implement them in drivers/hwmon/max31790.c then update this binding document.
I look at other binding documents, I also see something similar. They just introduce the "compatible" and "reg" properties.
This is only my view. It's a pleasure to hear your advice. Thanks!
Quoted 28 lines
Quoted 28 lines
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 31
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +5
-0+ +required: + - compatible + - reg +You miss allOf: with $ref to fan controller schema.
Thank Krzysztof,
I'll add the allOf at v2.Quoted 14 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml line 40
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml new file +9
-0+additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + max31790@20 {Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Quoted 5 lines
Quoted 2 lines
I suggest some node names, such as "i2c-fan" or "fan-controller" . Can you please share your ideas with me!
Look at recent commits and patches for similar type of a device.
Hi Krzysztof,
I checked on recent commits and found something of a similar type.
adi,max31760.yaml
fan-controller@50 {
reg = <0x50>;
compatible = "adi,max31760";
};hpe,gxp-fan-ctrl.yaml
fan-controller@1000c00 {
compatible = "hpe,gxp-fan-ctrl";
reg = <0x1000c00 0x200>, <0xd1000000 0xff>, <0x80200000 0x100000>;
reg-names = "base", "pl", "fn2";
};adi,axi-fan-control.yaml
axi_fan_control: axi-fan-control@80000000 {
compatible = "adi,axi-fan-control-1.00.a";
reg = <0x0 0x80000000 0x10000>;
clocks = <&clk 71>;
interrupts = <0 110 0>;
pulses-per-revolution = <2>;
};I think "fan-controller" is a good node name. Do you think so?
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 6 lines · Chanh Nguyen
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Hi Krzysztof,
I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof!
Quoted 8 lines
Quoted 3 lines
I expect many more properties of a fan controller. Resources (clocks, PWMs, supplies) and FAN specific properties.
Hi Krzysztof,
I'm creating a base binding document for the max31790 driver. I'm basing it on the
drivers/hwmon/max31790.c. Currently, themax31790.cdriver has
Binding should be based on device (e.g. its datasheet), not the driver.
Quoted 6 lines
not yet implemented other properties, such as clocks, fan-supply, pwms, etc. So I just introduced the "compatible" and "reg" properties.
In the near future, if any other properties are necessary, I think we will implement them in
drivers/hwmon/max31790.cthen update this binding document.
Please instead read:Documentation/devicetree/bindings/writing-bindings.rst
Quoted 5 lines
I look at other binding documents, I also see something similar. They just introduce the "compatible" and "reg" properties.
Maybe these devices are similar, maybe not. This should not be excuse to come with really incomplete binding.
...
Quoted 2 lines
I think "fan-controller" is a good node name. Do you think so?
Yes.
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Chanh Nguyen
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Hi Krzysztof,
I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof!I expect many more properties of a fan controller. Resources (clocks, PWMs, supplies) and FAN specific properties.
Quoted 7 lines
Quoted 4 lines
Hi Krzysztof,
I'm creating a base binding document for the max31790 driver. I'm basing it on the
drivers/hwmon/max31790.c. Currently, themax31790.cdriver hasBinding should be based on device (e.g. its datasheet), not the driver.
Thank Krzysztof,
I'm reading the writing-bindings.rst and I got it for now. I'll make complete binding in patch v2.
I am very pleased to hear your comments.
Quoted 29 lines
Quoted 6 lines
not yet implemented other properties, such as clocks, fan-supply, pwms, etc. So I just introduced the "compatible" and "reg" properties.
In the near future, if any other properties are necessary, I think we will implement them in
drivers/hwmon/max31790.cthen update this binding document.Please instead read:
Documentation/devicetree/bindings/writing-bindings.rstQuoted 5 lines
I look at other binding documents, I also see something similar. They just introduce the "compatible" and "reg" properties.
Maybe these devices are similar, maybe not. This should not be excuse to come with really incomplete binding.
...
Quoted 2 lines
I think "fan-controller" is a good node name. Do you think so?
Yes.
Best regards,
Krzysztof
PATCH 2/3 hwmon: (max31790): Support config PWM output becomes TACH
In reply to Chanh NguyenPWMOUT pins on MAX31790 can be configured as a tachometer input pin by setting bit[0] in the Configuration Register. When the bit[0] of a channel is set, the PWMOUT pin becomes the tach input pin for the channel plus six.
This commit allows the kernel to set those pins when necessary if the pwmout-pin-as-tach-input DT property exists.
--- drivers/hwmon/max31790.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/hwmon/max31790.c +31 -0
@@ -12,6 +12,7 @@#include <linux/init.h> #include <linux/jiffies.h> #include <linux/module.h> +#include <linux/property.h> #include <linux/slab.h> /* MAX31790 registers */
@@ -506,9 +507,12 @@ static int max31790_probe(struct i2c_client *client) {struct i2c_adapter *adapter = client->adapter;struct device *dev = &client->dev; +u8 pwmout_to_tach[NR_CHANNEL ];struct max31790_data *data;struct device *hwmon_dev;int err; +u8 tmp; +int i;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA |I2C_FUNC_SMBUS_WORD_DATA ))
@@ -528,6 +532,33 @@ static int max31790_probe(struct i2c_client *client)if (err)return err; +if (device_property_present (dev,"pwmout-pin-as-tach-input" )) { + err =device_property_read_u8_array (dev,"pwmout-pin-as-tach-input" , + pwmout_to_tach,NR_CHANNEL ); +if (err) { +/* The pwmout-pin-as-tach-input is an array of six values */ +dev_warn (dev,"The pwmout-pin-as-tach-input property exist but malform" ); + }else { +for (i =0 ; i <NR_CHANNEL ; i++) { + tmp = data->fan_config[i]; +if (pwmout_to_tach[i]) + data->fan_config[i] |=MAX31790_FAN_CFG_TACH_INPUT ; +else + data->fan_config[i] &= ~(MAX31790_FAN_CFG_TACH_INPUT ); + +if (tmp != data->fan_config[i]) { + err =i2c_smbus_write_byte_data (client, +MAX31790_REG_FAN_CONFIG (i), + data->fan_config[i]); +if (err <0 ) +dev_warn (dev, +"Fail to apply fan configuration at channel %d" , + i); + } + } + } + } + hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, data, &max31790_chip_info,
Signature · 1 line
2.17.1
PATCH 3/3 dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
In reply to Chanh NguyenAdd pwmout-pin-as-tach-input property.
--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/hwmon/max31790.yaml +11 -0
@@ -25,6 +25,16 @@ properties: reg: maxItems: 1 + pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array + maxItems: 6 + minItems: 6 + required: - compatible - reg
@@ -40,5 +50,6 @@ examples: max31790@20 { compatible = "maxim,max31790"; reg = <0x20>; + pwmout-pin-as-tach-input = /bits/ 8 <0 0 0 0 1 1>; }; };
Signature · 1 line
2.17.1
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 1 line · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Why is this split from original binding? This does not make much sense... Add complete hardware description.
Quoted 11 lines
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 33
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +6
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1 + pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input
No vendor prefix, so generic property... but where is it defined?
Best regards,
Krzysztof
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 6 lines · Krzysztof Kozlowski
Quoted 1 line · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Why is this split from original binding? This does not make much sense... Add complete hardware description.
Ok Krzysztof, I will merg the "[PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings" commit and "[PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property" commit.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 33
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +6
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH inputNo vendor prefix, so generic property... but where is it defined?
Thank Krzysztof! It is not generic property, I'll add the vendor prefix.
I'll update the "pwmout-pin-as-tach-input" to "maxim,pwmout-pin-as-tach-input" at v2.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 6 lines · Chanh Nguyen
Quoted 3 lines · Krzysztof Kozlowski
Quoted 1 line · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Quoted 7 lines
Quoted 3 lines
Why is this split from original binding? This does not make much sense... Add complete hardware description.
Ok Krzysztof, I will merg the "[PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings" commit and "[PATCH 3/3] dt-bindings: hwmon:
max31790: Add pwmout-pin-as-tach-input property" commit.
Later I checked your driver code and this explains a bit. However first patch should explain that instead. The split is fine, but just lack of rationale is confusing.
Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 33
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +6
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH inputNo vendor prefix, so generic property... but where is it defined?
Quoted 4 lines
Thank Krzysztof! It is not generic property, I'll add the vendor prefix.
I'll update the "pwmout-pin-as-tach-input" to
"maxim,pwmout-pin-as-tach-input" at v2.
Except that you should really look into common properties and use them. Or explain why do you need new property?
Best regards,
Krzysztof
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Chanh Nguyen
Quoted 6 lines · Krzysztof Kozlowski
Quoted 1 line · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Why is this split from original binding? This does not make much sense... Add complete hardware description.
Quoted 8 lines
Quoted 3 lines
Ok Krzysztof, I will merg the "[PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings" commit and "[PATCH 3/3] dt-bindings: hwmon:
max31790: Add pwmout-pin-as-tach-input property" commit.Later I checked your driver code and this explains a bit. However first patch should explain that instead. The split is fine, but just lack of rationale is confusing.
Thank Krzysztof. I'll try to explain in detail each patch in v2.
Quoted 28 lines
Quoted 28 lines
Quoted 16 lines
Quoted 16 lines
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 33
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +6
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH inputNo vendor prefix, so generic property... but where is it defined?
Thank Krzysztof! It is not generic property, I'll add the vendor prefix.
Quoted 9 lines
Quoted 2 lines
I'll update the "pwmout-pin-as-tach-input" to
"maxim,pwmout-pin-as-tach-input" at v2.Except that you should really look into common properties and use them. Or explain why do you need new property?
Best regards,
Krzysztof
I'm also discussing with Rob Herring that on patch 3/3, I checked in the Documentation/devicetree/bindings/hwmon/fan-common.yaml. I found the tach-ch property, but it seems to define the tach channel used for the fan. It does not match my purpose. I want to configure the PWM-OUT pin to become a TACH-IN pin. I wonder if I can use the tach-ch property for my purpose.
Rob Herring
maintainerRe: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
In reply to Chanh NguyenQuoted 14 lines · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 36
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +9
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array + maxItems: 6 + minItems: 6
Seems incomplete. For example, fan tachs have different number of pulses per revolution, don't you need to know that too?
There's a common fan binding now (or pending). You should use that and this property won't be needed.
Rob
Guenter Roeck
maintainerRe: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 16 lines · Rob Herring
Quoted 15 lines · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 36
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +9
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array + maxItems: 6 + minItems: 6Seems incomplete. For example, fan tachs have different number of pulses per revolution, don't you need to know that too?
Per Documentation/ABI/testing/sysfs-class-hwmon:
What: /sys/class/hwmon/hwmonX/fanY_pulses
Description:
Number of tachometer pulses per fan revolution.
Integer value, typically between 1 and 4.
RW
This value is a characteristic of the fan connected to the device's input, so it has to be set in accordance with the fan model.
Should only be created if the chip has a register to configure the number of pulses. In the absence of such a register (and thus attribute) the value assumed by all devices is 2 pulses per fan revolution.
We only expect the property (and attribute) to exist if the controller supports it.
Guenter
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 53 lines · Guenter Roeck
Quoted 19 lines · Rob Herring
Quoted 18 lines · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Signed-off-by Chanh Nguyen <[email protected]>---
Documentation/devicetree/bindings/hwmon/max31790.yaml| 11 +++++++++++1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties:reg:
maxItems: 1
+ pwmout-pin-as-tach-input:
+ description: |
+ An array of six integers responds to six PWM channels for + configuring the pwm to tach mode.Quoted 9 lines
Quoted 5 lines
+ When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array
+ maxItems: 6
+ minItems: 6Seems incomplete. For example, fan tachs have different number of pulses per revolution, don't you need to know that too?
Per
Documentation/ABI/testing/sysfs-class-hwmon:What:
/sys/class/hwmon/hwmonX/fanY_pulsesDescription:
Number of tachometer pulses per fan revolution.Integer value, typically between 1 and 4.
RW
This value is a characteristic of the fan connected to the device's input, so it has to be set in accordance with
the fan
model.Should only be created if the chip has a register to
configure
the number of pulses. In the absence of such a register
(and
thus attribute) the value assumed by all devices is 2
pulses
per fan revolution.
Quoted 5 lines
We only expect the property (and attribute) to exist if the controller supports it.
Guenter
Hi Guenter and Rob,
Most general-purpose brushless DC fans produce two tachometer pulses per revolution. My fan devices also produce two tachometer pulses per revolution.
In max31790.c, I saw the formula that is used to calculate TACH Count Registers, which defines the pulses per revolution as 2
#define RPM_TO_REG(rpm, sr) ((60 * (sr) * 8192) / ((rpm) * 2))
Do you think we should support the pulses-per-revolution property in this case?
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
In reply to Rob HerringQuoted 29 lines · Rob Herring
Quoted 14 lines · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Signed-off-by Chanh Nguyen <[email protected]>--- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties: reg: maxItems: 1Documentation/devicetree/bindings/hwmon/max31790.yaml properties: · line 36
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/max31790.yaml +9
-0+ pwmout-pin-as-tach-input: + description: | + An array of six integers responds to six PWM channels for + configuring the pwm to tach mode. + When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array + maxItems: 6 + minItems: 6Seems incomplete. For example, fan tachs have different number of pulses per revolution, don't you need to know that too?
Quoted 4 lines
There's a common fan binding now (or pending). You should use that and this property won't be needed.
Rob
Thank Rob,
I checked in the Documentation/devicetree/bindings/hwmon/fan-common.yaml. I found the tach-ch property, but it seems define the tach channel used for fan.
tach-ch:
description:
The tach channel used for the fan.
$ref: /schemas/types.yaml#/definitions/uint8-array
I would like to define a new vendor property to configure the PWM-OUT pin to become a TACH-IN pin. So I introduce the "maxim,pwmout-pin-as-tach-input" property. Please help me share your comments!
Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property
Quoted 38 lines · Chanh Nguyen
Quoted 28 lines · Rob Herring
Quoted 15 lines · Chanh Nguyen
Add pwmout-pin-as-tach-input property.
Signed-off-by Chanh Nguyen <[email protected]>---
Documentation/devicetree/bindings/hwmon/max31790.yaml| 11 +++++++++++1 file changed, 11 insertions(+)Documentation/devicetree/bindings/hwmon/max31790.yaml +0
-0@@ -25,6 +25,16 @@ properties:reg:
maxItems: 1
+ pwmout-pin-as-tach-input:Quoted 8 lines
+ description: |
+ An array of six integers responds to six PWM channels for + configuring the pwm to tach mode.
+ When set to 0, the associated PWMOUT produces a PWM waveform for + control of fan speed. When set to 1, PWMOUT becomes a TACH input + $ref: /schemas/types.yaml#/definitions/uint8-array
+ maxItems: 6
+ minItems: 6Seems incomplete. For example, fan tachs have different number of pulses per revolution, don't you need to know that too?
Quoted 4 lines
There's a common fan binding now (or pending). You should use that and this property won't be needed.
Rob
Thank Rob,
Quoted 8 lines
I checked in the
Documentation/devicetree/bindings/hwmon/fan-common.yaml. I found the tach-ch property, but it seems define the tach channel used for fan.tach-ch:
description:
The tach channel used for the fan. $ref: /schemas/types.yaml#/definitions/uint8-arrayI would like to define a new vendor property to configure the PWM-OUT pin to become a TACH-IN pin. So I introduce the "maxim,pwmout-pin-as-tach-input" property. Please help me share your comments!
Hi Guenter and Rob,
I'm preparing for patch v2. I'm looking forward to hear your advice. Should I use the "tach-ch" property (a common fan property) or define new vendor property ("maxim,pwmout-pin-as-tach-input") for my purpose?
Thank you very much!
Chanh