hwmon: pmbus: Add support for Richtek RTQ2886B
Subsystems (3)
cover hwmon: pmbus: Add support for Richtek RTQ2886B
From: ChiYuan Huang <[email protected]>
The RTQ2886B is a PMBus-controlled single-output synchronous buck regulator.
The RTQ2880B and RTQ2882B are register-compatible derivatives of the RTQ2886B and are supported through the same driver.
This series adds the Devicetree binding, PMBus driver, regulator integration, and MAINTAINERS entry for these devices.
ChiYuan Huang (2):
dt-bindings: hwmon: pmbus/rtq2886b: Add Richtek RTQ2886B support
hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
.../hwmon/pmbus/richtek,rtq2886b.yaml | 60 +++++++++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/rtq2886b.rst | 54 ++++++++ MAINTAINERS | 8 ++ drivers/hwmon/pmbus/Kconfig | 19 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/rtq2886b.c | 117 ++++++++++++++++++ 7 files changed, 260 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml create mode 100644 Documentation/hwmon/rtq2886b.rst create mode 100644 drivers/hwmon/pmbus/rtq2886b.c
Signature · 1 line
2.43.0
PATCH 1/2 dt-bindings: hwmon: pmbus/rtq2886b: Add Richtek RTQ2886B support
From: ChiYuan Huang <[email protected]>
Add a Devicetree binding schema for the Richtek RTQ2886B PMBus buck regulator.
The RTQ2880B and RTQ2882B are register-compatible derivatives of the RTQ2886B and use "richtek,rtq2886b" as a fallback compatible string.
--- .../hwmon/pmbus/richtek,rtq2886b.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml
Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml new file +60 -0
@@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/pmbus/richtek,rtq2886b.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RTQ2886B PMBus Buck Regulator + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RTQ2886B is a single-output synchronous buck regulator with a + PMBus interface. + + The RTQ2880B and RTQ2882B are register-compatible derivatives of the + RTQ2886B and are supported through the same driver. The primary + difference among these devices is their maximum load current + capability and they shall use "richtek,rtq2886b" as a fallback + compatible string. + +allOf: + - $ref: /schemas/regulator/regulator.yaml# + +properties: + compatible: + oneOf: + - const: richtek,rtq2886b + + - items: + - enum: + - richtek,rtq2880b + - richtek,rtq2882b + - const: richtek,rtq2886b + + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + regulator@5e { + compatible = "richtek,rtq2882b", "richtek,rtq2886b"; + reg = <0x5e>; + regulator-name = "vcore"; + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <5500000>; + regulator-boot-on; + }; + }; +...
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 1/2] dt-bindings: hwmon: pmbus/rtq2886b: Add Richtek RTQ2886B support
Sashiko has finished reviewing this 2-patch series:
Sashiko has finished reviewing this 2-patch series:
- Patch 1: no issues found.
- Patch 2 ("hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B"): 1 potential issue (1 Low)
A detailed review has been sent as a separate reply to patch 2.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/6420e55349f8dfbc5d72408ec07bc58286fe3f10.1796005535.git.cy_huang@richtek.com
PATCH 2/2 hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
In reply to [email protected]From: ChiYuan Huang <[email protected]>
Add a PMBus driver for the Richtek RTQ2886B single-output synchronous buck regulator.
The RTQ2880B and RTQ2882B are register-compatible derivatives of the RTQ2886B and are supported by the same driver.
--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/rtq2886b.rst | 54 ++++++++++++++ MAINTAINERS | 8 +++ drivers/hwmon/pmbus/Kconfig | 19 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/rtq2886b.c | 117 +++++++++++++++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 Documentation/hwmon/rtq2886b.rst create mode 100644 drivers/hwmon/pmbus/rtq2886b.c
Documentation/hwmon/index.rst +1 -0
@@ -240,6 +240,7 @@ Hardware Monitoring Kernel Drivers q54sj108a2 qnap-mcu-hwmon raspberrypi-hwmon + rtq2886b sbrmi sbtsi_temp sch5627
Documentation/hwmon/rtq2886b.rst new file +54 -0
54 lines not on this page · raw message
MAINTAINERS +8 -0
@@ -24074,6 +24074,14 @@ F: include/linux/rhashtable.h F: lib/rhashtable.c F: lib/test_rhashtable.c +RICHTEK RTQ2886B HARDWARE MONITOR DRIVER +M: ChiYuan Huang <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml +F: Documentation/hwmon/rtq2886b.rst +F: drivers/hwmon/pmbus/rtq2886b.c + RICOH R5C592 MEMORYSTICK DRIVER M: Maxim Levitsky <[email protected]> S: Maintained
drivers/hwmon/pmbus/Kconfig +19 -0
@@ -728,6 +728,25 @@ config SENSORS_Q54SJ108A2 This driver can also be built as a module. If so, the module will be called q54sj108a2. +config SENSORS_RTQ2886B + tristate "Richtek RTQ2886B" + help + If you say yes here, you get hardware monitoring support for the + Richtek RTQ2886B and compatible PMBus regulators. + + This driver can also be built as a module. If so, the module will + be called rtq2886b. + +config SENSORS_RTQ2886B_REGULATOR + bool "Regulator support for Richtek RTQ2886B and compatible devices" + depends on SENSORS_RTQ2886B && REGULATOR + help + If you say yes here, the driver registers a regulator device for + the Richtek RTQ2886B through the PMBus regulator framework. + + This allows the regulator output to be controlled through the + regulator subsystem. + config SENSORS_STEF48H28 tristate "ST STEF48H28" help
drivers/hwmon/pmbus/Makefile +1 -0
@@ -67,6 +67,7 @@ obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.o +obj-$(CONFIG_SENSORS_RTQ2886B) += rtq2886b.o obj-$(CONFIG_SENSORS_STEF48H28) += stef48h28.o obj-$(CONFIG_SENSORS_SQ24860) += sq24860.o obj-$(CONFIG_SENSORS_STPDDC60) += stpddc60.o
drivers/hwmon/pmbus/rtq2886b.c new file +117 -0
117 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] hwmon: (pmbus/rtq2886b) positional initializer in rtq2886b_id --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] hwmon: (pmbus/rtq2886b) positional initializer in rtq2886b_id --
commit 1a2a3df8ec61adbcea8332031ede52104c13b6a1
Author: ChiYuan Huang <[email protected]>
hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
This commit adds a PMBus hwmon driver for the Richtek RTQ2886B synchronous buck regulator and its compatible derivatives (RTQ2880B and RTQ2882B).
Quoted 6 lines
drivers/hwmon/pmbus/rtq2886b.c new file +0
-0@@ -0,0 +1,117 @@
[ ... ]
drivers/hwmon/pmbus/rtq2886b.c line 96
Quoted 5 lines
drivers/hwmon/pmbus/rtq2886b.c new file +5
-0+static const struct i2c_device_id rtq2886b_id[] = { + {"rtq2886b" }, + { } +}; +MODULE_DEVICE_TABLE (i2c, rtq2886b_id);
[Severity: Low]
This isn't a bug, but new struct i2c_device_id entries should use named initializers (such as { .name = "rtq2886b" }).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/6420e55349f8dfbc5d72408ec07bc58286fe3f10.1796005535.git.cy_huang@richtek.com?part=2
Guenter Roeck
maintainerRe: [PATCH 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
In reply to [email protected]Quoted 39 lines · On 11/29/26 19:01, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add a PMBus driver for the Richtek RTQ2886B single-output synchronous buck regulator.
The RTQ2880B and RTQ2882B are register-compatible derivatives of the RTQ2886B and are supported by the same driver.
Signed-off-by ChiYuan Huang <[email protected]>--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/rtq2886b.rst | 54 ++++++++++++++ MAINTAINERS | 8 +++ drivers/hwmon/pmbus/Kconfig | 19 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/rtq2886b.c | 117 +++++++++++++++++++++++++++++++ 6 files changed, 200 insertions(+)create mode 100644
Documentation/hwmon/rtq2886b.rstcreate mode 100644drivers/hwmon/pmbus/rtq2886b.cDocumentation/hwmon/index.rst +1
-0@@ -240,6 +240,7 @@ Hardware Monitoring Kernel Drivers q54sj108a2 qnap-mcu-hwmon raspberrypi-hwmon + rtq2886b sbrmi sbtsi_temp sch5627Documentation/hwmon/rtq2886b.rst new file +1
-0@@ -0,0 +1,54 @@ +.. SPDX-License-Identifier: GPL-2.0-only
Documentation/hwmon/rtq2886b.rst line 11
Quoted 10 lines
Documentation/hwmon/rtq2886b.rst new file +10
-0+ +==================================== +Kernel driver rtq2886b +==================================== + +Supported chips: + * Richtek RTQ2886B + * Richtek RTQ2882B + * Richtek RTQ2880B +
Are there only "B" variants ? No RTQ2886A or chips without trailing letter ?
Quoted 146 lines
Documentation/hwmon/rtq2886b.rst new file +43
-0+ Prefix: 'rtq2886b' + + Addresses scanned: - + +Author: ChiYuan Huang <[email protected]> + +Description +----------- + +The RTQ2886B is a single-output synchronous buck regulator with a PMBus +interface. It exposes voltage, current, power, and temperature telemetry through +the standard PMBus hwmon interface. + +The primary difference among the devices in this series is their maximum load +current capability. The RTQ2880B, RTQ2882B, and RTQ2886B support maximum load +currents of 20 A, 16 A, and 8 A, respectively. + +Sysfs entries +------------- + +======================= ======================================================= +curr1_crit Critical output current limit +curr1_crit_alarm Output current critical alarm +curr1_input Measured output current +curr1_label "iout1" + +in1_alarm Input voltage alarm +in1_input Measured input voltage +in1_label "vin" + +in2_alarm Output voltage alarm +in2_input Measured output voltage +in2_label "vout1" +in2_rated_max Maximum rated output voltage +in2_rated_min Minimum rated output voltage + +power1_input Measured output power +power1_label "pout1" + +temp1_alarm Temperature alarm +temp1_input Measured chip temperature +======================= ======================================================= +MAINTAINERS +8
-0@@ -24074,6 +24074,14 @@ F: include/linux/rhashtable.h F: lib/rhashtable.c F: lib/test_rhashtable.c +RICHTEK RTQ2886B HARDWARE MONITOR DRIVER +M: ChiYuan Huang <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml +F: Documentation/hwmon/rtq2886b.rst +F: drivers/hwmon/pmbus/rtq2886b.c + RICOH R5C592 MEMORYSTICK DRIVER M: Maxim Levitsky <[email protected]> S: Maintaineddrivers/hwmon/pmbus/Kconfig +19
-0@@ -728,6 +728,25 @@ config SENSORS_Q54SJ108A2 This driver can also be built as a module. If so, the module will be called q54sj108a2. +config SENSORS_RTQ2886B + tristate "Richtek RTQ2886B" + help + If you say yes here, you get hardware monitoring support for the + Richtek RTQ2886B and compatible PMBus regulators. + + This driver can also be built as a module. If so, the module will + be called rtq2886b. + +config SENSORS_RTQ2886B_REGULATOR + bool "Regulator support for Richtek RTQ2886B and compatible devices" + depends on SENSORS_RTQ2886B && REGULATOR + help + If you say yes here, the driver registers a regulator device for + the Richtek RTQ2886B through the PMBus regulator framework. + + This allows the regulator output to be controlled through the + regulator subsystem. + config SENSORS_STEF48H28 tristate "ST STEF48H28" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -67,6 +67,7 @@ obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.o +obj-$(CONFIG_SENSORS_RTQ2886B) += rtq2886b.o obj-$(CONFIG_SENSORS_STEF48H28) += stef48h28.o obj-$(CONFIG_SENSORS_SQ24860) += sq24860.o obj-$(CONFIG_SENSORS_STPDDC60) += stpddc60.odrivers/hwmon/pmbus/rtq2886b.c new file +36
-0@@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Hardware monitoring driver for Richtek RTQ2886B +* +* Copyright (C) 2026 Richtek Technology Corp. +*/ + +#include <linux/errno.h> +#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include "pmbus.h" + +#define RTQ2886B_PMBUS_VOUT_MIN 0x2B +#define RTQ2886B_ONOFF_DEFAULT 0x1E +#define RTQ2886B_N_VOLTS 65535 +#define RTQ2886B_STEP_UV (1000000 / 1024) +#define RICHTEK_MFR_ID "RT" +#define RICHTEK_MFR_ID_LEN (sizeof(RICHTEK_MFR_ID) - 1) + +#if IS_ENABLED (CONFIG_SENSORS_RTQ2886B_REGULATOR ) +static const struct regulator_desc rtq2886b_reg_desc[] = { +PMBUS_REGULATOR_STEP_ONE ("regulator" ,RTQ2886B_N_VOLTS ,RTQ2886B_STEP_UV ,0 ), +}; +#endif + +static int rtq2886b_read_word_data (struct i2c_client *i2c,int page,int phase,int reg) +{ +switch (reg) { +case PMBUS_MFR_VOUT_MIN : +return pmbus_read_word_data (i2c, page, phase,RTQ2886B_PMBUS_VOUT_MIN ); +case PMBUS_MFR_VOUT_MAX : +return pmbus_read_word_data (i2c, page, phase,PMBUS_VOUT_MAX ); +default : +return -ENODATA ; + }
drivers/hwmon/pmbus/rtq2886b.c line 46
Quoted 10 lines
drivers/hwmon/pmbus/rtq2886b.c new file +10
-0+} + +static int rtq2886b_identify (struct i2c_client *i2c,struct pmbus_driver_info *info) +{ +/* +* The device powers up with PMBUS_ON_OFF_CONFIG configured for +* hardware control. Configure it for PMBus-controlled operation +* to allow regulator output enable/disable management. +*/ +return pmbus_write_byte_data (i2c,0 ,PMBUS_ON_OFF_CONFIG ,RTQ2886B_ONOFF_DEFAULT );
As the function name suggests, the identify function is supposed to _identify_ a chip, not to configure it.
Please move this code into the probe function, or alternatively rename the function to rtq2886b_configure() or similar and call it from the probe function.
Quoted 27 lines
drivers/hwmon/pmbus/rtq2886b.c new file +27
-0+} + +static const struct pmbus_driver_info rtq2886b_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .format[PSC_TEMPERATURE ] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_VOUT |PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT | +PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_VOUT |PMBUS_HAVE_STATUS_IOUT | +PMBUS_HAVE_STATUS_INPUT |PMBUS_HAVE_STATUS_TEMP , + .read_word_data = rtq2886b_read_word_data, + .identify = rtq2886b_identify, +#if IS_ENABLED(CONFIG_SENSORS_RTQ2886B_REGULATOR) + .num_regulators =ARRAY_SIZE (rtq2886b_reg_desc), + .reg_desc = rtq2886b_reg_desc, +#endif + .have_pmbus_revision = true, + .pmbus_revision =PMBUS_REV_14 , +}; + +static int rtq2886b_probe (struct i2c_client *i2c) +{ +u8 buf[I2C_SMBUS_BLOCK_MAX +1 ] = {}; +struct device *dev = &i2c->dev; +struct pmbus_driver_info *info;
drivers/hwmon/pmbus/rtq2886b.c line 83
Quoted 10 lines
drivers/hwmon/pmbus/rtq2886b.c new file +10
-0+int ret; + + ret =pmbus_read_smbus_i2c_block_data (i2c,PMBUS_MFR_ID , buf); +if (ret <0 ) +return dev_err_probe (dev, ret,"Failed to read MFR_ID\n" ); + + buf[ret] ='\0' ; + +if (ret !=RICHTEK_MFR_ID_LEN ||strncmp (buf,RICHTEK_MFR_ID ,RICHTEK_MFR_ID_LEN )) +return dev_err_probe (dev, -ENODEV ,"Expected MFR_ID 'RT', got %s\n" , buf);
'%*pE' or similar instead of '%s' might be safer here since it is not known if the manufacturer ID is printable, and it would avoid the need to add the '\0' string terminator.
Either case, just checking the manufacturer ID is an exceptionally weak validation. If there is no means to check the device ID, you might as well drop it.
drivers/hwmon/pmbus/rtq2886b.c line 87
Quoted 4 lines
drivers/hwmon/pmbus/rtq2886b.c new file +4
-0+ + info =devm_kmemdup (dev, &rtq2886b_info,sizeof (*info),GFP_KERNEL ); +if (!info) +return -ENOMEM ;
rtq2886b_info is not modified, so I don't immediately see why it would be necessary to copy rtq2886b_info.
drivers/hwmon/pmbus/rtq2886b.c line 93
Quoted 6 lines
drivers/hwmon/pmbus/rtq2886b.c new file +6
-0+ +return pmbus_do_probe (i2c, info); +} + +static const struct i2c_device_id rtq2886b_id[] = { + {"rtq2886b" },
.name = "rtq2886b"
as suggested by Sashiko, please.
Thanks,
Guenter
Quoted 24 lines
drivers/hwmon/pmbus/rtq2886b.c new file +24
-0+ { } +}; +MODULE_DEVICE_TABLE (i2c, rtq2886b_id); + +static const struct of_device_id rtq2886b_of_match[] = { + { .compatible ="richtek,rtq2886b" }, + { } +}; +MODULE_DEVICE_TABLE (of, rtq2886b_of_match); + +static struct i2c_driver rtq2886b_driver = { + .driver = { + .name ="rtq2886b" , + .of_match_table = rtq2886b_of_match, + }, + .probe = rtq2886b_probe, + .id_table = rtq2886b_id, +}; +module_i2c_driver (rtq2886b_driver); + +MODULE_AUTHOR ("ChiYuan Huang <[email protected]>" ); +MODULE_DESCRIPTION ("PMBus driver for Richtek RTQ2886B" ); +MODULE_LICENSE ("GPL" ); +MODULE_IMPORT_NS ("PMBUS" );
Re: [PATCH 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
Quoted 44 lines · Guenter Roeck
Quoted 43 lines · On 11/29/26 19:01, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add a PMBus driver for the Richtek RTQ2886B single-output synchronous buck regulator.
The RTQ2880B and RTQ2882B are register-compatible derivatives of the RTQ2886B and are supported by the same driver.
Signed-off-by ChiYuan Huang <[email protected]>--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/rtq2886b.rst | 54 ++++++++++++++ MAINTAINERS | 8 +++ drivers/hwmon/pmbus/Kconfig | 19 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/rtq2886b.c | 117 +++++++++++++++++++++++++++++++ 6 files changed, 200 insertions(+)create mode 100644
Documentation/hwmon/rtq2886b.rstcreate mode 100644drivers/hwmon/pmbus/rtq2886b.cDocumentation/hwmon/index.rst +1
-0@@ -240,6 +240,7 @@ Hardware Monitoring Kernel Drivers q54sj108a2 qnap-mcu-hwmon raspberrypi-hwmon + rtq2886b sbrmi sbtsi_temp sch5627Documentation/hwmon/rtq2886b.rst new file +5
-0@@ -0,0 +1,54 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +==================================== +Kernel driver rtq2886b +====================================
Quoted 9 lines
Documentation/hwmon/rtq2886b.rst line 11
Quoted 6 lines
Documentation/hwmon/rtq2886b.rst new file +6
-0+ +Supported chips: + * Richtek RTQ2886B + * Richtek RTQ2882B + * Richtek RTQ2880B +Are there only "B" variants ? No RTQ2886A or chips without trailing letter ?
The RTQ288x family currently consists of A and B variants.
Only the B variants implement a PMBus interface and are therefore supported by this driver. The corresponding A variants support analog control only and do not provide PMBus functionality.
I'll clarify this in the documentation.
Quoted 158 lines
Quoted 144 lines
Documentation/hwmon/rtq2886b.rst new file +43
-0+ Prefix: 'rtq2886b' + + Addresses scanned: - + +Author: ChiYuan Huang <[email protected]> + +Description +----------- + +The RTQ2886B is a single-output synchronous buck regulator with a PMBus +interface. It exposes voltage, current, power, and temperature telemetry through +the standard PMBus hwmon interface. + +The primary difference among the devices in this series is their maximum load +current capability. The RTQ2880B, RTQ2882B, and RTQ2886B support maximum load +currents of 20 A, 16 A, and 8 A, respectively. + +Sysfs entries +------------- + +======================= ======================================================= +curr1_crit Critical output current limit +curr1_crit_alarm Output current critical alarm +curr1_input Measured output current +curr1_label "iout1" + +in1_alarm Input voltage alarm +in1_input Measured input voltage +in1_label "vin" + +in2_alarm Output voltage alarm +in2_input Measured output voltage +in2_label "vout1" +in2_rated_max Maximum rated output voltage +in2_rated_min Minimum rated output voltage + +power1_input Measured output power +power1_label "pout1" + +temp1_alarm Temperature alarm +temp1_input Measured chip temperature +======================= ======================================================= +MAINTAINERS +8
-0@@ -24074,6 +24074,14 @@ F: include/linux/rhashtable.h F: lib/rhashtable.c F: lib/test_rhashtable.c +RICHTEK RTQ2886B HARDWARE MONITOR DRIVER +M: ChiYuan Huang <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/hwmon/pmbus/richtek,rtq2886b.yaml +F: Documentation/hwmon/rtq2886b.rst +F: drivers/hwmon/pmbus/rtq2886b.c + RICOH R5C592 MEMORYSTICK DRIVER M: Maxim Levitsky <[email protected]> S: Maintaineddrivers/hwmon/pmbus/Kconfig +19
-0@@ -728,6 +728,25 @@ config SENSORS_Q54SJ108A2 This driver can also be built as a module. If so, the module will be called q54sj108a2. +config SENSORS_RTQ2886B + tristate "Richtek RTQ2886B" + help + If you say yes here, you get hardware monitoring support for the + Richtek RTQ2886B and compatible PMBus regulators. + + This driver can also be built as a module. If so, the module will + be called rtq2886b. + +config SENSORS_RTQ2886B_REGULATOR + bool "Regulator support for Richtek RTQ2886B and compatible devices" + depends on SENSORS_RTQ2886B && REGULATOR + help + If you say yes here, the driver registers a regulator device for + the Richtek RTQ2886B through the PMBus regulator framework. + + This allows the regulator output to be controlled through the + regulator subsystem. + config SENSORS_STEF48H28 tristate "ST STEF48H28" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -67,6 +67,7 @@ obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.o +obj-$(CONFIG_SENSORS_RTQ2886B) += rtq2886b.o obj-$(CONFIG_SENSORS_STEF48H28) += stef48h28.o obj-$(CONFIG_SENSORS_SQ24860) += sq24860.o obj-$(CONFIG_SENSORS_STPDDC60) += stpddc60.odrivers/hwmon/pmbus/rtq2886b.c new file +36
-0@@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Hardware monitoring driver for Richtek RTQ2886B +* +* Copyright (C) 2026 Richtek Technology Corp. +*/ + +#include <linux/errno.h> +#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include "pmbus.h" + +#define RTQ2886B_PMBUS_VOUT_MIN 0x2B +#define RTQ2886B_ONOFF_DEFAULT 0x1E +#define RTQ2886B_N_VOLTS 65535 +#define RTQ2886B_STEP_UV (1000000 / 1024) +#define RICHTEK_MFR_ID "RT" +#define RICHTEK_MFR_ID_LEN (sizeof(RICHTEK_MFR_ID) - 1) + +#if IS_ENABLED (CONFIG_SENSORS_RTQ2886B_REGULATOR ) +static const struct regulator_desc rtq2886b_reg_desc[] = { +PMBUS_REGULATOR_STEP_ONE ("regulator" ,RTQ2886B_N_VOLTS ,RTQ2886B_STEP_UV ,0 ), +}; +#endif + +static int rtq2886b_read_word_data (struct i2c_client *i2c,int page,int phase,int reg) +{ +switch (reg) { +case PMBUS_MFR_VOUT_MIN : +return pmbus_read_word_data (i2c, page, phase,RTQ2886B_PMBUS_VOUT_MIN ); +case PMBUS_MFR_VOUT_MAX : +return pmbus_read_word_data (i2c, page, phase,PMBUS_VOUT_MAX ); +default : +return -ENODATA ; + }drivers/hwmon/pmbus/rtq2886b.c line 46
Quoted 10 lines
drivers/hwmon/pmbus/rtq2886b.c new file +10
-0+} + +static int rtq2886b_identify (struct i2c_client *i2c,struct pmbus_driver_info *info) +{ +/* +* The device powers up with PMBUS_ON_OFF_CONFIG configured for +* hardware control. Configure it for PMBus-controlled operation +* to allow regulator output enable/disable management. +*/ +return pmbus_write_byte_data (i2c,0 ,PMBUS_ON_OFF_CONFIG ,RTQ2886B_ONOFF_DEFAULT );As the function name suggests, the identify function is supposed to _identify_ a chip, not to configure it.
Quoted 4 lines
Please move this code into the probe function, or alternatively rename the function to
rtq2886b_configure()or similar and call it from the probe function.
Agreed.
The PMBUS_ON_OFF_CONFIG programming will be moved to the probe() function and the identify() callback will be removed.
Quoted 42 lines
Quoted 27 lines
drivers/hwmon/pmbus/rtq2886b.c new file +27
-0+} + +static const struct pmbus_driver_info rtq2886b_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .format[PSC_TEMPERATURE ] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_VOUT |PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT | +PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_VOUT |PMBUS_HAVE_STATUS_IOUT | +PMBUS_HAVE_STATUS_INPUT |PMBUS_HAVE_STATUS_TEMP , + .read_word_data = rtq2886b_read_word_data, + .identify = rtq2886b_identify, +#if IS_ENABLED(CONFIG_SENSORS_RTQ2886B_REGULATOR) + .num_regulators =ARRAY_SIZE (rtq2886b_reg_desc), + .reg_desc = rtq2886b_reg_desc, +#endif + .have_pmbus_revision = true, + .pmbus_revision =PMBUS_REV_14 , +}; + +static int rtq2886b_probe (struct i2c_client *i2c) +{ +u8 buf[I2C_SMBUS_BLOCK_MAX +1 ] = {}; +struct device *dev = &i2c->dev; +struct pmbus_driver_info *info;drivers/hwmon/pmbus/rtq2886b.c line 83
Quoted 10 lines
drivers/hwmon/pmbus/rtq2886b.c new file +10
-0+int ret; + + ret =pmbus_read_smbus_i2c_block_data (i2c,PMBUS_MFR_ID , buf); +if (ret <0 ) +return dev_err_probe (dev, ret,"Failed to read MFR_ID\n" ); + + buf[ret] ='\0' ; + +if (ret !=RICHTEK_MFR_ID_LEN ||strncmp (buf,RICHTEK_MFR_ID ,RICHTEK_MFR_ID_LEN )) +return dev_err_probe (dev, -ENODEV ,"Expected MFR_ID 'RT', got %s\n" , buf);'%*pE' or similar instead of '%s' might be safer here since it is not known if the manufacturer ID is printable, and it would avoid the need to add the '\0' string terminator.
Quoted 3 lines
Either case, just checking the manufacturer ID is an exceptionally weak validation. If there is no means to check the device ID, you might as well drop it.
Agreed.
The manufacturer ID only identifies Richtek devices and does not provide sufficient validation of the actual device type. I'll remove the MFR_ID validation logic entirely.
Quoted 8 lines
drivers/hwmon/pmbus/rtq2886b.c line 87
Quoted 4 lines
drivers/hwmon/pmbus/rtq2886b.c new file +4
-0+ + info =devm_kmemdup (dev, &rtq2886b_info,sizeof (*info),GFP_KERNEL ); +if (!info) +return -ENOMEM ;
rtq2886b_infois not modified, so I don't immediately see why it would be necessary to copyrtq2886b_info.
The original implementation was based on the assumption that the PMBus core may modify struct pmbus_driver_info during probe, which is why a private copy was allocated.
Following your suggestion, I'll remove the allocation and pass rtq2886b_info directly to pmbus_do_probe().
Quoted 11 lines
drivers/hwmon/pmbus/rtq2886b.c line 93
Quoted 6 lines
drivers/hwmon/pmbus/rtq2886b.c new file +6
-0+ +return pmbus_do_probe (i2c, info); +} + +static const struct i2c_device_id rtq2886b_id[] = { + {"rtq2886b" },.name = "rtq2886b"as suggested by Sashiko, please.
Sure, I'll update the i2c_device_id entry to use designated initializers.
Quoted 28 lines
Thanks,
GuenterQuoted 24 lines
drivers/hwmon/pmbus/rtq2886b.c new file +24
-0+ { } +}; +MODULE_DEVICE_TABLE (i2c, rtq2886b_id); + +static const struct of_device_id rtq2886b_of_match[] = { + { .compatible ="richtek,rtq2886b" }, + { } +}; +MODULE_DEVICE_TABLE (of, rtq2886b_of_match); + +static struct i2c_driver rtq2886b_driver = { + .driver = { + .name ="rtq2886b" , + .of_match_table = rtq2886b_of_match, + }, + .probe = rtq2886b_probe, + .id_table = rtq2886b_id, +}; +module_i2c_driver (rtq2886b_driver); + +MODULE_AUTHOR ("ChiYuan Huang <[email protected]>" ); +MODULE_DESCRIPTION ("PMBus driver for Richtek RTQ2886B" ); +MODULE_LICENSE ("GPL" ); +MODULE_IMPORT_NS ("PMBUS" );