All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sibi Sankar <quic_sibis@quicinc.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"Konrad Dybcio" <konrad.dybcio@somainline.org>,
	Georgi Djakov <djakov@kernel.org>,
	Rob Herring <robh+dt@kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Rajendra Nayak <quic_rjendra@quicinc.com>
Subject: Re: [PATCH 06/10] soc: qcom: icc-bwmon: store count unit per variant
Date: Tue, 26 Jul 2022 17:07:44 +0530	[thread overview]
Message-ID: <76e12c2c-648a-8def-f0e4-5606d52a7ad6@quicinc.com> (raw)
In-Reply-To: <20220720192807.130098-7-krzysztof.kozlowski@linaro.org>



On 7/21/22 12:58 AM, Krzysztof Kozlowski wrote:
> Versions v4 and v5 of BWMON on SDM845 use different unit count, so allow
> easier variant customization by storing its value in struct
> icc_bwmon_data.
> 
> Cc: Rajendra Nayak <quic_rjendra@quicinc.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>

> ---
>   drivers/soc/qcom/icc-bwmon.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
> index dcd445af6488..9a99e0fd1140 100644
> --- a/drivers/soc/qcom/icc-bwmon.c
> +++ b/drivers/soc/qcom/icc-bwmon.c
> @@ -104,12 +104,11 @@
>   #define BWMON_THRESHOLD_COUNT_ZONE0_DEFAULT	0xff
>   #define BWMON_THRESHOLD_COUNT_ZONE2_DEFAULT	0xff
>   
> -/* BWMONv4 count registers use count unit of 64 kB */
> -#define BWMON_COUNT_UNIT_KB			64
>   #define BWMON_ZONE_MAX(zone)			(0x2e0 + 4 * (zone))
>   
>   struct icc_bwmon_data {
>   	unsigned int sample_ms;
> +	unsigned int count_unit_kb; /* kbytes */
>   	unsigned int default_highbw_kbps;
>   	unsigned int default_medbw_kbps;
>   	unsigned int default_lowbw_kbps;
> @@ -193,9 +192,10 @@ static void bwmon_enable(struct icc_bwmon *bwmon, unsigned int irq_enable)
>   	writel(BWMON_ENABLE_ENABLE, bwmon->base + BWMON_ENABLE);
>   }
>   
> -static unsigned int bwmon_kbps_to_count(unsigned int kbps)
> +static unsigned int bwmon_kbps_to_count(struct icc_bwmon *bwmon,
> +					unsigned int kbps)
>   {
> -	return kbps / BWMON_COUNT_UNIT_KB;
> +	return kbps / bwmon->data->count_unit_kb;
>   }
>   
>   static void bwmon_set_threshold(struct icc_bwmon *bwmon, unsigned int reg,
> @@ -203,8 +203,8 @@ static void bwmon_set_threshold(struct icc_bwmon *bwmon, unsigned int reg,
>   {
>   	unsigned int thres;
>   
> -	thres = mult_frac(bwmon_kbps_to_count(kbps), bwmon->data->sample_ms,
> -			  MSEC_PER_SEC);
> +	thres = mult_frac(bwmon_kbps_to_count(bwmon, kbps),
> +			  bwmon->data->sample_ms, MSEC_PER_SEC);
>   	writel_relaxed(thres, bwmon->base + reg);
>   }
>   
> @@ -270,7 +270,7 @@ static irqreturn_t bwmon_intr(int irq, void *dev_id)
>   	 * downstream) always increments the max bytes count by one.
>   	 */
>   	max = readl(bwmon->base + BWMON_ZONE_MAX(zone)) + 1;
> -	max *= BWMON_COUNT_UNIT_KB;
> +	max *= bwmon->data->count_unit_kb;
>   	bwmon->target_kbps = mult_frac(max, MSEC_PER_SEC, bwmon->data->sample_ms);
>   
>   	return IRQ_WAKE_THREAD;
> @@ -394,6 +394,7 @@ static int bwmon_remove(struct platform_device *pdev)
>   /* BWMON v4 */
>   static const struct icc_bwmon_data msm8998_bwmon_data = {
>   	.sample_ms = 4,
> +	.count_unit_kb = 64,
>   	.default_highbw_kbps = 4800 * 1024, /* 4.8 GBps */
>   	.default_medbw_kbps = 512 * 1024, /* 512 MBps */
>   	.default_lowbw_kbps = 0,
> 

  reply	other threads:[~2022-07-26 11:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 19:27 [PATCH 00/10] soc/arm64: qcom: Add LLCC BWMON on SDM845 Krzysztof Kozlowski
2022-07-20 19:27 ` [PATCH 01/10] dt-bindings: interconnect: qcom,msm8998-bwmon: add support for SDM845 LLCC BWMON Krzysztof Kozlowski
2022-07-25 22:32   ` Rob Herring
2022-07-26 11:19   ` Sibi Sankar
2022-07-20 19:27 ` [PATCH 02/10] soc: qcom: icc-bwmon: re-use IRQ enable/clear define Krzysztof Kozlowski
2022-07-26 11:20   ` Sibi Sankar
2022-07-20 19:28 ` [PATCH 03/10] soc: qcom: icc-bwmon: drop unused BWMON_ZONE_COUNT Krzysztof Kozlowski
2022-07-26 11:25   ` Sibi Sankar
2022-07-26 13:29     ` Krzysztof Kozlowski
2022-07-20 19:28 ` [PATCH 04/10] soc: qcom: icc-bwmon: store reference to varian data in container Krzysztof Kozlowski
2022-07-26 11:28   ` Sibi Sankar
2022-07-20 19:28 ` [PATCH 05/10] soc: qcom: icc-bwmon: clear all registers on init Krzysztof Kozlowski
2022-07-20 19:28 ` [PATCH 06/10] soc: qcom: icc-bwmon: store count unit per variant Krzysztof Kozlowski
2022-07-26 11:37   ` Sibi Sankar [this message]
2022-07-20 19:28 ` [PATCH 07/10] soc: qcom: icc-bwmon: use regmap and prepare for BWMON v5 Krzysztof Kozlowski
2022-07-20 19:28 ` [PATCH 08/10] soc: qcom: icc-bwmon: add per-variant quirks Krzysztof Kozlowski
2022-07-20 19:28 ` [PATCH 09/10] soc: qcom: icc-bwmon: add support for SDM845 LLCC BWMON Krzysztof Kozlowski
2022-07-20 19:28 ` [PATCH 10/10] arm64: dts: qcom: sdm845: add " Krzysztof Kozlowski
2022-07-22  1:22   ` Steev Klimaszewski
2022-07-22 17:30     ` Krzysztof Kozlowski
2022-07-23  0:29       ` Steev Klimaszewski
2022-07-23  2:37         ` Steev Klimaszewski
2022-07-23  8:36           ` Krzysztof Kozlowski
2022-07-26 11:31             ` Sibi Sankar
2022-07-26 12:01               ` Sibi Sankar
2022-07-26 13:49                 ` Krzysztof Kozlowski
2022-07-26 15:15               ` Steev Klimaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76e12c2c-648a-8def-f0e4-5606d52a7ad6@quicinc.com \
    --to=quic_sibis@quicinc.com \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=quic_rjendra@quicinc.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.