Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp81216pxb; Thu, 15 Apr 2021 23:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8oyrm2puXS1FBJUZDehZm7/YhtRn8RNa7XdfCt3ox2OD8cCdwyIocj4xbBYgipyabPE6E X-Received: by 2002:a17:906:cec2:: with SMTP id si2mr7129730ejb.234.1618555121381; Thu, 15 Apr 2021 23:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618555121; cv=none; d=google.com; s=arc-20160816; b=Pnwx6heMzBxBG3pu3sj0F6OGt1IGwbryi0bu58IV511NztevnQd9YoOsMoxrTMukOL vLut/rFxynbwgLdhiC+VNnl1VZqOzsAgKTGPXuzZiqksTGj+Ungsy+eCLfbsdGxOJ8DO HhHJ78f1bhVyNiw2C8ajrXE0q09QkgSXtjmjL7foxK97kcET8wsQelUlj66nJyFSSfJR /o8DSfOzGyX5fnTsKfc4iqXCbOGLvVOY0dNZvU5B2JlgoPkiXDt7eCp+/LkHkNsTZ7v5 fJV56QFnYh5v2HJ9TIZlPFNje7wbAYVZPB4qA/d91zaZob4Erdj/+b9tynSyqlfts1Av i9Rw== 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=HeEOZF5KkABK2M/RTmpqX++SXrAdlthytWqJ+8fcvIA=; b=ruJmxcvww1CadsaYEZC6P91CHYo3dxVc2FUyPUWkqHcIzcqV3qtv6Rl+DPTuSmNaKM Y0IH205PCZPA+lzJYIU8C85SdxG/NCIpvNfu8//oJT+LJS7I0ted2FE4DemLCoVy5UUM Ejfq1LcGKTQNrtwC9D6a0aY6QFdo6f93V0TL8hVtaQKyAGyPc+JxnYqVRwyJTu5S6d3h wu+OJzJO8VeEM3z1V3WQVzGAHSrXkYr4FufZvWze5yK1oIetFN5yDXrc97SYSpbKKeD5 rxpHPtrJM9cphdVynV5wdvch8xvujIjaDm5X/VubnGoFTNoa/cLB2A4QD7ztdj7aiM6s +RPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YTLwAKpJ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si3825529ejr.160.2021.04.15.23.38.18; Thu, 15 Apr 2021 23:38:41 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YTLwAKpJ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237362AbhDPFj3 (ORCPT + 99 others); Fri, 16 Apr 2021 01:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbhDPFj2 (ORCPT ); Fri, 16 Apr 2021 01:39:28 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C670C061574 for ; Thu, 15 Apr 2021 22:39:04 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id e66so11443094oif.11 for ; Thu, 15 Apr 2021 22:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HeEOZF5KkABK2M/RTmpqX++SXrAdlthytWqJ+8fcvIA=; b=YTLwAKpJyW9L+jsMG0AaqQBsVRtu3dpmEF7K4rQnhCfHubNY3MY3CUVTRLkk7vM+ad v2/G+5ZaIBo7T+55PcWdCR+DB5jGUyWOb05ED05zeXADfQ9zUj0TbuNZgb03HUio8nHF GK/Uf8inYvjCJrCnvlk8Deh+8niOx1k5ImwKf/q+fvO0/ZS6gDDJZP5t1pkbrHJHciNl F/JnHQLOnFBi2s6GBqy+hQdZgPxIRSRlXOBiGfpGjn2Td8e3DXxu1Ckxq8x7ZzAuhvgJ 5x+30YCycXr+EDNSgN+AAzp0cq7vFWSE2Tb6rJ1eXHx1RYTwoUrcKF/S9RbzKzhFIedx s2dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HeEOZF5KkABK2M/RTmpqX++SXrAdlthytWqJ+8fcvIA=; b=Ed2fuJ6St+fFFTaU+fWADbkrJzw0bUdDeerPYXT9aqmW1TiUHKmeXyVgpIRVzvImso alg5lJcLD5vMizkE94z1Z55ymZ+jWqGFIjH9LigMD9z2HHQui6ZPKDr/s9MQOFu2laYm 9dSAAhD1cZzcrNuiPCnrX+rgJ7Czfm4+4leAKjWYZ6kCDWkYWXXVgT3vqoIEe8U4rRLR oVN3wkIszS71Uw/YE3Bb37aMRS6F5kRAIYHk//4hAGAoxPZ0TA94d5OGUY1KoOgLpTKc fLtm/BhuHDiD7ZC/0z/peZdX3adhhUewwcnITCQdXwmnX75gkv+37uLZhKnoaqEjxFkz 8eHw== X-Gm-Message-State: AOAM53148BZLzCHQ8NtDGsUu7V4Est992k2olX9QiPj3xrMSXLJgT3V6 VFEiKrqfZ1kSq1+wddpBD2N2zLmsuk9KQmw8Ilo= X-Received: by 2002:a05:6808:bd6:: with SMTP id o22mr5221897oik.129.1618551544090; Thu, 15 Apr 2021 22:39:04 -0700 (PDT) MIME-Version: 1.0 References: <20210415021456.1805797-1-pmalani@chromium.org> In-Reply-To: <20210415021456.1805797-1-pmalani@chromium.org> From: Enric Balletbo Serra Date: Fri, 16 Apr 2021 07:38:55 +0200 Message-ID: Subject: Re: [PATCH] platform/chrome: cros_ec_typec: Handle hard reset To: Prashant Malani Cc: linux-kernel , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , "Gustavo A. R. Silva" , Mark Brown , Pi-Hsun Shih , Utkarsh Patel , Yu-Hsuan Hsu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prashant, Thank you for your patch. Missatge de Prashant Malani del dia dj., 15 d=E2=80=99abr. 2021 a les 4:15: > > The Chrome Embedded Controller (EC) generates a hard reset type C event > when a USB Power Delivery (PD) hard reset is encountered. Handle this > event by unregistering the partner and cable on the associated port and > clearing the event flag. > > Also update the EC command header to include the new event bit. This bit > is included in the latest version of the Chrome EC headers[1]. > > [1] https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads= /main/include/ec_commands.h > > Cc: Benson Leung > Signed-off-by: Prashant Malani > --- > drivers/platform/chrome/cros_ec_typec.c | 13 +++++++++++++ > include/linux/platform_data/cros_ec_commands.h | 1 + Could this be a separate patch? Thank you. Enric > 2 files changed, 14 insertions(+) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/c= hrome/cros_ec_typec.c > index d3df1717a5fd..22052f569f2a 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -905,6 +905,19 @@ static void cros_typec_handle_status(struct cros_typ= ec_data *typec, int port_num > return; > } > > + /* If we got a hard reset, unregister everything and return. */ > + if (resp.events & PD_STATUS_EVENT_HARD_RESET) { > + cros_typec_remove_partner(typec, port_num); > + cros_typec_remove_cable(typec, port_num); > + > + ret =3D cros_typec_send_clear_event(typec, port_num, > + PD_STATUS_EVENT_HARD_RE= SET); > + if (ret < 0) > + dev_warn(typec->dev, > + "Failed hard reset event clear, port: %d= \n", port_num); > + return; > + } > + > /* Handle any events appropriately. */ > if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[= port_num]->sop_disc_done) { > u16 sop_revision; > diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/lin= ux/platform_data/cros_ec_commands.h > index 5ff8597ceabd..9156078c6fc6 100644 > --- a/include/linux/platform_data/cros_ec_commands.h > +++ b/include/linux/platform_data/cros_ec_commands.h > @@ -5678,6 +5678,7 @@ enum tcpc_cc_polarity { > > #define PD_STATUS_EVENT_SOP_DISC_DONE BIT(0) > #define PD_STATUS_EVENT_SOP_PRIME_DISC_DONE BIT(1) > +#define PD_STATUS_EVENT_HARD_RESET BIT(2) > > struct ec_params_typec_status { > uint8_t port; > -- > 2.31.1.295.g9ea45b61b8-goog >