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

Commit 74fd4e30 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB:dwc3-msm: Don't schedule work if pm_qos_latency is zero



Currently driver is scheduling pm_qos_work again even though
pm_qos_latency is not passed from dts file. Add a check for
pm_qos_latency and don't schedule work if pm_qos_latency value
is zero. Also remove use of static variable for last_irq_count and
add the variable for the same in dwc3 structure for the case where
multi DWC3 usages are used.

Change-Id: I55e1e3a7d48fbea0a421802aae176ac57a48869f
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 406ab7d2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -840,6 +840,7 @@ struct dwc3_scratchpad_array {
 * @irq: irq number
 * @bh: tasklet which handles the interrupt
 * @irq_cnt: total irq count
 * @last_irq_cnt: last irq count
 * @bh_completion_time: time taken for taklet completion
 * @bh_handled_evt_cnt: no. of events handled by tasklet per interrupt
 * @bh_dbg_index: index for capturing bh_completion_time and bh_handled_evt_cnt
@@ -1028,6 +1029,7 @@ struct dwc3 {
	/* IRQ timing statistics */
	int			irq;
	unsigned long		irq_cnt;
	unsigned long		last_irq_cnt;
	unsigned long		ep_cmd_timeout_cnt;
	unsigned                bh_completion_time[MAX_INTR_STATS];
	unsigned                bh_handled_evt_cnt[MAX_INTR_STATS];
+7 −4
Original line number Diff line number Diff line
@@ -3320,16 +3320,19 @@ static void msm_dwc3_perf_vote_work(struct work_struct *w)
	struct dwc3_msm *mdwc = container_of(w, struct dwc3_msm,
						perf_vote_work.work);
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
	static unsigned long	last_irq_cnt;
	bool in_perf_mode = false;
	int latency = mdwc->pm_qos_latency;

	if (!latency)
		return;

	if (dwc->irq_cnt - last_irq_cnt >= PM_QOS_THRESHOLD)
	if (dwc->irq_cnt - dwc->last_irq_cnt >= PM_QOS_THRESHOLD)
		in_perf_mode = true;

	pr_debug("%s: in_perf_mode:%u, interrupts in last sample:%lu\n",
		 __func__, in_perf_mode, (dwc->irq_cnt - last_irq_cnt));
		 __func__, in_perf_mode, (dwc->irq_cnt - dwc->last_irq_cnt));

	last_irq_cnt = dwc->irq_cnt;
	dwc->last_irq_cnt = dwc->irq_cnt;
	msm_dwc3_perf_vote_update(mdwc, in_perf_mode);
	schedule_delayed_work(&mdwc->perf_vote_work,
			msecs_to_jiffies(1000 * PM_QOS_SAMPLE_SEC));