From patchwork Sat Mar 4 13:27:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 64231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp929768wrd; Sat, 4 Mar 2023 05:49:29 -0800 (PST) X-Google-Smtp-Source: AK7set8nnd26MHKfK8K4iF4irXonlDWyvqVWxJwNMULRapL2iTej3s9COVP5h8q1UqXpvKclBUt7 X-Received: by 2002:a17:907:9948:b0:8aa:a9fe:a3fc with SMTP id kl8-20020a170907994800b008aaa9fea3fcmr5527755ejc.8.1677937769406; Sat, 04 Mar 2023 05:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677937769; cv=none; d=google.com; s=arc-20160816; b=XP4jAN3UyrsFz0CvCcbqNJgnDxdUUt/eqzdW8BhyTWH/RWieZm59Rsy45SGjjWUIGd P4pfNJ//6RY3j4giEr0a/XR4orovp5tn0vYSJCfREuD09l//Whf+Is74bdJGvsJGefPP 6Nn11r7T/zLtP+NXSN7a93unKQo5Zt23BnROMP30On5kumN6CtqcgSG0i4NAG2mui1hj 6+N3Tk+ncPbSF8iVt8gvrh3S0VB+Mc37rAGUT4dsjWk/x2E18KDWyud6yvw4FlNPQt0L j8ZByKf06WxCXRQms1Zp/R3xLZmDsBTuZmXQQu9gv6PfwNiYtttDWv5dBbdo/aadal14 j0WQ== 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=hMJaPWZzvgr1zZRk25pniV8MNs32JGnZ0ctQITcox7M=; b=oK6OLlCj0odm+dVkuPiV27USWPPs5AUy9qTm59ruPM+rHfuuyG+MTw1nmy7d6CPF+o /uJS9FmRNnmVd6EavZx2b4BrUCavtHmYPqWA1GprFdf39zaOKJyMBDzyxq0pSQCPb/V+ A+tp3qZaJwBqejeVpzPrrp24lGI1fP1fuV0B/mKYO7lXCVoTEcwzVO9Gz076wEiq42No pJ8D+Utn/B9tZHt7L2vvY9JYDHYXllz2I9pRnSDgIjk2bmKzBMxeK8HVjUvSzwMb5Ixv eK453guaaQ8qUCsRIfHchQaxhhdcMwvSovBrCwWdRsQjGnJxGQzaUFB0hQVdSmG/yDnb QXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o8kkgmrj; 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 ke16-20020a17090798f000b008bafadf8b22si4976718ejc.199.2023.03.04.05.49.06; Sat, 04 Mar 2023 05:49:29 -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=o8kkgmrj; 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 S229803AbjCDN2A (ORCPT + 99 others); Sat, 4 Mar 2023 08:28:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCDN1s (ORCPT ); Sat, 4 Mar 2023 08:27:48 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B0016AE9 for ; Sat, 4 Mar 2023 05:27:47 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id t11so7046878lfr.1 for ; Sat, 04 Mar 2023 05:27:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677936465; 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=hMJaPWZzvgr1zZRk25pniV8MNs32JGnZ0ctQITcox7M=; b=o8kkgmrj2CZofpq7c3FkIlktr8pr851tpsO8hUhyNIAbK53RHVnMT6HM5xgR9g/92b uwCh4FRQ+l7zi46ITBZWceMIdVugwfDdV5XGhAWWtIoabnu1VLjrojg9DrXjYo+XIN4c PbDu98R30gX6B/0HK7bhgn40lkfZqvlqctTfhLI3KgXRa+dUBBa1vdH/HRzw/b26tJ+x OdZpHA5WFlAiij6Hr19O+DUxot1uqRJ8qN3CH+qiRNFcE4foBHUSBByCi3qnqAUXKpu8 eH31azpvQjwzm0EznW5pSeBEjviSI//OSWmQ/1CQlMe5oJYCkgkMlAEH8d/hnKLwFJFS /V4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677936465; 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=hMJaPWZzvgr1zZRk25pniV8MNs32JGnZ0ctQITcox7M=; b=yBcz/WmM7nN2x6lYIehCMYHTP8fQMHwFlt6NlRJKa6dVzM0wOu/sCIYlp6ZHxOt55X ijI1k0bPG5fyWgKPQo8qri5qe545J4t2oDM8MSb8pqMtpVAeB38aFynQBKqCmXsTSt4p xvLWMQ1VQiIbRC8ljtcXp2netJ7vfQa9/RntF+k69owAaL4bDtLCdb4W0EwwyBUhF9Jc 29HQEL/cFo221Ow6xj/6PPmzDvBoJ7Mwjd8qKJjW//KvC/FOAZfYQcTNIT40oNzWn9AX uqCF4bhyajNLpFIp8U3nF9W6FhYhHL0ZQcai2AyBfKROGcjBudzVbue+AEB/SuB0ZkTG JO/w== X-Gm-Message-State: AO0yUKXRMCEt7VBj/UcR/9tzxy1CeU7pCwbQrgds9Af7jrknm1/lGmth 5/9JU+XebYmafuoiAPPLPbu/BA== X-Received: by 2002:ac2:4854:0:b0:4db:387f:a3bb with SMTP id 20-20020ac24854000000b004db387fa3bbmr1587155lfy.0.1677936465661; Sat, 04 Mar 2023 05:27:45 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id j15-20020a19f50f000000b004e7fa99f2b5sm342975lfb.186.2023.03.04.05.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Mar 2023 05:27:45 -0800 (PST) From: Konrad Dybcio Date: Sat, 04 Mar 2023 14:27:37 +0100 Subject: [PATCH RFT 02/20] clk: qcom: smd-rpm: Add .is_prepared hook MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v1-2-d9cfaf9b27a7@linaro.org> References: <20230303-topic-rpmcc_sleep-v1-0-d9cfaf9b27a7@linaro.org> In-Reply-To: <20230303-topic-rpmcc_sleep-v1-0-d9cfaf9b27a7@linaro.org> To: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Shawn Guo X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677936461; l=1482; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=IcjgjHunD3zMZaFeCfHoL5cnPI0PmUW34gmf6fJPVyQ=; b=TA38znb8IsFbG6X+YzeL7jxDAfYqgL3P5XySVNQBRYMrhinLnwYLW7iCI5JC09DYwsWPOVlZj+l3 9PqFN2fBDSPADX7rWnlyzqWb/RUDvZvepA1iFGevM5jxQQmGbMJ6 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759445274543345766?= X-GMAIL-MSGID: =?utf-8?q?1759445274543345766?= From: Shawn Guo The RPM clocks are enabled/disabled through clk framework prepare/unprepare hooks. Without .is_prepared hook, those unused RPM clocks will not be disabled by core function clk_unprepare_unused_subtree(), because clk_core_is_prepared() always returns 0. Add .is_prepared hook to clk_ops and return the clock prepare (enable) state, so that those unused RPM clocks can be disabled by clk framework. Signed-off-by: Shawn Guo [Konrad: rebase, don't duplicate the enable func] Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index ecacfbc4a16c..cce7daa97c1e 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -438,6 +438,7 @@ static const struct clk_ops clk_smd_rpm_ops = { .round_rate = clk_smd_rpm_round_rate, .recalc_rate = clk_smd_rpm_recalc_rate, .is_enabled = clk_smd_rpm_is_enabled, + .is_prepared = clk_smd_rpm_is_enabled, }; static const struct clk_ops clk_smd_rpm_branch_ops = { @@ -445,6 +446,7 @@ static const struct clk_ops clk_smd_rpm_branch_ops = { .unprepare = clk_smd_rpm_unprepare, .recalc_rate = clk_smd_rpm_recalc_rate, .is_enabled = clk_smd_rpm_is_enabled, + .is_prepared = clk_smd_rpm_is_enabled, }; DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000);