Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2390755lqt; Mon, 22 Apr 2024 09:22:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6IEaK7bquFRVxEO7U6UtCUL8ObYyKLFzfUXa70nNxfL/fIXcnmT7C0FXfGcf0SKa4A0BamvCkWIKJzN7XwJnP8Fgc/luIYIAoc/6+AA== X-Google-Smtp-Source: AGHT+IE9zKGrB+naPk87EWHw7BZvtdt91aS3AdOes/RwpUVr8lZHmyVPp+9qh3AR3nDVL1mtxcwt X-Received: by 2002:a05:6a20:ce44:b0:1ac:e0fa:fb24 with SMTP id id4-20020a056a20ce4400b001ace0fafb24mr8488927pzb.29.1713802953346; Mon, 22 Apr 2024 09:22:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713802953; cv=pass; d=google.com; s=arc-20160816; b=i0c7sNlf/uok/BgOHx5uHCAuIE29LWr7eRj3niEo5cA+GbGF2w7m6J2+IWimLffqN9 mqGBve9ls4clsHhpj8b0OIeqNBpR7Wda3bEL2ZVvLVRdSt2vYzLSxGNQAVEk9SemHxMu kfeQ8wndDd7cCKQ7TS+F5TPb4DGkdvEljxDtfnYeIgY0CqTrUGLoKWMYo4GUfk8UO6Nl DHHD6ldNfWq6Qs7Uhn8E19pRPimACSqd83dtJp1amf/rxYjAhXTCdSAZjvE2llXBijAh sQx4QwP4wffo7frW6Q/21CA5yBKYyl2SINucJdjU7XWLTIw0pmMLGbTS5aHVGesmubVH RZUQ== 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=C5ajAwb9MkbB75oyq3cp3cCezFAf8gCMYw+m2bYrmOo=; fh=IgDv2fqL49gOboXXzCXMN0XID3/S4C2lxLde4mXZeek=; b=z6iYUKtkqlyp45SaNULYeIr9B9NAsqA55Bg13OoVEuoo+2Mkk/r565cYK94HSNjexD w20T4S1EHY89vAfaiRC3OhsfnTE7wIJSnFuvL10pUuRT9pbmvmjRHDzNpEKFHKjj1WiK wIzl4E+OcdVP8z59sGfAS+sPp2K8oeVoo1IRz3+I5ehaamrU9JDJCuTT79r8HIKRIJA3 I8R2n3IRAasLXizGBmdxBHTSiewtMe18mFo6rCwouNTXhHlYzx1LAVqcZyzUZ/VZI5Df q+RluEqVhmJqKL3d+OizqEbn574mQ9q4qq9Ku8lpzX1EzY5+0vPwSYmL1hIrMtiU9ffk Iofw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hmbiw8g4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153359-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x21-20020a63db55000000b005d576171e69si8007958pgi.88.2024.04.22.09.22.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153359-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hmbiw8g4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153359-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153359-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3F8C0283BDE for ; Mon, 22 Apr 2024 12:45:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73EF914F9DE; Mon, 22 Apr 2024 12:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hmbiw8g4" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 00B2A149C6C; Mon, 22 Apr 2024 12:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713789671; cv=none; b=rkYYL4lLajNU/6jSWtH7n/LHiNjGmkLJnL+gg0OrAHMxaCnLPydZu9+Otvq0GvHdvtdPdEla2Uw3ayxCdUESlxLh/oq08v1FKU14ASz8k3ADS/kNnzWGrDLyR4cI517VQMAvxwBKT54FcNIjA8yJ2EMvXU5t2zsOwMyCNdkm01o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713789671; c=relaxed/simple; bh=q1rjbjWEjU6oynrB5uWmbFr73fQnIPng6LYdBHmm2KQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pmgtqLY49QNDBeO4ucAXVQDJqIRUyH0JuxtpW3FaY0W7fdws7ew4fnzWmlq3vHCMsv+wpAmjxfTSlJZXdnFpgsQJkwHlB3rQ0aKO14zlbCiz5KehSCFbwdCqjsRwARvBxZfDYPn/oVwMwJBZpjmOzH8C+bJMgUm3aHH1XnHPnL4= 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=hmbiw8g4; arc=none smtp.client-ip=198.175.65.20 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=1713789670; x=1745325670; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=q1rjbjWEjU6oynrB5uWmbFr73fQnIPng6LYdBHmm2KQ=; b=hmbiw8g4I5Lg5V01lgGhvg8D3zChd7OyFDKT1/1EDYHGqSuXFLEEsuKt iOxcGYYSFbydl+OKjxrX2bALu7fpQyv8IavxMIiZfjUCqyagoRJ7XndBd xmHUF55MhdZ9ItYg+Zq3g5YD0h+jvhLgK0SFe0PEcTU9BdSEJv73izBsy sV1Kv6ya/RPGXEIu+V9td91johdNJJy2MIBu+oRK7B/fRLG+3yS0vtc6b eNYLOftL61Xs+2Bx8GVl/Ozw8FATHpLwFpbi+n5UcUIk1MywpHawdgEGK ueJRMx3/e+M68XZgV76xOc6ND15H5OgxCRnncJ6X7X1CISGX39NcOfdB+ A==; X-CSE-ConnectionGUID: teyZ3cwnTgygo5+CcO3/iQ== X-CSE-MsgGUID: 6kwfZQVXQFCbLrNjz8YfZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11051"; a="9151097" X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="9151097" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 05:41:09 -0700 X-CSE-ConnectionGUID: 81KViA8hTvS2wGu5G1sxCw== X-CSE-MsgGUID: /Q6cBKUESam2m5pyi7hn6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="61455544" Received: from kuha.fi.intel.com ([10.237.72.185]) by orviesa001.jf.intel.com with SMTP; 22 Apr 2024 05:41:05 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 22 Apr 2024 15:41:03 +0300 Date: Mon, 22 Apr 2024 15:41:03 +0300 From: Heikki Krogerus To: Jameson Thies Cc: linux-usb@vger.kernel.org, pmalani@chromium.org, bleung@google.com, abhishekpandit@chromium.org, andersson@kernel.org, dmitry.baryshkov@linaro.org, fabrice.gasnier@foss.st.com, gregkh@linuxfoundation.org, hdegoede@redhat.com, neil.armstrong@linaro.org, rajaram.regupathy@intel.com, saranya.gopal@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 4/4] usb: typec: ucsi: Always set number of alternate modes Message-ID: References: <20240419211650.2657096-1-jthies@google.com> <20240419211650.2657096-5-jthies@google.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: <20240419211650.2657096-5-jthies@google.com> On Fri, Apr 19, 2024 at 09:16:50PM +0000, Jameson Thies wrote: > Providing the number of known alternate modes allows user space to > determine when device registration has completed. Always register a > number of known alternate modes for the partner and cable plug, even > when the number of supported alternate modes is 0. > > Signed-off-by: Jameson Thies Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/ucsi/ucsi.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > index cd4c3b7a5d989..ea76d42fd1504 100644 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@ -812,10 +812,11 @@ static int ucsi_check_altmodes(struct ucsi_connector *con) > /* Ignoring the errors in this case. */ > if (con->partner_altmode[0]) { > num_partner_am = ucsi_get_num_altmode(con->partner_altmode); > - if (num_partner_am > 0) > - typec_partner_set_num_altmodes(con->partner, num_partner_am); > + typec_partner_set_num_altmodes(con->partner, num_partner_am); > ucsi_altmode_update_active(con); > return 0; > + } else { > + typec_partner_set_num_altmodes(con->partner, 0); > } > > return ret; > @@ -1138,7 +1139,7 @@ static int ucsi_check_connection(struct ucsi_connector *con) > static int ucsi_check_cable(struct ucsi_connector *con) > { > u64 command; > - int ret; > + int ret, num_plug_am; > > if (con->cable) > return 0; > @@ -1172,6 +1173,13 @@ static int ucsi_check_cable(struct ucsi_connector *con) > return ret; > } > > + if (con->plug_altmode[0]) { > + num_plug_am = ucsi_get_num_altmode(con->plug_altmode); > + typec_plug_set_num_altmodes(con->plug, num_plug_am); > + } else { > + typec_plug_set_num_altmodes(con->plug, 0); > + } > + > return 0; > } > > -- > 2.44.0.769.g3c40516874-goog -- heikki