firefly-linux-kernel-4.4.55.git
7 years agoUPSTREAM: PM / Domains: Allow runtime PM during system PM phases
Ulf Hansson [Mon, 30 May 2016 09:33:13 +0000 (11:33 +0200)]
UPSTREAM: PM / Domains: Allow runtime PM during system PM phases

In cases when a PM domain isn't powered off when genpd's ->prepare()
callback is invoked, genpd runtime resumes and disables runtime PM for the
device. This behaviour was needed when genpd managed intermediate states
during the power off sequence, as to maintain proper low power states of
devices during system PM suspend/resume.

Commit ba2bbfbf6307 (PM / Domains: Remove intermediate states from the
power off sequence), enables genpd to improve its behaviour in that
respect.

The PM core disables runtime PM at __device_suspend_late() before it calls
a system PM "late" callback for a device. When resuming a device, after a
corresponding "early" callback has been invoked, the PM core re-enables
runtime PM.

By changing genpd to allow runtime PM according to the same system PM
phases as the PM core, devices can be runtime resumed by their
corresponding subsystem/driver when really needed.

In this way, genpd no longer need to runtime resume the device from its
->prepare() callback. In most cases that avoids unnecessary and energy-
wasting operations of runtime resuming devices that have nothing to do,
only to runtime suspend them shortly after.

Although, because of changing this behaviour in genpd and due to that
genpd powers on the PM domain unconditionally in the system PM resume
"noirq" phase, it could potentially cause a PM domain to stay powered
on even if it's unused after the system has resumed. To avoid this,
schedule a power off work when genpd's system PM ->complete() callback
has been invoked for the last device in the PM domain.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4d23a5e84806b202d9231929c9507ef7cf7a0185)

Change-Id: I195392386758b1320107d17f4e54c3c220263a9c
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: PM / Domains: Remove redundant pm_request_idle() call in genpd
Ulf Hansson [Mon, 30 May 2016 09:33:11 +0000 (11:33 +0200)]
UPSTREAM: PM / Domains: Remove redundant pm_request_idle() call in genpd

The PM core increases the runtime PM usage count at the system PM prepare
phase. Later when the system resumes, it does a pm_runtime_put() in the
complete phase, which in addition to decrementing the usage count, does
the equivalent of a pm_request_idle().

Therefore the call to pm_request_idle() from within genpd's ->complete()
callback is redundant, so remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 9b002b8f0e386966dfc2dddf47eebed3b71ef876)

Change-Id: I3b6b3cb1b7675f7a9579b57d801efa5ea55c0e4e
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: PM / Domains: Remove redundant wrapper functions for system PM
Ulf Hansson [Mon, 30 May 2016 09:43:08 +0000 (11:43 +0200)]
UPSTREAM: PM / Domains: Remove redundant wrapper functions for system PM

Due to the previous changes in genpd, which removed the suspend_power_off
flag, several of the system PM callbacks no longer do any additional
checks but only invoke corresponding pm_generic_* helper functions.

To clean up the code, drop these wrapper functions as they have
become redundant. Instead, assign the system PM callbacks directly
to the pm_generic_*() helper functions.

While changing this, it has bocame clear that some of the current
system PM callbacks in genpd invoke wrong driver callbacks. For
example, the genpd's ->restore() callback invokes pm_generic_resume(),
while that should be pm_generic_restore(). Fix that as well.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 800188538965d90759cea13bcb4f87a214cf5c53)

Change-Id: I463cc0a8c4d6d2e69dd320ff58af3cf2e999e6ee
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: PM / Domains: Allow genpd to power on during system PM phases
Ulf Hansson [Mon, 30 May 2016 09:43:07 +0000 (11:43 +0200)]
UPSTREAM: PM / Domains: Allow genpd to power on during system PM phases

If a PM domain is powered off when the first device starts its system PM
prepare phase, genpd prevents any further attempts to power on the PM
domain during the following system PM phases. Not until the system PM
complete phase is finalized for all devices in the PM domain, genpd again
allows it to be powered on.

This behaviour needs to be changed, as a subsystem/driver for a device in
the same PM domain may still need to be able to serve requests in some of
the system PM phases. Accordingly, it may need to runtime resume its
device and thus also request the corresponding PM domain to be powered on.

To deal with these scenarios, let's make the device operational in the
system PM prepare phase by runtime resuming it, no matter if the PM domain
is powered on or off. Changing this also enables us to remove genpd's
suspend_power_off flag, as it's being used to track this condition.
Additionally, we must allow the PM domain to be powered on via runtime PM
during the system PM phases.

This change also requires a fix in the AMD ACP (Audio CoProcessor) drm
driver. It registers a genpd to model the ACP as a PM domain, but
unfortunately it's also abuses genpd's "internal" suspend_power_off flag
to deal with a corner case at system PM resume.

More precisely, the so called SMU block powers on the ACP at system PM
resume, unconditionally if it's being used or not. This may lead to that
genpd's internal status of the power state, may not correctly reflect the
power state of the HW after a system PM resume.

Because of changing the behaviour of genpd, by runtime resuming devices in
the prepare phase, the AMD ACP drm driver no longer have to deal with this
corner case. So let's just drop the related code in this driver.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 39dd0f234fc37da071dadbd9b49fe800d62139b4)

Change-Id: I1c964ebd660c8c7a8547f2206c80c25b936e7196
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: PM / Domains: Drop unnecessary wakeup code from pm_genpd_prepare()
Ulf Hansson [Tue, 26 Apr 2016 06:47:18 +0000 (08:47 +0200)]
UPSTREAM: PM / Domains: Drop unnecessary wakeup code from pm_genpd_prepare()

As the PM core already have wakeup management during the system PM phase,
it seems reasonable that genpd and its users should be able to rely on
that. Therefore let's remove this from pm_genpd_prepare().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 164a2159a2d6789bc7e3c4b126dde7f3ce865992)

Change-Id: I39f72aa82468327c01b4533d177f797bf2da59a6
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: PM / Domains: Remove redundant pm_runtime_get|put*() in pm_genpd_prepare()
Ulf Hansson [Tue, 26 Apr 2016 06:47:17 +0000 (08:47 +0200)]
UPSTREAM: PM / Domains: Remove redundant pm_runtime_get|put*() in pm_genpd_prepare()

The PM core increases and decreases the runtime PM usage count in the
system PM prepare phase. This makes some of the pm_runtime_get|put*()
calls in pm_genpd_prepare() redundant, so let's remove them.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 624c8df7d2823ec0df9609025480309322886ed3)

Change-Id: I0e9a2027740147ef6674993039062d2c3cb2513a
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm64: dts: rockchip: fix dp register fail for rk3399-mid
Bin Yang [Wed, 15 Feb 2017 02:45:08 +0000 (10:45 +0800)]
arm64: dts: rockchip: fix dp register fail for rk3399-mid

1. MID board is only one dp port, we need to assign a phy.
2. MID board not use HDMI, we need to disabled it.

Change-Id: I589373fa04b940681910b3c0ee58ee9f9f464916
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agoarm64: dts: rk3399-box-next: using drm hdmi audio framework
Sugar Zhang [Wed, 15 Feb 2017 08:32:55 +0000 (16:32 +0800)]
arm64: dts: rk3399-box-next: using drm hdmi audio framework

Change-Id: Ia217fdb6c9f8e77079ff5e5683d277fda6aeab5b
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoARM64: rockchip_defconfig: enable CONFIG_DRM_DW_HDMI_I2S_AUDIO
Sugar Zhang [Wed, 15 Feb 2017 08:29:44 +0000 (16:29 +0800)]
ARM64: rockchip_defconfig: enable CONFIG_DRM_DW_HDMI_I2S_AUDIO

enable CONFIG_DRM_DW_HDMI_I2S_AUDIO for drm hdmi audio.

Change-Id: I674b4dc0025539f9e9f72f286a90ab53bf83af5c
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoarm64: dts: rockchip: add u2phy grf and usb2.0 controller node
Meng Dongyang [Fri, 30 Dec 2016 04:28:58 +0000 (12:28 +0800)]
arm64: dts: rockchip: add u2phy grf and usb2.0 controller node

Support usb2.0 for rk3328.
Add node usb2phy_grf for usb2.0 phy.
Add node usb_host0_ehci for ehci controller.
Add node usb_host0_ohci for ohci controller.

Change-Id: Ia0adfa4c8cd16735e899491e1dc91d37bd348364
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
7 years agophy: rockchip-inno-usb2: add support of u2phy for rk3328
Meng Dongyang [Fri, 30 Dec 2016 03:45:20 +0000 (11:45 +0800)]
phy: rockchip-inno-usb2: add support of u2phy for rk3328

The u2phy driver of kernel 4.4 need add config and specific tuning
for rk3328. This patch add support of u2phy for rk3328.

Change-Id: Ie1bdfc0fde37d7d0b26d0f3aac136481bd6f4c44
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
7 years agoDocumentation: bindings: add DT documentation for u2phy and u2phy grf
Meng Dongyang [Fri, 30 Dec 2016 06:13:41 +0000 (14:13 +0800)]
Documentation: bindings: add DT documentation for u2phy and u2phy grf

Due to the u2phy registers are separated from general grf, we need to
add u2phy grf node and place u2phy node in it. And on some platform,
the 480m clock may need to assign clock parent in dts in stead of
clock driver. So this patch add u2phy grf node and property of
assigned-clocks and assigned-clock-parents to assign parent for 480m
clock.

Change-Id: I88e63745e38265814169136f079a00791f5813b3
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
7 years agoARM64: dts: rk3399-tve1205g: fix gpio set error for hall sensor
Zhou weixin [Tue, 14 Feb 2017 06:45:37 +0000 (14:45 +0800)]
ARM64: dts: rk3399-tve1205g: fix gpio set error for hall sensor

Change-Id: I39a0be31cf56106efdd11f3ea00234004b7e420c
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
7 years agoarm64: dts: rockchip: add auto dp config for rk3399-box-rev2-disvr dts
Luo wei [Sun, 5 Feb 2017 09:36:11 +0000 (17:36 +0800)]
arm64: dts: rockchip: add auto dp config for rk3399-box-rev2-disvr dts

Change-Id: I149ee371a9d11a807bf94c3cff8e3dc36d605853
Signed-off-by: Luo wei <lw@rock-chips.com>
7 years agovideo: rockchip: add auto dp support for vr product
Luo wei [Wed, 18 Jan 2017 09:49:34 +0000 (17:49 +0800)]
video: rockchip: add auto dp support for vr product

Change-Id: Ic4e4a3c0214c23bd55d883df6d2106646ef33614
Signed-off-by: Luo wei <lw@rock-chips.com>
7 years agopower: rk818-charger: set sleep otg 5v by otg_in status and dts
Jianhong Chen [Mon, 19 Dec 2016 06:37:53 +0000 (14:37 +0800)]
power: rk818-charger: set sleep otg 5v by otg_in status and dts

Change-Id: I1b2c14dfa64fe382e05717c5e9bb6a5617badba0
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agodrm: bridge/dw_hdmi: add switch state to support hdmi audio
Bin Yang [Thu, 9 Feb 2017 10:15:30 +0000 (18:15 +0800)]
drm: bridge/dw_hdmi: add switch state to support hdmi audio

Change-Id: Ib8122f9cc913d2cd15b92a3d6c57c7edf77d0483
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: add switch state to support dp audio
Bin Yang [Wed, 8 Feb 2017 09:14:09 +0000 (17:14 +0800)]
drm/rockchip: cdn-dp: add switch state to support dp audio

Change-Id: Ifb4f6c8c2ecc0df5a021c38c7b5fe57da5c98e6b
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agopower_supply: bq25700: update status when charger pull out
Shunqing Chen [Mon, 23 Jan 2017 01:38:12 +0000 (09:38 +0800)]
power_supply: bq25700: update status when charger pull out

Change-Id: I416aba3e0318544497bdf444df213461fd10ec7e
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
7 years agorockchip: clk: rk3399: remove the flag ROCKCHIP_PLL_SYNC_RATE for VPLL and CPLL
Elaine Zhang [Fri, 10 Feb 2017 02:29:46 +0000 (10:29 +0800)]
rockchip: clk: rk3399: remove the flag ROCKCHIP_PLL_SYNC_RATE for VPLL and CPLL

to slove the display shaking, when uboot logo display to kernel show.

Change-Id: I804aa09f24bc4fa7b6314a7a5487f0ee1a321724
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm64: dts: rockchip: clk: rk3399: support dual pll for vop on drm
Elaine Zhang [Fri, 10 Feb 2017 02:23:24 +0000 (10:23 +0800)]
arm64: dts: rockchip: clk: rk3399: support dual pll for vop on drm

attention:
if the vopb is for hdmi,the vopb parent clk must be vpll
and the vopl parent clk is cpll or others plls.
if the vopl is for hdmi,the vopl parent clk must be vpll
and the vopb parent clk is cpll or other plls.

Change-Id: I9056fbdbfcdb7a71f2e7ee5d57a0db8523be66ef
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm64: dts: rockchip: set hdmi ddc channel for excavator linux
yuyz [Thu, 9 Feb 2017 03:30:57 +0000 (11:30 +0800)]
arm64: dts: rockchip: set hdmi ddc channel for excavator linux

Change-Id: Ibef432d0b9a6a38d06e4841b7e97a5cbbea91da9
Signed-off-by: yuyz <yuyz@rock-chips.com>
7 years agoARM64: dts: rk3399-box: Add a new infrared remote control button
Zhangbin Tong [Thu, 9 Feb 2017 06:33:36 +0000 (14:33 +0800)]
ARM64: dts: rk3399-box: Add a new infrared remote control button

Change-Id: Idd384a9c8635772f3c53a0a1f60739998db1704a
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
7 years agoARM64: dts: rk3399: enable rockchip-suspend for box
Zhangbin Tong [Wed, 8 Feb 2017 07:04:48 +0000 (15:04 +0800)]
ARM64: dts: rk3399: enable rockchip-suspend for box

Change-Id: Ibfaee3b898dc77673b806e6a46570320918b9a5e
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
7 years agoFROMLIST: serial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt
Douglas Anderson [Mon, 6 Feb 2017 23:30:00 +0000 (15:30 -0800)]
FROMLIST: serial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt

On a Rockchip rk3399-based board during suspend/resume testing, we
found that we could get the console UART into a state where it would
print this to the console a lot:
  serial8250: too much work for irq42

Followed eventually by:
  NMI watchdog: BUG: soft lockup - CPU#0 stuck for 11s!

Upon debugging I found that we're in this state:
  iir = 0x000000cc
  lsr = 0x00000060

It appears that somehow we have a RX Timeout interrupt but there is no
actual data present to receive.  When we're in this state the UART
driver claims that it handled the interrupt but it actually doesn't
really do anything.  This means that we keep getting the interrupt
over and over again.

Normally we don't actually need to do anything special to handle a RX
Timeout interrupt.  We'll notice that there is some data ready and
we'll read it, which will end up clearing the RX Timeout.  In this
case we have a problem specifically because we got the RX TImeout
without any data.  Reading a bogus byte is confirmed to get us out of
this state.

It's unclear how exactly the UART got into this state, but it is known
that the UART lines are essentially undriven and unpowered during
suspend, so possibly during resume some garbage / half transmitted
bits are seen on the line and put the UART into this state.

The UART on the rk3399 is a DesignWare based 8250 UART.  From mailing
list posts, it appears that other people have run into similar
problems with DesignWare based IP.  Presumably this problem is unique
to that IP, so I have placed the workaround there to avoid possibly of
accidentally triggering bad behavior on other IP.  Also note the RX
Timeout behaves very differently in the DMA case, for for now the
workaround is only applied to the non-DMA case.

BUG=chrome-os-partner:59918
TEST=suspend_stress_test

Change-Id: I99974b2977527868c6216ac624dcb8bc9b64cf46
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(am from https://patchwork.kernel.org/patch/9558923/)
Reviewed-on: https://chromium-review.googlesource.com/421577
Reviewed-by: Caesar Wang <wxt@rock-chips.com>
7 years agodrm/panel: simple: fixup AUO B125HAN03.1 panel timing
WeiYong Bi [Thu, 9 Feb 2017 03:34:34 +0000 (11:34 +0800)]
drm/panel: simple: fixup AUO B125HAN03.1 panel timing

Change-Id: I488eb97c4e250de78e606a894c52f757fd18c7bb
Signed-off-by: WeiYong Bi <bivvy.bi@rock-chips.com>
7 years agodrm/panel: move hardcode timing top of mode list
Mark Yao [Thu, 9 Feb 2017 08:38:43 +0000 (16:38 +0800)]
drm/panel: move hardcode timing top of mode list

Change-Id: I76cc9ae6cfdac77e8ed0953da35b17491f5fae6c
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/panel: override panel if dts config exist
Mark Yao [Thu, 9 Feb 2017 08:27:00 +0000 (16:27 +0800)]
drm/panel: override panel if dts config exist

Change-Id: I326e28bf334025542f1bc46f80d41eee74b57286
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add dp audio support for rk3399-tve1205g
Bin Yang [Wed, 8 Feb 2017 01:49:13 +0000 (09:49 +0800)]
arm64: dts: rockchip: add dp audio support for rk3399-tve1205g

Change-Id: I63c3faa8d6218d77f29776035ac8098695f65629
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable cdn dp machine driver
Bin Yang [Wed, 8 Feb 2017 01:40:07 +0000 (09:40 +0800)]
arm64: rockchip_defconfig: enable cdn dp machine driver

Change-Id: I9568d07c59210cf1132a018c81aadc3e1993ec7f
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agoarm64: dts: rockchip: add dual port dp support for rk3399-tve1205g
Bin Yang [Wed, 8 Feb 2017 01:15:14 +0000 (09:15 +0800)]
arm64: dts: rockchip: add dual port dp support for rk3399-tve1205g

Change-Id: I6212cf1f829374ef2dac7ecda5ac5f0033ff5ba0
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agoclk: rockchip: describe clk_gmac2io_ext using the new muxgrf type on rk3328
Elaine Zhang [Tue, 7 Feb 2017 09:40:19 +0000 (17:40 +0800)]
clk: rockchip: describe clk_gmac2io_ext using the new muxgrf type on rk3328

Change-Id: I6b86bd2244fda5e1eac52be4b5399230bfc9875e
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agodt-bindings: clock: rk3328: add clk_mac2io_ext ID
Elaine Zhang [Tue, 7 Feb 2017 09:39:11 +0000 (17:39 +0800)]
dt-bindings: clock: rk3328: add clk_mac2io_ext ID

Change-Id: I1f17c50020d5f37f5cfd6a4d0ecfc195bad2687d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoARM64: dts: rk3399: enable rockchip-suspend for evb3
shengfei Xu [Mon, 6 Feb 2017 07:45:12 +0000 (15:45 +0800)]
ARM64: dts: rk3399: enable rockchip-suspend for evb3

Change-Id: I1d1511965c2eb7c04a7f91f093e95f2eceeb4790
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
7 years agoarm64: dts: rockchip: add rockchip-suspend node for rk3399
Shengfei xu [Tue, 17 Jan 2017 07:15:03 +0000 (15:15 +0800)]
arm64: dts: rockchip: add rockchip-suspend node for rk3399

Change-Id: I6af1f487f40c0775102d3b9951617c5d03b884ef
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable suspend mode config
Shengfei xu [Tue, 17 Jan 2017 06:46:21 +0000 (14:46 +0800)]
arm64: rockchip_defconfig: enable suspend mode config

Change-Id: Ifdf47ad8ff9303f5b94362f73f5115faaa3403d0
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable SIP interface
Shengfei xu [Tue, 17 Jan 2017 06:42:41 +0000 (14:42 +0800)]
arm64: rockchip_defconfig: enable SIP interface

Change-Id: I4f805ac550c291f4d0821cf7b2eb1eefe54ce067
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
7 years agosuspend: rockchip: set the suspend config to ATF
Shengfei xu [Thu, 5 Jan 2017 08:55:54 +0000 (16:55 +0800)]
suspend: rockchip: set the suspend config to ATF

Change-Id: I400aa252c24b814e3da7fa6703a4e03a1c90d572
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
7 years agodt-bindings: suspend: remove unused rockchip-pm.h
Huang, Tao [Tue, 7 Feb 2017 03:11:47 +0000 (11:11 +0800)]
dt-bindings: suspend: remove unused rockchip-pm.h

Which is legacy code, do not need any more.

Change-Id: I15f5cbf1389a6442fca6fbf348d2d94a59510338
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM: dts: rockchip: fix some incorrect supply for miniarm
Ziyuan Xu [Sun, 5 Feb 2017 09:51:43 +0000 (17:51 +0800)]
ARM: dts: rockchip: fix some incorrect supply for miniarm

Redress the supply node for rk3288-miniarm board, which obey strictly
schematic.

Change-Id: I2c38c7ec080bc836e77857af3a6d3ef02345a120
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
7 years agodrm/rockchip: fix race with kms hotplug and fbdev
Mark Yao [Mon, 23 Jan 2017 08:20:08 +0000 (16:20 +0800)]
drm/rockchip: fix race with kms hotplug and fbdev

Kms hotplug event may race into fbdev helper initial, that would
cause the bug:

[    0.735411] [00000200] *pgd=00000000f6ffe003, *pud=00000000f6ffe003, *pmd=0000000000000000
[    0.736156] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[    0.736648] Modules linked in:
[    0.736930] CPU: 2 PID: 20 Comm: kworker/2:0 Not tainted 4.4.41 #20
[    0.737480] Hardware name: Rockchip RK3399 Board rev2 (BOX) (DT)
[    0.738020] Workqueue: events cdn_dp_pd_event_work
[    0.738447] task: ffffffc0f21f3100 ti: ffffffc0f2218000 task.ti: ffffffc0f2218000
[    0.739109] PC is at mutex_lock+0x14/0x44
[    0.739469] LR is at drm_fb_helper_hotplug_event+0x30/0x114
[    0.756253] [<ffffff8008a344f4>] mutex_lock+0x14/0x44
[    0.756260] [<ffffff8008445708>] drm_fb_helper_hotplug_event+0x30/0x114
[    0.756271] [<ffffff8008473c84>] rockchip_drm_output_poll_changed+0x18/0x20
[    0.756280] [<ffffff8008439fcc>] drm_kms_helper_hotplug_event+0x28/0x34
[    0.756286] [<ffffff800846c444>] cdn_dp_pd_event_work+0x394/0x3c4
[    0.756295] [<ffffff80080b2b38>] process_one_work+0x218/0x3e0
[    0.756302] [<ffffff80080b3538>] worker_thread+0x2e8/0x404
[    0.756308] [<ffffff80080b7e70>] kthread+0xe8/0xf0
[    0.756316] [<ffffff8008082690>] ret_from_fork+0x10/0x40

Change-Id: I8d594183cf8187131418a0096dde840cbf01ed6b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: dw_hdmi: get rid of clock slop
Mark Yao [Sun, 22 Jan 2017 07:39:33 +0000 (15:39 +0800)]
drm/rockchip: dw_hdmi: get rid of clock slop

Clock slop is a solution for rk3288, not suitable for rk3399,
after use crtc mode_valid, we can remove the clock slop.

Change-Id: I68121505dfb7e65bf09c26d51c23edc909bdb517
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: check display mode with crtc mode valid
Mark Yao [Sun, 22 Jan 2017 07:46:48 +0000 (15:46 +0800)]
drm/rockchip: cdn-dp: check display mode with crtc mode valid

Change-Id: I431ae8e56c18b827e1995ce0dec125c585d096f9
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: dw_hdmi: check display mode with crtc mode valid
Mark Yao [Sun, 22 Jan 2017 07:54:24 +0000 (15:54 +0800)]
drm/rockchip: dw_hdmi: check display mode with crtc mode valid

Change-Id: I23470e46b97169da0b59153dfc0835833f1aa549
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: vop: support mode_valid for crtc
Mark Yao [Sun, 22 Jan 2017 07:53:49 +0000 (15:53 +0800)]
drm/rockchip: vop: support mode_valid for crtc

Change-Id: I51f2377c5bd4bdecf44ad31f11e4e7131c2c10c1
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rk3399-android-next: add cdn display node
Mark Yao [Sun, 22 Jan 2017 04:38:49 +0000 (12:38 +0800)]
arm64: dts: rk3399-android-next: add cdn display node

Change-Id: I3c940e330ceab488da3d4351de3a3f9500a6fb5e
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rk3399-android-next: use status disabled instead delete node
Mark Yao [Sun, 22 Jan 2017 04:00:01 +0000 (12:00 +0800)]
arm64: dts: rk3399-android-next: use status disabled instead delete node

Change-Id: Ia959ade5dda6f22682293494bafb45bdccba02be
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm: of: don't mask possible_crtcs if remote-point is disabled
Mark Yao [Sun, 22 Jan 2017 03:56:06 +0000 (11:56 +0800)]
drm: of: don't mask possible_crtcs if remote-point is disabled

Change-Id: I98d42ce5c9a5ed832e455a3d1fc88cf3ec717d69
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoASoC: rockchip: i2s: add other configurable formats
zhangjun [Fri, 20 Jan 2017 06:03:34 +0000 (14:03 +0800)]
ASoC: rockchip: i2s: add other configurable formats

simple-audio-card,bitclock-inversion = <1> : bclk falling edge taken
simple-audio-card,format = "dsp_a" : pcm no delay mode
simple-audio-card,format = "dsp_b" : pcm late 1 mode

Change-Id: I3d99fd04ee63dec46eb74c625b1e43e698092fe5
Signed-off-by: zhangjun <zhangjun@rock-chips.com>
7 years agoUPSTREAM: PCI: rockchip: Mark PM functions as __maybe_unused
Arnd Bergmann [Sun, 5 Feb 2017 02:19:54 +0000 (10:19 +0800)]
UPSTREAM: PCI: rockchip: Mark PM functions as __maybe_unused

When CONFIG_PM_SLEEP is disabled, we get harmless build warnings:

host/pcie-rockchip.c:1267:12: error: 'rockchip_pcie_resume_noirq'
defined but not used [-Werror=unused-function]
host/pcie-rockchip.c:1240:12: error: 'rockchip_pcie_suspend_noirq'
defined but not used [-Werror=unused-function]

Marking both functions as __maybe_unused avoids the warning without
the need for #ifdef around them.

Change-Id: Ic5f9f9d576049b77fd091488c785d09c46cb9b78
Fixes: 013dd3d5e183 ("PCI: rockchip: Add system PM support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git
commit 0b351c986a5ffedb502632c1b27690c9730d79c4)

7 years agoUPSTREAM: PCI: rockchip: improve the training polling code
Shawn Lin [Wed, 18 Jan 2017 03:03:17 +0000 (11:03 +0800)]
UPSTREAM: PCI: rockchip: improve the training polling code

Use the readl_poll_timeout instead of open coding them.

Change-Id: I68e801d395d3258a8a18ead2e18c2c479625d1fa
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/helgaas/pci.git
commit 7faebda21d573a6889bab1e0100ed4092a5a4716)

7 years agoANDROID: pagemap: do not leak physical addresses to non-privileged userspace
Kirill A. Shutemov [Mon, 9 Mar 2015 21:11:12 +0000 (23:11 +0200)]
ANDROID: pagemap: do not leak physical addresses to non-privileged userspace

As pointed by recent post[1] on exploiting DRAM physical imperfection,
/proc/PID/pagemap exposes sensitive information which can be used to do
attacks.

This disallows anybody without CAP_SYS_ADMIN to read the pagemap.

[1] http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.html

[ Eventually we might want to do anything more finegrained, but for now
  this is the simple model.   - Linus ]

We add this patch again for pass CTS
FileSystemPermissionTest: Assert /proc/self/pagemap not readable

Change-Id: Id4bf9ea27af000734356b921cd723868802b4335
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Seaborn <mseaborn@chromium.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoselinux: nlmsgtab: add SOCK_DESTROY to the netlink mapping tables
Lorenzo Colitti [Wed, 3 Feb 2016 15:52:15 +0000 (00:52 +0900)]
selinux: nlmsgtab: add SOCK_DESTROY to the netlink mapping tables

Without this, using SOCK_DESTROY in enforcing mode results in:

  SELinux: unrecognized netlink message type=21 for sclass=32

Change-Id: I7862bb0fc83573567243ffa9549a2c7405b5986c

7 years agoclk: rockchip: rk3399: fix up the pr_err for debug
Elaine Zhang [Sun, 22 Jan 2017 06:57:29 +0000 (14:57 +0800)]
clk: rockchip: rk3399: fix up the pr_err for debug

Change-Id: I16eeacaf0307146ebf8db745621ef57e5ab16fec
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable dp driver for drm
Bin Yang [Mon, 19 Dec 2016 10:16:46 +0000 (18:16 +0800)]
arm64: rockchip_defconfig: enable dp driver for drm

Change-Id: I6f7061fb6cc8c3f36f8b5b6d569266061a443e46
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
7 years agodrm/rockchip: dw_hdmi: move vpll set rate to encoder enable
Mark Yao [Fri, 20 Jan 2017 07:15:35 +0000 (15:15 +0800)]
drm/rockchip: dw_hdmi: move vpll set rate to encoder enable

Change-Id: I5cf7f32f15cf1ea3e85b69009615756be3809c5e
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rk3399: fixup hdmi clocks node
Mark Yao [Fri, 20 Jan 2017 06:51:45 +0000 (14:51 +0800)]
arm64: dts: rk3399: fixup hdmi clocks node

Change-Id: If3c26da746b582e5b54fb953c04d75a3c640c19b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agofiq_debugger: Switch current cpu when the former cpu is offline
Huibin Hong [Thu, 19 Jan 2017 02:12:23 +0000 (10:12 +0800)]
fiq_debugger: Switch current cpu when the former cpu is offline

Change-Id: Ie1a5fe5c3496e5182f0f9aaab336a4d0ff683dfa
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agopwm: rockchip: add individual clocks supported for APB and function
david.wu [Fri, 20 Jan 2017 07:03:39 +0000 (15:03 +0800)]
pwm: rockchip: add individual clocks supported for APB and function

New PWM module provides two individual clocks for APB bus clock
and function clock.

Change-Id: I0c262472c5d8b0c527c5a0a8d66b4512ac66f2ce
Signed-off-by: david.wu <david.wu@rock-chips.com>
7 years agoARM64: dts: rk3399-tve1205g: add some config for uboot charge
Zhou weixin [Fri, 20 Jan 2017 02:07:53 +0000 (10:07 +0800)]
ARM64: dts: rk3399-tve1205g: add some config for uboot charge

1. add charge ic support max input voltage and current for fusb302 pd.
2. set uboot-exit-charge-level to 2.

Change-Id: I41558bd3d72c4ad8cd4392c6cbedb4b1ebf6b28c
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
7 years agoARM64: dts: rk3399-tve1205g: add config for uboot charge with fusb302 sink
Zhou weixin [Thu, 19 Jan 2017 13:59:07 +0000 (21:59 +0800)]
ARM64: dts: rk3399-tve1205g: add config for uboot charge with fusb302 sink

Change-Id: Ie1a54a1c05f0db2b16851728bdf442699b69f277
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
7 years agorockchip: clk: rk3399: Mark some grf clock as critical
Elaine Zhang [Fri, 20 Jan 2017 02:07:59 +0000 (10:07 +0800)]
rockchip: clk: rk3399: Mark some grf clock as critical

pclk_perihp_grf and pclk_vio_grf is for some grf regs read and write,
mark it as critical and it never turns off.

Change-Id: If9465334b9168b4376a7ac95d5f08e389048409f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agodrm/rockchip: vop: no need wait vblank on crtc enable
Mark Yao [Thu, 19 Jan 2017 09:49:52 +0000 (17:49 +0800)]
drm/rockchip: vop: no need wait vblank on crtc enable

Since atomic framework, crtc enable and disable are in pairs,
no need to wait vblank.

Change-Id: I87b630b89a8361b59f613d1954addd655b7a4e37
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: vop: add display input/output limit
Mark Yao [Thu, 19 Jan 2017 09:14:06 +0000 (17:14 +0800)]
drm/rockchip: vop: add display input/output limit

Change-Id: If218ca6d2de5c05b6f8ed417cefa437c62c31935
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoARM64: dts: rk3328-evb: support rk805
Jianhong Chen [Fri, 6 Jan 2017 08:51:55 +0000 (16:51 +0800)]
ARM64: dts: rk3328-evb: support rk805

Change-Id: I462c26188dbaaed84a1d7addd43dc1d95d5a3af7
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agoUPSTREAM: USB: don't free bandwidth_mutex too early
Alan Stern [Mon, 27 Jun 2016 14:23:10 +0000 (10:23 -0400)]
UPSTREAM: USB: don't free bandwidth_mutex too early

The USB core contains a bug that can show up when a USB-3 host
controller is removed.  If the primary (USB-2) hcd structure is
released before the shared (USB-3) hcd, the core will try to do a
double-free of the common bandwidth_mutex.

The problem was described in graphical form by Chung-Geol Kim, who
first reported it:

=================================================
     At *remove USB(3.0) Storage
     sequence <1> --> <5> ((Problem Case))
=================================================
                                  VOLD
------------------------------------|------------
                                 (uevent)
                            ________|_________
                           |<1>               |
                           |dwc3_otg_sm_work  |
                           |usb_put_hcd       |
                           |peer_hcd(kref=2)|
                           |__________________|
                            ________|_________
                           |<2>               |
                           |New USB BUS #2    |
                           |                  |
                           |peer_hcd(kref=1)  |
                           |                  |
                         --(Link)-bandXX_mutex|
                         | |__________________|
                         |
    ___________________  |
   |<3>                | |
   |dwc3_otg_sm_work   | |
   |usb_put_hcd        | |
   |primary_hcd(kref=1)| |
   |___________________| |
    _________|_________  |
   |<4>                | |
   |New USB BUS #1     | |
   |hcd_release        | |
   |primary_hcd(kref=0)| |
   |                   | |
   |bandXX_mutex(free) |<-
   |___________________|
                               (( VOLD ))
                            ______|___________
                           |<5>               |
                           |      SCSI        |
                           |usb_put_hcd       |
                           |peer_hcd(kref=0)  |
                           |*hcd_release      |
                           |bandXX_mutex(free*)|<- double free
                           |__________________|

=================================================

This happens because hcd_release() frees the bandwidth_mutex whenever
it sees a primary hcd being released (which is not a very good idea
in any case), but in the course of releasing the primary hcd, it
changes the pointers in the shared hcd in such a way that the shared
hcd will appear to be primary when it gets released.

This patch fixes the problem by changing hcd_release() so that it
deallocates the bandwidth_mutex only when the _last_ hcd structure
referencing it is released.  The patch also removes an unnecessary
test, so that when an hcd is released, both the shared_hcd and
primary_hcd pointers in the hcd's peer will be cleared.

Change-Id: I4416ecd383136fa5898a5d6900de1ecf30ba5c54
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Chung-Geol Kim <chunggeol.kim@samsung.com>
Tested-by: Chung-Geol Kim <chunggeol.kim@samsung.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
(cherry picked from commit ab2a4bf83902c170d29ba130a8abb5f9d90559e1)

7 years agoUPSTREAM: usb: core: hub: hub_port_init lock controller instead of bus
Chris Bainbridge [Mon, 25 Apr 2016 12:48:38 +0000 (13:48 +0100)]
UPSTREAM: usb: core: hub: hub_port_init lock controller instead of bus

The XHCI controller presents two USB buses to the system - one for USB2
and one for USB3. The hub init code (hub_port_init) is reentrant but
only locks one bus per thread, leading to a race condition failure when
two threads attempt to simultaneously initialise a USB2 and USB3 device:

[    8.034843] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[   13.183701] usb 3-3: device descriptor read/all, error -110

On a test system this failure occurred on 6% of all boots.

The call traces at the point of failure are:

Call Trace:
 [<ffffffff81b9bab7>] schedule+0x37/0x90
 [<ffffffff817da7cd>] usb_kill_urb+0x8d/0xd0
 [<ffffffff8111e5e0>] ? wake_up_atomic_t+0x30/0x30
 [<ffffffff817dafbe>] usb_start_wait_urb+0xbe/0x150
 [<ffffffff817db10c>] usb_control_msg+0xbc/0xf0
 [<ffffffff817d07de>] hub_port_init+0x51e/0xb70
 [<ffffffff817d4697>] hub_event+0x817/0x1570
 [<ffffffff810f3e6f>] process_one_work+0x1ff/0x620
 [<ffffffff810f3dcf>] ? process_one_work+0x15f/0x620
 [<ffffffff810f4684>] worker_thread+0x64/0x4b0
 [<ffffffff810f4620>] ? rescuer_thread+0x390/0x390
 [<ffffffff810fa7f5>] kthread+0x105/0x120
 [<ffffffff810fa6f0>] ? kthread_create_on_node+0x200/0x200
 [<ffffffff81ba183f>] ret_from_fork+0x3f/0x70
 [<ffffffff810fa6f0>] ? kthread_create_on_node+0x200/0x200

Call Trace:
 [<ffffffff817fd36d>] xhci_setup_device+0x53d/0xa40
 [<ffffffff817fd87e>] xhci_address_device+0xe/0x10
 [<ffffffff817d047f>] hub_port_init+0x1bf/0xb70
 [<ffffffff811247ed>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff817d4697>] hub_event+0x817/0x1570
 [<ffffffff810f3e6f>] process_one_work+0x1ff/0x620
 [<ffffffff810f3dcf>] ? process_one_work+0x15f/0x620
 [<ffffffff810f4684>] worker_thread+0x64/0x4b0
 [<ffffffff810f4620>] ? rescuer_thread+0x390/0x390
 [<ffffffff810fa7f5>] kthread+0x105/0x120
 [<ffffffff810fa6f0>] ? kthread_create_on_node+0x200/0x200
 [<ffffffff81ba183f>] ret_from_fork+0x3f/0x70
 [<ffffffff810fa6f0>] ? kthread_create_on_node+0x200/0x200

Which results from the two call chains:

hub_port_init
 usb_get_device_descriptor
  usb_get_descriptor
   usb_control_msg
    usb_internal_control_msg
     usb_start_wait_urb
      usb_submit_urb / wait_for_completion_timeout / usb_kill_urb

hub_port_init
 hub_set_address
  xhci_address_device
   xhci_setup_device

Mathias Nyman explains the current behaviour violates the XHCI spec:

 hub_port_reset() will end up moving the corresponding xhci device slot
 to default state.

 As hub_port_reset() is called several times in hub_port_init() it
 sounds reasonable that we could end up with two threads having their
 xhci device slots in default state at the same time, which according to
 xhci 4.5.3 specs still is a big no no:

 "Note: Software shall not transition more than one Device Slot to the
  Default State at a time"

 So both threads fail at their next task after this.
 One fails to read the descriptor, and the other fails addressing the
 device.

Fix this in hub_port_init by locking the USB controller (instead of an
individual bus) to prevent simultaneous initialisation of both buses.

Fixes: 638139eb95d2 ("usb: hub: allow to process more usb hub events in parallel")
Link: https://lkml.org/lkml/2016/2/8/312
Link: https://lkml.org/lkml/2016/2/4/748
Conflicts:
        drivers/usb/core/hcd.c

Change-Id: I5f266198d32793ea3bc009f64ffc8b2a7744461a
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
(cherry picked from commit feb26ac31a2a5cb88d86680d9a94916a6343e9e6)

7 years agoarm: dts: fix dts for rk3288-popmetal
Jacob Chen [Fri, 20 Jan 2017 01:33:40 +0000 (09:33 +0800)]
arm: dts: fix dts for rk3288-popmetal

We have so many evaluation boards.....

Change-Id: I1fec7821dc7b96a263fd07fb5b910f526f4d1389
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agonet: rkwifi: fix using wext protocol anomaly
zzc [Wed, 18 Jan 2017 01:21:47 +0000 (09:21 +0800)]
net: rkwifi: fix using wext protocol anomaly

Change-Id: Id7a6b4069cb25bcf369f506e47630e86f98ec890
Signed-off-by: zzc <zzc@rock-chips.com>
7 years agodrm/rockchip: vop: fix display logo flash
Mark Yao [Thu, 19 Jan 2017 09:34:51 +0000 (17:34 +0800)]
drm/rockchip: vop: fix display logo flash

bootup logo path also would run into vop_enable, do windows disable on
vop_enable would may logo flash.

Just move register initial out of vop_enable, and rename vop_enable to
vop_power_enable.

Change-Id: I17b84970dbb473918ae7da5fab989694ef9bd109
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: fix some warning from smatch check
Mark Yao [Thu, 19 Jan 2017 07:01:03 +0000 (15:01 +0800)]
drm/rockchip: fix some warning from smatch check

drivers/gpu/drm/rockchip/rockchip_drm_drv.c:489
  update_state() warn: variable dereferenced before check 'encoder' (see line 488)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c:687
  rockchip_register_crtc_funcs() error: buffer overflow 'priv->crtc_funcs' 2 <= 2
drivers/gpu/drm/rockchip/rockchip_drm_drv.c:700
  rockchip_unregister_crtc_funcs() error: buffer overflow 'priv->crtc_funcs' 2 <= 2
drivers/gpu/drm/rockchip/rockchip_drm_rga.c:848
  rga_probe() warn: passing zero to 'PTR_ERR'

drivers/gpu/drm/rockchip/rockchip_drm_vop.c:597
  vop_csc_setup() warn: variable dereferenced before check 'y2r_table' (see line 578)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1059
  vop_plane_atomic_update() warn: variable dereferenced before check 'crtc' (see line 1041)

drivers/gpu/drm/rockchip/rockchip_lvds.c:88
  lvds_name_to_format() error: strncmp() '"vesa"' too small (5 vs 6)

I don't konw how to fix following error, maybe rga owner can fix it.
drivers/gpu/drm/rockchip/rockchip_drm_rga.c:174
  rga_alloc_dma_buf_for_cmdlist() error: buffer overflow 'cmdlist->data' 64 <= 64

Change-Id: I41cd098dbd2f311d01b4e84cf0d51598264c8e31
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agofiq_debugger: do reboot_notifier for reset command
Huibin Hong [Thu, 19 Jan 2017 03:41:42 +0000 (11:41 +0800)]
fiq_debugger: do reboot_notifier for reset command

Change-Id: I31e0789e7a7ed8cd645d103abc20a21fc3140f36
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agodrm/rockchip: vop: fix iommu crash when resume
Mark Yao [Thu, 19 Jan 2017 06:19:00 +0000 (14:19 +0800)]
drm/rockchip: vop: fix iommu crash when resume

Iommu crash with that path:
   vop_disable:
      1, disable all windows and set vop config done
      2, vop enter to standy, all windows not works, but their registers
         are not clean, when you read window's enable bit, may found the
         window is enable.

   vop_enable:
      1, memcpy(vop->regsbak, vop->regs, len)
         save current vop registers to vop->regsbak, then you can found
         window is enable on regsbak.
      2, VOP_WIN_SET(vop, win, gate, 1);
         force enable window gate, but gate and enable is on same
         hardware register, the means window enable rewrite to vop hardware.
   then:
      when some on do vop_config_done but not reconfigure the bad
      register window, iommu crash.

Do register configure before memcpy(vop->regsbak, vop->regs, len) is not
safe, after that would be save.

Change-Id: I55b7846b1d39901c6b357fe541c9af1729b2c6b9
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoMALI: midgard: linux: remove default_config_mk
Jacob Chen [Thu, 19 Jan 2017 05:51:50 +0000 (13:51 +0800)]
MALI: midgard: linux: remove default_config_mk

Change-Id: I82f0479f47d9db56553de65ca3ed0467c020f012
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoARM: rockchip_linux_deconfig: make MIDGARD CONFIG back
Jacob Chen [Thu, 19 Jan 2017 03:48:22 +0000 (11:48 +0800)]
ARM: rockchip_linux_deconfig: make MIDGARD CONFIG back

Since commit "gpu: mali: allow midgard for linux build as a module",
we have move midgard config define from default.mk to defconfig.

Change-Id: Ia24f6bf8489404d52954ee72a83e66a168d97fc4
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: rockchip_linux_deconfig: make MIDGARD CONFIG back
Jacob Chen [Thu, 19 Jan 2017 03:48:15 +0000 (11:48 +0800)]
arm64: rockchip_linux_deconfig: make MIDGARD CONFIG back

Since commit "gpu: mali: allow midgard for linux build as a module",
we have move midgard config define from default.mk to defconfig.

Change-Id: Ic27a12a453af1c87b9a4ab6f79d8e0a989070ffb
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agogpu: mali: allow midgard for linux build as a module
ayaka [Mon, 16 Jan 2017 04:42:56 +0000 (12:42 +0800)]
gpu: mali: allow midgard for linux build as a module

In order to build a kernel for different platforms, the mali
module should be load at boot time.

Change-Id: I03144648cb3548c6916620bc73fdfa2b4dab98dd
Signed-off-by: ayaka <ayaka@soulik.info>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agomali: gpu: video: make the menu of midgard for linux visible
ayaka [Mon, 16 Jan 2017 04:42:55 +0000 (12:42 +0800)]
mali: gpu: video: make the menu of midgard for linux visible

Although it is not allow to offer two config menu source at
the same time, but at lease we could tune some options of
it now.

Change-Id: I0b447876d13a0d5a95276cfe4600b6030f6b8529
Signed-off-by: ayaka <ayaka@soulik.info>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agovideo: rockchip: vcodec: fix reboot crash when playing
Jung Zhao [Tue, 10 Jan 2017 06:53:40 +0000 (14:53 +0800)]
video: rockchip: vcodec: fix reboot crash when playing

shutdown function need wait last irq finish and then continue
its work.

Change-Id: I12bed04f6eeac1f12eedf55a09699be49fb4ac35
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
7 years agoclk: rk3288: correct cif_out to vip_out
Jacob Chen [Wed, 18 Jan 2017 05:50:27 +0000 (13:50 +0800)]
clk: rk3288: correct cif_out to vip_out

we already have vip_src and sclk_vip_out defined, which are the clocks
we add as cif_out, so let's correct it.

Change-Id: I952b1490a882d290aa36d9629aeb32eee22ce8b3
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agomfd: rk808: add rk805 support
Jianhong Chen [Fri, 6 Jan 2017 08:52:49 +0000 (16:52 +0800)]
mfd: rk808: add rk805 support

include sub modules: regulator, rtc, gpio, pwrkey

Change-Id: I19796e2a94764f95588d4b90bca1f3bc616f4f56
Signed-off-by: Jianhong Chen <chenjh@rock-chips.com>
7 years agoARM: dts: rockchip: add clocks for iommu in RK3288
Randy Li [Thu, 29 Dec 2016 06:51:53 +0000 (14:51 +0800)]
ARM: dts: rockchip: add clocks for iommu in RK3288

As the commit "iommu/rockchip: Add pd/clk operation in iommu"
make iommu could operation clocks and power, this commit
would assign clocks to VPU, HEVC and VOP at rk3288.

Change-Id: I6a8f57e41e7db4f57200481e5a45dd24324c72f2
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agoarm: dts: rk3288-evb add adc keys
Jacob Chen [Wed, 18 Jan 2017 07:45:08 +0000 (15:45 +0800)]
arm: dts: rk3288-evb add adc keys

Change-Id: I976f05f9152895c02d44c4eb741b5691d3539969
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm: rockchip_linux_defconfig: add CONFIG_KEYBOARD_ADC
Jacob Chen [Wed, 18 Jan 2017 05:51:35 +0000 (13:51 +0800)]
arm: rockchip_linux_defconfig: add CONFIG_KEYBOARD_ADC

Change-Id: I588fda6a6b5289c97cf149e61f0aeecbdc53d6fb
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agodrm/rockchip: logo: no need IOMMU_WRITE for logo
Mark Yao [Wed, 18 Jan 2017 04:58:31 +0000 (12:58 +0800)]
drm/rockchip: logo: no need IOMMU_WRITE for logo

Change-Id: Id047a37db7ffa865403b99429e8cdbd37a588e59
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: logo: add iommu map size for logo buffer iommu mapping
Mark Yao [Wed, 18 Jan 2017 04:50:40 +0000 (12:50 +0800)]
drm/rockchip: logo: add iommu map size for logo buffer iommu mapping

Fix bug:
  iova 0x0(logo buffer) unmap fail:
    iommu: unaligned: iova 0x0 size 0xa5638 min_pagesz 0x1000
  then cause iova 0x0 mmap fail:
    iova: 0x0000000000000000 already mapped to 0x00000000f5c00000 cannot remap to phys: 0x00000000d6c6f000 prot: 0x3

Change-Id: I77443e9dba98aa6141aa44a42880b1cccc04043b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoASoC: codec cx2072x will only use mclk 12.288M
zhangjun [Tue, 17 Jan 2017 07:53:40 +0000 (15:53 +0800)]
ASoC: codec cx2072x will only use mclk 12.288M

1. due to cx2072x only support playback samplerate 48K
2. set_clk_rate called from codec side will make the clock
   tree correct, otherwise mclk will be closed from
   i2s_runtime_suspend unexpected

Change-Id: Iaa748bb27635e21f7c2d2997823228cdf7308fe8
Signed-off-by: zhangjun <zhangjun@rock-chips.com>
7 years agonet: stmmac: dwmac-rk: Add rk3328 gmac support
david.wu [Wed, 18 Jan 2017 03:56:36 +0000 (11:56 +0800)]
net: stmmac: dwmac-rk: Add rk3328 gmac support

Change-Id: I6d707c67c8edf809e47e1907765440088e162855
Signed-off-by: david.wu <david.wu@rock-chips.com>
7 years agoPM / AVS: rockchip-io: Add rk3328 io-domains support
david.wu [Wed, 18 Jan 2017 03:49:47 +0000 (11:49 +0800)]
PM / AVS: rockchip-io: Add rk3328 io-domains support

Change-Id: Ib99a22042cdc23367cd48a178b61b8744a8b3a57
Signed-off-by: david.wu <david.wu@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3399-android-next: fix color gradation
Huang Jiachai [Fri, 6 Jan 2017 07:28:15 +0000 (15:28 +0800)]
arm64: dts: rockchip: rk3399-android-next: fix color gradation

Change-Id: I482f10b9969d724472c188ec61d76fe6daaba84e
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agoHID: hid-alps: fix touchpad data report error after the android restart
Zhou weixin [Tue, 17 Jan 2017 11:05:51 +0000 (19:05 +0800)]
HID: hid-alps: fix touchpad data report error after the android restart

Change-Id: Id4204bc9b20ca257da65bcdec02eab8a6e398d02
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
7 years agoARM64: dts: rk3399-tve1205g: disable android charge
Shunqing Chen [Tue, 17 Jan 2017 01:06:52 +0000 (09:06 +0800)]
ARM64: dts: rk3399-tve1205g: disable android charge

1. disable android charge
2. disable uboot charge brightness

Change-Id: Id9c4d7d2c9ef52ab319d009fe883595fc7181c0e
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
7 years agodrm/rockchip: gem: fixup iommu_map_sg error path
Mark Yao [Tue, 17 Jan 2017 09:30:39 +0000 (17:30 +0800)]
drm/rockchip: gem: fixup iommu_map_sg error path

If iommu_map_sg is error, it's return value is zero, but
rockchip_gem_iommu_map feel the zero return value is success,
bug happen:

[    5.227458] [drm:rockchip_gem_iommu_map] *ERROR* failed to map buffer: 0
[   12.291590] WARNING: at drivers/gpu/drm/drm_mm.c:369
[   12.291611] Modules linked in:
[   12.291634]
[   12.291658] CPU: 4 PID: 338 Comm: cameraserver Not tainted 4.4.41 #196
[   12.291680] Hardware name: rockchip,rk3399-mid (DT)
[   12.291703] task: ffffffc0e5a23100 ti: ffffffc0e5a64000 task.ti: ffffffc0e5a64000
[   12.291739] PC is at drm_mm_remove_node+0xc/0xf8
[   12.291766] LR is at rockchip_gem_iommu_unmap+0x3c/0x54
[   12.303799] [<ffffff80084526e0>] drm_mm_remove_node+0xc/0xf8
[   12.303827] [<ffffff8008475430>] rockchip_gem_free_object+0x98/0x168
[   12.303854] [<ffffff8008449e80>] drm_gem_object_free+0x2c/0x34
[   12.303878] [<ffffff80084626c4>] drm_gem_dmabuf_release+0x90/0xa4
[   12.303904] [<ffffff80084ee73c>] dma_buf_release+0x64/0x15c
[   12.303929] [<ffffff80081aa8dc>] __fput+0xe0/0x1a4
[   12.303950] [<ffffff80081aa9f8>] ____fput+0xc/0x14
[   12.303977] [<ffffff80080b65ec>] task_work_run+0xa0/0xc0
[   12.304004] [<ffffff8008087f18>] do_notify_resume+0x40/0x54
[   12.304026] [<ffffff80080825e4>] work_pending+0x10/0x14

Change-Id: Id79c052691270553c1c60086f9926f39a5296354
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/sysfs: add current display mode to sysfs
Mark Yao [Sun, 15 Jan 2017 08:50:24 +0000 (16:50 +0800)]
drm/sysfs: add current display mode to sysfs

Change-Id: I2a1a699bac74d9fe71151ba1eb8e33e0683a48a5
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/sysfs: rename connector modes' name
Mark Yao [Sat, 14 Jan 2017 07:31:01 +0000 (15:31 +0800)]
drm/sysfs: rename connector modes' name

Most drm display mode's name is "[hdisplay]x[vdisplay]", like "1440x900",
it's not a friendly name.

Change-Id: I64d2fd3b00cdfc28906b31815af7e857fc88461e
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add adc key support for rk3399 linux project.
wenping.zhang [Mon, 16 Jan 2017 03:44:23 +0000 (11:44 +0800)]
arm64: dts: rockchip: add adc key support for rk3399 linux project.

we use linux upstream adc key driver to support adc keyboard.

Change-Id: Id93a4ab3d58ff92ce0fc11b35abd4d4b8d3737e0
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agoarm64: dts: rockchip: replace clkreqn with cpm GPIO for rk3399-tve1205g
Shawn Lin [Mon, 16 Jan 2017 09:36:27 +0000 (17:36 +0800)]
arm64: dts: rockchip: replace clkreqn with cpm GPIO for rk3399-tve1205g

We should convert to use cpm mode instead of L1 substate.
Fix it anyway.

Change-Id: I5d997d53b2151ba9b1d29bd07272894a377c2eda
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
7 years agoarm64: dts: rockchip: enable PCIe for rk3399-tve1205g
Shawn Lin [Mon, 16 Jan 2017 09:35:16 +0000 (17:35 +0800)]
arm64: dts: rockchip: enable PCIe for rk3399-tve1205g

Change-Id: I8492ea9deb6ba517bcd7a8b4bf97494368904f67
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
7 years agoarm64: rockchip_linux_defconfig: add CONFIG_KEYBOARD_ADC for rk3399 linux project.
wenping.zhang [Mon, 16 Jan 2017 03:42:22 +0000 (11:42 +0800)]
arm64: rockchip_linux_defconfig: add CONFIG_KEYBOARD_ADC for rk3399 linux project.

Change-Id: Ieb8c8bf311202119a31798a9a39883fc5e121f02
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agoARM: rockchip_linux_defconfig: add some config for wifi AP function
Jacob Chen [Fri, 13 Jan 2017 08:38:37 +0000 (16:38 +0800)]
ARM: rockchip_linux_defconfig: add some config for wifi AP function

Change-Id: I082b22858e0ded5055484ad0f1fdd04e23e01113
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>