Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3621879pxb; Mon, 9 Nov 2020 16:42:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVEkF3WxTmwod4oRIRSWLrOn5/8H8M7K1yq3XzmWIPDZU+0sUsufspe7zr+iap38BcJc/8 X-Received: by 2002:a17:906:2b4e:: with SMTP id b14mr18560786ejg.354.1604968926214; Mon, 09 Nov 2020 16:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604968926; cv=none; d=google.com; s=arc-20160816; b=xJhB3lpprwqVx1L/Nd+c1VPk5J7lyYzEJ1+Jia0msjI1JKDpggR465S2lFnmGNtfgD Y3yL8eQh7RWUcCXwd9nbIGQbLUpfbSzbzTOXMRHQZ5+H4MSJw6TjnG6Am/XDD73625F2 pbigWvb5Seb2ytD9WststsW2ykCVS37MBvXFUmvco7zgtNPbqDmbTbs7NwbFgbATVzij 5CEmfHxl2uzWWR3dFWqtg+J+5VdZPjkhjx+1swqWngv8d5rliw4/b0MQ5ykRstWUH8JZ +PlNY1SdSjZCgJs9XsUfq+Pu+zTTJM8koMGWQ0/eTB1pyzh8PdUJcmkuSNTAan98VCuM eu7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=jOBTyXFqSqYmXi2KyIvj66YRfMXlg0+i2HVTIHJya10=; b=HsoZxV7K0neMdTiN3dcHxOQuMT9Vh39AuHRhJyBKkNvEzZxEttuhCnXTO4fWbHkEVX SwMh2nkF2DK1aQPISUF9vUT5h4xn5VEdlUe9DtTfPoUYNIitoN8NAkRqSaVmEqzoQK+c bh8h9c1U91LNFDacoh7De2hr/0P3wRyA/zykcxinxiFhtEs7NU/a3k25Y7FDopqJYd4W 9ZEMenvPhHmZyNb44uHAF2UnE96unvlJljSRhDboG1M9+ltkVl2DSGJHhMgkRYCHHTEf A9/K7pubH7yCWxQvFkkhOKShl+TtSMu2ikqivk1j76FBr1LyC98F3iBwI54ldOM2H0G/ T9SA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si8242427edi.184.2020.11.09.16.41.43; Mon, 09 Nov 2020 16:42:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731207AbgKJAjA (ORCPT + 99 others); Mon, 9 Nov 2020 19:39:00 -0500 Received: from mga04.intel.com ([192.55.52.120]:25963 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731115AbgKJAi7 (ORCPT ); Mon, 9 Nov 2020 19:38:59 -0500 IronPort-SDR: yK5iQr4Kw7DEnmET5ukiH0HgIYPEQegBgk5CrLuTuxftEkcyafwrKqW2dIXw2qQ6ByI/zmLCQv 0hiVUy/S+myg== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="167308616" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="167308616" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 16:38:55 -0800 IronPort-SDR: Fll814JwIQALSl+wpFokCLz5V0TOSBTozvUSSixxMgTKVHOtrRXJQdWC92ycZ0X2RnKysrwKD+ xtrXMCuDPDBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="354312366" Received: from uhpatel-desk4.jf.intel.com (HELO uhpatel-desk4.intel.com) ([10.23.15.15]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2020 16:38:54 -0800 From: Utkarsh Patel To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, pmalani@chromium.org, enric.balletbo@collabora.com, rajmohan.mani@intel.com, azhar.shaikh@intel.com, Utkarsh Patel Subject: [PATCH 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode Date: Mon, 9 Nov 2020 16:37:14 -0800 Message-Id: <20201110003716.5164-7-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201110003716.5164-1-utkarsh.h.patel@intel.com> References: <20201110003716.5164-1-utkarsh.h.patel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables. While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value. Suggested-by: Heikki Krogerus Signed-off-by: Utkarsh Patel --- drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 8111ed1fc574..b7416e82c3b3 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec, else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE) data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT; - data.active_link_training = !!(pd_ctrl->control_flags & - USB_PD_CTRL_ACTIVE_LINK_UNIDIR); + /* + * This driver does not have access to the identity information or + * capabilities of the cable, so we don't know is it a real USB4 or + * TBT3 cable. Therefore pretending that it's always TBT3 cable by + * filling the TBT3 Cable VDO. + */ + data.tbt_cable_vdo = TBT_MODE; + + if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR) + data.tbt_cable_vdo |= TBT_CABLE_LINK_TRAINING; + + data.tbt_cable_vdo |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen); port->state.alt = NULL; port->state.data = &data; -- 2.17.1