Skip to contentSkip to conversation

hwmon: Add driver for Astera Labs PT5161L retimer

PATCH Applied Cosmo Chou 2 participants 7 messages Jan 15, 2024 – Feb 2, 2024

Subsystems (4)

v4 of 6 Applied Latest is v6 →

lore
Share & tools
lore

Cosmo Chou

author
#0 lore raw

v4 cover hwmon: Add driver for Astera Labs PT5161L retimer

This driver implements support for temperature monitoring of Astera Labs PT5161L series PCIe retimer chips.

v4:
- Rebased

v3:
- Revise pt5161l.rst
- Revise the style of comments
- Remove unused pec_enable
- Add back safe access wide registers
- fix build warning

v2:
- Add "asteralabs,pt5161l" to trivial-devices.yaml
- Change naming PT516XX/pt516xx to PT5161L/pt5161l
- Separated debugfs files for health status
- Revise the style of comments
- Remove unused defines
- Remove including unused header files
- Remove unnecessary debugging messages
- Revise the data parsing for a big-endian system
- Use read_block_data instead of accessing wide registers
- Remove the debugfs files when the device is unloaded
- Add acpi_match_table

Cosmo Chou (3):
dt-bindings: vendor-prefixes: add asteralabs
dt-bindings: trivial-devices: add Astera Labs PT5161L
hwmon: Add driver for Astera Labs PT5161L retimer

 .../devicetree/bindings/trivial-devices.yaml  |   2 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 Documentation/hwmon/index.rst                 |   1 +
 Documentation/hwmon/pt5161l.rst               |  42 ++
 MAINTAINERS                                   |   7 +
 drivers/hwmon/Kconfig                         |  10 +
 drivers/hwmon/Makefile                        |   1 +
 drivers/hwmon/pt5161l.c                       | 670 ++++++++++++++++++
 8 files changed, 735 insertions(+)
 create mode 100644 Documentation/hwmon/pt5161l.rst
 create mode 100644 drivers/hwmon/pt5161l.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v4 1/3 dt-bindings: vendor-prefixes: add asteralabs

Add vendor prefix for Astera Labs, Inc.
https://www.asteralabs.com

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 02aaa1f538b2..ec8cfe1b46b0 100644
@@ -157,6 +157,8 @@ patternProperties:
     description: ASPEED Technology Inc.
   "^asrock,.*":
     description: ASRock Inc.
+  "^asteralabs,.*":
+    description: Astera Labs, Inc.
   "^asus,.*":
     description: AsusTek Computer Inc.
   "^atheros,.*":
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v4 2/3 dt-bindings: trivial-devices: add Astera Labs PT5161L

In reply to Cosmo Chou

Add dt-bindings for pt5161l temperature monitoring.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 21d1f066f875..db3e585962e4 100644
@@ -47,6 +47,8 @@ properties:
           - adi,lt7182s
             # AMS iAQ-Core VOC Sensor
           - ams,iaq-core
+            # Temperature monitoring of Astera Labs PT5161L PCIe retimer
+          - asteralabs,pt5161l
             # i2c serial eeprom (24cxx)
           - at,24c08
             # ATSHA204 - i2c h/w symmetric crypto module
Signature · 1 line
2.34.1
author
#5 lore raw

PATCH v4 3/3 hwmon: Add driver for Astera Labs PT5161L retimer

In reply to Cosmo Chou

This driver implements support for temperature monitoring of Astera Labs PT5161L series PCIe retimer chips.

This driver implementation originates from the CSDK available at

The communication protocol utilized is based on the I2C/SMBus standard.

---
 Documentation/hwmon/index.rst   |   1 +
 Documentation/hwmon/pt5161l.rst |  42 ++
 MAINTAINERS                     |   7 +
 drivers/hwmon/Kconfig           |  10 +
 drivers/hwmon/Makefile          |   1 +
 drivers/hwmon/pt5161l.c         | 670 ++++++++++++++++++++++++++++++++
 6 files changed, 731 insertions(+)
 create mode 100644 Documentation/hwmon/pt5161l.rst
 create mode 100644 drivers/hwmon/pt5161l.c
Documentation/hwmon/index.rst +1 -0
index c7ed1f73ac06..9f5f215fcb2d 100644
@@ -185,6 +185,7 @@ Hardware Monitoring Kernel Drivers
    pmbus
    powerz
    powr1220
+   pt5161l
    pxe1610
    pwm-fan
    q54sj108a2
Documentation/hwmon/pt5161l.rst new file +42 -0

42 lines not on this page · raw message

MAINTAINERS +7 -0
index 391bbb855cbe..e194246f3c5c 100644
@@ -17568,6 +17568,13 @@ F:	fs/pstore/
 F:	include/linux/pstore*
 K:	\b(pstore|ramoops)
 
+PT5161L HARDWARE MONITOR DRIVER
+M:	Cosmo Chou <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/pt5161l.rst
+F:	drivers/hwmon/pt5161l.c
+
 PTP HARDWARE CLOCK SUPPORT
 M:	Richard Cochran <[email protected]>
 L:	[email protected]
drivers/hwmon/Kconfig +10 -0
index a608264da87d..c8d86a695f66 100644
@@ -1714,6 +1714,16 @@ source "drivers/hwmon/peci/Kconfig"
 
 source "drivers/hwmon/pmbus/Kconfig"
 
+config SENSORS_PT5161L
+	tristate "Astera Labs PT5161L PCIe retimer hardware monitoring"
+	depends on I2C
+	help
+	  If you say yes here you get support for temperature monitoring
+	  on the Astera Labs PT5161L PCIe retimer.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called pt5161l.
+
 config SENSORS_PWM_FAN
 	tristate "PWM fan"
 	depends on (PWM && OF) || COMPILE_TEST
drivers/hwmon/Makefile +1 -0
index 47be39af5c03..0554d3ccb09a 100644
@@ -180,6 +180,7 @@ obj-$(CONFIG_SENSORS_PC87427)	+= pc87427.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
 obj-$(CONFIG_SENSORS_POWERZ)	+= powerz.o
 obj-$(CONFIG_SENSORS_POWR1220)  += powr1220.o
+obj-$(CONFIG_SENSORS_PT5161L)	+= pt5161l.o
 obj-$(CONFIG_SENSORS_PWM_FAN)	+= pwm-fan.o
 obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON)	+= raspberrypi-hwmon.o
 obj-$(CONFIG_SENSORS_SBTSI)	+= sbtsi_temp.o
drivers/hwmon/pt5161l.c new file +670 -0

670 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#6 lore raw
Quoted 8 lines · Cosmo Chou

This driver implements support for temperature monitoring of Astera Labs PT5161L series PCIe retimer chips.

This driver implementation originates from the CSDK available at

The communication protocol utilized is based on the I2C/SMBus standard.

That gives me:

WARNING: Improper SPDX comment style for 'drivers/hwmon/pt5161l.c', please use '//' instead #237: FILE: drivers/hwmon/pt5161l.c:1:
+/* SPDX-License-Identifier: GPL-2.0-or-later */

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #237: FILE: drivers/hwmon/pt5161l.c:1:
+/* SPDX-License-Identifier: GPL-2.0-or-later */

CHECK: struct mutex definition without comment
#304: FILE: drivers/hwmon/pt5161l.c:68:
+ struct mutex lock;

CHECK: Lines should not end with a '('
#419: FILE: drivers/hwmon/pt5161l.c:183:
+ ret = pt5161l_write_block_data(

and many more of the latter. I'd fix it up if it was just one or two, and I don't care about the mutex definition comment, but

total: 0 errors, 2 warnings, 9 checks, 755 lines checked

is just too much.

From Documentation/hwmon/submitting-patches.rst:

* Please run your patch through 'checkpatch --strict'. There should be no errors, no warnings, and few if any check messages. If there are any messages, please be prepared to explain.

Please fix and resubmit. No need to resubmit the other patches in the series, since I already applied those.

Thanks,
Guenter