[v2,1/2] usb: typec: altmodes/displayport: Update active state

Message ID 20230120205827.740900-1-pmalani@chromium.org
State New
Headers
Series [v2,1/2] usb: typec: altmodes/displayport: Update active state |

Commit Message

Prashant Malani Jan. 20, 2023, 8:58 p.m. UTC
  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(+)
  

Comments

Guenter Roeck Jan. 20, 2023, 9:01 p.m. UTC | #1
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;
  
Heikki Krogerus Jan. 24, 2023, 11:01 a.m. UTC | #2
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
  

Patch

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;