Message ID | 20230920023243.2494410-6-utkarsh.h.patel@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6c29de68fb2955463d6b4115364ca78fcb0275bd |
Headers | show |
Series | Displayport Alternate Mode 2.1 Support | expand |
On 9/20/23 5:32 AM, Utkarsh Patel wrote: > Mux agent driver can configure cable details such as cable type and > cable speed received as a part of displayport configuration to support > Displayport Alternate mode 2.1. > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com> > --- > Changes in v4: > - No change. > > Changes in v3: > - No change. > > Changes in v2: > - No change. > > drivers/usb/typec/mux/intel_pmc_mux.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c > index 60ed1f809130..233958084b43 100644 > --- a/drivers/usb/typec/mux/intel_pmc_mux.c > +++ b/drivers/usb/typec/mux/intel_pmc_mux.c [...] > @@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) > req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << > PMC_USB_ALTMODE_DP_MODE_SHIFT; > > + if (!is_pmc_mux_tbt(port->pmc->iom_adev)) { > + u8 cable_speed = (data->conf & DP_CONF_SIGNALLING_MASK) >> > + DP_CONF_SIGNALLING_SHIFT; > + > + u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) >> > + DP_CONF_CABLE_TYPE_SHIFT; > + > + req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed); > + > + if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL) > + req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE; > + else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER) > + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE | > + PMC_USB_ALTMODE_RETIMER_CABLE; > + else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER) > + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE; Why not *switch* instead of string of *if*s? > + } > + > ret = pmc_usb_command(port, (void *)&req, sizeof(req)); > if (ret) > return ret; MBR, Sergey
Hi Sergei, Thank you for the review. > -----Original Message----- > From: Sergei Shtylyov <sergei.shtylyov@gmail.com> > Sent: Wednesday, September 20, 2023 2:10 AM > To: Patel, Utkarsh H <utkarsh.h.patel@intel.com>; linux- > kernel@vger.kernel.org; linux-usb@vger.kernel.org > Cc: heikki.krogerus@linux.intel.com; pmalani@chromium.org; chrome- > platform@lists.linux.dev; andriy.shevchenko@linux.intel.com; > bleung@chromium.org > Subject: Re: [PATCH v4 5/5] usb: typec: intel_pmc_mux: Configure Displayport > Alternate mode 2.1 > > On 9/20/23 5:32 AM, Utkarsh Patel wrote: > > > Mux agent driver can configure cable details such as cable type and > > cable speed received as a part of displayport configuration to support > > Displayport Alternate mode 2.1. > > > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > > Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com> > > --- > > Changes in v4: > > - No change. > > > > Changes in v3: > > - No change. > > > > Changes in v2: > > - No change. > > > > drivers/usb/typec/mux/intel_pmc_mux.c | 24 > ++++++++++++++++++++++++ > > 1 file changed, 24 insertions(+) > > > > diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c > > b/drivers/usb/typec/mux/intel_pmc_mux.c > > index 60ed1f809130..233958084b43 100644 > > --- a/drivers/usb/typec/mux/intel_pmc_mux.c > > +++ b/drivers/usb/typec/mux/intel_pmc_mux.c > [...] > > @@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, > struct typec_mux_state *state) > > req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << > > PMC_USB_ALTMODE_DP_MODE_SHIFT; > > > > + if (!is_pmc_mux_tbt(port->pmc->iom_adev)) { > > + u8 cable_speed = (data->conf & > DP_CONF_SIGNALLING_MASK) >> > > + DP_CONF_SIGNALLING_SHIFT; > > + > > + u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) > >> > > + DP_CONF_CABLE_TYPE_SHIFT; > > + > > + req.mode_data |= > PMC_USB_ALTMODE_CABLE_SPD(cable_speed); > > + > > + if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL) > > + req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE; > > + else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER) > > + req.mode_data |= > PMC_USB_ALTMODE_ACTIVE_CABLE | > > + > PMC_USB_ALTMODE_RETIMER_CABLE; > > + else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER) > > + req.mode_data |= > PMC_USB_ALTMODE_ACTIVE_CABLE; > > Why not *switch* instead of string of *if*s? > Switch can be used here but if there is no added benefit, would stick to if/else. Sincerely, Utkarsh Patel.
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index 60ed1f809130..233958084b43 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -191,6 +191,12 @@ static int hsl_orientation(struct pmc_usb_port *port) return port->orientation - 1; } +static bool is_pmc_mux_tbt(struct acpi_device *adev) +{ + return acpi_dev_hid_uid_match(adev, "INTC1072", NULL) || + acpi_dev_hid_uid_match(adev, "INTC1079", NULL); +} + static int pmc_usb_send_command(struct intel_scu_ipc_dev *ipc, u8 *msg, u32 len) { u8 response[4]; @@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << PMC_USB_ALTMODE_DP_MODE_SHIFT; + if (!is_pmc_mux_tbt(port->pmc->iom_adev)) { + u8 cable_speed = (data->conf & DP_CONF_SIGNALLING_MASK) >> + DP_CONF_SIGNALLING_SHIFT; + + u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) >> + DP_CONF_CABLE_TYPE_SHIFT; + + req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed); + + if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL) + req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE; + else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER) + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE | + PMC_USB_ALTMODE_RETIMER_CABLE; + else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER) + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE; + } + ret = pmc_usb_command(port, (void *)&req, sizeof(req)); if (ret) return ret;