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,
	bleung@chromium.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 3/3] usb: typec: Make bus switch code retimer-aware
Date: Tue, 17 Jan 2023 13:43:38 +0200	[thread overview]
Message-ID: <Y8aJ6hp4WhGJ4KAG@kuha.fi.intel.com> (raw)
In-Reply-To: <20230112221609.540754-4-pmalani@chromium.org>

On Thu, Jan 12, 2023 at 10:16:08PM +0000, Prashant Malani wrote:
> Since ports can have retimers associated with them, update the Type-C
> alternate mode bus code to also set retimer state when the switch state
> is updated.
> 
> While we are here, make the typec_retimer_dev_type declaration in the
> retimer.h file as extern, so that the header file can be successfully
> included in the bus code without redeclaration compilation errors.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
>  drivers/usb/typec/bus.c     | 22 ++++++++++++++++++++++
>  drivers/usb/typec/retimer.h |  2 +-
>  2 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
> index 9f1bbd26ca47..0c8d554240be 100644
> --- a/drivers/usb/typec/bus.c
> +++ b/drivers/usb/typec/bus.c
> @@ -11,6 +11,22 @@
>  #include "bus.h"
>  #include "class.h"
>  #include "mux.h"
> +#include "retimer.h"
> +
> +static inline int
> +typec_altmode_set_retimer(struct altmode *alt, unsigned long conf, void *data)
> +{
> +	struct typec_retimer_state state;
> +
> +	if (!alt->retimer)
> +		return 0;
> +
> +	state.alt = &alt->adev;
> +	state.mode = conf;
> +	state.data = data;
> +
> +	return typec_retimer_set(alt->retimer, &state);
> +}
>  
>  static inline int
>  typec_altmode_set_mux(struct altmode *alt, unsigned long conf, void *data)
> @@ -31,6 +47,12 @@ typec_altmode_set_mux(struct altmode *alt, unsigned long conf, void *data)
>  static inline int
>  typec_altmode_set_switches(struct altmode *alt, unsigned long conf, void *data)
>  {
> +	int ret;
> +
> +	ret = typec_altmode_set_retimer(alt, conf, data);
> +	if (ret)
> +		return ret;
> +
>  	return typec_altmode_set_mux(alt, conf, data);
>  }
>  
> diff --git a/drivers/usb/typec/retimer.h b/drivers/usb/typec/retimer.h
> index e34bd23323be..d6a5ef9881e1 100644
> --- a/drivers/usb/typec/retimer.h
> +++ b/drivers/usb/typec/retimer.h
> @@ -12,7 +12,7 @@ struct typec_retimer {
>  
>  #define to_typec_retimer(_dev_) container_of(_dev_, struct typec_retimer, dev)
>  
> -const struct device_type typec_retimer_dev_type;
> +extern const struct device_type typec_retimer_dev_type;
>  
>  #define is_typec_retimer(dev) ((dev)->type == &typec_retimer_dev_type)
>  
> -- 
> 2.39.0.314.g84b9a713c41-goog

-- 
heikki

      reply	other threads:[~2023-01-17 11:43 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
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 [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=Y8aJ6hp4WhGJ4KAG@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