Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

Displayport Alternatemode 2.1 requires cable capabilities such as cable
signalling, cable type, DPAM version which then will be used by mux
driver for displayport configuration. These capabilities can be derived
from the Cable VDO.

Acked-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Link: https://lore.kernel.org/r/20230920023243.2494410-5-utkarsh.h.patel@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Utkarsh Patel and committed by
Greg Kroah-Hartman
70ca6c73 f9ee6043

+28
+28
drivers/platform/chrome/cros_ec_typec.c
··· 492 492 { 493 493 struct cros_typec_port *port = typec->ports[port_num]; 494 494 struct typec_displayport_data dp_data; 495 + u32 cable_tbt_vdo; 496 + u32 cable_dp_vdo; 495 497 int ret; 496 498 497 499 if (typec->pd_ctrl_ver < 2) { ··· 525 523 526 524 port->state.data = &dp_data; 527 525 port->state.mode = TYPEC_MODAL_STATE(ffs(pd_ctrl->dp_mode)); 526 + 527 + /* Get cable VDO for cables with DPSID to check DPAM2.1 is supported */ 528 + cable_dp_vdo = cros_typec_get_cable_vdo(port, USB_TYPEC_DP_SID); 529 + 530 + /** 531 + * Get cable VDO for thunderbolt cables and cables with DPSID but does not 532 + * support DPAM2.1. 533 + */ 534 + cable_tbt_vdo = cros_typec_get_cable_vdo(port, USB_TYPEC_TBT_SID); 535 + 536 + if (cable_dp_vdo & DP_CAP_DPAM_VERSION) { 537 + dp_data.conf |= cable_dp_vdo; 538 + } else if (cable_tbt_vdo) { 539 + dp_data.conf |= TBT_CABLE_SPEED(cable_tbt_vdo) << DP_CONF_SIGNALLING_SHIFT; 540 + 541 + /* Cable Type */ 542 + if (cable_tbt_vdo & TBT_CABLE_OPTICAL) 543 + dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL << DP_CONF_CABLE_TYPE_SHIFT; 544 + else if (cable_tbt_vdo & TBT_CABLE_RETIMER) 545 + dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER << DP_CONF_CABLE_TYPE_SHIFT; 546 + else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE) 547 + dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER << DP_CONF_CABLE_TYPE_SHIFT; 548 + } else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) { 549 + dp_data.conf |= VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]) << 550 + DP_CONF_SIGNALLING_SHIFT; 551 + } 528 552 529 553 ret = cros_typec_retimer_set(port->retimer, port->state); 530 554 if (!ret)