Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org,
	Praveen Kumar Thuppa <pthuppa@qti.qualcomm.com>
Subject: Re: [PATCH] usb: typec: ucsi: Do not override an active alternate mode with USB mode
Date: Fri, 4 Dec 2026 14:53:45 +0100	[thread overview]
Message-ID: <axLF6V34k3Qfltha@black.igk.intel.com> (raw)
In-Reply-To: <20261203-sm8750-dp-issue-v1-1-a519848958ad@oss.qualcomm.com>

Hi,

On Thu, Dec 03, 2026 at 12:13:10AM +0530, Krishna Kurapati wrote:
> From: Praveen Kumar Thuppa <pthuppa@qti.qualcomm.com>
> 
> ucsi_partner_change() switches the port to USB mode whenever the
> connector status reports a USB partner. An alternate mode can be entered
> through a path other than the UCSI alternate mode negotiation, for example
> pmic glink altmodedriver that programs muxes from firmware events. UCSI
> does not know about such an alternate mode, so a partner change handled
> after it is up takes the muxes back to USB.
> 
> On SM8750, when the Qualcomm PMIC GLINK altmode driver enters DisplayPort,
> the USB mode update from ucsi switches the wcd939x-usbss mux, which carries
> the DisplayPort AUX lines, away from DisplayPort shortly after the hotplug
> handling has read the sink capabilities and EDID successfully. The next AUX
> read times out with -110 and link training never runs.
> 
> The check cannot be done in UCSI or in the driver that entered the altmode,
> as neither knows what the other did. It is done in the mux layer, where the
> state is applied. Record in struct typec_mux_dev whether the last state
> accepted by the set callback was an alternate mode, and add
> mux_set_unless_altmode and set_mode_unless_altmode, which behave like
> typec_mux_set and typec_set_mode but leave mux devices that are in an alt
> mode untouched and report success for them. Use the latter for the USB
> mode update in ucsi_partner_change(). This also applies to alt modes that
> UCSI entered itself: a later USB mode update from a partner change no
> longer takes them back to USB. Any other accepted state clears the record.
> 
> Hold a per mux device mutex around the set() callback and the update of the
> record, so that the check cannot interleave with an alternate mode entry
> coming from another path. Give every mutex its own lockdep class, muxes
> such as wcd939x-usbss forward a state to a downstream mux from their set
> callback and must be able to nest.
> 
> Ports without an active alternate mode get the same states and error
> handling as before; the set() calls are now serialized per mux
> device.
> 
> Signed-off-by: Praveen Kumar Thuppa <pthuppa@qti.qualcomm.com>
> Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>

There's something wrong with the flow of things here. It sounds like
the PPM on this system is not aware of the connector state when this
pmic alt mode driver handles the mode entry. That would be really bad
situation, because the PPM really should always know the connector
state.

On most systems UCSI is not taking care of the actual mode entry. It
only reports what ever the PPM/FW says. So it really should not matter
if something else, like the pmic alt mode driver, actually enters the
altmode. In that case the UCSI driver should just get the appropriate
connector change event telling what has happened.

It is then up to the mux layer/drivers to know how to handle the
information that's coming from UCSI - filter/ignore it when the pmic
driver has already told to switch to DP (or what ever) mode, or only
get the commands from the UCSI (don't program the muxes from pmic alt
mode driver at all).

So why is the PPM not getting the information about the mode entry
when the pmic alt mode driver has taken care of that?

Which component is the PPM on this platform?

Thanks,

-- 
heikki

      parent reply	other threads:[~2026-12-04 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:43 [PATCH] usb: typec: ucsi: Do not override an active alternate mode with USB mode Krishna Kurapati
2026-12-02 18:51 ` sashiko-bot
2026-12-04 13:53 ` 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=axLF6V34k3Qfltha@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krishna.kurapati@oss.qualcomm.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pthuppa@qti.qualcomm.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