[RFC 0/8] Enable runtime suspend resume for QCOM devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently for all dwc3 devices, runtime is forbidden in kernel code.
Although it can be configured from userspace, qualcomm devices using
role switching with dr_mode "otg" would need to modify glue specific
qscratch registers without which connection done/ disconnect events
wouldn't be generated in device mode thus blocking suspend entry.
Also when in host mode, xhci and roothubs needs to be configured
to use_autosuspend accrordingly. More information regarding disconnect
event generation on QC targets is in [1].

The series introduces vendor hooks for passing on notifications
from core to glue layers. Since these hooks are to be registered
by glue to core, glue needs to have some sort of indication that
core probe hasn't been deferred or core probe hasn't failed. So
this series banks upon Bjorn's flattened device tree implementation [2]
for dwc3 core and dwc3-qcom. Since these patches ensure that we use
core layer as a library and probe is invoked in a controlled fashion
from qcom glue layer, we can register vendor hooks in this probe call.

While in host mode, usb-core notifiers have been utilised to ensure
we use_autosuspend for connected devices and roothubs.

[1]: https://lore.kernel.org/all/af60c05b-4a0f-51b8-486a-1fc601602515@xxxxxxxxxxx/
[2]: https://lore.kernel.org/all/20231016-dwc3-refactor-v1-0-ab4a84165470@xxxxxxxxxxx/

Tests done:
1. Enumeration in device mode:
After creating symlinks to ffs.adb and writing to UDC node, ADB is up and
working in a stable way.

2. When none is written to UDC, device enters suspend.

3. When cable is removed, cable disconnect notification comes and when
qscratch registers are cleared properly, it is generating disconnect event

4. Device enters suspend upon removing cable (host and device mode)

5. In host mode, when autosuspend and wakeup are enabled from userspace
via the following commands, device enters runtime suspend:

echo enabled > /sys/bus/platform/devices/xhci-hcd.0.auto/power/wakeup
echo auto > /sys/bus/platform/devices/xhci-hcd.0.auto/power/control
echo 5000 > /sys/bus/platform/devices/xhci-hcd.0.auto/usb1/1-1/power/autosuspend_delay_ms
echo enabled > /sys/bus/platform/devices/xhci-hcd.0.auto/usb1/1-1/power/wakeup
echo auto > /sys/bus/platform/devices/xhci-hcd.0.auto/usb1/1-1/power/control

6. Upon removing cable in host mode, setmode brings back usb to device
mode (which is default setting), it enters suspend as cable is still
disconnected

7. When in host mode, if we enter runtime suspend with wakeup enabled,
clicking on buttons of headset are resuming the controller.

Issues still present:
During bootup if UDC is not written before dwc3 is suspended, then device
enters suspend and although writing to UDC is resuming the device and
setting  run stop, controller is not generating events. At this stage if
a simple plug-in/plug-out is done, everything works fine.

Krishna Kurapati (8):
  dt-bindings: usb: qcom,dwc3: Add bindings to enable runtime
  usb: dwc3: core: Register vendor hooks for dwc3-qcom
  usb: dwc3: qcom: Enable autosuspend for host mode
  clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend
  arm64: dts: qcom: Flatten sm8450 usb device node
  arm: dts: qcom: Add pmic glink support for sm8450-qrd
  arm: dts: qcom: Enable runtime for SM8450 QRD
  usb: dwc3: core: Skip set_mode notification if cable is disconnected

 .../devicetree/bindings/usb/qcom,dwc3.yaml    |   5 +
 arch/arm64/boot/dts/qcom/sm8450-hdk.dts       |   3 -
 arch/arm64/boot/dts/qcom/sm8450-qrd.dts       |  48 ++++++-
 .../dts/qcom/sm8450-sony-xperia-nagara.dtsi   |   3 -
 arch/arm64/boot/dts/qcom/sm8450.dtsi          |  44 +++----
 drivers/clk/qcom/gcc-sm8450.c                 |   1 +
 drivers/usb/dwc3/core.c                       |  19 ++-
 drivers/usb/dwc3/core.h                       |  50 ++++++-
 drivers/usb/dwc3/drd.c                        |  13 ++
 drivers/usb/dwc3/dwc3-qcom.c                  | 122 +++++++++++++++++-
 10 files changed, 271 insertions(+), 37 deletions(-)

-- 
2.42.0





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux