Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1084195lqp; Fri, 22 Mar 2024 05:21:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjSbnW1jvUqIvXDf310x20m32R7OgAQWj8CttUCtrqJHsa1zXKZwm3pCfYs2LYldb7bPVwCMJ/6Gyt51hjzNQMeY05yul78vBt7pgV/g== X-Google-Smtp-Source: AGHT+IHFJq/UVqejAm/L0O07XB6hAEcrfSFk+zpboTGUgFpyhV0low4BMFXWrX6LtzZ7jskW2hgY X-Received: by 2002:a50:c011:0:b0:566:18ba:6b80 with SMTP id r17-20020a50c011000000b0056618ba6b80mr1266706edb.31.1711110115748; Fri, 22 Mar 2024 05:21:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711110115; cv=pass; d=google.com; s=arc-20160816; b=k+t4Khbpa/diRJWDGdmSdJ28QgqmuZoxG3o6dxc+0/qGJ3sU2rT2IEEQO8OtumvOzl AGp5G6/Mc3ERt2UyghpILk8EwclHFJCe3TRjb8Gl5NtNBhsLJ/OKNR3Vi8epluQaLdZ+ YKXNIoMqoYSbUyLlk9LCKr2wH0qmzrPy+DJt1JZsbbwse9+XO2IwhEtKpg1saNu3r1zF dEgY/uG+9D1lQtTrB4ga50a2VX87IlRW0Wv13Ka4UMezqBOz75gE3LhlRYF4Kn5W2Xj/ X/TOpGtDwSuHhO2lFXtx/jbTunYp+JUP6mfFzfcnb8zeGCmVMdjXwtbU4BgMVLY4TdwP 8V5Q== 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=LeLoPfd5fIqYZkIB51WACcLHnc1Ncn/ryBGhG1VecMM=; fh=m9yuojRAs2VhzD7g4D7RnfZOLkI5smsq7Pu4jebMN0o=; b=tEd0AKy0n+udSf9V/q2+cNw/W2TYguCbiyDYzoks9ggjbPOkJmVWVJLcteafSh4M5R P3nmfl4soxrKaPaUbMMfH43hUqUAORGXCh0E6tacU7S2damDCgn3U4Kg4N03HUQf70h4 w1GjrFdTza39m4a21yDnAOreIRmeYPu26Jq87GwgK0ThXsiZ8ng2DXIQXbJK1mnmU6X6 wXjfbWQvvrH+cQAleTd/flYwoq6SDUXR7qZla9otipleVluefbF87BgH737m+ocuUcQs x97Napc4ax8+Bs0KtYSwcHWK8zmSZzyYeooXqaozfJa6jp42QJ8uKSWZIlA4xwjmXk47 vGwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eTjJqdfp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-111256-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a11-20020a05640213cb00b00568b5ce1579si872741edx.120.2024.03.22.05.21.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 05:21:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111256-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eTjJqdfp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-111256-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111256-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A458F1F248F7 for ; Fri, 22 Mar 2024 09:54:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48F0823778; Fri, 22 Mar 2024 09:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eTjJqdfp" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 7C57F224CF; Fri, 22 Mar 2024 09:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711101273; cv=none; b=GK92hRormZN485RfGmcPp6KKq2r2WLN04aV4ZySWqyVWJJIjjmi9Ag66gsmoRQgh+xv2DJRwpOOtWTVA5QzUAG/lyLnsOOF+UJbu/lh3FA48mhkEZHhCOgKbNGBd/DNG3dmHIBqk8900e0wUf2OGfHsra1xwxDdsd/XKHTwCoEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711101273; c=relaxed/simple; bh=I99OtoggqVQ+CHYuX9e5N8dwaYZ+BHkENlZwYobcauQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UTR6ie3U6Fn84YuqjfkqUN/lwmbFv+6MQFHb3XTyPn3rh6wE6QIsdpF+uLFGa1xXzwXbvbeZQckHVI5rqBQZ5Pm8EQZymszOPRU7MR5q3e8bW8qY9xUUdK8s9V6zfAL0s3eyW3qKsgatsL/BXMOtVEiBzzy0pflyclh33DsC3d4= 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=eTjJqdfp; arc=none smtp.client-ip=192.198.163.9 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=1711101270; x=1742637270; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=I99OtoggqVQ+CHYuX9e5N8dwaYZ+BHkENlZwYobcauQ=; b=eTjJqdfpGZHsYxhjZuOLeGhXH1Lb6KVeno7RwTVmMEIiMI6F4jnhenyQ A/nLcn3CkXQIS8+zbiu5WxPSX7Db9QMTY1HnLsgSh3Lgiyn/7iPCfLcFW oYkn/mtCrFYCKYK86eQJQrjcETDnFJvJTEGRFVXE/LVlPrMcnJv541KPJ TRr0PqsCmhRJAvCaNJsNCcmcHfDgkOb/njUkmFnCrW2gqw0kRx/ny4/1I NwK8Z+qkl5mGXGQs+kMaBru2kOogksMMOR8/+drP4fftZsGsB4XTzA0TH RcqbE+azLJ/foKkiPAKxopiR3a+qRpDPXUtiEd2CGtAVRzcGI75II/JPe g==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="16869416" X-IronPort-AV: E=Sophos;i="6.07,145,1708416000"; d="scan'208";a="16869416" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 02:54:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="937066506" X-IronPort-AV: E=Sophos;i="6.07,145,1708416000"; d="scan'208";a="937066506" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 22 Mar 2024 02:54:26 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 22 Mar 2024 11:54:25 +0200 Date: Fri, 22 Mar 2024 11:54:25 +0200 From: Heikki Krogerus To: "Christian A. Ehrhardt" Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Prashant Malani , Jameson Thies , Abhishek Pandit-Subedi , Neil Armstrong , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Samuel =?utf-8?B?xIxhdm9q?= , linux-usb@vger.kernel.org, Kenneth Crudup Subject: Re: [PATCH 2/5] usb: typec: ucsi: Check for notifications after init Message-ID: References: <20240320073927.1641788-1-lk@c--e.de> <20240320073927.1641788-3-lk@c--e.de> 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: <20240320073927.1641788-3-lk@c--e.de> On Wed, Mar 20, 2024 at 08:39:23AM +0100, Christian A. Ehrhardt wrote: > The completion notification for the final SET_NOTIFICATION_ENABLE > command during initialization can include a connector change > notification. However, at the time this completion notification is > processed, the ucsi struct is not ready to handle this notification. > As a result the notification is ignored and the controller > never sends an interrupt again. > > Re-check CCI for a pending connector state change after > initialization is complete. Adjust the corresponding debug > message accordingly. > > Fixes: 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask") > Cc: stable@vger.kernel.org > Signed-off-by: Christian A. Ehrhardt Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > index 8a6645ffd938..dceeed207569 100644 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@ -1237,7 +1237,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num) > struct ucsi_connector *con = &ucsi->connector[num - 1]; > > if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) { > - dev_dbg(ucsi->dev, "Bogus connector change event\n"); > + dev_dbg(ucsi->dev, "Early connector change event\n"); > return; > } > > @@ -1636,6 +1636,7 @@ static int ucsi_init(struct ucsi *ucsi) > { > struct ucsi_connector *con, *connector; > u64 command, ntfy; > + u32 cci; > int ret; > int i; > > @@ -1688,6 +1689,13 @@ static int ucsi_init(struct ucsi *ucsi) > > ucsi->connector = connector; > ucsi->ntfy = ntfy; > + > + ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); > + if (ret) > + return ret; > + if (UCSI_CCI_CONNECTOR(READ_ONCE(cci))) > + ucsi_connector_change(ucsi, cci); > + > return 0; > > err_unregister: > -- > 2.40.1 -- heikki