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 2F5D6C3DA49 for ; Fri, 26 Jul 2024 14:11:55 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fZ0lL9cBdnnOMV5rQN9jPH3iRson9SbNwY3JE5esLcE=; b=oOgllaLGix+NYXksrJ3ABAP7WD LG2emloR7U36HKAYdPxAQCquzgxqzzu56gP9rYQAlhfQouH4HDL+6Ea0+CJK7+6WgAmvB0Oi8jOuL tE4s8j1I2eR3OPdsV2l45ib6/fzgTA1ob39s3ZqDbuM8dkRopdgJNCaReFLx0dFg1Zt9FDpJEQRCc B31kR1pN4g6dZeHonJB1QzCI2KI+GqzgcHqoU9z0aohCONue2Nah+x4wi7vnID4rEDEWZWUVW7z/9 FFajLhvSRKYTkPqNH94o3aYDzuNGv/k+TT+Nha41sBzc73Nh/6ERC3xXdXz5zU2VJQmLZ7pekUvy8 fxE/tdTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXLfd-000000046Rr-1MCk; Fri, 26 Jul 2024 14:11:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXLfC-000000046MU-3eBl for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 14:11:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 579471007; Fri, 26 Jul 2024 07:11:42 -0700 (PDT) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 311973F5A1; Fri, 26 Jul 2024 07:11:15 -0700 (PDT) Date: Fri, 26 Jul 2024 15:11:08 +0100 From: Cristian Marussi To: Dhruva Gole Cc: "Peng Fan (OSS)" , sudeep.holla@arm.com, cristian.marussi@arm.com, mturquette@baylibre.com, sboyd@kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org, Peng Fan Subject: Re: [PATCH V2] clk: scmi: add is_prepared hook Message-ID: References: <20240726131007.1651996-1-peng.fan@oss.nxp.com> <20240726134414.2ctbtt53sd3lyfjl@dhruva> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240726134414.2ctbtt53sd3lyfjl@dhruva> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_071118_979831_3117DD49 X-CRM114-Status: GOOD ( 18.37 ) 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 On Fri, Jul 26, 2024 at 07:14:14PM +0530, Dhruva Gole wrote: > On Jul 26, 2024 at 21:10:07 +0800, Peng Fan (OSS) wrote: > > From: Peng Fan > > > > Some clks maybe default enabled by hardware, so add is_prepared hook > > for non-atomic clk_ops to get the status of the clk. Then when disabling > > unused clks, those unused clks but default hardware on clks could be > > in off state to save power. > > > > Signed-off-by: Peng Fan > > --- > > > > V2: > > Provider helper __scmi_clk_is_enabled for atomic and non-atomic usage > > Move is_prepared hook out of SCMI_CLK_STATE_CTRL_SUPPORTED > > > > drivers/clk/clk-scmi.c | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c > > index d86a02563f6c..15510c2ff21c 100644 > > --- a/drivers/clk/clk-scmi.c > > +++ b/drivers/clk/clk-scmi.c > > @@ -156,13 +156,13 @@ static void scmi_clk_atomic_disable(struct clk_hw *hw) > > scmi_proto_clk_ops->disable(clk->ph, clk->id, ATOMIC); > > } > > > > -static int scmi_clk_atomic_is_enabled(struct clk_hw *hw) > > +static int __scmi_clk_is_enabled(struct clk_hw *hw, bool atomic) > > I think we can combine other atomic/non atomic in the same way no? > Let me know if I should send a follow up patch based on this to make > __scmi_clk_enable(hw,atomic) and __scmi_clk_disable(hw,atomic) I dont think that it is worth unifying also the disable/enable atomic and non_atomic versions because if you look at their implementations they are indeed already wrappers around the state_get()....this new is_prepared/is_enabled were more 'thick' and so there was a lot of duplicated code. Thanks Cristian