From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D243CA0FEF for ; Thu, 21 Aug 2025 19:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/7GeHpb8ibtabb5vK+54Picev+iB5/xmebSj+kYx6+w=; b=MlNY7MkkZMAkvq xSNbQU2tctLOSoyrBMKTi2aSTcipqQm2V7UydAO5aDGTZ9bZ78+NNybdckkcVExH72VOF7YKjDoch iIl6kNljIKIIFrnCeddkWJab8Mcg81LQnVr10vMloikjBpw74dZI4i1sU82GjqwjbMd8oS+le/yL8 TZne5k6OLs0t4Soi3LApnHa5i/ayNrOWF5hA0QJxbmQJwoDnP/sOaZLBwRc6WT+HL1mov5M5X1I+C R/Dcv2FzuBFYN1JfVoQl9S25u4V1BXyjyW+bXTqFRxws5TODfIz2qWrVSSPoeYEacm1BsLILUcsPa /qtsYOlj5rT7Q7rUQM2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1upBMH-00000000LtW-3roz; Thu, 21 Aug 2025 19:54:01 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1up7OW-0000000HQWx-42UU; Thu, 21 Aug 2025 15:40:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 31D3DA584D3; Thu, 21 Aug 2025 15:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id A1069C2BCFB; Thu, 21 Aug 2025 15:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755790803; bh=9b0UWJfjrXCs7KOiQdQ75i5y2gJdq9gUxiVJvcVeHXA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H+5bPyidn8Qqa5k6hTahJscGN05bCasClF5mMHGbvV+Xq26Wmgkc3apYClcrHpJ4P Cu0Zrx8jpjF3DGEcp+wqrbNeNgKXlgPPya3URsuDIStuo03N9OvwLnjV6t1CqoSwwu kj2807naqNOCzk7Q+HvRS6SE5PJgbjrELEgOqLGsXAXci4qnxjYNVPtHk3KznyfMvD CgqCW00e1YkcO4glzQJqSOVCpuj6oBrIgbSgaO0zODlG43+I4oPaiMncGeN9j89bVz 0XeGmDdo8UvEvY29KpkwfA3zqRX6cEM6MoQ9fg0HnuCda5f/gqo++v91ErIy1qSv1C 2NBLiUosMn3+Q== 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 95BAFCA0FE6; Thu, 21 Aug 2025 15:40:03 +0000 (UTC) From: Sven Peter Date: Thu, 21 Aug 2025 15:39:02 +0000 Subject: [PATCH RFC 10/22] usb: typec: tipd: Move switch_power_state to tipd_data MIME-Version: 1.0 Message-Id: <20250821-atcphy-6-17-v1-10-172beda182b8@kernel.org> References: <20250821-atcphy-6-17-v1-0-172beda182b8@kernel.org> In-Reply-To: <20250821-atcphy-6-17-v1-0-172beda182b8@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 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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2259; i=sven@kernel.org; h=from:subject:message-id; bh=9b0UWJfjrXCs7KOiQdQ75i5y2gJdq9gUxiVJvcVeHXA=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ8Zy27W+3KLP8xdIeDa8kpZbUayuzJoSnrLN0f1fYRDH8 62961o6SlkYxDgYZMUUWbbvtzd98vCN4NJNl97DzGFlAhnCwMUpABPZ9oOR4UlB5tX3MRybrvXl ndq4Imr1Z6PwqRL7b7t+aUw5qcr23YWRYfu2uOn3d3IGnNP+8WPm08c9HgZ+l3e933Ikvaev01z pLT8A 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250821_084005_219224_373C99BB X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org When support for CD321x was originally added no other hardware variant was supported and there was no need for struct tipd_data. Now that it exists move the special case in there so that we can drop the of_device_is_compatible_check entirely. Signed-off-by: Sven Peter --- drivers/usb/typec/tipd/core.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 6d8bcbc9cad8a1394e066504d4c5ca570edd4e4f..4815c5c462837865a5f9d37bbc139249c82c2f75 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -118,6 +118,7 @@ struct tipd_data { void (*trace_status)(u32 status); int (*apply_patch)(struct tps6598x *tps); int (*init)(struct tps6598x *tps); + int (*switch_power_state)(struct tps6598x *tps, u8 target_state); int (*reset)(struct tps6598x *tps); }; @@ -1293,7 +1294,6 @@ tps25750_register_port(struct tps6598x *tps, struct fwnode_handle *fwnode) static int tps6598x_probe(struct i2c_client *client) { - struct device_node *np = client->dev.of_node; struct tps6598x *tps; struct fwnode_handle *fwnode; u32 status; @@ -1331,18 +1331,16 @@ static int tps6598x_probe(struct i2c_client *client) if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) tps->i2c_protocol = true; - if (np && of_device_is_compatible(np, "apple,cd321x")) { - /* Switch CD321X chips to the correct system power state */ - ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); - if (ret) - return ret; - - } - tps->data = i2c_get_match_data(client); if (!tps->data) return -EINVAL; + if (tps->data->switch_power_state) { + ret = tps->data->switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); + if (ret) + return ret; + } + /* Make sure the controller has application firmware running */ ret = tps6598x_check_mode(tps); if (ret < 0) @@ -1525,6 +1523,7 @@ static const struct tipd_data cd321x_data = { .trace_status = trace_tps6598x_status, .init = cd321x_init, .reset = cd321x_reset, + .switch_power_state = cd321x_switch_power_state, }; static const struct tipd_data tps6598x_data = { -- 2.34.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy