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

Commit e2bffa40 authored by Manu Gautam's avatar Manu Gautam Committed by Gerrit - the friendly Code Review server
Browse files

USB: ANDROID: Implement dynamic pm_qos voting based on USB activity



Currently USB android driver maintains only two states for DMA
latency voting with pm_qos i.e. USB connect and disconnect/suspend.
This doesn't take into consideration when USB is completely IDLE
or very minimal USB transfers are happening resulting in high
power consumption. Even though USB is used for battery charging
but not allowing CPU to enter lower power states may result in high
charging time or even device getting hot.
Driver now monitors USB traffic using UI interrupts count and based
on that takes decision to vote appropriate DMA latency. If interrupts
during a sample time are less than threshold then it allows transition
from WFI to IDLE_PC and further to IDLE_PC_RPM if no interrupts are
seen for a while.
All these thresholds and sample times (note below) are configurable and
should be defined such that we ramp up fast to WFI (up_sample_sec)
but slow down shift to IDLE_PC (down_sample_sec). User configurable
parameters are:
1. Parameters to control WFI to L2 IDLE_PC transition:
  * down_pm_qos_sample_sec: Interrupts sampling time
  * down_pm_qos_threshold: If interrupts during a sample are less than
         this threshold then allow L2 IDLE_PC.
2. Parameters to control IDLE_PC to IDLE_PC_RPM transition:
  * idle_pc_rpm_no_int_secs: If no interrupts are seen for this much
         time then allow L2 IDLE_PC_RPM.
3. Parameters to control transition to WFI:
  * up_pm_qos_sample_sec: Interrupts sampling time
  * up_pm_qos_threshold: If interrupts during a sample are more than
         this threshold then allow only WFI.

Change-Id: I945dfca84e56005e8d5940f3dc31ed2c1197cde1
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 5b5abd71
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -11,8 +11,14 @@ Required properties:
Optional properties :
- reg  : offset and length of memory region that is used by device to
  update USB PID and serial numbers used by bootloader in DLOAD mode.
- qcom,android-usb-swfi-latency : value to be used by device to vote
  for DMA latency in microsecs.
- qcom,pm-qos-latency : This property must be a list of three integer values
  (perf, normal, sleep) where each value respresents DMA latency in microsecs.
  First value represents DMA latency to vote with pm_qos when back to back USB
  transfers are happening and it requires USB thoughput to be maximum.
  Second value represents value to vote when not many USB transfers are
  happening and it is OK to have higher DMA latency to save power.
  Third value represents DMA latency to vote when USB BUS is IDLE and absolutely
  no transfers are happening. It should allow transition to lowest power state.
- qcom,streaming-func : add list of usb function name. If mention usb function
  is being enable as part of USB composition, streaming mode is enable with
  usb device controller to get better throughput. NOTE: Inverted CRC and
@@ -30,7 +36,7 @@ Example Android USB device node :
	android_usb@fc42b0c8 {
		compatible = "qcom,android-usb";
		reg = <0xfc42b0c8 0xc8>;
		qcom,android-usb-swfi-latency = <1>;
		qcom,pm-qos-latency = <2 1001 12701>;
		qcom,streaming-func = "rndis","mtp";
		qcom,android-usb-uicc-nluns = /bits/ 8 <1>;
		qcom,usb-core-id = <1>;
+1 −1
Original line number Diff line number Diff line
@@ -4423,7 +4423,7 @@
	android_usb@fe8050c8 {
		compatible = "qcom,android-usb";
		reg = <0xfe8050c8 0xc8>;
		qcom,android-usb-swfi-latency = <1>;
		qcom,pm-qos-latency = <2 1001 30001>;
	};

	hsphy0: hsphy@f92f8800 {
+1 −1
Original line number Diff line number Diff line
@@ -1584,7 +1584,7 @@

	android_usb@fe8050c8 {
		compatible = "qcom,android-usb";
		qcom,android-usb-swfi-latency = <1>;
		qcom,pm-qos-latency = <2 1001 30001>;
	};

	pcie0: qcom,pcie@fc520000 {
+1 −1
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@
	android_usb@fe8050c8 {
		reg = <0xfe8050c8 0xc8>;
		compatible = "qcom,android-usb";
		qcom,android-usb-swfi-latency = <100>;
		qcom,pm-qos-latency = <101 2001 30001>;
	};

	hsphy0: hsphy@f92f8800 {
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@
	android_usb: android_usb@fe8050c8 {
		compatible = "qcom,android-usb";
		reg = <0xfe8050c8 0xc8>;
		qcom,android-usb-swfi-latency = <1>;
		qcom,pm-qos-latency = <2 1001 12701>;
		qcom,streaming-func = "rndis";
		qcom,android-usb-uicc-nluns = /bits/ 8 <1>;
	};
Loading