Chrome platform driver development
 help / color / mirror / Atom feed
From: Benson Leung <bleung@google.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: heikki.krogerus@linux.intel.com, tzungbi@kernel.org,
	linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev,
	akuchynski@google.com, sboyd@kernel.org, pmalani@chromium.org,
	badhri@google.com, rdbabiera@google.com,
	dmitry.baryshkov@linaro.org, jthies@google.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/8] usb: typec: Make active on port altmode writable
Date: Thu, 19 Dec 2024 01:23:58 +0000	[thread overview]
Message-ID: <Z2N1rvl-3g5ditVp@google.com> (raw)
In-Reply-To: <20241213153543.v5.3.I794566684ab2965e209f326b08232006eff333f8@changeid>

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

On Fri, Dec 13, 2024 at 03:35:44PM -0800, Abhishek Pandit-Subedi wrote:
> The active property of port altmode should be writable (to prevent or
> allow partner altmodes from entering) and needs to be part of
> typec_altmode_desc so we can initialize the port to an inactive state if
> desired.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

Reviewed-by: Benson Leung <bleung@chromium.org>

> ---
> 
> Changes in v5:
> - Extract port altmode ".active" changes to its own patch
> 
>  drivers/usb/typec/class.c | 5 +++--
>  include/linux/usb/typec.h | 2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index febe453b96be..b5e67a57762c 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -458,7 +458,8 @@ static umode_t typec_altmode_attr_is_visible(struct kobject *kobj,
>  	struct typec_altmode *adev = to_typec_altmode(kobj_to_dev(kobj));
>  
>  	if (attr == &dev_attr_active.attr)
> -		if (!adev->ops || !adev->ops->activate)
> +		if (!is_typec_port(adev->dev.parent) &&
> +		    (!adev->ops || !adev->ops->activate))
>  			return 0444;
>  
>  	return attr->mode;
> @@ -563,7 +564,7 @@ typec_register_altmode(struct device *parent,
>  
>  	if (is_port) {
>  		alt->attrs[3] = &dev_attr_supported_roles.attr;
> -		alt->adev.active = true; /* Enabled by default */
> +		alt->adev.active = !desc->inactive; /* Enabled by default */
>  	}
>  
>  	sprintf(alt->group_name, "mode%d", desc->mode);
> diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
> index d616b8807000..252af3f77039 100644
> --- a/include/linux/usb/typec.h
> +++ b/include/linux/usb/typec.h
> @@ -140,6 +140,7 @@ int typec_cable_set_identity(struct typec_cable *cable);
>   * @mode: Index of the Mode
>   * @vdo: VDO returned by Discover Modes USB PD command
>   * @roles: Only for ports. DRP if the mode is available in both roles
> + * @inactive: Only for ports. Make this port inactive (default is active).
>   *
>   * Description of an Alternate Mode which a connector, cable plug or partner
>   * supports.
> @@ -150,6 +151,7 @@ struct typec_altmode_desc {
>  	u32			vdo;
>  	/* Only used with ports */
>  	enum typec_port_data	roles;
> +	bool			inactive;
>  };
>  
>  void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_revision);
> -- 
> 2.47.1.613.gc27f4b7a9f-goog
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2024-12-19  1:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 23:35 [PATCH v5 0/8] Thunderbolt and DP altmode support for cros-ec-typec Abhishek Pandit-Subedi
2024-12-13 23:35 ` [PATCH v5 1/8] usb: typec: Only use SVID for matching altmodes Abhishek Pandit-Subedi
2024-12-19  1:18   ` Benson Leung
2024-12-19  1:24   ` Benson Leung
2024-12-13 23:35 ` [PATCH v5 2/8] usb: typec: Add driver for Thunderbolt 3 Alternate Mode Abhishek Pandit-Subedi
2024-12-19  1:20   ` Benson Leung
2024-12-13 23:35 ` [PATCH v5 3/8] usb: typec: Make active on port altmode writable Abhishek Pandit-Subedi
2024-12-18  9:47   ` Heikki Krogerus
2024-12-19  1:23   ` Benson Leung [this message]
2024-12-13 23:35 ` [PATCH v5 4/8] usb: typec: Print err when displayport fails to enter Abhishek Pandit-Subedi
2024-12-18  9:48   ` Heikki Krogerus
2024-12-19  1:25   ` Benson Leung
2024-12-13 23:35 ` [PATCH v5 5/8] platform/chrome: cros_ec_typec: Update partner altmode active Abhishek Pandit-Subedi
2024-12-19  1:30   ` Benson Leung
2024-12-13 23:35 ` [PATCH v5 6/8] platform/chrome: cros_ec_typec: Displayport support Abhishek Pandit-Subedi
2024-12-18  1:16   ` Stephen Boyd
2024-12-13 23:35 ` [PATCH v5 7/8] platform/chrome: cros_ec_typec: Thunderbolt support Abhishek Pandit-Subedi
2024-12-19  1:31   ` Benson Leung
2026-03-02  9:36   ` Dzmitry Sankouski
2026-03-02 11:31     ` Andrei Kuchynski
2026-03-03 14:13       ` Dzmitry Sankouski
2024-12-13 23:35 ` [PATCH v5 8/8] platform/chrome: cros_ec_typec: Disable tbt on port Abhishek Pandit-Subedi
2024-12-19  1:32   ` Benson Leung
2024-12-20  4:28 ` [PATCH v5 0/8] Thunderbolt and DP altmode support for cros-ec-typec Tzung-Bi Shih

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=Z2N1rvl-3g5ditVp@google.com \
    --to=bleung@google.com \
    --cc=abhishekpandit@chromium.org \
    --cc=akuchynski@google.com \
    --cc=badhri@google.com \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pmalani@chromium.org \
    --cc=rdbabiera@google.com \
    --cc=sboyd@kernel.org \
    --cc=tzungbi@kernel.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