linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 1/3] usb: typec: ucsi: call typec_set_mode on non-altmode partner change
Date: Mon, 26 Jun 2023 16:43:35 +0200	[thread overview]
Message-ID: <2023062628-pleading-hedging-2ceb@gregkh> (raw)
In-Reply-To: <c0bb8255-db4f-e93b-5593-0faa32e44410@linaro.org>

On Mon, Jun 26, 2023 at 03:23:11PM +0200, Neil Armstrong wrote:
> Hi,
> 
> On 26/06/2023 10:12, Heikki Krogerus wrote:
> > Hi Neil,
> > 
> > Sorry to keep you waiting.
> 
> No problem, thanks for reviewing my patches!
> 
> > 
> > On Wed, Jun 14, 2023 at 03:10:39PM +0200, Neil Armstrong wrote:
> > > Add support for calling typec_set_mode() for the DEBUG, AUDIO
> > > accessory modes.
> > > 
> > > Let's also call typec_set_mode() for USB as default and SAFE
> > > when partner is disconnected.
> > > 
> > > The USB state is only called when ALT mode is specifically
> > > not specified by the partner status flags in order
> > > to leave the altmode handlers setup the proper mode to
> > > switches, muxes and retimers.
> > > 
> > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> > > ---
> > >   drivers/usb/typec/ucsi/ucsi.c | 17 +++++++++++++++++
> > >   1 file changed, 17 insertions(+)
> > > 
> > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> > > index 2b472ec01dc4..44f43cdea5c1 100644
> > > --- a/drivers/usb/typec/ucsi/ucsi.c
> > > +++ b/drivers/usb/typec/ucsi/ucsi.c
> > > @@ -809,6 +809,23 @@ static void ucsi_partner_change(struct ucsi_connector *con)
> > >   		break;
> > >   	}
> > > +	if (con->status.flags & UCSI_CONSTAT_CONNECTED) {
> > > +		switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
> > > +		case UCSI_CONSTAT_PARTNER_TYPE_DEBUG:
> > > +			typec_set_mode(con->port, TYPEC_MODE_DEBUG);
> > > +			break;
> > > +		case UCSI_CONSTAT_PARTNER_TYPE_AUDIO:
> > > +			typec_set_mode(con->port, TYPEC_MODE_AUDIO);
> > > +			break;
> > > +		default:
> > > +			if (UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) ==
> > > +					UCSI_CONSTAT_PARTNER_FLAG_USB)
> > > +				typec_set_mode(con->port, TYPEC_STATE_USB);
> > > +		}
> > > +	} else {
> > > +		typec_set_mode(con->port, TYPEC_STATE_SAFE);
> > > +	}
> > 
> > Can you do that (set safe mode) in ucsi_unregister_partner() instead?
> 
> It seems greg already landed the patch into usb-next, but I can send a fix to
> move it to unregister

Yes please.

  reply	other threads:[~2023-06-26 14:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 13:10 [PATCH 0/3] typec: support Audio Accessory mode on FSA4480 Neil Armstrong
2023-06-14 13:10 ` [PATCH 1/3] usb: typec: ucsi: call typec_set_mode on non-altmode partner change Neil Armstrong
2023-06-14 13:11   ` Krzysztof Kozlowski
2023-06-26  8:12   ` Heikki Krogerus
2023-06-26 13:23     ` Neil Armstrong
2023-06-26 14:43       ` Greg Kroah-Hartman [this message]
2023-06-14 13:10 ` [PATCH 2/3] usb: typec: fsa4480: rework mux & switch setup to handle more states Neil Armstrong
2023-06-14 13:12   ` Krzysztof Kozlowski
2023-06-26  8:30   ` Heikki Krogerus
2023-06-14 13:10 ` [PATCH 3/3] usb: typec: fsa4480: add support for Audio Accessory Mode Neil Armstrong
2023-06-14 13:12   ` Krzysztof Kozlowski
2023-06-26  8:32   ` 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=2023062628-pleading-hedging-2ceb@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=neil.armstrong@linaro.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;
as well as URLs for NNTP newsgroup(s).