Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp925887pxb; Thu, 5 Nov 2020 17:32:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwMAv51S/oEqqxFQ1lfIn/ddGGL7KdTPtWEWUzgyqR34rb2DRnECgm/aGMbXMHXXd3uH9V X-Received: by 2002:aa7:d64b:: with SMTP id v11mr5576894edr.253.1604626362884; Thu, 05 Nov 2020 17:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604626362; cv=none; d=google.com; s=arc-20160816; b=yerr3OWzhwz5rgPqgN1NQEwqFET/emDqW3cDeikMcwr0vKC/Ddgks4qDR6Azkq/HcZ hbda3dUtckNYBqMFm3njK80X5/0NV3yJtUbXfFPcgoxLIG0uJ/YFbbeWXfxPsoiOMUY1 XSxS62rgM81m93R2eI1tZsaiuPE7c9UzXp4PL1dw0FX6t5OdN4VN3Lp8RTztlfPah7pf bUK3HtaIdYeDsnJ2nYUWS6WDsoODYkte/YZWHwCZD+S1zISitjaIQzBsLiEZeJ+K62r/ FlEGTcYvmQCs3ftb4IvdEHIrxzsEJDPS+2ath41freztWwx+e4OhPWEHs+YUIIH9bsQ8 n5WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Isl/WzUuPljZe1UXO1RGJXR4af+lyqHxbfYjSyUmTkQ=; b=XRzAB9MRVa0xVF1eDUJ7aRZlEh/l5bB2hWB0HnKlG3TcuMENl5DOgzME4GRDfbxk4I Lst9toP+94TZHt9AGHIAyK1LwvddMMoFk3vwR5rPi77LR+Xqrzang3l8yCL7BS18fUVY fMXsKVGpWbl8E134GvZ2c6jHDy0wyIi9mwO4lBVMyFN5De5eEF77a++O9aHvVXfMr6pw AcLH6owh8KfwfzSbdV4QYx8fhut7JXbYg0ON7eeHY24WlUkYb2Jl/bIQS+QZy/+3egK4 LNgnqZrvFgN4BjbE0rq9xBHoAmkMg7b/3BWIsKLxPa05XWEPLHXkYG4YJGfH3ULlucVx yCEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GxVvL+MS; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 32si2314660edr.232.2020.11.05.17.32.20; Thu, 05 Nov 2020 17:32:42 -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; dkim=pass header.i=@chromium.org header.s=google header.b=GxVvL+MS; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732743AbgKFB2c (ORCPT + 99 others); Thu, 5 Nov 2020 20:28:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732701AbgKFB2c (ORCPT ); Thu, 5 Nov 2020 20:28:32 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7D9C0613CF for ; Thu, 5 Nov 2020 17:28:32 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id t14so2684743pgg.1 for ; Thu, 05 Nov 2020 17:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Isl/WzUuPljZe1UXO1RGJXR4af+lyqHxbfYjSyUmTkQ=; b=GxVvL+MS9hLkAgTYVlotm7VFLMcrEv7IN1lbn7z4vA8niPlW7ShKz01QQGDywB8JQA 9101aQF4fD+5MQUWb3yRDq2L+BG0PeGz/YbjEwpXSjaxnnSSaqeB4TQQo4MLzLOVpoMK TD8MHX7GCV0SA0+0TiJCubI2WO+XBdAk0lirw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Isl/WzUuPljZe1UXO1RGJXR4af+lyqHxbfYjSyUmTkQ=; b=KE+Ub3Zlr/QOtnA8kKchvXT31BvaG4iZGxbX7Cm6jlG5javSO4/9OxRxRYdf4ufQNt ZKB/GeOIgNj/Zb6nYArpuRheB//b7bFv+KVCGBWUairUdnngDrChpzOd8u+BI8IIKH22 G2eAH4eHzNsYPwFaSSE1smevwoREdgU0UFe0/z1oQXy5MxfHp5VyAJxVazrTmeZFQQCJ 6TRqY4V5f1hXUX5BzHYREGGke7kYfQb0XRB2dwxbW2UWZkRD6oqUYqw6BIrQSUqf7Qh4 4BKMWjirFf1p4y8zTa35SPtFoIcLtvNclxzocazfHSxOBHV+dG7+4DDtEdF9Rsx9ESrW Fafg== X-Gm-Message-State: AOAM533y0EUmWpn90Oj/4lubBmRk+/6AFJTuMBHWZhANLVUhmO5x/ppr A3VyFKnk7tmLEeKNCPOXLJQYXv6WX3PcEA== X-Received: by 2002:a17:90b:d18:: with SMTP id n24mr5512719pjz.206.1604626111708; Thu, 05 Nov 2020 17:28:31 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:a28c:fdff:fef0:49dd]) by smtp.gmail.com with ESMTPSA id e2sm3567887pgd.27.2020.11.05.17.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 17:28:30 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, dzigterman@chromium.org, alevkoy@chromium.org, Prashant Malani , Benson Leung , Enric Balletbo i Serra , Greg Kroah-Hartman , Guenter Roeck , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) Subject: [PATCH 1/6] platform/chrome: cros_ec_typec: Make disc_done flag partner-only Date: Thu, 5 Nov 2020 17:27:53 -0800 Message-Id: <20201106012758.525472-2-pmalani@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201106012758.525472-1-pmalani@chromium.org> References: <20201106012758.525472-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the disc_done flag, which indicates whether PD discovery is complete, to sop_disc_done instead, since we will process SOP and SOP' discovery data separately. Signed-off-by: Prashant Malani --- drivers/platform/chrome/cros_ec_typec.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index ce031a10eb1b..801c3d2c1fbd 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -57,8 +57,8 @@ struct cros_typec_port { /* Port alt modes. */ struct typec_altmode p_altmode[CROS_EC_ALTMODE_MAX]; - /* Flag indicating that PD discovery data parsing is completed. */ - bool disc_done; + /* Flag indicating that PD partner discovery data parsing is completed. */ + bool sop_disc_done; struct ec_response_typec_discovery *sop_disc; struct list_head partner_mode_list; }; @@ -210,7 +210,7 @@ static void cros_typec_remove_partner(struct cros_typec_data *typec, typec_unregister_partner(port->partner); port->partner = NULL; memset(&port->p_identity, 0, sizeof(port->p_identity)); - port->disc_done = false; + port->sop_disc_done = false; } static void cros_unregister_ports(struct cros_typec_data *typec) @@ -727,18 +727,13 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num return; } - if (typec->ports[port_num]->disc_done) - return; - /* Handle any events appropriately. */ - if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE) { + if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) { ret = cros_typec_handle_sop_disc(typec, port_num); - if (ret < 0) { + if (ret < 0) dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num); - return; - } - - typec->ports[port_num]->disc_done = true; + else + typec->ports[port_num]->sop_disc_done = true; } } -- 2.29.1.341.ge80a0c044ae-goog