diff mbox series

[2/3] usb: typec: altmodes/displayport: Fix pin assignment calculation

Message ID 20230111020546.3384569-2-pmalani@chromium.org (mailing list archive)
State Accepted
Commit 9682b41e52cc9f42f5c33caf410464392adaef04
Headers show
Series [1/3] usb: typec: altmodes/displayport: Add pin assignment helper | expand

Commit Message

Prashant Malani Jan. 11, 2023, 2:05 a.m. UTC
Commit c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin
assignment for UFP receptacles") fixed the pin assignment calculation
to take into account whether the peripheral was a plug or a receptacle.

But the "pin_assignments" sysfs logic was not updated. Address this by
using the macros introduced in the aforementioned commit in the sysfs
logic too.

Fixes: c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles")
Cc: stable@vger.kernel.org
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/usb/typec/altmodes/displayport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Benson Leung Jan. 11, 2023, 2:12 a.m. UTC | #1
On Wed, Jan 11, 2023 at 02:05:42AM +0000, Prashant Malani wrote:
> Commit c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin
> assignment for UFP receptacles") fixed the pin assignment calculation
> to take into account whether the peripheral was a plug or a receptacle.
> 
> But the "pin_assignments" sysfs logic was not updated. Address this by
> using the macros introduced in the aforementioned commit in the sysfs
> logic too.
> 
> Fixes: c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles")
> Cc: stable@vger.kernel.org
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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


> ---
>  drivers/usb/typec/altmodes/displayport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index f9d4a7648bc9..c0d65c93cefe 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -427,9 +427,9 @@ static const char * const pin_assignments[] = {
>  static u8 get_current_pin_assignments(struct dp_altmode *dp)
>  {
>  	if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D)
> -		return DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo);
> +		return DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo);
>  	else
> -		return DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo);
> +		return DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo);
>  }
>  
>  static ssize_t
> -- 
> 2.39.0.314.g84b9a713c41-goog
>
Heikki Krogerus Jan. 12, 2023, 1:23 p.m. UTC | #2
On Wed, Jan 11, 2023 at 02:05:42AM +0000, Prashant Malani wrote:
> Commit c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin
> assignment for UFP receptacles") fixed the pin assignment calculation
> to take into account whether the peripheral was a plug or a receptacle.
> 
> But the "pin_assignments" sysfs logic was not updated. Address this by
> using the macros introduced in the aforementioned commit in the sysfs
> logic too.
> 
> Fixes: c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles")
> Cc: stable@vger.kernel.org
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
>  drivers/usb/typec/altmodes/displayport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index f9d4a7648bc9..c0d65c93cefe 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -427,9 +427,9 @@ static const char * const pin_assignments[] = {
>  static u8 get_current_pin_assignments(struct dp_altmode *dp)
>  {
>  	if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D)
> -		return DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo);
> +		return DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo);
>  	else
> -		return DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo);
> +		return DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo);
>  }
>  
>  static ssize_t
> -- 
> 2.39.0.314.g84b9a713c41-goog
diff mbox series

Patch

diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index f9d4a7648bc9..c0d65c93cefe 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -427,9 +427,9 @@  static const char * const pin_assignments[] = {
 static u8 get_current_pin_assignments(struct dp_altmode *dp)
 {
 	if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D)
-		return DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo);
+		return DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo);
 	else
-		return DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo);
+		return DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo);
 }
 
 static ssize_t