From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.130.44.152 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796087628; b=4/IF7zULvGE7e1dNrtPiovgHuGoATPWv1cV/v4AY2fnkhD+3ePH4sFmfDKaMZTxNWF2t 5RdnSekKh+jN84DD6dtv1dFurudxxmMcTzRa/Hwg6Ym7/xkRrKv0jT6GkgTZJTbgCa7We v1XNL6A3DZxJWJ07T55WbrCEahRVX4n1vdS5GpKSMZpaQltMNW17skgR0n4R+TLMU2CRN kiZ3h/oZqQ7T/6UGMN8vguBgfXXjZ0FkJsL33e4VDt0ju5zO4jT58MY7xgit1qnSVQiP4 fzAaNbaXPyyngrpZxzUOCcFOJX0h2n7kZ01jPNzGOC0yFBDwd00YH+jvr0N4F8N7wfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796087628; h=DMARC-Filter:X-MailGates:DKIM-Signature:Received:Received:Received: Received:From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=gI3Kuj2DktHMPMgYVO+GVisHyrYJIqGnaYPpDZUBRJA=; b=P++QUZqWYeZQDUhDLMuyJecoo6iFx1HK4PnqLQlMKGXw+zRpJVcvK9EJNUAEG2WROuL2 SPOcadH9pmd+CTquKU6qG0FmCIUHhm5ch+w1b2IfaVBn00o1Af/KEr1XF/XEazh6Z/q1+ qJ+qADutoPtEHpDESCaG4LUMjLlXAIHA+k6FXYL+R+mKFiEttomQsuPVmXM5FgshHWEv2 ODGqdfCjsPqecDiHQcV3V8iPIlSMCmChx6jTt7D2zg5GM8mqpZ9RkXtW56CPoR6t19o2d 91ertEOkGzfzex7Emwn7Giqe0mAlww0Ekol7ik5eJiD2RQ+4HtkhijOo+Z50E+zrmVg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass header.d=richtek.com header.i=@richtek.com header.a=rsa-sha256 header.s=richtek header.b=4uDJaCwq; arc=none smtp.remote-ip=220.130.44.152 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 020F7606A320; Tue, 1 Dec 2026 01:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 020F7606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=richtek.com header.i=@richtek.com header.a=rsa-sha256 header.s=richtek header.b=4uDJaCwq X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1796087624; bh=gI3Kuj2DktHMPMgYVO+GVisHyrYJIqGnaYPpDZUBRJA=; l=8730; h=From:To:Subject:Date:Message-ID:MIME-Version; b=4uDJaCwqP4HL6YpUNOD4ltO92q77vKgU/QLZ2MKcgAN9+pgAifMBsXpO9EOWhkhJu YZ7WsYJ22VUbYlikdI1RVTu4mtxx4zD3/LWZU2RrXTFIGGWrqUofy5P4yzVwi0QKkG yp6BFWEiON16ngpQozh81OQCxVEWb7sk00bx6DYIYnhnc/6LoQkNy3zyCGZqWbcFXX d6Up83nw9B1V6ygxojup7jVT6Yv5fxjTFcKn5mLCGD03ULWXK1xpeiNgJLd7KgYIY7 bODfmMs9COWm0aQSAxE5pHcyJtMRVEQRDSLl18mzoa+DlNRNWq/fxA3a62WmUgx7Lq AKSAL6ijRF9Ag== Received: from 192.168.10.46 by mg.richtek.com with MailGates ESMTPS Server V6.0(2325279:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Tue, 01 Dec 2026 09:11:56 +0800 (CST) Received: from ex4.rt.l (192.168.10.40) by ex5.rt.l (192.168.10.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.53; Tue, 1 Dec 2026 09:11:56 +0800 Received: from ex6.rt.l (192.168.10.47) by ex4.rt.l (192.168.10.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.26; Tue, 1 Dec 2026 09:11:56 +0800 Received: from git-send.richtek.com (192.168.10.154) by ex6.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.2562.53 via Frontend Transport; Tue, 1 Dec 2026 09:11:56 +0800 From: To: Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet CC: Shuah Khan , Randy Dunlap , Alexis Czezar Torreno , Sanman Pradhan , Ashish Yadav , Matti Vaittinen , Colin Huang , Vincent Jardin , =?UTF-8?q?Nuno=20S=C3=A1?= , Abdurrahman Hussain , Ziming Zhu , Carlos Jones Jr , Wensheng Wang , Charles Hsu , Brian Chiang , ChiYuan Huang , , , , , , Subject: [PATCH v2 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B Date: Tue, 1 Dec 2026 09:11:52 +0800 Message-ID: <9fb5fb44c4b9e38986ef2fb29d09672b130fe313.1796086906.git.cy_huang@richtek.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain From: ChiYuan Huang 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 --- v2 - Document the rtq2886 variant - Move the default config into probe - Remove weak MFR_ID identification - Directly pass the rtq2886_info into pmbus_do_probe - Add named initializaion for i2c_device_id --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/rtq2886b.rst | 58 ++++++++++++++++++ MAINTAINERS | 8 +++ drivers/hwmon/pmbus/Kconfig | 19 ++++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/rtq2886b.c | 100 +++++++++++++++++++++++++++++++ 6 files changed, 187 insertions(+) create mode 100644 Documentation/hwmon/rtq2886b.rst create mode 100644 drivers/hwmon/pmbus/rtq2886b.c diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index 199ca79621e9..ca8f30a48695 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -240,6 +240,7 @@ Hardware Monitoring Kernel Drivers q54sj108a2 qnap-mcu-hwmon raspberrypi-hwmon + rtq2886b sbrmi sbtsi_temp sch5627 diff --git a/Documentation/hwmon/rtq2886b.rst b/Documentation/hwmon/rtq2886b.rst new file mode 100644 index 000000000000..061199e0ce08 --- /dev/null +++ b/Documentation/hwmon/rtq2886b.rst @@ -0,0 +1,58 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +==================================== +Kernel driver rtq2886b +==================================== + +Supported chips: + * Richtek RTQ2886B + * Richtek RTQ2882B + * Richtek RTQ2880B + +Only the B variants are supported by this driver. The corresponding +RTQ2886A, RTQ2882A, and RTQ2880A devices support analog control only +and do not provide a PMBus interface. + + Prefix: 'rtq2886b' + + Addresses scanned: - + +Author: ChiYuan Huang + +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 +======================= ======================================================= + diff --git a/MAINTAINERS b/MAINTAINERS index 84cb98ef4c49..0bc9ee8c2b9d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 +L: linux-hwmon@vger.kernel.org +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 S: Maintained diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index fd6641316454..876e389a7ec9 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -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 diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index b67ec382328e..88fbde32f212 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -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 diff --git a/drivers/hwmon/pmbus/rtq2886b.c b/drivers/hwmon/pmbus/rtq2886b.c new file mode 100644 index 000000000000..fce225b5111b --- /dev/null +++ b/drivers/hwmon/pmbus/rtq2886b.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Hardware monitoring driver for Richtek RTQ2886B + * + * Copyright (C) 2026 Richtek Technology Corp. + */ + +#include +#include +#include +#include +#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) + +#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; + } +} + +static 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, +#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) +{ + int ret; + + /* The device requires SMBus PEC for PMBus transactions. */ + i2c->flags |= I2C_CLIENT_PEC; + + /* + * 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. + */ + ret = i2c_smbus_write_byte_data(i2c, PMBUS_ON_OFF_CONFIG, RTQ2886B_ONOFF_DEFAULT); + if (ret) + return dev_err_probe(&i2c->dev, ret, "Failed to configure device\n"); + + return pmbus_do_probe(i2c, &rtq2886b_info); +} + +static const struct i2c_device_id rtq2886b_id[] = { + { .name = "rtq2886b" }, + { } +}; +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 "); +MODULE_DESCRIPTION("PMBus driver for Richtek RTQ2886B"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("PMBUS"); -- 2.43.0