public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	chrome-platform@lists.linux.dev, bleung@chromium.org,
	Daisuke Nojiri <dnojiri@chromium.org>,
	"Dustin L. Howett" <dustin@howett.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <groeck@chromium.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH 2/9] usb: typec: Add retimer handle to port
Date: Thu, 30 Jun 2022 11:27:07 +0300	[thread overview]
Message-ID: <Yr1eW1gHR7LGP70Y@kuha.fi.intel.com> (raw)
In-Reply-To: <20220629233314.3540377-3-pmalani@chromium.org>

Hi,

On Wed, Jun 29, 2022 at 11:32:20PM +0000, Prashant Malani wrote:
> Similar to mux and orientation switch, add a handle for registered
> retimer to the port, so that it has handles to the various switches
> connected to it.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
> ---
>  drivers/usb/typec/class.c | 8 ++++++++
>  drivers/usb/typec/class.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 2fa0b3718d23..2bc5fbdb25dd 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -12,6 +12,7 @@
>  #include <linux/slab.h>
>  #include <linux/usb/pd_vdo.h>
>  #include <linux/usb/typec_mux.h>
> +#include <linux/usb/typec_retimer.h>
>  
>  #include "bus.h"
>  #include "class.h"
> @@ -2249,6 +2250,13 @@ struct typec_port *typec_register_port(struct device *parent,
>  		return ERR_PTR(ret);
>  	}
>  
> +	port->retimer = typec_retimer_get(&port->dev);
> +	if (IS_ERR(port->retimer)) {
> +		ret = PTR_ERR(port->retimer);
> +		put_device(&port->dev);
> +		return ERR_PTR(ret);
> +	}
> +
>  	ret = device_add(&port->dev);
>  	if (ret) {
>  		dev_err(parent, "failed to register port (%d)\n", ret);

I think you need to release the reference with typec_retimer_put() in
typec_release().

I guess we can look handle this later, but there can actually be two
onboard retimers for each connector.

thanks,

> diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h
> index 1bb1da124109..97520406929e 100644
> --- a/drivers/usb/typec/class.h
> +++ b/drivers/usb/typec/class.h
> @@ -55,6 +55,7 @@ struct typec_port {
>  	enum typec_orientation		orientation;
>  	struct typec_switch		*sw;
>  	struct typec_mux		*mux;
> +	struct typec_retimer		*retimer;
>  
>  	const struct typec_capability	*cap;
>  	const struct typec_operations   *ops;

-- 
heikki

  reply	other threads:[~2022-06-30  8:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 23:32 [PATCH 0/9] platform/chrome: Type-C switch driver and Type-C framework updates Prashant Malani
2022-06-29 23:32 ` [PATCH 1/9] usb: typec: Add support for retimers Prashant Malani
2022-06-30  8:17   ` Heikki Krogerus
2022-06-30 10:18     ` Mika Westerberg
2022-06-30 17:13     ` Prashant Malani
2022-06-29 23:32 ` [PATCH 2/9] usb: typec: Add retimer handle to port Prashant Malani
2022-06-30  8:27   ` Heikki Krogerus [this message]
2022-06-30 17:16     ` Prashant Malani
2022-06-29 23:32 ` [PATCH 3/9] platform/chrome: Add Type-C mux set command definitions Prashant Malani
2022-06-29 23:32 ` [PATCH 4/9] platform/chrome: cros_typec_switch: Add switch driver Prashant Malani
2022-06-29 23:32 ` [PATCH 5/9] platform/chrome: cros_typec_switch: Set EC retimer Prashant Malani
2022-06-29 23:32 ` [PATCH 6/9] platform/chrome: cros_typec_switch: Add event check Prashant Malani
2022-06-29 23:32 ` [PATCH 7/9] platform/chrome: cros_typec_switch: Register mode switches Prashant Malani
2022-06-29 23:32 ` [PATCH 8/9] platform/chrome: cros_ec_typec: Cleanup switch handle return paths Prashant Malani
2022-06-29 23:32 ` [PATCH 9/9] platform/chrome: cros_ec_typec: Get retimer handle Prashant Malani

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=Yr1eW1gHR7LGP70Y@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dnojiri@chromium.org \
    --cc=dustin@howett.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=gustavoars@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pmalani@chromium.org \
    --cc=sebastian.reichel@collabora.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