[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZQsE5hgm4qYpr/My@smile.fi.intel.com>
Date: Wed, 20 Sep 2023 17:42:46 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Utkarsh Patel <utkarsh.h.patel@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
heikki.krogerus@...ux.intel.com, pmalani@...omium.org,
chrome-platform@...ts.linux.dev, bleung@...omium.org
Subject: Re: [PATCH v4 4/5] platform/chrome: cros_ec_typec: Add Displayport
Alternatemode 2.1 Support
On Tue, Sep 19, 2023 at 07:32:42PM -0700, Utkarsh Patel wrote:
> 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.
...
> + /**
Are you sure?
> + * Get cable VDO for thunderbolt cables and cables with DPSID but does not
> + * support DPAM2.1.
> + */
...
> + if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
> + dp_data.conf |= cable_dp_vdo;
> + } else if (cable_tbt_vdo) {
> + dp_data.conf |= TBT_CABLE_SPEED(cable_tbt_vdo) << DP_CONF_SIGNALLING_SHIFT;
> +
> + /* Cable Type */
> + if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
> + dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL << DP_CONF_CABLE_TYPE_SHIFT;
> + else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
> + dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER << DP_CONF_CABLE_TYPE_SHIFT;
> + else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
> + dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER << DP_CONF_CABLE_TYPE_SHIFT;
> + } else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) {
> + dp_data.conf |= VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]) <<
> + DP_CONF_SIGNALLING_SHIFT;
> + }
You can also make it a bit more readable with (use better names
if you think it's needed)
u32 signalling = 0;
u32 cable_type = 0;
...
if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
dp_data.conf |= cable_dp_vdo;
} else if (cable_tbt_vdo) {
signalling = TBT_CABLE_SPEED(cable_tbt_vdo);
/* Cable Type */
if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
cable_type = DP_CONF_CABLE_TYPE_OPTICAL;
else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
cable_type = DP_CONF_CABLE_TYPE_RE_TIMER;
else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
cable_type = DP_CONF_CABLE_TYPE_RE_DRIVER;
} else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) {
signalling = VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]);
}
dp_data.conf |= signalling << DP_CONF_SIGNALLING_SHIFT;
dp_data.conf |= cable_type << DP_CONF_CABLE_TYPE_SHIFT;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists