hwmon: aspeed2600-pwm-tacho: Add driver support
v2 cover hwmon: aspeed2600-pwm-tacho: Add driver support
Aspeed AST2600 is a server management SoC which has 16 PWM channels and 16 fan tacho channel.
This series of patch provides AST2600 PWM/Fan tacho support in hwmon class.
The driver provides a sysfs interface, and user can configure PWM duty cycle and read current FAN speed in RPM.
Change since v1:
- dt-binding rewrote with dt schema format
- register hwmon driver with devm_hwmon_device_register_with_info()
- moving default configurations to device tree
*** BLURB HERE ***
Troy Lee (4):
dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
hwmon: Add Aspeed AST2600 support
ARM: dts: aspeed: Add Aspeed AST2600 PWM/Fan node in devicetree
hwmon: Support Aspeed AST2600 PWM/Fan tachometer
.../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++ .../hwmon/aspeed2600-pwm-tachometer.rst | 27 + Documentation/hwmon/index.rst | 1 + arch/arm/boot/dts/aspeed-ast2600-evb.dts | 152 ++++ arch/arm/boot/dts/aspeed-g6.dtsi | 10 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/aspeed2600-pwm-tacho.c | 756 ++++++++++++++++++ 8 files changed, 1094 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml create mode 100644 Documentation/hwmon/aspeed2600-pwm-tachometer.rst create mode 100644 drivers/hwmon/aspeed2600-pwm-tacho.c
Signature · 1 line
2.25.1
PATCH v2 1/4 dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
We add binding for supporting a new AST2600 PWM/Fan hwmon driver.
Changes since v1:
- dt binding with DT schema format
--- .../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +137 -0
@@ -0,0 +1,137 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/aspeed,ast2600-pwm-tachometer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASPEED AST2600 PWM and Fan Tacho controller device driver + +maintainers: + - Ryan Chen <[email protected]> + +description: | + The ASPEED PWM controller can support upto 16 PWM outputs. The ASPEED Fan Tacho + controller can support upto 16 Fan tachometer inputs. + There can be upto 16 fans supported. Each fan can have one PWM output and + one Fan tach inputs. + +properties: + compatible: + const: aspeed,ast2600-pwm-tachometer + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + "#cooling-cells": + const: 2 + + reg: + description: + Address and length of the register set for the device. + + clocks: + description: + phandle to clock provider with the clock number in the second cell + + resets: + description: + phandle to reset controller with the reset number in the second cell + +patternProperties: + "@[0-9]+$": + type: object + description: + Under fan subnode there can upto 16 child nodes, with each child node + representing a fan. There are 16 fans each fan can have one PWM port and one + Fan tach inputs. + For PWM port can be configured cooling-levels to create cooling device. + Cooling device could be bound to a thermal zone for the thermal control. + + properties: + reg: + minimum: 0 + maximum: 15 + description: + This property identify the PWM control channel of this fan. + + fan-tach-ch: + $ref: /schemas/types.yaml#/definitions/uint8 + minimum: 0 + maximum: 15 + description: + This property identify the fan tach input channel. + + pulses-per-revolution: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 2 + minimum: 1 + description: + Specify tacho pulse per revolution of the fan. + + cooling-levels: + description: + PWM duty cycle values in a range from 0 to 255 + which correspond to thermal cooling states. + + aspeed,pwm-freq: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 25000 + minimum: 24 + maximum: 780000 + description: + Specify the frequency of PWM. + + aspeed,inverse-pin: + type: boolean + description: + Inverse PWM output signal. + + aspeed,falling-point: + $ref: /schemas/types.yaml#/definitions/uint8 + default: 10 + minimum: 0 + maximum: 255 + description: + Initialize the pulse width. + + required: + - fan-tach-ch + - reg + + additionalProperties: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pwm_tacho: pwm-tacho-controller at 1e610000 { + compatible = "aspeed,ast2600-pwm-tachometer"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1e610000 0x100>; + + fan at 1 { + reg = <0x00>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x00>; + pulses-per-revolution = <2>; + }; + + fan at 2 { + reg = <0x01>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x01>; + pulses-per-revolution = <2>; + }; + }; +...
Signature · 1 line
2.25.1
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
Quoted 11 lines · Troy Lee
We add binding for supporting a new AST2600 PWM/Fan hwmon driver.
Changes since v1:
- dt binding with DT schema formatSigned-off-by Troy Lee <[email protected]>--- .../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:./Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml:108:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
dtschema/dtc warnings/errors:
See https://patchwork.ozlabs.org/patch/1425628
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Re: [PATCH v2 1/4] dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
Hi Rob,
Quoted 25 lines · Rob Herring
Quoted 11 lines · Troy Lee
We add binding for supporting a new AST2600 PWM/Fan hwmon driver.
Changes since v1:
- dt binding with DT schema formatSigned-off-by Troy Lee <[email protected]>--- .../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yamlMy bot found errors running 'make
dt_binding_check' on your patch:yamllint warnings/errors:
./Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml:108:2: [warning] wrong indentation: expected 2 but found 1 (indentation)dtschema/dtc warnings/errors:
See https://patchwork.ozlabs.org/patch/1425628
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 8 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
After install yamllint and ran 'make dt_binding_check' again, I can see the same issue. I'll fix it in v3 patch set.
Thanks,
Troy Lee
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
In reply to Troy LeeQuoted 41 lines · Troy Lee
We add binding for supporting a new AST2600 PWM/Fan hwmon driver.
Changes since v1:
- dt binding with DT schema formatSigned-off-by Troy Lee <[email protected]>--- .../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yamlDocumentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +24
-0@@ -0,0 +1,137 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/aspeed,ast2600-pwm-tachometer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASPEED AST2600 PWM and Fan Tacho controller device driver + +maintainers: + - Ryan Chen <[email protected]> + +description: | + The ASPEED PWM controller can support upto 16 PWM outputs. The ASPEED Fan Tacho + controller can support upto 16 Fan tachometer inputs. + There can be upto 16 fans supported. Each fan can have one PWM output and + one Fan tach inputs. + +properties: + compatible: + const: aspeed,ast2600-pwm-tachometer + + "#address-cells": + const: 1
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 34
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +10
-0+ + "#size-cells": + const: 0 + + "#cooling-cells": + const: 2 + + reg: + description: + Address and length of the register set for the device.
No need for generic descriptions. That's every 'reg'.
What you need is how many entries and what each one is if more than 1. If only 1, then just 'maxItems: 1'
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 38
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +4
-0+ + clocks: + description: + phandle to clock provider with the clock number in the second cell
Same here.
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 42
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +4
-0+ + resets: + description: + phandle to reset controller with the reset number in the second cell
And here.
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 45
Quoted 3 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +3
-0+ +patternProperties: + "@[0-9]+$":
If every node is a fan and there are up to 16:
^fan@[0-9a-f]$
Quoted 31 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +31
-0+ type: object + description: + Under fan subnode there can upto 16 child nodes, with each child node + representing a fan. There are 16 fans each fan can have one PWM port and one + Fan tach inputs. + For PWM port can be configured cooling-levels to create cooling device. + Cooling device could be bound to a thermal zone for the thermal control. + + properties: + reg: + minimum: 0 + maximum: 15 + description: + This property identify the PWM control channel of this fan. + + fan-tach-ch: + $ref: /schemas/types.yaml#/definitions/uint8 + minimum: 0 + maximum: 15 + description: + This property identify the fan tach input channel. + + pulses-per-revolution: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 2 + minimum: 1 + description: + Specify tacho pulse per revolution of the fan. + + cooling-levels: + description:
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 86
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +10
-0+ PWM duty cycle values in a range from 0 to 255 + which correspond to thermal cooling states. + + aspeed,pwm-freq: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 25000 + minimum: 24 + maximum: 780000 + description: + Specify the frequency of PWM.
Units? Use a unit suffix and then drop the $ref.
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 97
Quoted 11 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +11
-0+ + aspeed,inverse-pin: + type: boolean + description: + Inverse PWM output signal. + + aspeed,falling-point: + $ref: /schemas/types.yaml#/definitions/uint8 + default: 10 + minimum: 0 + maximum: 255
0-255 is already the range of uint8, so drop.
Quoted 43 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +40
-0+ description: + Initialize the pulse width. + + required: + - fan-tach-ch + - reg + + additionalProperties: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pwm_tacho: pwm-tacho-controller at 1e610000 { + compatible = "aspeed,ast2600-pwm-tachometer"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1e610000 0x100>; + + fan at 1 { + reg = <0x00>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x00>; + pulses-per-revolution = <2>; + }; + + fan at 2 { + reg = <0x01>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x01>; + pulses-per-revolution = <2>; + }; + }; +...Signature · 1 line
2.25.1
Re: [PATCH v2 1/4] dt-bindings: hwmon: Add Aspeed AST2600 PWM/Fan
Hi Rob,
Thanks for reviewing.
Quoted 72 lines · Rob Herring
Quoted 41 lines · Troy Lee
We add binding for supporting a new AST2600 PWM/Fan hwmon driver.
Changes since v1:
- dt binding with DT schema formatSigned-off-by Troy Lee <[email protected]>--- .../hwmon/aspeed,ast2600-pwm-tachometer.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yamlDocumentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +24
-0@@ -0,0 +1,137 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/aspeed,ast2600-pwm-tachometer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASPEED AST2600 PWM and Fan Tacho controller device driver + +maintainers: + - Ryan Chen <[email protected]> + +description: | + The ASPEED PWM controller can support upto 16 PWM outputs. The ASPEED Fan Tacho + controller can support upto 16 Fan tachometer inputs. + There can be upto 16 fans supported. Each fan can have one PWM output and + one Fan tach inputs. + +properties: + compatible: + const: aspeed,ast2600-pwm-tachometer + + "#address-cells": + const: 1Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 34
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +10
-0+ + "#size-cells": + const: 0 + + "#cooling-cells": + const: 2 + + reg: + description: + Address and length of the register set for the device.No need for generic descriptions. That's every 'reg'.
What you need is how many entries and what each one is if more than 1. If only 1, then just 'maxItems: 1'
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 38
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +4
-0+ + clocks: + description: + phandle to clock provider with the clock number in the second cellSame here.
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 42
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +4
-0+ + resets: + description: + phandle to reset controller with the reset number in the second cellAnd here.
Quoted 8 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 45
Quoted 3 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +3
-0+ +patternProperties: + "@[0-9]+$":If every node is a fan and there are up to 16:
^fan@[0-9a-f]$
I will update these in v3 patch set.
Quoted 35 lines
Quoted 35 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +35
-0+ type: object + description: + Under fan subnode there can upto 16 child nodes, with each child node + representing a fan. There are 16 fans each fan can have one PWM port and one + Fan tach inputs. + For PWM port can be configured cooling-levels to create cooling device. + Cooling device could be bound to a thermal zone for the thermal control. + + properties: + reg: + minimum: 0 + maximum: 15 + description: + This property identify the PWM control channel of this fan. + + fan-tach-ch: + $ref: /schemas/types.yaml#/definitions/uint8 + minimum: 0 + maximum: 15 + description: + This property identify the fan tach input channel. + + pulses-per-revolution: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 2 + minimum: 1 + description: + Specify tacho pulse per revolution of the fan. + + cooling-levels: + description: + PWM duty cycle values in a range from 0 to 255 + which correspond to thermal cooling states. + + aspeed,pwm-freq:
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 86
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + default: 25000 + minimum: 24 + maximum: 780000 + description: + Specify the frequency of PWM.Units? Use a unit suffix and then drop the $ref.
I'll change it to pwm-freq-hz.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +5
-0+ + aspeed,inverse-pin: + type: boolean + description: + Inverse PWM output signal.
Quoted 9 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml line 97
Quoted 6 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +6
-0+ + aspeed,falling-point: + $ref: /schemas/types.yaml#/definitions/uint8 + default: 10 + minimum: 0 + maximum: 2550-255 is already the range of uint8, so drop.
I'll drop it in v3.
Thanks,
Troy Lee
Quoted 43 lines
Quoted 43 lines
Documentation/devicetree/bindings/hwmon/aspeed,ast2600-pwm-tachometer.yaml new file +40
-0+ description: + Initialize the pulse width. + + required: + - fan-tach-ch + - reg + + additionalProperties: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pwm_tacho: pwm-tacho-controller at 1e610000 { + compatible = "aspeed,ast2600-pwm-tachometer"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1e610000 0x100>; + + fan at 1 { + reg = <0x00>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x00>; + pulses-per-revolution = <2>; + }; + + fan at 2 { + reg = <0x01>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x01>; + pulses-per-revolution = <2>; + }; + }; +...Signature · 1 line
2.25.1
PATCH v2 2/4 hwmon: Add Aspeed AST2600 support
In reply to Troy LeeUpdating index.rst and adding aspeed2600-pwm-tachometer.rst to address the driver.
Changes since v1:
- rename to aspeed2600-pwm-tachometer.rst
- add license identifier
--- .../hwmon/aspeed2600-pwm-tachometer.rst | 27 +++++++++++++++++++ Documentation/hwmon/index.rst | 1 + 2 files changed, 28 insertions(+) create mode 100644 Documentation/hwmon/aspeed2600-pwm-tachometer.rst
Documentation/hwmon/aspeed2600-pwm-tachometer.rst new file +27 -0
@@ -0,0 +1,27 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=================================== +Kernel driver aspeed2600-pwm-tachometer +=================================== + +Supported chips: + ASPEED AST2600 + +Authors: + Ryan Chen <[email protected]> + +Description: +------------ +This driver implements support for ASPEED AST2600 PWM and Fan Tacho +controller. The PWM controller supports upto 16 PWM outputs. The Fan tacho +controller supports up to 16 tachometer inputs. + +The driver provides the following sensor accesses in sysfs: + +=============== ======= ===================================================== +fanX_input ro provide current fan rotation value in RPM as reported + by the fan to the device. + +pwmX rw get or set PWM fan control value. This is an integer + value between 0(off) and 255(full speed). +=============== ======= =====================================================
Documentation/hwmon/index.rst +1 -0
@@ -44,6 +44,7 @@ Hardware Monitoring Kernel Drivers asb100 asc7621 aspeed-pwm-tacho + aspeed2600-pwm-tachometer bcm54140 bel-pfe bt1-pvt
Signature · 1 line
2.25.1
PATCH v2 3/4 ARM: dts: aspeed: Add Aspeed AST2600 PWM/Fan node in devicetree
In reply to Troy LeeCreate a common node in aspeed-g6.dtsi and add fan nodes for aspeed-ast2600-evb.dts file.
Changes since v1:
- rename properties name in child node
--- arch/arm/boot/dts/aspeed-ast2600-evb.dts | 152 +++++++++++++++++++++++ arch/arm/boot/dts/aspeed-g6.dtsi | 10 ++ 2 files changed, 162 insertions(+)
arch/arm/boot/dts/aspeed-ast2600-evb.dts +152 -0
@@ -23,6 +23,158 @@ memory at 80000000 { }; }; +&pwm_tacho { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pwm0_default &pinctrl_tach0_default + &pinctrl_pwm1_default &pinctrl_tach1_default + &pinctrl_pwm2_default &pinctrl_tach2_default + &pinctrl_pwm3_default &pinctrl_tach3_default + &pinctrl_pwm4_default &pinctrl_tach4_default + &pinctrl_pwm5_default &pinctrl_tach5_default + &pinctrl_pwm6_default &pinctrl_tach6_default + &pinctrl_pwm7_default &pinctrl_tach7_default + &pinctrl_pwm8g1_default &pinctrl_tach8_default + &pinctrl_pwm9g1_default &pinctrl_tach9_default + &pinctrl_pwm10g1_default &pinctrl_tach10_default + &pinctrl_pwm11g1_default &pinctrl_tach11_default + &pinctrl_pwm12g1_default &pinctrl_tach12_default + &pinctrl_pwm13g1_default &pinctrl_tach13_default + &pinctrl_pwm14g1_default &pinctrl_tach14_default + &pinctrl_pwm15g1_default &pinctrl_tach15_default>; + + fan at 1 { + reg = <0x00>; + aspeed,pwm-freq = <25000>; + aspeed,falling-point = /bits/ 8 <100>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x00>; + aspeed,tacho-div = <3>; + pulses-per-revolution = <1>; + }; + + fan at 2 { + reg = <0x01>; + aspeed,pwm-freq = <25000>; + aspeed,falling-point = /bits/ 8 <100>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x01>; + pulses-per-revolution = <1>; + }; + + fan at 3 { + reg = <0x02>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x02>; + pulses-per-revolution = <2>; + }; + + fan at 4 { + reg = <0x03>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x03>; + pulses-per-revolution = <2>; + }; + + fan at 5 { + reg = <0x04>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x04>; + pulses-per-revolution = <2>; + }; + + fan at 6 { + reg = <0x05>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x05>; + pulses-per-revolution = <2>; + }; + + fan at 7 { + reg = <0x06>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x06>; + pulses-per-revolution = <2>; + }; + + fan at 8 { + reg = <0x07>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x07>; + pulses-per-revolution = <2>; + }; + + fan at 9 { + reg = <0x08>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x08>; + pulses-per-revolution = <2>; + }; + + fan at 10 { + reg = <0x09>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x09>; + pulses-per-revolution = <2>; + }; + + fan at 11 { + reg = <0x0a>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0a>; + pulses-per-revolution = <2>; + }; + + fan at 12 { + reg = <0x0b>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0b>; + pulses-per-revolution = <2>; + }; + + fan at 13 { + reg = <0x0c>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0c>; + pulses-per-revolution = <2>; + }; + + fan at 14 { + reg = <0x0d>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0d>; + pulses-per-revolution = <2>; + }; + + fan at 15 { + reg = <0x0e>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0e>; + pulses-per-revolution = <2>; + }; + + fan at 16 { + reg = <0x0f>; + aspeed,pwm-freq = <25000>; + cooling-levels = /bits/ 8 <125 151 177 203 229 255>; + fan-tach-ch = /bits/ 8 <0x0f>; + pulses-per-revolution = <2>; + }; +}; + &mdio0 { status = "okay";
arch/arm/boot/dts/aspeed-g6.dtsi +10 -0
@@ -304,6 +304,16 @@ apb { #size-cells = <1>; ranges; + pwm_tacho: pwm-tacho-controller at 1e610000 { + compatible = "aspeed,ast2600-pwm-tachometer"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1e610000 0x100>; + clocks = <&syscon ASPEED_CLK_AHB>; + resets = <&syscon ASPEED_RESET_PWM>; + status = "disabled"; + }; + syscon: syscon at 1e6e2000 { compatible = "aspeed,ast2600-scu", "syscon", "simple-mfd"; reg = <0x1e6e2000 0x1000>;
Signature · 1 line
2.25.1
PATCH v2 4/4 hwmon: Support Aspeed AST2600 PWM/Fan tachometer
In reply to Troy LeeAdd Aspeed AST2600 PWM/Fan tacho driver. AST2600 has 16 PWM channel and 16 FAN tacho channel.
Changes since v1:
- fixed review comments
- fixed double-looped calculation of div_h and div_l
- moving configuration to device tree
- register hwmon driver with devm_hwmon_device_register_with_info()
--- drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/aspeed2600-pwm-tacho.c | 756 +++++++++++++++++++++++++++ 3 files changed, 767 insertions(+) create mode 100644 drivers/hwmon/aspeed2600-pwm-tacho.c
drivers/hwmon/Kconfig +10 -0
@@ -400,6 +400,16 @@ config SENSORS_ASPEED This driver can also be built as a module. If so, the module will be called aspeed_pwm_tacho. +config SENSORS_ASPEED2600_PWM_TACHO + tristate "ASPEED AST2600 PWM and Fan Tachometer" + depends on THERMAL || THERMAL=n + help + This driver provides support for ASPEED AST2600 PWM + and Fan Tacho controllers. + + This driver can also be built as a module. If so, the module + will be called aspeed2600-pwm-tacho. + config SENSORS_ATXP1 tristate "Attansic ATXP1 VID controller" depends on I2C
drivers/hwmon/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_SENSORS_ARM_SCPI) += scpi-hwmon.o obj-$(CONFIG_SENSORS_AS370) += as370-hwmon.o obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o obj-$(CONFIG_SENSORS_ASPEED) += aspeed-pwm-tacho.o +obj-$(CONFIG_SENSORS_ASPEED2600_PWM_TACHO) += aspeed2600-pwm-tacho.o obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o obj-$(CONFIG_SENSORS_AXI_FAN_CONTROL) += axi-fan-control.o obj-$(CONFIG_SENSORS_BT1_PVT) += bt1-pvt.o
drivers/hwmon/aspeed2600-pwm-tacho.c new file +756 -0
756 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH v2 4/4] hwmon: Support Aspeed AST2600 PWM/Fan tachometer
Thank you for the patch! Perhaps something to improve:
Hi Troy,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on joel-aspeed/for-next v5.11-rc3 next-20210113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: riscv-randconfig-r023-20210113 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 68ff52ffead2ba25cca442778ab19286000daad7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/19a51124badf28349d26657b611da77d5dfba2f1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 git checkout 19a51124badf28349d26657b611da77d5dfba2f1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/hwmon/aspeed2600-pwm-tacho.c:581:5: warning: no previous prototype for function 'aspeed_pwm_tacho_read' [-Wmissing-prototypes]
int aspeed_pwm_tacho_read(struct device *dev, enum hwmon_sensor_types type,
^
drivers/hwmon/aspeed2600-pwm-tacho.c:581:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int aspeed_pwm_tacho_read(struct device *dev, enum hwmon_sensor_types type,
^
static
>> drivers/hwmon/aspeed2600-pwm-tacho.c:615:5: warning: no previous prototype for function 'aspeed_pwm_tacho_write' [-Wmissing-prototypes]
int aspeed_pwm_tacho_write(struct device *dev, enum hwmon_sensor_types type,
^ drivers/hwmon/aspeed2600-pwm-tacho.c:615:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int aspeed_pwm_tacho_write(struct device *dev, enum hwmon_sensor_types type,
^
static
2 warnings generated.
vim +/aspeed_pwm_tacho_read +581 drivers/hwmon/aspeed2600-pwm-tacho.c
580
> 581 int aspeed_pwm_tacho_read(struct device *dev, enum hwmon_sensor_types type,
582 u32 attr, int channel, long *val)
583 {
584 struct aspeed_pwm_tachometer_data *priv = dev_get_drvdata(dev);
585 long rpm;
586
587 switch (type) {
588 case hwmon_pwm:
589 switch (attr) {
590 case hwmon_pwm_input:
591 *val = priv->pwm_channel[channel].falling;
592 break;
593 default:
594 return -EOPNOTSUPP;
595 }
596 break;
597 case hwmon_fan:
598 switch (attr) {
599 case hwmon_fan_input:
600 rpm = aspeed_get_fan_tach_ch_rpm(dev, priv, channel);
601 if (rpm < 0)
602 return rpm;
603 *val = rpm;
604 break;
605 default:
606 return -EOPNOTSUPP;
607 }
608 break;
609 default:
610 return -EOPNOTSUPP;
611 }
612 return 0;
613 }
614
> 615 int aspeed_pwm_tacho_write(struct device *dev, enum hwmon_sensor_types type, 616 u32 attr, int channel, long val)
617 {
618 switch (type) {
619 case hwmon_pwm:
620 switch (attr) {
621 case hwmon_pwm_input:
622 return set_pwm(dev, channel, val);
623 default:
624 return -EOPNOTSUPP;
625 }
626 break;
627 default:
628 return -EOPNOTSUPP;
629 }
630 return -EOPNOTSUPP;
631 }
632
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v2 4/4] hwmon: Support Aspeed AST2600 PWM/Fan tachometer
In reply to Troy LeeThank you for the patch! Perhaps something to improve:
Hi Troy,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on joel-aspeed/for-next v5.11-rc3 next-20210113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: sparc-randconfig-r021-20210113 (attached as .config) compiler: sparc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/19a51124badf28349d26657b611da77d5dfba2f1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 git checkout 19a51124badf28349d26657b611da77d5dfba2f1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/hwmon/aspeed2600-pwm-tacho.c:581:5: warning: no previous prototype for 'aspeed_pwm_tacho_read' [-Wmissing-prototypes]
581 | int aspeed_pwm_tacho_read(struct device *dev, enum hwmon_sensor_types type,
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/hwmon/aspeed2600-pwm-tacho.c:615:5: warning: no previous prototype for 'aspeed_pwm_tacho_write' [-Wmissing-prototypes] 615 | int aspeed_pwm_tacho_write(struct device *dev, enum hwmon_sensor_types type,
| ^~~~~~~~~~~~~~~~~~~~~~
vim +/aspeed_pwm_tacho_read +581 drivers/hwmon/aspeed2600-pwm-tacho.c
580
> 581 int aspeed_pwm_tacho_read(struct device *dev, enum hwmon_sensor_types type,
582 u32 attr, int channel, long *val)
583 {
584 struct aspeed_pwm_tachometer_data *priv = dev_get_drvdata(dev);
585 long rpm;
586
587 switch (type) {
588 case hwmon_pwm:
589 switch (attr) {
590 case hwmon_pwm_input:
591 *val = priv->pwm_channel[channel].falling;
592 break;
593 default:
594 return -EOPNOTSUPP;
595 }
596 break;
597 case hwmon_fan:
598 switch (attr) {
599 case hwmon_fan_input:
600 rpm = aspeed_get_fan_tach_ch_rpm(dev, priv, channel);
601 if (rpm < 0)
602 return rpm;
603 *val = rpm;
604 break;
605 default:
606 return -EOPNOTSUPP;
607 }
608 break;
609 default:
610 return -EOPNOTSUPP;
611 }
612 return 0;
613 }
614
> 615 int aspeed_pwm_tacho_write(struct device *dev, enum hwmon_sensor_types type, 616 u32 attr, int channel, long val)
617 {
618 switch (type) {
619 case hwmon_pwm:
620 switch (attr) {
621 case hwmon_pwm_input:
622 return set_pwm(dev, channel, val);
623 default:
624 return -EOPNOTSUPP;
625 }
626 break;
627 default:
628 return -EOPNOTSUPP;
629 }
630 return -EOPNOTSUPP;
631 }
632
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH v2 4/4] hwmon: Support Aspeed AST2600 PWM/Fan tachometer
Hi Kernel test robot,
Quoted 27 lines · kernel test robot
Hi Troy,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on joel-aspeed/for-next v5.11-rc3 next-20210113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: sparc-randconfig-r021-20210113 (attached as .config) compiler: sparc-linux-gcc (GCC) 9.3.0reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/19a51124badf28349d26657b611da77d5dfba2f1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Troy-Lee/hwmon-aspeed2600-pwm-tacho-Add-driver-support/20210113-151325 git checkout19a51124badf28349d26657b611da77d5dfba2f1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparcIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>
Quoted 8 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/hwmon/aspeed2600-pwm-tacho.c:581:5: warning: no previous prototype for 'aspeed_pwm_tacho_read' [-Wmissing-prototypes]581 | int aspeed_pwm_tacho_read(struct device *dev, enum
hwmon_sensor_typestype,
| ^~~~~~~~~~~~~~~~~~~~~Quoted 1 line
Quoted 1 line
drivers/hwmon/aspeed2600-pwm-tacho.c:615:5: warning: no previous prototype for 'aspeed_pwm_tacho_write' [-Wmissing-prototypes]615 | int aspeed_pwm_tacho_write(struct device *dev, enum
hwmon_sensor_typestype,
| ^~~~~~~~~~~~~~~~~~~~~~
Good catch, I'll fix it in v3 patch set.
Quoted 58 lines
vim +/aspeed_pwm_tacho_read +581
drivers/hwmon/aspeed2600-pwm-tacho.c580Quoted 1 line
581 int aspeed_pwm_tacho_read(struct device *dev, enum
hwmon_sensor_typestype,582 u32 attr, int channel, long *val)
583 { 584 struct aspeed_pwm_tachometer_data *priv = dev_get_drvdata(dev); 585 long rpm; 586 587 switch (type) { 588 case hwmon_pwm: 589 switch (attr) { 590 case hwmon_pwm_input: 591 *val = priv->pwm_channel[channel].falling; 592 break; 593 default: 594 return -EOPNOTSUPP; 595 } 596 break; 597 case hwmon_fan: 598 switch (attr) { 599 case hwmon_fan_input: 600 rpm = aspeed_get_fan_tach_ch_rpm(dev, priv, channel); 601 if (rpm < 0) 602 return rpm; 603 *val = rpm; 604 break; 605 default: 606 return -EOPNOTSUPP; 607 } 608 break; 609 default: 610 return -EOPNOTSUPP; 611 } 612 return 0; 613 } 614Quoted 1 line
615 int aspeed_pwm_tacho_write(struct device *dev, enum
hwmon_sensor_typestype,616 u32 attr, int channel, long val)
617 { 618 switch (type) { 619 case hwmon_pwm: 620 switch (attr) { 621 case hwmon_pwm_input: 622 return set_pwm(dev, channel, val); 623 default: 624 return -EOPNOTSUPP; 625 } 626 break; 627 default: 628 return -EOPNOTSUPP; 629 } 630 return -EOPNOTSUPP; 631 } 632
Quoted 3 lines
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Thanks,
Troy Lee
Guenter Roeck
maintainerRe: [PATCH v2 4/4] hwmon: Support Aspeed AST2600 PWM/Fan tachometer
In reply to Troy LeeQuoted 10 lines · Troy Lee
Add Aspeed AST2600 PWM/Fan tacho driver. AST2600 has 16 PWM channel and 16 FAN tacho channel.
Changes since v1:
- fixed review comments
- fixed double-looped calculation ofdiv_handdiv_l
- moving configuration to device tree
- register hwmon driver withdevm_hwmon_device_register_with_info()Signed-off-by Troy Lee <[email protected]>
checkpatch says:
total: 0 errors, 9 warnings, 26 checks, 779 lines checked
This is a bit much. Please run checkpatch --strict and fix the issues it reports. Please also fix the issues reported by 0-day as well as the issues reported by the bindings robot, and resubmit.
Thanks,
Guenter
Re: [PATCH v2 4/4] hwmon: Support Aspeed AST2600 PWM/Fan tachometer
Hi Guenter,
Quoted 14 lines · Guenter Roeck
Quoted 10 lines · Troy Lee
Add Aspeed AST2600 PWM/Fan tacho driver. AST2600 has 16 PWM channel and 16 FAN tacho channel.
Changes since v1:
- fixed review comments
- fixed double-looped calculation ofdiv_handdiv_l
- moving configuration to device tree
- register hwmon driver withdevm_hwmon_device_register_with_info()Signed-off-by Troy Lee <[email protected]>checkpatch says:
Quoted 8 lines
total: 0 errors, 9 warnings, 26 checks, 779 lines checked
This is a bit much. Please run checkpatch --strict and fix the issues it reports. Please also fix the issues reported by 0-day as well as the issues reported by the bindings robot, and resubmit.
Thanks,
Guenter
I'll fix the WARNINGs and CHECKs.
Thanks,
Troy Lee