* [PATCH 0/3] Update the max31790 driver @ 2024-03-11 11:13 Chanh Nguyen 2024-03-11 11:13 ` [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings Chanh Nguyen ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-11 11:13 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen, Chanh Nguyen 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 -- 2.17.1 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-11 11:13 [PATCH 0/3] Update the max31790 driver Chanh Nguyen @ 2024-03-11 11:13 ` Chanh Nguyen 2024-03-11 16:55 ` Krzysztof Kozlowski 2024-03-11 11:13 ` [PATCH 2/3] hwmon: (max31790): Support config PWM output becomes TACH Chanh Nguyen 2024-03-11 11:13 ` [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property Chanh Nguyen 2 siblings, 1 reply; 19+ messages in thread From: Chanh Nguyen @ 2024-03-11 11:13 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen, Chanh Nguyen Add a device tree bindings for max31790 device. Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> --- .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml new file mode 100644 index 000000000000..5a93e6bdebda --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml @@ -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 <jdelvare@suse.com> + - Guenter Roeck <linux@roeck-us.net> + +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>; + }; + }; -- 2.17.1 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-11 11:13 ` [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings Chanh Nguyen @ 2024-03-11 16:55 ` Krzysztof Kozlowski 2024-03-18 9:51 ` Chanh Nguyen 0 siblings, 1 reply; 19+ messages in thread From: Krzysztof Kozlowski @ 2024-03-11 16:55 UTC (permalink / raw) To: Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 11/03/2024 12:13, Chanh Nguyen wrote: > 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. > > Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> > --- > .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ > 1 file changed, 44 insertions(+) > create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml > > diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml > new file mode 100644 > index 000000000000..5a93e6bdebda > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml Filename like compatible. > @@ -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 <jdelvare@suse.com> > + - Guenter Roeck <linux@roeck-us.net> You should have here someone responsible for hardware, not subsystem maintainers. > + > +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 That's weirdly empty. > + > +required: > + - compatible > + - reg > + You miss allOf: with $ref to fan controller schema. > +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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-11 16:55 ` Krzysztof Kozlowski @ 2024-03-18 9:51 ` Chanh Nguyen 2024-03-18 10:00 ` Krzysztof Kozlowski 0 siblings, 1 reply; 19+ messages in thread From: Chanh Nguyen @ 2024-03-18 9:51 UTC (permalink / raw) To: Krzysztof Kozlowski, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 11/03/2024 23:55, Krzysztof Kozlowski wrote: > On 11/03/2024 12:13, Chanh Nguyen wrote: >> Add a device tree bindings for max31790 device. > > Subject: drop "driver", bindings are about hardware. > Yes, I'll drop "driver" at v2 updating. > 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. > 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' >> >> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >> --- >> .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ >> 1 file changed, 44 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml >> >> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> new file mode 100644 >> index 000000000000..5a93e6bdebda >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml > > Filename like compatible. Yes, I'll update that in v2 > >> @@ -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 <jdelvare@suse.com> >> + - Guenter Roeck <linux@roeck-us.net> > > 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 <linux@roeck-us.net> as an important maintainer. I saw many commits from him. So, I add him to maintainer list. >> + >> +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 > > That's weirdly empty. > Hi Krzysztof, I have not yet understood your comment here. Please help give more details for my missing! Thank Krzysztof! >> + >> +required: >> + - compatible >> + - reg >> + > > You miss allOf: with $ref to fan controller schema. > Thank Krzysztof, I'll add the allOf at v2. >> +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 > I suggest some node names, such as "i2c-fan" or "fan-controller" . Can you please share your ideas with me! > > Best regards, > Krzysztof > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-18 9:51 ` Chanh Nguyen @ 2024-03-18 10:00 ` Krzysztof Kozlowski 2024-03-22 9:53 ` Chanh Nguyen 0 siblings, 1 reply; 19+ messages in thread From: Krzysztof Kozlowski @ 2024-03-18 10:00 UTC (permalink / raw) To: Chanh Nguyen, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 18/03/2024 10:51, Chanh Nguyen wrote: > >> 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. >> > > > 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. > > => 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' > >>> >>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>> --- >>> .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ >>> 1 file changed, 44 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> new file mode 100644 >>> index 000000000000..5a93e6bdebda >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> >> Filename like compatible. > > Yes, I'll update that in v2 > >> >>> @@ -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 <jdelvare@suse.com> >>> + - Guenter Roeck <linux@roeck-us.net> >> >> 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 <linux@roeck-us.net> as an important maintainer. I saw many > commits from him. So, I add him to maintainer list. OK > >>> + >>> +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 >> >> That's weirdly empty. >> > > 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. >>> + >>> +required: >>> + - compatible >>> + - reg >>> + >> >> You miss allOf: with $ref to fan controller schema. >> > > Thank Krzysztof, > I'll add the allOf at v2. > >>> +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 >> > > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-18 10:00 ` Krzysztof Kozlowski @ 2024-03-22 9:53 ` Chanh Nguyen 2024-03-25 8:32 ` Krzysztof Kozlowski 0 siblings, 1 reply; 19+ messages in thread From: Chanh Nguyen @ 2024-03-22 9:53 UTC (permalink / raw) To: Krzysztof Kozlowski, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 18/03/2024 17:00, Krzysztof Kozlowski wrote: > On 18/03/2024 10:51, Chanh Nguyen wrote: >> >>> 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. >>> >> >> >> 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. > >> >> => 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' >> >>>> >>>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>>> --- >>>> .../devicetree/bindings/hwmon/max31790.yaml | 44 +++++++++++++++++++ >>>> 1 file changed, 44 insertions(+) >>>> create mode 100644 Documentation/devicetree/bindings/hwmon/max31790.yaml >>>> >>>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>>> new file mode 100644 >>>> index 000000000000..5a93e6bdebda >>>> --- /dev/null >>>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> >>> Filename like compatible. >> >> Yes, I'll update that in v2 >> >>> >>>> @@ -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 <jdelvare@suse.com> >>>> + - Guenter Roeck <linux@roeck-us.net> >>> >>> 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 <linux@roeck-us.net> as an important maintainer. I saw many >> commits from him. So, I add him to maintainer list. > > OK > >> >>>> + >>>> +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 >>> >>> That's weirdly empty. >>> >> >> 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. https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/hwmon/adi,max31760.yaml https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/hwmon/adt7475.yaml https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/hwmon/adi,ad741x.yaml This is only my view. It's a pleasure to hear your advice. Thanks! > >>>> + >>>> +required: >>>> + - compatible >>>> + - reg >>>> + >>> >>> You miss allOf: with $ref to fan controller schema. >>> >> >> Thank Krzysztof, >> I'll add the allOf at v2. >> >>>> +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 >>> >> >> 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? > Best regards, > Krzysztof > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-22 9:53 ` Chanh Nguyen @ 2024-03-25 8:32 ` Krzysztof Kozlowski 2024-03-26 10:26 ` Chanh Nguyen 0 siblings, 1 reply; 19+ messages in thread From: Krzysztof Kozlowski @ 2024-03-25 8:32 UTC (permalink / raw) To: Chanh Nguyen, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 22/03/2024 10:53, Chanh Nguyen wrote: >>>> >>> >>> 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 Binding should be based on device (e.g. its datasheet), not the driver. > 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. Please instead read: Documentation/devicetree/bindings/writing-bindings.rst > > I look at other binding documents, I also see something similar. They > just introduce the "compatible" and "reg" properties. > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/hwmon/adi,max31760.yaml Maybe these devices are similar, maybe not. This should not be excuse to come with really incomplete binding. ... > I think "fan-controller" is a good node name. Do you think so? > Yes. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings 2024-03-25 8:32 ` Krzysztof Kozlowski @ 2024-03-26 10:26 ` Chanh Nguyen 0 siblings, 0 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-26 10:26 UTC (permalink / raw) To: Krzysztof Kozlowski, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 25/03/2024 15:32, Krzysztof Kozlowski wrote: > On 22/03/2024 10:53, Chanh Nguyen wrote: >>>>> >>>> >>>> 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 > > Binding 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. >> 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. > > Please instead read: > Documentation/devicetree/bindings/writing-bindings.rst > >> >> I look at other binding documents, I also see something similar. They >> just introduce the "compatible" and "reg" properties. >> >> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/hwmon/adi,max31760.yaml > > Maybe these devices are similar, maybe not. This should not be excuse to > come with really incomplete binding. > > ... > >> I think "fan-controller" is a good node name. Do you think so? >> > > Yes. > > Best regards, > Krzysztof > ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/3] hwmon: (max31790): Support config PWM output becomes TACH 2024-03-11 11:13 [PATCH 0/3] Update the max31790 driver Chanh Nguyen 2024-03-11 11:13 ` [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings Chanh Nguyen @ 2024-03-11 11:13 ` Chanh Nguyen 2024-03-11 11:13 ` [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property Chanh Nguyen 2 siblings, 0 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-11 11:13 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen, Chanh Nguyen PWMOUT 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. Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> --- drivers/hwmon/max31790.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c index 3dc95196b229..33ca8d1721c0 100644 --- a/drivers/hwmon/max31790.c +++ b/drivers/hwmon/max31790.c @@ -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, -- 2.17.1 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 11:13 [PATCH 0/3] Update the max31790 driver Chanh Nguyen 2024-03-11 11:13 ` [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings Chanh Nguyen 2024-03-11 11:13 ` [PATCH 2/3] hwmon: (max31790): Support config PWM output becomes TACH Chanh Nguyen @ 2024-03-11 11:13 ` Chanh Nguyen 2024-03-11 16:56 ` Krzysztof Kozlowski 2024-03-11 17:34 ` Rob Herring 2 siblings, 2 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-11 11:13 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen, Chanh Nguyen Add pwmout-pin-as-tach-input property. Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> --- Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml index 5a93e6bdebda..447cac17053a 100644 --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml @@ -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>; }; }; -- 2.17.1 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 11:13 ` [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property Chanh Nguyen @ 2024-03-11 16:56 ` Krzysztof Kozlowski 2024-03-18 9:48 ` Chanh Nguyen 2024-03-11 17:34 ` Rob Herring 1 sibling, 1 reply; 19+ messages in thread From: Krzysztof Kozlowski @ 2024-03-11 16:56 UTC (permalink / raw) To: Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 11/03/2024 12:13, Chanh Nguyen wrote: > Add pwmout-pin-as-tach-input property. Why is this split from original binding? This does not make much sense... Add complete hardware description. > > Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> > --- > Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml > index 5a93e6bdebda..447cac17053a 100644 > --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml > +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml > @@ -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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 16:56 ` Krzysztof Kozlowski @ 2024-03-18 9:48 ` Chanh Nguyen 2024-03-18 10:02 ` Krzysztof Kozlowski 0 siblings, 1 reply; 19+ messages in thread From: Chanh Nguyen @ 2024-03-18 9:48 UTC (permalink / raw) To: Krzysztof Kozlowski, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 11/03/2024 23:56, Krzysztof Kozlowski wrote: > On 11/03/2024 12:13, Chanh Nguyen wrote: >> 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. >> >> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >> --- >> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> index 5a93e6bdebda..447cac17053a 100644 >> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> @@ -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? > 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. > > Best regards, > Krzysztof > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-18 9:48 ` Chanh Nguyen @ 2024-03-18 10:02 ` Krzysztof Kozlowski 2024-03-18 16:50 ` Chanh Nguyen 0 siblings, 1 reply; 19+ messages in thread From: Krzysztof Kozlowski @ 2024-03-18 10:02 UTC (permalink / raw) To: Chanh Nguyen, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 18/03/2024 10:48, Chanh Nguyen wrote: > > > On 11/03/2024 23:56, Krzysztof Kozlowski wrote: >> On 11/03/2024 12:13, Chanh Nguyen wrote: >>> 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. 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. > >>> >>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>> --- >>> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >>> 1 file changed, 11 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> index 5a93e6bdebda..447cac17053a 100644 >>> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> @@ -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? >> > > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-18 10:02 ` Krzysztof Kozlowski @ 2024-03-18 16:50 ` Chanh Nguyen 0 siblings, 0 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-18 16:50 UTC (permalink / raw) To: Krzysztof Kozlowski, Chanh Nguyen, Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission Cc: Phong Vo, Thang Nguyen, Quan Nguyen On 18/03/2024 17:02, Krzysztof Kozlowski wrote: > On 18/03/2024 10:48, Chanh Nguyen wrote: >> >> >> On 11/03/2024 23:56, Krzysztof Kozlowski wrote: >>> On 11/03/2024 12:13, Chanh Nguyen wrote: >>>> 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. > > 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. > >> >>>> >>>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>>> --- >>>> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >>>> 1 file changed, 11 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>>> index 5a93e6bdebda..447cac17053a 100644 >>>> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>>> @@ -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? >>> >> >> 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 > 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. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 11:13 ` [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property Chanh Nguyen 2024-03-11 16:56 ` Krzysztof Kozlowski @ 2024-03-11 17:34 ` Rob Herring 2024-03-11 17:52 ` Guenter Roeck 2024-03-18 9:53 ` Chanh Nguyen 1 sibling, 2 replies; 19+ messages in thread From: Rob Herring @ 2024-03-11 17:34 UTC (permalink / raw) To: Chanh Nguyen Cc: Jean Delvare, Guenter Roeck, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission, Phong Vo, Thang Nguyen, Quan Nguyen On Mon, Mar 11, 2024 at 06:13:47PM +0700, Chanh Nguyen wrote: > Add pwmout-pin-as-tach-input property. > > Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> > --- > Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml > index 5a93e6bdebda..447cac17053a 100644 > --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml > +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml > @@ -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 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 17:34 ` Rob Herring @ 2024-03-11 17:52 ` Guenter Roeck 2024-03-18 9:54 ` Chanh Nguyen 2024-03-18 9:53 ` Chanh Nguyen 1 sibling, 1 reply; 19+ messages in thread From: Guenter Roeck @ 2024-03-11 17:52 UTC (permalink / raw) To: Rob Herring, Chanh Nguyen Cc: Jean Delvare, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission, Phong Vo, Thang Nguyen, Quan Nguyen On 3/11/24 10:34, Rob Herring wrote: > On Mon, Mar 11, 2024 at 06:13:47PM +0700, Chanh Nguyen wrote: >> Add pwmout-pin-as-tach-input property. >> >> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >> --- >> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> index 5a93e6bdebda..447cac17053a 100644 >> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> @@ -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 > > Seems 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 17:52 ` Guenter Roeck @ 2024-03-18 9:54 ` Chanh Nguyen 0 siblings, 0 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-18 9:54 UTC (permalink / raw) To: Guenter Roeck, Rob Herring, Chanh Nguyen Cc: Jean Delvare, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission, Phong Vo, Thang Nguyen, Quan Nguyen On 12/03/2024 00:52, Guenter Roeck wrote: > On 3/11/24 10:34, Rob Herring wrote: >> On Mon, Mar 11, 2024 at 06:13:47PM +0700, Chanh Nguyen wrote: >>> Add pwmout-pin-as-tach-input property. >>> >>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>> --- >>> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >>> 1 file changed, 11 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> index 5a93e6bdebda..447cac17053a 100644 >>> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> @@ -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 >> >> Seems 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 > 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? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-11 17:34 ` Rob Herring 2024-03-11 17:52 ` Guenter Roeck @ 2024-03-18 9:53 ` Chanh Nguyen 2024-03-26 10:33 ` Chanh Nguyen 1 sibling, 1 reply; 19+ messages in thread From: Chanh Nguyen @ 2024-03-18 9:53 UTC (permalink / raw) To: Rob Herring, Chanh Nguyen Cc: Jean Delvare, Guenter Roeck, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission, Phong Vo, Thang Nguyen, Quan Nguyen On 12/03/2024 00:34, Rob Herring wrote: > On Mon, Mar 11, 2024 at 06:13:47PM +0700, Chanh Nguyen wrote: >> Add pwmout-pin-as-tach-input property. >> >> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >> --- >> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> index 5a93e6bdebda..447cac17053a 100644 >> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >> @@ -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 > > 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 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! ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property 2024-03-18 9:53 ` Chanh Nguyen @ 2024-03-26 10:33 ` Chanh Nguyen 0 siblings, 0 replies; 19+ messages in thread From: Chanh Nguyen @ 2024-03-26 10:33 UTC (permalink / raw) To: Rob Herring, Guenter Roeck, Chanh Nguyen Cc: Jean Delvare, Krzysztof Kozlowski, Conor Dooley, Justin Ledford, devicetree, linux-hwmon, linux-kernel, OpenBMC Maillist, Open Source Submission, Phong Vo, Thang Nguyen, Quan Nguyen On 18/03/2024 16:53, Chanh Nguyen wrote: > > > On 12/03/2024 00:34, Rob Herring wrote: >> On Mon, Mar 11, 2024 at 06:13:47PM +0700, Chanh Nguyen wrote: >>> Add pwmout-pin-as-tach-input property. >>> >>> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> >>> --- >>> Documentation/devicetree/bindings/hwmon/max31790.yaml | 11 +++++++++++ >>> 1 file changed, 11 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> index 5a93e6bdebda..447cac17053a 100644 >>> --- a/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> +++ b/Documentation/devicetree/bindings/hwmon/max31790.yaml >>> @@ -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 >> >> 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 > > 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! 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-03-26 10:33 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-11 11:13 [PATCH 0/3] Update the max31790 driver Chanh Nguyen 2024-03-11 11:13 ` [PATCH 1/3] dt-bindings: hwmon: Add maxim max31790 driver bindings Chanh Nguyen 2024-03-11 16:55 ` Krzysztof Kozlowski 2024-03-18 9:51 ` Chanh Nguyen 2024-03-18 10:00 ` Krzysztof Kozlowski 2024-03-22 9:53 ` Chanh Nguyen 2024-03-25 8:32 ` Krzysztof Kozlowski 2024-03-26 10:26 ` Chanh Nguyen 2024-03-11 11:13 ` [PATCH 2/3] hwmon: (max31790): Support config PWM output becomes TACH Chanh Nguyen 2024-03-11 11:13 ` [PATCH 3/3] dt-bindings: hwmon: max31790: Add pwmout-pin-as-tach-input property Chanh Nguyen 2024-03-11 16:56 ` Krzysztof Kozlowski 2024-03-18 9:48 ` Chanh Nguyen 2024-03-18 10:02 ` Krzysztof Kozlowski 2024-03-18 16:50 ` Chanh Nguyen 2024-03-11 17:34 ` Rob Herring 2024-03-11 17:52 ` Guenter Roeck 2024-03-18 9:54 ` Chanh Nguyen 2024-03-18 9:53 ` Chanh Nguyen 2024-03-26 10:33 ` Chanh Nguyen
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).