mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
PM / devfreq: bw_hwmon: Add support for configuring byte MID match
Add support to configure the byte MID match value from DT. Change-Id: I5848aef98f15c6de9fe0fae0a1188a17810a5ef5 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> [avajid@codeaurora.org: made minor styling changes] Signed-off-by: Amir Vajid <avajid@codeaurora.org>
This commit is contained in:
parent
0dd9e33079
commit
d6ee9c7aa6
1 changed files with 29 additions and 0 deletions
|
|
@ -56,6 +56,8 @@
|
|||
#define MON3_INT_STATUS_MASK 0x0F
|
||||
#define MON3_EN(m) ((m)->base + 0x10)
|
||||
#define MON3_CLEAR(m) ((m)->base + 0x14)
|
||||
#define MON3_MASK(m) ((m)->base + 0x18)
|
||||
#define MON3_MATCH(m) ((m)->base + 0x1C)
|
||||
#define MON3_SW(m) ((m)->base + 0x20)
|
||||
#define MON3_THRES_HI(m) ((m)->base + 0x24)
|
||||
#define MON3_THRES_MED(m) ((m)->base + 0x28)
|
||||
|
|
@ -94,6 +96,8 @@ struct bwmon {
|
|||
u32 throttle_adj;
|
||||
u32 sample_size_ms;
|
||||
u32 intr_status;
|
||||
u32 byte_mask;
|
||||
u32 byte_match;
|
||||
};
|
||||
|
||||
#define to_bwmon(ptr) container_of(ptr, struct bwmon, hw)
|
||||
|
|
@ -723,6 +727,25 @@ static irqreturn_t bwmon_intr_thread(int irq, void *dev)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static __always_inline
|
||||
void mon_set_byte_count_filter(struct bwmon *m, enum mon_reg_type type)
|
||||
{
|
||||
if (!m->byte_mask)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case MON1:
|
||||
case MON2:
|
||||
writel_relaxed(m->byte_mask, MON_MASK(m));
|
||||
writel_relaxed(m->byte_match, MON_MATCH(m));
|
||||
break;
|
||||
case MON3:
|
||||
writel_relaxed(m->byte_mask, MON3_MASK(m));
|
||||
writel_relaxed(m->byte_match, MON3_MATCH(m));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static __always_inline int __start_bw_hwmon(struct bw_hwmon *hw,
|
||||
unsigned long mbps, enum mon_reg_type type)
|
||||
{
|
||||
|
|
@ -774,6 +797,7 @@ static __always_inline int __start_bw_hwmon(struct bw_hwmon *hw,
|
|||
writel_relaxed(zone_actions, MON3_ZONE_ACTIONS(m));
|
||||
}
|
||||
|
||||
mon_set_byte_count_filter(m, type);
|
||||
mon_irq_clear(m, type);
|
||||
mon_irq_enable(m, type);
|
||||
mon_enable(m, type);
|
||||
|
|
@ -1052,6 +1076,11 @@ static int bimc_bwmon_driver_probe(struct platform_device *pdev)
|
|||
break;
|
||||
}
|
||||
|
||||
of_property_read_u32(dev->of_node, "qcom,byte-mid-match",
|
||||
&m->byte_match);
|
||||
of_property_read_u32(dev->of_node, "qcom,byte-mid-mask",
|
||||
&m->byte_mask);
|
||||
|
||||
if (m->spec->throt_adj) {
|
||||
m->hw.set_throttle_adj = mon_set_throttle_adj;
|
||||
m->hw.get_throttle_adj = mon_get_throttle_adj;
|
||||
|
|
|
|||
Loading…
Reference in a new issue