Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1354237lqt; Wed, 20 Mar 2024 00:49:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfcq6DxcY4XRhM+heRHxyCgS+AXIYb6Se+huZcT0G67jr8gR0nQhkGnCHml1Jq273Am+e17BXZjmN+3kIKrhDVlsmJAejpAnm/ivsznA== X-Google-Smtp-Source: AGHT+IG7KdVpBl8lUG6QSjKNwRg/ZF1/5szudG8bIyQX0YDVBC/g2ei9l4mv6JYy6xlttm0p25wi X-Received: by 2002:a05:6808:1b25:b0:3c3:9949:45b3 with SMTP id bx37-20020a0568081b2500b003c3994945b3mr3628738oib.54.1710920978108; Wed, 20 Mar 2024 00:49:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710920977; cv=pass; d=google.com; s=arc-20160816; b=VbAPOHs3JSCHxjIi9yOVX/IsJPNah8+qg5b2pq71yBztHBmUeCUwCzDLaG1+fwyme3 zIZfUUyrwCwmKu5yoC5SSS7APM8DZdx1DYsxaRVsaHuRN6Y/lVhYELPEBSsnQngzg1WN IJJ+Mb1pF+dBoQQlql2xQPyiU9UhuSm6nELpFxbFXA3CKrtorasR4pcqO2aKWwYTMVFJ dP0KR8gKxZ8jmlyB5LzWYgCeTNXe7KMRq7nukcH+ak9nMTs4bessLT2Qezv3IhLfvmHa 4rRrRqbFHkB8tg9m5sXfpm5FaEELM0IFGQigTC3VsuDa0uT3acGgrxBCHMzhZ8hsCbBE beKw== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7zIiV9Gi7HkAylK5w2pgQPy2qSSlmDOJ73i7ZS4lfaA=; fh=t7qge2pgQ1KGYNFJFP5O5P99eTkxe/9M9cwHlxSyYyw=; b=C7E4cOm1u9vfr0LHG4es2g1mTpIH3fsi0myADWbBdtBZ48XJ5QkrrW+WqfhBHeHYSQ WnJ+bBgActh0Zw+QsU5g0+DH7+oX3mA/ItNIx7vxQ2D2KWrMv6hpIEN/8+5Ua9UN8cnF Q+QKlHkgOzUsdAj0BlS8koAPAYn9x/OT8P8aLwk7G4Z1xzndoKdMPXuSl6RvR3OsfF41 XXg0UjmGP2zU/3rqufmjdg3KrkfKSXQdmQKPA9v/lRuoooGO4jKH3W7ivK1u+ixLYmbT MgEWMSk+EgjtNyVePlB/YbrZ8JmnI/wwVCHpW4Cv1qQsRRyzgevrgs38+ZHp43tSqCaq bTOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=c--e.de); spf=pass (google.com: domain of linux-kernel+bounces-108571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108571-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 28-20020a63185c000000b005dbe2220330si11747329pgy.171.2024.03.20.00.49.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:49:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108571-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; arc=pass (i=1 spf=pass spfdomain=c--e.de); spf=pass (google.com: domain of linux-kernel+bounces-108571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108571-linux.lists.archive=gmail.com@vger.kernel.org" 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 1EE9EB22FD3 for ; Wed, 20 Mar 2024 07:49:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 206BB374DB; Wed, 20 Mar 2024 07:48:40 +0000 (UTC) Received: from cae.in-ulm.de (cae.in-ulm.de [217.10.14.231]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E313C22F07; Wed, 20 Mar 2024 07:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.14.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920919; cv=none; b=qAhiOCELr0b9l7frhWRYKJDsukzS4+bAaMHOkOwj0DBBSTrEfwO7jmQCPFJTNd+PUCa7mEXRk3RtAHSqSgJdHv0j3nVhAmr8HAEdkyz3JQLOsOML16AF9NXhfWU+QDM314xBcXTG2fWQZ0+YpfL8A3w3PSGkHRU+DyKAVO2sGJk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920919; c=relaxed/simple; bh=mdgMqfsJqx6yP6KG7NUVhitkX5wgR7Ijn/LGX47PJFA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qE14jRNUQrh9+Fgj2FZk3+Tgp/fqNugibF+bx7VRmIJ5DAUpVHKomBGSiTIV0qFP8jWXZ87gmNMs/ID12hkpqqZX6Azk7Soknzf24ot8ibtXw5YyLPxrs9D43S+FjIzZU2S/3tl+Cf3x0S9mBmhYw0Tgzi04Uy3s0IeOp0CjppY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de; spf=pass smtp.mailfrom=c--e.de; arc=none smtp.client-ip=217.10.14.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=c--e.de Received: by cae.in-ulm.de (Postfix, from userid 1000) id BE028140583; Wed, 20 Mar 2024 08:40:06 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org Cc: "Christian A. Ehrhardt" , Heikki Krogerus , Greg Kroah-Hartman , Prashant Malani , Jameson Thies , Abhishek Pandit-Subedi , Neil Armstrong , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Samuel=20=C4=8Cavoj?= , linux-usb@vger.kernel.org, Kenneth Crudup Subject: [PATCH 2/5] usb: typec: ucsi: Check for notifications after init Date: Wed, 20 Mar 2024 08:39:23 +0100 Message-Id: <20240320073927.1641788-3-lk@c--e.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240320073927.1641788-1-lk@c--e.de> References: <20240320073927.1641788-1-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-Transfer-Encoding: 8bit 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 --- 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