From nobody Sun Feb 8 08:13:34 2026 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 C84ABC83005 for ; Mon, 12 Jun 2023 09:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234651AbjFLJ3H (ORCPT ); Mon, 12 Jun 2023 05:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbjFLJ2Z (ORCPT ); Mon, 12 Jun 2023 05:28:25 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BAE54C17 for ; Mon, 12 Jun 2023 02:22:52 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b203360d93so47330091fa.3 for ; Mon, 12 Jun 2023 02:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686561771; x=1689153771; 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=aokZ02DTWb9itSjNmX3GX1bnlGBgRvBPpzBUwT1r8Ks=; b=zgaXR068y2KvRcu+CefSXblQauZN/5694hY3v3A7mOv8L2XDoiACIFYh0En2bjFWO7 elrV6OhqE7pubIBMZnNEpe3US8kk7cx7qjr/U3dOsamyYot1184AjFRQr74Nu3xec5pp 4EmEIYb+GCt1S83vlEWaJor7gMzYeFdsu50yEG6n0Blk2gFifRyCFnPAdDUNNCU4CrJl NES3HC0wKGdRVeaa7i557J1WaXaISlJNWJLOO8+jV5VGT0Uo2gVx12TYt9qDZsKLF3jJ nBLzxypmxW1pNtaab38uryMBiz8WRkg0DEA56Bi4B+Ei1fn0Vewaymmg3YWbwf1v7unA ymcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561771; x=1689153771; 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=aokZ02DTWb9itSjNmX3GX1bnlGBgRvBPpzBUwT1r8Ks=; b=jutd9qkejQROF84ktZIUifOdvqtEE+cXhnTp7dzRt8fH862C9fbS8GhSTdTUot/e2W ufdDusOseyyTkNcdNyVi4oPwNP+9m6Etcaj9WApI4jUCTRvlRrdH3TgARuEe60uaylf4 IiZEXvFG355RgR8KfDcYFTx6wMpzrYffkuTUonxd7ro1ReGj2kmMuGHuyoFvPVMj84i3 69dt2EQQF5HP2X/JwtiBiBYCL62i0fziViNXfNdfPN2pNOStTcPL6UIHRKkE6/pdbbcA mMFO4hDNKj5CnjBxfptBCYSxA77S+CJBs06KXHYDP7DyyMlHuhPkEoVwXAb7gNsQ+PlA 861Q== X-Gm-Message-State: AC+VfDx5dR/eoAgHkdqes3WYqHUuaITvXmG/ihgzCEscLIvXpAtxJ0Gq gxNvopK4uDys8VesfsTTzfnp+w== X-Google-Smtp-Source: ACHHUZ5AjcfJ5uMMKue3jHOWd8iRAU/zsDR+PTI2mRCF58UVPCYAZha4zaL1zKZ8sMKtUSCKN3XhxA== X-Received: by 2002:a05:651c:22a:b0:2af:2441:f709 with SMTP id z10-20020a05651c022a00b002af2441f709mr2312656ljn.29.1686561770934; Mon, 12 Jun 2023 02:22:50 -0700 (PDT) Received: from [192.168.1.101] (abyj190.neoplus.adsl.tpnet.pl. [83.9.29.190]) by smtp.gmail.com with ESMTPSA id o20-20020a2e7314000000b002adc2fe3fc8sm1681722ljc.4.2023.06.12.02.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 02:22:50 -0700 (PDT) From: Konrad Dybcio Date: Mon, 12 Jun 2023 11:22:47 +0200 Subject: [PATCH 1/2] clk: qcom: rcg2: Introduce read-only RCG2 ops MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230612-topic-rcg2_ro-v1-1-e7d824aeb628@linaro.org> References: <20230612-topic-rcg2_ro-v1-0-e7d824aeb628@linaro.org> In-Reply-To: <20230612-topic-rcg2_ro-v1-0-e7d824aeb628@linaro.org> To: Bjorn Andersson , Andy Gross , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686561768; l=1865; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=3gIA9vzv7N0fpwHj2dbt5ZFR2hwXZW2370PjU3vkRU0=; b=/QuvsvHHTCcXI2H4Y3Vl48qEwTbc+OqDpUK9QFPMGjfNXa4lqdxBVWHNLyqKbv6mkQe9Xoc0t SRRPfn5u4jmAHeAyOv/Oz3gazVUBpjYJv2DCh5qsADr/ZIRk9wy3zIF X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some clocks are physically part of a clock controller block (e.g. GCC), but are under no circumstances supposed to be touched from HLOS/APSS, as another subsystem manages them, and trying to alter its configuration may (and likely will) wreck total havoc over whatever the clock is attached to. Add read-only ops for RCG clocks. This allows us to peak at the rates (and other configuration parameters) of such clocks without the risk of messing up half of the SoC due to an erroneous CCF call. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-rcg.h | 1 + drivers/clk/qcom/clk-rcg2.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h index e6d84c8c7989..4b4ff156539f 100644 --- a/drivers/clk/qcom/clk-rcg.h +++ b/drivers/clk/qcom/clk-rcg.h @@ -170,6 +170,7 @@ struct clk_rcg2_gfx3d { extern const struct clk_ops clk_rcg2_ops; extern const struct clk_ops clk_rcg2_floor_ops; extern const struct clk_ops clk_rcg2_mux_closest_ops; +extern const struct clk_ops clk_rcg2_ro_ops; extern const struct clk_ops clk_edp_pixel_ops; extern const struct clk_ops clk_byte_ops; extern const struct clk_ops clk_byte2_ops; diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index e22baf3a7112..71de1cd8d45b 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -518,6 +518,14 @@ const struct clk_ops clk_rcg2_mux_closest_ops =3D { }; EXPORT_SYMBOL_GPL(clk_rcg2_mux_closest_ops); =20 +const struct clk_ops clk_rcg2_ro_ops =3D { + .is_enabled =3D clk_rcg2_is_enabled, + .get_parent =3D clk_rcg2_get_parent, + .recalc_rate =3D clk_rcg2_recalc_rate, + .get_duty_cycle =3D clk_rcg2_get_duty_cycle, +}; +EXPORT_SYMBOL_GPL(clk_rcg2_ro_ops); + struct frac_entry { int num; int den; --=20 2.41.0 From nobody Sun Feb 8 08:13:34 2026 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 E34BAC7EE2E for ; Mon, 12 Jun 2023 09:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234235AbjFLJ3M (ORCPT ); Mon, 12 Jun 2023 05:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjFLJ20 (ORCPT ); Mon, 12 Jun 2023 05:28:26 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 966AE4C1A for ; Mon, 12 Jun 2023 02:22:53 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b1c910ee19so46819981fa.3 for ; Mon, 12 Jun 2023 02:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686561772; x=1689153772; 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=wF7kJNEVNClZhr22GJ39Mf3qOuL6Q0VFjYnT8ReRfhE=; b=TQFyRQ9dCAAjzWOD1qlKjLIaGuoxP8JtMlaRrMdhIDuLRK4jGXpvd9VWW5vx2qTjIS IgZLOVYLfGkuntkIxDONGBdGyukhQOKTQmYYsLh6KJvYOtOMEaC0oDUQ4TeQllmB9DSM 1TzEhCcbitB1S1jqEYzXDhZK370PA2R3KJV++NAO93DIWdcAszS+iaCEEAxw1tcDm7H7 mJ3naSjr4iUs1S/w7yidyLrpmVQyer7mjnZsSGAneL767HuG0AOWbx6jTgPk1QCfDYUv NV/wwsgN7wXiJhI9YdNMImRO+Q7nHpXyWashbxmUNzs1qz2q4TAHosQq1BUxtgizWvKX HqVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561772; x=1689153772; 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=wF7kJNEVNClZhr22GJ39Mf3qOuL6Q0VFjYnT8ReRfhE=; b=Lj+sfg31RUoe6WTAhMXKPtYysODBw+XfMpkxo7cdJfE8hcgK/BOES7M2Pc+IS2cVJr 3d41S6MbA7bq3HueDj+vkRjV33wC+LdDc9cwP1r3KoWmKyf9n4IKpes1KPJogR4+BCyt jv6iXCzJ0FN1jybPd4Ump+ysPF5Sj/qyfwpnY2VsKfKTy5TMxiMJ/fPj211sppO3EWAM e8aDZBY0kdNVn85GzwN1W4TWmqVWnqw4Bya0l9FFNIO1jp1UhL4w8Q/xKqVJbvy6Y8ij 3C6+UggzgX03xDpZkfe/wkV+tw8gfYditK5j+5qwDEOq5iEnirJnhM3cEc5LlGr/tbYY UMsw== X-Gm-Message-State: AC+VfDw2IDT/dJ8c34NhGBCh9MgFfhsBiBjkgen8+1MfKu79s3NmtLwy JlnwOsHXV/tOTRuKXVXBm8+yiw== X-Google-Smtp-Source: ACHHUZ7RbAzssVMBcdrvdXlaVgKlkWxS5u0gD99JnUeFDv45MtVzgcIujsTbpXWa2jpkgJNModhPWA== X-Received: by 2002:a2e:8719:0:b0:2b1:e65a:a1d3 with SMTP id m25-20020a2e8719000000b002b1e65aa1d3mr2200583lji.40.1686561771994; Mon, 12 Jun 2023 02:22:51 -0700 (PDT) Received: from [192.168.1.101] (abyj190.neoplus.adsl.tpnet.pl. [83.9.29.190]) by smtp.gmail.com with ESMTPSA id o20-20020a2e7314000000b002adc2fe3fc8sm1681722ljc.4.2023.06.12.02.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 02:22:51 -0700 (PDT) From: Konrad Dybcio Date: Mon, 12 Jun 2023 11:22:48 +0200 Subject: [PATCH 2/2] clk: qcom: gcc-msm8996: Use read-only RCG ops for RPM bus clocks MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230612-topic-rcg2_ro-v1-2-e7d824aeb628@linaro.org> References: <20230612-topic-rcg2_ro-v1-0-e7d824aeb628@linaro.org> In-Reply-To: <20230612-topic-rcg2_ro-v1-0-e7d824aeb628@linaro.org> To: Bjorn Andersson , Andy Gross , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686561768; l=1415; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ciUM7VVqmyaHUus+1v7jieLBfQZSXfrd5Ukd9qFyQXo=; b=34ZFn6hCgCgNYS/VVRxB/dsQm8stj9nIrROWY7b0B1M6RqHvB/A+SpcLbyv4XA5qQ4vbLebmW giUvvTAi9p0BcxEhM4uBTY9UCEv86kBgUMnYvr0BMrglAgg99c9oOtL X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The config/periph/system NoC clocks are wholly controlled by the RPM firmware and Linux should never ever alter their configuration. Switch them over to read-only ops to avoid that. Fixes: b1e010c0730a ("clk: qcom: Add MSM8996 Global Clock Control (GCC) dri= ver") Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/gcc-msm8996.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gcc-msm8996.c b/drivers/clk/qcom/gcc-msm8996.c index 5e44d1bcca9e..588e3b67657a 100644 --- a/drivers/clk/qcom/gcc-msm8996.c +++ b/drivers/clk/qcom/gcc-msm8996.c @@ -264,7 +264,7 @@ static struct clk_rcg2 system_noc_clk_src =3D { .name =3D "system_noc_clk_src", .parent_data =3D gcc_xo_gpll0_gpll0_early_div, .num_parents =3D ARRAY_SIZE(gcc_xo_gpll0_gpll0_early_div), - .ops =3D &clk_rcg2_ops, + .ops =3D &clk_rcg2_ro_ops, }, }; =20 @@ -284,7 +284,7 @@ static struct clk_rcg2 config_noc_clk_src =3D { .name =3D "config_noc_clk_src", .parent_data =3D gcc_xo_gpll0, .num_parents =3D ARRAY_SIZE(gcc_xo_gpll0), - .ops =3D &clk_rcg2_ops, + .ops =3D &clk_rcg2_ro_ops, }, }; =20 @@ -306,7 +306,7 @@ static struct clk_rcg2 periph_noc_clk_src =3D { .name =3D "periph_noc_clk_src", .parent_data =3D gcc_xo_gpll0, .num_parents =3D ARRAY_SIZE(gcc_xo_gpll0), - .ops =3D &clk_rcg2_ops, + .ops =3D &clk_rcg2_ro_ops, }, }; =20 --=20 2.41.0