Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp45759lqb; Thu, 23 May 2024 10:17:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZLXx1anLVX5QyUDQNUwyBgNeqqXuj7+0CYHogl3rVz9S1C9Xbk30BDJRzlxSfxHWnUAR8KfFbnIjg4oSOtqKSrLjnYRdxk9VNnJdXmA== X-Google-Smtp-Source: AGHT+IEYNs7azkzHOZ3KrEXiS+UVNJn+PqFsQEgkFaTdf9aqOIcBL9cliVZvnGB25PU42D0ikIrP X-Received: by 2002:a17:902:e2c2:b0:1f3:892:5f7e with SMTP id d9443c01a7336-1f31c976cecmr46684215ad.15.1716484662688; Thu, 23 May 2024 10:17:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716484662; cv=pass; d=google.com; s=arc-20160816; b=yEogjFycq30t6qMzk1Jz72G2WG+Ip7XHYCvFsGHhI642ei3Bc6Z6dHkG/shZgDyv+B 8V3yAXGzoDhNN3yUrwbdNZAXw+7S7P72tWQsOpEcQs5qDdT45bXhdD9vXgwSShfnv83G GuiaDr/eHBoBskNEvv7t/GfuqyXrs9sPsSNAh3Di28B3DtMqo99/0E0gWxrSaBqpEtBA STveUtrSOCaqacMKQm3AYfAE8ppcjyBrATrhnAfby2G7R3gaYRMypyVvd5GfTgMQ4wJj TR4Pme0L8CU9d+lE/8BdLGT/8ZKfw2yel+1+sB8//xHhiVaNqDoH+V+mr1c5pObWPT2t uXkQ== 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=92VqXpGW+nndq7C/3fEiSTHTkPpKxDU8896WTzpdmf4=; fh=E0R16hPj7td+EU/fzzlGBrhHh3ap2ihkfYocwTQIwQA=; b=tKv9N3b5P5BnvmcfmOZB//gwBinCaVTbOQAiNlKkQyewQ4yi+WyxQFZP/J4+WCN6+l M28G6DkujefK3hWCq0YaLBhH0HR/ca+4LYKbZ22sHl+8XayYSAeKvjxA9mcQeZFI28bw YEXlV19NaB7Wo6sWMepnoMhwp48dt5Dz69oiLFd26F8VDN14MruhjI1oMw2w4VwcqQhh W94hkN1WPB1Bb1Ie35+XZohMS8phWrathSWQvlbN6itzRdZKKQmMiAzWADGTyJN1MPaQ TLdRf6i5hdLO8faP8FucoKfKE/Gu9YF4SP6+XDEG1LOVoEu9IpC9Q1WAAdPOs8WyPhTb k97Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nNhLrNpy; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-187826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f335eafe29si20449985ad.186.2024.05.23.10.17.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 10:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nNhLrNpy; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-187826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BFB11B212EB for ; Thu, 23 May 2024 17:17:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1B8F537FF; Thu, 23 May 2024 17:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="nNhLrNpy" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63AE5AD27; Thu, 23 May 2024 17:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716484648; cv=none; b=AY4FZ3PDiOLq84nlMWfnKJhmj5+kAyMbcwP389ILGiK3LJLC66SkS8w2jHdfM3jixTLTz0eW6yeiS5lqc1H/QAGyFTmbOPGCUeq5aRZ1cU8MNVTOdQJVhoyNnM0NX2wlj70LoOvrO8ZjkPb8N4ze8fHbDIm79LcVDVwStqRSctA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716484648; c=relaxed/simple; bh=O7RWrEm6Vj69Eur57L0pSmBb5qrZIwen6LArd8lQTA0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PcGqXkKjJOLm885ohq1HfgbX3bRyOa3ZiYzfxip2QSKOlciUoHJ3XxHg4LgWaNNpARHyptoGcFJ/hPh6F99LosXb7WYKHx0C/q+1XN1Ib+am+sZVzucZFXTD7+mSCioCTgHu3OtRDp0VB2vzdJO6FVJ0vf6eyXAeCEZSRwW6yfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=nNhLrNpy; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716484639; bh=O7RWrEm6Vj69Eur57L0pSmBb5qrZIwen6LArd8lQTA0=; h=From:To:Cc:Subject:Date:From; b=nNhLrNpy8zCYj7/QLT6c5DxITQM1hjumEGo6OLzDCD92w+CY9rcx4gReh900ES7oL C1/UtlVfxPL8yg18JDt/lzYN2HTlM230GmPhG3Y4yCFulzdvXfC3+5Wdgx0+6K0SR0 i07hJ1HCiOxAEgE13JEeG3uqrZbR+WjRKvnp1pGu32aINyDr/Bv54a2sThQu49fJxK a/b55eNclzEL/DyFUwY/c3dpA1E0hQ6oOI9Vr7EI249GS37jhL4WZiRx2xaaAY4oAJ kUOzxzt1aJTbJcC2HMikKYH3PTCUkfjdL+KI0zZua+EojWgVqC6VKFrmcty7P5yXLo WdDuKbANR5gJQ== Received: from jupiter.universe (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sre) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 122B837821B3; Thu, 23 May 2024 17:17:19 +0000 (UTC) Received: by jupiter.universe (Postfix, from userid 1000) id A550D4800C9; Thu, 23 May 2024 19:17:18 +0200 (CEST) From: Sebastian Reichel To: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Guenter Roeck , linux-kernel@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: [PATCH v1 1/1] usb: typec: tcpm: print error on hard reset Date: Thu, 23 May 2024 19:12:29 +0200 Message-ID: <20240523171645.223225-1-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A USB-C hard reset involves removing the voltage from VBUS for some time. So basically it has the same effect as removing the USB-C plug for a short moment. If the machine is powered from the USB-C port and does not have a fallback supply (e.g. a battery), this will result in a full machine reset due to power loss. Ideally we want to avoid triggering a hard reset on these boards. A non-working USB-C port is probably better than unplanned reboots. But boards with a backup supply should do the hard reset to get everything working again. In theory it would be enough to check the self_powered property, but it seems the property might not be configured consistently enough in system firmwares. So let's start with just printing an error message when a hard reset is triggered on systems we expect to be affected. This at least makes debugging issues on affected systems easier without impacting unaffected systems too much. Signed-off-by: Sebastian Reichel --- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 8a1af08f71b6..375bc84d14a2 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5185,6 +5185,8 @@ static void run_state_machine(struct tcpm_port *port) case HARD_RESET_SEND: if (port->ams != NONE_AMS) tcpm_ams_finish(port); + if (!port->self_powered && port->port_type == TYPEC_PORT_SNK) + dev_err(port->dev, "Initiating hard-reset, which might result in machine power-loss.\n"); /* * State machine will be directed to HARD_RESET_START, * thus set upcoming_state to INVALID_STATE. -- 2.43.0