2020-05-10 20:36:45

by Prashant Malani

[permalink] [raw]
Subject: [PATCH] usb: typec: mux: intel: Fix DP_HPD_LVL bit field

According to the PMC Type C Subsystem (TCSS) Mux programming guide rev
0.6, the PMC HPD request LVL bit field is bit 5.
Fix the definition here to match the programming guide.

Since this bit field is changing, explicitly define a field for the
HPD_HIGH mode data bit.

Signed-off-by: Prashant Malani <[email protected]>
Fixes: 6701adfa9693 ("usb: typec: driver for Intel PMC mux control")
---
drivers/usb/typec/mux/intel_pmc_mux.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 67c5139cfa0d..15074aec94eb 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -63,6 +63,7 @@ enum {
#define PMC_USB_ALTMODE_DP_MODE_SHIFT 8

/* TBT specific Mode Data bits */
+#define PMC_USB_ALTMODE_HPD_HIGH BIT(14)
#define PMC_USB_ALTMODE_TBT_TYPE BIT(17)
#define PMC_USB_ALTMODE_CABLE_TYPE BIT(18)
#define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20)
@@ -75,7 +76,7 @@ enum {

/* Display HPD Request bits */
#define PMC_USB_DP_HPD_IRQ BIT(5)
-#define PMC_USB_DP_HPD_LVL BIT(6)
+#define PMC_USB_DP_HPD_LVL BIT(4)

struct pmc_usb;

@@ -158,8 +159,7 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
PMC_USB_ALTMODE_DP_MODE_SHIFT;

if (data->status & DP_STATUS_HPD_STATE)
- req.mode_data |= PMC_USB_DP_HPD_LVL <<
- PMC_USB_ALTMODE_DP_MODE_SHIFT;
+ req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH;

return pmc_usb_command(port, (void *)&req, sizeof(req));
}
--
2.26.2.645.ge9eca65c58-goog


2020-05-10 21:26:36

by Benson Leung

[permalink] [raw]
Subject: Re: [PATCH] usb: typec: mux: intel: Fix DP_HPD_LVL bit field

Hi Prashant,

On Sun, May 10, 2020 at 01:31:43PM -0700, Prashant Malani wrote:
> According to the PMC Type C Subsystem (TCSS) Mux programming guide rev
> 0.6, the PMC HPD request LVL bit field is bit 5.
> Fix the definition here to match the programming guide.
>
> Since this bit field is changing, explicitly define a field for the
> HPD_HIGH mode data bit.
>
> Signed-off-by: Prashant Malani <[email protected]>
> Fixes: 6701adfa9693 ("usb: typec: driver for Intel PMC mux control")

Reviewed-by: Benson Leung <[email protected]>


> ---
> drivers/usb/typec/mux/intel_pmc_mux.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index 67c5139cfa0d..15074aec94eb 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -63,6 +63,7 @@ enum {
> #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8
>
> /* TBT specific Mode Data bits */
> +#define PMC_USB_ALTMODE_HPD_HIGH BIT(14)
> #define PMC_USB_ALTMODE_TBT_TYPE BIT(17)
> #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18)
> #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20)
> @@ -75,7 +76,7 @@ enum {
>
> /* Display HPD Request bits */
> #define PMC_USB_DP_HPD_IRQ BIT(5)
> -#define PMC_USB_DP_HPD_LVL BIT(6)
> +#define PMC_USB_DP_HPD_LVL BIT(4)
>
> struct pmc_usb;
>
> @@ -158,8 +159,7 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
> PMC_USB_ALTMODE_DP_MODE_SHIFT;
>
> if (data->status & DP_STATUS_HPD_STATE)
> - req.mode_data |= PMC_USB_DP_HPD_LVL <<
> - PMC_USB_ALTMODE_DP_MODE_SHIFT;
> + req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH;
>
> return pmc_usb_command(port, (void *)&req, sizeof(req));
> }
> --
> 2.26.2.645.ge9eca65c58-goog
>

--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]


Attachments:
(No filename) (1.94 kB)
signature.asc (235.00 B)
Download all attachments