From patchwork Sat Feb 17 16:20:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 202652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp400971dyc; Sat, 17 Feb 2024 08:21:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjm45CVSw5ZrX4nfP+kIm7+8JSNA8BWj1taLAC2okEOKIOzKdAWBgk3S8PZckqgJRM0qExFX9jJ3zV5XnBRK+xnM2G9Q== X-Google-Smtp-Source: AGHT+IFOCofzw5Dul8a/fP0NKH/BpYQzW8G407XkuPCGTfKombaBp5h32io4WVmtWxp13JHBbLOY X-Received: by 2002:a17:90a:d157:b0:299:64d8:10ef with SMTP id t23-20020a17090ad15700b0029964d810efmr785338pjw.10.1708186869662; Sat, 17 Feb 2024 08:21:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708186869; cv=pass; d=google.com; s=arc-20160816; b=Z6ejWqvn3Nwb4IflQxZt6cxEEvi5j4+uWshGpuEcQ6TGuDffZT03/Bce+DANjGZFE6 AtzYKPvQHdjtTzTAf6DoJ9/1qpgI3a4sLaylOOqW44jmXTd5GOciTvyo/uArufOmUVbM w3hGcT/pd8WggfsBng/xNbMobGujAZuPY0l0ri2yo8KEfV5cbIYC4OURORTcdjfKaTfn KvFmiK8itt6iEy6XOUcqYxKHZ/pm8Y4VLUoyWCa0QSAJPwabA8HL2M/G2y7hRtSQtCWe 2ROmHTYxG66BUrJyUujeq6VeHiKf+7YiVaOn+nFW3K9xeYzeX3NDfzJlCXB8IKtRzocK 8IpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Ktz6i/za41cvkwmuQyDtNPqBUzDObsW3KNMD+itm7S8=; fh=3dQNwn039l7SBmjN3IpVoEGvm0wZOU7rWtAO11UOEng=; b=t18fspTh7yyU1euLI/Itz7pGDBUswPjJhYfwz7Q+GZhtKi1ogudtchC3kHiZBJG1mi 90rzpy7UxR8i+zbr//Fa1D0oJrucJJL5ViKecj7fGwI5OyXuVMhj/3jTKjB2eyKWcuM8 IPwU4Xa9YcdBroMjfEgSyJIjmOB9CD8RJyYyZWr5uI+CMZC1uSkhqFvw+F9UzgKBtnw7 qdCxqNmFdd/QlQnDjrijPbi5vMpvAHUxsN2BpXQUesGLWfzMU0u2XL3u5chHcaeC+udG ThtRZbMF8no94HACcT1XMTK7QS0VUVrrtHzS/419hxAE16QqPGJuluNS575P+NmLE8dC VpmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=YIfeNqHX; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-69961-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69961-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bx7-20020a17090af48700b0029901e7381dsi1757934pjb.135.2024.02.17.08.21.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 08:21:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69961-ouuuleilei=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=@xff.cz header.s=mail header.b=YIfeNqHX; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-69961-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69961-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz 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 7BDCF282D19 for ; Sat, 17 Feb 2024 16:21:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 083377D408; Sat, 17 Feb 2024 16:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="YIfeNqHX" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (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 23C477CF0C; Sat, 17 Feb 2024 16:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708186840; cv=none; b=gprqEi4BxBuM8eCV4svnRnSe/ZE7Iv8pzplW0xRGSIfYxKhMNty3Jeio+5i9/Kgqn42mmDyJeFdM5qNQ9FsC7IdBD5OrP+h06ekt/P0Evf4N1YvYXk/zvNmB9+jli0nAwe0tPLd0evifIdGN6cfWKuCQcwGA1O+p86KGEwuyLdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708186840; c=relaxed/simple; bh=RMZ/XWlCqeCx+75CqNA5sIFLnWQchRr9VYsbdrIqm8Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mjQ336eqUlcQ74ZJkAd4r1xeVRA0YdgM7vUO0FT/E2dbi41m6c+EOG4YvyQM+RH/4/ACVOpzEwCFBjGxoaSqYEjRexVGaVqqAQ1VxOdgQZc7w3ZmvRx6nuCKJuYTVoFpAJHn8roXRTi/9vWKgmYi+q5/CZb7Y6lNiMcRWG/n5Os= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=YIfeNqHX; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1708186834; bh=RMZ/XWlCqeCx+75CqNA5sIFLnWQchRr9VYsbdrIqm8Y=; h=From:To:Cc:Subject:Date:From; b=YIfeNqHXk/5q7NU9A7y1Pv7CWXn4HoF6uIM+QUJCPS7MOGeWDPu1MWi2QquItbGob bzmUlzFCCggh4tMNC9HUo+6w+T8Ji7+utFe46Dci8cYJYCDfG5FWAMe7qBJUfb9w8c SsxGtHLv0Z92T7GIfvSaSnP7TBw2dvZa6FNs3Y54= From: =?utf-8?q?Ond=C5=99ej_Jirman?= To: linux-kernel@vger.kernel.org Cc: Ondrej Jirman , stable@vger.kernel.org, Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman , Xu Yang , linux-usb@vger.kernel.org (open list:USB TYPEC PORT CONTROLLER DRIVERS) Subject: [PATCH] Revert "usb: typec: tcpm: reset counter when enter into unattached state after try role" Date: Sat, 17 Feb 2024 17:20:21 +0100 Message-ID: <20240217162023.1719738-1-megi@xff.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791163754776714057 X-GMAIL-MSGID: 1791163754776714057 From: Ondrej Jirman The reverted commit makes the state machine only ever go from SRC_ATTACH_WAIT to SNK_TRY in endless loop when toggling. After revert it goes to SRC_ATTACHED after initially trying SNK_TRY earlier, as it should for toggling to ever detect the power source mode and the port is again able to provide power to attached power sinks. This reverts commit 2d6d80127006ae3da26b1f21a65eccf957f2d1e5. Cc: stable@vger.kernel.org Fixes: 2d6d80127006 ("usb: typec: tcpm: reset counter when enter into unattached state after try role") Signed-of-by: Ondrej Jirman Acked-by: Heikki Krogerus --- drivers/usb/typec/tcpm/tcpm.c | 3 --- 1 file changed, 3 deletions(-) See https://lore.kernel.org/all/odggrbbgjpardze76qiv57mw6tllisyu5sbrta37iadjzwamcv@qr3ubwnlzqqt/ for more. diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index f7d7daa60c8d..295ae7eb912c 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3743,9 +3743,6 @@ static void tcpm_detach(struct tcpm_port *port) if (tcpm_port_is_disconnected(port)) port->hard_reset_count = 0; - port->try_src_count = 0; - port->try_snk_count = 0; - if (!port->attached) return;