Skip to content

Commit

Permalink
bwmon v3
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
  • Loading branch information
krzk committed May 24, 2022
1 parent 55cd7b9 commit 3cd6e62
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/soc/qcom/icc-bwmon.c
Expand Up @@ -173,18 +173,18 @@ static void bwmon_start(struct icc_bwmon *bwmon,
data->default_lowbw_kbps);

thres_count = data->zone3_thres_count << BWMON_THRESHOLD_COUNT_ZONE3_SHIFT |
BWMON_THRESHOLD_COUNT_ZONE2_DEFAULT << BWMON_THRESHOLD_COUNT_ZONE2_SHIFT |
data->zone1_thres_count << BWMON_THRESHOLD_COUNT_ZONE1_SHIFT |
BWMON_THRESHOLD_COUNT_ZONE0_DEFAULT;
BWMON_THRESHOLD_COUNT_ZONE2_DEFAULT << BWMON_THRESHOLD_COUNT_ZONE2_SHIFT |
data->zone1_thres_count << BWMON_THRESHOLD_COUNT_ZONE1_SHIFT |
BWMON_THRESHOLD_COUNT_ZONE0_DEFAULT;
writel_relaxed(thres_count, bwmon->base + BWMON_THRESHOLD_COUNT);
writel_relaxed(BWMON_ZONE_ACTIONS_DEFAULT,
bwmon->base + BWMON_ZONE_ACTIONS);

/* Write barriers in bwmon_clear() */
irq_enable = BIT(BWMON_IRQ_ENABLE_ZONE1_SHIFT) |
BIT(BWMON_IRQ_ENABLE_ZONE3_SHIFT);
BIT(BWMON_IRQ_ENABLE_ZONE3_SHIFT);
bwmon_clear(bwmon);
bwmon_enable(bwmon, irq_enable);
bwmon_enable(bwmon, BWMON_IRQ_ENABLE_MASK);
}

static irqreturn_t bwmon_intr(int irq, void *dev_id)
Expand All @@ -195,12 +195,16 @@ static irqreturn_t bwmon_intr(int irq, void *dev_id)

status = readl(bwmon->base + BWMON_IRQ_STATUS);

if (status & (~BWMON_IRQ_ENABLE_MASK))
pr_err("AAA different interrupt: 0x%x\n", status);
status &= BWMON_IRQ_ENABLE_MASK;

if (!status)
return IRQ_NONE;

bwmon_disable(bwmon);

zone = get_bitmask_order(status >> 4) - 1;
zone = get_bitmask_order(status >> BWMON_IRQ_STATUS_ZONE_SHIFT) - 1;
max = readl(bwmon->base + BWMON_ZONE_MAX(zone)) * SZ_1K;
bwmon->target_kbps = mult_frac(max, MSEC_PER_SEC, bwmon->sample_ms);

Expand Down

0 comments on commit 3cd6e62

Please sign in to comment.