We should also Disable vbus-5v gpio control in retulator node,otherwise
vbus-5v will always power on.
Change-Id: Icb42f687866174398917ced3e53a3e876ea37b86
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
Consider two devices, A and B, where B is a child of A, and B utilizes
asynchronous suspend (it does not matter whether A is sync or async). If
B fails to suspend_noirq() or suspend_late(), or is interrupted by a
wakeup (pm_wakeup_pending()), then it aborts and sets the async_error
variable. However, device A does not (immediately) check the async_error
variable; it may continue to run its own suspend_noirq()/suspend_late()
callback. This is bad.
We can resolve this problem by checking the async_error flag after
waiting for children to suspend, using the same logic for the noirq and
late suspend cases as we already do for __device_suspend().
It's easy to observe this erroneous behavior by, for example, forcing a
device to sleep a bit in its suspend_noirq() (to ensure the parent is
waiting for the child to complete), then return an error, and watch the
parent suspend_noirq() still get called. (Or similarly, fake a wakeup
event at the right (or is it wrong?) time.)
Change-Id: I9f6d9a599b45aaeb2debccc50a47525f138ad07e
Fixes: de377b3972 ("PM / sleep: Asynchronous threads for suspend_late")
Fixes: 28b6fd6e37 ("PM / sleep: Asynchronous threads for suspend_noirq")
Reported-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
The printouts writen to the logs by suspend can be a bit opaque: it can
be hard to track them down to the actual function called. You might
see:
calling rfkill1+ @ 19473, parent: phy0
call rfkill1+ returned 0 after 1 usecs
calling phy0+ @ 19473, parent: mmc2:0001:1
call phy0+ returned 0 after 19 usecs
It's a bit hard to know what's actually happening. Instead, it's nice
to see:
calling rfkill1+ @ 15793, parent: phy0, cb: rfkill_suspend
call rfkill1+ returned 0 after 1 usecs
calling phy0+ @ 15793, parent: mmc2:0001:1, cb: wiphy_suspend [cfg80211]
call phy0+ returned 0 after 7 usecs
That makes it very obvious what's going on. It also has the nice side
effect of making the suspend/resume spew a little more obvious, since
many resume functions have the word "resume" in the name:
calling phy0+ @ 15793, parent: mmc2:0001:1, cb: wiphy_resume [cfg80211]
call phy0+ returned 0 after 12 usecs
calling rfkill1+ @ 15793, parent: phy0, cb: rfkill_resume
call rfkill1+ returned 0 after 1 usecs
Change-Id: I32dcedfa013393aab79af852304c7d9f3465f183
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Add usb super speed,support dp 4 lanes and usb2.0 function.
Also add power domain control function and optimize the logic
of dp recognizing flow.And also change the logic of dp suspend,
the clock of dp will be disabled after early suspend, and enabled
after early resume by trigger a hotplug event.
Change-Id: I917d0d34b0909373ba037c62b3582893d7dce00b
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
Add the sensor node "power-off-in-suspend" to support sensor poweroff in
system suspend.
Change-Id: Ic0dc660f0211b7dd18ba8fec6d54aba5b1dfc301
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
For some sensors are designed to support poweroff when system suspend,
so we need reinit register when system resume.
Change-Id: I4d61dc318562336781aa1010d1fbad447cc76b83
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
If the expected number of FTS aren't received by RC when exiting from L0s,
the LTSSM will fall into recover state, which means it will need to send TS
for retraining which makes the latency of exiting from L0s a little longer
than expected. This issue is caused by an incorrect reset value of FTS
count on PLC1 register (offset 0x4). The expected value for Gen1/2 should
be more than 240 and we may leave a little margin here. Fix this before
starting Gen1 training which will make TS1 contain the correct FTS count.
Change-Id: I15543b385fdb7a007187faf51265c591c51433e6
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from git.kernel.org/cgit/linux/kernel/git/next/linux-next.git
commit ca19890840)
Per TRM, we need to deassert the four reset pins simultaneously.
Currently the reset framework doesn't support that so we did it
one by one. It seems no side effect found but it does impact the
state machine of controller, so sometimes the change speed bit is
not setted when sending training sequence from recover state.
After the silicon RTL review from Soc guys, we don't need to do
the sequence recommended by TRM, and could just move the deassert
of mgmt_sticky_rst to the first place.
Change-Id: I001f3707054af98b147cb1d56b1a03e5f7d44ceb
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from git.kernel.org/cgit/linux/kernel/git/next/linux-next.git
commit 58c6990c5e)
Without supporting clock PM capable, if we want to disable
clkpm, we don't need this extra check as it already be zero for
the enable argument. And it's the same for enabling clkpm here.
So let's remove this check.
Change-Id: I0dc251e5dea940a2288fbb31a58336dea83f2515
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from git.kernel.org/cgit/linux/kernel/git/next/linux-next.git
commit a6c1c6f354)
This increases the likelihood of link state to automatically go to L1
and save some power.
The default credit update interval of 7.5 us results in the rootport
sending UpdateFC-P and UpdateFC-NP packets too often, thus resulting
in the link never going to L1, and always staying in L0/L0s. The
value 24 us was chosen after some experiments and peeking over the
PCIe bus to see that we do enter L1 substate when there is not enough
traffic on the PCIe bus.
Change-Id: I23eccba98f6fe731bcacec80349dc05bd7baf9c1
Signed-off-by: Rajat Jain <rajatja@google.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from git.kernel.org/cgit/linux/kernel/git/next/linux-next.git
commit 277743ef61)
Bjorn did some cleanup for rockchip pcie driver after
mereging the drivers. So let's backport it entirely
to keep consisten with the upstream kernel.
[bhelgaas: fold in Brian's rockchip_pcie_client_irq_handler() OR fix, other
fixes and cleanups from Guenter Roeck <linux@roeck-us.net> and me,
uninitialized variable fix from Arnd Bergmann <arnd@arndb.de>]
Change-Id: If680b9c2264cd89561427180b146c34eb8549511
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
The pixel clock of 4K@60Hz is 594MHz, let's enable it for HDMI.
Change-Id: I6097c8a452ba8259c1d8d01fb793cd7cc55cafb3
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
The max output resolution of VOP Little is 2K, but VOP Big could support
4K output. For now we need support HDMI 4K display, so let force VOP Big
to HDMI, and VOP Little to eDP
Change-Id: Ic493fcb2ee29c3deda0fe5437aab46e271f3689b
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
If extcon cable state is EXTCON_USB_VBUS_EN, it also means
that otg host connected, don't need to do charge detection.
Change-Id: Ie7c97c4cd0cfd2688edbfb3bbff93d2f58e9ef9a
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
Set extcon cable state to EXTCON_USB_VBUS_EN instead of
EXTCON_USB_HOST when enable vbus 5v. Because EXTCON_USB_HOST
state means that fusb302 has detected Type-C mode and the
orientation. However, enable vbus is prior to Type-C mode
and orientation detection. If we set EXTCON_USB_HOST state
when power on vbus, it may cause usb controller driver to
receive the state prematurely, and do tcphy orientation init
improperly.
Change-Id: Id65072dc8235693db44667ee5d2ceac74dc94920
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
In usb3 tcphy init, it will access usb3 module to set
usb3 working on USB3.0 mode or USB2.0 only mode, and
usb3 pd must be enabled before do this operation. So
we add pm runtime control for dwc3 parent in extcon
evt work. If plug in usb device, resume dwc3 parent
first to enable usb3 pd and then do phy init.
Change-Id: I90dd762d7f76e5f1722c95611e440eacd3afcdc9
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
If the buffer alloced from the ion, user can flush
it by ion apis, but if the buffer was alloced by
other apis like malloc, user space is not easy to
flush the data cache. So rga flush the data cache
for cache coherence.
Change-Id: I5fcfc3e00c6a8f6b12ed66043b37b0c7c840e7ee
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
This reverts commit ccc954ee9f.
In current code, the dwc3 controller will not process notify when it is
in suspend state and this forbid extcon remove hcd before xhci resume, so
we do not need to forbid remove hcd by the hcd runtime flag and it is
difficult to deal with different process when connected with some special
usb storage.
Change-Id: I987862cceb4ffbe8deefb503f6bc4009770e87bd
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
The max output resolution of vopl is 2K, but vopb could support
4K output. For now we need support HDMI 4K display, so let force
VOP Big to HDMI.
Change-Id: Id095d3659554988f7647fb27d415652fbf510b14
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Add EXTCON_USB_VBUS_EN cable and change EXTCON_USB_HOST to
EXTCON_USB_VBUS_EN cable to control vbus.
Change-Id: I2e7c6111f723e425bd4c156e803cb6a1a9f17511
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
When usb device or host reconnect quickly, the dwc3 controller still
in the state of resume and can not resume again after receive connect
notify. So we need to suspend dwc3 controller immediately when
receive the notify of disconnect. This patch fix the bug "set device
address fail" when resume or quick reconnect.
Change-Id: Iaef6363cdece497f8d7be745017674e119fe3529
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
In current code, the dwc3 controller is active when system start
and change to suspend when auto suspend, while the dwc3 controller
will receive connected notify before auto suspend and fail to change
the state of dwc3 controller from active state to resume if dwc3
controller is connected when system start. So we can change async
suspend to sysc suspend to make sure that the dwc3 controller could
finish suspend process before receive connect notify and fix "set
address fail" error when system start.
Change-Id: Ida8760004da06275d667e33b887b8dde87cd9520
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
RK818 will miss the notify of charge type changing because
the charge cable state is init when u2phy probe but rk818 probe after
u2phy. So we need to get the charge cable state when rk818 probe.
Change-Id: I3682d764ae3f9a56a1ba85ba8b81ea7f1aacdf49
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Id pin interrupt not occur when system start, so we need to check
id pin value when u2phy probe and set cable to host if the value
is high.
Change-Id: I333d5cae2463a159a18b455550a76ebcac704c44
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Enable dwc3 to be wakeup source in runtime resume callback function
and disable dwc3 to be wake up source in runtime suspend. Change pd
in order to control usb pd base on the connect state of usb controller
and fix the detect fail bug of otg port after suspend and resume.
Change-Id: Ic204a82952eb5dd626945189e18a3d2cc40aa6d9
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
rk3399 Type-C0 USB can support both peripheral mode
and host mode, so we set dr_mode as otg.
Change-Id: Ifb6e64920cecf27e41f801809d560bdd302a880b
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
If DWC3 works as peripheral only mode, XHCI HCD will
not be created and added, so we should only get XHCI
HCD in host mode.
Change-Id: Iefb02431d6a973050986963bbabe0a943283f4b3
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
Since the commit a2be4bc ('FIXUP: UPSTREAM: phy: Add USB
Type-C PHY driver for rk3399') has created 2 PHY devices
separately for tcphy USB3 and DisplyPort, and registered
them under the child node, we should also add the USB3
and DP child nodes to dts.
Change-Id: Iffe5dc961dc96b2b41476b1db2949e95c275e19f
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
This patch aims to make code sync with upstream[1]. And it
can fix the following issues:
1. Introduce the EXTCON_PROP_USB_SS property to support both
DP 2*lanes + USB3.0 and DP 4*lanes + USB2.0 mode;
2. Fix the bug that the USB3 phy power on should not return
err when no USB attached, since the USB3 controller will
power_on phy at probe/resume, even though there is no USB3
super speed device attached. At this case, return 0 and do
nothing is better.
3. Create 2 PHY devices separately for USB3 and DisplyPort,
and registers them under the child node.
[1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
commit <e96be45cb84e29e58f35ed460a859b61e8bf28c5>
Change-Id: Ib388a072f11d80624ec6e16291eab497a3dcb0e1
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>