mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kenneth Crudup <kenny@panix.com>
To: Hsin-Te Yuan <yuanhsinte@chromium.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kenneth C <kenny@panix.com>,
	"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: Re: [PATCH] usb: typec: ucsi: Monitor connector change before getting connector status
Date: Tue, 18 Nov 2025 08:54:49 -0800	[thread overview]
Message-ID: <d2fb89c1-a4cb-4d59-93ef-3c462ae0964f@panix.com> (raw)
In-Reply-To: <20251117-ucsi-v1-1-1dcbc5ea642b@chromium.org>


This patch seems to fix an issue I've had for a while now on my Dell 
XPS-9320 where if I suspend with one Thunderbolt Dock connected and 
resume with another, the machine thinks the previous dock is still 
connected (which means mostly that the new monitor configuration isn't set).

I'm still testing it to see if it does indeed fix my issue, but to at 
least confirm it does what it says on the tin:

Tested-By: Kenneth R. Crudup <kenny@panix.com>

On 11/17/25 01:31, Hsin-Te Yuan wrote:
> Originally, the notification for connector change will be enabled after
> the first read of the connector status. Therefore, if the event happens
> during this window, it will be missing and make the status unsynced.
> 
> Enable the notification for connector change before getting the
> connector status to ensure the status is synced.
> 
> Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
> ---
>   drivers/usb/typec/ucsi/ucsi.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 3f568f790f39b0271667e80816270274b8dd3008..07290cd85b618b22cb989151079707dbe9f578a7 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1565,7 +1565,7 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
>   	struct typec_capability *cap = &con->typec_cap;
>   	enum typec_accessory *accessory = cap->accessory;
>   	enum usb_role u_role = USB_ROLE_NONE;
> -	u64 command;
> +	u64 command, ntfy;
>   	char *name;
>   	int ret;
>   
> @@ -1659,6 +1659,15 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
>   		goto out;
>   	}
>   
> +	/* Enable the notification for connector change before getting the connector status */
> +	ntfy = UCSI_ENABLE_NTFY_CMD_COMPLETE | UCSI_ENABLE_NTFY_ERROR | UCSI_ENABLE_NTFY_CONNECTOR_CHANGE;
> +	command = UCSI_SET_NOTIFICATION_ENABLE | ntfy;
> +	ret = ucsi_send_command(ucsi, command, NULL, 0);
> +	if (ret < 0) {
> +		dev_warn(ucsi->dev, "con%d: failed to enable the notification for connector change\n",
> +			 con->num);
> +	}
> +
>   	/* Get the status */
>   	ret = ucsi_get_connector_status(con, false);
>   	if (ret) {
> 
> ---
> base-commit: 6a23ae0a96a600d1d12557add110e0bb6e32730c
> change-id: 20251117-ucsi-c2dfe8c006d7
> 
> Best regards,

-- 
Kenneth R. Crudup / Sr. SW Engineer, Scott County Consulting, Orange 
County CA


  reply	other threads:[~2025-11-18 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  9:31 Hsin-Te Yuan
2025-11-18 16:54 ` Kenneth Crudup [this message]
2025-11-19  8:39 ` Heikki Krogerus

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=d2fb89c1-a4cb-4d59-93ef-3c462ae0964f@panix.com \
    --to=kenny@panix.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=superm1@kernel.org \
    --cc=yuanhsinte@chromium.org \
    /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®