Skip to contentSkip to conversation

usb: typec: add Rohm BM92TXX Type-C / PD controller driver

PATCH In review Alexandre Hamamdjian 7 participants 12 messages May 10 – May 14

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover usb: typec: add Rohm BM92TXX Type-C / PD controller driver

This series adds initial support for the Rohm Semiconductor BM92TXX family of USB Type-C and Power Delivery controllers.

This chipset is found on Nintendo Switch hardware, where it handles charger and dock USB-C / PD negotiation, DisplayPort alternate-mode entry through the dock and VBUS / VCONN control.

Further patches will follow to wire the driver up on Nintendo Switch device trees and to address review feedback.

---
Changes in v2:
- dt-bindings: usb: rohm,bm92t: fix properties type
- Link to v1: https://patch.msgid.link/[email protected]

To: Heikki Krogerus <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: CTCaer <[email protected]>
To: Alexandre Hamamdjian <[email protected]>
To: Linus Walleij <[email protected]>
To: Bartosz Golaszewski <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Alexandre Hamamdjian (2):
dt-bindings: usb: add Rohm BM92TXX Type-C controller
dt-bindings: usb: fix properties type

CTCaer (1):
usb: typec: bm92txx: add Rohm BM92TXX support

 .../devicetree/bindings/usb/rohm,bm92t.yaml        |  132 +
 MAINTAINERS                                        |    8 +
 drivers/usb/typec/Kconfig                          |   11 +
 drivers/usb/typec/Makefile                         |    1 +
 drivers/usb/typec/bm92txx.c                        | 2634 ++++++++++++++++++++
 5 files changed, 2786 insertions(+)

---
base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83
change-id: 20260510-bm92t-378a19c339e3

Best regards,

Signature · 1 line
Alexandre Hamamdjian <[email protected]>
#1 lore raw

PATCH v2 1/3 usb: typec: bm92txx: add Rohm BM92TXX support

From: CTCaer <[email protected]>

Add a driver for the Rohm Semiconductor BM92TXX family of USB Type-C and Power Delivery controllers. The IC integrates an MCU that runs the PD state machine; the host configures it and observes status over I2C and reacts to a level-triggered ALERT interrupt.

The driver exposes the controller through extcon and a USB role switch, manages the VBUS sink, optional VBUS source and battery-charger regulators along with the VCONN-enable GPIO, and applies per-PDO charging current limits (5 V, 9 V, 12 V, 15 V) sourced from device tree. DisplayPort alternate-mode handling and dock LED behaviour are configurable through rohm,* properties so the same driver can serve boards that wire the part up differently. A debugfs interface under bm92txx/ is provided for register dumps and low-level command access when CONFIG_DEBUG_FS is enabled.

---
 MAINTAINERS                 |    7 +
 drivers/usb/typec/Kconfig   |   11 +
 drivers/usb/typec/Makefile  |    1 +
 drivers/usb/typec/bm92txx.c | 2634 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 2653 insertions(+)
MAINTAINERS +7 -0
index f877e5aaf2c7..01e06d87b926 100644
@@ -23306,6 +23306,13 @@ L:	[email protected]
 S:	Supported
 F:	drivers/iio/pressure/rohm-bm1390.c
 
+ROHM BM92TXX USB TYPE-C CONTROLLER DRIVER
+M:	CTCaer <[email protected]>
+M:	Alexandre Hamamdjian <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/usb/typec/bm92txx.c
+
 ROHM BU270xx LIGHT SENSOR DRIVERs
 M:	Matti Vaittinen <[email protected]>
 L:	[email protected]
drivers/usb/typec/Kconfig +11 -0
index 2f80c2792dbd..a9160d6e36bc 100644
@@ -64,6 +64,17 @@ config TYPEC_ANX7411
 	  If you choose to build this driver as a dynamically linked module, the
 	  module will be called anx7411.ko.
 
+config TYPEC_BM92TXX
+	tristate "Rohm Semiconductor BM92TXX USB Type-C Support"
+	depends on I2C
+	depends on USB_ROLE_SWITCH
+	help
+	  Say Y or M here if your system has Rohm BM92TXX USB Type-C and
+	  Power Delivery controller.
+
+	  If you choose to build this driver as a dynamically linked module, the
+	  module will be called bm92txx.ko
+
 config TYPEC_RT1719
 	tristate "Richtek RT1719 Sink Only Type-C controller driver"
 	depends on USB_ROLE_SWITCH || !USB_ROLE_SWITCH
drivers/usb/typec/Makefile +1 -0
index 8a6a1c663eb6..349996e5355c 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_TYPEC_TCPM)	+= tcpm/
 obj-$(CONFIG_TYPEC_UCSI)	+= ucsi/
 obj-$(CONFIG_TYPEC_TPS6598X)	+= tipd/
 obj-$(CONFIG_TYPEC_ANX7411)	+= anx7411.o
+obj-$(CONFIG_TYPEC_BM92TXX)	+= bm92txx.o
 obj-$(CONFIG_TYPEC_HD3SS3220)	+= hd3ss3220.o
 obj-$(CONFIG_TYPEC_STUSB160X) 	+= stusb160x.o
 obj-$(CONFIG_TYPEC_RT1719)	+= rt1719.o
drivers/usb/typec/bm92txx.c new file +2634 -0

2,634 lines not on this page · raw message

Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH v2 1/3] usb: typec: bm92txx: add Rohm BM92TXX support

Quoted 21 lines · On Sun, May 10, 2026 at 8:32 PM Alexandre Hamamdjian via B4 Relay…

From: CTCaer <[email protected]>

Add a driver for the Rohm Semiconductor BM92TXX family of USB Type-C and Power Delivery controllers. The IC integrates an MCU that runs the PD state machine; the host configures it and observes status over I2C and reacts to a level-triggered ALERT interrupt.

The driver exposes the controller through extcon and a USB role switch, manages the VBUS sink, optional VBUS source and battery-charger regulators along with the VCONN-enable GPIO, and applies per-PDO charging current limits (5 V, 9 V, 12 V, 15 V) sourced from device tree. DisplayPort alternate-mode handling and dock LED behaviour are configurable through rohm,* properties so the same driver can serve boards that wire the part up differently. A debugfs interface under bm92txx/ is provided for register dumps and low-level command access when CONFIG_DEBUG_FS is enabled.

---

...

Quoted 20 lines
drivers/usb/typec/bm92txx.c new file +14 -0
new file mode 100644
index 000000000000..39e20a4394c1
@@ -0,0 +1,2634 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/*
+ * Driver for Rohm BM92TXX USB Type-C and Power Delivery controller
+ *
+ * Copyright (c) 2020-2023 CTCaer <[email protected]>
+ *
+ * Authors:
+ *     CTCaer <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.

drivers/usb/typec/bm92txx.c line 24

Quoted 10 lines
drivers/usb/typec/bm92txx.c new file +10 -0
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>

Sorry but I have to NAK this. This is a legacy header (as per it's documentation) and must no longer be used in new code. Please refer to the kernel docs and use the APIs from linux/gpio/consumer.h instead.

Bartosz

maintainer
#3 lore raw

Re: [PATCH v2 1/3] usb: typec: bm92txx: add Rohm BM92TXX support

In reply to Alexandre Hamamdjian

Hi Alexandre,

Quoted 7 lines · On Mon, May 11, 2026 at 01:32:09AM +0700, Alexandre Hamamdjian via B4 Relay…

From: CTCaer <[email protected]>

Add a driver for the Rohm Semiconductor BM92TXX family of USB Type-C and Power Delivery controllers. The IC integrates an MCU that runs the PD state machine; the host configures it and observes status over I2C and reacts to a level-triggered ALERT interrupt.

Quoted 9 lines

The driver exposes the controller through extcon and a USB role switch, manages the VBUS sink, optional VBUS source and battery-charger regulators along with the VCONN-enable GPIO, and applies per-PDO charging current limits (5 V, 9 V, 12 V, 15 V) sourced from device tree. DisplayPort alternate-mode handling and dock LED behaviour are configurable through rohm,* properties so the same driver can serve boards that wire the part up differently. A debugfs interface under bm92txx/ is provided for register dumps and low-level command access when CONFIG_DEBUG_FS is enabled.

You need to use the USB Type-C framework for everything, not just for the switches. The port, the partner when connected, the cable and plugs, and all the alternate modes (the port alt modes, the plug alt modes, and partner alt modes) need to be registered.

All that needs to be exposed properly inside kernel as well in user space.

<snip>

drivers/usb/typec/bm92txx.c line 281

Quoted 10 lines
drivers/usb/typec/bm92txx.c new file +10 -0
+/* VDM/VDO */
+#define VDM_CMD_RESERVED    0x00
+#define VDM_CMD_DISC_ID     0x01
+#define VDM_CMD_DISC_SVID   0x02
+#define VDM_CMD_DISC_MODE   0x03
+#define VDM_CMD_ENTER_MODE  0x04
+#define VDM_CMD_EXIT_MODE   0x05
+#define VDM_CMD_ATTENTION   0x06
+#define VDM_CMD_DP_STATUS   0x10
+#define VDM_CMD_DP_CONFIG   0x11

Already defined in include/linux/usb/pd_vdo.h

drivers/usb/typec/bm92txx.c line 287

Quoted 5 lines
drivers/usb/typec/bm92txx.c new file +5 -0
+#define VDM_ACK   0x40
+#define VDM_NAK   0x80
+#define VDM_BUSY  0xC0
+#define VDM_UNSTRUCTURED   0x00
+#define VDM_STRUCTURED     0x80

Ditto.

drivers/usb/typec/bm92txx.c line 301

Quoted 13 lines
drivers/usb/typec/bm92txx.c new file +13 -0
+/* VDM Discover ID */
+#define VDO_ID_TYPE_NONE        0
+#define VDO_ID_TYPE_PD_HUB      1
+#define VDO_ID_TYPE_PD_PERIPH   2
+#define VDO_ID_TYPE_PASS_CBL    3
+#define VDO_ID_TYPE_ACTI_CBL    4
+#define VDO_ID_TYPE_ALTERNATE   5
+
+/* VDM Discover Mode Caps [From device (UFP_U) to host (DFP_U)] */
+#define VDO_DP_UFP_D       BIT(0) /* DisplayPort Sink */
+#define VDO_DP_DFP_D       BIT(1) /* DisplayPort Source */
+#define VDO_DP_SUPPORT     BIT(2)
+#define VDO_DP_RECEPTACLE  BIT(6)

include/linux/usb/typec_dp.h

drivers/usb/typec/bm92txx.c line 307

Quoted 5 lines
drivers/usb/typec/bm92txx.c new file +5 -0
+/* VDM DP Configuration [From host (DFP_U) to device (UFP_U)] */
+#define VDO_DP_U_DFP_D     BIT(0) /* UFP_U as DisplayPort Source */
+#define VDO_DP_U_UFP_D     BIT(1) /* UFP_U as DisplayPort Sink */
+#define VDO_DP_SUPPORT     BIT(2)
+#define VDO_DP_RECEPTACLE  BIT(6)

Ditto.

drivers/usb/typec/bm92txx.c line 315

Quoted 7 lines
drivers/usb/typec/bm92txx.c new file +7 -0
+/* VDM Mode Caps and DP Configuration pins */
+#define VDO_DP_PIN_A   BIT(0)
+#define VDO_DP_PIN_B   BIT(1)
+#define VDO_DP_PIN_C   BIT(2)
+#define VDO_DP_PIN_D   BIT(3)
+#define VDO_DP_PIN_E   BIT(4)
+#define VDO_DP_PIN_F   BIT(5)

Ditto.

Quoted 4 lines
drivers/usb/typec/bm92txx.c new file +4 -0
+/* Known VID/SVID */
+#define VID_NINTENDO      0x057E
+#define PID_NIN_DOCK      0x2003
+#define PID_NIN_CHARGER   0x2004

drivers/usb/typec/bm92txx.c line 330

Quoted 10 lines
drivers/usb/typec/bm92txx.c new file +9 -0
+
+#define SVID_NINTENDO     VID_NINTENDO
+#define SVID_DP           0xFF01
 
+/* Nintendo dock VDM Commands */
+#define VDM_NCMD_LED_CONTROL         0x01 /* Reply size 12 */
+#define VDM_NCMD_DEVICE_STATE        0x16 /* Reply size 12 */
+#define VDM_NCMD_DP_SIGNAL_DISABLE   0x1C /* Reply size 8 */
+#define VDM_NCMD_HUB_RESET           0x1E /* Reply size 8 */
+#define VDM_NCMD_HUB_CONTROL         0x20 /* Reply size 8 */

You need a dedicated alternate mode driver for this mode.

It looks like you have a lot of duplication in this code. You really have to refactor this whole driver. It probable does not make sense to review this any further before that.

Please register all the Type-C (inclide/linux/usb/typec.h) and power delivery (include/linux/usb/pd.h) components, and at least try to handle the alternate mode VDM communication in the alt mode drivers dedicated for each alt mode.

I also really think that that the battery charging information needs to be exposed to user space with the power supply device class (include/linux/power_supply.h).

Because there is a lot of stuff to be done here, please consider splitting this into clear steps. For example, you could start by simply registering the port and the partner, and so on.

thanks,

Signature · 1 line
heikki
#4 lore raw

Re: [PATCH v2 1/3] usb: typec: bm92txx: add Rohm BM92TXX support

In reply to Alexandre Hamamdjian
Thank you for your contribution! Sashiko AI review found 11 potential issue(s) to consider: - [Critical] Missing cleanup in bm92t_remove and error paths leads to use-after-free and resource leaks.…

Thank you for your contribution! Sashiko AI review found 11 potential issue(s) to consider:
- [Critical] Missing cleanup in bm92t_remove and error paths leads to use-after-free and resource leaks.
- [Critical] Unvalidated I2C message lengths lead to stack buffer overflow and out-of-bounds reads.
- [High] Integer underflow in current limit calculation allows over-drawing power from weak sources.
- [High] bm92t_probe succeeds without full initialization when role switch is NULL, causing NULL pointer dereference.
- [High] Use of C bitfields to parse hardware responses breaks on big-endian architectures.
- [High] Misuse of disable_irq() and queue_work() causes permanent IRQ disablement.
- [High] I2C_M_NOSTART is incorrectly set for standard standalone writes, violating I2C protocol.
- [High] Race condition due to unsynchronized access to driver state and global arrays.
- [High] Incorrect cancellation of power_work can leave charging enabled after cable disconnect.
- [Medium] Undeclared variable pd_switch_name causes build failure if CONFIG_SWITCH is enabled.
- [Medium] Incorrect return value check for kstrtouint() breaks debugfs interfaces.
--

commit bc2b1e9499614886b3e416da0258ae455e2169d4
Author: CTCaer <[email protected]>
usb: typec: bm92txx: add Rohm BM92TXX support

This commit introduces the driver for the Rohm BM92TXX USB Type-C and Power Delivery controllers. It provides extcon, USB role switch support, and VBUS regulation based on PD negotiations.

drivers/usb/typec/bm92txx.c +0 -0
@@ -359,6 +359,13 @@

Review

Quoted 6 lines
(quoted diff) +6 -0
+struct __packed pd_object {
+	unsigned int amp:10;
+	unsigned int volt:10;
+	unsigned int info:10;
+	unsigned int type:2;
+};

Does the use of C bitfields to parse hardware responses via memcpy() break protocol parsing on big-endian architectures?

[ ... ]

@@ -550,6 +550,13 @@

Review

Quoted 9 lines
(quoted diff) +9 -0
+static int bm92t_write_reg(struct bm92t_info *info,
+			   unsigned char *buf, unsigned int len)
+{
+	struct i2c_msg xfer_msg[1];
+
+	xfer_msg[0].addr = info->i2c_client->addr;
+	xfer_msg[0].len = len;
+	xfer_msg[0].flags = I2C_M_NOSTART;
+	xfer_msg[0].buf = buf;

Does setting I2C_M_NOSTART on a single-message transfer violate the I2C protocol? This might cause standard I2C adapter drivers to reject the write.

[ ... ]

@@ -1285,6 +1285,13 @@

Review

Quoted 12 lines
(quoted diff) +12 -0
+static void bm92t_calculate_current_limit(struct bm92t_info *info,
+	unsigned int voltage, unsigned int amperage)
+{
+	int i;
+	unsigned int charging_limit = amperage;
+	struct bm92t_platform_data *pdata = info->pdata;
+
+	/* Subtract a USB2 or USB3 port current */
+	if (voltage > 5000)
+		charging_limit -= (PD_POWER_RESERVE_UA / voltage);
+	else
+		charging_limit -= (NON_PD_POWER_RESERVE_UA / voltage);

Can this subtraction underflow since charging_limit is unsigned? If the source advertises an amperage less than the reserve, this could wrap around to a large positive value and bypass the min() checks, potentially setting a large current limit on a weak source.

[ ... ]

@@ -1310,6 +1310,13 @@

Quoted 6 lines
(quoted diff) +6 -0
+static void bm92t_extcon_cable_set_init_state(struct work_struct *work)
+{
+	struct bm92t_info *info = container_of(to_delayed_work(work),
+					       struct bm92t_info, oneshot_work);
+
+	disable_irq(info->i2c_client->irq);

[ ... ]

Review

Quoted 2 lines
(quoted diff) +2 -0
+	queue_work(info->event_wq, &info->work);
+}

And in the interrupt handler:

@@ -1910,6 +1910,13 @@

Review

Quoted 8 lines
(quoted diff) +8 -0
+static irqreturn_t bm92t_interrupt_handler(int irq, void *handle)
+{
+	struct bm92t_info *info = handle;
+
+	disable_irq_nosync(info->i2c_client->irq);
+	queue_work(info->event_wq, &info->work);
+	return IRQ_HANDLED;
+}

Could this sequence permanently disable the interrupt? If the interrupt handler and the delayed work both call disable_irq() and then queue_work(), the workqueue might deduplicate the work item. The work will only execute once and enable the IRQ once, leaving the disable depth unbalanced.

[ ... ]

@@ -1335,6 +1335,13 @@

Quoted 6 lines
(quoted diff) +6 -0
+static bool bm92t_check_pdo(struct bm92t_info *info)
+{
+	int i, err, pdos_no;
+	struct device *dev;
+	unsigned char pdos[29];
+	struct pd_object pdo[7];

[ ... ]

Quoted 2 lines
(quoted diff) +2 -0
+	err = bm92t_read_reg(info, READ_PDOS_SRC_REG, pdos, sizeof(pdos));
+	pdos_no = pdos[0] / sizeof(struct pd_object);

[ ... ]

Review

Quoted 1 line
(quoted diff) +1 -0
+	memcpy(pdo, pdos + 1, pdos[0]);

Does this code overflow the pdo[] array? The size pdos[0] is read directly from the I2C device and used in memcpy() into a 28-byte array without validation.

Similarly, in the event handler:

@@ -1765,6 +1765,13 @@

Review

Quoted 13 lines
(quoted diff) +13 -0
+	case VDM_ACCEPT_DISC_SVID_REPLY:
+		if (bm92t_is_success(alert_data)) {
+			/* Check discovered SVIDs */
+			err = bm92t_read_reg(info, INCOMING_VDM_REG, vdm,
+					     sizeof(vdm));
+
+			if (vdm[1] == (VDM_ACK | VDM_CMD_DISC_SVID)) {
+				dev_info(dev, "Supported SVIDs:\n");
+				for (i = 0; i < ((vdm[0] - 4) / 2); i++) {
+					dev_info(dev, "SVID%d %04X\n", i,
+						 vdm[5 + i * 2] |
+						 (vdm[6 + i * 2] << 8));
+				}

Can this loop read past the end of the vdm[] stack buffer? The length vdm[0] is read from the hardware and used as the loop bound without bounds checking.

[ ... ]

@@ -1550,6 +1550,13 @@

Quoted 7 lines
(quoted diff) +7 -0
+static void bm92t_usbhub_led_cfg_wait(struct bm92t_info *info,
+	unsigned char duty, unsigned char time_on,
+	unsigned char time_off, unsigned char fade)
+{
+	int retries = 100;
+
+	if (info->state == NINTENDO_CONFIG_HANDLED) {

Review

Quoted 10 lines
(quoted diff) +10 -0
+		bm92t_state_machine(info, VDM_ND_CUSTOM_CMD_SENT);
+		bm92t_usbhub_led_cfg(info, duty, time_on, time_off, fade);
+		while (info->state != NINTENDO_CONFIG_HANDLED) {
+			retries--;
+			if (retries < 0)
+				break;
+			usleep_range(1000, 1500);
+		}
+	}
+}

Is there a race condition here? The driver state and global arrays like vdm_usbhub_led_msg are modified concurrently from the workqueue, debugfs write handlers, and PM suspend/resume callbacks without locking.

[ ... ]

@@ -1682,6 +1682,13 @@

Review

Quoted 11 lines
(quoted diff) +11 -0
+	if (alert_data & ALERT_PLUGPULL) {
+		if (!bm92t_is_plugged(status1_data)) { /* Pull event */
+src_fault:
+			/* Cancel any pending charging enable work */
+			cancel_delayed_work(&info->power_work);
+
+			/* Disable VBUS in case it's enabled */
+			bm92t_set_vbus_enable(info, false);
+
+			/* Disable charging */
+			if (info->pd_charging_enabled) {

Should this use cancel_delayed_work_sync()? Using the non-sync version might leave bm92t_power_work() executing on another CPU, which could re-enable charging right after the unplug handler disables it.

[ ... ]

@@ -1918,6 +1918,13 @@

Review

Quoted 8 lines
(quoted diff) +8 -0
+static void bm92t_remove(struct i2c_client *client)
+{
+	struct bm92t_info *info = i2c_get_clientdata(client);
+
+#ifdef CONFIG_DEBUG_FS
+	debugfs_remove_recursive(info->debugfs_root);
+#endif
+}

Does this code leak the workqueue, fwnode handles, and switch device?

Furthermore, since the IRQ is non-devm and the work items are not synchronously canceled, can this cause a use-after-free when the devm-managed memory is freed but the IRQ or delayed works fire later?

[ ... ]

@@ -2110,6 +2110,13 @@

Quoted 3 lines
(quoted diff) +3 -0
+static ssize_t bm92t_cmd_write(struct file *file,
+		     const char __user *userbuf, size_t count, loff_t *ppos)
+{

[ ... ]

Review

Quoted 9 lines
(quoted diff) +9 -0
+	ret = kstrtouint(buf, 0, &val);
+
+	if (ret == 1) {
+		cmd = val;
+		bm92t_send_cmd(info, &cmd);
+	} else {
+		dev_err(&info->i2c_client->dev, "Cmd syntax is: cmd\n");
+		return -EINVAL;
+	}

Does kstrtouint() return 0 on success? Checking for a return value of 1 will cause the debugfs interfaces to reject valid inputs with -EINVAL.

[ ... ]

@@ -2413,6 +2413,13 @@

Review

Quoted 8 lines
(quoted diff) +8 -0
+	info->role_sw = fwnode_usb_role_switch_get(remote);
+	if (IS_ERR_OR_NULL(info->role_sw)) {
+		err = PTR_ERR(info->role_sw);
+		dev_err(&client->dev, "Failed to retrieve fwnode: %d\n", err);
+		return err;
+	}
+
+	i2c_set_clientdata(client, info);

If fwnode_usb_role_switch_get() returns NULL, IS_ERR_OR_NULL is true and err is set to PTR_ERR(NULL) which is 0. Does this cause the probe function to succeed without calling i2c_set_clientdata(), leading to a NULL pointer dereference later when bm92t_remove() retrieves it?

[ ... ]

@@ -2514,6 +2514,13 @@

Review

Quoted 6 lines
(quoted diff) +6 -0
+#ifdef CONFIG_SWITCH
+	info->pd_switch.name = pd_switch_name;
+	err = switch_dev_register(&info->pd_switch);
+	if (err)
+		dev_err(&client->dev, "failed to register pd switch, err=%d\n", err);
+#endif

Is pd_switch_name declared anywhere? Referencing an undeclared variable will cause a build failure when CONFIG_SWITCH is enabled.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw

PATCH v2 2/3 dt-bindings: usb: add Rohm BM92TXX Type-C controller

In reply to Alexandre Hamamdjian

Add the device-tree binding documentation for the Rohm BM92TXX family of USB Type-C and Power Delivery controllers. The device is controlled over I2C and signals state changes through a dedicated interrupt line.

Document the rohm,* properties consumed by the driver: the optional VCONN-enable GPIO, the DisplayPort alternate-mode toggles (rohm,dp-disable, rohm,dp-alerts-enable, rohm,dp-signal-toggle-on-resume, rohm,dp-lanes), the suspend/dock tunables (rohm,led-static-on-suspend, rohm,dock-power-limit-disable) and the four rohm,pd-{5,9,12,15}v-current-limit-ma per-PDO charging current limits. A graph port is required to link the controller to a USB role switch consumer.

---
 .../devicetree/bindings/usb/rohm,bm92t.yaml        | 128 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 129 insertions(+)
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +128 -0
new file mode 100644
index 000000000000..007f70a8f5bb
@@ -0,0 +1,128 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/rohm,bm92t.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rohm BM92TXX USB Type-C and Power Delivery controller
+
+maintainers:
+  - CTCaer <[email protected]>
+  - Alexandre Hamamdjian <[email protected]>
+
+description:
+  The Rohm BM92TXX is a family of USB Type-C and Power Delivery
+  controllers with an integrated MCU. The host communicates with the
+  device over I2C and is notified of state changes through a dedicated
+  interrupt line.
+
+properties:
+  compatible:
+    const: rohm,bm92t
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vbus-supply:
+    description: VBUS sink regulator.
+
+  vbus-source-supply:
+    description: VBUS source (provider) regulator.
+
+  pd_bat_chg-supply:
+    description: Battery charger regulator gated by Power Delivery state.
+
+  rohm,vconn-en-gpio:
+    maxItems: 1
+    description: GPIO controlling the external VCONN switch.
+
+  rohm,dp-disable:
+    type: boolean
+    description: Disable DisplayPort alternate-mode handling.
+
+  rohm,dp-alerts-enable:
+    type: boolean
+    description: Enable DisplayPort status alerts.
+
+  rohm,dp-signal-toggle-on-resume:
+    type: boolean
+    description:
+      Toggle the DisplayPort signal on resume to work around sinks that
+      do not re-train after system resume.
+
+  rohm,dp-lanes:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [2, 4]
+    default: 2
+    description: Number of DisplayPort lanes to negotiate.
+
+  rohm,led-static-on-suspend:
+    type: boolean
+    description:
+      Keep the charge LED in a static state during system suspend
+      instead of letting the controller animate it.
+
+  rohm,dock-power-limit-disable:
+    type: boolean
+    description:
+      Disable the lower power limit applied when a dock is detected.
+
+  rohm,pd-5v-current-limit-ma:
+    description: Charging current limit in mA when 5V PD contract is active.
+
+  rohm,pd-9v-current-limit-ma:
+    description: Charging current limit in mA when 9V PD contract is active.
+
+  rohm,pd-12v-current-limit-ma:
+    description: Charging current limit in mA when 12V PD contract is active.
+
+  rohm,pd-15v-current-limit-ma:
+    description: Charging current limit in mA when 15V PD contract is active.
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      Output port linking to a USB role switch consumer endpoint.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        typec@18 {
+            compatible = "rohm,bm92t";
+            reg = <0x18>;
+            interrupt-parent = <&gpio>;
+            interrupts = <42 IRQ_TYPE_LEVEL_LOW>;
+
+            vbus-supply = <&vbus_reg>;
+            vbus-source-supply = <&vbus_src_reg>;
+            pd_bat_chg-supply = <&pd_bat_chg_reg>;
+
+            rohm,dp-lanes = <4>;
+            rohm,pd-5v-current-limit-ma = <2000>;
+            rohm,pd-9v-current-limit-ma = <2000>;
+            rohm,pd-12v-current-limit-ma = <1500>;
+            rohm,pd-15v-current-limit-ma = <1200>;
+
+            port {
+                bm92t_ep: endpoint {
+                    remote-endpoint = <&usb_role_sw>;
+                };
+            };
+        };
+    };
MAINTAINERS +1 -0
index 01e06d87b926..8e8a23cad7c8 100644
@@ -23311,6 +23311,7 @@ M:	CTCaer <[email protected]>
 M:	Alexandre Hamamdjian <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/usb/rohm,bm92t.yaml
 F:	drivers/usb/typec/bm92txx.c
 
 ROHM BU270xx LIGHT SENSOR DRIVERs
Signature · 1 line
2.54.0
#6 lore raw

Re: [PATCH v2 2/3] dt-bindings: usb: add Rohm BM92TXX Type-C controller

Quoted 13 lines · Alexandre Hamamdjian

Add the device-tree binding documentation for the Rohm BM92TXX family of USB Type-C and Power Delivery controllers. The device is controlled over I2C and signals state changes through a dedicated interrupt line.

Document the rohm,* properties consumed by the driver: the optional VCONN-enable GPIO, the DisplayPort alternate-mode toggles (rohm,dp-disable, rohm,dp-alerts-enable, rohm,dp-signal-toggle-on-resume, rohm,dp-lanes), the suspend/dock tunables (rohm,led-static-on-suspend, rohm,dock-power-limit-disable) and the four rohm,pd-{5,9,12,15}v-current-limit-ma per-PDO charging current limits. A graph port is required to link the controller to a USB role switch consumer.

Quoted 6 lines
---
 .../devicetree/bindings/usb/rohm,bm92t.yaml        | 128 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 129 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-5v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-9v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-12v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-15v-current-limit-ma: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#7 lore raw

Re: [PATCH v2 2/3] dt-bindings: usb: add Rohm BM92TXX Type-C controller

Quoted 25 lines · Rob Herring (Arm)
Quoted 13 lines · Alexandre Hamamdjian

Add the device-tree binding documentation for the Rohm BM92TXX family of USB Type-C and Power Delivery controllers. The device is controlled over I2C and signals state changes through a dedicated interrupt line.

Document the rohm,* properties consumed by the driver: the optional VCONN-enable GPIO, the DisplayPort alternate-mode toggles (rohm,dp-disable, rohm,dp-alerts-enable, rohm,dp-signal-toggle-on-resume, rohm,dp-lanes), the suspend/dock tunables (rohm,led-static-on-suspend, rohm,dock-power-limit-disable) and the four rohm,pd-{5,9,12,15}v-current-limit-ma per-PDO charging current limits. A graph port is required to link the controller to a USB role switch consumer.

Quoted 6 lines
---
 .../devicetree/bindings/usb/rohm,bm92t.yaml        | 128 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 129 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

Quoted 7 lines

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-5v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-9v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-12v-current-limit-ma: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/rohm,bm92t.yaml: rohm,pd-15v-current-limit-ma: missing type definition

Use a standard unit suffix.

Rob

#8 lore raw

Re: [PATCH v2 2/3] dt-bindings: usb: add Rohm BM92TXX Type-C controller

In reply to Alexandre Hamamdjian
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Low] Missing type definitions and non-standard unit suffix for `rohm,pd-*v-current-limit-ma`. - [Low]…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] Missing type definitions and non-standard unit suffix for rohm,pd-*v-current-limit-ma.
- [Low] Invalid Devicetree property naming with underscores (pd_bat_chg-supply).
- [Low] Use of deprecated singular GPIO property suffix (rohm,vconn-en-gpio). --

commit 482fd67d1e5e9ceafc592495c4e2a23d21e35b0e
Author: Alexandre Hamamdjian <[email protected]>

dt-bindings: usb: add Rohm BM92TXX Type-C controller

Add the device-tree binding documentation for the Rohm BM92TXX family of USB Type-C and Power Delivery controllers.

Quoted 5 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +0 -0
new file mode 100644
index 0000000000000..007f70a8f5bb1

[ ... ]

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 36

Quoted 5 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +5 -0
+  vbus-source-supply:
+    description: VBUS source (provider) regulator.
+
+  pd_bat_chg-supply:
+    description: Battery charger regulator gated by Power Delivery state.

Does this property name violate Devicetree naming conventions? Devicetree properties typically use hyphens instead of underscores (e.g., pd-bat-chg-supply).

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 40

Quoted 4 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +4 -0
+
+  rohm,vconn-en-gpio:
+    maxItems: 1
+    description: GPIO controlling the external VCONN switch.

Should this property use the standard -gpios suffix? Even for a single GPIO line, the standard suffix is -gpios rather than the deprecated -gpio.

[ ... ]

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 74

Quoted 7 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +7 -0
+  rohm,dock-power-limit-disable:
+    type: boolean
+    description:
+      Disable the lower power limit applied when a dock is detected.
+
+  rohm,pd-5v-current-limit-ma:
+    description: Charging current limit in mA when 5V PD contract is active.

Does this property lack an explicit type definition? Custom properties without standard unit suffixes require a type reference, otherwise schema validation will fail for integer array values. Also, the -ma suffix is not a standard unit suffix (such as -milliamp or -microamp).

I see this schema validation failure is fixed later in the series by commit 315ea48f16e75d9fc77bc6e2af87cacc47b7249f ("dt-bindings: usb: fix properties type").

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#9 lore raw

Re: [PATCH v2 2/3] dt-bindings: usb: add Rohm BM92TXX Type-C controller

Quoted 50 lines · On Mon, May 11, 2026 at 10:05:06PM +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] Missing type definitions and non-standard unit suffix for rohm,pd-*v-current-limit-ma.
- [Low] Invalid Devicetree property naming with underscores (pd_bat_chg-supply).
- [Low] Use of deprecated singular GPIO property suffix (rohm,vconn-en-gpio). --

commit 482fd67d1e5e9ceafc592495c4e2a23d21e35b0e
Author: Alexandre Hamamdjian <[email protected]>

dt-bindings: usb: add Rohm BM92TXX Type-C controller

Add the device-tree binding documentation for the Rohm BM92TXX family of USB Type-C and Power Delivery controllers.

Quoted 5 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +0 -0
new file mode 100644
index 0000000000000..007f70a8f5bb1

[ ... ]

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 36

Quoted 5 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +5 -0
+  vbus-source-supply:
+    description: VBUS source (provider) regulator.
+
+  pd_bat_chg-supply:
+    description: Battery charger regulator gated by Power Delivery state.

Does this property name violate Devicetree naming conventions? Devicetree properties typically use hyphens instead of underscores (e.g., pd-bat-chg-supply).

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 40

Quoted 4 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +4 -0
+
+  rohm,vconn-en-gpio:
+    maxItems: 1
+    description: GPIO controlling the external VCONN switch.

Should this property use the standard -gpios suffix? Even for a single GPIO line, the standard suffix is -gpios rather than the deprecated -gpio.

[ ... ]

Documentation/devicetree/bindings/usb/rohm,bm92t.yaml line 74

Quoted 7 lines
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml new file +7 -0
+  rohm,dock-power-limit-disable:
+    type: boolean
+    description:
+      Disable the lower power limit applied when a dock is detected.
+
+  rohm,pd-5v-current-limit-ma:
+    description: Charging current limit in mA when 5V PD contract is active.
Quoted 8 lines

Does this property lack an explicit type definition? Custom properties without standard unit suffixes require a type reference, otherwise schema validation will fail for integer array values. Also, the -ma suffix is not a standard unit suffix (such as -milliamp or -microamp).

I see this schema validation failure is fixed later in the series by commit 315ea48f16e75d9fc77bc6e2af87cacc47b7249f ("dt-bindings: usb: fix properties type").

Properly suffixed properties should be used instead of making some up, but also patches in a series that fix issues introduced by a series should always be squashed..

#10 lore raw

PATCH v2 3/3 dt-bindings: usb: fix properties type

In reply to Alexandre Hamamdjian

rohm,pd-5v-current-limit-ma, rohm,pd-9v-current-limit-ma, rohm,pd-12v-current-limit-ma, rohm,pd-15v-current-limit-ma where missing type, add appropriate uint32 type

---
 Documentation/devicetree/bindings/usb/rohm,bm92t.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/rohm,bm92t.yaml +4 -0
index 007f70a8f5bb..6ee6ddcdca7a 100644
@@ -71,15 +71,19 @@ properties:
       Disable the lower power limit applied when a dock is detected.
 
   rohm,pd-5v-current-limit-ma:
+    $ref: /schemas/types.yaml#/definitions/uint32
     description: Charging current limit in mA when 5V PD contract is active.
 
   rohm,pd-9v-current-limit-ma:
+    $ref: /schemas/types.yaml#/definitions/uint32
     description: Charging current limit in mA when 9V PD contract is active.
 
   rohm,pd-12v-current-limit-ma:
+    $ref: /schemas/types.yaml#/definitions/uint32
     description: Charging current limit in mA when 12V PD contract is active.
 
   rohm,pd-15v-current-limit-ma:
+    $ref: /schemas/types.yaml#/definitions/uint32
     description: Charging current limit in mA when 15V PD contract is active.
 
   port:
Signature · 1 line
2.54.0
#11 lore raw
In reply to Alexandre Hamamdjian
Quoted 7 lines · Alexandre Hamamdjian

This series adds initial support for the Rohm Semiconductor BM92TXX family of USB Type-C and Power Delivery controllers.

This chipset is found on Nintendo Switch hardware, where it handles charger and dock USB-C / PD negotiation, DisplayPort alternate-mode entry through the dock and VBUS / VCONN control.

Quoted 6 lines

Further patches will follow to wire the driver up on Nintendo Switch device trees and to address review feedback.

---
Changes in v2:

Please start testing your commits before you send them. Also, read submitting patches in DT subdir and writing bindings documents.

Best regards,
Krzysztof