From nobody Tue Sep 9 11:46:23 2025 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 3FA532EBBBC; Sat, 6 Sep 2025 15:43:40 +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=1757173420; cv=none; b=avejxuMOdFXX/q/tBrdmLjHogJTJcyN539aWkiqDrtBAg70xWpbvyZLFq17fFB90lUswsD/ZzwKiNDeFl5PRgDrMULPfPTxhYbQh70ke2lyWep6FnULWebzt7u3rQOlkWaFNs3qsg8fC2f2J7xs4WbfNZHxHcDMXCtxcdtGqt5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757173420; c=relaxed/simple; bh=da0nPHLb+kjJFizEGwI7X27ZL2AoDem8fuVWASExNUk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bSrWVn9XkQgEOp960rKS56eGbLzEPjui3mac7PHB123Ptf0Nzd07HU1T/pjRFqYldQ44vsYNSo1kqCmLDM8rxQKJ7SXbfXaQ4hZxNW6qrIcRG2VMDXYxCzN0DxNJnVUoxZB6gApM4AHBTqDsyoHir299scECFeFkz1Ca+XrUixo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YtWb0fpG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YtWb0fpG" Received: by smtp.kernel.org (Postfix) with ESMTPS id 1C70DC113CF; Sat, 6 Sep 2025 15:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757173420; bh=da0nPHLb+kjJFizEGwI7X27ZL2AoDem8fuVWASExNUk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YtWb0fpGpaC5RQFl1oG57UBX04lywvgRfn7jPwrdJFTkMWs+DQhLOTMe0gqjuUotY DNtdIBxgOCis28lb+2W+fIu/SbXE0DewOHj2Nf+IoHt179LCMUfTiwRC6jMWY76wQB 4s3cDO4mFLINRHNAdlLDw+pQ9UuIDCYqgbSHgYZWIq0xccrgzyDPaHMD7sa6/tB3AU dlTYUjPdLL3gs7YUCb8cy76eeFc2tU8zN4833pn6njP4yNkWI9D2PCqThSNk0OntcV nrC1XbBmwO6X8o+cxyO24FHmH3IZ8PCH5XxLfI4MO9qRv0oFNwlVVQNX80q8q2Y78r iNmibGXZmEpyw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A5CCA1002; Sat, 6 Sep 2025 15:43:40 +0000 (UTC) From: Sven Peter Date: Sat, 06 Sep 2025 15:43:27 +0000 Subject: [PATCH v2 14/22] usb: typec: tipd: Read data status in probe and cache its value 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250906-atcphy-6-17-v2-14-52c348623ef6@kernel.org> References: <20250906-atcphy-6-17-v2-0-52c348623ef6@kernel.org> In-Reply-To: <20250906-atcphy-6-17-v2-0-52c348623ef6@kernel.org> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felipe Balbi , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Vinod Koul , Kishon Vijay Abraham I , Thinh Nguyen , Heikki Krogerus , Philipp Zabel , Frank Li , Ran Wang , Peter Chen Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, Sven Peter , Hector Martin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1479; i=sven@kernel.org; h=from:subject:message-id; bh=apIjO4uQjpk9TWGcbO53K/zBq9zHh6dxC3iJN9qbzAg=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ8aesEWvvkpfDdwbIq58dkrs5JWbO3Nq4j/uNK7eMb9P2 nWR0XT1jlIWBjEOBlkxRZbt++1Nnzx8I7h006X3MHNYmUCGMHBxCsBEzigy/C9iTP1zclKuQOgN HQa1o2vmyBk161wzFDCcO8vjY/S+gJWMDMdfcIcKb9p3e2Ko995NBRkib2UeFs6zcP9z5umx0p7 F+pwA X-Developer-Key: i=sven@kernel.org; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@kernel.org/default with auth_id=407 From: Hector Martin Just like for power status we also need to keep track of data status to be able to detect mode changes once we introduce de-bouncing for CD321x. Read it during probe and keep a cached copy of its value. Signed-off-by: Hector Martin Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus <> Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tipd/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index e6e9730ee6dacd8c1271b1d52a02da49ff248d3e..b558fc5ecbc35a9dabbf33c444f= 38173740af7c3 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -176,6 +176,7 @@ struct tps6598x { =20 int wakeup; u32 status; /* status reg */ + u32 data_status; u16 pwr_status; struct delayed_work wq_poll; =20 @@ -538,6 +539,7 @@ static bool tps6598x_read_data_status(struct tps6598x *= tps) dev_err(tps->dev, "failed to read data status: %d\n", ret); return false; } + tps->data_status =3D data_status; =20 if (tps->data->trace_data_status) tps->data->trace_data_status(data_status); @@ -1551,6 +1553,8 @@ static int tps6598x_probe(struct i2c_client *client) if (status & TPS_STATUS_PLUG_PRESENT) { if (!tps6598x_read_power_status(tps)) goto err_unregister_port; + if (!tps->data->read_data_status(tps)) + goto err_unregister_port; ret =3D tps6598x_connect(tps, status); if (ret) dev_err(&client->dev, "failed to register partner\n"); --=20 2.34.1