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 5F284CA1002 for ; Sat, 6 Sep 2025 16:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type: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=ZHGtos+9IgKq3JH4BYfqlu/TlqErPbM1HMGXtkOa0GQ=; b=a7y4f8dj5EkX57xfqMotjd2n1B 2xiybVyxvvOgK8z0967rVtX7FKfATJtXbe0BHZKz7YP05C0DVoYylxhq4ep9T0JtPxA52vG+eO9vO 9g/oyTGpw8abrqwRKQBdd00nRYLuZUX3xB8sAYXk8tCeziWBRQk6ZGxsleSrjOJGVaume0MykMALO gtlA52cvtfUDnDNFUWHpswnnRxWB0PMrvqY+LXfKvHrMTUCMbosescXqr2gvwxUBWlQYiasqepEYt KLpf5hb7DSVDW1ONC8hua2C6dq1Ac0f95TXjHg52ljhZJ8YatYTbvCpX1qkTxWLJZ9bFi3wJuN2/A oMvR4IyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuvU9-000000085L8-3krt; Sat, 06 Sep 2025 16:09:53 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuv4n-000000081gV-2tfN; Sat, 06 Sep 2025 15:43:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id D32BC451F5; Sat, 6 Sep 2025 15:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 97278C2BC87; Sat, 6 Sep 2025 15:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757173419; bh=W4i17xp3u3JigmcFedI8/zdpo2DC0szFJNzKL3OP7zQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GXSU2X0yuqEqcgIXw4++1duW1AvkYDAuvZmLpnXa3GR1D+aKkDBBH0Jg2Op16r6Oc AJNOGu7drmRw9QBs2nAMlKtNwNU15Y6v5/JuI8X8ssTJR2cM1EmTOSYqU9a4ce5IVV hmG+i5lBW2eJbtSqZNjI5nLyuL5LcuAg/bA6IHppw+T53nh9QAkpaAi3Ogbz2cwRQc 3aDJyBeV2IS/zhnJfhxgr4exY0YAt3BTf5Zz66d9Zn5/Ro0hHBF9UgQXx0hk5hYB/F OHCpOgPSR3+IMKshLhjJlh2Z0N3w2ui5N5qsi9obeFup+aq4MCL2NskWFA8gnx1kpx N36nLmCec72gQ== 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 8D0C9CA1002; Sat, 6 Sep 2025 15:43:39 +0000 (UTC) From: Sven Peter Date: Sat, 06 Sep 2025 15:43:20 +0000 Subject: [PATCH v2 07/22] usb: typec: tipd: Move switch_power_state to tipd_data MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250906-atcphy-6-17-v2-7-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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2323; i=sven@kernel.org; h=from:subject:message-id; bh=W4i17xp3u3JigmcFedI8/zdpo2DC0szFJNzKL3OP7zQ=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ8aesHlWOivDd/tkmESs+yyWuFftTt0avnk3Xc+7scton voS7veuo5SFQYyDQVZMkWX7fnvTJw/fCC7ddOk9zBxWJpAhDFycAjCR5+mMDOcMTYXn9vFtStKY wZMepSfj5MT6dubPbw+7SuoWxpzuPsrwP/ZkmxbPp/NbvU7MOah9UEB8oueR+Pv32i9KMbTyvNY 5xwkA 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-20250906_084341_790769_4A7919D1 X-CRM114-Status: GOOD ( 13.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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. Reviewed-by: Heikki Krogerus 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