Message ID | 20230303-topic-rpmcc_sleep-v2-2-ae80a325fe94@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp589490wrd; Wed, 8 Mar 2023 13:46:14 -0800 (PST) X-Google-Smtp-Source: AK7set8q974CFWlGsAQIlZmU/QRsLImpTfIautmGdAcX9wZnrrgpf8dr/ms1e0O5+/Uoh51p9d30 X-Received: by 2002:a62:1aca:0:b0:5e1:a3b1:966a with SMTP id a193-20020a621aca000000b005e1a3b1966amr16937330pfa.34.1678311973951; Wed, 08 Mar 2023 13:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678311973; cv=none; d=google.com; s=arc-20160816; b=d/JgQu2EutYtqCzlakC1f1H562Xt2QeWtYl0kcR/gFSeOjv675lgr8AZmhtYmP78xe ZDk+SWAsz0xcbUdkuNK4q++QN3OXLWw+RacsJDiEnjsGVkwJTYZwY0bH3zD6Z8A/ehRR tHmIzBcEduP1yOap2Sll51k8uTTto1Mta4YM9BCxI8z4ixHNa/Kf/Ftfs+Apx0uGtVPm FoBpF6x4NeZ8uOj1xfh1V0TYqJY6SypRr20hOCE0aKYXBgTWKCtFWkuXHiJIiObgLvTg XE9Uhd9w3NT7fkDmVhAZKtFmbV/pmJV9xn2AwWAzNhZahL50WmqUoqaJ6dwyCsdTZ8t0 6bHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SOECaGmGmUJLrulLw8TRNrQNT4lkSkMI20VbWaQaVaY=; b=difZnGRmSmNNHXHUw2zkk4TwrRYJUzjFD2aqiBlTlbVlKjKeuqOwZG2GDX2yoiy1xv S+zhAxrkIBTN98mc4BW7p1ncUAUichCMzyyBTRxf7doGOwzIhyLs1zrizoJlw/9Oyxy0 9ZkCYavdm4+tpQMDFuc6KSgw5BlahuoJGGJNSQ6cb3cXKHeh0Is/ls017ltYfrCZZ5ZS NKeVn38lDnLhtCn1/ORi+uLFeMRXMqLE8G/HLpHSsf1CN5hAqtC2LCHRgqDnpIB5z8hI RV9/ct/SOCd1G5QyHvqhYsaSpgGGuVv3r4I52wGffH8S16lpHPm3C+EhdZOxjbcclijO 4yQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o2v3nZSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h67-20020a625346000000b00592a19cde96si14731323pfb.369.2023.03.08.13.46.01; Wed, 08 Mar 2023 13:46:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o2v3nZSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjCHVfw (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 8 Mar 2023 16:35:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjCHVfs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Mar 2023 16:35:48 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E69CD13CF for <linux-kernel@vger.kernel.org>; Wed, 8 Mar 2023 13:35:41 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id j11so23051442lfg.13 for <linux-kernel@vger.kernel.org>; Wed, 08 Mar 2023 13:35:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311339; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SOECaGmGmUJLrulLw8TRNrQNT4lkSkMI20VbWaQaVaY=; b=o2v3nZSRV6jX/ICAGftZdATJ2s6wCtxca6GFrbERkhh9MKuTWUSGF+BS2bz0fruDeY p6Tz9BBV0QTw44vdXR6hLNpREOYFMDUoklZE9yGtUmec+0noRMW7rU86LKQJHZYsyI2a rypoiclDLhzo2+DkRr9+/YTCI5syEXb71RRCosKKjs54FLmsTDaH0iBjFv2Egd7iMgqd 9RA59HOR0gQyDikhy8X/zS/Ehx+jPhm/A4bWv6UzHb4emXNMH9bxcYnDf2Hwd8N+KYcv N1kGQBANwqL8cVLv6yaMyeXFcLvUvCBlTm7c5+xOhgTnqD+cQH9f7oDL4Tpzb06icVfu 4lnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311339; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SOECaGmGmUJLrulLw8TRNrQNT4lkSkMI20VbWaQaVaY=; b=pl5d74STFCKn95s2ZLicQqEzYkLxFn9VCtZPA2b94FAPJtYjVGWd0I5qJhZFAn3BRs 8dvUutzpWoNG4HVhzklY7hG7XhGztbUm+mI+K1387cD3jrDVzanN1VSxZYaXznr2X8zD pTm+d5PZc7I1GJAGPb9Ng7wZ9JEFP0/EDZi9/Toyf7xotr/vksiObpkNDpPwMXB7MZrE V+jNQR9CRI/C2JTuU4lFUccypf45qiVW9XrkG35M5L3NyYs7xqEcpn3NQCcUfPLjJQfP lnj176J4xJafXm9D876G3bqYvpgc4Y3/E5L7QLSZs9FkXds293pVfmqmxVPzVqGn6/NN CgKg== X-Gm-Message-State: AO0yUKXyWMrdqb/ojh4DKTVcxn5me5vrGHD8+Q23YQIL5Oqw7oFFCGhS 3t4WfWQRVxgPkYkzk+gZvaDadQ== X-Received: by 2002:ac2:46c9:0:b0:4db:1bee:c with SMTP id p9-20020ac246c9000000b004db1bee000cmr4952816lfo.44.1678311339444; Wed, 08 Mar 2023 13:35:39 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id u7-20020ac243c7000000b004dc4d26c324sm2467479lfl.143.2023.03.08.13.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:38 -0800 (PST) From: Konrad Dybcio <konrad.dybcio@linaro.org> Date: Wed, 08 Mar 2023 22:35:18 +0100 Subject: [PATCH RFT v2 02/14] clk: qcom: smd-rpm: Add .is_enabled hook MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230303-topic-rpmcc_sleep-v2-2-ae80a325fe94@linaro.org> References: <20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org> In-Reply-To: <20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, devicetree@vger.kernel.org, Konrad Dybcio <konrad.dybcio@linaro.org>, Shawn Guo <shawn.guo@linaro.org> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1448; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=DkAvY529UR+RwkQzY1FO48/jck/x44pR7ssps7xiA3g=; b=bMTX86MhRue6/CH4CAoR6mX0UhkJTn6HwQaKXt995jwdXJIOSTvZ4jiIt70kDOEqeCI115aI/A1n ZdtbcESyAwGjcxMnj2Cdm9vW5rThMJ5JfMdD6oFC26GRd42RhZeu X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759837656438571593?= X-GMAIL-MSGID: =?utf-8?q?1759837656438571593?= |
Series |
SMD RPMCC sleep preparations
|
|
Commit Message
Konrad Dybcio
March 8, 2023, 9:35 p.m. UTC
From: Shawn Guo <shawn.guo@linaro.org> The RPM clock enabling state can be found with 'enabled' in struct clk_smd_rpm. Add .is_enabled hook so that clk_summary in debugfs can show a correct enabling state for RPM clocks. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> [Konrad: rebase] Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Comments
On 08/03/2023 23:35, Konrad Dybcio wrote: > From: Shawn Guo <shawn.guo@linaro.org> > > The RPM clock enabling state can be found with 'enabled' in struct > clk_smd_rpm. Add .is_enabled hook so that clk_summary in debugfs can > show a correct enabling state for RPM clocks. > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > [Konrad: rebase] > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
On Wed, Mar 08, 2023 at 10:35:18PM +0100, Konrad Dybcio wrote: > From: Shawn Guo <shawn.guo@linaro.org> > > The RPM clock enabling state can be found with 'enabled' in struct > clk_smd_rpm. Add .is_enabled hook so that clk_summary in debugfs can > show a correct enabling state for RPM clocks. > I don't think .is_enabled should be implemented for clocks where the actual state can't be queried. E.g. should a clock which is is_enabled = false be unprepared during disable_unused? It's already disabled... Regards, Bjorn > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > [Konrad: rebase] > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c > index 198886c1b6c8..ecacfbc4a16c 100644 > --- a/drivers/clk/qcom/clk-smd-rpm.c > +++ b/drivers/clk/qcom/clk-smd-rpm.c > @@ -424,18 +424,27 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) > return 0; > } > > +static int clk_smd_rpm_is_enabled(struct clk_hw *hw) > +{ > + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); > + > + return r->enabled; > +} > + > static const struct clk_ops clk_smd_rpm_ops = { > .prepare = clk_smd_rpm_prepare, > .unprepare = clk_smd_rpm_unprepare, > .set_rate = clk_smd_rpm_set_rate, > .round_rate = clk_smd_rpm_round_rate, > .recalc_rate = clk_smd_rpm_recalc_rate, > + .is_enabled = clk_smd_rpm_is_enabled, > }; > > static const struct clk_ops clk_smd_rpm_branch_ops = { > .prepare = clk_smd_rpm_prepare, > .unprepare = clk_smd_rpm_unprepare, > .recalc_rate = clk_smd_rpm_recalc_rate, > + .is_enabled = clk_smd_rpm_is_enabled, > }; > > DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000); > > -- > 2.39.2 >
On 22.03.2023 04:02, Bjorn Andersson wrote: > On Wed, Mar 08, 2023 at 10:35:18PM +0100, Konrad Dybcio wrote: >> From: Shawn Guo <shawn.guo@linaro.org> >> >> The RPM clock enabling state can be found with 'enabled' in struct >> clk_smd_rpm. Add .is_enabled hook so that clk_summary in debugfs can >> show a correct enabling state for RPM clocks. >> > > I don't think .is_enabled should be implemented for clocks where the > actual state can't be queried. > > E.g. should a clock which is is_enabled = false be unprepared during > disable_unused? It's already disabled... That's true, it sounds silly. However, I feel like it's the least painful option, as trying to disable a clock that's already actually disabled (read, in hw+RPM, not Linux) will not do any harm. Not adding this (and by extension not making use of any sort of unused clk cleanup) will prevent the system from hitting low power modes and SMD RPM is strictly speaking, too dumb to figure out that these clocks aren't really consumed. Konrad > > Regards, > Bjorn > >> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> >> [Konrad: rebase] >> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >> --- >> drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c >> index 198886c1b6c8..ecacfbc4a16c 100644 >> --- a/drivers/clk/qcom/clk-smd-rpm.c >> +++ b/drivers/clk/qcom/clk-smd-rpm.c >> @@ -424,18 +424,27 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) >> return 0; >> } >> >> +static int clk_smd_rpm_is_enabled(struct clk_hw *hw) >> +{ >> + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); >> + >> + return r->enabled; >> +} >> + >> static const struct clk_ops clk_smd_rpm_ops = { >> .prepare = clk_smd_rpm_prepare, >> .unprepare = clk_smd_rpm_unprepare, >> .set_rate = clk_smd_rpm_set_rate, >> .round_rate = clk_smd_rpm_round_rate, >> .recalc_rate = clk_smd_rpm_recalc_rate, >> + .is_enabled = clk_smd_rpm_is_enabled, >> }; >> >> static const struct clk_ops clk_smd_rpm_branch_ops = { >> .prepare = clk_smd_rpm_prepare, >> .unprepare = clk_smd_rpm_unprepare, >> .recalc_rate = clk_smd_rpm_recalc_rate, >> + .is_enabled = clk_smd_rpm_is_enabled, >> }; >> >> DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000); >> >> -- >> 2.39.2 >>
diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 198886c1b6c8..ecacfbc4a16c 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -424,18 +424,27 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) return 0; } +static int clk_smd_rpm_is_enabled(struct clk_hw *hw) +{ + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); + + return r->enabled; +} + static const struct clk_ops clk_smd_rpm_ops = { .prepare = clk_smd_rpm_prepare, .unprepare = clk_smd_rpm_unprepare, .set_rate = clk_smd_rpm_set_rate, .round_rate = clk_smd_rpm_round_rate, .recalc_rate = clk_smd_rpm_recalc_rate, + .is_enabled = clk_smd_rpm_is_enabled, }; static const struct clk_ops clk_smd_rpm_branch_ops = { .prepare = clk_smd_rpm_prepare, .unprepare = clk_smd_rpm_unprepare, .recalc_rate = clk_smd_rpm_recalc_rate, + .is_enabled = clk_smd_rpm_is_enabled, }; DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000);