Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2953100lqp; Mon, 25 Mar 2024 14:20:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUe60PcUTScgMYp8pOtKA5PPJcpSKdEfgLKqLCIGoGPNvPGFj0aG4AK0pHnfGeRwmK1dzWy3BWCjBSe4HT2WLdxCBnyGZcQ12u18rQx+Q== X-Google-Smtp-Source: AGHT+IHJDkThyrPxzpIZPUsL7s9l671c0nhvlIMxk8R7rmdO887jrakJ2feT8s/T5CGRD18UmSdi X-Received: by 2002:a17:902:f683:b0:1de:fe77:41e0 with SMTP id l3-20020a170902f68300b001defe7741e0mr10770995plg.64.1711401638186; Mon, 25 Mar 2024 14:20:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711401638; cv=pass; d=google.com; s=arc-20160816; b=wGCCWlNcD1nXyMCWOzizh5zfcV3mDf80CIu/LPqt8OiOxeslI+fjyhwsQF0xXrYF1O yrFpqHejDe4bcw93XQyJNSZ6Mcgk8Z9ycK2i8k2phT7wNMTQfyp6XXlJ/wrTQC7tQKA9 C1b7TJr/XtqJTs3VW6lqcolQO23EMtTBffOcvCSU2ebtPPoM/2wDIc33uUJlZbiYBKyt pE7RVVSvM6+WjCGZobx8gKOYQkSUvxSQ/PBXTYEXukuT5kE+g6KufFC0hBtj8NWSrNCD Okb5Ben9Wx+h5igovbhKrBfR0uENarxe07Ibts4KjAHGTEcSzi43rgm7AzB6vOpqWAcN XrqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=IWkKtqlB2IYpNkVz6EWQgOv/DTm4sZRBKwumKBADUJY=; fh=aKKjcy8MOKinIsP9xanY5+/jHBSoq2mjvzPm6vJZPbY=; b=RoDg0jSTy9707Jd3pjZj8LbhIIN2jpjwVaMGORScqX+szU/VxF10gpT/9ueeN1zzkc 6c1itZU608d3SoT+dTbRBYwyn9u78j5weUdqwEYQmriIhR0rdBIMOJGjUmHdfiOREcfN inU2l2H/PglxqSn7HbAGWfnSAjykiAbrd6TL+Is6Y7JgDnFD6aITjcJqCER7Ko7dpv4s 9ZHOq83XLvTCsKWvdwlxokrpnXgDnJNla0CthbzA/MxlWdtkuvBg3yL5UK4LgAit/2yi StlC4dyDi4YGWwBWy5T748RiTzr0ziXXUCXL+4JQGvsiBO0bzj+eravhiUd+6JJVuWgw n7Xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KsJmHKED; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-118028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w14-20020a170902e88e00b001dcee30de72si5250982plg.616.2024.03.25.14.20.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 14:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KsJmHKED; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-118028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D5CEF2E3D61 for ; Mon, 25 Mar 2024 21:20:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 403DC71733; Mon, 25 Mar 2024 21:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KsJmHKED" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04C6E7173A for ; Mon, 25 Mar 2024 21:19:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711401591; cv=none; b=qzoEJGu99x7AcxAJLEdUzGgTf/pzjB0EPxpgCzdAh+9QBFir0t9i0LmZ//5W8SVI6agcy6QUvpOB1yK+B8kGXBAAn8WFPhvoh4+PqkzYJlf6GAYFa2SFePGErRbRdgKGWjpLHpgA0Osn/O8PmtoboDiPVyyIQpOWisQ8Jxfg628= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711401591; c=relaxed/simple; bh=ppMvWVev0cLIJM7WJ4IVef/LN8AiezVVGMMPIfD8CQU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=DGfxKfCWWr9jRiY8pgkv1Cq9XK1pBZhgJJrB12sR9zLxYlmJdKf8SAL//RxvbyubYuvQPbbgscbsPl442rzoF02rQzJQhKEDmo5muFLf81IEtr8KJPkwyuHkaz5BlhEPmEsgTx1OQX/MByJI2/pXV1vg9pjxPn+KGTUm9isZgdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KsJmHKED; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6e6afb754fcso4268063b3a.3 for ; Mon, 25 Mar 2024 14:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1711401589; x=1712006389; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=IWkKtqlB2IYpNkVz6EWQgOv/DTm4sZRBKwumKBADUJY=; b=KsJmHKEDmlarbQ4DTOv3j9DNvkgyDGMBh0ZuauXXw3XHR8PdtZ+QID1uwIj3DhWzbD AeKMb2bptOdrqE1eWLR7sfiP32BxYOjQcJkODyQ5CSq403Kvgl2Td3UHIrVuXXRguGUm sbrzrbANJsikyJPwQnTpYuAqjx6oQu4JopLmM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711401589; x=1712006389; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IWkKtqlB2IYpNkVz6EWQgOv/DTm4sZRBKwumKBADUJY=; b=WIO+PLSWS5ilNxjobGdIZfA+Bbg3sTJ3mOjyMAxm8psx1auz/7xqQ/zyuHCtXDXs1y UOa989eE/Y7Dc4o6pcCwUPQcpG7rceKge76hThgFWpgyfU0kWxxMb3Z38chVtfCQWyWS pUhJFNZ/a8a0FroPcK+uR81RM/OQcvWsj2VawQcV+KSAkDMqBFjapF0P1aYOo345duvd 3tX+xYb51V+NeGoQvyWFADSv+zLkZ6KcAszOrudpXbaY3JZSe0NcNRPrjJfAlYbKPgbd YVv7HU25Dw/bFUZyv7h1Xxgqp2hBNs1DvqZAsObx8IXfZmyL/LAp0Q144cwH2NXzbf1h T08Q== X-Forwarded-Encrypted: i=1; AJvYcCWKULwPWKCkdY0DoHwhO3BzEiZNVDZv9ZHlcc67u/TmviqEv9Gc+HQvcdeVvtJEYou4TWtBJM3sOylX/NyXxOWBEbNiUIhPh8hKvz+v X-Gm-Message-State: AOJu0Yyp0RcDY2exdYhX+etFjGrMeALYeSU9uTFoMQatZ/4hLBYZhqFm LDWfGonA8aYDy7UCmFa8/0tXdq9ljiO9qmZhOq/uhfZsJbdCdJpxKiSsdXolApY3sYrnZtxhFvp msA== X-Received: by 2002:a05:6a20:9585:b0:1a3:bc78:fd1 with SMTP id iu5-20020a056a20958500b001a3bc780fd1mr9199760pzb.59.1711401589029; Mon, 25 Mar 2024 14:19:49 -0700 (PDT) Received: from pholla1.c.googlers.com (210.73.125.34.bc.googleusercontent.com. [34.125.73.210]) by smtp.gmail.com with ESMTPSA id r17-20020aa79ed1000000b006eaada3860dsm1851656pfq.200.2024.03.25.14.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 14:19:48 -0700 (PDT) From: Pavan Holla Date: Mon, 25 Mar 2024 21:19:43 +0000 Subject: [PATCH] usb: typec: ucsi: Wait 20ms before retrying reset Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240325-ucsi-reset-delay-v1-1-d9e183e0f1e6@chromium.org> X-B4-Tracking: v=1; b=H4sIAG7qAWYC/x3MQQ5AMBBA0avIrE1SpSSuIhalUyYRpIOQxt01l m/xfwShwCTQZhECXSy8rQlFnsE423UiZJcMWulKldrgOQpjIKEDHS32wcH5uil0ZYx3kLI9kOf 7X3b9+37ptv4VYgAAAA== To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Abhishek Pandit-Subedi , Pavan Holla X-Mailer: b4 0.12.4 The PPM might take time to process reset. Allow 20ms for the reset to complete before issuing another reset. Signed-off-by: Pavan Holla --- There is a 20ms delay for a reset retry to complete. However, the first reset attempt is expected to complete immediately after an async write of the reset command. This patch adds 20ms between the async write and the CCI read that expects the reset to be complete. The additional delay also allows the PPM to settle after the first reset, which seems to be the intention behind the original 20ms delay ( kernel v4.14 has a comment regarding the same ) --- drivers/usb/typec/ucsi/ucsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index cf52cb34d285..6b642c4c58b7 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1280,6 +1280,9 @@ static int ucsi_reset_ppm(struct ucsi *ucsi) goto out; } + /* Give the PPM time to reset and stabilize */ + msleep(20); + ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); if (ret) goto out; @@ -1293,7 +1296,6 @@ static int ucsi_reset_ppm(struct ucsi *ucsi) goto out; } - msleep(20); } while (!(cci & UCSI_CCI_RESET_COMPLETE)); out: --- base-commit: 4cece764965020c22cff7665b18a012006359095 change-id: 20240325-ucsi-reset-delay-bdf6712455fd Best regards, -- Pavan Holla