Skip to content

Commit 7f2958e

Browse files
esmilgroeck
authored andcommitted
hwmon: (sfctemp) Add StarFive JH71x0 temperature sensor
Add driver for the StarFive JH71x0 temperature sensor. You can enable/disable it and read temperature in milli Celcius through sysfs. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Co-developed-by: Samin Guo <samin.guo@starfivetech.com> Signed-off-by: Samin Guo <samin.guo@starfivetech.com> Signed-off-by: Hal Feng <hal.feng@starfivetech.com> Link: https://lore.kernel.org/r/20230321022644.107027-3-hal.feng@starfivetech.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent d16718f commit 7f2958e

6 files changed

Lines changed: 384 additions & 0 deletions

File tree

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Hardware Monitoring Kernel Drivers
184184
sch5627
185185
sch5636
186186
scpi-hwmon
187+
sfctemp
187188
sht15
188189
sht21
189190
sht3x

Documentation/hwmon/sfctemp.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Kernel driver sfctemp
4+
=====================
5+
6+
Supported chips:
7+
- StarFive JH7100
8+
- StarFive JH7110
9+
10+
Authors:
11+
- Emil Renner Berthing <kernel@esmil.dk>
12+
13+
Description
14+
-----------
15+
16+
This driver adds support for reading the built-in temperature sensor on the
17+
JH7100 and JH7110 RISC-V SoCs by StarFive Technology Co. Ltd.
18+
19+
``sysfs`` interface
20+
-------------------
21+
22+
The temperature sensor can be enabled, disabled and queried via the standard
23+
hwmon interface in sysfs under ``/sys/class/hwmon/hwmonX`` for some value of
24+
``X``:
25+
26+
================ ==== =============================================
27+
Name Perm Description
28+
================ ==== =============================================
29+
temp1_enable RW Enable or disable temperature sensor.
30+
Automatically enabled by the driver,
31+
but may be disabled to save power.
32+
temp1_input RO Temperature reading in milli-degrees Celsius.
33+
================ ==== =============================================

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18908,6 +18908,14 @@ S: Supported
1890818908
F: Documentation/networking/devlink/sfc.rst
1890918909
F: drivers/net/ethernet/sfc/
1891018910

18911+
SFCTEMP HWMON DRIVER
18912+
M: Emil Renner Berthing <kernel@esmil.dk>
18913+
L: linux-hwmon@vger.kernel.org
18914+
S: Maintained
18915+
F: Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml
18916+
F: Documentation/hwmon/sfctemp.rst
18917+
F: drivers/hwmon/sfctemp.c
18918+
1891118919
SFF/SFP/SFP+ MODULE SUPPORT
1891218920
M: Russell King <linux@armlinux.org.uk>
1891318921
L: netdev@vger.kernel.org

drivers/hwmon/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,16 @@ config SENSORS_STTS751
19291929
This driver can also be built as a module. If so, the module
19301930
will be called stts751.
19311931

1932+
config SENSORS_SFCTEMP
1933+
tristate "Starfive JH71x0 temperature sensor"
1934+
depends on ARCH_STARFIVE || COMPILE_TEST
1935+
help
1936+
If you say yes here you get support for temperature sensor
1937+
on the Starfive JH71x0 SoCs.
1938+
1939+
This driver can also be built as a module. If so, the module
1940+
will be called sfctemp.
1941+
19321942
config SENSORS_SMM665
19331943
tristate "Summit Microelectronics SMM665"
19341944
depends on I2C

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ obj-$(CONFIG_SENSORS_SBRMI) += sbrmi.o
181181
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
182182
obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
183183
obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
184+
obj-$(CONFIG_SENSORS_SFCTEMP) += sfctemp.o
184185
obj-$(CONFIG_SENSORS_SL28CPLD) += sl28cpld-hwmon.o
185186
obj-$(CONFIG_SENSORS_SHT15) += sht15.o
186187
obj-$(CONFIG_SENSORS_SHT21) += sht21.o

0 commit comments

Comments
 (0)