Skip to contentSkip to conversation

add low power mode support for typec ic

PATCH In review [email protected] 4 participants 11 messages May 18 – Jun 8

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

cover add low power mode support for typec ic

From: Lucas Tsai <[email protected]>

Reduce typec IC VDD/VBAT Iq during unattached states

Lucas Tsai (3):
usb: typec: tcpm: add low power mode support
usb: typec: tcpci: add low power mode support
usb: typec: tcpci_rt1711h: add low power mode support

 drivers/usb/typec/tcpm/tcpci.c         |  9 +++++++++
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 drivers/usb/typec/tcpm/tcpm.c          | 10 ++++++++++
 include/linux/usb/tcpci.h              |  4 ++++
 include/linux/usb/tcpm.h               |  4 ++++
 5 files changed, 41 insertions(+)

base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 usb: typec: tcpm: add low power mode support

From: Lucas Tsai <[email protected]>

Add low power mode support,
enter low power mode at detach,
exit low power mode at SRC_ATTACH_WAIT, SNK_ATTACH_WAIT and init.

---
 drivers/usb/typec/tcpm/tcpm.c | 10 ++++++++++
 include/linux/usb/tcpm.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +10 -0
index 55fee96d3342..a4bde4c292e4 100644
@@ -4939,6 +4939,9 @@ static void tcpm_reset_port(struct tcpm_port *port)
 
 static void tcpm_detach(struct tcpm_port *port)
 {
+	if (port->tcpc->set_low_power_mode)
+		port->tcpc->set_low_power_mode(port->tcpc, true);
+
 	if (tcpm_port_is_disconnected(port))
 		port->hard_reset_count = 0;
 
@@ -5181,6 +5184,8 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, SNK_UNATTACHED, PD_T_DRP_SNK);
 		break;
 	case SRC_ATTACH_WAIT:
+		if (port->tcpc->set_low_power_mode)
+			port->tcpc->set_low_power_mode(port->tcpc, false);
 		if (tcpm_port_is_debug_source(port))
 			tcpm_set_state(port, DEBUG_ACC_ATTACHED,
 				       port->timings.cc_debounce_time);
@@ -5439,6 +5444,8 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, SRC_UNATTACHED, PD_T_DRP_SRC);
 		break;
 	case SNK_ATTACH_WAIT:
+		if (port->tcpc->set_low_power_mode)
+			port->tcpc->set_low_power_mode(port->tcpc, false);
 		if (tcpm_port_is_debug_sink(port))
 			tcpm_set_state(port, DEBUG_ACC_ATTACHED,
 				       PD_T_CC_DEBOUNCE);
@@ -7489,6 +7496,9 @@ static void tcpm_init(struct tcpm_port *port)
 {
 	enum typec_cc_status cc1, cc2;
 
+	if (port->tcpc->set_low_power_mode)
+		port->tcpc->set_low_power_mode(port->tcpc, false);
+
 	port->tcpc->init(port->tcpc);
 
 	tcpm_reset_port(port);
include/linux/usb/tcpm.h +4 -0
index 93079450bba0..475c5d478c0e 100644
@@ -82,6 +82,9 @@ enum tcpm_transmit_type {
  *		Optional; if supported by hardware, called to start dual-role
  *		toggling or single-role connection detection. Toggling stops
  *		automatically if a connection is established.
+ * @set_low_power_mode:
+ *		Optional; if supported by hardware, called to enter or exit
+ *		low power mode.
  * @try_role:	Optional; called to set a preferred role
  * @pd_transmit:Called to transmit PD message
  * @set_bist_data: Turn on/off bist data mode for compliance testing
@@ -155,6 +158,7 @@ struct tcpc_dev {
 	int (*start_toggling)(struct tcpc_dev *dev,
 			      enum typec_port_type port_type,
 			      enum typec_cc_status cc);
+	void (*set_low_power_mode)(struct tcpc_dev *dev, bool enable);
 	int (*try_role)(struct tcpc_dev *dev, int role);
 	int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type,
 			   const struct pd_message *msg, unsigned int negotiated_rev);
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/3] usb: typec: tcpm: add low power mode support

Quoted 28 lines · On Mon, May 18, 2026 at 2:18 AM <[email protected]> wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
enter low power mode at detach,
exit low power mode at SRC_ATTACH_WAIT, SNK_ATTACH_WAIT and init.

---
 drivers/usb/typec/tcpm/tcpm.c | 10 ++++++++++
 include/linux/usb/tcpm.h      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +3 -0
index 55fee96d3342..a4bde4c292e4 100644
@@ -4939,6 +4939,9 @@ static void tcpm_reset_port(struct tcpm_port *port)
 
 static void tcpm_detach(struct tcpm_port *port)
 {
+       if (port->tcpc->set_low_power_mode)
+               port->tcpc->set_low_power_mode(port->tcpc, true);
+
        if (tcpm_port_is_disconnected(port))
                port->hard_reset_count = 0;
 

drivers/usb/typec/tcpm/tcpm.c static void run_state_machine(struct tcpm_port *port) · line 5188

Quoted 5 lines
drivers/usb/typec/tcpm/tcpm.c +2 -0
@@ -5181,6 +5184,8 @@ static void run_state_machine(struct tcpm_port *port)
                        tcpm_set_state(port, SNK_UNATTACHED, PD_T_DRP_SNK);
                break;
        case SRC_ATTACH_WAIT:
+               if (port->tcpc->set_low_power_mode)
+                       port->tcpc->set_low_power_mode(port->tcpc, false);

If the callback ends up being absolutely needed, then, Instead of calling set_low_power_mode() here and in SNK_ATTACH_WAIT, you can invoke it in __tcpm_cc_change() in the TOGGLING switch case if the state machine is going to enter SRC_ATTACH_WAIT or SNK_ATTACH_WAIT.

Quoted 47 lines
drivers/usb/typec/tcpm/tcpm.c +5 -0
                if (tcpm_port_is_debug_source(port))
                        tcpm_set_state(port, DEBUG_ACC_ATTACHED,
                                       port->timings.cc_debounce_time);
@@ -5439,6 +5444,8 @@ static void run_state_machine(struct tcpm_port *port)
                        tcpm_set_state(port, SRC_UNATTACHED, PD_T_DRP_SRC);
                break;
        case SNK_ATTACH_WAIT:
+               if (port->tcpc->set_low_power_mode)
+                       port->tcpc->set_low_power_mode(port->tcpc, false);
                if (tcpm_port_is_debug_sink(port))
                        tcpm_set_state(port, DEBUG_ACC_ATTACHED,
                                       PD_T_CC_DEBOUNCE);
@@ -7489,6 +7496,9 @@ static void tcpm_init(struct tcpm_port *port)
 {
        enum typec_cc_status cc1, cc2;
 
+       if (port->tcpc->set_low_power_mode)
+               port->tcpc->set_low_power_mode(port->tcpc, false);
+
        port->tcpc->init(port->tcpc);
 
        tcpm_reset_port(port);
include/linux/usb/tcpm.h +4 -1
index 93079450bba0..475c5d478c0e 100644
@@ -82,6 +82,9 @@ enum tcpm_transmit_type {
  *             Optional; if supported by hardware, called to start dual-role
  *             toggling or single-role connection detection. Toggling stops
  *             automatically if a connection is established.
+ * @set_low_power_mode:
+ *             Optional; if supported by hardware, called to enter or exit
+ *             low power mode.
  * @try_role:  Optional; called to set a preferred role
  * @pd_transmit:Called to transmit PD message
  * @set_bist_data: Turn on/off bist data mode for compliance testing
@@ -155,6 +158,7 @@ struct tcpc_dev {
        int (*start_toggling)(struct tcpc_dev *dev,
                              enum typec_port_type port_type,
                              enum typec_cc_status cc);
+       void (*set_low_power_mode)(struct tcpc_dev *dev, bool enable);
        int (*try_role)(struct tcpc_dev *dev, int role);
        int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type,
                           const struct pd_message *msg, unsigned int negotiated_rev);
--

2.43.0

#3 lore raw

PATCH 2/3 usb: typec: tcpci: add low power mode support

In reply to [email protected]

From: Lucas Tsai <[email protected]>

Add low power mode support,
due to no standard about low power mode in TCPCI Spec, handle vendor low power mode currently.

---
 drivers/usb/typec/tcpm/tcpci.c | 9 +++++++++
 include/linux/usb/tcpci.h      | 4 ++++
 2 files changed, 13 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +9 -0
index 0148b8f50412..8f6df4c708f5 100644
@@ -227,6 +227,14 @@ static int tcpci_start_toggling(struct tcpc_dev *tcpc,
 			    TCPC_CMD_LOOK4CONNECTION);
 }
 
+static void tcpci_set_low_power_mode(struct tcpc_dev *tcpc, bool enable)
+{
+	struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
+
+	if (tcpci->data->set_low_power_mode)
+		tcpci->data->set_low_power_mode(tcpci, tcpci->data, enable);
+}
+
 static int tcpci_get_cc(struct tcpc_dev *tcpc,
 			enum typec_cc_status *cc1, enum typec_cc_status *cc2)
 {
@@ -857,6 +865,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
 	tcpci->tcpc.set_polarity = tcpci_set_polarity;
 	tcpci->tcpc.set_vconn = tcpci_set_vconn;
 	tcpci->tcpc.start_toggling = tcpci_start_toggling;
+	tcpci->tcpc.set_low_power_mode = tcpci_set_low_power_mode;
 
 	tcpci->tcpc.set_pd_rx = tcpci_set_pd_rx;
 	tcpci->tcpc.set_roles = tcpci_set_roles;
include/linux/usb/tcpci.h +4 -0
index f7f5cfbdef12..0ecf11b7b8f2 100644
@@ -177,6 +177,8 @@ struct tcpci;
 /*
  * @TX_BUF_BYTE_x_hidden:
  *		optional; Set when TX_BUF_BYTE_x can only be accessed through I2C_WRITE_BYTE_COUNT.
+ * @set_low_power_mode:
+ *		Optional; Callback to enter or exit low power mode.
  * @frs_sourcing_vbus:
  *		Optional; Callback to perform chip specific operations when FRS
  *		is sourcing vbus.
@@ -221,6 +223,8 @@ struct tcpci_data {
 			 bool enable);
 	int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
 				  enum typec_cc_status cc);
+	void (*set_low_power_mode)(struct tcpci *tcpci, struct tcpci_data *data,
+				   bool enable);
 	int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink);
 	void (*frs_sourcing_vbus)(struct tcpci *tcpci, struct tcpci_data *data);
 	void (*set_partner_usb_comm_capable)(struct tcpci *tcpci, struct tcpci_data *data,
Signature · 1 line
2.43.0
#4 lore raw

PATCH 3/3 usb: typec: tcpci_rt1711h: add low power mode support

In reply to [email protected]

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10, while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +14 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1	0x80
 #define RT1711H_PHYCTRL2	0x81
+#define RT1711H_BMCCTRL		0x90
 
 #define RT1711H_RTCTRL4		0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
 	return 0;
 }
 
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+				       struct tcpci_data *tdata, bool enable)
+{
+	int ret;
+	struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+	ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+	if (ret < 0)
+		dev_err(chip->dev, "%s lpm fail(%d)\n",
+			enable ? "enter" : "exit", ret);
+}
+
 static irqreturn_t rt1711h_irq(int irq, void *dev_id)
 {
 	int ret;
@@ -336,6 +349,7 @@ static int rt1711h_probe(struct i2c_client *client)
 	chip->data.set_vbus = rt1711h_set_vbus;
 	chip->data.set_vconn = rt1711h_set_vconn;
 	chip->data.start_drp_toggling = rt1711h_start_drp_toggling;
+	chip->data.set_low_power_mode = rt1711h_set_low_power_mode;
 	chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
 	if (IS_ERR_OR_NULL(chip->tcpci))
 		return PTR_ERR(chip->tcpci);
Signature · 1 line
2.43.0
maintainer
#5 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

Hi,

I'm sorry to keep you waiting.

Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

What is VDD Iq?

Quoted 25 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +2 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1	0x80
 #define RT1711H_PHYCTRL2	0x81
+#define RT1711H_BMCCTRL		0x90
 
 #define RT1711H_RTCTRL4		0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
 	return 0;
 }
 
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 10 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +10 -0
+				       struct tcpci_data *tdata, bool enable)
+{
+	int ret;
+	struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+	ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+	if (ret < 0)
+		dev_err(chip->dev, "%s lpm fail(%d)\n",
+			enable ? "enter" : "exit", ret);
+}

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Br,

Signature · 1 line
heikki
#6 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

Quoted 4 lines · Heikki Krogerus

Hi,

I'm sorry to keep you waiting.

Quoted 9 lines
Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

What is VDD Iq?

VDD pin is RT1715's power input,
and Iq is the quiescent current,
so the low power mode reduces the baseline power used by RT1715.

Quoted 24 lines
Quoted 24 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +1 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1	0x80
 #define RT1711H_PHYCTRL2	0x81
+#define RT1711H_BMCCTRL		0x90
 
 #define RT1711H_RTCTRL4		0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
 	return 0;
 }
 
Quoted 14 lines

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 11 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +11 -0
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+				       struct tcpci_data *tdata, bool enable)
+{
+	int ret;
+	struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+	ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+	if (ret < 0)
+		dev_err(chip->dev, "%s lpm fail(%d)\n",
+			enable ? "enter" : "exit", ret);
+}

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Entering low power mode or not relates directly to the status of USB-C port:
enter low power mode when USB-C port attached nothing (unattached), and exit low power mode when attached with cable or device.

In the other word, it is possible to have system suspended and USB-C port attached at the same time, so it is not suitable to bind the flow of low power mode to the PM suspend and resume.

--
Lucas Tsai

Quoted 5 lines

Br,

Signature · 1 line
heikki
maintainer
#7 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

Quoted 12 lines · On Wed, Jun 03, 2026 at 11:18:27AM +0800, [email protected] wrote:
Quoted 11 lines · Heikki Krogerus

Hi,

I'm sorry to keep you waiting.

Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

Quoted 6 lines
Quoted 2 lines

What is VDD Iq?

VDD pin is RT1715's power input,
and Iq is the quiescent current,
so the low power mode reduces the baseline power used by RT1715.

Got it, thanks. Please add that explanation to the commit message.

Quoted 39 lines
Quoted 24 lines
Quoted 24 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +1 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1	0x80
 #define RT1711H_PHYCTRL2	0x81
+#define RT1711H_BMCCTRL		0x90
 
 #define RT1711H_RTCTRL4		0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
 	return 0;
 }
 
Quoted 14 lines

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 11 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +11 -0
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+				       struct tcpci_data *tdata, bool enable)
+{
+	int ret;
+	struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+	ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+	if (ret < 0)
+		dev_err(chip->dev, "%s lpm fail(%d)\n",
+			enable ? "enter" : "exit", ret);
+}

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Quoted 7 lines

Entering low power mode or not relates directly to the status of USB-C port:
enter low power mode when USB-C port attached nothing (unattached), and exit low power mode when attached with cable or device.

In the other word, it is possible to have system suspended and USB-C port attached at the same time, so it is not suitable to bind the flow of low power mode to the PM suspend and resume.

You don't have to do that in the system suspend callback, but you still should do this in the runtime suspend callback, no?

This is not a major thing, but mctp.c is a bit bloated, I want to make sure that adding this kind of callbacks is really necessary.

Badhri, do you have time to check this series?

thanks,

Signature · 1 line
heikki
#8 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

Quoted 47 lines · Heikki Krogerus
Quoted 12 lines · On Wed, Jun 03, 2026 at 11:18:27AM +0800, [email protected] wrote:
Quoted 11 lines · Heikki Krogerus

Hi,

I'm sorry to keep you waiting.

Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

Quoted 6 lines
Quoted 2 lines

What is VDD Iq?

VDD pin is RT1715's power input,
and Iq is the quiescent current,
so the low power mode reduces the baseline power used by RT1715.

Got it, thanks. Please add that explanation to the commit message.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +1 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1 0x80
 #define RT1711H_PHYCTRL2 0x81
+#define RT1711H_BMCCTRL          0x90
 
 #define RT1711H_RTCTRL4          0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
  return 0;
 }
 
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 11 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +11 -0
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+                                struct tcpci_data *tdata, bool enable)
+{
+ int ret;
+ struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+ ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+ if (ret < 0)
+         dev_err(chip->dev, "%s lpm fail(%d)\n",
+                 enable ? "enter" : "exit", ret);
+}

Any reason why cant rt1711h_set_low_power_mode() be called from rt1711h_init_cc_params() and rt1711h_start_drp_toggling() ? rt1711h_start_drp_toggling() can enable low power mode. rt1711h_init_cc_params(), which is already aware of CC status, can disable low power mode when a source or sink is detected. This approach would avoid adding a new callback in tcpci.c.

If the above works, you could optionally rely on runtime pm callbacks to call rt1711h_set_low_power_mode() and increment/decrement the usage count in rt1711h_init_cc_params() and rt1711h_start_drp_toggling().

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Entering low power mode or not relates directly to the status of USB-C port:
enter low power mode when USB-C port attached nothing (unattached), and exit low power mode when attached with cable or device.

Quoted 8 lines
Quoted 3 lines

In the other word, it is possible to have system suspended and USB-C port attached at the same time, so it is not suitable to bind the flow of low power mode to the PM suspend and resume.

You don't have to do that in the system suspend callback, but you still should do this in the runtime suspend callback, no?

This is not a major thing, but mctp.c is a bit bloated, I want to make

I believe Heikki was referring to tcpci.c here.

Quoted 8 lines

sure that adding this kind of callbacks is really necessary.

Badhri, do you have time to check this series?

thanks,

--
heikki

#9 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

Quoted 49 lines · Badhri Jagan Sridharan
Quoted 47 lines · Heikki Krogerus
Quoted 12 lines · On Wed, Jun 03, 2026 at 11:18:27AM +0800, [email protected] wrote:
Quoted 11 lines · Heikki Krogerus

Hi,

I'm sorry to keep you waiting.

Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

Quoted 6 lines
Quoted 2 lines

What is VDD Iq?

VDD pin is RT1715's power input,
and Iq is the quiescent current,
so the low power mode reduces the baseline power used by RT1715.

Got it, thanks. Please add that explanation to the commit message.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +1 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1 0x80
 #define RT1711H_PHYCTRL2 0x81
+#define RT1711H_BMCCTRL          0x90
 
 #define RT1711H_RTCTRL4          0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
  return 0;
 }
 
Quoted 15 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 11 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +11 -0
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+                                struct tcpci_data *tdata, bool enable)
+{
+ int ret;
+ struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+ ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+ if (ret < 0)
+         dev_err(chip->dev, "%s lpm fail(%d)\n",
+                 enable ? "enter" : "exit", ret);
+}

Any reason why cant rt1711h_set_low_power_mode() be called from rt1711h_init_cc_params() and rt1711h_start_drp_toggling() ? rt1711h_start_drp_toggling() can enable low power mode.

rt1711h_start_drp_toggling() will not be called for non-DRP ports, e.g.: sink only or source only ports, because the flow in tcpci.c blocks such conditions:
static int tcpci_start_toggling(...)

{
	...
	if (port_type != TYPEC_PORT_DRP)
		return -EOPNOTSUPP;
	...
}
Quoted 3 lines

rt1711h_init_cc_params(), which is already aware of CC status, can disable low power mode when a source or sink is detected. This approach would avoid adding a new callback in tcpci.c.

Since rt1711h_start_drp_toggling() approach have the limitations, a new callback seems like being inevitable,
so putting the logic of disabling low power mode in the new callback.

Quoted 5 lines

If the above works, you could optionally rely on runtime pm callbacks to call rt1711h_set_low_power_mode() and increment/decrement the usage count in rt1711h_init_cc_params() and rt1711h_start_drp_toggling().

The power mode of TCPC IC does not relate to system/runtime pm, but to the USB-C port status (Attached vs. Unattached).

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 3 lines

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Entering low power mode or not relates directly to the status of USB-C port:
enter low power mode when USB-C port attached nothing (unattached), and exit low power mode when attached with cable or device.

In the other word, it is possible to have system suspended and USB-C port attached at the same time, so it is not suitable to bind the flow of low power mode to the PM suspend and resume.

Quoted 7 lines
Quoted 4 lines

You don't have to do that in the system suspend callback, but you still should do this in the runtime suspend callback, no?

This is not a major thing, but mctp.c is a bit bloated, I want to make

I believe Heikki was referring to tcpci.c here.

Thanks for your clarifying.

Quoted 8 lines
Quoted 8 lines

sure that adding this kind of callbacks is really necessary.

Badhri, do you have time to check this series?

thanks,

--
heikki

Thanks.
--
Lucas Tsai

#10 lore raw

Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support

In reply to Heikki Krogerus
Quoted 13 lines · Heikki Krogerus
Quoted 12 lines · On Wed, Jun 03, 2026 at 11:18:27AM +0800, [email protected] wrote:
Quoted 11 lines · Heikki Krogerus

Hi,

I'm sorry to keep you waiting.

Quoted 5 lines · On Mon, May 18, 2026 at 05:15:14PM +0800, [email protected] wrote:

From: Lucas Tsai <[email protected]>

Add low power mode support,
add the op to enter and exit low power mode, this mode reduce RT1711H/RT1715 VDD Iq to 1 of 10,

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

What is VDD Iq?

VDD pin is RT1715's power input,
and Iq is the quiescent current,
so the low power mode reduces the baseline power used by RT1715.

Got it, thanks. Please add that explanation to the commit message.

No problem, I will include the explanation to the commit message of next version.

Quoted 43 lines
Quoted 43 lines
Quoted 24 lines
Quoted 24 lines

while disabling VBUS detection and PD BMC
but keeping CC detection and not affecting DRP toggling.

---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +1 -0
index 4b3e4e22a82e..48d6a6823ab9 100644
@@ -20,6 +20,7 @@
 
 #define RT1711H_PHYCTRL1	0x80
 #define RT1711H_PHYCTRL2	0x81
+#define RT1711H_BMCCTRL		0x90
 
 #define RT1711H_RTCTRL4		0x93
 /* rx threshold of rd/rp: 1b0 for level 0.4V/0.7V, 1b1 for 0.35V/0.75V */
@@ -254,6 +255,18 @@ static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
 	return 0;
 }
 
Quoted 14 lines

drivers/usb/typec/tcpm/tcpci_rt1711h.c static int rt1711h_start_drp_toggling(struct tcpci *tcpci, · line 268

Quoted 11 lines
drivers/usb/typec/tcpm/tcpci_rt1711h.c +11 -0
+static void rt1711h_set_low_power_mode(struct tcpci *tcpci,
+				       struct tcpci_data *tdata, bool enable)
+{
+	int ret;
+	struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
+
+	ret = rt1711h_write8(chip, RT1711H_BMCCTRL, enable ? 0x08 : 0x07);
+	if (ret < 0)
+		dev_err(chip->dev, "%s lpm fail(%d)\n",
+			enable ? "enter" : "exit", ret);
+}

Why couldn't this just be done in the PM suspend and resume callbacks for this driver?

Entering low power mode or not relates directly to the status of USB-C port:
enter low power mode when USB-C port attached nothing (unattached), and exit low power mode when attached with cable or device.

Quoted 7 lines
Quoted 3 lines

In the other word, it is possible to have system suspended and USB-C port attached at the same time, so it is not suitable to bind the flow of low power mode to the PM suspend and resume.

You don't have to do that in the system suspend callback, but you still should do this in the runtime suspend callback, no?

ya, and there is no suitable and existing callback chain to do so, so I create a new one.

Quoted 9 lines

This is not a major thing, but mctp.c is a bit bloated, I want to make sure that adding this kind of callbacks is really necessary.

Badhri, do you have time to check this series?

thanks,

Signature · 1 line
heikki

Thanks.
--
Lucas Tsai