firefly-linux-kernel-4.4.55.git
7 years agophy: phy-rockchip-typec: select phy select bit before TCPHY enter A2.
wenping.zhang [Tue, 15 Nov 2016 03:02:03 +0000 (11:02 +0800)]
phy: phy-rockchip-typec: select phy select bit before TCPHY enter A2.

Set phy select bit in typec driver instead of setting it in dp driver,
which is used to fix dp phy power on failed error if only use typec1
as dp output.

Change-Id: I3949305724f5b3c12dc2f0ffefcbe4abf26d43dd
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agovideo: rockchip: dp: remove dp phy select operation in dp driver.
wenping.zhang [Tue, 15 Nov 2016 02:48:51 +0000 (10:48 +0800)]
video: rockchip: dp: remove dp phy select operation in dp driver.

Previous code select dp phy by dp->port->id, but this id can't
indicate the phy id, and it will introduce a phy power on bug if
we only use typec1 as dp output, so we move these code to typec
phy driver.

Change-Id: If809efe9138b186b060e6c7467473f2d3192bc7e
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
7 years agoarm64: dts: rockchip: add touscreen for excavator linux
Jacob Chen [Thu, 17 Nov 2016 02:16:47 +0000 (10:16 +0800)]
arm64: dts: rockchip: add touscreen for excavator linux

Change-Id: I8fb62eea9667c6c1c646b70fd9d10671b07957a2
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agofbdev/fb_notify: fix blank_mode pointer crash
Mark Yao [Wed, 16 Nov 2016 07:03:16 +0000 (15:03 +0800)]
fbdev/fb_notify: fix blank_mode pointer crash

When fb event is not blank event, use *((int *)event->data) for
blank_mode is very dangerous, see follow code on
drivers/video/fbdev/core/fbmem.c:
struct fb_event event;
event.info = fb_info;
fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);

On FB_EVENT_FB_REGISTERED event, event->data is not initial,
so get value from *(int*)event->data would crash.

crash:
[    0.909647] Unable to handle kernel paging request at virtual address
12c000000000
[    0.915506] pgd = ffffff8009147000
[    0.915808] [12c000000000] *pgd=00000000f6ff9003, *pud=00000000f6ff9003, *pmd=0000000000000000
[    0.916577] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    0.917067] Modules linked in:
[    0.917347] CPU: 4 PID: 51 Comm: kworker/u12:1 Not tainted 4.4.30
[    0.917919] Hardware name: Rockchip RK3399 Evaluation Board v1 (Android) (DT)
[    1.098438] [<ffffff8008729fb0>] rkvr_fb_event_notify+0x38/0x18c
[    1.098976] [<ffffff80080b8c7c>] notifier_call_chain+0x48/0x80
[    1.099499] [<ffffff80080b8fb8>] __blocking_notifier_call_chain+0x48/0x64
[    1.100104] [<ffffff80080b8fe8>] blocking_notifier_call_chain+0x14/0x1c
[    1.100699] [<ffffff80083e4abc>] fb_notifier_call_chain+0x44/0x50
[    1.101242] [<ffffff80083e6da8>] register_framebuffer+0x1bc/0x288
[    1.101790] [<ffffff8008431e00>] drm_fb_helper_initial_config+0x2c0/0x354
[    1.102395] [<ffffff80084630e4>] rockchip_drm_fbdev_init+0xc8/0x104
[    1.102957] [<ffffff8008459fec>] rockchip_drm_load+0x91c/0x9c4
[    1.103478] [<ffffff800843a4c0>] drm_dev_register+0x78/0xc0
[    1.103978] [<ffffff8008458c0c>] rockchip_drm_bind+0x64/0x90
[    1.104488] [<ffffff800849e93c>] try_to_bring_up_master.part.3+0xb0/0x118
[    1.105093] [<ffffff800849eb68>] component_master_add_with_match+0xcc/0x12c
[    1.105714] [<ffffff80084591e0>] rockchip_drm_platform_probe+0x198/0x1c8
[    1.106313] [<ffffff80084a55b0>] platform_drv_probe+0x58/0xa4
[    1.106827] [<ffffff80084a38a0>] driver_probe_device+0x114/0x280
[    1.107362] [<ffffff80084a3b5c>] __device_attach_driver+0x88/0x98
[    1.107905] [<ffffff80084a1d7c>] bus_for_each_drv+0x7c/0xac
[    1.108402] [<ffffff80084a36d8>] __device_attach+0xa8/0x128
[    1.108900] [<ffffff80084a3ca0>] device_initial_probe+0x10/0x18
[    1.109427] [<ffffff80084a2d1c>] bus_probe_device+0x2c/0x8c
[    1.109924] [<ffffff80084a3170>] deferred_probe_work_func+0x74/0xa0
[    1.110486] [<ffffff80080b2e34>] process_one_work+0x218/0x3e0
[    1.111001] [<ffffff80080b3530>] worker_thread+0x24c/0x374
[    1.111490] [<ffffff80080b7dbc>] kthread+0xe8/0xf0
[    1.111922] [<ffffff8008082690>] ret_from_fork+0x10/0x40

Change-Id: I11f667830d913430d9e0b4da2b391815d335ecb8
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add efuse device node for rk3366
Finley Xiao [Wed, 16 Nov 2016 07:35:22 +0000 (15:35 +0800)]
arm64: dts: rockchip: add efuse device node for rk3366

Add a efuse node in the device tree for the ARM64 rk3366 SoC.

Change-Id: I163003e7e181645579a2af53003892ba46646706
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agonvmem: rockchip-efuse: add rk3366-efuse support
Finley Xiao [Wed, 16 Nov 2016 06:50:05 +0000 (14:50 +0800)]
nvmem: rockchip-efuse: add rk3366-efuse support

This adds the necessary data for handling efuse on the rk3366.

Change-Id: Ia9b03776172c9a66faa7320f7e1890549538a32a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoclk: rockchip: add clock ids for efuse on RK3366
Finley Xiao [Wed, 16 Nov 2016 03:46:20 +0000 (11:46 +0800)]
clk: rockchip: add clock ids for efuse on RK3366

Set the newly added id for efuse, so that they can be called
in other parts.

Change-Id: Id372ca207901aed689304f862412b2cf1e08fa80
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoinput: sensors: fromdos and remove trailing whitespace
Huang, Tao [Wed, 16 Nov 2016 02:25:18 +0000 (10:25 +0800)]
input: sensors: fromdos and remove trailing whitespace

Change-Id: I6799f2538f95953d1565ac805497161ce6043855
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoUPSTREAM: clk: rockchip: rk3399: fix copy-paste error
Jianqun Xu [Mon, 7 Nov 2016 02:28:20 +0000 (10:28 +0800)]
UPSTREAM: clk: rockchip: rk3399: fix copy-paste error

Fix RK3368_* to RK3399_* for rk3399 clk_test clock.

Change-Id: I3be8f582ab9a0ee484bf47e2090f020bbd4a7c72
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9430735/)

7 years agoclk: rockchip: remove more CLK_IGNORE_UNUSED for rk3399 clocktree
Jianqun Xu [Wed, 2 Nov 2016 07:36:30 +0000 (15:36 +0800)]
clk: rockchip: remove more CLK_IGNORE_UNUSED for rk3399 clocktree

Optimize rk3399 clocktree by removing CLK_IGNORE_UNUSED of some clocks.

clocks will managered by usb:
- clk_usbphy0_480m_src
- clk_usbphy1_480m_src
- clk_usbphy_480m

clocks will be managered by pvtm:
- clk_pvtm_core_l
- clk_pvtm_core_b
- clk_pvtm_ddr

clocks will be managered by dfi:
- pclk_ddr_mon
- clk_dfimon0_timer
- clk_dfimon1_timer
- aclk_dcf
- pclk_dcf

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9410123/)

Change-Id: I9c32423cafde00fc47673638633ca0c884253f36
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoCHROMIUM: devfreq: rockchip: remove wait dcf irq evnet
Lin Huang [Sun, 9 Oct 2016 22:58:45 +0000 (15:58 -0700)]
CHROMIUM: devfreq: rockchip: remove wait dcf irq evnet

We have already wait dcf done in ATF, so don't need wait dcf irq
in kernel, besides, clear dcf irq in kernel will import competiton
between kernel and ATF, only handle dcf irq in ATF is a better way.

BUG=chrome-os-partner:54651
TEST=Boot from kevin

Change-Id: Ibfc460bebb86eb72a218fbf39176d30320da2c57
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoarm64: configs: add some devfreq gov for rk3399 linux
Jacob Chen [Tue, 15 Nov 2016 12:08:55 +0000 (20:08 +0800)]
arm64: configs: add some devfreq gov for rk3399 linux

gpu dvfs need SIMPLE_ONDEMAND

Change-Id: I7f3247a7571e40cbfe929996d1c4db4b11ea63a5
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm: configs: add some devfreq gov for rk3288 linux
Jacob Chen [Tue, 15 Nov 2016 11:43:57 +0000 (19:43 +0800)]
arm: configs: add some devfreq gov for rk3288 linux

add more devfreq gov to let driver choose it.

Change-Id: Id47b519e1f41311283bf3f38b94cae3b8480aff4
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agovideo: rockchip: fb: fix inconsistent returns 'mutex:&dev_drv->front_lock'
Huang Jiachai [Fri, 11 Nov 2016 10:36:47 +0000 (18:36 +0800)]
video: rockchip: fb: fix inconsistent returns 'mutex:&dev_drv->front_lock'

Change-Id: If937a6cbc6d89ff0b4dbd2f540a87da1af3c4123
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agovideo: rockchip: fb: add api to enable mirror for VR
Huang Jiachai [Thu, 10 Nov 2016 06:35:13 +0000 (14:35 +0800)]
video: rockchip: fb: add api to enable mirror for VR

Change-Id: Ic9a6409f0243896021eb94df3600cdc2fc3db637
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agovideo: rockchip: fb: update for x and y mirror
Huang Jiachai [Mon, 7 Nov 2016 13:04:06 +0000 (21:04 +0800)]
video: rockchip: fb: update for x and y mirror

Change-Id: Ieca4a74af4b4ca2f5d90e7387601e2f87b0ac883
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
7 years agoarm: configs: enable devfreq thermal for rk3288 linux
Jacob Chen [Tue, 15 Nov 2016 07:49:39 +0000 (15:49 +0800)]
arm: configs: enable devfreq thermal for rk3288 linux

to enable gpu

Change-Id: I818b27927847bb1c62f60eb4b0335d1818f30dff
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: confis: enable devfreq thermal for rk3399 linux
Jacob Chen [Tue, 15 Nov 2016 07:48:37 +0000 (15:48 +0800)]
arm64: confis: enable devfreq thermal for rk3399 linux

to enable gpu freq

Change-Id: I8db7106d34592eb9f90b31838f60aba20313bdb5
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: configs: enable thermal fair share for rk3399 linux
Jacob Chen [Tue, 15 Nov 2016 07:47:30 +0000 (15:47 +0800)]
arm64: configs: enable thermal fair share for rk3399 linux

Change-Id: Ic69b404e075dfe2999b88eb5c808e01c10a97d0d
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoUPSTREAM: signals: avoid random wakeups in sigsuspend()
Sasha Levin [Fri, 5 Feb 2016 23:36:05 +0000 (15:36 -0800)]
UPSTREAM: signals: avoid random wakeups in sigsuspend()

A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING
being set.

Avoid that by making sure we were signaled, like sys_pause() does.

Change-Id: Ie647d2797416c6e53628174a07b62246e23081e7
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 823dd3224a07f618d652a7743c9603222d019de3)

7 years agonet: rkwifi: auto recognize nvram file
huweiguo [Tue, 1 Nov 2016 03:27:26 +0000 (11:27 +0800)]
net: rkwifi: auto recognize nvram file

Change-Id: Ia90c2657f9abf301882678e15ea18c2c17720be1
Signed-off-by: huweiguo <hwg@rock-chips.com>
7 years agoMALI: midgard: RK: slowdown clk_gpu before poweroff cores
chenzhen [Sat, 24 Sep 2016 08:31:08 +0000 (16:31 +0800)]
MALI: midgard: RK: slowdown clk_gpu before poweroff cores

This is a workaround for the issue that
"400M, 500M and 600M of clk_gpu needs high vdd_gpu",
according to "6.2" of Mali Application Note
"Potential glitches on Power Domain interfaces".

Change-Id: I8b8eccd2079e21ac5e1db7b4552c8f998f676a9f
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
7 years agoRevert "MALI: midgard: RK: not to power off all the pm cores"
chenzhen [Tue, 1 Nov 2016 08:33:09 +0000 (16:33 +0800)]
Revert "MALI: midgard: RK: not to power off all the pm cores"

This reverts commit 47a9fbf6c4de1dddaf82ed9159307f8ba039f85c.

Change-Id: I4cfc36a5dab7e6cb4a766995d456301c54728498
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3399: modify gpu opp table for evb board
Finley Xiao [Thu, 10 Nov 2016 07:53:03 +0000 (15:53 +0800)]
arm64: dts: rockchip: rk3399: modify gpu opp table for evb board

margin 25mV-50mV, stress test:
1. antutu-3d, use governor simpleondemand
2. webgl, fish number 50, sweep frequency
3. glmark2, run texture and shadow, sweep frequency

Change-Id: Ia2682610e948df7df2ad190ac3a28b2dad464cb3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agopinctrl: rockchip: Fix smatch warning
David Wu [Mon, 14 Nov 2016 00:28:20 +0000 (08:28 +0800)]
pinctrl: rockchip: Fix smatch warning

This patch fix the following warning:
drivers/pinctrl/pinctrl-rockchip.c:1415 rockchip_set_drive_perpin() warn: inconsistent returns 'spin_lock:&bank->slock'.
  Locked on:   line 1377
               line 1384
               line 1393
  Unlocked on: line 1306
               line 1333
               line 1342
               line 1352
               line 1406
               line 1415
drivers/pinctrl/pinctrl-rockchip.c:1415 rockchip_set_drive_perpin() warn: inconsistent returns 'irqsave:flags'.
  Locked on:   line 1377
               line 1384
               line 1393
  Unlocked on: line 1306
               line 1333
               line 1342
               line 1352
               line 1406
               line 1415

Change-Id: I3f97010fbc283084f06b83afcc46ab684d2a11c3
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agohid: rkvr: fix inconsistent returns in inv_hid_register_devcie()
lanshh [Mon, 14 Nov 2016 01:50:57 +0000 (09:50 +0800)]
hid: rkvr: fix inconsistent returns in inv_hid_register_devcie()

Change-Id: Ida0a3dff53c9e47dc04b0111ea56500d1adcbb3c
Signed-off-by: lanshh <lsh@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: avoid removing hcd while system is frozen
William wu [Tue, 8 Nov 2016 07:15:34 +0000 (15:15 +0800)]
CHROMIUM: usb: dwc3: rockchip: avoid removing hcd while system is frozen

Refer to the commit 85fbd722ad0f ("libata, freezer: avoid
block device removal while system is frozen"), when system
enter suspend, it may freeze kthreads and workqueues, and
do not restart them until complete PM resume all of devices.

If we remove XHCI hcd while system is frozen, it may call
usb_disconnect() to remove a usb block device which pluged
in before, but has gone missing. Unfortunately, remove the
block device can race with the rest of device resume. Since
freezable kthreads and workqueues are thawed after all of
devices resume are completed and block device removal depends
on freezable workqueues and kthreads (e.g. bdi_wq) to make
progress, this can lead to deadlock - block device removal
can't proceed because kthreads and workqueues are frozen and
can't be restarted because device resume is blocked behind
block device removal.

This patch must be used and tested with the commit bc68c26eff86
("CHROMIUM: usb: dwc3: rockchip: fix NULL pointer dereference
when resume"). This issue can be easily reproduced with USB-C
HUB and USB2/3 flash drive, result in the following backtrace.

[  360.201135] INFO: task kworker/u12:3:122 blocked for more than 120 seconds.
[  360.208094]       Not tainted 4.4.21 #185
[  360.212102] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  360.219923] kworker/u12:3   D ffffffc000204fd8     0   122      2 0x00000000
[  360.227007] Workqueue: events_unbound async_run_entry_fn
[  360.232326] Call trace:
[  360.234776] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[  360.239918] [<ffffffc000915bf4>] __schedule+0x440/0x6d8
[  360.245139] [<ffffffc000915f20>] schedule+0x94/0xb4
[  360.250016] [<ffffffc00091909c>] schedule_timeout+0x44/0x27c
[  360.255670] [<ffffffc000916b78>] wait_for_common+0xf8/0x198
[  360.261237] [<ffffffc000916c40>] wait_for_completion+0x28/0x34
[  360.267067] [<ffffffc0005f3f4c>] dpm_wait+0x40/0x4c
[  360.271942] [<ffffffc0005f4770>] device_resume+0x60/0x1a4
[  360.277337] [<ffffffc0005f48e4>] async_resume+0x30/0x60
[  360.282558] [<ffffffc000242fc4>] async_run_entry_fn+0x50/0x104
[  360.288387] [<ffffffc0002397f0>] process_one_work+0x240/0x424
[  360.294128] [<ffffffc00023a28c>] worker_thread+0x2fc/0x424
[  360.299608] [<ffffffc00023f5fc>] kthread+0x10c/0x114
[  360.304570] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40
[  360.309876]   task                        PC stack   pid father
[  360.315789] init            D ffffffc000204fd8     0     1      0 0x00400009
...
[  360.564124] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[  360.569259] [<ffffffc000915bf4>] __schedule+0x440/0x6d8
[  360.574481] [<ffffffc000915f20>] schedule+0x94/0xb4
[  360.579355] [<ffffffc00091909c>] schedule_timeout+0x44/0x27c
[  360.585010] [<ffffffc000916b78>] wait_for_common+0xf8/0x198
[  360.590580] [<ffffffc000916c40>] wait_for_completion+0x28/0x34
[  360.596408] [<ffffffc000239270>] flush_work+0x168/0x1a4
[  360.601629] [<ffffffc0002395a4>] flush_delayed_work+0x44/0x50
[  360.607371] [<ffffffc000322f48>] bdi_unregister+0xa8/0xfc
[  360.612766] [<ffffffc00049afdc>] blk_cleanup_queue+0xf4/0x10c
[  360.618508] [<ffffffc000625d7c>] __scsi_remove_device+0x80/0xc8
[  360.624423] [<ffffffc000623dec>] scsi_forget_host+0x5c/0x74
[  360.629991] [<ffffffc000619a98>] scsi_remove_host+0x90/0x110
[  360.635646] [<ffffffc000692940>] usb_stor_disconnect+0x78/0xec
[  360.641474] [<ffffffc0006545e4>] usb_unbind_interface+0xa0/0x1f8
[  360.647477] [<ffffffc0005e70cc>] __device_release_driver+0xb4/0x114
[  360.653746] [<ffffffc0005e7158>] device_release_driver+0x2c/0x40
[  360.659748] [<ffffffc0005e61f8>] bus_remove_device+0x110/0x128
[  360.665575] [<ffffffc0005e3178>] device_del+0x164/0x1f4
[  360.670797] [<ffffffc000652094>] usb_disable_device+0x94/0x1c8
[  360.676625] [<ffffffc000649b74>] usb_disconnect+0x9c/0x1d0
[  360.682106] [<ffffffc000649b60>] usb_disconnect+0x88/0x1d0
[  360.687587] [<ffffffc00064e0e4>] usb_remove_hcd+0xc8/0x1e0
[  360.693068] [<ffffffc000664b4c>] dwc3_rockchip_otg_extcon_evt_work+0x14c/0x198
[  360.700284] [<ffffffc0002397f0>] process_one_work+0x240/0x424
[  360.706026] [<ffffffc00023a28c>] worker_thread+0x2fc/0x424
[  360.711506] [<ffffffc00023f5fc>] kthread+0x10c/0x114
[  360.716467] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40

BUG=chrome-os-partner:58705, chrome-os-partner:59103
TEST=Plug in USB-C HUB and USB2/3 flash drive, then set
system to enter S3. After system suspend, plug out the
USB-C HUB first, and then press keyboard or power key to
check if system can wakeup successfully.

Change-Id: I6cb8ea1a4399b9b69b522ec0ed5f0f7810118850
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/408499
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: fix NULL pointer dereference when resume
William wu [Tue, 8 Nov 2016 03:31:21 +0000 (11:31 +0800)]
CHROMIUM: usb: dwc3: rockchip: fix NULL pointer dereference when resume

During system PM resume process, if remove XHCI hcd prior to
XHCI controller PM resume, it will result in a crash with
the following backtrace.

[   80.730581] Unable to handle kernel NULL pointer dereference at virtual address 00000138
...
[   80.731780] Call trace:
[   80.731784] [<ffffffc0005e43cc>] dev_driver_string+0x18/0x4c
[   80.731787] [<ffffffc0005e4918>] __dev_printk+0x34/0x88
[   80.731791] [<ffffffc0005e4da0>] dev_warn+0x7c/0xa0
[   80.731796] [<ffffffc000651ef8>] usb_root_hub_lost_power+0x28/0x40
[   80.731801] [<ffffffc0006866e8>] xhci_resume+0x250/0x444
[   80.731805] [<ffffffc00069612c>] xhci_plat_resume+0x44/0x64
[   80.731811] [<ffffffc0005ea878>] platform_pm_resume+0x50/0x64
[   80.731816] [<ffffffc0005f6354>] dpm_run_callback+0xb0/0x198
[   80.731819] [<ffffffc0005f68f4>] device_resume+0x160/0x19c
[   80.731822] [<ffffffc0005f6960>] async_resume+0x30/0x60
[   80.731827] [<ffffffc000242b88>] async_run_entry_fn+0x50/0xfc
[   80.731832] [<ffffffc000238e38>] process_one_work+0x230/0x3dc
[   80.731837] [<ffffffc000239db8>] worker_thread+0x248/0x370
[   80.731840] [<ffffffc00023f23c>] kthread+0x10c/0x114
[   80.731845] [<ffffffc000203d90>] ret_from_fork+0x10/0x40

It's because that when do PM resume, dwc3_rockchip_resume() will
be called before XHCI resume, and it will remove XHCI hcd and set
rhdev->dev to NULL, this cause rhdev->dev NULL pointer dereference
in XHCI resume.

So we need to check the flag dwc->xhci->dev.power.is_suspended to
ensure that XHCI has been resumed completely from pm suspended state
before remove XHCI hcd.

BUG=chrome-os-partner:58705
TEST=Plug in Type-C USB device, then set system to enter S3.
After system suspend, plug out the Type-C USB device first,
and then press keyboard or power key to check if system can
wakeup successfully.

Change-Id: I90fc48f5d3af8d08a290861ad7fcdaa5e4352320
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/408498
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
7 years agoCHROMIUM: xhci: fix hung task timeout when rm xhci-hcd
William wu [Tue, 8 Nov 2016 08:43:29 +0000 (16:43 +0800)]
CHROMIUM: xhci: fix hung task timeout when rm xhci-hcd

On some special platforms (e.g. rk3399), they will call
usb_remove_hcd() to remove xhci hcd if no device connected,
and add xhci hcd again when detect usb device. But they
just simply remove xhci hcd, and the usb core hub_event
don't know it at all. The hub_event just find usb device
disconnect, and try to call usb_disconnect() -> usb_disable
_endpoint() -> usb_kill_urb() -> usb_hcd_unlink_urb() ->
xhci_urb_dequeue -> queue a stop endpoint command, and
then the usb_kill_urb will wait_event(usb_kill_urb_queue,
atomic_read(&urb->use_count) == 0).

But in this case, we have removed xhci hcd and stop xhci
controller, so xhci can't complete stop endpoint command
and fail to call usb_hcd_giveback_urb() which can wakeup
usb_kill_urb_queue, this cause stall in usb_kill_urb()
with the following backstrace.

[  240.202208] INFO: task kworker/0:2:130 blocked for more than 120 seconds.
[  240.208996]       Not tainted 4.4.21 #454
[  240.213008] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  240.220828] kworker/0:2     D ffffffc000204fd8     0   130      2 0x00000000
[  240.227919] Workqueue: usb_hub_wq hub_event
[  240.232117] Call trace:
[  240.234576] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[  240.239713] [<ffffffc000919cb4>] __schedule+0x440/0x6d8
[  240.244938] [<ffffffc000919fe0>] schedule+0x94/0xb4
[  240.249814] [<ffffffc000654530>] usb_kill_urb+0xc4/0x110
[  240.255128] [<ffffffc000653538>] usb_hcd_flush_endpoint+0x128/0x148
[  240.261755] [<ffffffc0006560e4>] usb_disable_endpoint+0x70/0xa4
[  240.267679] [<ffffffc00065617c>] usb_disable_interface+0x64/0x7c
[  240.273680] [<ffffffc000658760>] usb_unbind_interface+0x88/0x1f8
[  240.279687] [<ffffffc0005eb260>] __device_release_driver+0xb4/0x114
[  240.285952] [<ffffffc0005eb2ec>] device_release_driver+0x2c/0x40
[  240.291956] [<ffffffc0005ea38c>] bus_remove_device+0x110/0x128
[  240.297783] [<ffffffc0005e730c>] device_del+0x164/0x1f4
[  240.303006] [<ffffffc000656228>] usb_disable_device+0x94/0x1c8
[  240.308834] [<ffffffc00064dd08>] usb_disconnect+0x9c/0x1d0
[  240.314317] [<ffffffc00064f51c>] hub_event+0x58c/0xde0
[  240.319451] [<ffffffc0002397f0>] process_one_work+0x240/0x424
[  240.325193] [<ffffffc00023a28c>] worker_thread+0x2fc/0x424
[  240.330725] [<ffffffc00023f5fc>] kthread+0x10c/0x114
[  240.335708] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40
...
[  240.466674] kworker/4:2     D ffffffc000204fd8     0   153      2 0x00000000
[  240.473752] Workqueue: events dwc3_rockchip_otg_extcon_evt_work
[  240.479680] Call trace:
[  240.482131] [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
[  240.487265] [<ffffffc000919cb4>] __schedule+0x440/0x6d8
[  240.492487] [<ffffffc000919fe0>] schedule+0x94/0xb4
[  240.497361] [<ffffffc00091a364>] schedule_preempt_disabled+0x28/0x44
[  240.503713] [<ffffffc00091be20>] __mutex_lock_slowpath+0x120/0x1ac
[  240.509885] [<ffffffc00091bef8>] mutex_lock+0x4c/0x68
[  240.514936] [<ffffffc00064dcc8>] usb_disconnect+0x5c/0x1d0
[  240.520415] [<ffffffc000652278>] usb_remove_hcd+0xc8/0x1e0
[  240.525899] [<ffffffc000668ce8>] dwc3_rockchip_otg_extcon_evt_work+0x154/0x198
[  240.533112] [<ffffffc0002397f0>] process_one_work+0x240/0x424
[  240.538856] [<ffffffc00023a28c>] worker_thread+0x2fc/0x424
[  240.544335] [<ffffffc00023f5fc>] kthread+0x10c/0x114
[  240.549296] [<ffffffc000203dd0>] ret_from_fork+0x10/0x40

This patch try to do the same thing as XHCI_STATE_HALTED in
xhci_urb_dequeue() if xhci->xhc_state is XHCI_STATE_REMOVING.
Because XHCI_STATE_REMOVING means that we are removing xhci
hcd, and need to call usb_hcd_giveback_urb() directly without
queueing any stop endpoint command.

In addition, this patch also forbid xhci to queue command or
slot control if it's in XHCI_STATE_REMOVING. It maybe helpful
to avoid the other unexpected problems, though I haven't met
them so far.

BUG=chrome-os-partner:59103
TEST=do plug/unplug USB-C HUB with an USB3 flash drive,
check if kernel blocked for more than 120 seconds.

Change-Id: I35ec94dcc742d29d52f73fa30f79cf005063ea55
Signed-off-by: William wu <wulf@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/408127
Commit-Ready: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Tested-by: Inno Park <ih.yoo.park@samsung.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
7 years agoCHROMIUM: usb: dwc3: rockchip: Check for plug/unplug events on resume
William Wu [Fri, 11 Nov 2016 08:50:21 +0000 (16:50 +0800)]
CHROMIUM: usb: dwc3: rockchip: Check for plug/unplug events on resume

Check on resume if the cable state has changed to detect devices
(un)plugged during suspend.

TEST=build and boot on rk3399 board. No USB device plugged. Set
system enter suspend. Wait for device to suspend. Plug USB device.
Wakeup system; Verify USB device is enumerated.

Change-Id: Iadbefe6737fa3ddfe2da1a66473f876411a4412a
Signed-off-by: William Wu <wulf@rock-chips.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/395528
Reviewed-by: Guenter Roeck <groeck@chromium.org>
7 years agorockchip/vcodec: fix double lock and some warning
alpha lin [Fri, 11 Nov 2016 10:25:26 +0000 (18:25 +0800)]
rockchip/vcodec: fix double lock and some warning

fix following problems:

vcodec_service.c:1613 try_set_reg()
error: double lock 'mutex:&pservice->shutdown_lock'
vcodec_service.c:1682 try_set_reg()
warn: inconsistent returns 'mutex:&pservice->shutdown_lock'.
  Locked on:   line 1614
  Unlocked on: line 1682

vcodec_service.c:599 vpu_get_clk()
warn: missing break? reassigning 'pservice->pd_video'
vcodec_service.c:901 vcodec_fd_to_iova()
warn: returning -1 instead of -ENOMEM is sloppy
vcodec_service.c:1100 vcodec_bufid_to_iova()
warn: returning -1 instead of -ENOMEM is sloppy
vcodec_service.c:1209 reg_init()
warn: passing __func__ while the format string already
contains the name of the function 'reg_init'
vcodec_service.c:1231 reg_init()
warn: passing __func__ while the format string already
contains the name of the function 'reg_init'
vcodec_service.c:1237 reg_init()
warn: passing __func__ while the format string already
contains the name of the function 'reg_init'
vcodec_service.c:1714 return_reg()
warn: passing __func__ while the format string already
contains the name of the function 'return_reg'

Change-Id: Ia2d3be7ad7a726d9af9e58c25079e6c11a7d302f
Signed-off-by: alpha lin <alpha.lin@rock-chips.com>
7 years agovidro/rockchip: Fix rga2 driver
Zikim,Wei [Wed, 19 Oct 2016 08:32:50 +0000 (16:32 +0800)]
vidro/rockchip: Fix rga2 driver

1.If rga get the mmu error, we must unlock the lock
or it will lead the next frame timeout.
2.calculate the rga mmu buf back length size in the
rga time out handler or it will lead the next frame
get mmu lentch wrong.

Change-Id: If85751bd292774a1d0ef9693b7f8ad92a4727c07
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
7 years agovidro/rockchip: fix rga1 driver deadlock
Zikim,Wei [Sun, 30 Oct 2016 09:26:46 +0000 (17:26 +0800)]
vidro/rockchip: fix rga1 driver deadlock

If rga get the mmu error, we must unlock the lock
or it will lead the next frame timeout.

Change-Id: I377217ea417de8e4d3f4ff63e478db1370951e62
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
(cherry picked from commit f453db8699919760a2297a7d2512f3c03c3edf25)

7 years agoinput: sensor-dev: fix smatch warning
Huang, Tao [Mon, 31 Oct 2016 07:58:33 +0000 (15:58 +0800)]
input: sensor-dev: fix smatch warning

fix below warnings:
sensor-dev.c:1016 gyro_dev_ioctl() warn: inconsistent returns 'mutex:&sensor->operation_mutex'.
  Locked on:   line 973
               line 982
  Unlocked on: line 919
               line 1010
               line 1016
sensor-dev.c:1905 sensor_probe() error: potential null dereference 'sensor->input_dev'.  (input_allocate_device returns null)
sensor-dev.c:1905 sensor_probe() error: we previously assumed 'sensor->input_dev' could be null (see line 1902)
sensor-dev.c:2051 sensor_probe() error: don't call input_free_device() after input_unregister_device()
sensor-dev.c:2080 sensor_remove() error: don't call input_free_device() after input_unregister_device()

Change-Id: I7da8a337282df7f9b8e6474a68928fc53d4e6890
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 08fd14ea02692f43eaa8a166791cdaaa4b6c0738)

7 years agoarm64: dts: rockchip: add pvtm node for rk3399
Finley Xiao [Tue, 8 Nov 2016 03:48:40 +0000 (11:48 +0800)]
arm64: dts: rockchip: add pvtm node for rk3399

Change-Id: Ic7becefeb7e7a1000b259c21fedda76794b7115c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: dts: rockchip: add pvtm node for rk3366
Finley Xiao [Tue, 8 Nov 2016 02:25:05 +0000 (10:25 +0800)]
arm64: dts: rockchip: add pvtm node for rk3366

Change-Id: Ic90466538671e69aaea82b0b20afdcb39ecf7006
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable pvtm
Finley Xiao [Thu, 3 Nov 2016 13:05:04 +0000 (21:05 +0800)]
arm64: rockchip_defconfig: enable pvtm

Change-Id: I726bddec7625540ff3b3b58cf4c3c9ee842d50da
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agosoc: rockchip: pvtm: add driver handling Rockchip pvtm
Finley Xiao [Thu, 3 Nov 2016 13:00:08 +0000 (21:00 +0800)]
soc: rockchip: pvtm: add driver handling Rockchip pvtm

This patch supports acquiring pvtm values.

Change-Id: I20c0c5a5136371880da1c246b0d71c7a2bddc1d6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodt-bindings: add binding document for Rockchip pvtm
Finley Xiao [Thu, 3 Nov 2016 12:48:17 +0000 (20:48 +0800)]
dt-bindings: add binding document for Rockchip pvtm

This patch documents the Rockchip pvtm device tree binding.

Change-Id: I7edcd1d57ff2852eb6e6897680566abb7f9e76a9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoclk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for pvtm clks
Finley Xiao [Thu, 3 Nov 2016 12:07:31 +0000 (20:07 +0800)]
clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for pvtm clks

These clks will be enabed and disabled in pvtm driver.

Change-Id: I742a8c4ef5877486fb21c014f1e4ab27f72e468d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3399: add aclk_gpu init freq
Elaine Zhang [Thu, 10 Nov 2016 03:24:31 +0000 (11:24 +0800)]
arm64: dts: rockchip: rk3399: add aclk_gpu init freq

Make sure the aclk_gpu freq is safety.
After soft reset the vdd_gpu is maintain
the voltage value before reset.

Change-Id: I3509b211d74cf649067090d13ce20d5c62782fd7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm64: dts: rockchip: add power button for rk3399 excavator linux
Jacob Chen [Thu, 10 Nov 2016 03:58:34 +0000 (11:58 +0800)]
arm64: dts: rockchip: add power button for rk3399 excavator linux

Change-Id: I5c69940b93dec8a04f72e7240fc732071d0187ed
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: dts: rockchip: add reset unit in saradc for rk3399
Jacob Chen [Thu, 10 Nov 2016 01:44:22 +0000 (09:44 +0800)]
arm64: dts: rockchip: add reset unit in saradc for rk3399

Change-Id: Iee831c8b4bc39cb324ee31ace9d98d235aaf7555
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agorockchip/rga: rga driver fix compat ptr from u64
Zikim,Wei [Wed, 9 Nov 2016 13:01:02 +0000 (21:01 +0800)]
rockchip/rga: rga driver fix compat ptr from u64

Change-Id: I23cff21aab9af09989b8b2332e7a2ef3ffc8bfb8
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
7 years agosoc: rockchip: pm_test: add driver handling Rockchip pm_test
Finley Xiao [Tue, 8 Nov 2016 10:05:53 +0000 (18:05 +0800)]
soc: rockchip: pm_test: add driver handling Rockchip pm_test

Add /sys/pm_tests/ node, only for internal testing.

Change-Id: I1fe9f09e6d410c9ed939666255111d2a8865466c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agovideo: rockchip: sysfs: fixup dump_buf node
Mark Yao [Wed, 9 Nov 2016 06:24:56 +0000 (14:24 +0800)]
video: rockchip: sysfs: fixup dump_buf node

Change-Id: Ie2e86d65b3db58f45c8c49894f506ab52b125c25
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add dp defaule mode for rk3399 discrete vr
wjh [Wed, 9 Nov 2016 03:31:02 +0000 (11:31 +0800)]
arm64: dts: rockchip: add dp defaule mode for rk3399 discrete vr

Change-Id: Icc25da3598d9a7475817aebdc101f5d77f58624c
Signed-off-by: wjh <wjh@rock-chips.com>
7 years agovideo: rockchip: dp: get edid for discrete vr
wjh [Mon, 7 Nov 2016 01:57:45 +0000 (09:57 +0800)]
video: rockchip: dp: get edid for discrete vr

Change-Id: Id791e838e37e76f72202731e53afd2533e653069
Signed-off-by: wjh <wjh@rock-chips.com>
7 years agovideo: rockchip: rk322x: use htotal to adjust fps
Mark Yao [Thu, 3 Nov 2016 07:52:20 +0000 (15:52 +0800)]
video: rockchip: rk322x: use htotal to adjust fps

Use dclk to adjust fps may effect many things, some display
controller also need to know dclk update, such as mipi.
So if we change fps by dclk, we need update mipi or other
display controller, it waste time and screen would flash

From the fps formula: fps = dclk / htotal * vtotal

Instead change dclk, we also can modify fps by htotal or vtotal.

On testing, vtotal would effect display, use htotal is more safe.

Change-Id: I67d58a815eae150b4e6390b6608557b87d43a27b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agovideo: rockchip: rk322x: keep vop standby before enable iommu
Mark Yao [Mon, 7 Nov 2016 06:22:36 +0000 (14:22 +0800)]
video: rockchip: rk322x: keep vop standby before enable iommu

Vop may access illegal address and cause bus error with:
    1, vop iommu is disable
    2, vop is enable and its window use a iommu mapping address

The illegal memory access may cause bus abnormal.

Change-Id: I17d52ae12140b9bf85d37123765f7163422ec8f5
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoUPSTREAM: arm64: dts: rockchip: add powerdomain for typec on rk3399
Chris Zhong [Wed, 7 Sep 2016 23:06:17 +0000 (16:06 -0700)]
UPSTREAM: arm64: dts: rockchip: add powerdomain for typec on rk3399

The tcpc power domain will try to power up/down the power of Type-C PHY.
Hence, we need control it in Type-C PHY driver with the pm_runtime helper.

Change-Id: I7697c50bb8538c00bb0fa14c92cc1e55bcdd4025
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
 commit 06ad4b2fad80713c50a31da6d1048cb1df728558)

7 years agoFROMLIST: phy: rockchip-typec: add pm_runtime_disable in err case
Chris Zhong [Thu, 8 Sep 2016 17:38:11 +0000 (10:38 -0700)]
FROMLIST: phy: rockchip-typec: add pm_runtime_disable in err case

Add pm_runtime_disable in err case to make the pm_runtime_enable/disable
is invoked balanced.

BUG=chrome-os-partner:52872
TEST=Check DP display and USB3

Change-Id: Ifc66a3e80d7b580963e609d2f14cea239104724c
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9321849/)
Reviewed-on: https://chromium-review.googlesource.com/382723
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: William Wu <wulf@rock-chips.com>
7 years agoUPSTREAM: phy: rockchip-typec: add pm runtime support
Chris Zhong [Wed, 7 Sep 2016 18:17:25 +0000 (11:17 -0700)]
UPSTREAM: phy: rockchip-typec: add pm runtime support

Adds pm_runtime support for rockchip Type-C, so that power domain is
enabled only when there is a transaction going on to help save power.

BUG=chrome-os-partner:52872
TEST=Check DP display and USB3

Change-Id: I072fd06eaa4dfc4b4f598c4a6a3972ee458b833f
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy.git next
 commit 15ab5499bd837b1d70287da747dc3d9762ab320a)
Reviewed-on: https://chromium-review.googlesource.com/382113
Reviewed-by: Brian Norris <briannorris@chromium.org>
7 years agoarm64: configs: enable drm rga in linux config
Jacob Chen [Tue, 8 Nov 2016 05:33:22 +0000 (13:33 +0800)]
arm64: configs: enable drm rga in linux config

Change-Id: I92985f4e1f8cf18d2f0f578e3d039b45e5f445fb
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: configs: enable extcon in linux config
Jacob Chen [Tue, 8 Nov 2016 03:59:25 +0000 (11:59 +0800)]
arm64: configs: enable extcon in linux config

Change-Id: I071fa1e075a5495be58315d47cc2a767ae09bd75
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoUPSTREAM: sched/preempt: Fix preempt_count manipulations
Peter Zijlstra [Mon, 16 May 2016 13:01:11 +0000 (15:01 +0200)]
UPSTREAM: sched/preempt: Fix preempt_count manipulations

Vikram reported that his ARM64 compiler managed to 'optimize' away the
preempt_count manipulations in code like:

preempt_enable_no_resched();
put_user();
preempt_disable();

Irrespective of that fact that that is horrible code that should be
fixed for many reasons, it does highlight a deficiency in the generic
preempt_count manipulators. As it is never right to combine/elide
preempt_count manipulations like this.

Therefore sprinkle some volatile in the two generic accessors to
ensure the compiler is aware of the fact that the preempt_count is
observed outside of the regular program-order view and thus cannot be
optimized away like this.

x86; the only arch not using the generic code is not affected as we
do all this in asm in order to use the segment base per-cpu stuff.

Change-Id: I13da06ddb17c533b8150f008514a4c74723b1742
Reported-by: Vikram Mulukutla <markivx@codeaurora.org>
Tested-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: a787870924db ("sched, arch: Create asm/preempt.h")
Link: http://lkml.kernel.org/r/20160516131751.GH3205@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 2e636d5e66c35dfcbaf617aa8fa963f6847478fe)

7 years agoarm64: rockchip_defconfig: enable HARDENED_USERCOPY
Huang, Tao [Mon, 7 Nov 2016 12:25:43 +0000 (20:25 +0800)]
arm64: rockchip_defconfig: enable HARDENED_USERCOPY

e41543b2d15f ("ANDROID: android-base: CONFIG_HARDENED_USERCOPY=y")

Change-Id: I4d2805c318f2fb65ae3c780aac26672bfc41be34
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable CC_STACKPROTECTOR_STRONG
Huang, Tao [Mon, 7 Nov 2016 12:22:08 +0000 (20:22 +0800)]
arm64: rockchip_defconfig: enable CC_STACKPROTECTOR_STRONG

df9e01a6c5d4 ("android-recommended.cfg: enable fstack-protector-strong")

If compiler has stack protector support, set
CONFIG_CC_STACKPROTECTOR_STRONG.

Change-Id: Icd3535b88fb7d62c135da72ae0921f7f4949efe4
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoUPSTREAM: f2fs: avoid hungtask problem caused by losing wake_up
Yunlei He [Tue, 23 Feb 2016 04:07:56 +0000 (12:07 +0800)]
UPSTREAM: f2fs: avoid hungtask problem caused by losing wake_up

The D state of wait_on_all_pages_writeback should be waken by
function f2fs_write_end_io when all writeback pages have been
succesfully written to device. It's possible that wake_up comes
between get_pages and io_schedule. Maybe in this case it will
lost wake_up and still in D state even if all pages have been
write back to device, and finally, the whole system will be into
the hungtask state.

                if (!get_pages(sbi, F2FS_WRITEBACK))
                         break;
<---------  wake_up
                io_schedule();

Change-Id: I8a60393c91343d75b7d48df2ca19d1735d69cc51
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Biao He <hebiao6@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 0ff21646f2a5c6ff77acc51eb3df4235af39be46)
Signed-off-by: Cliff Chen <cliff.chen@rock-chips.com>
7 years agoarm64: configs: add missing usb config in rockchip linux
Jacob Chen [Mon, 7 Nov 2016 08:57:35 +0000 (16:57 +0800)]
arm64: configs: add missing usb config in rockchip linux

Change-Id: I39f908c4427799a2728f7bc5f39e20accd126901
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm64: configs: rockchip: enable configfs usb gadget and otg in rockchip_linux_defconfig
Jacob Chen [Mon, 7 Nov 2016 06:41:01 +0000 (14:41 +0800)]
arm64: configs: rockchip: enable configfs usb gadget and otg in rockchip_linux_defconfig

Change-Id: I3d260fe97fe3dad2101a4cc54a604f8eca7ed248
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoRevert "arm64: dts: rk3399-sapphire: add vbus-5v gpio control in fusb302 node."
Jacob Chen [Tue, 8 Nov 2016 00:55:36 +0000 (08:55 +0800)]
Revert "arm64: dts: rk3399-sapphire: add vbus-5v gpio control in fusb302 node."

This reverts commit cb3e42dc8cf5e1e0431535a2fbe2a39dfac91d39.

This will make usb port in my board can't work, no 5v voltage.
Is it no issues in android?

Change-Id: I95fbd957d0ddb5fddf215d3b00ef74aae8af08d3
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agodrm: support ignore drm ioctl permission
Mark Yao [Fri, 4 Nov 2016 08:27:14 +0000 (16:27 +0800)]
drm: support ignore drm ioctl permission

Change-Id: I269766a9f3f844933bd294ce681466f5a97b1d43
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoUPSTREAM: arm64: dts: rockchip: add the tcpc for rk3399 power domain
Caesar Wang [Fri, 2 Sep 2016 20:39:06 +0000 (04:39 +0800)]
UPSTREAM: arm64: dts: rockchip: add the tcpc for rk3399 power domain

The tcpc is the Type C Port Controller and Type C Port Delivery (tcpd)
is part of it, we haven't used them now, add it to save power consumption.

Change-Id: Ia1046fd3bb7382498811159d8280ee46b3753ebd
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 4a3a3d32c77f942a10c0319f589186a768821397)

7 years agoUPSTREAM: soc: rockchip: power-domain: avoid infinite loop
Caesar Wang [Wed, 12 Oct 2016 18:16:08 +0000 (02:16 +0800)]
UPSTREAM: soc: rockchip: power-domain: avoid infinite loop

In some cases, we have met the infinite loop in
rockchip_pmu_set_idle_request() or rockchip_do_pmu_set_power_domain().

As the crosbug.com/p/57351 reported, the boot hangs right after this
[1.629163] bootconsole [uart8250] disabled
[1.639286] [drm:drm_core_init] Initialized drm 1.1.0 20060810
[1.645926] [drm:drm_get_platform_dev] Initialized vgem 1.0.0 20120112..
[1.654558] iommu: Adding device ff8f0000.vop to group 0
[1.660569] iommu: Adding device ff900000.vop to group 1
<hang>

This patch adds the error message and timeout to avoid infinite loop if
it fails to get the ack.

Change-Id: Ia1e2edbdb48de3ec776f1304a941136d3e7a1854
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from git.kernel.org mmind/linux-rockchip.git
 v4.10-armsoc/drivers commit e4c8cd82d5e1146590611c393001d846535bac5b)

7 years agoARM64: dts: rk3399: support cluster idle feature
tony.xie [Mon, 12 Sep 2016 06:24:44 +0000 (14:24 +0800)]
ARM64: dts: rk3399: support cluster idle feature

Add cluster sleep in cpu idle_states for RK3399 SoCs.

Change-Id: I85ea62f9af0d0c61e866a1937f79921d854fd1dc
Signed-off-by: tony.xie <tony.xie@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoMALI: midgard: ARM: patch for fence timeout in monkey test
chenzhen [Fri, 4 Nov 2016 01:29:41 +0000 (09:29 +0800)]
MALI: midgard: ARM: patch for fence timeout in monkey test

comes from mali support case [TAC674871].

Change-Id: I5e7c54190e24eea0306a9d64545482c6209a2c0d
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
7 years agork: gcc-wrapper.py ignore memcontrol.c:5346
Huang, Tao [Mon, 7 Nov 2016 02:47:20 +0000 (10:47 +0800)]
rk: gcc-wrapper.py ignore memcontrol.c:5346

Change-Id: I19b5f58f395cce934fe2efbb01267576b7772c02
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable cpu avs
Finley Xiao [Mon, 31 Oct 2016 10:49:20 +0000 (18:49 +0800)]
arm64: rockchip_defconfig: enable cpu avs

Change-Id: I626d1d238ea8efa38763fb6360936ce13c0c17fe
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoPM / AVS: rockchip-cpu-avs: add driver handling Rockchip cpu avs
Finley Xiao [Mon, 31 Oct 2016 10:38:58 +0000 (18:38 +0800)]
PM / AVS: rockchip-cpu-avs: add driver handling Rockchip cpu avs

This patch supports adjusting opp's voltage according to leakage

Change-Id: Ifbb6b6fec03abe0c7708a148affe4d7646ce38fa
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: dts: rockchip: add cpu-avs node for rk3399
Finley Xiao [Mon, 31 Oct 2016 10:36:35 +0000 (18:36 +0800)]
arm64: dts: rockchip: add cpu-avs node for rk3399

Change-Id: Ibfcda65b6b97af453942888cf07e8f08b06768c2
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodt-bindings: add binding document for Rockchip cpu avs
Finley Xiao [Wed, 2 Nov 2016 09:48:41 +0000 (17:48 +0800)]
dt-bindings: add binding document for Rockchip cpu avs

This patch documents the Rockchip cpu avs device tree binding.

Change-Id: I4a86cd384f304a5d77ff2763b2347804699b9b93
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoPM / OPP: Support adjusting OPP voltages at runtime
Finley Xiao [Mon, 31 Oct 2016 10:10:59 +0000 (18:10 +0800)]
PM / OPP: Support adjusting OPP voltages at runtime

On some SoCs the Adaptive Voltage Scaling (AVS) technique is
employed to optimize the operating voltage of a device. At a
given frequency, the hardware monitors dynamic factors and either
makes a suggestion for how much to adjust a voltage for the
current frequency, or it automatically adjusts the voltage
without software intervention. Add an API to the OPP library for
the former case, so that AVS type devices can update the voltages
for an OPP when the hardware determines the voltage should
change. The assumption is that drivers like CPUfreq or devfreq
will register for the OPP notifiers and adjust the voltage
according to suggestions that AVS makes.

Change-Id: Ia6dddc0976f116555965f784794b8eca37582737
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3399: add discrete vr support for box hardware
Luo wei [Thu, 3 Nov 2016 08:00:20 +0000 (16:00 +0800)]
arm64: dts: rockchip: rk3399: add discrete vr support for box hardware

Change-Id: I64078f3ab5730a451df05e64bee779fe99051af0
Signed-off-by: Luo wei <lw@rock-chips.com>
7 years agoarm64: dts: rk3399-vr: enable rk_headset on rk3399 vr
wuliangqing [Fri, 4 Nov 2016 01:36:52 +0000 (09:36 +0800)]
arm64: dts: rk3399-vr: enable rk_headset on rk3399 vr

Change-Id: I4e078c586e6654c3a4711d0b0108d28360db9453
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable DEFAULT_USE_ENERGY_AWARE
Huang, Tao [Fri, 4 Nov 2016 06:33:48 +0000 (14:33 +0800)]
arm64: rockchip_defconfig: enable DEFAULT_USE_ENERGY_AWARE

Same as before merge last lsk.

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoMerge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
Huang, Tao [Fri, 4 Nov 2016 06:23:25 +0000 (14:23 +0800)]
Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git

* linux-linaro-lsk-v4.4-android: (1362 commits)
  Linux 4.4.30
  Revert "fix minor infoleak in get_user_ex()"
  Revert "x86/mm: Expand the exception table logic to allow new handling options"
  Linux 4.4.29
  ARM: pxa: pxa_cplds: fix interrupt handling
  powerpc/nvram: Fix an incorrect partition merge
  mpt3sas: Don't spam logs if logging level is 0
  perf symbols: Fixup symbol sizes before picking best ones
  perf symbols: Check symbol_conf.allow_aliases for kallsyms loading too
  perf hists browser: Fix event group display
  clk: divider: Fix clk_divider_round_rate() to use clk_readl()
  clk: qoriq: fix a register offset error
  s390/con3270: fix insufficient space padding
  s390/con3270: fix use of uninitialised data
  s390/cio: fix accidental interrupt enabling during resume
  x86/mm: Expand the exception table logic to allow new handling options
  dmaengine: ipu: remove bogus NO_IRQ reference
  power: bq24257: Fix use of uninitialized pointer bq->charger
  staging: r8188eu: Fix scheduling while atomic splat
  ASoC: dapm: Fix kcontrol creation for output driver widget
  ...

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 agoMerge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Alex Shi [Tue, 1 Nov 2016 04:01:20 +0000 (12:01 +0800)]
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android

7 years ago Merge tag 'v4.4.30' into linux-linaro-lsk-v4.4
Alex Shi [Tue, 1 Nov 2016 04:01:18 +0000 (12:01 +0800)]
 Merge tag 'v4.4.30' into linux-linaro-lsk-v4.4

 This is the 4.4.30 stable release

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 agoLinux 4.4.30
Greg Kroah-Hartman [Tue, 1 Nov 2016 01:56:58 +0000 (19:56 -0600)]
Linux 4.4.30

7 years agoRevert "fix minor infoleak in get_user_ex()"
Greg Kroah-Hartman [Mon, 31 Oct 2016 16:14:06 +0000 (10:14 -0600)]
Revert "fix minor infoleak in get_user_ex()"

This reverts commit 9d25c78ec01c402dc56272693c44ef9d72ecdd2e which is
1c109fabbd51863475cd12ac206bdd249aee35af upstream

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoRevert "x86/mm: Expand the exception table logic to allow new handling options"
Greg Kroah-Hartman [Mon, 31 Oct 2016 16:12:45 +0000 (10:12 -0600)]
Revert "x86/mm: Expand the exception table logic to allow new handling options"

This reverts commit fcf5e5198b447969ed2a56ec335dae3c695a6b46 which is
548acf19234dbda5a52d5a8e7e205af46e9da840 upstream.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoLinux 4.4.29
Greg Kroah-Hartman [Mon, 31 Oct 2016 12:15:26 +0000 (06:15 -0600)]
Linux 4.4.29

7 years agoARM: pxa: pxa_cplds: fix interrupt handling
Robert Jarzmik [Sun, 4 Sep 2016 18:59:45 +0000 (20:59 +0200)]
ARM: pxa: pxa_cplds: fix interrupt handling

commit 9ba63e3cc849cdaf3b675c47cc51fe35419e5117 upstream.

Since its initial commit, the driver is buggy for multiple interrupts
handling. The translation from the former lubbock.c file was not
complete, and might stall all interrupt handling when multiple
interrupts occur.

This is especially true when inside the interrupt handler and if a new
interrupt comes and is not handled, leaving the output line still held,
and not creating a transition as the GPIO block behind would expect to
trigger another cplds_irq_handler() call.

For the record, the hardware is working as follows.

The interrupt mechanism relies on :
 - one status register
 - one mask register

Let's suppose the input irq lines are called :
 - i_sa1111
 - i_lan91x
 - i_mmc_cd
Let's suppose the status register for each irq line is called :
 - status_sa1111
 - status_lan91x
 - status_mmc_cd
Let's suppose the interrupt mask for each irq line is called :
 - irqen_sa1111
 - irqen_lan91x
 - irqen_mmc_cd
Let's suppose the output irq line, connected to GPIO0 is called :
 - o_gpio0

The behavior is as follows :
 - o_gpio0 = not((status_sa1111 & irqen_sa1111) |
 (status_lan91x & irqen_lan91x) |
 (status_mmc_cd & irqen_mmc_cd))
   => this is a N-to-1 NOR gate and multiple AND gates
 - irqen_* is exactly as programmed by a write to the FPGA
 - status_* behavior is governed by a bi-stable D flip-flop
   => on next FPGA clock :
     - if i_xxx is high, status_xxx becomes 1
     - if i_xxx is low, status_xxx remains as it is
     - if software sets status_xxx to 0, the D flip-flop is reset
       => status_xxx becomes 0
       => on next FPGA clock cycle, if i_xxx is high, status_xxx becomes
  1 again

Fixes: fc9e38c0f4d3 ("ARM: pxa: lubbock: use new pxa_cplds driver")
Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agopowerpc/nvram: Fix an incorrect partition merge
Pan Xinhui [Thu, 10 Dec 2015 07:30:02 +0000 (15:30 +0800)]
powerpc/nvram: Fix an incorrect partition merge

commit 11b7e154b132232535befe51c55db048069c8461 upstream.

When we merge two contiguous partitions whose signatures are marked
NVRAM_SIG_FREE, We need update prev's length and checksum, then write it
to nvram, not cur's. So lets fix this mistake now.

Also use memset instead of strncpy to set the partition's name. It's
more readable if we want to fill up with duplicate chars .

Fixes: fa2b4e54d41f ("powerpc/nvram: Improve partition removal")
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agompt3sas: Don't spam logs if logging level is 0
Johannes Thumshirn [Wed, 3 Aug 2016 13:00:18 +0000 (15:00 +0200)]
mpt3sas: Don't spam logs if logging level is 0

commit 0d667f72b2a20bbac72bec0ab11467fc70bb0f1f upstream.

In _scsih_io_done() we test if the ioc->logging_level does _not_ have
the MPT_DEBUG_REPLY bit set and if it hasn't we print the debug
messages. This unfortunately is the wrong way around.

Note, the actual bug is older than af0094115 but this commit removed the
CONFIG_SCSI_MPT3SAS_LOGGING Kconfig option which hid the bug.

Fixes: af0094115 'mpt2sas, mpt3sas: Remove SCSI_MPTXSAS_LOGGING entry from Kconfig'
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoperf symbols: Fixup symbol sizes before picking best ones
Arnaldo Carvalho de Melo [Thu, 1 Sep 2016 14:00:23 +0000 (11:00 -0300)]
perf symbols: Fixup symbol sizes before picking best ones

commit 432746f8e0b6a82ba832b771afe31abd51af6752 upstream.

When we call symbol__fixup_duplicate() we use algorithms to pick the
"best" symbols for cases where there are various functions/aliases to an
address, and those check zero size symbols, which, before calling
symbol__fixup_end() are _all_ symbols in a just parsed kallsyms file.

So first fixup the end, then fixup the duplicates.

Found while trying to figure out why 'perf test vmlinux' failed, see the
output of 'perf test -v vmlinux' to see cases where the symbols picked
as best for vmlinux don't match the ones picked for kallsyms.

Cc: Anton Blanchard <anton@samba.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 694bf407b061 ("perf symbols: Add some heuristics for choosing the best duplicate symbol")
Link: http://lkml.kernel.org/n/tip-rxqvdgr0mqjdxee0kf8i2ufn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>