public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de, Badhri Jagan Sridharan <badhri@google.com>
Subject: Re: [PATCH 1/3] usb: typec: tcpm: allow to use sink in accessory mode
Date: Mon, 7 Apr 2025 16:46:45 +0300	[thread overview]
Message-ID: <Z_PXRQB9zgmXvpEA@kuha.fi.intel.com> (raw)
In-Reply-To: <20250404-ml-topic-tcpm-v1-1-b99f44badce8@pengutronix.de>

+Badhri

On Fri, Apr 04, 2025 at 12:43:04AM +0200, Michael Grzeschik wrote:
> Since the function tcpm_acc_attach is not setting the data and role for
> for the sink case we extend it to check for it first.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

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

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index a99db4e025cd0..839697c14265e 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4551,12 +4551,17 @@ static void tcpm_snk_detach(struct tcpm_port *port)
>  static int tcpm_acc_attach(struct tcpm_port *port)
>  {
>  	int ret;
> +	enum typec_role role;
> +	enum typec_data_role data;
>  
>  	if (port->attached)
>  		return 0;
>  
> -	ret = tcpm_set_roles(port, true, TYPEC_SOURCE,
> -			     tcpm_data_role_for_source(port));
> +	role = tcpm_port_is_sink(port) ? TYPEC_SINK : TYPEC_SOURCE;
> +	data = tcpm_port_is_sink(port) ? tcpm_data_role_for_sink(port)
> +				       : tcpm_data_role_for_source(port);
> +
> +	ret = tcpm_set_roles(port, true, role, data);
>  	if (ret < 0)
>  		return ret;
>  

-- 
heikki

  reply	other threads:[~2025-04-07 13:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 22:43 [PATCH 0/3] usb: typec: tcpm: sink (ufp) accessory mode support Michael Grzeschik
2025-04-03 22:43 ` [PATCH 1/3] usb: typec: tcpm: allow to use sink in accessory mode Michael Grzeschik
2025-04-07 13:46   ` Heikki Krogerus [this message]
2025-04-03 22:43 ` [PATCH 2/3] usb: typec: tcpm: allow sink (ufp) to toggle into accessory mode debug Michael Grzeschik
2025-04-07 13:48   ` Heikki Krogerus
2025-04-03 22:43 ` [PATCH 3/3] usb: typec: tcpm: allow switching to mode accessory to mux properly Michael Grzeschik
2025-04-07 13:50   ` 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=Z_PXRQB9zgmXvpEA@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /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