From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F1958446AC; Mon, 1 Apr 2024 16:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711987723; cv=none; b=FwnvEH+vRZQDw8S1zuTDQKUAlVOxs6/xMdaXhOdt7hfXZh87R8xTy5/j1Lnyu409UECp5kLH1kej4pBy7pJaS/D3CWlvGb6fZxcG7amKmWTaHgbD5R6kFbESMXH+B59eh0Q7BWcgNen6TNVxyclWNGJM0bngIIBNM7gdLOstaTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711987723; c=relaxed/simple; bh=k2QJ5pQJYX29Tx3aQVRdlFkSWJQQp35czrOAZS9C2IA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lUaQoYiHPbvPLkXaWlVNEU3g5WyvqOIq8tuO1Y4aECgFQpDoP2tNZpozxoq1YUoxw54jyYjT5S+TTNAQVV3efdSk1nlt+YfYQdw5hv9jQQ/IADuKePEvsTQ2uxOamak0+dSL0ixf7tW7WJM227n7uTBCctXS1/nCuXOEA6yne/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NobWLt3W; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NobWLt3W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67028C433C7; Mon, 1 Apr 2024 16:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711987722; bh=k2QJ5pQJYX29Tx3aQVRdlFkSWJQQp35czrOAZS9C2IA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NobWLt3Wd8OTKGtMg9IIuDgt2F0K8+Tyq+dqsQgxoQS+RmLheXOreWQXp0qNt++sf QktJhlAbZr5dyzshz1p1myNSRCPFEwfs53XruxsCifdCWoUQ5ND/XdMbP96/Hug47c 7YGa88NoKbyrcuylBoBEf9orVtqp/HIFEU2QswKs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Christian A. Ehrhardt" , Heikki Krogerus , Neil Armstrong Subject: [PATCH 6.8 373/399] usb: typec: ucsi: Check for notifications after init Date: Mon, 1 Apr 2024 17:45:39 +0200 Message-ID: <20240401152600.313171411@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152549.131030308@linuxfoundation.org> References: <20240401152549.131030308@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian A. Ehrhardt commit 808a8b9e0b87bbc72bcc1f7ddfe5d04746e7ce56 upstream. 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 Tested-by: Neil Armstrong # on SM8550-QRD Link: https://lore.kernel.org/r/20240320073927.1641788-3-lk@c--e.de Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -958,7 +958,7 @@ void ucsi_connector_change(struct ucsi * 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; } @@ -1355,6 +1355,7 @@ static int ucsi_init(struct ucsi *ucsi) { struct ucsi_connector *con, *connector; u64 command, ntfy; + u32 cci; int ret; int i; @@ -1407,6 +1408,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: