From patchwork Wed Mar 8 21:35:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661845 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 A0D58C6FD19 for ; Wed, 8 Mar 2023 21:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjCHVfu (ORCPT ); Wed, 8 Mar 2023 16:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230015AbjCHVfr (ORCPT ); Wed, 8 Mar 2023 16:35:47 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF63CF9B1 for ; Wed, 8 Mar 2023 13:35:39 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id r27so23092213lfe.10 for ; Wed, 08 Mar 2023 13:35:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311338; 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=QDlHCsdatk7h5R3zUsXpTRiwKW19DDuLF4HKqV/q1bg=; b=osg1GpfiQPSnkCrXraQM+3UriA4cjKvMkix3J0/xqRUCIIoUUX4nnNhIrBmtBQiKnD gePP3GBZ6QMmX5q4kilek17tUpgbO1ASRe776L8tUVxqk3TmpwlNJzqKPURdyyHE/WMU BT3pPYibiXQlN6feiN2B+AInyVpl/Y9yXdo+9vMUnspdaubHww4SRB/18DqQen3eVzHC 0R/KeD5QV4ZI4LWlIg13vyRz+4oGYnfF1Ft7AH4oyqClKnkCxy8OZpYDUBzSdZq9ZffP M36yfO0hKGomA91p8WSsOY/mwYDUjVFDlVVX1y5VPQYoTYtu4tpFVSIKTcJ10eENQ1qD tQHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311338; 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=QDlHCsdatk7h5R3zUsXpTRiwKW19DDuLF4HKqV/q1bg=; b=NkR9K+EtattyEFNe5/+2PWGEY7b57MVu+uo0G/ZEcKHV362re1JGr3ttH489W0Qki8 rcFDFaHt50L4b0kWaR2w4ajKcqe7O7HPBHQyAcX6zexBMSyD/UyJEe1CyrnS0lU4mCgo 8ERKTenVMv9Gx56E3BCvHV7wndk3B+TQyZUt5KUaV4mDZQwsnm6p29VK1kxUwnc9evoU MoSvysRzFzZDAK21f1W1buSGamYj0U4wT383irBgS79c7u6PqxuNb9uhsznxPsuZzySC 240uX1AiwPy6UTAUDYSE1690XVMo6TUe1q1WqnrizlyJEve1I1hBFTf0ScQGTO9VSOwt ryCQ== X-Gm-Message-State: AO0yUKWuWcEJQfgtk99qFaxUzf9oAx4Omtdpveo340XIeJyAAnFYk5gn blhkOqYYZDIc6sK6zOOS6iHZiA== X-Google-Smtp-Source: AK7set9jKKS1d8eD16jz2TNullASEgcLm6DVH+d8w29UZNhGZI2EIfH5sDM7BrWWmTsnagUc8sH6Ag== X-Received: by 2002:a05:6512:25b:b0:4dd:ab39:86e0 with SMTP id b27-20020a056512025b00b004ddab3986e0mr6214451lfo.27.1678311337931; Wed, 08 Mar 2023 13:35:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:37 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:17 +0100 Subject: [PATCH RFT v2 01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-1-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=2006; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=kU+or0SIwjfCFe3CHtYMpTgzGECGUtYX8Fz74pRBjmw=; b=xakONkb1YLP0DXpf6jbByNh8PngvZtgp8nUR3XoamblbthS/l/94cTLlNZLqyAgOaLmx+zNacVua CppU+tiMDl4K7Y31exizgRwrFp/ZEBt95LxBUjQfHTTMDa5jS9yo X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all (or at least most) of the oneline peripherals ask the interconnect framework to keep their buses online and guarantee enough bandwidth, we're relying on bootloader defaults to keep the said buses alive through RPM requests and rate setting on RPM clocks. Without that in place, the RPM clocks are never enabled in the CCF, which qualifies them to be cleaned up, since - as far as Linux is concerned - nobody's using them and they're just wasting power. Doing so will end tragically, as within miliseconds we'll get *some* access attempt on an unlocked bus which will cause a platform crash. On the other hand, if we want to save power and put well-supported platforms to sleep, we should be shutting off at least some of these clocks (this time with a clear distinction of which ones are *actually* not in use, coming from the interconnect driver). To differentiate between these two cases while not breaking older DTs, introduce an opt-in property to correctly mark RPM clocks as enabled after handoff (the initial max freq vote) and hence qualify them for the common unused clock cleanup. Signed-off-by: Konrad Dybcio --- Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml index 2a95bf8664f9..386153f61971 100644 --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml @@ -58,6 +58,12 @@ properties: minItems: 1 maxItems: 2 + qcom,clk-disable-unused: + type: boolean + description: + Indicates whether unused RPM clocks can be shut down with the common + unused clock cleanup. Requires a functional interconnect driver. + required: - compatible - '#clock-cells' From patchwork Wed Mar 8 21:35:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660542 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 13457C64EC4 for ; Wed, 8 Mar 2023 21:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbjCHVfu (ORCPT ); Wed, 8 Mar 2023 16:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbjCHVfs (ORCPT ); Wed, 8 Mar 2023 16:35:48 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B87D13C1 for ; Wed, 8 Mar 2023 13:35:41 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id g17so23135234lfv.4 for ; 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=NEXn/ToB22QWCZCYY/jEfZFuOeYhHfYYQNZFGYNwAfPKmwmr8pTLZk0uiCBhMASI8s JSCEKk7v9N44Ko94hoc3DyuUUaMrRmqrfD1NYffcwoRxDapTSmvMAJWc+Y7kHAw7kqUk OoxGzBj5ZL6VwoTu/MlyEGu5EnIi2t4OetDi2OWPtAfo9yDTHfGe597IxV4bsvS94XDG n4Hs13fdxnjpXJHpxAeDJ9VgytRGaGHDEJoJ9Z/J5nBYuXkijuSL+SI9QnPXSFa7VQaN YvgCzXYFRlE8jlrBHZ2aYxW2TXFOC1UUx0aWZbCBBu3QHDWTomndHv8TNKuCGmVQNrhk ug8g== X-Gm-Message-State: AO0yUKXRxafO2v1M6wpkv6QbRDmg+rEX/Vqsk4Opg1pABYftqf/DvrYT SGOqnKsNJY/7a1hk7rj2pVrZSQ== X-Google-Smtp-Source: AK7set+DhSpnXnr9I8EDcOc3nQqFLUuF9k/Txcs+BH+Z+yUwfbbNUk8TN5SUvxdNTY58WT65NosnFw== 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 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 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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio , Shawn Guo 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= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Shawn Guo 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 [Konrad: rebase] Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- 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); From patchwork Wed Mar 8 21:35:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660541 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 BC04AC678D5 for ; Wed, 8 Mar 2023 21:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbjCHVfy (ORCPT ); Wed, 8 Mar 2023 16:35:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjCHVft (ORCPT ); Wed, 8 Mar 2023 16:35:49 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DDF099D65 for ; Wed, 8 Mar 2023 13:35:42 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id g17so23135297lfv.4 for ; Wed, 08 Mar 2023 13:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311341; 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=vKrNdtp74XinQeNY4eMDGuSmvkyKQGDqeQBhsMhjY4fdPFriJ/A/gnKkP1o1Rj5hGd d17LdIQDyFuSpT2Vfj7n7jHcMdiuoTW/TlXkk2saJZraSak8jwZ4Q24GswuNvxiAG74y UIkMljkp3U+T6aBAVWMxiZCBNWyRgmu0YLRi9L8sGgJwaKegUSS8EDgULQ+IQ03gMFx6 l2fjXcX3reu/Cu0ptyee4UayN1EImRLVAhamofdEb9uEo3zSaVG7Ko97sziZIay7InL2 XuZXMX/aRgxC28XHPPNGYfZej9i+JhM/Hg2bsCWhnKvmC0bkRYhNQuyOSLjeTRXqhT5r tcFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311341; 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=cl2ijg1/PZk71i5ELfGFwAMdrxuIyvcVQkkZ+D8gU++oRYBKczyc62i47GwaBebt8K NhKE1Au8bXD2pRnbglWdHQ5Eqrusu8xQYNnWx/KeLXXJf2N1XiHnOZf37j5E68F0KcDw GrCw2VRQ8cV3RBc+yTMZI4rdOWct3RwVQXxDmJrCh64SYYh51EdDGU86dkGz9fvI0cIj O5+5qTEUzFFESWM5XhtteTA3AgxqvuRGBPROC4F1pxA4UWebySsOCaJqseIymo1x+TTQ IZHvxEe53UKCm0Ikkt77W1vcCwZb0Q7mjM+3psaHpf00vmfUGpbb+TcNd7ixP9pHprHm ehcw== X-Gm-Message-State: AO0yUKV8GtCR9smkZTKzof2eiw7Zc3JyujClgmVbZDZgf1e6HI/49qNp lh2/PSX3Zn2429WonwvtARvucg== X-Google-Smtp-Source: AK7set/JPTntxaKTZcLdE5KqdvSF5AcoXwGRJn/HF6O72/daeXJyZEV1ZobxCAwgpbYkndOGpkFLRA== X-Received: by 2002:ac2:533c:0:b0:4dd:a7fb:1e7c with SMTP id f28-20020ac2533c000000b004dda7fb1e7cmr6210843lfh.3.1678311341007; Wed, 08 Mar 2023 13:35:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:40 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:19 +0100 Subject: [PATCH RFT v2 03/14] clk: qcom: smd-rpm: Add .is_prepared hook MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-3-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio , Shawn Guo X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1482; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=IcjgjHunD3zMZaFeCfHoL5cnPI0PmUW34gmf6fJPVyQ=; b=XRRU/aPY7IT5XMd/T58u1InRETQd/B3Yhxj0yGAMrEQOfmdVugwndUVxyE9RQFkJpxKP4wWNbu/N yGcVWciwAl1WH/YY2FamRSLaf5lO4N4wNpnx5oA33Np6wonJwq7K X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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); From patchwork Wed Mar 8 21:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661844 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 CA056C6FD19 for ; Wed, 8 Mar 2023 21:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbjCHVfz (ORCPT ); Wed, 8 Mar 2023 16:35:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjCHVfu (ORCPT ); Wed, 8 Mar 2023 16:35:50 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C76A8389 for ; Wed, 8 Mar 2023 13:35:44 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id k14so23110176lfj.7 for ; Wed, 08 Mar 2023 13:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311342; 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=ZR8rEfH+mByVpllyIkEvGaJqUK/MTbgeGfOlnZZHumI=; b=j5mdZnIXSPZgZ84/ChHPJU3MRFTAFSRTVSFKGDnDq8LQZHHRpw6zKsGRmwb8B7nLUe t9RKmbMdGY8w7Vuotqvr2aKglsFlIJQT+BELcAjgQesTzQUek3uaoQ03uYkZh4tlSc7w 5t5FkAm8JPSG/RLCn/dV/bs6WyLPCtVd8AK3yop13ht3+3vTHA8OJOpCvBBjgfsGFZ7b ws3hIvpjUmG734VwrFACIlR7AmoXyX+i5UVoklHS+vxrKWR/jWqzvafsHQB+8Zj1OikC imP0UVpgyHObbiVoCmXO5AR8vmCo6MCHeurn973btqrBEToWyewl45YnD3T016gJ4+On oaTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311342; 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=ZR8rEfH+mByVpllyIkEvGaJqUK/MTbgeGfOlnZZHumI=; b=a8TWqL82DQqUqT96J/1dqhhlVcLKrNTM8719fgF5GTh+dkD/JV+DcFmMCWqYT7fmkF 6ZbcwS9Qzn1uypVVGkAH3XdjR5Cw16uhPwzyvLs8eu0+MB0NJrOxjCXPoVCQjxA+0rJF xLuaO+QRaOnbWNKSSFQhBYoekWcYsTSS13h2umZMeMVOrgB81elJsZ6JEulLqGaDEQNk 8AuLNCDxSJEYQDjqSvdpzMkTWIxuk2AVYy6Am9i+f14XzI9gHW6eDJ+2B1w3CdMHV1Zi XsaZxenSQoP73Bm1kQ7YTSr3Iweq/e9kQzn4w/uXDP4KVWv4TrnD4YsWKGQeMxpBEAqD jN1g== X-Gm-Message-State: AO0yUKUviuEmiI0CHTf+unSv01qgUMbATVZ4gPlwNOcJZiTRoYIstGnj SYeyHxwlo7NNnh5PawL/gkctiQ== X-Google-Smtp-Source: AK7set9sJIy5ZuLxBh5lDZbltjJuYSZnf3f/k93H386tFxS4vn4xgQwY79ATHTAqpMNQ6F+zjCDXYA== X-Received: by 2002:ac2:593b:0:b0:4a4:68b7:deab with SMTP id v27-20020ac2593b000000b004a468b7deabmr5396112lfi.7.1678311342439; Wed, 08 Mar 2023 13:35:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:41 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:20 +0100 Subject: [PATCH RFT v2 04/14] clk: qcom: smd-rpm_ Make __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX accept flags MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-4-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=2532; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=XuAIaIbpiaJbVxAhaqMtXMVrCCmBcmYgJ4nDGrAeQno=; b=jZNigdsRXfdIB65SyKr65oVKcy+ixT8aE4ifRveJcZemRFeUe6X7/ib04zd35LNJEGWZm0kL1yI8 ug9NlicED7TK1xGd6sC07EquGHlLsUaI0XaRyQpieU97pGBPNVp6 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for supporting keepalive clocks which can never be shut off (as the platform would fall apart otherwise), make the __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX macro accept clock flags for the active-only clock. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index cce7daa97c1e..72b1f010509b 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -67,7 +67,7 @@ type, r_id, key) #define __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(_prefix, _name, _active,\ - type, r_id, r, key) \ + type, r_id, r, key, ao_flags) \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_active; \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_name = { \ .rpm_res_type = (type), \ @@ -102,12 +102,13 @@ .name = "xo_board", \ }, \ .num_parents = 1, \ + .flags = (ao_flags), \ }, \ } #define __DEFINE_CLK_SMD_RPM_BRANCH(_name, _active, type, r_id, r, key) \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(/* empty */, \ - _name, _active, type, r_id, r, key) + _name, _active, type, r_id, r, key, 0) #define DEFINE_CLK_SMD_RPM(_name, type, r_id) \ __DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ @@ -126,12 +127,12 @@ #define DEFINE_CLK_SMD_RPM_BRANCH(_name, type, r_id, r) \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \ _name##_clk, _name##_a_clk, \ - type, r_id, r, QCOM_RPM_SMD_KEY_ENABLE) + type, r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0) #define DEFINE_CLK_SMD_RPM_BRANCH_A(_name, type, r_id, r) \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \ _name, _name##_a, type, \ - r_id, r, QCOM_RPM_SMD_KEY_ENABLE) + r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0) #define DEFINE_CLK_SMD_RPM_QDSS(_name, type, r_id) \ __DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ @@ -146,7 +147,7 @@ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(_prefix, \ _name, _name##_a, \ QCOM_SMD_RPM_CLK_BUF_A, r_id, r, \ - QCOM_RPM_KEY_SOFTWARE_ENABLE) + QCOM_RPM_KEY_SOFTWARE_ENABLE, 0) #define DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(_name, r_id, r) \ DEFINE_CLK_SMD_RPM_XO_BUFFER(_name, r_id, r); \ From patchwork Wed Mar 8 21:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660540 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 52BDCC6FD19 for ; Wed, 8 Mar 2023 21:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbjCHVgJ (ORCPT ); Wed, 8 Mar 2023 16:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjCHVfy (ORCPT ); Wed, 8 Mar 2023 16:35:54 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34B3D2903 for ; Wed, 8 Mar 2023 13:35:45 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id k14so23110229lfj.7 for ; Wed, 08 Mar 2023 13:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311344; 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=ov5RMn4u4UzKJ3B2Go2X9BkWY6GJei++Q812Yrin8NQ=; b=AxhmL4HahGAmk4iXonM1WZnW6wfLggY8ACu1c7y/UUUX50xPNa6ZMfCFXIdx9ySf9B Kp4CHTl5eVmBoqaiegAqMDHPGeA2jm281La5XN8hGZVQvfGFZPsXi/2R8Wx4Xqg8pSTL 7x2cD7elmtx62OdCkJA1uYcgy3YzpiMjMbAoD7eT5EpYnM5eBkIHm0gzGtFmbICOGZwc /pAJESYHr5wN7jd9vh8sNHflicgIO3Nt+KatIewTqS178ZSiBiquaBGAIsgUtUlZlLFf q4blRWTFq9zvFxeNLz39okmM+Fa7hlQK3WL5qijMd7pjfdcoe6xh2RrcbbRP+7fMpq2S SUvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311344; 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=ov5RMn4u4UzKJ3B2Go2X9BkWY6GJei++Q812Yrin8NQ=; b=OFd1Itk763oABdURP9pppZB1+Ib+2NcAdPrG93+bGYjN9/uGV+/Z/hWiOzs8XVE+df I6zJE7qTPVfis37t2Sj9b7Z3J+RuQj3YbGNraWSrkoNF5BbIv5YAhp7AYpD+kRnscwZW WaaGb6Walh2/oNxRwwbFn0HMFw3b4FYwm/Qr3/SpgLRAqAK6vsAhqZPDB9KrjpqeS/lA RRHofxNfXEUPbk0lrWgNT4cXG51gw213zGVaS4E8/fB6eAKFJuzW2qVT/9Ltn1ttXUpQ GBegqzRhrMrMx0jngD589lwWljuslUMpOmmULIfREao9BxWWjGdiK1FUy/9NlL6LQeoG AkQA== X-Gm-Message-State: AO0yUKVKiz2VZ9cRBMXC/C24aDobDLc2122Uldvq1rwzVTM6vOW9A7pn B8sj+UmIjm/v9ovKZGp1lfIyUw== X-Google-Smtp-Source: AK7set9dma1j6Hpgq09B0UyfOJ4VTgSFw6jduwHFeZviyO9dnKsNOae9xfK14OlgNweaqopTCKXu7g== X-Received: by 2002:a05:6512:38c6:b0:4db:387f:a3af with SMTP id p6-20020a05651238c600b004db387fa3afmr4619602lft.4.1678311343950; Wed, 08 Mar 2023 13:35:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:43 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:21 +0100 Subject: [PATCH RFT v2 05/14] clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A accept flags MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-5-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1812; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=svZJYxWNeuanDoOsLpbm2ZL4k08Cxtikg953kjcomQI=; b=sWofPdTB+S2gmrrLLUFIgZQAJ2Dpw8GiAIqWBFrlUA0dFPLwJP/f1iFMOzWa5eP3iGN9mRFIVl6i PnKA34jlACMIaRLdI7hJ6pz6gH95zN0ugXHXujjpvItq48fx3w8B X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for supporting keepalive clocks which can never be shut off (as the platform would fall apart otherwise), make the DEFINE_CLK_SMD_RPM_BRANCH_A macro accept clock flags for the active-only clock. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/clk/qcom/clk-smd-rpm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 72b1f010509b..fec6ae4a8989 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -129,10 +129,10 @@ _name##_clk, _name##_a_clk, \ type, r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0) -#define DEFINE_CLK_SMD_RPM_BRANCH_A(_name, type, r_id, r) \ +#define DEFINE_CLK_SMD_RPM_BRANCH_A(_name, type, r_id, r, ao_flags) \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \ _name, _name##_a, type, \ - r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0) + r_id, r, QCOM_RPM_SMD_KEY_ENABLE, ao_flags) #define DEFINE_CLK_SMD_RPM_QDSS(_name, type, r_id) \ __DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ @@ -450,10 +450,10 @@ static const struct clk_ops clk_smd_rpm_branch_ops = { .is_prepared = clk_smd_rpm_is_enabled, }; -DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000); +DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, 0); DEFINE_CLK_SMD_RPM_BRANCH(qdss, QCOM_SMD_RPM_MISC_CLK, 1, 19200000); DEFINE_CLK_SMD_RPM_QDSS(qdss, QCOM_SMD_RPM_MISC_CLK, 1); -DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1); +DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1, 0); DEFINE_CLK_SMD_RPM_BRANCH(mss_cfg_ahb, QCOM_SMD_RPM_MCFG_CLK, 0, 19200000); From patchwork Wed Mar 8 21:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661843 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 398FAC742A7 for ; Wed, 8 Mar 2023 21:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbjCHVgJ (ORCPT ); Wed, 8 Mar 2023 16:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjCHVfz (ORCPT ); Wed, 8 Mar 2023 16:35:55 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 242ED92704 for ; Wed, 8 Mar 2023 13:35:46 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id t11so23133489lfr.1 for ; Wed, 08 Mar 2023 13:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311345; 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=WwZMH96UXfkc0AccFCgdHWqtpm71+Gjc4i/Nm8NSEJg=; b=hXBEuXzGMdj72xSPbg/KZ0ZJ0aETajx9yHPyiwgOFt0X1hTP8zQd5MS0i2U5vFEwfH pPPAGpWf1GoL2gATieKsJ/f6RnWuWoSB05oiMl2XdIjnLSw6NFqKdb/tFR83zRtjPZry ayu0Y7ftEnndA1gN+kBzO+r9ThFsGWL2XiC7ylY3GhYup3b1CPA3SQTZujAX2+mwZzoJ vHhxLYUqJ+5kfO2DLCFPXLATsD+E1ZWoIETRgQ4w29wc4j8U9VkgshFBgs6nXYKiE/+1 z++PKMsRMGHzzrYxFm0ZsYGBw1wElZt3rdh7FG7mb+zk7LYiOhFskqmSkbKpdzShS5gO Hs3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311345; 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=WwZMH96UXfkc0AccFCgdHWqtpm71+Gjc4i/Nm8NSEJg=; b=u9xEzJjRk6YreSiL2afZj0AbCknFSFmYqSF7v1AlXqTIqHQoTp73XxlICncH643O2e J6jd0ukKZcePwNpK9QXNtWxE5ojgiOaZPzZBBppRaAXDLnKqwJDAzkyWjLSw6VpHOT1l gWKvyrjEVIN64m5AbtKkyWAGl9eEh35GEmg5zxtLCwiahOxXh2NXVc/X+EfV9izw4EQ9 NpYzD5mSiy81LOx4aFnkOFFf5XVADSEjjP3CUlqq2vJ8g9iqxtLyt7zUYHH6KSTW9cf7 ihBQoSw2oC8fjCOB+IGK+a3aZhz83jmUqM5z1Ypxvitgo4jrjdKq3X5RpsHAxDbJDuWe XZjA== X-Gm-Message-State: AO0yUKVL1YUxqs/iPmscTXIDLMWu6J8rGN2Mzxgz6V77hjSGUCfkFUBb EiqTl/NHrSsW+Mzn4z5oc2h3vg== X-Google-Smtp-Source: AK7set8FAqtCPNeuGOFm27ULXeGksmc+9BuHiRhwbhDwx2j5p8KAmARp3lWBZD4m8ceHjrAfxOSShg== X-Received: by 2002:a19:f00f:0:b0:4c0:91d0:e7ab with SMTP id p15-20020a19f00f000000b004c091d0e7abmr4595915lfc.28.1678311345559; Wed, 08 Mar 2023 13:35:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:45 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:22 +0100 Subject: [PATCH RFT v2 06/14] clk: qcom: smd-rpm: Make BI_TCXO_AO critical MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-6-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1209; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=TISC+Oc8V9fBm+Q+IBeIefGIjS6ebEWVyUTx7mIEAsw=; b=R+M8Tbyxgn5h+HC/KiEpepKUFCu2bNNp8TswNI/3zNht3TSAvrONTg5dU73dvGjmFn/8guhHpguL RBE7PiI7AhPCKKU6oJK30w2Zvsq0AjO1z03dGN3IB4jXAx9VGi8i X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We should never let go of the active-only XO vote, as otherwise the RPM may decide that there are no online users and it can be shut down, resulting in a total, uncontrolled system collapse. Guarantee this through adding the CLK_IS_CRITICAL flag. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index fec6ae4a8989..9dc779360ada 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -450,7 +450,8 @@ static const struct clk_ops clk_smd_rpm_branch_ops = { .is_prepared = clk_smd_rpm_is_enabled, }; -DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, 0); +/* Disabling BI_TCXO_AO could gate the root clock source of the entire system. */ +DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, CLK_IS_CRITICAL); DEFINE_CLK_SMD_RPM_BRANCH(qdss, QCOM_SMD_RPM_MISC_CLK, 1, 19200000); DEFINE_CLK_SMD_RPM_QDSS(qdss, QCOM_SMD_RPM_MISC_CLK, 1); DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1, 0); From patchwork Wed Mar 8 21:35:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660539 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 EB4ADC64EC4 for ; Wed, 8 Mar 2023 21:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbjCHVgP (ORCPT ); Wed, 8 Mar 2023 16:36:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbjCHVfz (ORCPT ); Wed, 8 Mar 2023 16:35:55 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A522599BD0 for ; Wed, 8 Mar 2023 13:35:49 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id b13so18034698ljf.6 for ; Wed, 08 Mar 2023 13:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311348; 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=TQfh2WbVBXCGhONYJZDP8O9PA2kbZ/WsteDRJW+CEEo=; b=jlT64jGnX9EyFQbSCp7Bn017VtmEaLUeLCtmD5RVnxofRuyJmVNspcSNivRnK5XL5L +kBcOEEzSDuEgU7b5i/s+wlOoTNWHuiLKd4Lw5kKvZL0hG0JCt0zIbjQCb4odX3G2+tQ Z2D7WcIwQMkP+fkb81gxKNyp9oIhxobO/7OB9PYZYrKVBBoPNLcz+va9hOaC0aBhIMkJ Bkfx/OMZXVCo4A9m/mpkZka7E1WvILbGrlGC4xwN9JuOCdZ8XxWxKJ7GlNNB/Z/SWd1T 7VZBsAfX9UEgiJcCeJ519HuSqoZCQVsLfiVqCJgOhlhdSfp37F80B5hSzlbW5T7J3JmL 6yZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311348; 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=TQfh2WbVBXCGhONYJZDP8O9PA2kbZ/WsteDRJW+CEEo=; b=y3BnMT5/HWM6elu9LB9hDFJL5P6bUii7q3ulsXpic0btESWvNA/GgUiYJCC1JIEFDd Ef5cvSLWkg3WQOmkkGc3I8oroexMTwJ4z/y1oSVgS+bx3zbFb6PH5QvG5sT4+QYgMeRI 7feDmN3ji1hZgXPKkmFzyq06uzEsUChMTGvr9ihjMHC0mnN0ARer1QONbvz67PKH3EhA 2VEw4mcM7m3exLYJ9siCQgFxQQZnysyZz5qyHa1vnI2VKwEebi+2MHjWiLcfsUNWTGzO p6OlkfJqfdF5NPM2vwKW2T6j/1Bep2EsVewsVZgCFAFiu1F70zjjUP2J6oldSvoJIAnT tDbg== X-Gm-Message-State: AO0yUKUqWPD5+lFr9EzXr6r9TPhGvBx9zEanXcWQDNl3PzQgb8jYD5QP AkOKbt1n8kqnVOhJZ6yZd0obzA== X-Google-Smtp-Source: AK7set+y+DjLgIW7cnOdetKMsRZ4JWT/c1FWUTq7ipcbLcRS7Ib4CpBEwYEsN1IXPTaza1CY4QrbrQ== X-Received: by 2002:a2e:7810:0:b0:295:b005:1d56 with SMTP id t16-20020a2e7810000000b00295b0051d56mr5751684ljc.17.1678311347868; Wed, 08 Mar 2023 13:35:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:47 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:23 +0100 Subject: [PATCH RFT v2 07/14] clk: qcom: smd-rpm: Make __DEFINE_CLK_SMD_RPM_PREFIX accept flags MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-7-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1880; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=psKSvGQDNyeXFzjuSkxyveilkS0EXbnLPmqC1X+KBDY=; b=BNP9g6R4cFS3/Yrb9t5P/MOac0VdgbxoI+qmXh6hIoCVitEsxsgiU5LyXmHV31X+F2mf/Q0b+636 4HBTf54rCPB/sF1gXBv7ClninZknYlvqL3ULKsdw8p1TJd1D0NJV X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for supporting keepalive clocks which can never be shut off (as the platform would fall apart otherwise), make the __DEFINE_CLK_SMD_RPM_PREFIX macro accept clock flags for the active-only clock. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/clk/qcom/clk-smd-rpm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 9dc779360ada..ddb4268ba2a5 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -26,7 +26,7 @@ #define QCOM_RPM_SCALING_ENABLE_ID 0x2 #define __DEFINE_CLK_SMD_RPM_PREFIX(_prefix, _name, _active, \ - type, r_id, key) \ + type, r_id, key, ao_flags) \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_active; \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_name = { \ .rpm_res_type = (type), \ @@ -58,13 +58,14 @@ .fw_name = "xo", \ .name = "xo_board", \ }, \ + .flags = (ao_flags), \ .num_parents = 1, \ }, \ } #define __DEFINE_CLK_SMD_RPM(_name, _active, type, r_id, key) \ __DEFINE_CLK_SMD_RPM_PREFIX(/* empty */, _name, _active, \ - type, r_id, key) + type, r_id, key, 0) #define __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(_prefix, _name, _active,\ type, r_id, r, key, ao_flags) \ @@ -117,7 +118,7 @@ #define DEFINE_CLK_SMD_RPM_BUS(_name, r_id) \ __DEFINE_CLK_SMD_RPM_PREFIX(bus_##r_id##_, \ _name##_clk, _name##_a_clk, QCOM_SMD_RPM_BUS_CLK, r_id, \ - QCOM_RPM_SMD_KEY_RATE) + QCOM_RPM_SMD_KEY_RATE, 0) #define DEFINE_CLK_SMD_RPM_CLK_SRC(_name, type, r_id) \ __DEFINE_CLK_SMD_RPM( \ From patchwork Wed Mar 8 21:35:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661842 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 3CC10C678D5 for ; Wed, 8 Mar 2023 21:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230259AbjCHVgR (ORCPT ); Wed, 8 Mar 2023 16:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbjCHVf5 (ORCPT ); Wed, 8 Mar 2023 16:35:57 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F6DD292C for ; Wed, 8 Mar 2023 13:35:51 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id i28so23205939lfv.0 for ; Wed, 08 Mar 2023 13:35:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311349; 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=fCbN4RipXloOvl8HD4CkfkOTvrEB1N/g8w5o4Jrwa+U=; b=Q0uR7+OINHQuP91/EZXRdbCXk+J6inz2D6xS2kFEsEupu3Hy0y/l5jff0oTzfm2Vj2 GCPpj5G8+sC4k/2Z3NQeQEQjIjnpcuMzRlPGsKC88sWR1D6s2Fx8ZUFDb+RTNrkyPYIz v7LRe7D7D5CUlrKFrGrQNC3cRKr/sJpJwri0rUCMR+YOhBhINzedx7lSLty/MHGmZ3W+ mkIUmbFfCS0RmFdhlngtGrxVgNgUuUcmWX8qMqPGpKYweg3Dkq7rlbKF4holXfiPVdLL O0UYcSvVbgUOEHGRi6oqNgxKEaPrRn/cr8ncLlMCrgB7vOAhf3yLDRgMaYeKDfX7o7+q Xq8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311349; 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=fCbN4RipXloOvl8HD4CkfkOTvrEB1N/g8w5o4Jrwa+U=; b=d2WhaYEAFjQhE2Sd2Rxf5hD6vjWtjWp+bNZgCd5uWaJZkVLdyRc4S/eozGWF/PMI67 wXlLf4qGfZdpqnHUyI0G1QP6CIARiyyxnEjBUgsWJZ3bZLINL0YA2PPVywAGz79WKhWt Z/f4XJS9/1SJWnNg1jqdexTwuEhJPwR/56n1CoVK/5SdLe7tHhlCsac2qxsMYpJfBfwA ern2PatKtv2wbqjTC7lBP+5HZzVv6QpJ/1bbXdqf4NEcahKXKraYXulUeK3aos2cnIAA nDh3J7GOrdFluFh7tfyYHuNqssqPX9/kEfacxb+zdxPPm/9XnOq339c8SvXGGTJGbtz5 TNrQ== X-Gm-Message-State: AO0yUKUlzeXw73KQPAYwubkiNB8i53xCb3+Gz/BRmL1qPeCM+sxllqVd Q+VbnCGuuV+nLqneCo5JevjclQ== X-Google-Smtp-Source: AK7set/R90Bpp2AH47wz7bWahvZ1Wib3lh+sacEOd8AoT/cBdslN0Ew6dDasUkCOiHzc1U4L2iOp+g== X-Received: by 2002:a05:6512:3c3:b0:4d8:4f53:37b0 with SMTP id w3-20020a05651203c300b004d84f5337b0mr5071270lfp.41.1678311349794; Wed, 08 Mar 2023 13:35:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:49 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:24 +0100 Subject: [PATCH RFT v2 08/14] clk: qcom: smd-rpm: Separate out a macro for defining an AO clock MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-8-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1025; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=b14AEjTLwjLgGEk78F1dpInwcT5yQSs+pXHFwVDxjG0=; b=YZjjRcIZTzgaqY6x0UbgV5zzjW3IjnbHE+/bhMHyCC8csrAHASH2iqQHODhNkWPsdUYxL9opmkSO DaqekFNQAg2ytq6y+M6qXA23HqLqYCzktQv6Ua1BlvLrdvoTN2To X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org To declare a keepalive variant of a bus clock, it will be useful to have a reusable macro which will ease defining a keepalive variant of an AO clock with an IS_CRITICAL flag. Introduce it. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index ddb4268ba2a5..eb7781e5c8c1 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -44,6 +44,11 @@ .num_parents = 1, \ }, \ }; \ + __DEFINE_CLK_SMD_RPM_AO_PREFIX(_prefix, _name, _active, type, \ + r_id, key, ao_flags) + +#define __DEFINE_CLK_SMD_RPM_AO_PREFIX(_prefix, _name, _active, \ + type, r_id, key, ao_flags) \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_active = { \ .rpm_res_type = (type), \ .rpm_clk_id = (r_id), \ From patchwork Wed Mar 8 21:35:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660538 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 94A2BC6FD19 for ; Wed, 8 Mar 2023 21:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbjCHVgS (ORCPT ); Wed, 8 Mar 2023 16:36:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbjCHVgI (ORCPT ); Wed, 8 Mar 2023 16:36:08 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2D5DC3B0 for ; Wed, 8 Mar 2023 13:35:52 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id i28so23206014lfv.0 for ; Wed, 08 Mar 2023 13:35:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311351; 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=/go9JzzVOEsVKPzeAceWp3TS35nZ2mbESw1jgSMGm7A=; b=y1r7IR/q5CFB+NwNRrjeOgw5mcgy6SiAP4aq4/6uUugMPqIEkqrjka4MJovtVPukAF KtjQCWEh9dDUBqPQA9A4S7UT+t+FBa5pSCbrC0fiZhIKlITgO622Vfmpa2RVgdFtlz/b OWGm55WlYQtq5LoEBJultPT4Tff4KXJS8GEJgbnE9rS/VN7UwD6YRqEDEecUb+A2FmWU 13pImcnL1JbaAdAdcI2QmXGce/DRUOnEhUcPUXzAOvPOx19QmeBe+BGAxEghssfzCNLn upVManq9skJmwnplxBX5CudGvJSkxVkzwloS6kvE3imD96UWE61rlEB2wDD+DGFiGr5B npFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311351; 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=/go9JzzVOEsVKPzeAceWp3TS35nZ2mbESw1jgSMGm7A=; b=0vYEhwRH0+seaju9xymKhNnLfxwbEyUozF/NkHtTZYH0ICG4ve6hbbO4FpdMy6ub4H exPN0R5tP75PeQsCm25X4LlDJhuWaMI/+oi4OH3toK5KMjuEBROwakkB0jknXeepgFZ+ 5iRp1tm2ZInhSK2n274EgrUkt9TkgaYIDUDXzlsUhW14ndOd8pRN1NRRYZE6wkQXQvZ3 erWJ9gF3n7763NN9SPsMMvtj5I9HOqzyUO4zPEaEKpNfrUKKlkSsxsv2kNvdOYEuOUJl kuNxx7kajKDG+NLMjH7f/qi7eKFfV932IpVroUttZTg3X4E+sBnK6p6ZEGAfOcS3e2p7 w9Sg== X-Gm-Message-State: AO0yUKUDibgE66KDhrU/n//PUsPYNkOMKCjeRIiTQOoyxiJYvAzUuanZ Xmi+0Ddxxm2SQ9sc4jU6SDy2cA== X-Google-Smtp-Source: AK7set+wUGkTJxfe/LDVdq6Rbt04pIceTywLx4q2uqA4bXqqssqCvaGnGHMD/pXuXb535yBp1Hb3yg== X-Received: by 2002:a05:6512:401d:b0:4e7:ff1c:6030 with SMTP id br29-20020a056512401d00b004e7ff1c6030mr4353486lfb.15.1678311351542; Wed, 08 Mar 2023 13:35:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:51 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:25 +0100 Subject: [PATCH RFT v2 09/14] clk: qcom: smd-rpm: Add support for keepalive votes MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-9-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio , Shawn Guo , Taniya Das X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=3522; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=PET/xgo25kPZz4y++jzQYNkadiG9KbkszadHqMCSmYo=; b=U8c6gZZepRlLHsxJCUUNeNSgs2R1pXwK8Oz0lee09UzA9sQohyMnpsOokWw2mt5ez6+UA+8waarz 1XTH+4oZBjlT8ZUcGNF9pFFN0kJ4hArj/ANRqAQUEIswdP4QS8cl X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some bus clock should always have a minimum (19.2 MHz) vote cast on them, otherwise the platform will fall apart, hang and reboot. Add support for specifying which clocks should be kept alive and always keep a vote on XO_A to make sure the clock tree doesn't collapse. This removes the need to keep a maximum vote that was previously guaranteed by clk_smd_rpm_handoff. This commit is a combination of existing (not-exactly-upstream) work by Taniya Das, Shawn Guo and myself. Co-developed-by: Shawn Guo Co-developed-by: Taniya Das Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index eb7781e5c8c1..d89918f9ae60 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -45,15 +45,17 @@ }, \ }; \ __DEFINE_CLK_SMD_RPM_AO_PREFIX(_prefix, _name, _active, type, \ - r_id, key, ao_flags) + r_id, key, ao_flags, false) #define __DEFINE_CLK_SMD_RPM_AO_PREFIX(_prefix, _name, _active, \ - type, r_id, key, ao_flags) \ + type, r_id, key, ao_flags, \ + _keep_alive) \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_active = { \ .rpm_res_type = (type), \ .rpm_clk_id = (r_id), \ .active_only = true, \ .rpm_key = (key), \ + .keep_alive = (_keep_alive), \ .peer = &clk_smd_rpm_##_prefix##_name, \ .rate = INT_MAX, \ .hw.init = &(struct clk_init_data){ \ @@ -170,6 +172,7 @@ struct clk_smd_rpm { const bool active_only; bool enabled; bool branch; + bool keep_alive; struct clk_smd_rpm *peer; struct clk_hw hw; unsigned long rate; @@ -198,11 +201,16 @@ static int clk_smd_rpm_handoff(struct clk_smd_rpm *r) .value = cpu_to_le32(r->branch ? 1 : INT_MAX), }; + /* Set up keepalive clocks with a minimum bus rate */ + if (r->keep_alive) + req.value = cpu_to_le32(19200); /* 19.2 MHz */ + ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, r->rpm_res_type, r->rpm_clk_id, &req, sizeof(req)); if (ret) return ret; + ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, r->rpm_res_type, r->rpm_clk_id, &req, sizeof(req)); @@ -438,12 +446,29 @@ static int clk_smd_rpm_is_enabled(struct clk_hw *hw) return r->enabled; } +static int clk_smd_rpm_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); + + /* + * RPM resolves the rates internally. All we have to do on the kernel + * side is ensure that we don't accidentally put down the keepalive + * clocks, which could happen if they received a vote below 19.2 MHz. + */ + if (r->keep_alive) + req->rate = max(req->rate, 19200000UL); + + return 0; +} + 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, + .determine_rate = clk_smd_rpm_determine_rate, .is_enabled = clk_smd_rpm_is_enabled, .is_prepared = clk_smd_rpm_is_enabled, }; From patchwork Wed Mar 8 21:35:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661841 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 E9B68C6FD19 for ; Wed, 8 Mar 2023 21:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjCHVgl (ORCPT ); Wed, 8 Mar 2023 16:36:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbjCHVgQ (ORCPT ); Wed, 8 Mar 2023 16:36:16 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DA1D309D for ; Wed, 8 Mar 2023 13:35:55 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id m6so23121021lfq.5 for ; Wed, 08 Mar 2023 13:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311353; 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=tTT9T3ZA8o58JTVSfKP4mFmGSY9L0FD5ME/SSc1VeoA=; b=vDB0yPgjLPPWoTfMKifxuDN4HA99g3FORK5nE8C+hMr23QT6TbTSkc93JcR4QJQJXo xMy6pMK1XQF3QCwSt20pIVEDfCojiR89iEAfcYrCoNfxoA2Uds6l16egXmaVEZ+qhrHx HeLIVr09bSo/s5T8qCGIG0x1ySnvTj8lGAd0Gp9lBbmMab/qKlDDMXFQdnyHph5PvSli 2BqFj9mx9yUF55GRgi98PM//GKYe2jAFboQxvgxSfESsP+VeA9+9oAEl38SywOZXP94i r+RWaDCKPwmI/Fr7Kj5qVV9gAehpAJ34H73pcqSAyzzog0lvH6Nq2G9m3vXy17xE9AJs Tocg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311353; 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=tTT9T3ZA8o58JTVSfKP4mFmGSY9L0FD5ME/SSc1VeoA=; b=ooeIzA2cs3ZfkN9s0qILDvdmzGZNo+meoNqig9d+Tm9gSBY+5kUOgFpVywzfZ29ltk 2wFaQT6Pb4nBbEolT+XBCV319bXbQXvuOkqQ4jtnZiFr3ZFmfWo38B2Vu3Ek+CW0Q0qO 8u4PB02EYoY3dCZb8yR5QlhJEWypVfCCil958Bd/nqE/KzheJYrxVykUUnDgRq6ADWkN UF0lGEtQbetsF63gGkgz/UoxpVS+XC+kFfRfZZar5U8FaInZI6MF1y/apGuBHkik/HQo T+UseJB1hc3mvjAB0O6/KyaFvs7xm+vRIsaI0M6L5M0UkfGdazg0rSotu65Bwm1CN/cl DoSQ== X-Gm-Message-State: AO0yUKX6IS26INxzE8m0u6hH04caUiEezAao5N87wYvYk5PKqYXsBJJB mxbe99d8U5ZD0qiiqhxdbUxFZg== X-Google-Smtp-Source: AK7set9HYpOkHj7Fa1MNXJxiUAjYPFfn9R/0Dc3fBPzXsZzKXqsMs8IROFf/vCb2Cd1Pzk6nAUyhdw== X-Received: by 2002:ac2:599b:0:b0:4dd:98c6:ee1 with SMTP id w27-20020ac2599b000000b004dd98c60ee1mr5249370lfn.61.1678311353641; Wed, 08 Mar 2023 13:35:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:52 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:26 +0100 Subject: [PATCH RFT v2 10/14] clk: qcom: smd-rpm: Introduce DEFINE_CLK_SMD_RPM_BUS_KEEPALIVE MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-10-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=1045; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=nCVLU2bNG/XRlQstVOXJbHVfkx/oThdOe+b2OVKuu+k=; b=B6Pkn3UBt2p7iNXjBVL9wZ8vkQaA5HPLUlt+T/OKBYmMnH6RlhWe8h/cFssu4XFxmJLlBJ7CH7O2 xSMGSQqQB2wzWwXbOGfExpBIxd25+iI8Q6c3zWdHhSZstBUckuKw X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for supporting keepalive clocks which can never be shut off (as the platform would fall apart otherwise), add a macro for defining such clocks. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index d89918f9ae60..8e25b3d7d30c 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -127,6 +127,11 @@ _name##_clk, _name##_a_clk, QCOM_SMD_RPM_BUS_CLK, r_id, \ QCOM_RPM_SMD_KEY_RATE, 0) +#define DEFINE_CLK_SMD_RPM_BUS_KEEP_ALIVE(_name, r_id) \ + __DEFINE_CLK_SMD_RPM_AO_PREFIX(bus_##r_id##_, \ + _name##_clk, _name##_a_keep_alive_clk, QCOM_SMD_RPM_BUS_CLK, \ + r_id, QCOM_RPM_SMD_KEY_RATE, CLK_IS_CRITICAL, true) + #define DEFINE_CLK_SMD_RPM_CLK_SRC(_name, type, r_id) \ __DEFINE_CLK_SMD_RPM( \ _name##_clk_src, _name##_a_clk_src, \ From patchwork Wed Mar 8 21:35:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660537 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 55B35C742A7 for ; Wed, 8 Mar 2023 21:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjCHVgn (ORCPT ); Wed, 8 Mar 2023 16:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbjCHVgQ (ORCPT ); Wed, 8 Mar 2023 16:36:16 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B215AD30A6 for ; Wed, 8 Mar 2023 13:35:55 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id bi9so23154395lfb.2 for ; Wed, 08 Mar 2023 13:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311355; 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=18sKuiUZ5qcOhA0BPqaLsV7V9u6MXywtAtqfprvdNpA=; b=kuEZA5WBA7SdWEEPArS0NM4NxQySePTy4hToYIWbXUWY7BIyxK5OQOkExJoqS37sqJ ksUsiRFu6luv9pWWU7g/iArQgc+tvBiEtwQ2zIllLO2sp3mUvM+eiTTEg1BRiyR33bAj 4Z3ghgRDlyXwUbcVOqv/J4VZUv/mG9OiBFzkVCegd/+ZWI9y43yRNm2mL5QKdVsX+r7N RGfKC9CnAcucB2u8kLgPifyNjkRP3Szmv29xF2jztYOY1Ip2kfqH0k4jMn08jH6leefy jTFnLaMu8kAWVjtBt0aii740oa0lU8Y2I/lGP+1P9y7CoK4zqvjWKDuBV8wiAOH7hjyq 2aVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311355; 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=18sKuiUZ5qcOhA0BPqaLsV7V9u6MXywtAtqfprvdNpA=; b=mRgN9yZvig4mGPjHfOl6ASesjLogijSk5p11+FYrhKz2Pz4QuBvjfQjuzrQqfVXuVg JQNdnReygfzWojRmLuMFoD5Bz3ZO4W9ljpFgZUkly84+ZBAO0GhVlXWTLtc/twjbnctG Ffxf/6mSsu+8r9A7OwpAYu9T0hQmBzau8NBoj89IXtD9ZSecgcYK3arvgwsRgv+E46jx PA4pFA/pgb6K5yCOAesrKnl3NaLUtGrn76uqxCOvaqdT68aeOXjVLsiQrjqMcQMcXkgx wu/nvLUseCBLvVoFDpDDoIZaThqgxAelS2Im83o7XOTG+XwBi3O1NzbhY1q8C083k/Pt opUA== X-Gm-Message-State: AO0yUKUWoYlfxGeFCViH2ZbeORllwZ3XZtUt13n/og3p0GvnIaAwFljY 10UUb7iqLb6FRO5JE2WiAbXscA== X-Google-Smtp-Source: AK7set85U3bH/mA2/qRDLBvxVOfcB9k/oV2D4aRe319AMMSu9H7/PRIKpH/rib4+Bj4ImxyKxSAOCQ== X-Received: by 2002:ac2:50c9:0:b0:4a4:68b7:d64b with SMTP id h9-20020ac250c9000000b004a468b7d64bmr5468773lfm.50.1678311355132; Wed, 08 Mar 2023 13:35:55 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:54 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:27 +0100 Subject: [PATCH RFT v2 11/14] clk: qcom: smd-rpm: Hook up PCNoC_0 keep_alive MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-11-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=7589; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ht1r9OGUoEseRFNQ9l7Gc9DH17HBnASp+IBgQCKWpG4=; b=w8IKPEIDXvKB2pFy9RLASr+KNH5tUDGfcQhHLgRHnGVwcpV2nKhRVeQEXX36aZ3QdUHn0lcvbqYr ZRlBn1P1D7uMDgi/2kj3Lyqx1PRn0SQ0zldTs02q2hUdgHshrcZi X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 14 [1] of our 18 supported platforms need an active keepalive vote on PCNoC_0 so as not to cause havoc on the entire SoC. Guarantee that. [1] there are 13 changes to driver data, but 8226 reuses 8974. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/clk/qcom/clk-smd-rpm.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 8e25b3d7d30c..a44b52bd0c83 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -500,6 +500,7 @@ DEFINE_CLK_SMD_RPM(aggre1_noc, QCOM_SMD_RPM_AGGR_CLK, 1); DEFINE_CLK_SMD_RPM(aggre2_noc, QCOM_SMD_RPM_AGGR_CLK, 2); DEFINE_CLK_SMD_RPM_BUS(pcnoc, 0); +DEFINE_CLK_SMD_RPM_BUS_KEEP_ALIVE(pcnoc, 0); DEFINE_CLK_SMD_RPM_BUS(snoc, 1); DEFINE_CLK_SMD_RPM_BUS(sysmmnoc, 2); DEFINE_CLK_SMD_RPM_BUS(cnoc, 2); @@ -558,7 +559,7 @@ DEFINE_CLK_SMD_RPM_XO_BUFFER(div_clk3, 13, 19200000); static struct clk_smd_rpm *msm8909_clks[] = { [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -592,7 +593,7 @@ static const struct rpm_smd_clk_desc rpm_clk_msm8909 = { static struct clk_smd_rpm *msm8916_clks[] = { [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -626,7 +627,7 @@ static struct clk_smd_rpm *msm8936_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -660,7 +661,7 @@ static const struct rpm_smd_clk_desc rpm_clk_msm8936 = { static struct clk_smd_rpm *msm8974_clks[] = { [RPM_SMD_PNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_2_cnoc_clk, @@ -712,7 +713,7 @@ static struct clk_smd_rpm *msm8976_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -746,7 +747,7 @@ static struct clk_smd_rpm *msm8992_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_OCMEMGX_CLK] = &clk_smd_rpm_ocmemgx_clk, [RPM_SMD_OCMEMGX_A_CLK] = &clk_smd_rpm_ocmemgx_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -804,7 +805,7 @@ static struct clk_smd_rpm *msm8994_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_OCMEMGX_CLK] = &clk_smd_rpm_ocmemgx_clk, [RPM_SMD_OCMEMGX_A_CLK] = &clk_smd_rpm_ocmemgx_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -864,7 +865,7 @@ static struct clk_smd_rpm *msm8996_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_2_cnoc_clk, @@ -918,7 +919,7 @@ static struct clk_smd_rpm *qcs404_clks[] = { [RPM_SMD_QDSS_CLK] = &clk_smd_rpm_qdss_clk, [RPM_SMD_QDSS_A_CLK] = &clk_smd_rpm_qdss_a_clk, [RPM_SMD_PNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, @@ -948,7 +949,7 @@ static struct clk_smd_rpm *msm8998_clks[] = { [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_2_cnoc_clk, @@ -1010,7 +1011,7 @@ static struct clk_smd_rpm *sdm660_clks[] = { [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_2_cnoc_clk, [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_2_cnoc_a_clk, [RPM_SMD_CNOC_PERIPH_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_CNOC_PERIPH_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_CNOC_PERIPH_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_MMSSNOC_AXI_CLK] = &clk_smd_rpm_mmssnoc_axi_rpm_clk, @@ -1052,7 +1053,7 @@ static struct clk_smd_rpm *mdm9607_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_QPIC_CLK] = &clk_smd_rpm_qpic_clk, @@ -1074,7 +1075,7 @@ static struct clk_smd_rpm *msm8953_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_PCNOC_CLK] = &clk_smd_rpm_bus_0_pcnoc_clk, - [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_clk, + [RPM_SMD_PCNOC_A_CLK] = &clk_smd_rpm_bus_0_pcnoc_a_keep_alive_clk, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_1_snoc_clk, [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_1_snoc_a_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, From patchwork Wed Mar 8 21:35:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 660536 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 BD0F5C74A44 for ; Wed, 8 Mar 2023 21:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbjCHVg5 (ORCPT ); Wed, 8 Mar 2023 16:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjCHVgX (ORCPT ); Wed, 8 Mar 2023 16:36:23 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33EAD30B5 for ; Wed, 8 Mar 2023 13:35:58 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id i9so23108177lfc.6 for ; Wed, 08 Mar 2023 13:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311356; 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=D4XnwTKK+r/ENEsY5xL5W4CAtIX7vncEORsdYqk3zz8=; b=gX777jL/5l6kIjI27QmqsyX79SF8nW8A0qVANxM9lSgrvA8+n6GoLs/Yv5v0fxKza+ 0MP40fOz85b2O+zV1XDcRsBXKqL8MH2QhoSYNWwyS6DU2nEsoRhpSiLQu8TzK5fxUt8z jvYebb9QXjQ5m2e80f7aRscvKrspADRTmI0iRXPdhs8Tnm3Dkpp998ZsV5tYMjbTzTKo r0oZR/UvRX5lZBAMNO+xJjhrwc2Co1YG1384CWujXk+ZTEvCeXemwCafgZAv8BAsxiTE NBixBt2VTokQiO3QMXgzP7PQV1kxX2JkP28T6Dkh8D0AUeSrSar8rGAqgiY4wnfYqp2L fflA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311356; 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=D4XnwTKK+r/ENEsY5xL5W4CAtIX7vncEORsdYqk3zz8=; b=1zZ1yB8xSETssu/Q+JTfyDoPKI/WiBTvW8zWSkO1R7zPfEgu8mpziNse4rEa1rF+hp 36bxku3dMgxMJo4ySuCIx1tFJUPEUXjFKBfM1me5jmFGK0wdktFeYr3LURrXO2UpKjWd Z4Z55yJB6NnTdm4cZy4o2SWdpWqrBtZruEK9D4Fm0Be+bTTYL475uy7OJE7lIZKhi3eL Ykoad9jtVuCDWcKho7JzkVVYAPaxjhhU2OSIixDNdkSQJxBILvYWOSDb+GYzFHcP1to8 pIXFPRnp/cDhkcvc/jSfsKoygIvbU4sc+GOzkDrZebfII+QEISkzyuPOhxgMpDI7I4TQ mnYw== X-Gm-Message-State: AO0yUKXS9lQLVo7rHaIfG47bwraTFX0QosbJM/ZNLo5Ulv8yCRArlxGn rDkELpqMb/WYW1mW8eDpmErVcg== X-Google-Smtp-Source: AK7set+LiU1LGn6kjvZ8TOavZQwSLWsnj3ZSJWqAQ5ozQw6k0x5p7VRZoONoQjyaQkuDHYzdmnKmfw== X-Received: by 2002:ac2:5a45:0:b0:4cc:8682:ec5c with SMTP id r5-20020ac25a45000000b004cc8682ec5cmr5076161lfn.34.1678311356522; Wed, 08 Mar 2023 13:35:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:56 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:28 +0100 Subject: [PATCH RFT v2 12/14] clk: qcom: smd-rpm: Hook up CNoC_1 and SNoC_2 keep_alive MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-12-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=4801; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=bvsdJLy7tgag7pJIG/YhqythrBFn4s7xKZ0bdeefut8=; b=J7M28LAzUYEMYIao58B7D+APzztZRI1TsQUe1Yors/2XpeGwGjVfdXjMHBiYHvyvbLpjaLGKin5g lGpXKd06B4R8gu/XE9vn+KOlp5fJ1ZS1P/6FK2MWGQOr2N9+4kFD X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 4 of our 18 supported platforms need an active keepalive vote on CNoC_1 and SNoC_2 so as not to cause havoc on the entire SoC. Guarantee that. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/clk/qcom/clk-smd-rpm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index a44b52bd0c83..ef3157fd29d5 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -507,7 +507,9 @@ DEFINE_CLK_SMD_RPM_BUS(cnoc, 2); DEFINE_CLK_SMD_RPM_BUS(mmssnoc_ahb, 3); DEFINE_CLK_SMD_RPM_BUS(snoc_periph, 0); DEFINE_CLK_SMD_RPM_BUS(cnoc, 1); +DEFINE_CLK_SMD_RPM_BUS_KEEP_ALIVE(cnoc, 1); DEFINE_CLK_SMD_RPM_BUS(snoc, 2); +DEFINE_CLK_SMD_RPM_BUS_KEEP_ALIVE(snoc, 2); DEFINE_CLK_SMD_RPM_BUS(snoc_lpass, 5); DEFINE_CLK_SMD_RPM(bimc, QCOM_SMD_RPM_MEM_CLK, 0); @@ -1111,7 +1113,7 @@ static struct clk_smd_rpm *sm6125_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_2_snoc_clk, - [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_clk, + [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_QDSS_CLK] = &clk_smd_rpm_branch_qdss_clk, @@ -1121,7 +1123,7 @@ static struct clk_smd_rpm *sm6125_clks[] = { [RPM_SMD_RF_CLK2] = &clk_smd_rpm_rf_clk2, [RPM_SMD_RF_CLK2_A] = &clk_smd_rpm_rf_clk2_a, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_1_cnoc_clk, - [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_clk, + [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_keep_alive_clk, [RPM_SMD_IPA_CLK] = &clk_smd_rpm_ipa_clk, [RPM_SMD_IPA_A_CLK] = &clk_smd_rpm_ipa_a_clk, [RPM_SMD_CE1_CLK] = &clk_smd_rpm_ce1_clk, @@ -1154,7 +1156,7 @@ static struct clk_smd_rpm *sm6115_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_2_snoc_clk, - [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_clk, + [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_QDSS_CLK] = &clk_smd_rpm_branch_qdss_clk, @@ -1164,7 +1166,7 @@ static struct clk_smd_rpm *sm6115_clks[] = { [RPM_SMD_RF_CLK2] = &clk_smd_rpm_rf_clk2, [RPM_SMD_RF_CLK2_A] = &clk_smd_rpm_rf_clk2_a, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_1_cnoc_clk, - [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_clk, + [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_keep_alive_clk, [RPM_SMD_IPA_CLK] = &clk_smd_rpm_ipa_clk, [RPM_SMD_IPA_A_CLK] = &clk_smd_rpm_ipa_a_clk, [RPM_SMD_CE1_CLK] = &clk_smd_rpm_ce1_clk, @@ -1194,13 +1196,13 @@ static struct clk_smd_rpm *sm6375_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_2_snoc_clk, - [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_clk, + [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_QDSS_CLK] = &clk_smd_rpm_branch_qdss_clk, [RPM_SMD_QDSS_A_CLK] = &clk_smd_rpm_branch_qdss_a_clk, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_1_cnoc_clk, - [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_clk, + [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_keep_alive_clk, [RPM_SMD_IPA_CLK] = &clk_smd_rpm_ipa_clk, [RPM_SMD_IPA_A_CLK] = &clk_smd_rpm_ipa_a_clk, [RPM_SMD_QUP_CLK] = &clk_smd_rpm_qup_clk, @@ -1231,7 +1233,7 @@ static struct clk_smd_rpm *qcm2290_clks[] = { [RPM_SMD_XO_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo, [RPM_SMD_XO_A_CLK_SRC] = &clk_smd_rpm_branch_bi_tcxo_a, [RPM_SMD_SNOC_CLK] = &clk_smd_rpm_bus_2_snoc_clk, - [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_clk, + [RPM_SMD_SNOC_A_CLK] = &clk_smd_rpm_bus_2_snoc_a_keep_alive_clk, [RPM_SMD_BIMC_CLK] = &clk_smd_rpm_bimc_clk, [RPM_SMD_BIMC_A_CLK] = &clk_smd_rpm_bimc_a_clk, [RPM_SMD_QDSS_CLK] = &clk_smd_rpm_branch_qdss_clk, @@ -1241,7 +1243,7 @@ static struct clk_smd_rpm *qcm2290_clks[] = { [RPM_SMD_RF_CLK3] = &clk_smd_rpm_38m4_rf_clk3, [RPM_SMD_RF_CLK3_A] = &clk_smd_rpm_38m4_rf_clk3_a, [RPM_SMD_CNOC_CLK] = &clk_smd_rpm_bus_1_cnoc_clk, - [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_clk, + [RPM_SMD_CNOC_A_CLK] = &clk_smd_rpm_bus_1_cnoc_a_keep_alive_clk, [RPM_SMD_IPA_CLK] = &clk_smd_rpm_ipa_clk, [RPM_SMD_IPA_A_CLK] = &clk_smd_rpm_ipa_a_clk, [RPM_SMD_QUP_CLK] = &clk_smd_rpm_qup_clk, From patchwork Wed Mar 8 21:35:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661840 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 DEFB4C6FD19 for ; Wed, 8 Mar 2023 21:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229574AbjCHVg5 (ORCPT ); Wed, 8 Mar 2023 16:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbjCHVgS (ORCPT ); Wed, 8 Mar 2023 16:36:18 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0316D3098 for ; Wed, 8 Mar 2023 13:35:58 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id g17so23136075lfv.4 for ; Wed, 08 Mar 2023 13:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311358; 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=urmGJAPgwAGGBM7URg5kN0SEKagUfLPIGhnTYX/DEYE=; b=GNVYLg9ohWuW/v3/mcICnAg/PJu6Qnk0xgBCKATX+YqfrOteGWMKGJ6x2aceFAPe+U Eed8PXwSoxFpmiVN64rjRWJCRU4k0CZZV3JTs8KNCf3rlju0OR7Pe/RM8iHNny+MHlcZ ac30gMHU6JmSL0Gmcs5I8CfOmSBO9yR6xlMdCsnK60NVq/mPpA8Cc9lXcPe8tAFTJ9Oh 6vTBMrNGJE+6OoKu5hdaDu0kId4/ovnbOYzOvuq9HVk0eL43NavA8x86S0STXaWghkML eGGrsZP/41ehBnZ3m2XjFF61XJSVMQ2pzIG52PjgPBszQmxmbrSWjh6z7KPliEGGANkt 2B+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311358; 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=urmGJAPgwAGGBM7URg5kN0SEKagUfLPIGhnTYX/DEYE=; b=yD4AR88MGcVtFmXd+lpW3XrrrTKTFbv2/gRsfvPVETHLbdEv0GdO6OZzeuxZZS+FEw ir1XUmVUf1VaYmK8iE+NDBFwMkGt103PZyUNRIP3npuWBSeJfiuGctHRF/Z11eMbTY8k 8MzLYNNc4FW0L7KidC9kSHkpR15w69kSQvl9BSk6ABmBwdqeay9stBz1KgpnzXlSNz2A FMYKpiBCNFxzu5aynXIwLzI9H7gXYbY/ipRbYLpeUCLnOfTnb0n95+QAwtMxxf55doMq 0prPdWMOMHAIS+hoNmyOlrcOgiAwLS6Gr6EoFmOTlkafadBnBaBqMqZHDe4c0etqK4Ms lS8w== X-Gm-Message-State: AO0yUKUMjelcXqMxlN4cR03Wx2BUVV3x8nlaZXTyVbD/+COqutMkFpZl us7t8lEVw2Bx7YKnOher8M9+iQ== X-Google-Smtp-Source: AK7set92Z69NMyyEQP7wB0K4PZMXIufxALGgm1eGkSDTelNQPsB4m1mLnlSOBQbzDg412IiaFtMdNw== X-Received: by 2002:a19:7609:0:b0:4dd:9931:c4f6 with SMTP id c9-20020a197609000000b004dd9931c4f6mr5223428lff.16.1678311358070; Wed, 08 Mar 2023 13:35:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:57 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:29 +0100 Subject: [PATCH RFT v2 13/14] clk: qcom: smd-rpm: Mark clock enabled in clk_smd_rpm_handoff() MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-13-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio , Shawn Guo X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=2789; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ptSW3wZBetlXgOZ2HWII0h2GkDDWkHkQylreBSIoYDE=; b=pVN/1pfoxRb/PkVrgLyzANO7P40tBDrd+dWqphNKXRPek7PH4uHm0+pV220EEBj+mIfB6GdTztpy +YM8AiROBnYjd+FexpLOMnYZNLdFEZt3JQjhi/s2TTFeEEiQoQHd X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Shawn Guo The result of clock handoff is that the clock is voted by APSS and enabled by RPM. So it should be marked as enabled. This, combined with .is_enabled/prepared will ultimately cause RPM clocks that were enabled by the bootloader to actually be shut down if unused. We can only afford to do so if we have a functioning ICC driver. An immediate thought to test for that can be to provide an ICC path to the RPMCC node, however that would create a couple of circular dependencies between GCC/DISPCC/.../RPMCC and ICC. The next best thing to do without breaking older device trees is to add an opt-in DTS property. Do just that. Signed-off-by: Shawn Guo [Konrad: make conditional, explain the consequences] Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index ef3157fd29d5..6736e53e607a 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -197,7 +197,7 @@ struct rpm_smd_clk_desc { static DEFINE_MUTEX(rpm_smd_clk_lock); -static int clk_smd_rpm_handoff(struct clk_smd_rpm *r) +static int clk_smd_rpm_handoff(struct clk_smd_rpm *r, bool disable_unused_clks) { int ret; struct clk_smd_rpm_req req = { @@ -222,6 +222,10 @@ static int clk_smd_rpm_handoff(struct clk_smd_rpm *r) if (ret) return ret; + /* Marking clocks enabled here will trigger unused cleanup */ + if (disable_unused_clks) + r->enabled = true; + return 0; } @@ -1319,6 +1323,7 @@ static int rpm_smd_clk_probe(struct platform_device *pdev) struct qcom_smd_rpm *rpm; struct clk_smd_rpm **rpm_smd_clks; const struct rpm_smd_clk_desc *desc; + bool disable_unused_clks; rpm = dev_get_drvdata(pdev->dev.parent); if (!rpm) { @@ -1326,6 +1331,14 @@ static int rpm_smd_clk_probe(struct platform_device *pdev) return -ENODEV; } + /* + * We can only really park unused clocks if we have a sane interconnect + * driver. Otherwise, the platform may (and probably will) try accessing + * IPs that are hosted on unclocked buses. In an effort not to break + * older DTs, make this an opt-in through a DT property. + */ + disable_unused_clks = of_property_read_bool(pdev->dev.of_node, "qcom,clk-disable-unused"); + desc = of_device_get_match_data(&pdev->dev); if (!desc) return -EINVAL; @@ -1339,7 +1352,7 @@ static int rpm_smd_clk_probe(struct platform_device *pdev) rpm_smd_clks[i]->rpm = rpm; - ret = clk_smd_rpm_handoff(rpm_smd_clks[i]); + ret = clk_smd_rpm_handoff(rpm_smd_clks[i], disable_unused_clks); if (ret) goto err; } From patchwork Wed Mar 8 21:35:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 661839 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 94177C678D5 for ; Wed, 8 Mar 2023 21:36:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbjCHVg6 (ORCPT ); Wed, 8 Mar 2023 16:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbjCHVgX (ORCPT ); Wed, 8 Mar 2023 16:36:23 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91E2D30BC for ; Wed, 8 Mar 2023 13:35:59 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id t11so23134191lfr.1 for ; Wed, 08 Mar 2023 13:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311359; 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=ZubkqDM02FAiEq3eW9W/hQGkoIRi+LbMNFc2dkt329w=; b=U2+2EA4Y3hZZ4IySjfJI7Rl8yoiGa46ugFf4hmN9QuuP8TmiomTY4CaHr6rB8HomBu 1d58zX7S00aWHBBZPR/9Qn0NTAtJnx4USs+nIOvlr4IZkdCbpiqX2iFUgWZhVmtjwMhF HwjoziRqgFYuPmfsOT0ZS+HAnLTHRS9MNFAqStOd4lVU8TSR8VgUBKPsgLLnr5hZOL/p aQQzjQFknH52GZKA90Mjip+qHUNF15Q2GKbuq3ZeRxgpOBgMZ742kRiF0mDniqN3ygUL PRE7HiM63+DplQpxJGy+qf4hW3UYDcYevICm0uYsosmmjnr9HSLo2RoMKZKCsi2leuyV cWJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311359; 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=ZubkqDM02FAiEq3eW9W/hQGkoIRi+LbMNFc2dkt329w=; b=THUR+r+JHCpdQNvAJZgoxBZ7NwkDEbIg31UIVOTUsaqyjXRhhoKgfsyOJz9wWa7cQo F693nRvIVnHTiTtUJ8Wo2UOMP30hXTBFZksSFchrlRAKg1rbjpc0gED11ekrZvUMO1MV ZCg5K6upDlbfuRXbh790lhePEPTpUFkkZVJSakOOd4qGfnWG22XK7tSG9WYdQIwy1jz7 eswmGTkAytP2b3nbMFaDM4Ve2Dm5pusigaggxpEgGgJh3v/uSjZRBYLrXwNrQ6AEqthG zasklJ915UhrR67nikzldn0AKByrUKU+AKIY2/BR1k6RvFSupveEmnm0kjN63UTxeXpZ xlKQ== X-Gm-Message-State: AO0yUKW1uCTuV3dUwktDR1/7AypPzdsQqAxmipwX4T4ygVRhylKrztFM f9RDTV3tF+75GpvrTeydNpUQ/g== X-Google-Smtp-Source: AK7set+G3EUNHPXsQ1i0gem4UXH/5P0KEDgfYTdtkCno0b2iCeMPN8kRgDjX9mylfukjLAE3B1WfPA== X-Received: by 2002:ac2:508f:0:b0:4dd:a5aa:accb with SMTP id f15-20020ac2508f000000b004dda5aaaccbmr5350543lfm.44.1678311359487; Wed, 08 Mar 2023 13:35:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:58 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:35:30 +0100 Subject: [PATCH RFT v2 14/14] arm64: dts: qcom: msm8996: Enable rpmcc unused clk disablement MIME-Version: 1.0 Message-Id: <20230303-topic-rpmcc_sleep-v2-14-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 , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=658; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ymIRVOgSTZj4llDzbcFS8Jduc30n2FcF0wczQdKvVS8=; b=7LtP5xJlOff5hrptxWCmxeFmHS62ygyBcYYVTgt92Z6PwhXkfshXJ2lTCW00E24p6ufcwyRA44Pe zx7PeJN/D0AhenvXl0rkAAO1hHKJfYaoWqp532nuqUb1Ua8I72gw X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org MSM8996 is in a good enough state to shut down unused RPM clocks. Do it! Signed-off-by: Konrad Dybcio --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 905678e7175d..59451d87cfbf 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -488,6 +488,7 @@ rpmcc: clock-controller { #clock-cells = <1>; clocks = <&xo_board>; clock-names = "xo"; + qcom,clk-disable-unused; }; rpmpd: power-controller {