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 89805C3DA4A for ; Fri, 26 Jul 2024 14:42:33 +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-Transfer-Encoding:Content-Type: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=NsUZZFtPcgXCm+u7glsr5HmeOq0eYKygh997UOr6Cuw=; b=kuw9uac1pXs9/tL1uhvYkcQKr6 lAKQJwxKlv/URFfRVatK+ykJbD0DetC9luLXyskI53pKU5RWqTzDs1myfqB4AOoSGTZRBIKxpWlqL 3cxYaZxS7AwHxC9PfEWUdPz9BKssk8OQOnpYwqYcMhfBQ09h6UHTSdjdcXnbZTLEO6b5QPdIkNIBD ohNu0aDjoM+ksHMTduGmbvlFDR7naWcx6c+8VReiWqmESF3Iu2tPzowBdlqf4HS4KJplHiQ6jklYB pzsm+sA6x5Gz6pPgemaoktLRA0hZ+lXsLsWIXHu8vtFtHRUS652QfzV3Aln65DAgRYsu1ED1cM9yn hew15OAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXM9K-00000004B3A-40WK; Fri, 26 Jul 2024 14:42:27 +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 1sXM8v-00000004Ays-38bw for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 14:42:03 +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 856C71007; Fri, 26 Jul 2024 07:42:23 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C5133F5A1; Fri, 26 Jul 2024 07:41:56 -0700 (PDT) Date: Fri, 26 Jul 2024 15:41:53 +0100 From: Sudeep Holla To: Cristian Marussi Cc: Dhruva Gole , "Peng Fan (OSS)" , 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, Sudeep Holla , 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_074201_868653_9CE0ED98 X-CRM114-Status: GOOD ( 21.32 ) 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 03:11:08PM +0100, Cristian Marussi wrote: > 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. > +1, was planning to respond with similar message. Just jumped now as you made it easier for me 😁. -- Regards, Sudeep