From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 13ABF2BD5A8 for ; Fri, 5 Sep 2025 11:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757070582; cv=none; b=OUqnLq+1KfiH3nLjZ5dvwVQw7DB32ibNrKNWWdreKZ1Un42tiasuHGqNfG2ifdMgJaTyJNm3m9ULrsNHdX19bPvSdLe7/rNykbwIhLZsCq5d3Z1q9LywCyy9HpGMjJ3JoaQEh3RCxYydwqqXBgra/UwW1bpTz8JDmncgpLSw5Z4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757070582; c=relaxed/simple; bh=7m/86o3yQ77TEdGSH2MiSbmes09C1SQZCM+n87rz7fg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OoNuWo6SDAO0eQiq4dE/3eN0w2BI4lMnPQVOpJNoCf72jvK7+h81IHzoSuhR7pmGZcPQRyWvzx1R1GEtcD+IHjySMo1iCBfHhmWAdwjwcCw5PNWV5L4JsGnubNrqVPOielaQCh5qSq3KRBIc66FaBRtdBFqKVpnzm5Ctjv8Dgag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=btMw55hj; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="btMw55hj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757070581; x=1788606581; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=7m/86o3yQ77TEdGSH2MiSbmes09C1SQZCM+n87rz7fg=; b=btMw55hjbBZs6N/QPh47X4FjGcefjA4z+UmuZG5jcrM9XXjd9jbsgQhg Z4RnK8wP1i0w8bSypqZ/FNU45tFfqXIqPyeROlII+vrOiBUIrzSU+8Ihr Tj4hDO+aiuRpI+AlazFkxh32nMHnegT9D4z7o+SKCbnAHpoqS5f9wILkO J46UbmxS7BUcpZpPsw7drfPk3axRm3hKsL/zv/ETEAXUUDryykI07+rc8 Enpu91XHMzTdWk+WMYUjM2vYXXDbhB5baCAjBXjclz4COsZMff9B7514V dZpvhJ9808hJAtpS/RDB92In2lZ49Sg8FC0kPZLnZ1XlM2js2Jh8EoBwo g==; X-CSE-ConnectionGUID: 03ut7CVsTsSunH0epvGz1A== X-CSE-MsgGUID: SHFcrVKyTY213LHV1E8iBg== X-IronPort-AV: E=McAfee;i="6800,10657,11543"; a="58454994" X-IronPort-AV: E=Sophos;i="6.18,241,1751266800"; d="scan'208";a="58454994" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2025 04:09:40 -0700 X-CSE-ConnectionGUID: Q+k0m8w6TqGxOoJFGC8I5g== X-CSE-MsgGUID: NcHeEyL0SVK7RRDj8ZOf7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,241,1751266800"; d="scan'208";a="202960490" Received: from kuha.fi.intel.com ([10.237.72.152]) by orviesa002.jf.intel.com with SMTP; 05 Sep 2025 04:09:35 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 05 Sep 2025 14:09:34 +0300 Date: Fri, 5 Sep 2025 14:09:34 +0300 From: Heikki Krogerus To: Sven Peter Cc: 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 , Philipp Zabel , 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 Subject: Re: [PATCH RFC 10/22] usb: typec: tipd: Move switch_power_state to tipd_data Message-ID: References: <20250821-atcphy-6-17-v1-0-172beda182b8@kernel.org> <20250821-atcphy-6-17-v1-10-172beda182b8@kernel.org> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250821-atcphy-6-17-v1-10-172beda182b8@kernel.org> On Thu, Aug 21, 2025 at 03:39:02PM +0000, Sven Peter wrote: > 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 Reviewed-by: Heikki Krogerus > --- > 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 > -- heikki 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 385ACCA1010 for ; Fri, 5 Sep 2025 15:41:16 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ENmjv122ai6kk2FbP2ZFmUaGHfAe+UeunnAzBe56TPA=; b=C6DEF0wtrjl+3r //SnlHsgV6xKrap/RQaAzbwyFYBm42A7eGfPP98UlpJXuWs/yjXEFCgN+FykfNWriVV5eN7vkbnTP CMfOoQGiTGKmQR7hsIVi+UboZmzaMx7AUcn1EvPxeXkFlgXfF93PHk90sUqtKdR9vAxAFS3aUn6te D+3B3Btxb+m0JuU+grNVZU1LouewbowPEWAI5K82YBiJsml5lTsO9DvS2X7lcw4t4R5QO4sh1kRwx n3eyZJYxRkox6FUlR6T1HQ8lmmtBidBofS9h9NSiFNIm83ncB9FVI2/sbU/I72vHVFsnIxEg26psw drz66jXZBasgu4on5qug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuYYt-00000002pLq-3zxJ; Fri, 05 Sep 2025 15:41:15 +0000 Received: from mgamail.intel.com ([192.198.163.19]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuUK5-00000001HUd-077f; Fri, 05 Sep 2025 11:09:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757070581; x=1788606581; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=7m/86o3yQ77TEdGSH2MiSbmes09C1SQZCM+n87rz7fg=; b=btMw55hjbBZs6N/QPh47X4FjGcefjA4z+UmuZG5jcrM9XXjd9jbsgQhg Z4RnK8wP1i0w8bSypqZ/FNU45tFfqXIqPyeROlII+vrOiBUIrzSU+8Ihr Tj4hDO+aiuRpI+AlazFkxh32nMHnegT9D4z7o+SKCbnAHpoqS5f9wILkO J46UbmxS7BUcpZpPsw7drfPk3axRm3hKsL/zv/ETEAXUUDryykI07+rc8 Enpu91XHMzTdWk+WMYUjM2vYXXDbhB5baCAjBXjclz4COsZMff9B7514V dZpvhJ9808hJAtpS/RDB92In2lZ49Sg8FC0kPZLnZ1XlM2js2Jh8EoBwo g==; X-CSE-ConnectionGUID: EAgunRp4QZugi/uh/sisLA== X-CSE-MsgGUID: /rxvIjHPRc6SAJetvlog8A== X-IronPort-AV: E=McAfee;i="6800,10657,11543"; a="58454998" X-IronPort-AV: E=Sophos;i="6.18,241,1751266800"; d="scan'208";a="58454998" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2025 04:09:40 -0700 X-CSE-ConnectionGUID: Q+k0m8w6TqGxOoJFGC8I5g== X-CSE-MsgGUID: NcHeEyL0SVK7RRDj8ZOf7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,241,1751266800"; d="scan'208";a="202960490" Received: from kuha.fi.intel.com ([10.237.72.152]) by orviesa002.jf.intel.com with SMTP; 05 Sep 2025 04:09:35 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 05 Sep 2025 14:09:34 +0300 Date: Fri, 5 Sep 2025 14:09:34 +0300 From: Heikki Krogerus To: Sven Peter Cc: 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 , Philipp Zabel , 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 Subject: Re: [PATCH RFC 10/22] usb: typec: tipd: Move switch_power_state to tipd_data Message-ID: References: <20250821-atcphy-6-17-v1-0-172beda182b8@kernel.org> <20250821-atcphy-6-17-v1-10-172beda182b8@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250821-atcphy-6-17-v1-10-172beda182b8@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250905_040941_113025_CB228C7F X-CRM114-Status: GOOD ( 21.20 ) 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 On Thu, Aug 21, 2025 at 03:39:02PM +0000, Sven Peter wrote: > 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 Reviewed-by: Heikki Krogerus > --- > 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 > -- heikki -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy