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,
bleung@chromium.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 1/3] usb: typec: Add retimer handle to port altmode
Date: Tue, 17 Jan 2023 13:40:09 +0200 [thread overview]
Message-ID: <Y8aJGSaFzhLucZvK@kuha.fi.intel.com> (raw)
In-Reply-To: <20230112221609.540754-2-pmalani@chromium.org>
On Thu, Jan 12, 2023 at 10:16:06PM +0000, Prashant Malani wrote:
> Just like it does with muxes, the Type-C bus code can update the state
> of connected retimers (especially when altmode-related transitions
> occur). Add a retimer handle to the port altmode struct to enable this.
>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/bus.h | 2 ++
> drivers/usb/typec/class.c | 15 +++++++++++++--
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/bus.h b/drivers/usb/typec/bus.h
> index 56dec268d4dd..c89168857417 100644
> --- a/drivers/usb/typec/bus.h
> +++ b/drivers/usb/typec/bus.h
> @@ -7,11 +7,13 @@
>
> struct bus_type;
> struct typec_mux;
> +struct typec_retimer;
>
> struct altmode {
> unsigned int id;
> struct typec_altmode adev;
> struct typec_mux *mux;
> + struct typec_retimer *retimer;
>
> enum typec_port_data roles;
>
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 5897905cb4f0..ed3d070b1ca4 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -583,6 +583,7 @@ void typec_unregister_altmode(struct typec_altmode *adev)
> {
> if (IS_ERR_OR_NULL(adev))
> return;
> + typec_retimer_put(to_altmode(adev)->retimer);
> typec_mux_put(to_altmode(adev)->mux);
> device_unregister(&adev->dev);
> }
> @@ -2108,16 +2109,26 @@ typec_port_register_altmode(struct typec_port *port,
> {
> struct typec_altmode *adev;
> struct typec_mux *mux;
> + struct typec_retimer *retimer;
>
> mux = typec_mux_get(&port->dev, desc);
> if (IS_ERR(mux))
> return ERR_CAST(mux);
>
> + retimer = typec_retimer_get(&port->dev);
> + if (IS_ERR(retimer)) {
> + typec_mux_put(mux);
> + return ERR_CAST(retimer);
> + }
> +
> adev = typec_register_altmode(&port->dev, desc);
> - if (IS_ERR(adev))
> + if (IS_ERR(adev)) {
> + typec_retimer_put(retimer);
> typec_mux_put(mux);
> - else
> + } else {
> to_altmode(adev)->mux = mux;
> + to_altmode(adev)->retimer = retimer;
> + }
>
> return adev;
> }
> --
> 2.39.0.314.g84b9a713c41-goog
--
heikki
next prev parent reply other threads:[~2023-01-17 11:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 22:16 [PATCH 0/3] usb: typec: Add retimer support to bus code Prashant Malani
2023-01-12 22:16 ` [PATCH 1/3] usb: typec: Add retimer handle to port altmode Prashant Malani
2023-01-17 11:40 ` Heikki Krogerus [this message]
2023-01-12 22:16 ` [PATCH 2/3] usb: typec: Add wrapper for bus switch set code Prashant Malani
2023-01-17 11:42 ` Heikki Krogerus
2023-01-12 22:16 ` [PATCH 3/3] usb: typec: Make bus switch code retimer-aware Prashant Malani
2023-01-17 11:43 ` 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=Y8aJGSaFzhLucZvK@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=bleung@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pmalani@chromium.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).