Commit Graph

608813 Commits

Author SHA1 Message Date
Finley Xiao
f1671758fc arm: dts: rockchip: Change cpu opp-microvolt form one entry to three
Single entry is for target voltage and three entries are for
<target min max> voltages. Change cpu opp-microvolt form one entry to
three entries and set maximum acceptable voltage to a high value so that
regulator device can supply multiple consumers at the same time.

Change-Id: I3a0dc4e161bae33e36b232c36a0a05a3102359ef
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-27 17:03:13 +08:00
Jason Song
7872d76144 ARM64: dts: rockchip: px5: fix pmu and ddr configs.
Change-Id: I7bed4caac70b430752bc6338d15554901892144a
Signed-off-by: Jason Song <sxj@rock-chips.com>
2018-04-27 14:32:17 +08:00
Jason Song
17b13ccea0 ARM64: dts: rockchip: add ramoops support for rk3368-android
Change-Id: If570260ce12fd2afc678cefcbfe1a2641b5253d9
Signed-off-by: Jason Song <sxj@rock-chips.com>
2018-04-27 14:31:32 +08:00
Shixiang Zheng
9fd9c79820 drm/rockchip: add a debug node to dump buf from application
dump path: /data/vop_buf
debug nod: d/dri/0/ff900000.vop/vop_dump/dump
echo dump    > dump to dump one frame
echo dumpon  > dump to start vop keep dumping
echo dumpoff > dump to stop keep dumping
echo dumpn   > dump n is the number of dump times
if fd err -3 try rm -r /data/vopbuf echo dump1 > dump can fix it
if fd err -28 save needed data try rm -r /data/vopbuf

Change-Id: Id5fefa428db1b5669ceae418cd8bddfa52e52f61
Signed-off-by: Shixiang Zheng <shixiang.zheng@rock-chips.com>
2018-04-27 10:43:43 +08:00
Caesar Wang
1c40af5de0 arm64: dts: rockchip: rk3326-evb-linux-lp3-v10: add the ov5695 for rk3326 mipi
This patch adds the ov5695 releated configure with rk3326 mipi/isp.

Change-Id: I62d6d8854d7e66fac521b3fea0f4dd35dc2799c4
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2018-04-27 10:33:44 +08:00
Hu Kejun
a657b85fc1 media: i2c: ov5695: initialize sensor driver after io_domain
Change-Id: Ia0d754d941ba9bda874efe787a985f00cf1be779
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2018-04-27 10:32:57 +08:00
William Wu
6f0fe931c5 BACKPORT: usb: gadget: add tracepoints to the gadget API
This new set of tracepoints will help all gadget
drivers and UDC drivers when problem appears. Note
that, in order to be able to add tracepoints to
udc-core.c we had to rename that to core.c and
statically link it with trace.c to form
udc-core.o. This is to make sure that module name
stays the same.

Change-Id: I23eb801151a75629a8a2f6e7d9203f58281ed3d2
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 5e42d710a1)
2018-04-27 10:27:04 +08:00
Felipe Balbi
9af9852cc1 UPSTREAM: usb: gadget: move gadget API functions to udc-core
instead of defining all functions as static inlines,
let's move them to udc-core and export them with
EXPORT_SYMBOL_GPL, that way we can make sure that
only GPL drivers will use them.

As a side effect, it'll be nicer to add tracepoints
to the gadget API.

While at that, also fix Kconfig dependencies to
avoid randconfig build failures.

Change-Id: I3fcc99c0730608076cfa8624908e58b7ee6f1bef
Acked-By: Sebastian Reichel <sre@kernel.org>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry-picked from commit 5a8d651a2b)
2018-04-27 10:27:04 +08:00
Rocky Hao
00011b0208 arm: dts: rockchip: update tsadc's pinctrl for rk3288
we set cru reset as tshut's default mode, i.e. hw-tshut-mode = <0>, and
otp_gpio mode is set accordingly. if gpio mode is set,
i.e. hw-tshut-mode = <1>, otp_out is set accordingly.

Change-Id: I3cb4588fec171e2867a326f55c2115b1da927ac3
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
2018-04-27 10:24:12 +08:00
Simon Xue
b8bca70342 iommu/rockchip: support rk_iommu_map_sg for iommu ops
Impletement rk_iommu_map_sg for rk_iommu_ops, which only
flush TLB once after each sg been mapped, that speed up
the map operation.

Change-Id: Ief123ad363018d2b3227066c07338ccbd75c9d84
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2018-04-27 10:23:33 +08:00
XiaoDong Huang
c9b30e4ff4 regulator: tps549b22: add TI TPS549b22 support
Change-Id: I7550fc9f78a30b5d8ff705403ad91cfd8727fad6
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2018-04-27 10:23:16 +08:00
Steven Rostedt (VMware)
102d3ecfe1 UPSTREAM: sched/core: Call __schedule() from do_idle() without enabling preemption
I finally got around to creating trampolines for dynamically allocated
ftrace_ops with using synchronize_rcu_tasks(). For users of the ftrace
function hook callbacks, like perf, that allocate the ftrace_ops
descriptor via kmalloc() and friends, ftrace was not able to optimize
the functions being traced to use a trampoline because they would also
need to be allocated dynamically. The problem is that they cannot be
freed when CONFIG_PREEMPT is set, as there's no way to tell if a task
was preempted on the trampoline. That was before Paul McKenney
implemented synchronize_rcu_tasks() that would make sure all tasks
(except idle) have scheduled out or have entered user space.

While testing this, I triggered this bug:

BUG: unable to handle kernel paging request at ffffffffa0230077
 ...
RIP: 0010:0xffffffffa0230077
 ...
Call Trace:
  schedule+0x5/0xe0
  schedule_preempt_disabled+0x18/0x30
  do_idle+0x172/0x220

What happened was that the idle task was preempted on the trampoline.
As synchronize_rcu_tasks() ignores the idle thread, there's nothing
that lets ftrace know that the idle task was preempted on a trampoline.

The idle task shouldn't need to ever enable preemption. The idle task
is simply a loop that calls schedule or places the cpu into idle mode.
In fact, having preemption enabled is inefficient, because it can
happen when idle is just about to call schedule anyway, which would
cause schedule to be called twice. Once for when the interrupt came in
and was returning back to normal context, and then again in the normal
path that the idle loop is running in, which would be pointless, as it
had already scheduled.

The only reason schedule_preempt_disable() enables preemption is to be
able to call sched_submit_work(), which requires preemption enabled. As
this is a nop when the task is in the RUNNING state, and idle is always
in the running state, there's no reason that idle needs to enable
preemption. But that means it cannot use schedule_preempt_disable() as
other callers of that function require calling sched_submit_work().

Adding a new function local to kernel/sched/ that allows idle to call
the scheduler without enabling preemption, fixes the
synchronize_rcu_tasks() issue, as well as removes the pointless spurious
schedule calls caused by interrupts happening in the brief window where
preemption is enabled just before it calls schedule.

Reviewed: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170414084809.3dacde2a@gandalf.local.home
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-----Shawn: trace on 4.4 for RK3308 -------------------------
[  151.389904] BUG: scheduling while atomic: swapper/0/0/0x00000000
[  151.390478] Modules linked in:
[  151.390813] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.126 #1327
[  151.390830] Hardware name: Rockchip RK3308 evb digital-i2s mic board
(DT)
[  151.390844] Call trace:
[  151.390868] [<ffffff800808731c>] dump_backtrace+0x0/0x1c4
[  151.390883] [<ffffff80080874f4>] show_stack+0x14/0x1c
[  151.390900] [<ffffff80081e4274>] dump_stack+0x94/0xbc
[  151.390919] [<ffffff80080b4c6c>] __schedule_bug+0x3c/0x54
[  151.390938] [<ffffff800857e978>] __schedule+0x88/0x45c
[  151.390953] [<ffffff800857edc0>] schedule+0x74/0x94
[  151.390971] [<ffffff800857f118>] schedule_preempt_disabled+0x20/0x38
[  151.390987] [<ffffff80080c9d74>] cpu_startup_entry+0x44/0x204
[  151.391007] [<ffffff800857cda0>] rest_init+0x80/0x8c
[  151.391025] [<ffffff8008750b04>] start_kernel+0x31c/0x330
[  151.391040] [<ffffff80087501c4>] __primary_switched+0x30/0x6c
-------------------------------------------------------
Change-Id: I12971dfe9c2039920162326aabe1df0ecaf79804
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry-picked from 8663effb24)
2018-04-26 19:23:47 +08:00
Tony Xie
4b2e018dc1 arm64: dts: rockchip: support board-irdrop for rk3326-863 board
Change-Id: I3ccb3c6426d08dc1a186f86d86391a8e307e6e1b
Signed-off-by: Tony Xie <xxx@rock-chips.com>
2018-04-26 17:13:18 +08:00
Finley Xiao
1605391f3b arm64: dts: rockchip: px30: modify voltage for gpu 200MHz and 300Mhz
Change-Id: Ifbd3117d3999b322951df458a12cfe488954803d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-26 17:12:28 +08:00
Liang Chen
96176aa53b arm64: dts: rockchip: Enable dmc for px30/rk3326
Change-Id: I47c08b9fcd12c21c3cc4731617ebfe4331a0ac72
Signed-off-by: Liang Chen <cl@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-26 17:12:06 +08:00
Tony Xie
4487c33172 PM / devfreq: rockchip_dmc: Adjust struct rockchip_dmcfreq in suspend.
Change-Id: If9761fe64d7edef6e218dee591f523679e154199
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-04-26 16:44:58 +08:00
Finley Xiao
e37dce72a0 PM / devfreq: rockchip_dmc: Update cpu dma latency when change frequency
Change-Id: Ia063ce7da2f68ffac4068f4f8136acf178a28918
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-04-26 16:44:24 +08:00
Tony Xie
767bd670b9 arm64: dts: rockchip: support complete_irq in dmc node for px30.
Change-Id: I99e474f323cf57a15e1ed7431bafe3514aedc603
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-04-26 16:44:24 +08:00
Tony Xie
5c1ca8c14c PM / devfreq: rockchip_dmc: support wait_complete.
Change-Id: Ie3f173f632068f261b84a204bbd36b26b10e1981
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-04-26 16:44:24 +08:00
Xing Zheng
46cb48d1dc ASoC: rk3308_codec: add a bit of delay during enable DAC
The suggestion is from verndor, we should add a bit of
delay in key steps until the reference voltages are
stable, otherwise, the output of voltage maybe too low.

@HPMIX -6dB + LINEOUT -6dB:
normal Vpp: ~450mV
abnormal Vpp: ~100mV

Change-Id: I463d308b809b2c5e74e3bd37573bcbbd624df72e
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-26 16:40:53 +08:00
CanYang He
f48d457786 arm64: dts: rockchip: increase mcu frequency to 97mhz for rk3399
mcu run at 97MHz to reduce lpddr4 scale frequency elapsed time

Change-Id: Ie2805eaf0d902c9531819217d05a86775d85f809
Signed-off-by: CanYang He <hcy@rock-chips.com>
2018-04-26 16:35:05 +08:00
CanYang He
ff3dcfed5f arm64: dts: rockchip: support lpddr4 for rk3399
1. modify lpddr4 setting in rk3399-dram-default-timing.dts
2. add a dts file for evb-rev3 lpddr4
3. using sram buffer for pcm buffer

Change-Id: Id52e9e4b5c366ec61bfb4818d3a14a4ea2024806
Signed-off-by: CanYang He <hcy@rock-chips.com>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2018-04-26 16:31:00 +08:00
Sugar Zhang
d45d93b7e1 ASoC: rockchip: add support for sram audio buffer
This patch force the use of sram buffer for pcm buffer,
default is disabled.

Change-Id: I2e6936e1071347f767c67066126b22e39fb477c5
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2018-04-26 16:24:52 +08:00
Tao Huang
57ef690be6 soc: rockchip: rockchip_dmc: add missing CONFIG_
Commit 1763310f33 ("soc: rockchip: Add dummy
rockchip_pm_register_notify_to_dmc") make power domain driver
unable to receive dmc notify. That will make DDR freq stop or
power domain unable to idle or deidle.

Fixes: 1763310f33 ("soc: rockchip: Add dummy rockchip_pm_register_notify_to_dmc")
Change-Id: I30970507ce56a663198c777ddf691ccfbf12611e
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-04-26 16:03:40 +08:00
William Wu
801ff69e8b uvcvideo: add quirk for dev parent with broken auto suspend
If the parent of uvc device has a quirk for broken
auto-suspend function (e.g. rk3328 usb 3.0 root hub),
we also need to disable auto-suspend for the uvc device.

Change-Id: Ida8d05a411f49f39e13cad3ec837a56598b4a630
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-04-26 10:52:31 +08:00
William Wu
a46f2b4821 usb: dwc3: rockchip: fix usb peripheral connection fail
This patch fix the issue that usb peripheral fails to connect
to PC after resume from deep sleep. In my test case, I use a
rk3399 sapphire excavator board, and test usb as follows:

- Let the system enter deep sleep without usb connection.
- During deep sleep, connect the Type-C0 of rk3399 with PC usb port.
- Press power key to wakeup system, and check if the PC can detect usb.

Without this patch, the usb enumeration often fail with the
error log "dwc3 fe800000.dwc3: failed to enable ep0out". It's
because that after system resume, the dwc3 pm resume and dwc3
pm runtime resume are running asynchronously. If dwc3 runtime
resume before pm resume, the dwc3_resume_common() maybe called
twice, and cause ep enable failure.

This patch use the suspend flag of dev to wait until the dwc3
core resume from PM suspend successfully before do dwc3 pm
runtime resume.

Change-Id: I6a67ad636630699569e16346ac167b785b800f85
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-04-26 09:25:13 +08:00
Sean Purcell
690646e829 UPSTREAM: squashfs: Add zstd support
Add zstd compression and decompression support to SquashFS. zstd is a
great fit for SquashFS because it can compress at ratios approaching xz,
while decompressing twice as fast as zlib. For SquashFS in particular,
it can decompress as fast as lzo and lz4. It also has the flexibility
to turn down the compression ratio for faster compression times.

The compression benchmark is run on the file tree from the SquashFS archive
found in ubuntu-16.10-desktop-amd64.iso [1]. It uses `mksquashfs` with the
default block size (128 KB) and and various compression algorithms/levels.
xz and zstd are also benchmarked with 256 KB blocks. The decompression
benchmark times how long it takes to `tar` the file tree into `/dev/null`.
See the benchmark file in the upstream zstd source repository located under
`contrib/linux-kernel/squashfs-benchmark.sh` [2] for details.

I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
16 GB of RAM, and a SSD.

| Method         | Ratio | Compression MB/s | Decompression MB/s |
|----------------|-------|------------------|--------------------|
| gzip           |  2.92 |               15 |                128 |
| lzo            |  2.64 |              9.5 |                217 |
| lz4            |  2.12 |               94 |                218 |
| xz             |  3.43 |              5.5 |                 35 |
| xz 256 KB      |  3.53 |              5.4 |                 40 |
| zstd 1         |  2.71 |               96 |                210 |
| zstd 5         |  2.93 |               69 |                198 |
| zstd 10        |  3.01 |               41 |                225 |
| zstd 15        |  3.13 |             11.4 |                224 |
| zstd 16 256 KB |  3.24 |              8.1 |                210 |

This patch was written by Sean Purcell <me@seanp.xyz>, but I will be
taking over the submission process.

[1] http://releases.ubuntu.com/16.10/
[2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/squashfs-benchmark.sh

zstd source repository: https://github.com/facebook/zstd

Change-Id: I6d6d6c1a7f565d7ad28eb01d052604ec7b588a0b
Signed-off-by: Sean Purcell <me@seanp.xyz>
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Acked-by: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry-picked from commit 87bf54bb43)
2018-04-25 16:21:55 +08:00
Nick Terrell
14793dd0f5 UPSTREAM: lib: Add zstd modules
Add zstd compression and decompression kernel modules.
zstd offers a wide varity of compression speed and quality trade-offs.
It can compress at speeds approaching lz4, and quality approaching lzma.
zstd decompressions at speeds more than twice as fast as zlib, and
decompression speed remains roughly the same across all compression levels.

The code was ported from the upstream zstd source repository. The
`linux/zstd.h` header was modified to match linux kernel style.
The cross-platform and allocation code was stripped out. Instead zstd
requires the caller to pass a preallocated workspace. The source files
were clang-formatted [1] to match the Linux Kernel style as much as
possible. Otherwise, the code was unmodified. We would like to avoid
as much further manual modification to the source code as possible, so it
will be easier to keep the kernel zstd up to date.

I benchmarked zstd compression as a special character device. I ran zstd
and zlib compression at several levels, as well as performing no
compression, which measure the time spent copying the data to kernel space.
Data is passed to the compresser 4096 B at a time. The benchmark file is
located in the upstream zstd source repository under
`contrib/linux-kernel/zstd_compress_test.c` [2].

I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
16 GB of RAM, and a SSD. I benchmarked using `silesia.tar` [3], which is
211,988,480 B large. Run the following commands for the benchmark:

    sudo modprobe zstd_compress_test
    sudo mknod zstd_compress_test c 245 0
    sudo cp silesia.tar zstd_compress_test

The time is reported by the time of the userland `cp`.
The MB/s is computed with

    1,536,217,008 B / time(buffer size, hash)

which includes the time to copy from userland.
The Adjusted MB/s is computed with

    1,536,217,088 B / (time(buffer size, hash) - time(buffer size, none)).

The memory reported is the amount of memory the compressor requests.

| Method   | Size (B) | Time (s) | Ratio | MB/s    | Adj MB/s | Mem (MB) |
|----------|----------|----------|-------|---------|----------|----------|
| none     | 11988480 |    0.100 |     1 | 2119.88 |        - |        - |
| zstd -1  | 73645762 |    1.044 | 2.878 |  203.05 |   224.56 |     1.23 |
| zstd -3  | 66988878 |    1.761 | 3.165 |  120.38 |   127.63 |     2.47 |
| zstd -5  | 65001259 |    2.563 | 3.261 |   82.71 |    86.07 |     2.86 |
| zstd -10 | 60165346 |   13.242 | 3.523 |   16.01 |    16.13 |    13.22 |
| zstd -15 | 58009756 |   47.601 | 3.654 |    4.45 |     4.46 |    21.61 |
| zstd -19 | 54014593 |  102.835 | 3.925 |    2.06 |     2.06 |    60.15 |
| zlib -1  | 77260026 |    2.895 | 2.744 |   73.23 |    75.85 |     0.27 |
| zlib -3  | 72972206 |    4.116 | 2.905 |   51.50 |    52.79 |     0.27 |
| zlib -6  | 68190360 |    9.633 | 3.109 |   22.01 |    22.24 |     0.27 |
| zlib -9  | 67613382 |   22.554 | 3.135 |    9.40 |     9.44 |     0.27 |

I benchmarked zstd decompression using the same method on the same machine.
The benchmark file is located in the upstream zstd repo under
`contrib/linux-kernel/zstd_decompress_test.c` [4]. The memory reported is
the amount of memory required to decompress data compressed with the given
compression level. If you know the maximum size of your input, you can
reduce the memory usage of decompression irrespective of the compression
level.

| Method   | Time (s) | MB/s    | Adjusted MB/s | Memory (MB) |
|----------|----------|---------|---------------|-------------|
| none     |    0.025 | 8479.54 |             - |           - |
| zstd -1  |    0.358 |  592.15 |        636.60 |        0.84 |
| zstd -3  |    0.396 |  535.32 |        571.40 |        1.46 |
| zstd -5  |    0.396 |  535.32 |        571.40 |        1.46 |
| zstd -10 |    0.374 |  566.81 |        607.42 |        2.51 |
| zstd -15 |    0.379 |  559.34 |        598.84 |        4.61 |
| zstd -19 |    0.412 |  514.54 |        547.77 |        8.80 |
| zlib -1  |    0.940 |  225.52 |        231.68 |        0.04 |
| zlib -3  |    0.883 |  240.08 |        247.07 |        0.04 |
| zlib -6  |    0.844 |  251.17 |        258.84 |        0.04 |
| zlib -9  |    0.837 |  253.27 |        287.64 |        0.04 |

Tested in userland using the test-suite in the zstd repo under
`contrib/linux-kernel/test/UserlandTest.cpp` [5] by mocking the kernel
functions. Fuzz tested using libfuzzer [6] with the fuzz harnesses under
`contrib/linux-kernel/test/{RoundTripCrash.c,DecompressCrash.c}` [7] [8]
with ASAN, UBSAN, and MSAN. Additionaly, it was tested while testing the
BtrFS and SquashFS patches coming next.

[1] https://clang.llvm.org/docs/ClangFormat.html
[2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/zstd_compress_test.c
[3] http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
[4] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/zstd_decompress_test.c
[5] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/test/UserlandTest.cpp
[6] http://llvm.org/docs/LibFuzzer.html
[7] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/test/RoundTripCrash.c
[8] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/test/DecompressCrash.c

zstd source repository: https://github.com/facebook/zstd

Change-Id: I743d2b97db39be7e26045c1fd2a7adc1d1440401
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry-picked from commit 73f3d1b48f)
2018-04-25 16:21:55 +08:00
Nick Terrell
0546200f0e UPSTREAM: lib: Add xxhash module
Adds xxhash kernel module with xxh32 and xxh64 hashes. xxhash is an
extremely fast non-cryptographic hash algorithm for checksumming.
The zstd compression and decompression modules added in the next patch
require xxhash. I extracted it out from zstd since it is useful on its
own. I copied the code from the upstream XXHash source repository and
translated it into kernel style. I ran benchmarks and tests in the kernel
and tests in userland.

I benchmarked xxhash as a special character device. I ran in four modes,
no-op, xxh32, xxh64, and crc32. The no-op mode simply copies the data to
kernel space and ignores it. The xxh32, xxh64, and crc32 modes compute
hashes on the copied data. I also ran it with four different buffer sizes.
The benchmark file is located in the upstream zstd source repository under
`contrib/linux-kernel/xxhash_test.c` [1].

I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
16 GB of RAM, and a SSD. I benchmarked using the file `filesystem.squashfs`
from `ubuntu-16.10-desktop-amd64.iso`, which is 1,536,217,088 B large.
Run the following commands for the benchmark:

    modprobe xxhash_test
    mknod xxhash_test c 245 0
    time cp filesystem.squashfs xxhash_test

The time is reported by the time of the userland `cp`.
The GB/s is computed with

    1,536,217,008 B / time(buffer size, hash)

which includes the time to copy from userland.
The Normalized GB/s is computed with

    1,536,217,088 B / (time(buffer size, hash) - time(buffer size, none)).

| Buffer Size (B) | Hash  | Time (s) | GB/s | Adjusted GB/s |
|-----------------|-------|----------|------|---------------|
|            1024 | none  |    0.408 | 3.77 |             - |
|            1024 | xxh32 |    0.649 | 2.37 |          6.37 |
|            1024 | xxh64 |    0.542 | 2.83 |         11.46 |
|            1024 | crc32 |    1.290 | 1.19 |          1.74 |
|            4096 | none  |    0.380 | 4.04 |             - |
|            4096 | xxh32 |    0.645 | 2.38 |          5.79 |
|            4096 | xxh64 |    0.500 | 3.07 |         12.80 |
|            4096 | crc32 |    1.168 | 1.32 |          1.95 |
|            8192 | none  |    0.351 | 4.38 |             - |
|            8192 | xxh32 |    0.614 | 2.50 |          5.84 |
|            8192 | xxh64 |    0.464 | 3.31 |         13.60 |
|            8192 | crc32 |    1.163 | 1.32 |          1.89 |
|           16384 | none  |    0.346 | 4.43 |             - |
|           16384 | xxh32 |    0.590 | 2.60 |          6.30 |
|           16384 | xxh64 |    0.466 | 3.30 |         12.80 |
|           16384 | crc32 |    1.183 | 1.30 |          1.84 |

Tested in userland using the test-suite in the zstd repo under
`contrib/linux-kernel/test/XXHashUserlandTest.cpp` [2] by mocking the
kernel functions. A line in each branch of every function in `xxhash.c`
was commented out to ensure that the test-suite fails. Additionally
tested while testing zstd and with SMHasher [3].

[1] https://phabricator.intern.facebook.com/P57526246
[2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/test/XXHashUserlandTest.cpp
[3] https://github.com/aappleby/smhasher

zstd source repository: https://github.com/facebook/zstd
XXHash source repository: https://github.com/cyan4973/xxhash

Change-Id: Ibb5ffee816e2593800c07263719bd1d4b802d8de
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry-picked from 5d2405227a)
2018-04-25 16:21:55 +08:00
Caesar Wang
6cdbb3d210 arm64: rockchip_linux_defconfig: enable the gt1x for linux
As the rk3326 board used panel with the gt1x tp for working,

Change-Id: Id46765922a6986b34100c20db0b218090b36aa07
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2018-04-25 15:19:34 +08:00
Caesar Wang
23ad893d02 input: touchscreen: add the ABS_X and ABS_Y report for gt1x
As the linux platform used the udev/mdev userspace mechanisms,
It needed the ABS_X and ABS_Y when the input event as the touchscreen.
Otherswise the userspace will identify as the keyboard.

Change-Id: I892ed37252d49c5457fe1f25fdd14dabce6ff9cf
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2018-04-25 15:19:34 +08:00
Caesar Wang
ebb63d2100 arm64: rockchip_linux_defconfig: enable BIFROST Mali for linux
In order to support the rk3326 mali on linux platform, enabling the
BIFROST Mali config for linux.

As the mali driver had supported for linux with the below commits[0].
And the linux platform didn't need to loade the mali module for working.

commits[0]:
2aee160 MALI: bifrost: RK:
    There are a few modifications in some 'Kbuild' and 'Kconfig' files.
e5ccb3a MALI: bifrost: RK:
    add separate src dir of Bifrost driver for RK Linux device

Change-Id: I1cbd8515aab8a7bd23ab31db1743a4b8c723d81d
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2018-04-25 14:13:46 +08:00
Zhen Chen
7920ebfd62 arm: rockchip_defconfig: enable CONFIG_MALI_PWRSOFT_765 for midgard DDK r18
Change-Id: Ica3b4a1feef6acd9e2d0881091ced3dc086465d3
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2018-04-25 11:57:54 +08:00
Xinhuang Li
5e3370fa00 clk: rockchip: rk3368: set true clk for spdif
the mux_spdif_8ch_p is composed of spdif_8ch_src not spdif_8ch_pre

Change-Id: I7dd40e35078b2d012af2c777de763d14e93c3d4e
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
2018-04-25 11:30:04 +08:00
Xing Zheng
25d06f4256 arm64: dts: rockchip: add headphone detection by codec for RK3308 EVB
This patch using codec detect headphone via simple-card on
RK3308 EVB, it needs add the default widgets "Headphones"
for registering soc-jack.

Change-Id: I9819aa05e8d186d32d9363cfe619782783c67dd0
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-25 09:39:09 +08:00
Xing Zheng
837dedffc4 ASoC: rk3308_codec: clean up and add support headphone detection
Since this signal line is directly connected to the GIC,
it has not been processed by the logic gate. Therefore,
when the headphone is plugged in, the status register
will remain high and when pulled out, the status register
will be converted to a low level.

However, the GIC can only accept high and rising edge
triggers, so when the headset is plugged in, it needs to
poll (~2s) to detect whether plug the headphone.

Change-Id: I321cd363103127911c503a63008882ffbc9c3633
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-25 09:39:07 +08:00
Xing Zheng
ebe374e9c4 HACK-TO-REVERT: ASoC: simple-card: add properties hp/mic via internal codec
Change-Id: I0f99d73c3bed2954710607b773a945c354867b61
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-25 09:39:05 +08:00
Xing Zheng
8fcec45416 HACK-TO-REVERT: ASoC: simple-card: add support hp/mic detect for internal codec
This is a local patch, because our simple-card is too
backward from upstream. This will take more time on
the cherry-pick patch and verification.

In order to speed up the progress, I put this local
patch and please revert it after I merge the new
patches of simple-card.

Change-Id: If566cf66c69d3a4fccbffc423433e6b724a23c04
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-25 09:38:35 +08:00
Xing Zheng
6530305c0d ASoC: rk3308_codec: add suppot 4ch/6ch recording for codec
Change-Id: I4d5dd2c7d0f81966db0faf226b130601dcfcd0cf
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-24 19:28:41 +08:00
William Wu
654983e94d arm: rockchip_linux_config: enable scsi scan async
Enable CONFIG_SCSI_SCAN_ASYNC to probe device on
different buses in parallel, it can speed up the
USB 3.0 UAS disk enumeration on rockchip platform.

Change-Id: I0db76b9326b9ea2700f925ed9d79c2c9470228e7
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-04-24 19:09:31 +08:00
William Wu
6592d7f0ba arm64: rockchip_linux_defconfig: enable scsi scan async
Enable CONFIG_SCSI_SCAN_ASYNC to probe device on
different buses in parallel, it can speed up the
USB 3.0 UAS disk enumeration on rockchip platform.

Change-Id: I30afc13928c8ea6eac16e3a96ef1f79b6bda56ae
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-04-24 19:09:31 +08:00
Finley Xiao
c9a1d109bd clk: rockchip: rk3288: remove the flag ROCKCHIP_PLL_SYNC_RATE for GPLL
If pwm regulator is enabled in uboot, the rate of pclk_pwm can't be
changed, otherwise the voltage may be abnormal. The gpll is the parent
clock of pclk_pwm, its rate also can't be changed.

Change-Id: I493de867ec6d0f8308a03f5ad6fe2244bbae7d11
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-24 16:14:54 +08:00
Sandy Huang
cd54066dfb drm/rockchip: vop: ignore crtc close when crtc is disabled
when in suspend state, the crtc clock is disabled, if we do reboot
at this time, the following call will lead to system panic:

	->rockchip_drm_platform_shutdown()
		->vop_crtc_close()

Change-Id: I1989d0da4d033d608d59587385da288789d9c2c1
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-04-24 14:41:27 +08:00
Tony Xie
6e3ddcaf17 mfd: rk808: Set only resetting pmic register for 817&809.
If the system needs hold register values when system will reboot.
need to set only resetting pmic register for 817&809 forcedly.

Change-Id: Ib4b850c86ec3079cd7e374bc96460ee1532854a2
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-04-24 11:37:19 +08:00
Tao Huang
cea2a68180 soc: rockchip: rk_fiq_debugger: better console thread print
- Print by message other than by byte.
  Make messages more readable.
- Sleep while block other than busy loop.
  Reduce cpu usage while print a lot of messages.
- Show how many messages dropped.
  Let people know that the messages are not complete.
- Wake up console_task when needed.
  Reduce unneeded call wake_up_process.

Change-Id: I508d2f5b6671695413b01bc167d768ec9b614934
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-04-24 11:10:59 +08:00
Huicong Xu
09aeb6ebfb arm64: dts: rockchip: add hdmi hdcp2 node for rk3399
Change-Id: Ie78fbdc226d856a20c2da40e4166e7b23ed27aba
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
2018-04-24 09:23:31 +08:00
lihuang
2aee160e20 MALI: bifrost: RK: There are a few modifications in some 'Kbuild' and 'Kconfig' files.
A new config MALI_BIFROST_FOR_LINUX is introduced to specify which directory of Birfrost to use.

Change-Id: I1f4a01e963073c68238b08f930b196aa799b8e17
Signed-off-by: Putin Lee <putin.li@rock-chips.com>
2018-04-23 15:49:26 +08:00
lihuang
e5ccb3a62b MALI: bifrost: RK: add separate src dir of Bifrost driver for RK Linux device
The version of Bifrost DDK used in RK Linux device is different from the one
    used in Android platforms.
    It might be convenient to have a separate src directory for it.

    The new directory drivers/gpu/arm/bifrost_for_linux is copied from
    drivers/gpu/arm/bifrost of commit 25c5dc5a92y.
    It's on DDK r8p0-01rel0

Change-Id: I3b8b4f071104faf988e56b9b61d41378831943bb
Signed-off-by: Putin Lee <putin.li@rock-chips.com>
2018-04-23 15:49:26 +08:00
Meng Dongyang
f71c468ab1 usb: fix error of reference count of ep
The reference count of endpoints is same with the interface
number in the quirk case of USB_QUIRK_AUTO_SUSPEND. This will
result in a break of unregister interface cycle. As a result,
the device only unregister the first interface when disconnect.
This patch use "j" instead of "i" to solve this problem.

Fixes: f092c995c3 ("USB: core: flush pending URBs for unusual USB3 core when disable device")
Change-Id: I7aba63c0d38768cb956394a702bb61ae3f3250ba
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
2018-04-23 11:57:29 +08:00
Xing Zheng
d0c026907f arm64: dts: rockchip: move acodec sound node to rk3308-evb-v10.dtsi
The acodec part is shared with the RK3308 EVB, so that users
can select an external sound card device as required.

Change-Id: I42c1de879ba14a693c161a401ecf5ba6a8d39cd0
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-04-21 15:01:14 +08:00