All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
@ 2024-02-27 23:58 Badhri Jagan Sridharan
  2024-02-28  0:00 ` kernel test robot
  2024-02-28  0:06 ` Badhri Jagan Sridharan
  0 siblings, 2 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2024-02-27 23:58 UTC (permalink / raw)
  To: gregkh, linux, heikki.krogerus
  Cc: kyletso, linux-usb, linux-kernel, rdbabiera, amitsd, stable,
	frank.wang, broonie, Badhri Jagan Sridharan, stable

While commit 69f89168b310 ("usb: typec: tpcm: Fix issues with power being
removed during reset") fixes the boot issues for bus powered devices such
as LibreTech Renegade Elite/Firefly, it trades off the CC pins NOT being
Hi-Zed during errory recovery (i.e PORT_RESET) for devices which are NOT
bus powered(a.k.a self powered). This change Hi-Zs the CC pins only for
self powered devices, thus preventing brown out for bus powered devices

Adhering to spec is gaining more importance due to the Common charger
initiative enforced by the European Union.

Quoting from the spec:
    4.5.2.2.2.1 ErrorRecovery State Requirements
    The port shall not drive VBUS or VCONN, and shall present a
    high-impedance to ground (above zOPEN) on its CC1 and CC2 pins.

Hi-Zing the CC pins is the inteded behavior for PORT_RESET.
CC pins are set to default state after tErrorRecovery in
PORT_RESET_WAIT_OFF.

    4.5.2.2.2.2 Exiting From ErrorRecovery State
    A Sink shall transition to Unattached.SNK after tErrorRecovery.
    A Source shall transition to Unattached.SRC after tErrorRecovery.

Fixes: 69f89168b310 ("usb: typec: tpcm: Fix issues with power being removed during reset")
Cc: stable@kernel.org
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index c9a78f55ca48..bbe1381232eb 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5593,8 +5593,11 @@ static void run_state_machine(struct tcpm_port *port)
 		break;
 	case PORT_RESET:
 		tcpm_reset_port(port);
-		tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
-			    TYPEC_CC_RD : tcpm_rp_cc(port));
+		if (port->self_powered)
+			tcpm_set_cc(port, TYPEC_CC_OPEN);
+		else
+			tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
+				    TYPEC_CC_RD : tcpm_rp_cc(port));
 		tcpm_set_state(port, PORT_RESET_WAIT_OFF,
 			       PD_T_ERROR_RECOVERY);
 		break;

base-commit: a560a5672826fc1e057068bda93b3d4c98d037a2
-- 
2.44.0.rc1.240.g4c46232300-goog


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

* Re: [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
  2024-02-27 23:58 [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices Badhri Jagan Sridharan
@ 2024-02-28  0:00 ` kernel test robot
  2024-02-28  0:06 ` Badhri Jagan Sridharan
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-02-28  0:00 UTC (permalink / raw)
  To: Badhri Jagan Sridharan; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
Link: https://lore.kernel.org/stable/20240227235832.744908-1-badhri%40google.com

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




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

* Re: [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
  2024-02-27 23:58 [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices Badhri Jagan Sridharan
  2024-02-28  0:00 ` kernel test robot
@ 2024-02-28  0:06 ` Badhri Jagan Sridharan
  1 sibling, 0 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2024-02-28  0:06 UTC (permalink / raw)
  To: gregkh, linux, heikki.krogerus
  Cc: kyletso, linux-usb, linux-kernel, rdbabiera, amitsd, stable,
	frank.wang, broonie, stable

HI all,

Please ignore this patch. Adding the right tag "Cc:
stable@vger.kernel.org"  for CCing stable.

Thanks,
Badhri

On Tue, Feb 27, 2024 at 3:58 PM Badhri Jagan Sridharan
<badhri@google.com> wrote:
>
> While commit 69f89168b310 ("usb: typec: tpcm: Fix issues with power being
> removed during reset") fixes the boot issues for bus powered devices such
> as LibreTech Renegade Elite/Firefly, it trades off the CC pins NOT being
> Hi-Zed during errory recovery (i.e PORT_RESET) for devices which are NOT
> bus powered(a.k.a self powered). This change Hi-Zs the CC pins only for
> self powered devices, thus preventing brown out for bus powered devices
>
> Adhering to spec is gaining more importance due to the Common charger
> initiative enforced by the European Union.
>
> Quoting from the spec:
>     4.5.2.2.2.1 ErrorRecovery State Requirements
>     The port shall not drive VBUS or VCONN, and shall present a
>     high-impedance to ground (above zOPEN) on its CC1 and CC2 pins.
>
> Hi-Zing the CC pins is the inteded behavior for PORT_RESET.
> CC pins are set to default state after tErrorRecovery in
> PORT_RESET_WAIT_OFF.
>
>     4.5.2.2.2.2 Exiting From ErrorRecovery State
>     A Sink shall transition to Unattached.SNK after tErrorRecovery.
>     A Source shall transition to Unattached.SRC after tErrorRecovery.
>
> Fixes: 69f89168b310 ("usb: typec: tpcm: Fix issues with power being removed during reset")
> Cc: stable@kernel.org
> Cc: Mark Brown <broonie@kernel.org>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index c9a78f55ca48..bbe1381232eb 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5593,8 +5593,11 @@ static void run_state_machine(struct tcpm_port *port)
>                 break;
>         case PORT_RESET:
>                 tcpm_reset_port(port);
> -               tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
> -                           TYPEC_CC_RD : tcpm_rp_cc(port));
> +               if (port->self_powered)
> +                       tcpm_set_cc(port, TYPEC_CC_OPEN);
> +               else
> +                       tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
> +                                   TYPEC_CC_RD : tcpm_rp_cc(port));
>                 tcpm_set_state(port, PORT_RESET_WAIT_OFF,
>                                PD_T_ERROR_RECOVERY);
>                 break;
>
> base-commit: a560a5672826fc1e057068bda93b3d4c98d037a2
> --
> 2.44.0.rc1.240.g4c46232300-goog
>

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

end of thread, other threads:[~2024-02-28  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 23:58 [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices Badhri Jagan Sridharan
2024-02-28  0:00 ` kernel test robot
2024-02-28  0:06 ` Badhri Jagan Sridharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.