Linux USB
 help / color / mirror / Atom feed
* [PATCH 0/3] add low power mode support for typec ic
@ 2026-05-18  9:15 cy_huang
  2026-05-18  9:15 ` [PATCH 1/3] usb: typec: tcpm: add low power mode support cy_huang
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: cy_huang @ 2026-05-18  9:15 UTC (permalink / raw)
  To: linux-usb
  Cc: badhri, heikki.krogerus, gregkh, lucas_tsai, cy_huang, ren_chen,
	kevin_hung

From: Lucas Tsai <lucas_tsai@richtek.com>

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
-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] usb: typec: tcpm: add low power mode support
  2026-05-18  9:15 [PATCH 0/3] add low power mode support for typec ic cy_huang
@ 2026-05-18  9:15 ` cy_huang
  2026-06-06 16:37   ` Badhri Jagan Sridharan
  2026-05-18  9:15 ` [PATCH 2/3] usb: typec: tcpci: " cy_huang
  2026-05-18  9:15 ` [PATCH 3/3] usb: typec: tcpci_rt1711h: " cy_huang
  2 siblings, 1 reply; 11+ messages in thread
From: cy_huang @ 2026-05-18  9:15 UTC (permalink / raw)
  To: linux-usb
  Cc: badhri, heikki.krogerus, gregkh, lucas_tsai, cy_huang, ren_chen,
	kevin_hung

From: Lucas Tsai <lucas_tsai@richtek.com>

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

Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 10 ++++++++++
 include/linux/usb/tcpm.h      |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 55fee96d3342..a4bde4c292e4 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -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);
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 93079450bba0..475c5d478c0e 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] usb: typec: tcpci: add low power mode support
  2026-05-18  9:15 [PATCH 0/3] add low power mode support for typec ic cy_huang
  2026-05-18  9:15 ` [PATCH 1/3] usb: typec: tcpm: add low power mode support cy_huang
@ 2026-05-18  9:15 ` cy_huang
  2026-05-18  9:15 ` [PATCH 3/3] usb: typec: tcpci_rt1711h: " cy_huang
  2 siblings, 0 replies; 11+ messages in thread
From: cy_huang @ 2026-05-18  9:15 UTC (permalink / raw)
  To: linux-usb
  Cc: badhri, heikki.krogerus, gregkh, lucas_tsai, cy_huang, ren_chen,
	kevin_hung

From: Lucas Tsai <lucas_tsai@richtek.com>

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

Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
---
 drivers/usb/typec/tcpm/tcpci.c | 9 +++++++++
 include/linux/usb/tcpci.h      | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index 0148b8f50412..8f6df4c708f5 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -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;
diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h
index f7f5cfbdef12..0ecf11b7b8f2 100644
--- a/include/linux/usb/tcpci.h
+++ b/include/linux/usb/tcpci.h
@@ -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,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-05-18  9:15 [PATCH 0/3] add low power mode support for typec ic cy_huang
  2026-05-18  9:15 ` [PATCH 1/3] usb: typec: tcpm: add low power mode support cy_huang
  2026-05-18  9:15 ` [PATCH 2/3] usb: typec: tcpci: " cy_huang
@ 2026-05-18  9:15 ` cy_huang
  2026-06-01 13:36   ` Heikki Krogerus
  2 siblings, 1 reply; 11+ messages in thread
From: cy_huang @ 2026-05-18  9:15 UTC (permalink / raw)
  To: linux-usb
  Cc: badhri, heikki.krogerus, gregkh, lucas_tsai, cy_huang, ren_chen,
	kevin_hung

From: Lucas Tsai <lucas_tsai@richtek.com>

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.

Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
index 4b3e4e22a82e..48d6a6823ab9 100644
--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
+++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
@@ -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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-05-18  9:15 ` [PATCH 3/3] usb: typec: tcpci_rt1711h: " cy_huang
@ 2026-06-01 13:36   ` Heikki Krogerus
  2026-06-03  3:18     ` lucas_tsai
  0 siblings, 1 reply; 11+ messages in thread
From: Heikki Krogerus @ 2026-06-01 13:36 UTC (permalink / raw)
  To: cy_huang; +Cc: linux-usb, badhri, gregkh, lucas_tsai, ren_chen, kevin_hung

Hi,

I'm sorry to keep you waiting.

On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> From: Lucas Tsai <lucas_tsai@richtek.com>
> 
> 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?

> while disabling VBUS detection and PD BMC
> but keeping CC detection and not affecting DRP toggling.
> 
> Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> ---
>  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index 4b3e4e22a82e..48d6a6823ab9 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -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);
> +}

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

Br,

-- 
heikki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-06-01 13:36   ` Heikki Krogerus
@ 2026-06-03  3:18     ` lucas_tsai
  2026-06-05 13:03       ` Heikki Krogerus
  0 siblings, 1 reply; 11+ messages in thread
From: lucas_tsai @ 2026-06-03  3:18 UTC (permalink / raw)
  To: heikki.krogerus
  Cc: badhri, cy_huang, gregkh, kevin_hung, linux-usb, lucas_tsai,
	ren_chen

On Mon, Jun 01, 2026 at 04:36:02PM +0300, Heikki Krogerus wrote:
> Hi,
> 
> I'm sorry to keep you waiting.
> 
> On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> > From: Lucas Tsai <lucas_tsai@richtek.com>
> > 
> > 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.

> > while disabling VBUS detection and PD BMC
> > but keeping CC detection and not affecting DRP toggling.
> > 
> > Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> > ---
> >  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > index 4b3e4e22a82e..48d6a6823ab9 100644
> > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > @@ -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);
> > +}
> 
> 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
> 
> Br,
> 
> -- 
> heikki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-06-03  3:18     ` lucas_tsai
@ 2026-06-05 13:03       ` Heikki Krogerus
  2026-06-06 16:20         ` Badhri Jagan Sridharan
  2026-06-08  3:05         ` lucas_tsai
  0 siblings, 2 replies; 11+ messages in thread
From: Heikki Krogerus @ 2026-06-05 13:03 UTC (permalink / raw)
  To: lucas_tsai; +Cc: badhri, cy_huang, gregkh, kevin_hung, linux-usb, ren_chen

On Wed, Jun 03, 2026 at 11:18:27AM +0800, lucas_tsai@richtek.com wrote:
> On Mon, Jun 01, 2026 at 04:36:02PM +0300, Heikki Krogerus wrote:
> > Hi,
> > 
> > I'm sorry to keep you waiting.
> > 
> > On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> > > From: Lucas Tsai <lucas_tsai@richtek.com>
> > > 
> > > 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.

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

> > > while disabling VBUS detection and PD BMC
> > > but keeping CC detection and not affecting DRP toggling.
> > > 
> > > Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> > > ---
> > >  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > > 
> > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > index 4b3e4e22a82e..48d6a6823ab9 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > @@ -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);
> > > +}
> > 
> > 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.

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,

-- 
heikki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-06-05 13:03       ` Heikki Krogerus
@ 2026-06-06 16:20         ` Badhri Jagan Sridharan
  2026-06-08  4:16           ` Lucas Tsai
  2026-06-08  3:05         ` lucas_tsai
  1 sibling, 1 reply; 11+ messages in thread
From: Badhri Jagan Sridharan @ 2026-06-06 16:20 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: lucas_tsai, cy_huang, gregkh, kevin_hung, linux-usb, ren_chen

On Fri, Jun 5, 2026 at 6:03 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> On Wed, Jun 03, 2026 at 11:18:27AM +0800, lucas_tsai@richtek.com wrote:
> > On Mon, Jun 01, 2026 at 04:36:02PM +0300, Heikki Krogerus wrote:
> > > Hi,
> > >
> > > I'm sorry to keep you waiting.
> > >
> > > On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> > > > From: Lucas Tsai <lucas_tsai@richtek.com>
> > > >
> > > > 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.
>
> Got it, thanks. Please add that explanation to the commit message.
>
> > > > while disabling VBUS detection and PD BMC
> > > > but keeping CC detection and not affecting DRP toggling.
> > > >
> > > > Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> > > > ---
> > > >  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
> > > >  1 file changed, 14 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > index 4b3e4e22a82e..48d6a6823ab9 100644
> > > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > @@ -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);
> > > > +}

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().

> > >
> > > 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.
>
> 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.

> sure that adding this kind of callbacks is really necessary.
>
> Badhri, do you have time to check this series?
>
> thanks,
>
> --
> heikki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] usb: typec: tcpm: add low power mode support
  2026-05-18  9:15 ` [PATCH 1/3] usb: typec: tcpm: add low power mode support cy_huang
@ 2026-06-06 16:37   ` Badhri Jagan Sridharan
  0 siblings, 0 replies; 11+ messages in thread
From: Badhri Jagan Sridharan @ 2026-06-06 16:37 UTC (permalink / raw)
  To: cy_huang
  Cc: linux-usb, heikki.krogerus, gregkh, lucas_tsai, ren_chen,
	kevin_hung

On Mon, May 18, 2026 at 2:18 AM <cy_huang@richtek.com> wrote:
>
> From: Lucas Tsai <lucas_tsai@richtek.com>
>
> Add low power mode support,
> enter low power mode at detach,
> exit low power mode at SRC_ATTACH_WAIT, SNK_ATTACH_WAIT and init.
>
> Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 10 ++++++++++
>  include/linux/usb/tcpm.h      |  4 ++++
>  2 files changed, 14 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 55fee96d3342..a4bde4c292e4 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -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 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.

>                 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);
> diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
> index 93079450bba0..475c5d478c0e 100644
> --- a/include/linux/usb/tcpm.h
> +++ b/include/linux/usb/tcpm.h
> @@ -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
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-06-05 13:03       ` Heikki Krogerus
  2026-06-06 16:20         ` Badhri Jagan Sridharan
@ 2026-06-08  3:05         ` lucas_tsai
  1 sibling, 0 replies; 11+ messages in thread
From: lucas_tsai @ 2026-06-08  3:05 UTC (permalink / raw)
  To: heikki.krogerus
  Cc: badhri, cy_huang, gregkh, kevin_hung, linux-usb, lucas_tsai,
	ren_chen, alan_lan

On Fri, Jun 05, 2026 at 04:03:38PM +0300, Heikki Krogerus wrote:
> On Wed, Jun 03, 2026 at 11:18:27AM +0800, lucas_tsai@richtek.com wrote:
> > On Mon, Jun 01, 2026 at 04:36:02PM +0300, Heikki Krogerus wrote:
> > > Hi,
> > > 
> > > I'm sorry to keep you waiting.
> > > 
> > > On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> > > > From: Lucas Tsai <lucas_tsai@richtek.com>
> > > > 
> > > > 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.
> 
> 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.

> > > > while disabling VBUS detection and PD BMC
> > > > but keeping CC detection and not affecting DRP toggling.
> > > > 
> > > > Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> > > > ---
> > > >  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
> > > >  1 file changed, 14 insertions(+)
> > > > 
> > > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > index 4b3e4e22a82e..48d6a6823ab9 100644
> > > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > @@ -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);
> > > > +}
> > > 
> > > 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.
> 
> 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.

> 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,
> 
> -- 
> heikki

Thanks.
--
Lucas Tsai

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] usb: typec: tcpci_rt1711h: add low power mode support
  2026-06-06 16:20         ` Badhri Jagan Sridharan
@ 2026-06-08  4:16           ` Lucas Tsai
  0 siblings, 0 replies; 11+ messages in thread
From: Lucas Tsai @ 2026-06-08  4:16 UTC (permalink / raw)
  To: Badhri Jagan Sridharan
  Cc: Heikki Krogerus, cy_huang, gregkh, kevin_hung, linux-usb,
	ren_chen, lucas_tsai, alan_lan

On Sat, Jun 06, 2026 at 09:20:34AM -0700, Badhri Jagan Sridharan wrote:
> On Fri, Jun 5, 2026 at 6:03 AM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > On Wed, Jun 03, 2026 at 11:18:27AM +0800, lucas_tsai@richtek.com wrote:
> > > On Mon, Jun 01, 2026 at 04:36:02PM +0300, Heikki Krogerus wrote:
> > > > Hi,
> > > >
> > > > I'm sorry to keep you waiting.
> > > >
> > > > On Mon, May 18, 2026 at 05:15:14PM +0800, cy_huang@richtek.com wrote:
> > > > > From: Lucas Tsai <lucas_tsai@richtek.com>
> > > > >
> > > > > 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.
> >
> > Got it, thanks. Please add that explanation to the commit message.
> >
> > > > > while disabling VBUS detection and PD BMC
> > > > > but keeping CC detection and not affecting DRP toggling.
> > > > >
> > > > > Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com>
> > > > > ---
> > > > >  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 ++++++++++++++
> > > > >  1 file changed, 14 insertions(+)
> > > > >
> > > > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > > index 4b3e4e22a82e..48d6a6823ab9 100644
> > > > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > > > @@ -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);
> > > > > +}
> 
> 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;
	...
}

> 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.

> 
> 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).

> > > >
> > > > 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.
> >
> > 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.

> > sure that adding this kind of callbacks is really necessary.
> >
> > Badhri, do you have time to check this series?
> >
> > thanks,
> >
> > --
> > heikki

Thanks.
--
Lucas Tsai

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-06-08  4:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18  9:15 [PATCH 0/3] add low power mode support for typec ic cy_huang
2026-05-18  9:15 ` [PATCH 1/3] usb: typec: tcpm: add low power mode support cy_huang
2026-06-06 16:37   ` Badhri Jagan Sridharan
2026-05-18  9:15 ` [PATCH 2/3] usb: typec: tcpci: " cy_huang
2026-05-18  9:15 ` [PATCH 3/3] usb: typec: tcpci_rt1711h: " cy_huang
2026-06-01 13:36   ` Heikki Krogerus
2026-06-03  3:18     ` lucas_tsai
2026-06-05 13:03       ` Heikki Krogerus
2026-06-06 16:20         ` Badhri Jagan Sridharan
2026-06-08  4:16           ` Lucas Tsai
2026-06-08  3:05         ` lucas_tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox