Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81f5f00f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "PM / devfreq: bw_hwmon: Fix handling of max_mbps"

parents 0f1ae05d 379754d5
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -220,9 +220,10 @@ static int __bw_hwmon_sample_end(struct bw_hwmon *hwmon)
	 * bandwidth usage and do the bandwidth calculation based on just
	 * this micro sample.
	 */
	if (mbps > node->up_wake_mbps)
	if (mbps > node->up_wake_mbps) {
		wake = UP_WAKE;
	else if (mbps < node->down_wake_mbps) {
	} else if (mbps < node->down_wake_mbps) {
		if (node->down_cnt)
			node->down_cnt--;
		if (node->down_cnt <= 0)
			wake = DOWN_WAKE;
@@ -337,15 +338,6 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
	if (node->wake == UP_WAKE) {
		req_mbps += ((meas_mbps - node->prev_req)
				* node->up_scale) / 100;
		/*
		 * Don't drop below max_mbps which caused the UP_WAKE if
		 * down_thres is enabled. This is functionally equivalent of
		 * two adjacent decision windows overlapping by one short
		 * sample window when an UP_WAKE happens.
		 */
		node->max_mbps = meas_mbps;
		node->down_cnt = node->down_count;

		/*
		 * However if the measured load is less than the historic
		 * peak, but the over request is higher than the historic
@@ -357,13 +349,6 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
			req_mbps = node->hist_max_mbps;

		req_mbps = min(req_mbps, meas_mbps_zone);
	} else {
		/*
		 * We want to quickly drop the vote only if we are
		 * over-voting (UP_WAKE). So, effectively disable it for all
		 * other cases by setting it to a very large value.
		 */
		node->down_cnt = INT_MAX;
	}

	hyst_lo_tol = (node->hyst_mbps * HIST_PEAK_TOL) / 100;
@@ -420,6 +405,7 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
		node->down_wake_mbps = (meas_mbps * node->down_thres) / 100;
		thres = mbps_to_bytes(meas_mbps, node->sample_ms);
	}
	node->down_cnt = node->down_count;

	node->bytes = hw->set_thres(hw, thres);