From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
linux-kernel@vger.kernel.org, kernel@collabora.com
Subject: Re: [PATCH v1 1/1] usb: typec: tcpm: print error on hard reset
Date: Fri, 31 May 2024 11:47:54 +0300 [thread overview]
Message-ID: <ZlmOukCZ7Qh2g4Bd@kuha.fi.intel.com> (raw)
In-Reply-To: <20240523171645.223225-1-sebastian.reichel@collabora.com>
On Thu, May 23, 2024 at 07:12:29PM +0200, Sebastian Reichel wrote:
> A USB-C hard reset involves removing the voltage from VBUS for some
> time. So basically it has the same effect as removing the USB-C plug
> for a short moment. If the machine is powered from the USB-C port and
> does not have a fallback supply (e.g. a battery), this will result in
> a full machine reset due to power loss.
>
> Ideally we want to avoid triggering a hard reset on these boards. A
> non-working USB-C port is probably better than unplanned reboots. But
> boards with a backup supply should do the hard reset to get everything
> working again.
>
> In theory it would be enough to check the self_powered property, but
> it seems the property might not be configured consistently enough in
> system firmwares.
>
> So let's start with just printing an error message when a hard reset is
> triggered on systems we expect to be affected. This at least makes
> debugging issues on affected systems easier without impacting unaffected
> systems too much.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 8a1af08f71b6..375bc84d14a2 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5185,6 +5185,8 @@ static void run_state_machine(struct tcpm_port *port)
> case HARD_RESET_SEND:
> if (port->ams != NONE_AMS)
> tcpm_ams_finish(port);
> + if (!port->self_powered && port->port_type == TYPEC_PORT_SNK)
> + dev_err(port->dev, "Initiating hard-reset, which might result in machine power-loss.\n");
> /*
> * State machine will be directed to HARD_RESET_START,
> * thus set upcoming_state to INVALID_STATE.
> --
> 2.43.0
--
heikki
prev parent reply other threads:[~2024-05-31 8:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 17:12 Sebastian Reichel
2024-05-31 8:47 ` Heikki Krogerus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZlmOukCZ7Qh2g4Bd@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sebastian.reichel@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®