From: Prashant Malani <pmalani@chromium.org>
To: Utkarsh Patel <utkarsh.h.patel@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
heikki.krogerus@linux.intel.com,
andriy.shevchenko@linux.intel.com, bleung@chromium.org
Subject: Re: [PATCH 3/4] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support
Date: Fri, 18 Aug 2023 17:16:12 +0000 [thread overview]
Message-ID: <ZN+nXGr3S0OL3Edn@chromium.org> (raw)
In-Reply-To: <20230811210735.159529-4-utkarsh.h.patel@intel.com>
Hi Utkarsh,
Thanks for the patch. Please include the chrome-platform mailing list to each
patch in the series; at the very least, patches which touch drivers/platform/chrome
should definitely have the mailing list (chrome-platform@lists.linux.dev). Otherwise,
we don't have enough context about what changes are being made across the series.
On Aug 11 14:07, 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 data as well as from
> the existing EC PD host command interface.
>
> 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>
> ---
> drivers/platform/chrome/cros_ec_typec.c | 30 +++++++++++++++++++++++++
> drivers/platform/chrome/cros_ec_typec.h | 1 +
> 2 files changed, 31 insertions(+)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index d0b4d3fc40ed..eb4a1cb584a2 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -485,6 +485,32 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
> return typec_mux_set(port->mux, &port->state);
> }
>
> +static int cros_typec_dp21_support(struct cros_typec_port *port,
> + struct typec_displayport_data dp21_data,
> + struct ec_response_usb_pd_control_v2 *pd_ctrl)
> +{
> + u32 cable_vdo = cros_typec_get_cable_vdo(port, USB_TYPEC_DP_SID);
> +
> + if (cable_vdo & DP_CAP_DPAM_VERSION) {
> + dp21_data.conf |= cable_vdo;
> + } else {
> + /* Cable Speed */
> + dp21_data.conf |= pd_ctrl->cable_speed << DP_CONF_SIGNALLING_SHIFT;
> +
> + /* Cable Type */
> + if (pd_ctrl->cable_gen & USB_PD_CTRL_OPTICAL_CABLE)
> + dp21_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL << DP_CONF_CABLE_TYPE_SHIFT;
> + else if (cros_typec_get_cable_vdo(port, USB_TYPEC_TBT_SID) & TBT_CABLE_RETIMER)
> + dp21_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER << DP_CONF_CABLE_TYPE_SHIFT;
> + else if (pd_ctrl->cable_gen & USB_PD_CTRL_ACTIVE_CABLE)
> + dp21_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER << DP_CONF_CABLE_TYPE_SHIFT;
> + }
I don't understand why the conf VDO is being recreated here. cable_vdo should already contain the necessary
bits. Just use the cable_vdo that you get from cros_typec_get_cable_vdo(); it will have all the bits
set correctly already (the EC should be doing that).
The "if" condition should also be unnecessary.
You are already doing something similar in the other patch for "active retimer cable support" [1]
> +
> + port->state.data = &dp21_data;
> +
> + return typec_mux_set(port->mux, &port->state);
Note that now you have reversed the order in which the muxes are set (which leads to subtle timing issues with
Burnside Bridge and other similar retimers). So please don't do this.
> +}
> +
> /* Spoof the VDOs that were likely communicated by the partner. */
> static int cros_typec_enable_dp(struct cros_typec_data *typec,
> int port_num,
> @@ -524,6 +550,9 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
> port->state.data = &dp_data;
> port->state.mode = TYPEC_MODAL_STATE(ffs(pd_ctrl->dp_mode));
>
> + if (typec->typec_dp21_supported)
> + return cros_typec_dp21_support(port, dp_data, pd_ctrl);
> +
> ret = cros_typec_retimer_set(port->retimer, port->state);
> if (!ret)
> ret = typec_mux_set(port->mux, &port->state);
> @@ -1196,6 +1225,7 @@ static int cros_typec_probe(struct platform_device *pdev)
>
> typec->typec_cmd_supported = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_CMD);
> typec->needs_mux_ack = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK);
> + typec->typec_dp21_supported = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_DP2_1);
This entire feature isn't necessary. Regardless of whether dp2.1 is supported or not, the port driver
just needs to forward the cable_vdo it receives faithfully to the mux driver, which can deal with
internal details (based on whether *it* supports DP 2.1 or not).
Thanks,
-Prashant
[1] https://lore.kernel.org/linux-usb/20230718024703.1013367-1-utkarsh.h.patel@intel.com/T/#m950b24e7874d34f11081f252ba3ef4e752628529
next prev parent reply other threads:[~2023-08-18 17:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 21:07 [PATCH 0/4] Displayport Alternate Mode 2.1 Support Utkarsh Patel
2023-08-11 21:07 ` [PATCH 1/4] usb: typec: Add " Utkarsh Patel
2023-08-11 21:07 ` [PATCH 2/4] platform/chrome: cros_ec: Add Displayport Alternatemode 2.1 feature flag Utkarsh Patel
2023-08-11 21:07 ` [PATCH 3/4] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support Utkarsh Patel
2023-08-18 17:16 ` Prashant Malani [this message]
2023-08-21 17:34 ` Patel, Utkarsh H
2023-08-21 23:40 ` Prashant Malani
2023-08-25 0:02 ` Patel, Utkarsh H
2023-08-11 21:07 ` [PATCH 4/4] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1 Utkarsh Patel
2023-08-12 9:47 ` Sergey Shtylyov
2023-08-14 14:48 ` Andy Shevchenko
2023-08-14 15:06 ` Andy Shevchenko
2023-08-22 12:09 ` [PATCH 0/4] Displayport Alternate Mode 2.1 Support Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZN+nXGr3S0OL3Edn@chromium.org \
--to=pmalani@chromium.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bleung@chromium.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=utkarsh.h.patel@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox