Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp425726lqh; Fri, 31 May 2024 05:55:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUErEgZ0fA4HUz+/yOt0+icbOtR+jKuVxDh3LSedqeqg049fg1vUBMz0O7wgeecBhfaVH1m09Io/3VFqn4ZdlnaMfZJd1tEMsNmw6C+ow== X-Google-Smtp-Source: AGHT+IGXM15iVpocJSP3icXKk+ZtXXGg8IZqod9ZaRQcJeXh1KiEXAI/cCB6s68Bbckii/9Wej0J X-Received: by 2002:a17:90b:100f:b0:2b3:28be:ddfa with SMTP id 98e67ed59e1d1-2c1dc5ba033mr1621809a91.38.1717160147148; Fri, 31 May 2024 05:55:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717160147; cv=pass; d=google.com; s=arc-20160816; b=DTC2xJMu/zg4BLg+xwQNx9ElQu4DP5OxScHIu0pcJqAbR2AIK2SfXYg5qPGXYNlcuD pS7BfJ47jjW+xXespc+ucFnP/rVXrza//EK+b49+GO7E3o/fVqVOxzccM5GUVXW4r2oD lrYL3Ml6gV9Xasi1rR76tWDCvv+MAkplHbbkVDLoDx8RAF/vaKa3V0Y+m5QoLf6ed+h1 A0eYyd2NOm/sJcBkdT5NO9BYDmebSM54I6ZJjlq1GIPt2N2S3rMN/X3rqck6bZl72Kou TWnGrG3syiqMN+WvsYl3XXut4cK+GTiS/Jh1lCIxkGA6EeKv5dmozDuMjCKkbc+5t/Qs wAcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ADoSAJ+Zih2oETkXeZhC/68ZiCYwr5uIPfiJ6Gd6SJM=; fh=m+cO00vEAPNTEslhvL2hnUt1GdZGFq6RtGPs2JjOhi0=; b=Hx+afeJj473NfVmyi2PHkauWUqDosQ1aoBjTJNCh3WNgHvWhr/ONvMLqUy2jkLO0qz 4mMONfwZFiQlP1azw+pvd051EXTicrTSANGytVUzxyjTwPzOb8lMoFwqE/a/3+xg5ZGj iFM4gUO8QSVIZ7SzF4JMn/i46pA+ws1VJafzlzXZSWyZF6+amUXBF/UGvqwNJaGhecXF Xs/bLHteNDEyij/eGXSxkO1IxVWXWNYU+2zs8ADTXfHaQv2p2FB8KCVosjCfEny5HNcz NhZw/EAlryl9RSvQ2+13sTnVtUecCqHaZS6jXZyqZJp6Uegg5JXDszYoKPOFxlCt4/kh fN1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WfoJxfGf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196501-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196501-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 98e67ed59e1d1-2c1a777ab8csi3350351a91.41.2024.05.31.05.55.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 05:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196501-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=@intel.com header.s=Intel header.b=WfoJxfGf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196501-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196501-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 11084B24B48 for ; Fri, 31 May 2024 08:48:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BE4F155C82; Fri, 31 May 2024 08:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WfoJxfGf" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 3EDDF15575F; Fri, 31 May 2024 08:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717145279; cv=none; b=U+JRggPpB2LQ0V6Gb44kqDO9pT0GsHUOSzuLhJrrnGnHwueVBHv/h1CCYatGXlP5ALfQl9oFwcdHZ+l3/9sddoSqVZHhS7ZP9/IMum8Pja7qUosEYpEsBEmIZ9x3XNdk9YoKhQtgK+MX+RzAB7WJ8jHkhL51ybp0K5O6cWaYH48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717145279; c=relaxed/simple; bh=uS5o+FWxiCvy3YjKzKRAy5N6NMJJQCv7/fpq7ul1rzI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kCeKEHiBb/Su0x8oOajoNUodeKA6gKgBg1NeO9wFh67YyYlFwQcmFen9ZG6ZXXQCwypllhnAookxY22/D+WGLao/XfmmeW/M08VptUAWTF9+qh5S4q9bvr2LVMU3xLSBnKsZx6uVk8yed3A0IYYAv8IMjF67uigDA1Us4V64XXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WfoJxfGf; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717145279; x=1748681279; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=uS5o+FWxiCvy3YjKzKRAy5N6NMJJQCv7/fpq7ul1rzI=; b=WfoJxfGfU3+KVuHfaoQXRke+gtHWiyRc4//BQ2omhv9GE2UWimNormxX GFkW3DFMct8O/y7Ct99P6SbQVlzyubJcL3PQOamTDovV1rUARgPC8asQ+ Bxpc9zDP2Q7zmWMUgRNtTJ+toG0NkXXfF5TcmPAkealZWfdCTicZ0aYJR 6nOaiS2bYWK5+flY3vaq/Z0VC422YFaJMhiJbzw2sK/vUcRjYSC+e1BW5 GtkqJjg906LZGmLO2dlAr9vqSwydOqJqRJmqp+FBWakuBi6bZV2/S2lId OIannGUPmRdzJqOz7kMJU4zdUiN+Ku3D4UCIVzQ4Ajto6t4JJXak09EtV A==; X-CSE-ConnectionGUID: Kgvqg1hIRJWRUuV9h6zsOg== X-CSE-MsgGUID: tkhWaPOpTS6o0KNlpVtnYQ== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="24800874" X-IronPort-AV: E=Sophos;i="6.08,203,1712646000"; d="scan'208";a="24800874" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 01:47:58 -0700 X-CSE-ConnectionGUID: m1xok72FQv+SEHizwj3eGA== X-CSE-MsgGUID: 3o6D9GnQRx+pphs5KaqdIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,203,1712646000"; d="scan'208";a="36581972" Received: from kuha.fi.intel.com ([10.237.72.185]) by orviesa006.jf.intel.com with SMTP; 31 May 2024 01:47:56 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 31 May 2024 11:47:54 +0300 Date: Fri, 31 May 2024 11:47:54 +0300 From: Heikki Krogerus To: Sebastian Reichel Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, Guenter Roeck , linux-kernel@vger.kernel.org, kernel@collabora.com Subject: Re: [PATCH v1 1/1] usb: typec: tcpm: print error on hard reset Message-ID: References: <20240523171645.223225-1-sebastian.reichel@collabora.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240523171645.223225-1-sebastian.reichel@collabora.com> On Thu, May 23, 2024 at 07:12:29PM +0200, Sebastian Reichel wrote: > 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 Reviewed-by: Heikki Krogerus > --- > 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 -- heikki