diff --git a/drivers/devfreq/bimc-bwmon.c b/drivers/devfreq/bimc-bwmon.c index cbe35fb6e97b..68d31ca738a9 100644 --- a/drivers/devfreq/bimc-bwmon.c +++ b/drivers/devfreq/bimc-bwmon.c @@ -32,6 +32,13 @@ #define MON_MASK(m) ((m)->base + 0x298) #define MON_MATCH(m) ((m)->base + 0x29C) +/* + * Don't set the threshold lower than this value. This helps avoid + * threshold IRQs when the traffic is close to zero and even small + * changes can exceed the threshold percentage. + */ +#define FLOOR_MBPS 100UL + struct bwmon_spec { bool wrap_on_thres; bool overflow; @@ -195,7 +202,7 @@ static unsigned long meas_bw_and_set_irq(struct bw_hwmon *hw, * multiple times before the IRQ is processed. */ if (likely(!m->spec->wrap_on_thres)) - limit = mbps_to_bytes(mbps, sample_ms, tol); + limit = mbps_to_bytes(max(mbps, FLOOR_MBPS), sample_ms, tol); else limit = mbps_to_bytes(max(mbps, 400UL), sample_ms, tol);