From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C60C01917CD for ; Sat, 6 Jun 2026 02:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780712327; cv=none; b=QEx0Mz5PdYoPrFv9LsFx4mYeWppzHGbwQlb8bJB5Xs6nJlNDMkoE9sPURvV+aY9Vj9BOVxIlRR23di+RVCMX/VeHSjkH+75PYuXNQbTZ8XzFY4hDAcVEa5aw7wTCEKg7ihhCfxVUX0o7HUiE8idwiDiCMWJh2Egvg3b51RLLnBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780712327; c=relaxed/simple; bh=ir4WgsxJ5h2ML8Xh5593bTcRgdDCjYkI0c/6fBPGCS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kk+5kCoSJ7YGwcnknN/hbelWHssH7z92JM3e0y8BTZ5Auzwdz8YzbZrQdqNh0F47f96arHj+RfoiSmGz/J3AJPrGk/DTQclSxt4dUk/xDpVS8eLYhNG76ZjjCvTjXZYZ9c5gJXGDqlZMfcpXL2u366LNs9cw/pBR49tdPwGL/fE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eIQKs218; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eIQKs218" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEB671F00893; Sat, 6 Jun 2026 02:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780712326; bh=WtcgCHQP36SHY76cpd02fcPiziLrHvN3/sgjm0rVJNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eIQKs218ZiTzplXScRkO514XHsuFonbbKQ5zsBMe8nZHZi1vNCVPHJ3RrhY9JCkrz AO5twJl8J6us70z6qYs/W7IvgZuyY2fefP0ycyaQgTE6A8/xkjgJkYIVEcwUXsRZNk Un0z/DydAivp7hEBvPrctqFdG2qDZps6Zr2lfYtGR4rY2ZVhv1jcpQ3+scn3UnGRGE PbpYnA3PENmf+AaaxIK2KXXT98hMAkgYDBsUVsKbLDMPAg9GeSvQY2ReaPB6/5Qu7E gha6RiQ/2QADnNuIBlSxzLtHF0Ly4WbNWQctMKtDmTQzkHpw9vTEtWobLgDWypNHCD DwiXPzGEw9iiA== From: Sasha Levin To: stable@vger.kernel.org Cc: Myrrh Periwinkle , stable , Sergey Senozhatsky , Heikki Krogerus , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 5.10.y] usb: typec: ucsi: Check if power role change actually happened before handling Date: Fri, 5 Jun 2026 22:18:44 -0400 Message-ID: <20260606021844.2487798-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026060419-refold-strategic-2d2c@gregkh> References: <2026060419-refold-strategic-2d2c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Myrrh Periwinkle [ Upstream commit b80e7d34c7ea6a564525119d6138fbb577a23dba ] The CrOS EC may send a connector status change event with the power direction changed flag set even if the power direction hasn't actually changed after initiating a SET_PDR command internally [1]. In practice this happens on every system suspend due to other changes performed by the EC [2][3][4], causing suspend to fail. Fix this by checking if the power role change actually happened before handling it. [1]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=1689;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794 [2]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=3923;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794 [3]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=5094;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794 [4]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=2229;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794 Cc: stable Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change") Signed-off-by: Myrrh Periwinkle Reported-and-tested-by: Sergey Senozhatsky Reviewed-by: Heikki Krogerus Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-1-6f1239535187@qtmlabs.xyz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 60339c74669417..853a1a847a0c9c 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -656,7 +656,7 @@ static void ucsi_handle_connector_change(struct work_struct *work) struct ucsi *ucsi = con->ucsi; struct ucsi_connector_status pre_ack_status; struct ucsi_connector_status post_ack_status; - enum typec_role role; + enum typec_role role, prev_role; u16 inferred_changes; u16 changed_flags; u64 command; @@ -692,6 +692,8 @@ static void ucsi_handle_connector_change(struct work_struct *work) * short transitional changes. */ + prev_role = !!(con->status.flags & UCSI_CONSTAT_PWR_DIR); + /* 1. First UCSI_GET_CONNECTOR_STATUS */ command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num); ret = ucsi_send_command(ucsi, command, &pre_ack_status, @@ -769,7 +771,8 @@ static void ucsi_handle_connector_change(struct work_struct *work) ucsi_port_psy_changed(con); } - if (con->status.change & UCSI_CONSTAT_POWER_DIR_CHANGE) { + if ((con->status.change & UCSI_CONSTAT_POWER_DIR_CHANGE) && + role != prev_role) { typec_set_pwr_role(con->port, role); /* Complete pending power role swap */ -- 2.53.0