From patchwork Tue Feb 14 14:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 653558 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 6B0E1C61DA4 for ; Tue, 14 Feb 2023 14:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbjBNOiF (ORCPT ); Tue, 14 Feb 2023 09:38:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbjBNOiE (ORCPT ); Tue, 14 Feb 2023 09:38:04 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC64A2313D for ; Tue, 14 Feb 2023 06:38:01 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id bt8so11879556edb.12 for ; Tue, 14 Feb 2023 06:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eCg1qb28rj+gFKZAL4LyzRFUv7U0u9J7xzWR97CVfk4=; b=Z3dvwBabyJaQvCC1kbnr4v2nvDp/l7oYaIw8Wgbskb/3LrTPmcx/J90JqRdHMBWXHb lanZGKYBqLs8IrMWUUi5M7w90AXqv/iESKI/efJnvHF1og9ea/px5GQwjOXKgl2SUyBU FT0sDEbUzJMR/t/zuJMM2o+KwtyfnAVqnyegkTfNA7Rn46VO4d5bw0gQmmqAMMJ1mc3J 1bICs9a0Q4pQG4GF/ktHwpCGEyVAE7NhFfyQsvs9ewHQcoDJ42PTa5lFlGacMz2kH5qL 3smcmKyzOmAN4+S8lWorlOxCeyvv6zZrS82hzAt7YmQYiwvGpxv0Cpta29mNGyvRv7yu DHGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eCg1qb28rj+gFKZAL4LyzRFUv7U0u9J7xzWR97CVfk4=; b=bSaDKCux71utAhLbCChxEp8YhYnu1GW5bBt3yvpfkkRZ+rzeKHTMzoNoPXGAYLuIVd qNtDkYVx5ZdukAwvhJwS9YqG7dtR8XxUYbhglBb95FbAji8bJClRk7N4qot/3pYDZmPv Z278TlsX5VyLsE/75AtKG8OkRvYRHrg6gI+JMKhxG8Ox7JQGzljuu3vOoyzrWX4+OTXK ruv+MO1YYNbdG3mC2jsVVmqvksCgHlYbCIplrR/hUQdx8qdb+gJHM5uGNsylbEHyGN4l axbIUS4abnAvQ2Ujs3aCy/0F3sgbQBi9CzTzSN/JBukS6ku9+DFNOjVkAsVqkl8q1EAx xUvw== X-Gm-Message-State: AO0yUKV3nFdX5qgv3Phptn128ezvSFnu9AzHMz4XKQ+iFL1uAME4SISj OXvvA0dzjqufAWcMld1FSkxLzIsiA5XCSyl2 X-Google-Smtp-Source: AK7set8v07+GY3U6QGwQDJD0xYT9bhBeL7BzwyXM8JvIyvSeGfSf9c2G0R/mfV99dEnaBGFXD2tgVA== X-Received: by 2002:a50:d5c2:0:b0:4ac:bdac:ce20 with SMTP id g2-20020a50d5c2000000b004acbdacce20mr2539297edj.35.1676385480174; Tue, 14 Feb 2023 06:38:00 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:37:59 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , Evan Green , Jun Nie , Brian Masney , Greg Kroah-Hartman , Yassine Oudjana , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 01/12] interconnect: qcom: rpm: make QoS INVALID default, separate out driver data Date: Tue, 14 Feb 2023 15:37:09 +0100 Message-Id: <20230214143720.2416762-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently, NOC_QOS_MODE_FIXED is defined as 0x0, which makes it the "default" option (as that's what uninitialized members of partially initialized structs are set to), which should really have been NOC_QOS_MODE_INVALID, and that's what people (wrongly) assumed was the case when .qos.qos_mode was not defined and what really makes the most sense.. That resulted in {port 0, prio 0, areq_prio 0, urg_fwd = false, rpm-voted} QoS being always voted for, because the code flow assumed "hey, it's fixed QoS, so let's just roll with whatever parameters are set" [again, set by partial struct initialization, as these fields were left unfilled by the developers]. That is of course incorrect, and on many of these platforms port 0 is MAS_APPS_PROC, which 9/10 times is supposed to be handled by the ap_owned path, not to mention the rest of the parameters may differ. Arguably, the APPS node is the most important one, next to EBI0.. The modes are defined as preprocessor constants. They are not used anywhere outside the driver or sent to any remote processor outside qcom_icc_set_noc_qos(), which is easily worked around. Separate the type specified in driver data from the value sent to msmbus. Make the former an enum for better mainainability. This is an implicit fix for every SMD RPM ICC driver that didn't explicitly specify NOC_QOS_MODE_INVALID on non-AP_owned nodes that don't have QoS settings. Fixes: 30c8fa3ec61a ("interconnect: qcom: Add MSM8916 interconnect provider driver") Fixes: 6c6fe5d3dc5e ("interconnect: qcom: Add MSM8939 interconnect provider driver") Fixes: 4e60a9568dc6 ("interconnect: qcom: add msm8974 driver") Fixes: 7add937f5222 ("interconnect: qcom: Add MSM8996 interconnect provider driver") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 22 ++++++++++++---------- drivers/interconnect/qcom/icc-rpm.h | 10 ++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index df3196f72536..385a67c20956 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -48,6 +48,9 @@ #define NOC_QOS_MODEn_ADDR(n) (0xc + (n * 0x1000)) #define NOC_QOS_MODEn_MASK 0x3 +#define NOC_QOS_MODE_FIXED_VAL 0x0 +#define NOC_QOS_MODE_BYPASS_VAL 0x2 + static int qcom_icc_set_qnoc_qos(struct icc_node *src, u64 max_bw) { struct icc_provider *provider = src->provider; @@ -153,7 +156,7 @@ static int qcom_icc_set_noc_qos(struct icc_node *src, u64 max_bw) struct qcom_icc_provider *qp; struct qcom_icc_node *qn; struct icc_provider *provider; - u32 mode = NOC_QOS_MODE_BYPASS; + u32 mode = NOC_QOS_MODE_BYPASS_VAL; int rc = 0; qn = src->data; @@ -167,18 +170,17 @@ static int qcom_icc_set_noc_qos(struct icc_node *src, u64 max_bw) return 0; } - if (qn->qos.qos_mode != NOC_QOS_MODE_INVALID) - mode = qn->qos.qos_mode; - - if (mode == NOC_QOS_MODE_FIXED) { - dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", - qn->name); + if (qn->qos.qos_mode == NOC_QOS_MODE_FIXED) { + dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", qn->name); + mode = NOC_QOS_MODE_FIXED_VAL; rc = qcom_icc_noc_set_qos_priority(qp, &qn->qos); if (rc) return rc; - } else if (mode == NOC_QOS_MODE_BYPASS) { - dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", - qn->name); + } else if (qn->qos.qos_mode == NOC_QOS_MODE_BYPASS) { + dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", qn->name); + mode = NOC_QOS_MODE_BYPASS_VAL; + } else { + /* How did we get here? */ } return regmap_update_bits(qp->regmap, diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index a49af844ab13..8ba1918d7997 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -97,10 +97,12 @@ struct qcom_icc_desc { unsigned int qos_offset; }; -/* Valid for both NoC and BIMC */ -#define NOC_QOS_MODE_INVALID -1 -#define NOC_QOS_MODE_FIXED 0x0 -#define NOC_QOS_MODE_BYPASS 0x2 +/* Valid for all bus types */ +enum qos_mode { + NOC_QOS_MODE_INVALID = 0, + NOC_QOS_MODE_FIXED, + NOC_QOS_MODE_BYPASS, +}; int qnoc_probe(struct platform_device *pdev); int qnoc_remove(struct platform_device *pdev); From patchwork Tue Feb 14 14:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 653557 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 D5974C6379F for ; Tue, 14 Feb 2023 14:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233037AbjBNOiH (ORCPT ); Tue, 14 Feb 2023 09:38:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233062AbjBNOiF (ORCPT ); Tue, 14 Feb 2023 09:38:05 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B7623326 for ; Tue, 14 Feb 2023 06:38:04 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id dz21so5657990edb.13 for ; Tue, 14 Feb 2023 06:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xya4N6V99R7wqs6ZB8AIcG0kln00FcHSqxn/UQPegiI=; b=EiKX90X5fNy6Nz388HaVIX5jCbaMOoZ3lyT6vGA9izzswRrk84eWbViJSEZRmUi3Gi 94y1It23vgAqwGQrE+SSetmPTORcz56fR2R0M9eaYQCBQvNkJhYjvTertdPnMvx8FOaF ZO3A81QM2XO3zC+fxlBsNPt4K6WbqaRBQt+rtDWhogu+HfDqY94cDCtIflO9wcBXE3AU V2QMdZhRgU9e1+B41q2dyfzla/RAWLG5Kybd+Gae3ta2qdtZ+VOKPqldXktsVgYwKPeK /38J2E28nQig1q53uIa3Ug2maU0Mt/38e2RD5wO4egr0G6kYw3X4gnroRfE2pmHogOhB 8/tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xya4N6V99R7wqs6ZB8AIcG0kln00FcHSqxn/UQPegiI=; b=GmUqxDUCygAUsSUCGytvSlypezYZdzN9/2x1zmZ+eFTyO0Ov0aIiNfxVHqdj8UpwuE fBYdZksKhF85djw9bsh65fMbYhWuPckz/64hDMvC24oyMwO0kWapNgwMDCZt+5fLANfO 6fdXyl05DAsQ9cdNpRIbDiO5KBIl1SYCWjRttldcN//h8B/EW+lsYZvqz6x6oHAnXQOa W2tLzyCd9Ih8KA81nb1XuVb4EItV0yX/+5yWxIc/Jh6nab4A0694NchtQ4b4aRMzcGJ8 2ON3Y4igfvivf4dUwBG6Bv+J4lk+IUXXATXOwD31k93TJhKicM213cc5LbgFnJLE8AI0 hXMg== X-Gm-Message-State: AO0yUKVqwq2nJMjsMrN+mc8gzLHdssu3hlGVIZsJmzuRaOPFacTWnP+e gpNenbAN9bUd6oQtXlldYtSl/Jsufy+LlFIy X-Google-Smtp-Source: AK7set9+F319gWN9LYU+7iuxl9Jcf1eXJx0wdcHhLh+ez5xkj5LQywaE0O0LpQTkdbn1KdAjU7rXgw== X-Received: by 2002:a50:f690:0:b0:4aa:cc30:b858 with SMTP id d16-20020a50f690000000b004aacc30b858mr2817345edn.7.1676385482814; Tue, 14 Feb 2023 06:38:02 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:02 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/12] interconnect: qcom: Sort kerneldoc entries Date: Tue, 14 Feb 2023 15:37:11 +0100 Message-Id: <20230214143720.2416762-4-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Sort the kerneldoc entries the same way the struct members are sorted. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 8aed5400afda..21f440beda86 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -23,12 +23,12 @@ enum qcom_icc_type { /** * struct qcom_icc_provider - Qualcomm specific interconnect provider * @provider: generic interconnect provider - * @bus_clks: the clk_bulk_data table of bus clocks * @num_clks: the total number of clk_bulk_data entries * @type: the ICC provider type - * @qos_offset: offset to QoS registers * @regmap: regmap for QoS registers read/write access + * @qos_offset: offset to QoS registers * @bus_clk_rate: bus clock rate in Hz + * @bus_clks: the clk_bulk_data table of bus clocks */ struct qcom_icc_provider { struct icc_provider provider; From patchwork Tue Feb 14 14:37:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 653556 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 65BBCC6379F for ; Tue, 14 Feb 2023 14:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233115AbjBNOiM (ORCPT ); Tue, 14 Feb 2023 09:38:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbjBNOiI (ORCPT ); Tue, 14 Feb 2023 09:38:08 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3B222782 for ; Tue, 14 Feb 2023 06:38:06 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id bt8so11879919edb.12 for ; Tue, 14 Feb 2023 06:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AZQ+Q5LCAHKHQSgy3yl+J2ss+UfKNp2XcWG5M2noUQM=; b=v1ohS2cMmusUnrYLqFzah4WLvGW1n71og7wpUyBJLys2wk2hZ37taW+GANhe+QR4za 0DOvf593h4DgFfNJ5fm1jIIB2fv2GuheHbyghXCjW8TL7/uYRyTuIw5ed8ojxLQFC2ds Wk81OqgArmoTcFLX1m/MFZFds4Rwtgm6ULpmSvJUgMWev8DWEwm7ivnjU67SRAYf3Y79 rYXfJSYr3PBWFxv0+8fWEMpgXlxIMMbJ5Ta8ghlhxCoTwFqOnkomCbdIA8luwgMt7YVi r87gSLqRIZ6497Ws8SoZHf5BB2ezK2b02FfwIyCJSe+PQZ9ypqVSVEUygfkJbxZJgfwO f1Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AZQ+Q5LCAHKHQSgy3yl+J2ss+UfKNp2XcWG5M2noUQM=; b=FTIqshjA80oMTPsxXNdEJuHloWe+v3FI0IKjydLcHjA5qfi1+U3yIZ7XHOvj9qdtSD /QnshqSi81FHBJyz4jNDL+Pw42SB3EDfed7JoJoPvpuvNlq9LzSJhFPjhW47avss2S5z Cyx7eq/zLFjJskJFrFdjgzHQNTsJBoW+/i85rR0RJ3Vy4FldCD8ZboH4UKMKYuGjw1V3 DOjwCsBIt+fk152tyAd8+tOqOeWZAI8Nq3C3hNQWljYq1dqB6+6OOQAwubkPlbf8y+kt RlcInonBSVw9nIJOqjQ0/LJ0YFnMVhuJ0LEdXLEbl46mx40G217uexx4BfhNtxKddMdm 2zeQ== X-Gm-Message-State: AO0yUKUxeMi5RK9h3Si5j3XC3nnSFducZl6xOOode4ky7iEMJ8FJ2onl 5GHuGDyNawYMi2SDhE0VrewFTbNaCT5W/Ifc X-Google-Smtp-Source: AK7set9kDbCN3DytGLWPJni3E26eW299uOBWkxKbu8Z5m9InIIYQyiR0e0YmdoCHVdP31zxBqrCNdQ== X-Received: by 2002:a50:9ee7:0:b0:4aa:a390:bf4a with SMTP id a94-20020a509ee7000000b004aaa390bf4amr2987011edf.20.1676385485402; Tue, 14 Feb 2023 06:38:05 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:05 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/12] interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks Date: Tue, 14 Feb 2023 15:37:13 +0100 Message-Id: <20230214143720.2416762-6-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for handling non-scaling clocks that we still have to enable, rename num_clocks to more descriptive num_bus_clocks. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 14 +++++++------- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 37a299f4de6a..76e8f660b932 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -380,7 +380,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) return ret; } - for (i = 0; i < qp->num_clks; i++) { + for (i = 0; i < qp->num_bus_clks; i++) { /* * Use WAKE bucket for active clock, otherwise, use SLEEP bucket * for other clocks. If a platform doesn't set interconnect @@ -465,7 +465,7 @@ int qnoc_probe(struct platform_device *pdev) for (i = 0; i < cd_num; i++) qp->bus_clks[i].id = cds[i]; - qp->num_clks = cd_num; + qp->num_bus_clks = cd_num; qp->type = desc->type; qp->qos_offset = desc->qos_offset; @@ -495,11 +495,11 @@ int qnoc_probe(struct platform_device *pdev) } regmap_done: - ret = devm_clk_bulk_get_optional(dev, qp->num_clks, qp->bus_clks); + ret = devm_clk_bulk_get_optional(dev, qp->num_bus_clks, qp->bus_clks); if (ret) return ret; - ret = clk_bulk_prepare_enable(qp->num_clks, qp->bus_clks); + ret = clk_bulk_prepare_enable(qp->num_bus_clks, qp->bus_clks); if (ret) return ret; @@ -521,7 +521,7 @@ int qnoc_probe(struct platform_device *pdev) ret = icc_provider_add(provider); if (ret) { dev_err(dev, "error adding interconnect provider: %d\n", ret); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); return ret; } @@ -554,7 +554,7 @@ int qnoc_probe(struct platform_device *pdev) return 0; err: icc_nodes_remove(provider); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(provider); return ret; @@ -566,7 +566,7 @@ int qnoc_remove(struct platform_device *pdev) struct qcom_icc_provider *qp = platform_get_drvdata(pdev); icc_nodes_remove(&qp->provider); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(&qp->provider); return 0; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index d6b4c56bf02c..d4401f35f6d2 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -23,7 +23,7 @@ enum qcom_icc_type { /** * struct qcom_icc_provider - Qualcomm specific interconnect provider * @provider: generic interconnect provider - * @num_clks: the total number of clk_bulk_data entries + * @num_bus_clks: the total number of bus_clks clk_bulk_data entries * @type: the ICC provider type * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers @@ -32,7 +32,7 @@ enum qcom_icc_type { */ struct qcom_icc_provider { struct icc_provider provider; - int num_clks; + int num_bus_clks; enum qcom_icc_type type; struct regmap *regmap; unsigned int qos_offset; From patchwork Tue Feb 14 14:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 653555 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 F03DDC05027 for ; Tue, 14 Feb 2023 14:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233423AbjBNOiV (ORCPT ); Tue, 14 Feb 2023 09:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233252AbjBNOiP (ORCPT ); Tue, 14 Feb 2023 09:38:15 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC272B0B2 for ; Tue, 14 Feb 2023 06:38:08 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id bt8so11880128edb.12 for ; Tue, 14 Feb 2023 06:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LSHlBADaeK5eFrFjJgn2OtkHxC346mVqKTE4q7ml+Fw=; b=JOZ8rJWtYrzYeN0+rGbqI/wx8EuNL3DrY3GjN2dAlPM7z3Sb/R+cgOEkntfp6Y9Ix+ BiQDAp8wTkrzFkYjBT39wGovWXz6Rdob/U6aMFGB51hLaelvNuYW1tPz9c5MSennNG+9 STbVdcm8DctY2vEuMBi4C0Ws8CPKfzzaxGEttI/4trrjnZ9KEPRvv5v7mkP5WhIgQcSg ukU0vDm91gUQRdwujboW/Q0Gu5TTTqfPXPX4frBmtGIMfR08/H8h6LAOA4ZtP3PW5mgY se7pyyXBG9Uzr6FqUyZnBxw4NO+RdMugjo3jcZ5w1/mIabQOSKU5VMnVO+eIM4SjOMNM mRFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LSHlBADaeK5eFrFjJgn2OtkHxC346mVqKTE4q7ml+Fw=; b=8Mol2ADFXXqu1+sQDZPDrbtQgnNLsB7QiEbptpMX6rxWnosv+ZmCQ/pSg+YuRRhuPO Uj1Tz0rolyo8HXp9Zj/pXPqLU0jtlFd0MYdqgsALVT9hyj8xzIF+IGxFFUHbfB+zBNj/ yWDjpd7Vnezj1O8BVjVbmu5bup9iBnSnf57cTYYGa7/rr4fhx0bs7trk1ImlIloh+1Tk VRLJDI8+ttPCnJrBM6vm//0i4M1lsKcRvIWB1bNgOxuzZa8L3hXXFp1FX8bGrv8NLLT0 i5pLug1k16QUfjoYAQPr/wkI6Mi5JPXsmxGlfV8gxxAULTpiLg/OZbBCzAW7FGLJZYx8 Ke/A== X-Gm-Message-State: AO0yUKX3kYLlddv/Q/ohun1CH0U0nGtZWGvLSZtmJzHYw7aYED2AcL5U FvPQs6YV5ludntztGnmWjPpDLyxfeLG6Y9lt X-Google-Smtp-Source: AK7set9uuTJEmNmbrlKkvp5NQcZ4mib7QOYAsmrJV7OxGCpp3r1RJfIzRFqNDfbjKT6/dmMN6KRs7g== X-Received: by 2002:a50:8e4f:0:b0:4ac:d2b3:b724 with SMTP id 15-20020a508e4f000000b004acd2b3b724mr2581423edx.27.1676385488086; Tue, 14 Feb 2023 06:38:08 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:07 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/12] interconnect: qcom: icc-rpm: Allow negative num_bus_clocks Date: Tue, 14 Feb 2023 15:37:15 +0100 Message-Id: <20230214143720.2416762-8-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In some rare cases, buses will not have *any* bus-scaling clocks, which is "fine", as the voting can be done through RPM provided that the necessary QoS clocks are enabled. Allow specifying a negative (-1) number of clocks to make the driver accept such cases, without having to add a lot of boilerplate to all existing ICC drivers for SoCs with SMD RPM. FWIW this value was previously being assigned to a >>signed<< integer as well. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 729573f0d9fe..9dd631964b8c 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -96,7 +96,7 @@ struct qcom_icc_desc { struct qcom_icc_node * const *nodes; size_t num_nodes; const char * const *bus_clocks; - size_t num_bus_clocks; + int num_bus_clocks; const char * const *intf_clocks; size_t num_intf_clocks; bool has_bus_pd; From patchwork Tue Feb 14 14:37: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: 653554 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 46B9FC61DA4 for ; Tue, 14 Feb 2023 14:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233514AbjBNOig (ORCPT ); Tue, 14 Feb 2023 09:38:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233321AbjBNOiR (ORCPT ); Tue, 14 Feb 2023 09:38:17 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB45B2B605 for ; Tue, 14 Feb 2023 06:38:12 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id v13so17661285eda.11 for ; Tue, 14 Feb 2023 06:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4CEkCZ6M0V0rHXdhyITLeseCr9Rsf6DFLsvzd46ANmM=; b=n1aeZTy4RMrg+Tgm5UPefjlZ3SkYZ64uuw44avuzcjWhCTmV8yAe23ueUB4bJGFDlb Q9tUOxHYuiOil4iVbBdIMWNlj4wNPWkCOBNYLPsFeWZBHos4qN8yGb0QAbGKtqwo988g 7mXXYygMO3Od9lvS2jrVDch/qpr5JwYJ5TvVQE16bggIfDI7Q8z/+bz13TJVLpXX5zAm mtjjeAY+lFIPMDuqefLcFrIZUM9qGJcbCq5gbzzG5Ia03xzWriNuHS8Ih8hBDH8TrOqX LLJ6qPnCE9MtpZhQdWoO8q2bV6p3WJUPkowU9P/eWS089+UEaGCgwgQSX0MUt7oYJBJ8 uUyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4CEkCZ6M0V0rHXdhyITLeseCr9Rsf6DFLsvzd46ANmM=; b=FAeq0p2pKlj+XqwAJ404nzYtbZeFmV7QfD0yvfoRmiEFB+xuTagS7BEcJpxNVVW8hH dlG8JVB+5HlVdj+aaZtRuNBr74nRAnUMZucErenLBuKiQTHJT7o74QpIZd9rXVv7T4rT WlErtMSBlaWWj7JLuSVWRTFapQxugwA9xayz9+e6dr0xSWrUG+ia96YGCsqvXf5//lKW et5pCZ2f9dzEyeFKRvXFKhENz3w5La1pr4kGTV7WvffvHzzAzXXFie/vLZTB7MpSBGVK GyDKOh2Cy45T1bOGxUH2sti3iVxJIL35S24R5DbiOn9E4K33zvZ5vq2+kRXimF6VJfpT zwzA== X-Gm-Message-State: AO0yUKWolcvyerTP6KmTcWkUUb5fuiBL+pG+ftFO+Y4H0U7AaggybGKi tEMWl8YNyb3cuwoYgbtOnkAqSTDRPk4Xztek X-Google-Smtp-Source: AK7set+Eaxs7wodwqIB4zDVySQzPvUzm9h+or6cuR9nyCbqpnBb1PZWk3UCQ2hcu8XGZ3a4NsGGUaw== X-Received: by 2002:a50:9b03:0:b0:4aa:a9c7:4224 with SMTP id o3-20020a509b03000000b004aaa9c74224mr2981618edi.30.1676385492095; Tue, 14 Feb 2023 06:38:12 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:11 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/12] interconnect: qcom: msm8996: Promote to core_initcall Date: Tue, 14 Feb 2023 15:37:18 +0100 Message-Id: <20230214143720.2416762-11-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The interconnect driver is (or soon will be) vital to many other devices, as it's not a given that the bootloader will set up enough bandwidth for us or that the values we come into are reasonable. Promote the driver to core_initcall to ensure the consumers (i.e. most "meaningful" parts of the SoC) can probe without deferrals. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/msm8996.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 45eb8675fb11..0e0395328dc7 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -2109,7 +2109,17 @@ static struct platform_driver qnoc_driver = { .sync_state = icc_sync_state, } }; -module_platform_driver(qnoc_driver); +static int __init qnoc_driver_init(void) +{ + return platform_driver_register(&qnoc_driver); +} +core_initcall(qnoc_driver_init); + +static void __exit qnoc_driver_exit(void) +{ + platform_driver_unregister(&qnoc_driver); +} +module_exit(qnoc_driver_exit); MODULE_AUTHOR("Yassine Oudjana "); MODULE_DESCRIPTION("Qualcomm MSM8996 NoC driver"); From patchwork Tue Feb 14 14:37: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: 653553 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 5EBA3C61DA4 for ; Tue, 14 Feb 2023 14:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbjBNOik (ORCPT ); Tue, 14 Feb 2023 09:38:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbjBNOiV (ORCPT ); Tue, 14 Feb 2023 09:38:21 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27216241EB for ; Tue, 14 Feb 2023 06:38:13 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id dz21so5658780edb.13 for ; Tue, 14 Feb 2023 06:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z33GhR/weoldfPdNFE3B9Pq21vIvD0pApq29v3a6yUs=; b=ySmYQIamqXyQQfy3KF5JJo0QF9heP7EPzSm33XZvcY0zurxbqNpafTiodrXwZJ5Un3 cTdSvwCm3Dt0QcrvvunDa6uEEGaOxHULrDexGmPLQdJZiaQmkQVrad7Y6x6ApKvhtaXm h+dXLgBx4NsrGwZTNoQPLK4YZiOHEZ6LREWIbEFgxiNVlGkwX279n5UlVuYBxt5MdA45 7YUfU8augui2eVwpzvGzVN7KlEWmogok3N3MwrETTutz9PNk5ag4PHxjKKpiaEXpyYZl 56gB8EKMPk7hbcPwxHvDTh8bveEKbORbjPAdVAeUyOi6QOglUL8dv9iLntvYL/zhon9G A5pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z33GhR/weoldfPdNFE3B9Pq21vIvD0pApq29v3a6yUs=; b=VLLz46bhPQxT0nHQigeDcToXj/KnK7Sx8qIqBIlsojX6DOYiRyJ8MyuFH3BdGdcR1J sPVpFyNrMmr/0Xra4LDPEVB78EgjL/I5KzHz5IwX9XMLWn9c/5ZKC2bSP+teWPqIgNym cieI8rhO01kzXEFVYe269SqOv7ic3mRZ4HOw1+dRD3VKmBnFXq1OnL0FLkzscukw7cyO snYTEW6vBzJESDbVRSPQnAkG2jUCRsLpkyTQp8rev++0hdm5nQpuTqf7w7uCs2oWn3vy jnBqDL4VrlSZCTH0t4aye9kbSHrnDWu35M6e1hO0BM932PJbrdoMC3OnnHL7QDH6R8Dk qt0Q== X-Gm-Message-State: AO0yUKVde26Z/burHhtin/o1M5z/Zuvc/JswNWsYiW0zNB8I0XsSTD9o aImyh63cEL15OGoyKyNRy+x+pougyS3U6RYy X-Google-Smtp-Source: AK7set80uxf5pBfbb6lc75dlj4UDVpPHnvDxery5QD784awKrXQ28xl7ODeSqSqe2+QkaJ3B1/QA+w== X-Received: by 2002:a50:9508:0:b0:4ab:4bf9:a10f with SMTP id u8-20020a509508000000b004ab4bf9a10fmr2741874eda.30.1676385493381; Tue, 14 Feb 2023 06:38:13 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:13 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 11/12] interconnect: qcom: icc-rpm: Introduce keep_alive Date: Tue, 14 Feb 2023 15:37:19 +0100 Message-Id: <20230214143720.2416762-12-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The downstream kernel employs the concept of "keeping the bus alive" by voting for the minimum (XO/19.2MHz) rate at all times on certain (well, most) buses. This is a very important thing to have, as if we either have a lackluster/wrong DT that doesn't specify a (high enough) vote on a certain bus, we may lose access to the entire bus altogether. This is very apparent when we only start introducing interconnect support on a given platform and haven't yet introduced voting on all peripherals. The same can happen if we only have a single driver casting a vote on a certain bus and that driver exits/crashes/suspends. The keepalive vote is limited to the ACTIVE bucket, as keeping a permanent vote on the SLEEP one could prevent the platform from properly entering low power mode states. Introduce the very same concept, with a slight twist: the vendor kernel checks whether the rate is zero before setting the minimum vote, but that's rather silly, as in doing so we're at the mercy of CCF. Instead, explicitly clamp the rates to always be >= 19.2 MHz for providers with keep_alive=true. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 10 ++++++++++ drivers/interconnect/qcom/icc-rpm.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index c1954584d6f0..88cad71688ec 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -51,6 +51,8 @@ #define NOC_QOS_MODE_FIXED_VAL 0x0 #define NOC_QOS_MODE_BYPASS_VAL 0x2 +#define ICC_BUS_CLK_MIN_RATE 19200000ULL + static int qcom_icc_set_qnoc_qos(struct icc_node *src, u64 max_bw) { struct icc_provider *provider = src->provider; @@ -397,6 +399,13 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) do_div(rate, src_qn->buswidth); rate = min_t(u64, rate, LONG_MAX); + /* + * Downstream checks whether the requested rate is zero, but it makes little sense + * to vote for a value that's below the lower threshold, so let's not do so. + */ + if (bucket == QCOM_ICC_BUCKET_WAKE && qp->keep_alive) + qp->bus_clk_rate[i] = max(ICC_BUS_CLK_MIN_RATE, qp->bus_clk_rate[i]); + if (qp->bus_clk_rate[i] == rate) continue; @@ -482,6 +491,7 @@ int qnoc_probe(struct platform_device *pdev) qp->bus_clks[i].id = cds[i]; qp->num_bus_clks = cd_num; + qp->keep_alive = desc->keep_alive; qp->type = desc->type; qp->qos_offset = desc->qos_offset; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 9dd631964b8c..77e263b93c27 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -29,6 +29,7 @@ enum qcom_icc_type { * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers * @bus_clk_rate: bus clock rate in Hz + * @keep_alive: whether to always keep a minimum vote on the bus clocks * @bus_clks: the clk_bulk_data table of bus clocks * @intf_clks: the clk_bulk_data table of interface clocks */ @@ -40,6 +41,7 @@ struct qcom_icc_provider { struct regmap *regmap; unsigned int qos_offset; u64 bus_clk_rate[2]; + bool keep_alive; struct clk_bulk_data bus_clks[2]; struct clk_bulk_data intf_clks[]; }; @@ -100,6 +102,7 @@ struct qcom_icc_desc { const char * const *intf_clocks; size_t num_intf_clocks; bool has_bus_pd; + bool keep_alive; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; unsigned int qos_offset;