firefly-linux-kernel-4.4.55.git
7 years agoRevert "ARM64: cpufreq_sched: implement event CPUFREQ_GOV_LIMIT for governor"
Huang, Tao [Fri, 4 Nov 2016 06:10:09 +0000 (14:10 +0800)]
Revert "ARM64: cpufreq_sched: implement event CPUFREQ_GOV_LIMIT for governor"

This reverts commit d94634b0ab1bd61cc4088de63608287938a8fec2.

Fixed by commit 24884e54340e35d43bd09af0b12caef57a63458f
("sched/cpufreq_sched: Consolidated update")

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoRevert "ARM64: sched: cpufreq_sched: fix bug: init data before use it in thread"
Huang, Tao [Fri, 4 Nov 2016 06:08:48 +0000 (14:08 +0800)]
Revert "ARM64: sched: cpufreq_sched: fix bug: init data before use it in thread"

This reverts commit 0ac5bfd6d9652d477387764a11e3b48f1afe6891.

Fixed by commit ac6f9bad52a79154bebd1626344dfc206d1cbefe
("FIXUP: sched: scheduler-driven cpu frequency selection")

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoRevert "ARM64: sched: fix bug: avoid infinite loop"
Huang, Tao [Fri, 4 Nov 2016 06:06:58 +0000 (14:06 +0800)]
Revert "ARM64: sched: fix bug: avoid infinite loop"

This reverts commit d4773e1407b6d59a202bd4ce8acc83deaceafa29.

Fixed by commit abdb60d816bfd20b8d4f61c3e7c95a61ad12212a
("FIXUP: sched/fair: Fix hang during suspend in sched_group_energy")

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoRevert "ROCKCHIP: sched: enable the feature ENERGY_AWARE"
Huang, Tao [Fri, 4 Nov 2016 06:00:30 +0000 (14:00 +0800)]
Revert "ROCKCHIP: sched: enable the feature ENERGY_AWARE"

This reverts commit a9ad2b25a053c995e9a5fd256cc655f32897ed68.

Fixed by commit fc1d6c8c6a6e7353147bcb02d0236db5714804d2
("sched: Add Kconfig option DEFAULT_USE_ENERGY_AWARE to set ENERGY_AWARE feature flag")

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoRevert "UPSTREAM: usb: dwc3: core: Move the mode setting to the right place"
William Wu [Thu, 3 Nov 2016 10:03:45 +0000 (18:03 +0800)]
Revert "UPSTREAM: usb: dwc3: core: Move the mode setting to the right place"

This reverts commit 104756064072e39790eb16c5c987744e81d52a62.

This commit 1047560 will reinit dwc3 controller mode
when resuming dwc3 core. Generally, this patch can be
used for "dr_mode = host", "dr_mode = peripheral" and
"dr_mode = otg".

However, rockchip dwc3 core don't support otg function,
but only support DRD mode. So on rockchip platform, we
set dr_mode to otg for DRD mode, then switch host and
peripheral dynamically by extcon notifier. Also, we will
enable dwc3 to be a wakeup source and enable usb3 power
domain in suspend mode if usb device is pluged in. So
dwc3 controller will not lost the mode when resuming dwc3
core.

Change-Id: I0ee4f5b02d4504e853d8ef81df3df9a8a4ac284f
Signed-off-by: William Wu <wulf@rock-chips.com>
7 years agonvmem: rockchip-efuse: Change initcall to subsys
Finley Xiao [Mon, 31 Oct 2016 07:58:01 +0000 (15:58 +0800)]
nvmem: rockchip-efuse: Change initcall to subsys

We will add a avs driver to adjust opp's voltage according to leakage.
As it need register a notifier before cpufreq starts, and make cpufreq
defer probe is probably not really easy, so avs should probe earlier
than cpufreq, efuse should probe earlier than avs.

Change-Id: I817aa44c3b34d2fdf44148e6b9649ceed76d8f1f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoUPSTREAM: phy: Add reset callback
Randy Li [Fri, 9 Sep 2016 18:59:37 +0000 (02:59 +0800)]
UPSTREAM: phy: Add reset callback

The only use for this is for solving a hardware design problem in
usb of Rockchip RK3288.

Change-Id: I40b17f5c33125c77759808720763d2694dfc25f2
Signed-off-by: Randy Li <ayaka@soulik.info>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit cac18ecb6f44b11bc303d7afbae3887b27938fa4)

7 years agofirmware: rockchip: sip: add rockchip SIP runtime service
Jianhong Chen [Thu, 29 Sep 2016 12:14:36 +0000 (20:14 +0800)]
firmware: rockchip: sip: add rockchip SIP runtime service

Change-Id: I996a90b3f6cb471f255566dfab0059a55da8866d
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agovideo: rockchip: 3399 vop: fix pwm config done lead to iommu pagefault
Huang Jiachai [Tue, 1 Nov 2016 08:09:16 +0000 (16:09 +0800)]
video: rockchip: 3399 vop: fix pwm config done lead to iommu pagefault

Change-Id: Ia8e8a3ccaf9a713d96e93a435503d8b55b794f3b
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agoarm64: dts: rockchip: enable rk_headset on rk3399 mid
zhangjun [Tue, 11 Oct 2016 06:46:10 +0000 (14:46 +0800)]
arm64: dts: rockchip: enable rk_headset on rk3399 mid

Change-Id: I8ef75283727152e7c5fa7380813296bc7220ed91
Signed-off-by: zhangjun <zhangjun@rock-chips.com>
7 years agoCHROMIUM: xhci: stop roothub port polling timer in shutdown
William wu [Wed, 19 Oct 2016 16:05:26 +0000 (00:05 +0800)]
CHROMIUM: xhci: stop roothub port polling timer in shutdown

The xhci hcd use the port polling timer (rh_timer) to poll the
roothub for port events. But we can't allow the USB core to poll
the port events during shutdown because the xhci controller may
be disable and can't be accessed in shutdown. If we access xhci
port registers with port polling timer after xhci shutdown, it
may cause kernel crash or unexpected behavior. So we need to stop
the port polling timer while shutdown xhci.

I can easily reproduce the issue on rk3399 platform, plug in a
Type-C hub and an USB ethernet dongle, then do reboot test,
result in a crash with the following backtrace.

Unhandled fault: synchronous external abort (0x96000010) at 0xffffff80002f0430
Internal error: : 96000010 [#1] PREEMPT SMP
task: ffffffc001092cb0 ti: ffffffc00107c000 task.ti: ffffffc00107c000
PC is at xhci_hub_status_data+0xec/0x1e4
LR is at xhci_hub_status_data+0xb0/0x1e4
[<ffffffc00067a210>] xhci_hub_status_data+0xec/0x1e4
[<ffffffc00063ebf8>] usb_hcd_poll_rh_status+0x54/0x148
[<ffffffc00063ed0c>] rh_timer_func+0x20/0x2c
[<ffffffc0002845cc>] call_timer_fn+0xa4/0x1c8
[<ffffffc000284964>] run_timer_softirq+0x248/0x2cc
[<ffffffc000200928>] __do_softirq+0x178/0x338
[<ffffffc000224b08>] irq_exit+0x78/0xc0
[<ffffffc00027089c>] __handle_domain_irq+0x9c/0xbc
[<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188

BUG=chrome-os-partner:59111
TEST=Plug in a Type-C hub, then do reboot test, check if
kernel crash during shutdown.

Change-Id: I3ca3d12d101241cd78138ea5d995708a2893d1a0
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/401121
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
7 years agoCHROMIUM: xhci: do shutdown only hcd is registered
William wu [Wed, 19 Oct 2016 11:53:53 +0000 (19:53 +0800)]
CHROMIUM: xhci: do shutdown only hcd is registered

On some sepcial platforms (e.g. rk3399 platform), they will call
usb_remove_hcd() to remove xhci hcd if no device connected, and
also call xhci_stop() to halt and reset xhci. So we don't need to
do the same thing in shutdown if hcd has been unregistered.

In addition to remove hcd, rk3399 platform will disable xhci power
domain in runtime suspend, if we try to access xhci registers in
shutdown, it might cause kernel crash or unexpected behavior.

BUG=chrome-os-partner:59111
TEST=reboot the system

Change-Id: I7ecfce068211ff1c4a884fc4a8a54ca5b84c1c09
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/401120
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
7 years agoCHROMIUM: usb: xhci-plat: use usb_hcd_platform_shutdown() callback
William wu [Wed, 19 Oct 2016 11:25:05 +0000 (19:25 +0800)]
CHROMIUM: usb: xhci-plat: use usb_hcd_platform_shutdown() callback

The xhci driver provides xhci_shutdown() to be called with the main
usb_hcd (the USB3 roothub) while do reboot. But actually, xhci-plat
never call xhci_shutdwon() during reboot because it doesn't use the
usb_hcd_platform_shutdown() helper.

So we use use usb_hcd_platform_shutdown() for xhci-plat, and the
normal shutdown call trace is:
kernel_restart -> kernel_restart_prepare -> device_shutdown ->
platform_drv_shutdown -> usb_hcd_platform_shutdown -> xhci_shutdown

BUG=chrome-os-partner:59111
TEST=reboot the system

Change-Id: I9be424257ea6ba1e51521cbdd01f4698ae1752ad
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/401119
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
7 years agousb: dwc_otg_310: fix smatch warnings relate to locking imbalance.
Frank Wang [Mon, 31 Oct 2016 03:00:56 +0000 (11:00 +0800)]
usb: dwc_otg_310: fix smatch warnings relate to locking imbalance.

This patch corrects the below locking imbalance warnings:

drivers/usb/dwc_otg_310/dwc_otg_driver.c:406 dwc_otg_force_device()
warn: inconsistent returns 'irqsave:flags'.
  Locked on:   line 390
  Unlocked on: line 406

Change-Id: Id79ebe0d41fbbab38c59384e23d7e2133c436c96
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agorockchip/iep: bugfix, inconsistent mutex operation
alpha lin [Mon, 31 Oct 2016 01:06:33 +0000 (09:06 +0800)]
rockchip/iep: bugfix, inconsistent mutex operation

Fix a inconsistent mutex operation in iep driver.

Change-Id: Iddb25d89013438da9a4985f9d9f663061c750eeb
Signed-off-by: alpha lin <alpha.lin@rock-chips.com>
7 years agoarm64: dts: rk3399-box: adjust hdmi phy_table for physical signal test
xuhuicong [Thu, 27 Oct 2016 10:00:00 +0000 (18:00 +0800)]
arm64: dts: rk3399-box: adjust hdmi phy_table for physical signal test

Change-Id: I4184d26dd26ccfa786d1147ec73caae006e32343
Signed-off-by: xuhuicong <xhc@rock-chips.com>
7 years agovideo: rockchip: hdmi: modify wrong phy freq of 4k@60hz(yuv420)10bit
xuhuicong [Thu, 27 Oct 2016 07:32:21 +0000 (15:32 +0800)]
video: rockchip: hdmi: modify wrong phy freq of 4k@60hz(yuv420)10bit

the original phy pll of this Resolution is configure incorrect.
result in the phy clk freq Double. now fix it.

Change-Id: I2bcb669a2d61d53fee1ed521e672ea4306b401d5
Signed-off-by: xuhuicong <xhc@rock-chips.com>
7 years agovideo: rockchip: hdmi: fix panic if enable hdcp buy load key fail
xuhuicong [Thu, 27 Oct 2016 07:19:44 +0000 (15:19 +0800)]
video: rockchip: hdmi: fix panic if enable hdcp buy load key fail

Change-Id: I8550983a61fdb806680d40ce4281cdfe4ae101f8
Signed-off-by: xuhuicong <xhc@rock-chips.com>
7 years agoarm64: dts: rk3399-box: dp: select vopl for dp as vop0 for hdmi
xuhuicong [Thu, 27 Oct 2016 12:58:43 +0000 (20:58 +0800)]
arm64: dts: rk3399-box: dp: select vopl for dp as vop0 for hdmi

Change-Id: I8ee8a2d7e5f441e765c7d3f6c805c5a0e3666e59
Signed-off-by: xuhuicong <xhc@rock-chips.com>
7 years agovideo: rockchip: dp: do no support 4k when use vop1
xuhuicong [Thu, 27 Oct 2016 12:55:49 +0000 (20:55 +0800)]
video: rockchip: dp: do no support 4k when use vop1

Change-Id: I3ff56100947d04b703f15f22616b5e9ef73bbb06
Signed-off-by: xuhuicong <xhc@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: fix hung task timeout when rm xhci-hcd
Wu Liang feng [Fri, 28 Oct 2016 02:23:09 +0000 (10:23 +0800)]
CHROMIUM: usb: dwc3: rockchip: fix hung task timeout when rm xhci-hcd

We will remove the xhci controller from usb bus when Type-C USB
is disconnected. This patch set xhci state to XHCI_STATE_REMOVING
when remove xhci-hcd to indicate that the host is being removed
and avoid queueing configure_endpoint commands for the dropped
endpoints.

This fix the following problem, observed with a USB-C HUB.

[11760.112650] INFO: task kworker/0:2:1636 blocked for more than 120 seconds.
[11760.119588]       Tainted: G        W       4.4.21 #2
[11760.124779] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[11760.134551] kworker/0:2     D ffffffc000204fd8     0  1636      2 0x00000000
[11760.143947] Workqueue: usb_hub_wq hub_event
[11760.148173] Call trace:
[11760.152660] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.157820] [<ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.166718] [<ffffffc00090fa80>] schedule+0x94/0xb4
[11760.171643] [<ffffffc000912bfc>] schedule_timeout+0x44/0x27c
[11760.181127] [<ffffffc0009106d8>] wait_for_common+0xf8/0x198
[11760.186746] [<ffffffc0009107a0>] wait_for_completion+0x28/0x34
[11760.195950] [<ffffffc000674e40>] xhci_configure_endpoint+0x20c/0x4b0
[11760.202569] [<ffffffc000675730>] xhci_check_bandwidth+0x1a4/0x324
[11760.212137] [<ffffffc00064798c>] usb_hcd_alloc_bandwidth+0xb4/0x2c8
[11760.218446] [<ffffffc00064a690>] usb_disable_device+0x17c/0x1c8
[11760.227668] [<ffffffc000642088>] usb_disconnect+0x9c/0x1d0
[11760.233188] [<ffffffc00064389c>] hub_event+0x58c/0xde0
[11760.238483] [<ffffffc000239260>] process_one_work+0x240/0x424
[11760.244659] [<ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.250569] [<ffffffc00023f06c>] kthread+0x10c/0x114
[11760.255755] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40
[11760.261513]   task                        PC stack   pid father
[11760.268100] kworker/0:2     D ffffffc000204fd8     0  1636      2 0x00000000
[11760.275603] Workqueue: usb_hub_wq hub_event
[11760.279915] Call trace:
[11760.282437] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.287595] [<ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.292929] [<ffffffc00090fa80>] schedule+0x94/0xb4
[11760.297893] [<ffffffc000912bfc>] schedule_timeout+0x44/0x27c
[11760.303598] [<ffffffc0009106d8>] wait_for_common+0xf8/0x198
[11760.309264] [<ffffffc0009107a0>] wait_for_completion+0x28/0x34
[11760.315171] [<ffffffc000674e40>] xhci_configure_endpoint+0x20c/0x4b0
[11760.321573] [<ffffffc000675730>] xhci_check_bandwidth+0x1a4/0x324
[11760.327757] [<ffffffc00064798c>] usb_hcd_alloc_bandwidth+0xb4/0x2c8
[11760.334094] [<ffffffc00064a690>] usb_disable_device+0x17c/0x1c8
[11760.340119] [<ffffffc000642088>] usb_disconnect+0x9c/0x1d0
[11760.345663] [<ffffffc00064389c>] hub_event+0x58c/0xde0
[11760.350809] [<ffffffc000239260>] process_one_work+0x240/0x424
[11760.356549] [<ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.362090] [<ffffffc00023f06c>] kthread+0x10c/0x114
[11760.367055] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40
[11760.372374] kworker/1:1     D ffffffc000204fd8     0  5743      2 0x00000000
[11760.379456] Workqueue: events dwc3_rockchip_otg_extcon_evt_work
[11760.385443] Call trace:
[11760.387893] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.393035] [<ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.398256] [<ffffffc00090fa80>] schedule+0x94/0xb4
[11760.403134] [<ffffffc00090fe04>] schedule_preempt_disabled+0x28/0x44
[11760.409487] [<ffffffc0009118c0>] __mutex_lock_slowpath+0x120/0x1ac
[11760.415664] [<ffffffc000911998>] mutex_lock+0x4c/0x68
[11760.420714] [<ffffffc000642048>] usb_disconnect+0x5c/0x1d0
[11760.426200] [<ffffffc0006465f8>] usb_remove_hcd+0xc8/0x1e0
[11760.431691] [<ffffffc00065d048>] dwc3_rockchip_otg_extcon_evt_work+0x134/0x178
[11760.438911] [<ffffffc000239260>] process_one_work+0x240/0x424
[11760.444739] [<ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.450230] [<ffffffc00023f06c>] kthread+0x10c/0x114
[11760.455196] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40

TEST=do plug/unplug USB-C HUB with a USB3 flash drive,
check if kernel blocked for more than 120 seconds.

Change-Id: Ib37009c185a2cad6f4671c6a858a737c2ccef1e8
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
7 years agoUPSTREAM: xhci: fix null pointer dereference in stop command timeout function
Mathias Nyman [Wed, 7 Sep 2016 14:26:33 +0000 (17:26 +0300)]
UPSTREAM: xhci: fix null pointer dereference in stop command timeout function

The stop endpoint command has its own 5 second timeout timer.
If the timeout function is triggered between USB3 and USB2 host
removal it will try to call usb_hc_died(xhci_to_hcd(xhci)->primary_hcd)

the ->primary_hcd will be set to NULL at USB3 hcd removal.

Fix this by first checking if the PCI host is being removed, and
also by using only xhci_to_hcd() as it will always return the primary
hcd.

CC: <stable@vger.kernel.org>
Change-Id: Id8489b9ac57e08c7c696a06c7d6fe312ba393f6a
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit bcf42aa60c2832510b9be0f30c090bfd35bb172d)

7 years agoarm64: cpuinfo: compat task get hwcap from compat_hwcap_str
Huang, Tao [Thu, 27 Oct 2016 08:25:34 +0000 (16:25 +0800)]
arm64: cpuinfo: compat task get hwcap from compat_hwcap_str

backport 3.10 patch

Change-Id: Ice8b552450f34772ece0a56f04ba758886c955e2
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: dts: rk3399-vr: gpu dvfs remove 200M
wuliangqing [Tue, 18 Oct 2016 07:33:22 +0000 (15:33 +0800)]
arm64: dts: rk3399-vr: gpu dvfs remove 200M

GPU 200M is performance-hungry for vr

Change-Id: Ib0bee38cdf71c78904cc67f0dafec92e734e516d
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
7 years agorockchip: clk: rk3399: add clk_testout2 ID
Elaine Zhang [Wed, 26 Oct 2016 10:04:43 +0000 (18:04 +0800)]
rockchip: clk: rk3399: add clk_testout2 ID

Change-Id: If5d94896e8e5ce565738064ab8273dbf7242881e
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agovideo: rockchip: mipi: reduce the invalid delay time
Xubilv [Wed, 26 Oct 2016 10:04:45 +0000 (18:04 +0800)]
video: rockchip: mipi: reduce the invalid delay time

Change-Id: I79d1e6efdabb7c385dd84d8f0d41795ed25753f0
Signed-off-by: Xubilv <xbl@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable cpusets for android performance
HaoXiaowei [Wed, 26 Oct 2016 09:02:50 +0000 (17:02 +0800)]
arm64: rockchip_defconfig: enable cpusets for android performance

Change-Id: I972565b011041ef52d980828e0c11675c1254a6d
Signed-off-by: HaoXiaowei <hxw@rock-chips.com>
7 years agoarm64: dts: rk3399-rv1-android: dp enable for both typec0 and typec1
Zorro Liu [Wed, 26 Oct 2016 09:55:16 +0000 (17:55 +0800)]
arm64: dts: rk3399-rv1-android: dp enable for both typec0 and typec1

Change-Id: I047c50b984229e8bcea8726d5808504f00620092
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agovideo: rockchip: mipi: add command mode support
Xubilv [Sat, 22 Oct 2016 07:33:39 +0000 (15:33 +0800)]
video: rockchip: mipi: add command mode support

Change-Id: I38d8bf0487d62339e55b8adffc57261bb9c35f55
Signed-off-by: Xubilv <xbl@rock-chips.com>
7 years agovideo: rockchip: vop: 3399: add support cmd mode
Huang Jiachai [Wed, 12 Oct 2016 10:15:05 +0000 (18:15 +0800)]
video: rockchip: vop: 3399: add support cmd mode

Change-Id: I854a108e73947f96efe8a73d842713cab3330c90
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agovideo: rockchip: fb: add support cmd mode
Huang Jiachai [Wed, 12 Oct 2016 10:14:26 +0000 (18:14 +0800)]
video: rockchip: fb: add support cmd mode

Change-Id: I5b6ce2d439b54c0c1d133e8a3e19ae364ff0ce16
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agovideo: rockchip: screen: add refresh mode for cmd mode screen
Huang Jiachai [Wed, 12 Oct 2016 08:53:08 +0000 (16:53 +0800)]
video: rockchip: screen: add refresh mode for cmd mode screen

Change-Id: I4643eb1272a1f504ba4b36eb31a4125fa22390f3
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agoCHROMIUM: arm64: dts: rockchip: add suspend quirk for rk3399 dwc3
Wu Liang feng [Wed, 26 Oct 2016 06:55:11 +0000 (14:55 +0800)]
CHROMIUM: arm64: dts: rockchip: add suspend quirk for rk3399 dwc3

This patch adds disable usb2 suspend phy quirk for rk3399 platform.

TEST=Plug in USB-C HUB, then do suspend_stress_test;
Plug in Yubico/Gnubby security key, check if it can
work normally.

Change-Id: I98f344d9fb47baa892f7653ca43dad2b581611f9
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
7 years agophy: phy-rockchip-typec: fix usb connect failed after diconnect dp
Meng Dongyang [Mon, 24 Oct 2016 09:19:18 +0000 (17:19 +0800)]
phy: phy-rockchip-typec: fix usb connect failed after diconnect dp

In 4 lane dp mode, the dwc3 controller need to config to usb2.0
only mode, while the dwc3 controller must finish config between usb3.0
and usb2.0 only mode, otherwise if will be failed when connect with usb
device. In current code, the config process is done in typec phy init
function, and is called durling dwc3 controller init, so it is too late
for dwc3 controller to config. This patch config usb2.0 only mode when
usb phy power on and config to usb3.0 when usb phy power off if it is
dp mode only. Finish change to usb3.0 before dwc3 controller reinit to
usb3.0 mode.

Change-Id: Iad69dc730408a88bb5f3b9d9bd366754f82db182
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
7 years agoUPSTREAM: usb: dwc2: host: Always add to the tail of queuesa
Nickey Yang [Wed, 26 Oct 2016 06:08:23 +0000 (14:08 +0800)]
UPSTREAM: usb: dwc2: host: Always add to the tail of queuesa

The queues the the dwc2 host controller used are truly queues.  That
means FIFO or first in first out.

Unfortunately though the code was iterating through these queues
starting from the head, some places in the code was adding things to the
queue by adding at the head instead of the tail.  That means last in
first out.  Doh.

Go through and just always add to the tail.

Doing this makes things much happier when I've got:
 * 7-port USB 2.0 Single-TT hub
 * - Microsoft 2.4 GHz Transceiver v7.0 dongle
 * - Jabra speakerphone playing music

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
(cherry picked from commit 94ef7aee11c26e79441276ca43f0c25a04bd1303)

Change-Id: Idf0f468b0e849698a637548f9520b9965368ef35
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
7 years agoUPSTREAM: usb: dwc3: core: Move the mode setting to the right place
Baolin Wang [Fri, 15 Jul 2016 09:13:27 +0000 (17:13 +0800)]
UPSTREAM: usb: dwc3: core: Move the mode setting to the right place

When dwc3 core enters into suspend mode, the system (especially for mobile
device) may power off the dwc3 controller for power saving, that will cause
dwc3 controller lost the mode operation when resuming dwc3 core.

Thus we can move the mode setting into dwc3_core_init() function to avoid this
issue.

Change-Id: I2999291d8f6632e02ceba35d957f7129e18919e6
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 00af62330c39a6c88615a08e7f9d068944e4af69)

7 years agoi2c: rk3x: Give the tuning value 0 during rk3x_i2c_v0_calc_timings
David Wu [Sat, 22 Oct 2016 08:43:42 +0000 (16:43 +0800)]
i2c: rk3x: Give the tuning value 0 during rk3x_i2c_v0_calc_timings

We found a bug that i2c transfer sometimes failed on 3066a board with
stabel-4.8, the con register would be updated by uninitialized tuning
value, it made the i2c transfer failed.

So give the tuning value to be zero during rk3x_i2c_v0_calc_timings.

Change-Id: I8686b8525e7fc8adc896f60dec4ae74d6c2a173c
Signed-off-by: David Wu <david.wu@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
7 years agoserial: 8250: Disable UART_IER_RLSI and UART_IER_RDI for dma receive
Huibin Hong [Mon, 24 Oct 2016 11:34:59 +0000 (19:34 +0800)]
serial: 8250: Disable UART_IER_RLSI and UART_IER_RDI for dma receive

For rockchip serial, received data available and character timeout
interrupts are both enabled by IER[0]. Then when there is data in
the FIFO, received data available interrupt will occurd frequently.
So we must disable it, but which may disable the character timeout
interrput. Then it is useful to add a timer to report the data received
in dma buffer every 10 microsecond.

Change-Id: I1cf9dee495453d3530ab66c95a4e4cfef46b7795
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agoserial: 8250_dma: add timer for dma receive
Huibin Hong [Mon, 24 Oct 2016 10:04:50 +0000 (18:04 +0800)]
serial: 8250_dma: add timer for dma receive

For rockchip serial, received data available and character timeout
interrupts are both enabled by IER[0]. Then when there is data in
the FIFO, received data available interrupt will occurd frequently.
So we must disable it, but which may disable the character timeout
interrput. Then it is useful to add a timer to report the data received
in dma buffer every 10 microsecond.

Change-Id: I6530b17800435b288a7309bb5998176decb94297
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agoarm64: dts: rockchip: update the dts for excavator discrete vr device.
wenping.zhang [Fri, 21 Oct 2016 10:28:45 +0000 (18:28 +0800)]
arm64: dts: rockchip: update the dts for excavator discrete vr device.

Change the configs for RAYKEN 5.46' lcd which is defaultly used for
discrete vr lcd.

Change-Id: I3894697367229ea059b9200fd2ad5aac8781b7df
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agohid: rkvr: add suspend and resume notifier for nanoc
lanshh [Fri, 14 Oct 2016 01:52:12 +0000 (09:52 +0800)]
hid: rkvr: add suspend and resume notifier for nanoc

Change-Id: I870247058c363506400a20c57eb48566b7516c7d
Signed-off-by: lanshh <lsh@rock-chips.com>
7 years agovideo: rockchip: edp: Solve the problem of write grf register failure
xubilv [Thu, 20 Oct 2016 03:38:11 +0000 (11:38 +0800)]
video: rockchip: edp: Solve the problem of write grf register failure

Change-Id: Ia5fa679f4cda5e0c62cf40f2079735c01d0817bc
Signed-off-by: xubilv <xbl@rock-chips.com>
7 years agoarm64: dts: rk3399-sapphire: add vbus-5v gpio control in fusb302 node.
wenping.zhang [Thu, 20 Oct 2016 10:26:45 +0000 (18:26 +0800)]
arm64: dts: rk3399-sapphire: add vbus-5v gpio control in fusb302 node.

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>
7 years agoFROMLIST: PM / sleep: don't suspend parent when async child suspend_{noirq,late}...
Brian Norris [Thu, 20 Oct 2016 04:09:30 +0000 (12:09 +0800)]
FROMLIST: PM / sleep: don't suspend parent when async child suspend_{noirq,late} fails

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: de377b397272 ("PM / sleep: Asynchronous threads for suspend_late")
Fixes: 28b6fd6e3779 ("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>
7 years agoFROMLIST: PM / sleep: print function name of callbacks
Douglas Anderson [Thu, 20 Oct 2016 04:07:31 +0000 (12:07 +0800)]
FROMLIST: PM / sleep: print function name of callbacks

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>
7 years agoarm64: dts: rockchip: add reset control registers for rk3399 dp driver.
wenping.zhang [Mon, 17 Oct 2016 02:30:13 +0000 (10:30 +0800)]
arm64: dts: rockchip: add reset control registers for rk3399 dp driver.

Change-Id: Ibbad2bd5ab49c71385045ca743740cbba8ed6bf0
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agovideo: rockchip: dp: fix deadlock if video timing get failed.
wenping.zhang [Mon, 17 Oct 2016 02:16:40 +0000 (10:16 +0800)]
video: rockchip: dp: fix deadlock if video timing get failed.

Change-Id: I00511a7b2aa0229b04c2326ca267a39cf7d46f42
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agovideo: rockchip: dp: merge the dp driver from chrome and fix error of suspend and...
wenping.zhang [Thu, 29 Sep 2016 10:59:07 +0000 (18:59 +0800)]
video: rockchip: dp: merge the dp driver from chrome and fix error of suspend and resume

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>
7 years agovideo: rockchip: mipi: Solve the problem of compiler error when open the debug
xubilv [Wed, 19 Oct 2016 02:26:56 +0000 (10:26 +0800)]
video: rockchip: mipi: Solve the problem of compiler error when open the debug

Change-Id: Ic74ca747df6dfc913bbf3a379f894635aef35919
Signed-off-by: xubilv <xbl@rock-chips.com>
7 years agoarm64: dts: rockchip: create a rk3399 discrete vr dts based on excavator board.
wenping.zhang [Mon, 17 Oct 2016 02:45:26 +0000 (10:45 +0800)]
arm64: dts: rockchip: create a rk3399 discrete vr dts based on excavator board.

Change-Id: Ib6d6154040e243b6cbbfa47d441744a42165e0cf
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agoarm64: dts: rockchip: add sensor lsm330 node for rk3399-mid
Bin Yang [Wed, 19 Oct 2016 07:39:45 +0000 (15:39 +0800)]
arm64: dts: rockchip: add sensor lsm330 node for rk3399-mid

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>
7 years agoinput: sensors: reinit sensors register when system resume
Bin Yang [Wed, 19 Oct 2016 07:03:24 +0000 (15:03 +0800)]
input: sensors: reinit sensors register when system resume

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>
7 years agoarm64: dts: rockchip: add rv1 board dts file
Zorro Liu [Tue, 18 Oct 2016 07:57:24 +0000 (15:57 +0800)]
arm64: dts: rockchip: add rv1 board dts file

Change-Id: Ib10c6a923e3b6f62a083339ccd8807461ff8f26f
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agopower: rk818-charger: fix usb_charger not assigned new state error
Jianhong Chen [Wed, 19 Oct 2016 08:38:13 +0000 (16:38 +0800)]
power: rk818-charger: fix usb_charger not assigned new state error

Change-Id: I841fe6106fb51820d541cd99a21d0ad0305dec9d
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agoUPSTREAM: PCI: rockchip: Fix wrong transmitted FTS count
Shawn Lin [Fri, 7 Oct 2016 09:42:47 +0000 (17:42 +0800)]
UPSTREAM: PCI: rockchip: Fix wrong transmitted FTS count

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 ca1989084054e64da25662e1f974f77312083eb3)

7 years agoUPSTREAM: PCI: rockchip: improve the deassert sequence of four reset pins
Shawn Lin [Fri, 23 Sep 2016 02:05:59 +0000 (10:05 +0800)]
UPSTREAM: PCI: rockchip: improve the deassert sequence of four reset pins

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 58c6990c5ee772c2551193f053e51a52b9984b49)

7 years agoUPSTREAM: PCI/ASPM: Remove redundant check of pcie_set_clkpm
Shawn Lin [Tue, 24 May 2016 09:32:10 +0000 (17:32 +0800)]
UPSTREAM: PCI/ASPM: Remove redundant check of pcie_set_clkpm

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 a6c1c6f3547b6c4cbd4a30d67a968ee1519a8ffd)

7 years agoUPSTREAM: PCI: rockchip: Increase the Max Credit update interval.
Rajat Jain [Fri, 23 Sep 2016 00:50:42 +0000 (17:50 -0700)]
UPSTREAM: PCI: rockchip: Increase the Max Credit update interval.

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 277743ef616defc870d101f9cf9d3488aba1c1b6)

7 years agoUPSTREAM: PCI: rockchip: cleanup for rockchip pcie driver
Shawn Lin [Fri, 7 Oct 2016 09:31:25 +0000 (17:31 +0800)]
UPSTREAM: PCI: rockchip: cleanup for rockchip pcie driver

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>
7 years agodriver,iio,inv_mpu_i2c: driver set i2c clientdata twice, remove err one
Zorro Liu [Mon, 17 Oct 2016 07:25:29 +0000 (15:25 +0800)]
driver,iio,inv_mpu_i2c: driver set i2c clientdata twice, remove err one

Change-Id: I506d924121b7abe57659815b356a3cbab887f869
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agovideo: rockchip: vop: 3399: fix win2/win3 csc mode error
Huang Jiachai [Mon, 17 Oct 2016 03:44:30 +0000 (11:44 +0800)]
video: rockchip: vop: 3399: fix win2/win3 csc mode error

Change-Id: I34275fda827446dbdebbe3a13e18ceaacd6bba2c
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agork: arm: support build kernel.img and resource.img
Yakir Yang [Mon, 1 Aug 2016 10:08:28 +0000 (18:08 +0800)]
rk: arm: support build kernel.img and resource.img

Change-Id: I651bb208c4304a2aeb7a03516238ac81cdc957d2
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
7 years agodrm/rockchip: dw_hdmi: support 4K@60Hz output
Yakir Yang [Thu, 22 Sep 2016 03:43:55 +0000 (11:43 +0800)]
drm/rockchip: dw_hdmi: support 4K@60Hz output

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>
7 years agoARM: dts: rk3288-evb: force VOP Big to hdmi, and VOP Little to edp
Yakir Yang [Thu, 22 Sep 2016 03:40:53 +0000 (11:40 +0800)]
ARM: dts: rk3288-evb: force VOP Big to hdmi, and VOP Little to edp

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>
7 years agopower: rk818-battery: restore coffset when update fail
Jianhong Chen [Mon, 17 Oct 2016 02:31:12 +0000 (10:31 +0800)]
power: rk818-battery: restore coffset when update fail

Change-Id: Ia1d02a0d340819bbca14e4f0931f9e94230cef78
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agonet: rkwifi: fix ap6330 sdio write/read abnormal when doing stress test
zzc [Mon, 17 Oct 2016 03:54:22 +0000 (11:54 +0800)]
net: rkwifi: fix ap6330 sdio write/read abnormal when doing stress test

Change-Id: I7c353cd4cabb24425aa0bdef243adb293e7c2829
Signed-off-by: zzc <zzc@rock-chips.com>
7 years agousb: rockchip-inno-usb2: check EXTCON_USB_VBUS_EN state in otg sm work
Wu Liang feng [Sat, 15 Oct 2016 04:18:43 +0000 (12:18 +0800)]
usb: rockchip-inno-usb2: check EXTCON_USB_VBUS_EN state in otg sm work

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>
7 years agomfd: fusb302: correct extcon cable state when enable vbus
Wu Liang feng [Sat, 15 Oct 2016 03:49:18 +0000 (11:49 +0800)]
mfd: fusb302: correct extcon cable state when enable vbus

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>
7 years agodrivers: video: rockchip: hdmi: add RAYKEN5.46" lcd for discret vr device
wjh [Fri, 14 Oct 2016 08:06:50 +0000 (16:06 +0800)]
drivers: video: rockchip: hdmi: add RAYKEN5.46" lcd for discret vr device

Change-Id: Ica15b530c565b3c61fe1b1cb6ef1e8944a7e7607
Signed-off-by: wjh <wjh@rock-chips.com>
7 years agousb: dwc3: rockchip: add pm runtime control for dwc3 parent
Wu Liang feng [Fri, 14 Oct 2016 09:41:26 +0000 (17:41 +0800)]
usb: dwc3: rockchip: add pm runtime control for dwc3 parent

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>
7 years agoarm64: dts: rockchip: add dts node for dp 4 lanes + usb2.0 function.
wenping.zhang [Fri, 14 Oct 2016 03:06:31 +0000 (11:06 +0800)]
arm64: dts: rockchip: add dts node for dp 4 lanes + usb2.0 function.

Change-Id: Ia45dd31ebfe2c0c038a6102920eefb50fd512f36
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agophy: phy-rockchip-typec: add dp 4 lane + usb2.0 support.
wenping.zhang [Fri, 14 Oct 2016 01:22:51 +0000 (09:22 +0800)]
phy: phy-rockchip-typec: add dp 4 lane + usb2.0 support.

Change-Id: I7b67959a1bd05694f929d1d437d55d2b7b015b46
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agorockchip/rga: add rga flush data cache
Zikim,Wei [Wed, 28 Sep 2016 13:35:27 +0000 (21:35 +0800)]
rockchip/rga: add rga flush data cache

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>
7 years agoRevert "usb: dwc3: rockchip: fix otg plug out error before resume"
Meng Dongyang [Fri, 14 Oct 2016 07:57:42 +0000 (15:57 +0800)]
Revert "usb: dwc3: rockchip: fix otg plug out error before resume"

This reverts commit ccc954ee9f8859569fe16cc17b598fbfece07ae8.
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>
7 years agoarm64: dts: rockchip: set hall-sensor interrupt gpio pull up for rk3399-mid
Bin Yang [Sun, 9 Oct 2016 08:27:15 +0000 (16:27 +0800)]
arm64: dts: rockchip: set hall-sensor interrupt gpio pull up for rk3399-mid

Change-Id: I72c8df9abdd6f173bc33d907794afc4ac2eb8b6b
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agodrm/rockchip: mipi: dsi: Decrease the value of Ths-prepare
xubilv [Fri, 14 Oct 2016 06:26:11 +0000 (14:26 +0800)]
drm/rockchip: mipi: dsi: Decrease the value of Ths-prepare

Change-Id: Ia3912004f3799465102c36e5faefa6238e52af83
Signed-off-by: xubilv <xbl@rock-chips.com>
7 years agoARM: dts: rk3288-miniarm: force VOP Big to hdmi
Nickey Yang [Sat, 8 Oct 2016 07:35:38 +0000 (15:35 +0800)]
ARM: dts: rk3288-miniarm: force VOP Big to hdmi

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>
7 years agodrm/rockchip: mipi: dsi: add non-burst mode macro definition
xubilv [Thu, 13 Oct 2016 09:58:18 +0000 (17:58 +0800)]
drm/rockchip: mipi: dsi: add non-burst mode macro definition

Change-Id: Ief47d18825afa0d0116a940336dfe1116238cdb7
Signed-off-by: xubilv <xbl@rock-chips.com>
7 years agodrm/rockchip: mipi: dsi: add send mipi command function
xubilv [Thu, 13 Oct 2016 09:47:57 +0000 (17:47 +0800)]
drm/rockchip: mipi: dsi: add send mipi command function

Change-Id: If0699d8d5a42320ba064b698486a912794dfbfb7
Signed-off-by: xubilv <xbl@rock-chips.com>
7 years agoarm64: dts: rk3399: workaround: remove sd-uhs-sdr104 for sd cards
xiaoyao [Wed, 12 Oct 2016 09:33:55 +0000 (17:33 +0800)]
arm64: dts: rk3399: workaround: remove sd-uhs-sdr104 for sd cards

Change-Id: Ic9d1f6f0e1ff81025b8b8d8d04f98026301c900f
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
7 years agohid: rkvr: add touch panel support
lanshh [Tue, 11 Oct 2016 08:39:13 +0000 (16:39 +0800)]
hid: rkvr: add touch panel support

Change-Id: Icc4393db25f4def8ac663dd7e4cb7779a80446cc
Signed-off-by: lanshh <lsh@rock-chips.com>
7 years agohid: rkvr: change sync implement
lanshh [Tue, 11 Oct 2016 08:13:52 +0000 (16:13 +0800)]
hid: rkvr: change sync implement

Change-Id: I2c18d79339f067e8b567be0568ff3de8a8934a27
Signed-off-by: lanshh <lsh@rock-chips.com>
7 years agousb: rockchip-inno-usb2: use EXTCON_USB_VBUS_EN to control vbus
Meng Dongyang [Wed, 12 Oct 2016 11:26:10 +0000 (19:26 +0800)]
usb: rockchip-inno-usb2: use EXTCON_USB_VBUS_EN to control vbus

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>
7 years agousb: dwc3: rockchip: force dwc3 suspend immediately after disconneted
Meng Dongyang [Tue, 11 Oct 2016 09:59:58 +0000 (17:59 +0800)]
usb: dwc3: rockchip: force dwc3 suspend immediately after disconneted

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>
7 years agousb: dwc3: rockchip: set dwc3 enter runtime suspend immediately
Meng Dongyang [Tue, 11 Oct 2016 09:40:19 +0000 (17:40 +0800)]
usb: dwc3: rockchip: set dwc3 enter runtime suspend immediately

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>
7 years agopower: rk818_charger: get cable state when usb charge function init
Meng Dongyang [Tue, 11 Oct 2016 09:25:14 +0000 (17:25 +0800)]
power: rk818_charger: get cable state when usb charge function init

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>
7 years agousb: rockchip-inno-usb2: init cable state when u2phy probe
Meng Dongyang [Tue, 11 Oct 2016 09:08:10 +0000 (17:08 +0800)]
usb: rockchip-inno-usb2: init cable state when u2phy probe

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>
7 years agousb: dwc3: rockchip: enable dwc3 to be a wakeup source
Meng Dongyang [Wed, 12 Oct 2016 07:55:39 +0000 (15:55 +0800)]
usb: dwc3: rockchip: enable dwc3 to be a wakeup source

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>
7 years agoarm64: dts: rockchip: set dwc3 dr_mode as otg for rk3399-android-next
Wu Liang feng [Thu, 13 Oct 2016 06:24:53 +0000 (14:24 +0800)]
arm64: dts: rockchip: set dwc3 dr_mode as otg for rk3399-android-next

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>
7 years agousb: dwc3: rockchip: fix xhci NULL pointer dereference
Wu Liang feng [Thu, 13 Oct 2016 06:08:52 +0000 (14:08 +0800)]
usb: dwc3: rockchip: fix xhci NULL pointer dereference

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>
7 years agoarm64: dts: rockchip: add USB3 an DP child nodes for tcphy
Wu Liang feng [Thu, 13 Oct 2016 01:27:17 +0000 (09:27 +0800)]
arm64: dts: rockchip: add USB3 an DP child nodes for tcphy

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>
7 years agoFIXUP: UPSTREAM: phy: Add USB Type-C PHY driver for rk3399
Wu Liang feng [Wed, 12 Oct 2016 16:22:49 +0000 (00:22 +0800)]
FIXUP: UPSTREAM: phy: Add USB Type-C PHY driver for rk3399

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>
7 years agodrm/rockchip: vop: support afbdc
Mark Yao [Fri, 12 Aug 2016 10:10:58 +0000 (18:10 +0800)]
drm/rockchip: vop: support afbdc

Change-Id: If22924904f6d0362ba2abef0ddfe715684aca58a
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agousb: dwc3: rockchip: fix otg plug out error before resume
Meng Dongyang [Fri, 7 Oct 2016 05:50:59 +0000 (13:50 +0800)]
usb: dwc3: rockchip: fix otg plug out error before resume

ID dig disconnect interrupt will happen and notify dwc3 controller
to remove hcd as soon as resume, and release root hub, but the hcd
has not resume, so there is a logic error and it may result in NULL
pointer, this patch forbid remove hcd when the state of hcd is suspend.

Change-Id: Ia5673848a23528cd053d75910c0fdbddf0927a40
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
7 years agoFROMLIST: drm/bridge: analogix: protect power when get_modes or detect
Mark Yao [Wed, 12 Oct 2016 10:03:08 +0000 (18:03 +0800)]
FROMLIST: drm/bridge: analogix: protect power when get_modes or detect

The drm callback ->detect and ->get_modes seems is not power safe,
they may be called when device is power off, do register access on
detect or get_modes will cause system die.

Here is the path call ->detect before analogix_dp power on
[<ffffff800843babc>] analogix_dp_detect+0x44/0xdc
[<ffffff80083fd840>] drm_helper_probe_single_connector_modes_merge_bits+0xe8/0x41c
[<ffffff80083fdb84>] drm_helper_probe_single_connector_modes+0x10/0x18
[<ffffff8008418d24>] drm_mode_getconnector+0xf4/0x304
[<ffffff800840cff0>] drm_ioctl+0x23c/0x390
[<ffffff80081a8adc>] do_vfs_ioctl+0x4b8/0x58c
[<ffffff80081a8c10>] SyS_ioctl+0x60/0x88

Change-Id: Ica3fda1f22f903ee9ba2f0caed40cdae9bdfa32b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9374135)

7 years agoFROMLIST: drm: add ARM vendor format afbc
Mark Yao [Sat, 10 Sep 2016 01:57:05 +0000 (09:57 +0800)]
FROMLIST: drm: add ARM vendor format afbc

AFBC is arm vendor format, it's a compressed format.

The AFBC format is supported by rk3399 vop big.

We know little about AFBC layout, hope to some guys can
fixme about the afbc comment.

Change-Id: I9b3edaeb8cc7ffb792820c2f9a60d91fd0c6c28b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9324667/)

7 years agoarm64: rockchip_defconfig: enable drm display drivers
Mark Yao [Wed, 12 Oct 2016 03:08:11 +0000 (11:08 +0800)]
arm64: rockchip_defconfig: enable drm display drivers

enable ROCKCHIP_ANALOGIX_DP, ROCKCHIP_INNO_HDMI and ROCKCHIP_LVDS

Change-Id: I2bd0836bdb04b2c560834e8de31b37ce7a4fae79
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agousb: dwc3: rockchip: remove unused NULL pointer handle otg_work
William wu [Mon, 10 Oct 2016 04:37:51 +0000 (12:37 +0800)]
usb: dwc3: rockchip: remove unused NULL pointer handle otg_work

We make sure that get drvdata dwc before register extcon
notifier and schedule otg_work, so we can remove the dwc
NULL pointer handle safely.

Also, change the WARN_ON to dev_warn, and avoid log noise.

Change-Id: Icececf3bb5ad510b91d2c3a50e2126225673605e
Signed-off-by: William wu <wulf@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: Fix race conditions involving extcon
William wu [Mon, 10 Oct 2016 03:53:09 +0000 (11:53 +0800)]
CHROMIUM: usb: dwc3: rockchip: Fix race conditions involving extcon

Use a lock to ensure that the extcon callback only runs after probe()
has finished. In suspend() we unregister the extcon handler to prevent
it from being executed when the controller is suspended, which might
lead to crashes or unexpected behavior.

TEST=build and boot on 3399 board; plug in a USB device and verify
whether it is enumerated; suspend the DUT; resume the DUT; unplug
and re-plug the USB device and verify it is enumerated.

Change-Id: I965e66631a2d0f4d6cc53917d6a6e80bf8774fe1
Signed-off-by: William wu <wulf@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: fix otg reset problem
William wu [Sun, 9 Oct 2016 16:26:20 +0000 (00:26 +0800)]
CHROMIUM: usb: dwc3: rockchip: fix otg reset problem

We need to ensure the dwc controller stay in P2 state prior
to phy init. In order to set dwc controller in P2 state,
there're two methods:

1. Hold dwc controller in reset while initialize phy.
2. Do OTG reset before phy init, one thing to note here is
   that we can't reinit dwc controller again prior to phy init.

We choose the second mothod now. Because asserting the OTG
reset may affect dwc chip operation. The reset will clear all
of the dwc controller registers, and there are no synchronization
primitives, meaning the dwc3 core code could at least in theory
access chip registers while the reset is asserted, with unknown
impact. So we need to deassert the OTG reset as soon as possible.
Since phy init may take a long time, we can't hold the reset while
initialize phy.

Also, we add otg reset if dwc controller works as peripheral mode.

Change-Id: I54fec922308f62bfc7ebdde3e07ede9347e8f70a
Signed-off-by: William wu <wulf@rock-chips.com>