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

Commit 2e4b7559 authored by Manu Gautam's avatar Manu Gautam
Browse files

USB: android: Reinit pm_qos request to avoid vote on all cores



Commit 8e64c400 ("USB: android: Remove PM QOS request during
cable disconnect") added pm_qos_request_add/remove on CONNECT and
DISCONNECT. PM QOS driver clears request on remove which results in
subsequent pm_qos_add request updating latency on all cores.
Fix this by re-initializing pm_qos request before every pm_qos add.

Change-Id: I0c8063d0f020139c6953c502b83c29bf50a0abef
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 422bb915
Loading
Loading
Loading
Loading
+15 −16
Original line number Diff line number Diff line
@@ -307,9 +307,23 @@ static void android_pm_qos_update_latency(struct android_dev *dev, s32 latency)
		last_vote = latency;
		pm_qos_remove_request(&dev->pm_qos_req_dma);
	} else {
		if (!pm_qos_request_active(&dev->pm_qos_req_dma))
		if (!pm_qos_request_active(&dev->pm_qos_req_dma)) {
			/*
			 * The default request type PM_QOS_REQ_ALL_CORES is
			 * applicable to all CPU cores that are online and
			 * would have a power impact when there are more
			 * number of CPUs. PM_QOS_REQ_AFFINE_IRQ request
			 * type shall update/apply the vote only to that CPU to
			 * which IRQ's affinity is set to.
			 */
#ifdef CONFIG_SMP
			dev->pm_qos_req_dma.type = PM_QOS_REQ_AFFINE_IRQ;
			dev->pm_qos_req_dma.irq =
				dev->cdev->gadget->interrupt_num;
#endif
			pm_qos_add_request(&dev->pm_qos_req_dma,
				PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
		}
		pm_qos_update_request(&dev->pm_qos_req_dma, latency);
		last_vote = latency;
	}
@@ -4221,21 +4235,6 @@ static int android_probe(struct platform_device *pdev)
	/* pm qos request to prevent apps idle power collapse */
	android_dev->curr_pm_qos_state = NO_USB_VOTE;
	if (pdata && pdata->pm_qos_latency[0]) {
		/*
		 * The default request type PM_QOS_REQ_ALL_CORES is
		 * applicable to all CPU cores that are online and
		 * would have a power impact when there are more
		 * number of CPUs. PM_QOS_REQ_AFFINE_IRQ request
		 * type shall update/apply the vote only to that CPU to
		 * which IRQ's affinity is set to.
		 */
#ifdef CONFIG_SMP
		android_dev->pm_qos_req_dma.type = PM_QOS_REQ_AFFINE_IRQ;
		android_dev->pm_qos_req_dma.irq =
				android_dev->cdev->gadget->interrupt_num;
#endif
		pm_qos_add_request(&android_dev->pm_qos_req_dma,
			PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
		android_dev->down_pm_qos_sample_sec = DOWN_PM_QOS_SAMPLE_SEC;
		android_dev->down_pm_qos_threshold = DOWN_PM_QOS_THRESHOLD;
		android_dev->up_pm_qos_sample_sec = UP_PM_QOS_SAMPLE_SEC;