linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state
@ 2023-01-20 20:58 Prashant Malani
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Prashant Malani @ 2023-01-20 20:58 UTC (permalink / raw)
  To: linux-kernel, linux-usb
  Cc: bleung, heikki.krogerus, gregkh, Prashant Malani, Guenter Roeck

Update the altmode "active" state when we receive Acks for Enter and
Exit Mode commands. Having the right state is necessary to change Pin
Assignments using the 'pin_assignment" sysfs file.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---

Changes since v1:
- Dropped the Fixes and Cc: stable tags; given the discussion in [1]
  I no longer think this constitutes a fix.
- Added Reviewed-by tag from Benson.

[1] https://lore.kernel.org/linux-usb/20230118031514.1278139-1-pmalani@chromium.org/

 drivers/usb/typec/altmodes/displayport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 06fb4732f8cd..bc1c556944d6 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -277,9 +277,11 @@ static int dp_altmode_vdm(struct typec_altmode *alt,
 	case CMDT_RSP_ACK:
 		switch (cmd) {
 		case CMD_ENTER_MODE:
+			typec_altmode_update_active(alt, true);
 			dp->state = DP_STATE_UPDATE;
 			break;
 		case CMD_EXIT_MODE:
+			typec_altmode_update_active(alt, false);
 			dp->data.status = 0;
 			dp->data.conf = 0;
 			break;
-- 
2.39.0.246.g2a6d74b583-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates
  2023-01-20 20:58 [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Prashant Malani
@ 2023-01-20 20:58 ` Prashant Malani
  2023-01-20 22:47   ` Guenter Roeck
                     ` (2 more replies)
  2023-01-20 21:01 ` [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Guenter Roeck
  2023-01-24 11:01 ` Heikki Krogerus
  2 siblings, 3 replies; 7+ messages in thread
From: Prashant Malani @ 2023-01-20 20:58 UTC (permalink / raw)
  To: linux-kernel, linux-usb
  Cc: bleung, heikki.krogerus, gregkh, Prashant Malani, Guenter Roeck

Since the "active" state for partner altmodes is now being taken care of
by the altmode driver itself (specifically, DisplayPort altmode), we
no longer need to do so from the port driver. So remove the calls to
typec_altmode_update_active() from TCPM.

Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---

Changes since v1:
- Patch first introduced in v2.

 drivers/usb/typec/tcpm/tcpm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 904c7b4ce2f0..0f5a9d4db105 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
 			}
 			break;
 		case CMD_ENTER_MODE:
-			if (adev && pdev) {
-				typec_altmode_update_active(pdev, true);
+			if (adev && pdev)
 				*adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL;
-			}
 			return 0;
 		case CMD_EXIT_MODE:
 			if (adev && pdev) {
-				typec_altmode_update_active(pdev, false);
 				/* Back to USB Operation */
 				*adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM;
 				return 0;
-- 
2.39.0.246.g2a6d74b583-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state
  2023-01-20 20:58 [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Prashant Malani
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
@ 2023-01-20 21:01 ` Guenter Roeck
  2023-01-24 11:01 ` Heikki Krogerus
  2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2023-01-20 21:01 UTC (permalink / raw)
  To: Prashant Malani, linux-kernel, linux-usb; +Cc: bleung, heikki.krogerus, gregkh

On 1/20/23 12:58, Prashant Malani wrote:
> Update the altmode "active" state when we receive Acks for Enter and
> Exit Mode commands. Having the right state is necessary to change Pin
> Assignments using the 'pin_assignment" sysfs file.
> 
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Reviewed-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
> Changes since v1:
> - Dropped the Fixes and Cc: stable tags; given the discussion in [1]
>    I no longer think this constitutes a fix.
> - Added Reviewed-by tag from Benson.
> 
> [1] https://lore.kernel.org/linux-usb/20230118031514.1278139-1-pmalani@chromium.org/
> 
>   drivers/usb/typec/altmodes/displayport.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 06fb4732f8cd..bc1c556944d6 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -277,9 +277,11 @@ static int dp_altmode_vdm(struct typec_altmode *alt,
>   	case CMDT_RSP_ACK:
>   		switch (cmd) {
>   		case CMD_ENTER_MODE:
> +			typec_altmode_update_active(alt, true);
>   			dp->state = DP_STATE_UPDATE;
>   			break;
>   		case CMD_EXIT_MODE:
> +			typec_altmode_update_active(alt, false);
>   			dp->data.status = 0;
>   			dp->data.conf = 0;
>   			break;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
@ 2023-01-20 22:47   ` Guenter Roeck
  2023-01-24 11:03   ` Heikki Krogerus
  2023-01-24 15:27   ` Benson Leung
  2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2023-01-20 22:47 UTC (permalink / raw)
  To: Prashant Malani, linux-kernel, linux-usb; +Cc: bleung, heikki.krogerus, gregkh

On 1/20/23 12:58, Prashant Malani wrote:
> Since the "active" state for partner altmodes is now being taken care of
> by the altmode driver itself (specifically, DisplayPort altmode), we
> no longer need to do so from the port driver. So remove the calls to
> typec_altmode_update_active() from TCPM.
> 
> Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
> Changes since v1:
> - Patch first introduced in v2.
> 
>   drivers/usb/typec/tcpm/tcpm.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 904c7b4ce2f0..0f5a9d4db105 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
>   			}
>   			break;
>   		case CMD_ENTER_MODE:
> -			if (adev && pdev) {
> -				typec_altmode_update_active(pdev, true);
> +			if (adev && pdev)
>   				*adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL;
> -			}
>   			return 0;
>   		case CMD_EXIT_MODE:
>   			if (adev && pdev) {
> -				typec_altmode_update_active(pdev, false);
>   				/* Back to USB Operation */
>   				*adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM;
>   				return 0;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state
  2023-01-20 20:58 [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Prashant Malani
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
  2023-01-20 21:01 ` [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Guenter Roeck
@ 2023-01-24 11:01 ` Heikki Krogerus
  2 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2023-01-24 11:01 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, linux-usb, bleung, gregkh, Guenter Roeck

On Fri, Jan 20, 2023 at 08:58:26PM +0000, Prashant Malani wrote:
> Update the altmode "active" state when we receive Acks for Enter and
> Exit Mode commands. Having the right state is necessary to change Pin
> Assignments using the 'pin_assignment" sysfs file.
> 
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Reviewed-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
> 
> Changes since v1:
> - Dropped the Fixes and Cc: stable tags; given the discussion in [1]
>   I no longer think this constitutes a fix.
> - Added Reviewed-by tag from Benson.
> 
> [1] https://lore.kernel.org/linux-usb/20230118031514.1278139-1-pmalani@chromium.org/
> 
>  drivers/usb/typec/altmodes/displayport.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 06fb4732f8cd..bc1c556944d6 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -277,9 +277,11 @@ static int dp_altmode_vdm(struct typec_altmode *alt,
>  	case CMDT_RSP_ACK:
>  		switch (cmd) {
>  		case CMD_ENTER_MODE:
> +			typec_altmode_update_active(alt, true);
>  			dp->state = DP_STATE_UPDATE;
>  			break;
>  		case CMD_EXIT_MODE:
> +			typec_altmode_update_active(alt, false);
>  			dp->data.status = 0;
>  			dp->data.conf = 0;
>  			break;
> -- 
> 2.39.0.246.g2a6d74b583-goog

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
  2023-01-20 22:47   ` Guenter Roeck
@ 2023-01-24 11:03   ` Heikki Krogerus
  2023-01-24 15:27   ` Benson Leung
  2 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2023-01-24 11:03 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, linux-usb, bleung, gregkh, Guenter Roeck

On Fri, Jan 20, 2023 at 08:58:28PM +0000, Prashant Malani wrote:
> Since the "active" state for partner altmodes is now being taken care of
> by the altmode driver itself (specifically, DisplayPort altmode), we
> no longer need to do so from the port driver. So remove the calls to
> typec_altmode_update_active() from TCPM.
> 
> Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
> 
> Changes since v1:
> - Patch first introduced in v2.
> 
>  drivers/usb/typec/tcpm/tcpm.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 904c7b4ce2f0..0f5a9d4db105 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
>  			}
>  			break;
>  		case CMD_ENTER_MODE:
> -			if (adev && pdev) {
> -				typec_altmode_update_active(pdev, true);
> +			if (adev && pdev)
>  				*adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL;
> -			}
>  			return 0;
>  		case CMD_EXIT_MODE:
>  			if (adev && pdev) {
> -				typec_altmode_update_active(pdev, false);
>  				/* Back to USB Operation */
>  				*adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM;
>  				return 0;
> -- 
> 2.39.0.246.g2a6d74b583-goog

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates
  2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
  2023-01-20 22:47   ` Guenter Roeck
  2023-01-24 11:03   ` Heikki Krogerus
@ 2023-01-24 15:27   ` Benson Leung
  2 siblings, 0 replies; 7+ messages in thread
From: Benson Leung @ 2023-01-24 15:27 UTC (permalink / raw)
  To: Prashant Malani
  Cc: linux-kernel, linux-usb, heikki.krogerus, gregkh, Guenter Roeck,
	Benson Leung

On Fri, Jan 20, 2023 at 1:00 PM Prashant Malani <pmalani@chromium.org> wrote:
>
> Since the "active" state for partner altmodes is now being taken care of
> by the altmode driver itself (specifically, DisplayPort altmode), we
> no longer need to do so from the port driver. So remove the calls to
> typec_altmode_update_active() from TCPM.
>
> Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
>
> Changes since v1:
> - Patch first introduced in v2.
>
>  drivers/usb/typec/tcpm/tcpm.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 904c7b4ce2f0..0f5a9d4db105 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
>                         }
>                         break;
>                 case CMD_ENTER_MODE:
> -                       if (adev && pdev) {
> -                               typec_altmode_update_active(pdev, true);
> +                       if (adev && pdev)
>                                 *adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL;
> -                       }
>                         return 0;
>                 case CMD_EXIT_MODE:
>                         if (adev && pdev) {
> -                               typec_altmode_update_active(pdev, false);
>                                 /* Back to USB Operation */
>                                 *adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM;
>                                 return 0;
> --
> 2.39.0.246.g2a6d74b583-goog
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-24 15:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 20:58 [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Prashant Malani
2023-01-20 20:58 ` [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Prashant Malani
2023-01-20 22:47   ` Guenter Roeck
2023-01-24 11:03   ` Heikki Krogerus
2023-01-24 15:27   ` Benson Leung
2023-01-20 21:01 ` [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Guenter Roeck
2023-01-24 11:01 ` Heikki Krogerus

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).