Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] usb: typec: tcpci_rt1711h: unmask alerts before registering the port
Date: Mon, 30 Nov 2026 15:00:55 +0100	[thread overview]
Message-ID: <aw2Bl7FBj0iViwTv@black.igk.intel.com> (raw)
In-Reply-To: <20261126195059.1139494-1-vinicius.eduardo.pedrosa@gmail.com>

On Thu, Nov 26, 2026 at 04:50:59PM -0300, Vinicius Pedrosa wrote:
> rt1711h_probe() masks all alerts before tcpci_register_port() and only
> writes the real mask after devm_request_threaded_irq(). TCPM starts
> looking for a partner several milliseconds after the registration
> returns.
> 
> The ET7304 (RT1715 compatible) does not latch a CC status change in
> TCPC_ALERT while its mask bit is clear, and setting the bit later does
> not bring it back. If the partner shows up before the mask is written,
> CC_STATUS has the Rd but no alert is pending. TCPM stays in
> SRC_UNATTACHED and VBUS stays off until the cable is replugged.
> 
> On a Radxa Cubie A7Z (Allwinner A733) with PREEMPT_RT, a source-only
> port and a sink attached at boot, 6 of 12 boots ended like that. In each
> of them the mask write finished after TCPM started driving Rp, and in
> each of the other six it finished before. With this change 0 of 12
> failed.
> 
> Write the mask right before the registration, so the setup before it
> still runs masked, and drop the write after the interrupt request. The
> interrupt is still requested after the registration. It is level
> triggered, so an alert raised in between is handled once it is requested.
> 
> Fixes: d6b82dafd17d ("usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> I only had the ET7304 on a Cubie A7Z. RT1711H and RT1715 are untested.
> 
>  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index 0581659763a..635ea9aa8fc 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -337,6 +337,15 @@ 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;
> +
> +	/*
> +	 * Unmask alerts before TCPM starts looking for a partner. The ET7304
> +	 * does not latch CC changes in ALERT while its mask bit is clear.
> +	 */
> +	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask);
> +	if (ret < 0)
> +		return ret;
> +
>  	chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
>  	if (IS_ERR_OR_NULL(chip->tcpci))
>  		return PTR_ERR(chip->tcpci);
> @@ -352,11 +361,6 @@ static int rt1711h_probe(struct i2c_client *client)
>  	if (ret < 0)
>  		return ret;
>  
> -	/* Enable alert interrupts */
> -	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask);
> -	if (ret < 0)
> -		return ret;
> -
>  	enable_irq_wake(client->irq);
>  
>  	return 0;
> -- 
> 2.43.0
> 

-- 
heikki

      parent reply	other threads:[~2026-11-30 14:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 19:50 [PATCH] usb: typec: tcpci_rt1711h: unmask alerts before registering the port Vinicius Pedrosa
2026-11-26 20:06 ` sashiko-bot
2026-11-30 14:00 ` 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=aw2Bl7FBj0iViwTv@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vinicius.eduardo.pedrosa@gmail.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