Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp432939imn; Thu, 28 Jul 2022 05:22:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v78ni54m9V+g/f9tKTFXg08cJ0KMnLI6lSQevV/0Tq2yUoZEGIFdbg6ChlhNAbMBJWLu7W X-Received: by 2002:a05:6402:444c:b0:43b:d375:e932 with SMTP id o12-20020a056402444c00b0043bd375e932mr27270921edb.399.1659010922403; Thu, 28 Jul 2022 05:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659010922; cv=none; d=google.com; s=arc-20160816; b=zXWasNTosuCq2jzfS7Qys9RY5nRXc0ml+UmrSBBWaImLGs51eUNzXShE0QFYd2qtoo LxbbUowIdgqLwQ3uSSdLAJ1YuZ6RayaK42JAdMbRjMP93uim1A3AkxF7Ny/+9FUPjQvp 1M2GA/Meh/z5VuBW0q/iV65t+0Jas6q+DPkuj4vAU5hZHl3q2zMtWNaZT6ZwFZIkZ2aN pd7Yz15HZdKuWVw1kP4bkmzW8RZqyrE0nyuhQ9Sr/SO/moAYJfsRvcewdSfi1J7EFcnY e4eeX4tOTErEOt6UOC7w+fOl22qqfepyitjTyPfqbAPOvV7ifHoM0j03Uw8OVpoIqxin unBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9vUNSXhigYPL6YxGm2dwwRSYcJw5sLrH/ALUNKD6VII=; b=PrsOWn98Rya9nIAPdch2D+mx2pye4/akepFEjOgKuoUutAqn56N1He74NRixTcdUu9 QBVtpg9xfa0dbzcs+XyBNHaOz1DFN6sAhTmRh5tOap/S4u51uylWety194aoU5mRRfHP FII1Eqf+jQ21UKKfAp5Jp/CeHAAOPfz1ts8/PKhcwTuxO02+rOdmT4MiL5qBX0/yufB3 /qJcUCmn6tWJwTswSZo1atQIdXuTeVz5r+CKFUlt86F8RjHHKHmvMbORj/6E3lm3Ut7V 12QLTNw3nESiorDWTRs63DhgdxsDwF5yMh3hBUwCRjcLT9DZOgp+3mmIQecsNxr31IC/ Jo3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XOJMgXpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a05640205c800b0043a6efbaaa4si701215edx.301.2022.07.28.05.21.35; Thu, 28 Jul 2022 05:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XOJMgXpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236889AbiG1Lif (ORCPT + 99 others); Thu, 28 Jul 2022 07:38:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236879AbiG1LiX (ORCPT ); Thu, 28 Jul 2022 07:38:23 -0400 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 5CFE254CB9 for ; Thu, 28 Jul 2022 04:38:06 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id p10so2401327lfd.9 for ; Thu, 28 Jul 2022 04:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9vUNSXhigYPL6YxGm2dwwRSYcJw5sLrH/ALUNKD6VII=; b=XOJMgXpybulWrGv5BYGON9YiSnqxYrtIhsPEE+fdCvYm4cnp9bW1DaJLQ28XQgv4ni EZk+yYNnqO5zKpqfWWXOALRzrf3oUbkeLn0tbg5/CZ9zZISzsGjwgvIzFd8SBLDWWFTX nIp3ZdQqWOQDptA/nD+d7UzCtI0IODyRcLUw5qEnMZTNWA1zzFGT8xFQqvXtqdvpxL9c A5kwEiE2hC1Y2l0TDjnzAlmRinEWBOef8+x5pcpSsZXfEOXS3buN/LhBsMUMbe8JnqRO lZvqUe3A03W8cUTUjAEXApqkBZ9al4aMPKVYqRYZGunHGwnwBvPWuGzL4GX27NT6I0xm BRcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9vUNSXhigYPL6YxGm2dwwRSYcJw5sLrH/ALUNKD6VII=; b=ZwmOzTSnzf4RWXBuwp+2Qkw4/7ViVKJBT4gMg3EmVIGA6OTIzDKcG2hkLFa1Vw6m3O T07zJL/Icx67HLwAaMSbBnK34ophUC6VBUkES3InToaMmkKOsKBJ8JsTjgQBQVtFZMcz s/LoTFIa1TyxLmsN331eJgt7rG3tcT0bvfXSEmwr9gX0xEEpyxDJJOyGc99CcMgl4LCw +EWnSwNo335UA8JxC5GLjVM4e5z1i8XgfzHg5pQM8KgzcaYecFn2kHxBmz65C31+UrGI 4q0T45y1ewLoPm7EYjJqf/uKjhhSLdGUdYQvRgjyF1ieKxiHauNcy/029Rdwz496IfE6 LFtw== X-Gm-Message-State: AJIora+IQ3uf7CPk9XbxLIVTG6ZkD8hcxtDHeixmAxm8vOO5JRi7VvdL IldjmHPHG4Dbk0ZEm4bMRW3mzw== X-Received: by 2002:ac2:484c:0:b0:48a:7a62:6dd3 with SMTP id 12-20020ac2484c000000b0048a7a626dd3mr10869205lfy.455.1659008284090; Thu, 28 Jul 2022 04:38:04 -0700 (PDT) Received: from krzk-bin.lan (78-26-46-173.network.trollfjord.no. [78.26.46.173]) by smtp.gmail.com with ESMTPSA id l12-20020a2ea80c000000b0025e0396786dsm98192ljq.93.2022.07.28.04.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 04:38:03 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Konrad Dybcio , Georgi Djakov , Rob Herring , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rajendra Nayak , Sibi Sankar Subject: [PATCH v2 08/11] soc: qcom: icc-bwmon: add per-variant quirks Date: Thu, 28 Jul 2022 13:37:45 +0200 Message-Id: <20220728113748.170548-9-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220728113748.170548-1-krzysztof.kozlowski@linaro.org> References: <20220728113748.170548-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BWMON v5 lacks global interrupt registers. Other BWMON versions differ as well, so add quirks for easier customization of code flow. Cc: Rajendra Nayak Cc: Sibi Sankar Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/icc-bwmon.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c index 058c35d8dbbe..2e4a0fdfbf54 100644 --- a/drivers/soc/qcom/icc-bwmon.c +++ b/drivers/soc/qcom/icc-bwmon.c @@ -100,6 +100,9 @@ #define BWMON_V4_ZONE_MAX(zone) (0x2e0 + 4 * (zone)) +/* Quirks for specific BWMON types */ +#define BWMON_HAS_GLOBAL_IRQ BIT(0) + enum bwmon_fields { F_GLOBAL_IRQ_CLEAR, F_GLOBAL_IRQ_ENABLE, @@ -136,6 +139,7 @@ struct icc_bwmon_data { unsigned int default_lowbw_kbps; u8 zone1_thres_count; u8 zone3_thres_count; + unsigned int quirks; const struct regmap_config *regmap_cfg; const struct reg_field *regmap_fields; @@ -270,14 +274,16 @@ static void bwmon_clear_irq(struct icc_bwmon *bwmon) * interrupt is cleared. */ regmap_field_force_write(bwmon->regs[F_IRQ_CLEAR], BWMON_IRQ_ENABLE_MASK); - regmap_field_force_write(bwmon->regs[F_GLOBAL_IRQ_CLEAR], - BWMON_V4_GLOBAL_IRQ_ENABLE_ENABLE); + if (bwmon->data->quirks & BWMON_HAS_GLOBAL_IRQ) + regmap_field_force_write(bwmon->regs[F_GLOBAL_IRQ_CLEAR], + BWMON_V4_GLOBAL_IRQ_ENABLE_ENABLE); } static void bwmon_disable(struct icc_bwmon *bwmon) { /* Disable interrupts. Strict ordering, see bwmon_clear_irq(). */ - regmap_field_write(bwmon->regs[F_GLOBAL_IRQ_ENABLE], 0x0); + if (bwmon->data->quirks & BWMON_HAS_GLOBAL_IRQ) + regmap_field_write(bwmon->regs[F_GLOBAL_IRQ_ENABLE], 0x0); regmap_field_write(bwmon->regs[F_IRQ_ENABLE], 0x0); /* @@ -290,8 +296,9 @@ static void bwmon_disable(struct icc_bwmon *bwmon) static void bwmon_enable(struct icc_bwmon *bwmon, unsigned int irq_enable) { /* Enable interrupts */ - regmap_field_write(bwmon->regs[F_GLOBAL_IRQ_ENABLE], - BWMON_V4_GLOBAL_IRQ_ENABLE_ENABLE); + if (bwmon->data->quirks & BWMON_HAS_GLOBAL_IRQ) + regmap_field_write(bwmon->regs[F_GLOBAL_IRQ_ENABLE], + BWMON_V4_GLOBAL_IRQ_ENABLE_ENABLE); regmap_field_write(bwmon->regs[F_IRQ_ENABLE], irq_enable); /* Enable bwmon */ @@ -543,6 +550,7 @@ static const struct icc_bwmon_data msm8998_bwmon_data = { .default_lowbw_kbps = 0, .zone1_thres_count = 16, .zone3_thres_count = 1, + .quirks = BWMON_HAS_GLOBAL_IRQ, .regmap_fields = msm8998_bwmon_reg_fields, .regmap_cfg = &msm8998_bwmon_regmap_cfg, }; -- 2.34.1