Skip to content

Commit 22d04b0

Browse files
authored
Merge pull request torvalds#191 from nascs/Radxa_cm3_rpi_cm4_io_emc2305
hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Spee…
2 parents 73bb55e + 02e34fc commit 22d04b0

File tree

6 files changed

+878
-0
lines changed

6 files changed

+878
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
5+
$id: http://devicetree.org/schemas/hwmon/microchip,emc2305.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Microchip EMC2305 RPM-based PWM Fan Speed Controller
9+
10+
maintainers:
11+
- Michael Shych <[email protected]>
12+
13+
description: |
14+
Microchip EMC2301/2/3/5 are RPM-based PWM Fan Controller.
15+
The Fan Controller supports up to 5 independently controlled PWM fan drives.
16+
Fan rotation speeds are reported in RPM.
17+
18+
Datasheet: https://www.microchip.com/en-us/product/EMC2305
19+
20+
additionalProperties: false
21+
22+
properties:
23+
compatible:
24+
enum:
25+
- microchip,emc2305
26+
- microchip,emc2303
27+
- microchip,emc2302
28+
- microchip,emc2301
29+
30+
reg:
31+
maxItems: 1
32+
33+
"#address-cells":
34+
const: 1
35+
36+
"#size-cells":
37+
const: 0
38+
39+
microchip,cooling-levels:
40+
description:
41+
Quantity of cooling level state.
42+
$ref: /schemas/types.yaml#/definitions/uint8
43+
minimum: 0
44+
maximum: 255
45+
46+
microchip,pwm-separate:
47+
description:
48+
This flag indicates that separate PWM setting will be used
49+
for different channels.
50+
$ref: /schemas/types.yaml#/definitions/flag
51+
52+
patternProperties:
53+
"^channel@[0-4]$":
54+
type: object
55+
56+
additionalProperties: false
57+
58+
properties:
59+
reg:
60+
items:
61+
- enum:
62+
- 0
63+
- 1
64+
- 2
65+
- 3
66+
- 4
67+
68+
pwm-min:
69+
description:
70+
Min pwm of emc2305 channel
71+
$ref: /schemas/types.yaml#/definitions/uint8
72+
minimum: 0
73+
maximum: 255
74+
75+
required:
76+
- reg
77+
78+
required:
79+
- compatible
80+
81+
82+
examples:
83+
- |
84+
i2c {
85+
#address-cells = <1>;
86+
#size-cells = <0>;
87+
88+
fan-controller@4d {
89+
compatible = "microchip,emc2305";
90+
reg = <0x4d>;
91+
#address-cells = <1>;
92+
#size-cells = <0>;
93+
microchip,pwm-separate;
94+
microchip,cooling-levels = /bits/ 8 <10>;
95+
96+
channel@0 {
97+
reg = <0>;
98+
pwm-min = /bits/ 8 <0>;
99+
};
100+
channel@1 {
101+
reg = <1>;
102+
pwm-min = /bits/ 8 <0>;
103+
};
104+
};
105+
};
106+

Documentation/hwmon/emc2305.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Kernel driver emc2305
4+
=====================
5+
6+
Supported chips:
7+
Microchip EMC2305, EMC2303, EMC2302, EMC2301
8+
9+
Addresses scanned: I2C 0x27, 0x2c, 0x2d, 0x2e, 0x2f, 0x4c, 0x4d
10+
Prefixes: 'emc2305'
11+
12+
Datasheet: Publicly available at the Microchip website :
13+
https://www.microchip.com/en-us/product/EMC2305
14+
15+
Description:
16+
-----------
17+
This driver implements support for Microchip EMC2301/2/3/5 RPM-based PWM Fan Controller.
18+
The EMC2305 Fan Controller supports up to 5 independently controlled PWM fan drives.
19+
Fan rotation speeds are reported in RPM.
20+
The driver supports the RPM-based PWM control to keep a fan at the desired speed.
21+
The driver provides the possibility to have one common PWM interface for all FANs
22+
or up to the maximum available or configured independent PWMs.
23+
24+
The driver provides the following sysfs interfaces in hwmon subsystem:
25+
26+
================= == ===================================================
27+
fan[1-5]_fault RO files for tachometers TACH1-TACH5 fault indication
28+
fan[1-5]_input RO files for tachometers TACH1-TACH5 input (in RPM)
29+
pwm[1-5] RW file for fan[1-5] target duty cycle (0..255)
30+
================= == ===================================================
31+
32+
sysfs interfaces in thermal subsystem:
33+
34+
================= == ========================================================================
35+
cur_state RW file for the current cooling state of the cooling device (0..max_state)
36+
max_state RO file for the maximum cooling state of the cooling device
37+
================= == ========================================================================
38+
39+
Configuration is possible via device tree:
40+
Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Hardware Monitoring Kernel Drivers
5858
ds620
5959
emc1403
6060
emc2103
61+
emc2305
6162
emc6w201
6263
f71805f
6364
f71882fg

drivers/hwmon/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,19 @@ config SENSORS_EMC2103
16011601
This driver can also be built as a module. If so, the module
16021602
will be called emc2103.
16031603

1604+
config SENSORS_EMC2305
1605+
tristate "Microchip EMC2305 and compatible EMC2301/2/3"
1606+
depends on I2C
1607+
imply THERMAL
1608+
help
1609+
If you say yes here you get support for the Microchip EMC2305
1610+
fan controller chips.
1611+
The Microchip EMC2305 is a fan controller for up to 5 fans.
1612+
Fan rotation speeds are reported in RPM.
1613+
1614+
This driver can also be built as a module. If so, the module
1615+
will be called emc2305.
1616+
16041617
config SENSORS_EMC6W201
16051618
tristate "SMSC EMC6W201"
16061619
depends on I2C

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ obj-$(CONFIG_SENSORS_DS620) += ds620.o
6666
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
6767
obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o
6868
obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o
69+
obj-$(CONFIG_SENSORS_EMC2305) += emc2305.o
6970
obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o
7071
obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
7172
obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o

0 commit comments

Comments
 (0)