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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 295AAC6FA86 for ; Thu, 8 Sep 2022 17:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbiIHRj1 (ORCPT ); Thu, 8 Sep 2022 13:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiIHRi4 (ORCPT ); Thu, 8 Sep 2022 13:38:56 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4109DEE50E for ; Thu, 8 Sep 2022 10:38:46 -0700 (PDT) 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 50E9814BF; Thu, 8 Sep 2022 10:38:52 -0700 (PDT) Received: from bogus (unknown [10.57.45.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8BF3E3F71A; Thu, 8 Sep 2022 10:38:43 -0700 (PDT) Date: Thu, 8 Sep 2022 18:38:40 +0100 From: Sudeep Holla To: Ulf Hansson , Peng Fan Cc: Sudeep Holla , "ben.dooks@codethink.co.uk" , "rafael.j.wysocki@intel.com" , "dmitry.baryshkov@linaro.org" , "jonathanh@nvidia.com" , "npitre@baylibre.com" , "linux-pm@vger.kernel.org" , Aisheng Dong Subject: Re: Question: why call clk_prepare in pm_clk_acquire Message-ID: <20220908173840.rqy335cdeg5a2ww5@bogus> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Thu, Sep 08, 2022 at 04:37:13PM +0200, Ulf Hansson wrote: > On Thu, 8 Sept 2022 at 09:33, Peng Fan wrote: > > > > Hi All, > > > > We are facing an issue clk_set_rate fail with commit a3b884cef873 ("firmware: > > arm_scmi: Add clock management to the SCMI power domain") , > > Hmm, I wonder about the main reason behind that commit. Can we revert > it or is there some platform/driver that is really relying on it? > IIUC, at the time of the commit, it was needed on some Renesas platform. Not sure if it is still used or not. > > > > we use scmi power domain, but not use scmi clk, but with upper commit, the clk is prepared > > when pm_clk_acquire. > > Is this based on latest SCMI clocks that support atomic or older one which doesn't. If latter, I see pm_clk_acquire doesn't actually call prepare as if clk_is_enabled_when_prepared(clk) = true. Do you see have issue ? > > However the clk has flag CLK_SET_RATE_GATE, clk_set_rate will fail in driver, because > > clk is prepared in pm_clk_acquire. > > Where is CLK_SET_RATE_GATE set exactly ? > > Looking into drivers/base/power/clock_ops.c, I see pm_clk_suspend/pm_clk_resume > > will handle clk prepare/unprepared, so why pm_clk_acquire will also prepare the clk? > As asked above do you see the actual clk_prepare getting called as I see it isn't if lk_is_enabled_when_prepared(clk) = true. > I agree, the behaviour is certainly questionable to me too. However, > it may be tricky to change by now, due to the deployment that has > happened over the years. > Agreed. > In principle we would need to make the part where pm_clk_acquire > prepares the clock to become optional, in some clever way. > I see it is already, let us see what is Peng's observation. -- Regards, Sudeep