* [PATCH v2 0/2] Add JHB100 Fan-Tach support
@ 2026-08-19 9:15 Changhuang Liang
2026-08-19 9:16 ` [PATCH v2 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach Changhuang Liang
0 siblings, 1 reply; 2+ messages in thread
From: Changhuang Liang @ 2026-08-19 9:15 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-kernel, linux-hwmon, devicetree, Changhuang Liang
StarFive Fan-Tach controller can support up to 16 fan tach input.
The series has been tested on the EVB1 board.
Change since v1:
PATCH 1:
- Add explicit minItems/maxItems and range constraints for tach-ch.
- Switch fan node regex to support hex addresses.
- Add pulses-per-revolution demo.
- Rename example node to fan-controller for consistency.
- Limit the reg property to a maximum value of 15
- Fix tach-ch example by changing /bits/ 8 <0x0>, <0x8> to
/bits/ 8 <0x0 0x8> so both values are parsed as 8-bit cells.
PATCH 2:
- Added hwmon documentation (starfive-fan-tach.rst)
- Added HAS_IOMEM dependency in Kconfig
- Added per-channel pulses-per-revolution DT property (default 2, range 1-4)
- Added mutex and spinlock for proper concurrency protection
- Added armed_stall/armed_slow mechanism to prevent spurious interrupts
- Added retry logic for zero sampling value in rpm read
- Improved probe sequence: clock enable before reset deassert
- Added devm action for remove path cleanup
- Added input validation for write operations
- Added MODULE_DEVICE_TABLE
- Added linux-hwmon mailing list to MAINTAINERS
v1: https://lore.kernel.org/all/20260428082337.743546-1-changhuang.liang@starfivetech.com/
Changhuang Liang (2):
dt-bindings: hwmon: Add starfive,jhb100-fan-tach
hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100
.../hwmon/starfive,jhb100-fan-tach.yaml | 93 +++
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/starfive-fan-tach.rst | 34 ++
MAINTAINERS | 8 +
drivers/hwmon/Kconfig | 14 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/starfive-fan-tach.c | 561 ++++++++++++++++++
7 files changed, 712 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
create mode 100644 Documentation/hwmon/starfive-fan-tach.rst
create mode 100644 drivers/hwmon/starfive-fan-tach.c
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach
2026-08-19 9:15 [PATCH v2 0/2] Add JHB100 Fan-Tach support Changhuang Liang
@ 2026-08-19 9:16 ` Changhuang Liang
0 siblings, 0 replies; 2+ messages in thread
From: Changhuang Liang @ 2026-08-19 9:16 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-kernel, linux-hwmon, devicetree, Changhuang Liang
Add compatible "starfive,jhb100-fan-tach" for StarFive JHB100 Fan-Tach
controller.
Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
---
.../hwmon/starfive,jhb100-fan-tach.yaml | 93 +++++++++++++++++++
1 file changed, 93 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
diff --git a/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml b/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
new file mode 100644
index 000000000000..1dcd4932768f
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/starfive,jhb100-fan-tach.yaml
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/starfive,jhb100-fan-tach.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JHB100 Fan-Tach controller
+
+maintainers:
+ - Changhuang Liang <changhuang.liang@starfivetech.com>
+
+description:
+ The StarFive Fan-Tach controller can support up to 16 fan tach input.
+
+properties:
+ compatible:
+ enum:
+ - starfive,jhb100-fan-tach
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ resets:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+patternProperties:
+ "^fan@[0-9a-f]+$":
+ $ref: fan-common.yaml#
+ unevaluatedProperties: false
+
+ properties:
+ reg:
+ description:
+ PWM channel index. The driver allows two fans to share the same
+ PWM channel, or each fan to use a dedicated channel.
+ maximum: 15
+
+ tach-ch:
+ description:
+ The tachometer channel(s) wired to the fan(s) driven by this PWM
+ channel. Integer values in the range 0-15.
+ minItems: 1
+ maxItems: 2
+ items:
+ maximum: 15
+
+ required:
+ - reg
+ - tach-ch
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - resets
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ fan-controller@11be0000 {
+ compatible = "starfive,jhb100-fan-tach";
+ reg = <0x11be0000 0x400>;
+ interrupts = <128>;
+ clocks = <&per2crg 33>;
+ resets = <&per2crg 5>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ fan@0 {
+ reg = <0x0>;
+ tach-ch = /bits/ 8 <0x0 0x8>;
+ pulses-per-revolution = <2>;
+ };
+ fan@1 {
+ reg = <0x1>;
+ tach-ch = /bits/ 8 <0x1>;
+ pulses-per-revolution = <2>;
+ };
+ };
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-19 10:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 9:15 [PATCH v2 0/2] Add JHB100 Fan-Tach support Changhuang Liang
2026-08-19 9:16 ` [PATCH v2 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach Changhuang Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox