Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1453400rwd; Thu, 15 Jun 2023 10:41:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ557upyIJ0gpy5tSbpESBV6+b6elwCJ4tQs0yLzXm1CzYHeNvE49GCpjt3zG0PHBBK8mUWT X-Received: by 2002:a05:6a20:6a1e:b0:114:7637:3459 with SMTP id p30-20020a056a206a1e00b0011476373459mr166787pzk.4.1686850897878; Thu, 15 Jun 2023 10:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686850897; cv=none; d=google.com; s=arc-20160816; b=tfRODqczJ9T65bvdxRQaOxxN8QRD+lARL0UW2vWfCrDNzZMZSpsn8FAqcttHe9cJcM EY2csqLg85HhnOybB9toLtJ+xvkso4jjTJzJsxFizqCLJyBwHa+9ou6LCEWPZh2PuTD/ t9USOPdNx0ermpfItBhSyzECFfZ+FgE6Sc02Qu6F2Va2Ba50B1B3CgXwm57jIfCPT53B P3Iy6o5oKkTX5XHLXNnnNoL15T0CYu5/eeUGJ3DO1lRvOlYwtTMvc6FF1JRs6E9Icozt jvHLmbbeLSYYmltAT+Alnxibqq4HWiwgweXggTYp5WhSETFkw90Xnw1i9PMVyxR9xgCz /XVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=osliInNk1/bU9RCFmEpWSSuapVy8I/16aX6E/CrvA2U=; b=IooELi7uP0Us3Zx7Fk3kmTPfMH2BjXstptBK6uZGaSqA5IZNlTBpIJp1GMPnzeEcTz p5WGOocBZaLTcHwjQOZGa+KI6IzJ/v5gC09n31zxNoN7aJrHZeWX3x6iMn5ymNaW3zAI LhS8Xse065D3zYPODJOqVsRnexNGNC2nX0VfmEQmioqR5MCwIAKLYteGflsv7aD450uB 7xVHAeSAeZk2JM1WyOXOJW8xtiFyyIlNaFKWxSr6ssyZgKrsXMRlvudZ/Qb5lJkyjeAW Gn1YcGQydXa8tLzJ7qfqlsv5UdA29LLx8+i2hemlWtT2XzH9V21MEtTbT9kux+X61qmV zBVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TfS+uE1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a63be4d000000b00544054a5f90si13071761pgo.555.2023.06.15.10.41.25; Thu, 15 Jun 2023 10:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TfS+uE1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjFOR2y (ORCPT + 99 others); Thu, 15 Jun 2023 13:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjFOR2x (ORCPT ); Thu, 15 Jun 2023 13:28:53 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B3B2AC for ; Thu, 15 Jun 2023 10:28:52 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-62de4cc0172so30234836d6.0 for ; Thu, 15 Jun 2023 10:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686850131; x=1689442131; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=osliInNk1/bU9RCFmEpWSSuapVy8I/16aX6E/CrvA2U=; b=TfS+uE1yKvVXVl+IfYsl3xobG8Dd/xgHVlpu80X7s9BpSwRELd7/sdVF/ZZCUdyyfl zrPMInrof6aqrDGnX0SvLh1juhNEmS4Ed6VCcAvg7hqbAOlNEWpHfl3naxtJW7o+RvBn OUeMO48Ye35N9sxuDv7KGDAxvZAwKGnHs+fOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686850131; x=1689442131; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=osliInNk1/bU9RCFmEpWSSuapVy8I/16aX6E/CrvA2U=; b=bHhAml8NrUrGeOF34tlTfuxn3AyPmbNB6ws0ti5WD+DmiwviAz/tc1GHVghUTe0ASQ 8EbD326sa40OrettxLrMFKLN+5fkReuW3Ur6ElUxF7ASySSDIQJJlg38LFc6tvQQ7XgP conrvt5Ll2aZEMrsPGpolV4LJQfY56rcHjPACrdbH/cFU5docWuxmSP8pMTl82mAf3ar fdb+0rCXgxTwxtWx0nM9SGSbYux5mZh8qVcxcg5MMD01iW7tspCd6egJuJs4dMszPEfg ylqqHYtkE6GaW5XNeGO0Q9ns80BOoRkkpmu6BhRycnhVEvyqtSn6LqhWpZg/qtDNFkNy Tyqg== X-Gm-Message-State: AC+VfDyWIQERHoI/S4eV87eekRldOLX4UMEKHDpf/ippfKZvlqyCmrgW HQ6dWB04BUe2UGAs5exXQYULGIM7mHAf6FpB/2NvrseiYjGsbCXmROw= X-Received: by 2002:ad4:5d4a:0:b0:629:1659:dcc with SMTP id jk10-20020ad45d4a000000b0062916590dccmr25254405qvb.34.1686850131319; Thu, 15 Jun 2023 10:28:51 -0700 (PDT) MIME-Version: 1.0 References: <20230605010117.794691-1-utkarsh.h.patel@intel.com> <20230605010117.794691-2-utkarsh.h.patel@intel.com> In-Reply-To: <20230605010117.794691-2-utkarsh.h.patel@intel.com> From: Prashant Malani Date: Thu, 15 Jun 2023 10:28:41 -0700 Message-ID: Subject: Re: [PATCH 1/2] platform/chrome: cros_ec_typec: Configure Retimer cable type To: Utkarsh Patel Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, heikki.krogerus@linux.intel.com, bleung@chromium.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (Sorry, I've been out on leave so haven't had a chance to look at this earl= ier) On Sun, Jun 4, 2023 at 6:00=E2=80=AFPM Utkarsh Patel wrote: > > Connector class driver only configure cable type active or passive. > With this change it will also configure if the cable type is retimer or > redriver if required by AP. This details will be provided by Chrome EC > as a part of cable discover mode VDO. > > This change also brings in corresponding EC header updates from the EC > code base [1]. Please separate this into another patch. > > [1]: > https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/mas= ter/include/ec_commands.h > > Acked-by: Heikki Krogerus > Signed-off-by: Utkarsh Patel > --- > drivers/platform/chrome/cros_ec_typec.c | 8 +++++++- > include/linux/platform_data/cros_ec_commands.h | 2 ++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/c= hrome/cros_ec_typec.c > index a673c3342470..9c18b1df64a7 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -448,6 +448,9 @@ static int cros_typec_enable_tbt(struct cros_typec_da= ta *typec, > if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE) > data.enter_vdo |=3D TBT_ENTER_MODE_ACTIVE_CABLE; > > + if (pd_ctrl->control_flags & USB_PD_CTRL_RETIMER_CABLE) > + data.enter_vdo |=3D TBT_CABLE_RETIMER; > + > if (!port->state.alt) { > port->state.alt =3D port->port_altmode[CROS_EC_ALTMODE_TB= T]; > ret =3D cros_typec_usb_safe_state(port); > @@ -522,8 +525,11 @@ static int cros_typec_enable_usb4(struct cros_typec_= data *typec, > /* Cable Type */ > if (pd_ctrl->control_flags & USB_PD_CTRL_OPTICAL_CABLE) > data.eudo |=3D EUDO_CABLE_TYPE_OPTICAL << EUDO_CABLE_TYPE= _SHIFT; > - else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE) > + else if (pd_ctrl->control_flags & USB_PD_CTRL_RETIMER_CABLE) > data.eudo |=3D EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYP= E_SHIFT; > + else if (!(pd_ctrl->control_flags & USB_PD_CTRL_RETIMER_CABLE) && > + (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)) > + data.eudo |=3D EUDO_CABLE_TYPE_RE_DRIVER << EUDO_CABLE_TY= PE_SHIFT; > > data.active_link_training =3D !!(pd_ctrl->control_flags & > USB_PD_CTRL_ACTIVE_LINK_UNIDIR); > diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/lin= ux/platform_data/cros_ec_commands.h > index ab721cf13a98..c9aa5495c666 100644 > --- a/include/linux/platform_data/cros_ec_commands.h > +++ b/include/linux/platform_data/cros_ec_commands.h > @@ -4963,6 +4963,8 @@ struct ec_response_usb_pd_control_v1 { > #define USB_PD_CTRL_TBT_LEGACY_ADAPTER BIT(2) > /* Active Link Uni-Direction */ > #define USB_PD_CTRL_ACTIVE_LINK_UNIDIR BIT(3) > +/* Retimer/Redriver cable */ > +#define USB_PD_CTRL_RETIMER_CABLE BIT(4) Why are we adding this to this host commands interface? Is this information not available from the Cable (plug)'s Identity information? We register all of that in the port driver already [1], so we should just use that, instead of changing the host command interface. Thanks, [1] https://elixir.bootlin.com/linux/v6.4-rc6/source/drivers/platform/chro= me/cros_ec_typec.c#L768