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

Commit f50591fa authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

USB: gadget: Set pm_qos_req-> type to AFFINITY_IRQ for android device



Current implementation is adding PM QOS request type default set to
zero, which means USB driver is updating new PM QOS request value
to all CPUs even though some CPUs are offline. This could cause
visible power impact if incase clusters are having different bucks.
Hence set PM QOS request type to AFFINITY_IRQ so that it updates to
CPU to which IRQ affinity is set.

Change-Id: Ie72d2f936c2d7146aa9b5c43393707d603bea8e9
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent bb29ea15
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2168,6 +2168,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
	}

	dwc->irq = irq;
	g->interrupt_num = dwc->irq;
	spin_lock_irqsave(&dwc->lock, flags);

	if (dwc->gadget_driver) {
+14 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ static const char *pm_qos_to_string(enum android_pm_qos_state state)
	}
}

static void android_pm_qos_update_latency(struct android_dev *dev, u32 latency)
static void android_pm_qos_update_latency(struct android_dev *dev, s32 latency)
{
	static int last_vote = -1;

@@ -4066,6 +4066,19 @@ 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;
+5 −1
Original line number Diff line number Diff line
@@ -223,7 +223,11 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *udc, unsigned event)
		dev_info(dev, "CI13XXX_CONTROLLER_ERROR_EVENT received\n");
		ci13xxx_msm_mark_err_event();
		break;

	case CI13XXX_CONTROLLER_UDC_STARTED_EVENT:
		dev_info(dev,
			 "CI13XXX_CONTROLLER_UDC_STARTED_EVENT received\n");
		udc->gadget.interrupt_num = _udc_ctxt.irq;
		break;
	default:
		dev_dbg(dev, "unknown ci13xxx_udc event\n");
		break;
+2 −0
Original line number Diff line number Diff line
@@ -632,6 +632,7 @@ struct usb_gadget_ops {
 * @bam2bam_func_enabled; Indicates function using bam2bam is enabled or not.
 * @extra_buf_alloc: Extra allocation size for AXI prefetch so that out of
 * boundary access is protected.
 * @interrupt_num: Interrupt number for the underlying platform device.
 *
 * Gadgets have a mostly-portable "gadget driver" implementing device
 * functions, handling all usb configurations and interfaces.  Gadget
@@ -679,6 +680,7 @@ struct usb_gadget {
	bool				l1_supported;
	bool				bam2bam_func_enabled;
	u32				extra_buf_alloc;
	int				interrupt_num;
};
#define work_to_gadget(w)	(container_of((w), struct usb_gadget, work))