Commit Graph

84116 Commits

Author SHA1 Message Date
Mengdong Lin
0e9a1da83f UPSTREAM: ASoC: Export snd_soc_find_dai()
This API can be used by topology to find an existing BE dai by name
and further configure it.

Topology will also check DAI ID to avoid wrong match.

Change-Id: I5651b280ef8352dd20bdb9e6ffa747d0b5a4e088
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 305e9020f0)
2018-05-30 15:13:19 +08:00
LABBE Corentin
2f8f9b4153 UPSTREAM: crypto: hash - add zero length message hash for shax and md5
Some crypto drivers cannot process empty data message and return a
precalculated hash for md5/sha1/sha224/sha256.

This patch add thoses precalculated hash in include/crypto.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 0c4c78de04)

Change-Id: Ie15d9e6119f415c7c5af875fec160299e9053770
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2018-05-24 11:44:00 +08:00
Sudip Mukherjee
c0d45d1ad2 UPSTREAM: devm: add helper devm_add_action_or_reset()
Add a helper function devm_add_action_or_reset() which will internally
call devm_add_action(). But if devm_add_action() fails then it will
execute the action mentioned and return the error code.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit a3499e9bf0)

Change-Id: Ice9a6b483021494194b3c57149bbc451050b1fe3
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2018-05-24 11:43:52 +08:00
Dingqiang Lin
d66b1d9e6a soc: rockchip: add flash vendor storage support
Change-Id: I0261e652161e6a20a4d988c4ddfd7f186ad2200e
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
2018-05-23 09:26:14 +08:00
Shunqing Chen
1df09ca4e1 power: cw201x: add power_supply property for CTS.
Change-Id: Ia342ef45a4e936be3e9ba200b41cfabfcbe5f927
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2018-05-18 16:33:59 +08:00
Xing Zheng
6f1983d819 clk: rockchip: rk3308: Export clk id for i2s src clocks
Change-Id: I4ba557649a95513d6cfbdb2242a5abb3f3650a61
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2018-05-17 14:08:33 +08:00
Tao Huang
c95036feef PM / devfreq: rockchip_dmc: Fix deadlock between dmcfreq and vop on/off
When change vop status and ddr frequency at the same time,
the following deadlock will happen:

vop no/off                            dmcfreq
vop_crtc_disable                      update_devfreq
->mutex_lock(&vop->vop_lock);         ->mutex_lock(&pd->pmu->mutex);
->pm_runtime_put(vop->dev);           ->mutex_lock(&vop->vop_lock);
  ->mutex_lock(&pd->pmu->mutex);      ...

Use new dmcfreq rwsem to decouple vop and pd driver, and get better
parallelism.

Change-Id: I56a4ee944200826d2a09e3ae8d2f4837f6f769d6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-17 11:43:55 +08:00
Elaine Zhang
32c3a8cf9c clk: rockchip: rk3288: export PCLK_PD_PMU and PCLK_PD_ALIVE clock id
Change-Id: Ie0550d9528367fa070328562fad2e597a5d6d7f7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-05-14 16:21:11 +08:00
Elaine Zhang
6e06c1b833 clk: rockchip: rk3399: export CIF_OUT_SRC clock id for cif
Change-Id: I77423891821dae0412dda4414222ba64bd0a4a4a
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-05-14 16:21:11 +08:00
xiaoyao
4ecfee5112 net: wifi: add get_oob_irq_flags interface for request_irq(flags)
Change-Id: I251d3dbad7dbf97c503b3f1ddf46199d8e669cae
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
2018-05-14 14:22:24 +08:00
Joseph Chen
b053b22930 arm64: dts: rockchip: rk3308: add rockchip_suspend node
Change-Id: Ib3a2d78da9a1c6a093b1c49c6393f098b2e03a8a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-05-11 14:44:53 +08:00
Lukasz Luba
f3cbd5a1bb UPSTREAM: devfreq_cooling: make the structs devfreq_cooling_xxx visible for all
Currently the protection #ifdef CONFIG_DEVFREQ_THERMAL cuts the needed
structures devfreq_cooling_ops and devfreq_cooling_device.
The functions which are supposed to provide the empty implementation complain
about unknown structures.
Similar solution is present in include/linux/devfreq.h.

Change-Id: I4ed7161734944799443fd43c56394e62eb3c499f
Reviewed-by: Ørjan Eide <orjan.eide@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 1cea4e7776)
2018-05-10 15:56:41 +08:00
Joseph Chen
1024a16839 firmware: rockchip: add sip_smc_get_suspend_info()
Change-Id: I976984c571ee7938d74129e99560c4c1505a7299
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-05-09 18:27:42 +08:00
Tao Huang
5a754e153e PM / devfreq: rockchip_dmc: move some functions
Move rockchip_dmcfreq_vop_bandwidth_request and
rockchip_dmcfreq_vop_bandwidth_update from rockchip_drm_fb.h
to rockchip_dmc.h.

Change-Id: I5b023e44b46a6c613af71452a940d31feb9b2d97
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-08 17:21:46 +08:00
Tao Huang
ab0d877240 PM / devfreq: rockchip_dmc: include pm_domains.h
remove rockchip_pm_register_notify_to_dmc from rockchip_dmc.h

Change-Id: I9e78eaec2a88cfc06ac3d24f01870cd39c9d05ad
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-08 17:18:43 +08:00
Tao Huang
62192d322e rk: rm include/linux/rockchip/pmu.h
Change-Id: I4825dd50a5a69555da4cb6f0762f192c8df57885
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-08 12:11:45 +08:00
Tao Huang
a3a5aa0cf6 soc: rockchip: power-domain: add pm_domains.h
Change-Id: I889a7da10605e70af635e8b7fac26bf26fe6506f
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-08 12:11:45 +08:00
Randy Li
8373cf713d clk: rockchip: rk3036: export the sfc clocks
The serial Flash controller on the rk3036 would request
two clock nodes.

Change-Id: Iaa50c4a25602a68241b0b9b2f186e4c7e55bc3da
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2018-05-04 19:12:31 +08:00
Tony Xie
b66148ef0d PM / devfreq: rockchip_bus: support soc bus devfreq.
Change-Id: Iba750d4522b99e88c16c8e4a77d3367fbb2a0d82
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-05-03 19:53:43 +08:00
Sugar Zhang
f9cbc2829b ASoC: rockchip: add support for vad
This patch add support for rockchip voice activity detection.
The vad is used to detect the amplitude of voice which is
received by analog mic, i2s digital mic or pdm digital mic
when soc is in low power mode. if the amplitude of voice is
over threshold, the vad will assert interrupt to wake up soc,
then soc will exit low power mode.

Change-Id: Idb7a3adb87ec4c07274eefd82da4672d493c7627
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2018-04-28 21:00:38 +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
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
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
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
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
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
Sandy Huang
04e6e5c7a0 drm/rockchip: vop: add support dclk invert config
Since some special hardware or panel need to invert dclk,
so we add dclk invert config at dts display timing node:

dts sample:

display-timings {
    timing0: timing0 {
        ...
        pixelclk-active = <1>;
        ...
    }
}

Change-Id: I64f053ecda0f607bdd6fd392a0922489502ac274
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-04-19 18:39:34 +08:00
Finley Xiao
6882654464 regulator: core: Add support to limit min_uV during system startup
Now a regulator device can supply multiple consumers at the same time,
if a consumer starts and set a low voltage, another consumer doesn't
start in kernel but has been set a high frequency in bootloader will
abort.

This patch Adds support to limit min_uV during kernel startup to make
sure the voltage can suit the needs of all consumers.

Change-Id: Ibd16a8e44916798021e2470c90a8e3488df206f4
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-18 17:22:03 +08:00
Qiang Wu
623da8f83a wifi: add marvell 88W8977 wifi module driver
Change-Id: Ia1e254e2c084621141d837be385d9198962be1cd
Signed-off-by: Qiang Wu <xianlee.wu@rock-chips.com>
2018-04-17 18:54:27 +08:00
Joseph Chen
f36de44fad mfd: rk808: set fall event higher priority than rise event
When PMIC irq occurs, regmap-irq.c will traverse all PMIC child
interrupts from low index 0 to high index, we give fall interrupt
high priority to be called earlier than rise, so that it can be
override by late rise event. This can helps to solve key release
glitch which make a wrongly fall event immediately after rise.

Change-Id: Ieda1d6fd3c50cc36742a4740504ec7ce12ea509b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-04-17 11:36:29 +08:00
Ziyuan Xu
75e03927ee mmc: dw_mmc: add xfer timer for avoid DTO without actual data payload
It has proved the controller has a potention broken state with a DTO
interrupt comes while the data payload is missing, which was not covered
by current software state machine. Add a xfer timer to work around
this buggy behaviour introduced by broken design.

Change-Id: I5019c5ba0cdeb59adcdd3a5231a2000b448762bc
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
2018-04-11 16:51:53 +08:00
Tao Huang
0b3ed0efcd Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
* linux-linaro-lsk-v4.4-android: (395 commits)
  Linux 4.4.126
  net: systemport: Rewrite __bcm_sysport_tx_reclaim()
  net: fec: Fix unbalanced PM runtime calls
  ieee802154: 6lowpan: fix possible NULL deref in lowpan_device_event()
  s390/qeth: on channel error, reject further cmd requests
  s390/qeth: lock read device while queueing next buffer
  s390/qeth: when thread completes, wake up all waiters
  s390/qeth: free netdevice when removing a card
  team: Fix double free in error path
  skbuff: Fix not waking applications when errors are enqueued
  net: Only honor ifindex in IP_PKTINFO if non-0
  netlink: avoid a double skb free in genlmsg_mcast()
  net/iucv: Free memory obtained by kzalloc
  net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
  l2tp: do not accept arbitrary sockets
  ipv6: fix access to non-linear packet in ndisc_fill_redirect_hdr_option()
  dccp: check sk for closed state in dccp_sendmsg()
  net: Fix hlist corruptions in inet_evict_bucket()
  Revert "genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs"
  ...

Conflicts:
	include/linux/usb/quirks.h

Change-Id: I125065cef66846e4cdee799f4b34d07c309d353e
2018-04-08 18:28:30 +08:00
Finley Xiao
f1b24931de clk: rockchip: rk3308: Add clock id for i2s mux clk
Change-Id: Iddf2070da1e2128ca15954c1a14d52e856e7b40f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-08 11:11:34 +08:00
Mark Brown
a748c8be5a Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2018-04-05 18:31:12 +01:00
Mark Brown
2da9deac1e Merge tag 'v4.4.126' into linux-linaro-lsk-v4.4
This is the 4.4.126 stable release
2018-04-05 16:49:48 +01:00
Tony Xie
ed38d26a33 pinctrl: support pinctrl driver for the RK817&RK809 PMIC
Change-Id: I9a24ee0d9266a000d582f8ffff8b0c872e3a0769
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-04-03 20:09:59 +08:00
Finley Xiao
4186a0e423 clk: rockchip: Add supprot to limit input rate for fractional divider
From Rockchips fractional divider usage, some clocks can be generated
by fractional divider, but the input clock frequency of fractional
divider should be less than a specified value.

Change-Id: Ifd6c5f6a24a64021f990506e8657cd925f9b96f9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-02 17:01:54 +08:00
Toshi Kani
31895cfd79 mm/vmalloc: add interfaces to free unmapped page table
commit b6bdb7517c upstream.

On architectures with CONFIG_HAVE_ARCH_HUGE_VMAP set, ioremap() may
create pud/pmd mappings.  A kernel panic was observed on arm64 systems
with Cortex-A75 in the following steps as described by Hanjun Guo.

 1. ioremap a 4K size, valid page table will build,
 2. iounmap it, pte0 will set to 0;
 3. ioremap the same address with 2M size, pgd/pmd is unchanged,
    then set the a new value for pmd;
 4. pte0 is leaked;
 5. CPU may meet exception because the old pmd is still in TLB,
    which will lead to kernel panic.

This panic is not reproducible on x86.  INVLPG, called from iounmap,
purges all levels of entries associated with purged address on x86.  x86
still has memory leak.

The patch changes the ioremap path to free unmapped page table(s) since
doing so in the unmap path has the following issues:

 - The iounmap() path is shared with vunmap(). Since vmap() only
   supports pte mappings, making vunmap() to free a pte page is an
   overhead for regular vmap users as they do not need a pte page freed
   up.

 - Checking if all entries in a pte page are cleared in the unmap path
   is racy, and serializing this check is expensive.

 - The unmap path calls free_vmap_area_noflush() to do lazy TLB purges.
   Clearing a pud/pmd entry before the lazy TLB purges needs extra TLB
   purge.

Add two interfaces, pud_free_pmd_page() and pmd_free_pte_page(), which
clear a given pud/pmd entry and free up a page for the lower level
entries.

This patch implements their stub functions on x86 and arm64, which work
as workaround.

[akpm@linux-foundation.org: fix typo in pmd_free_pte_page() stub]
Link: http://lkml.kernel.org/r/20180314180155.19492-2-toshi.kani@hpe.com
Fixes: e61ce6ade4 ("mm: change ioremap to set up huge I/O mappings")
Reported-by: Lei Li <lious.lilei@hisilicon.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Wang Xuefeng <wxf.wang@hisilicon.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Chintan Pandya <cpandya@codeaurora.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ tweak arm64 portion to rely on CONFIG_ARCH_HAVE_HUGE_VMAP - gregkh]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 18:40:14 +02:00
Kirill Marinushkin
87eccc3cd1 ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit
commit a6618f4aed upstream.

Currently, the offsets in the UAC2 processing unit descriptor are
calculated incorrectly. It causes an issue when connecting the device which
provides such a feature:

~~~~
[84126.724420] usb 1-1.3.1: invalid Processing Unit descriptor (id 18)
~~~~

After this patch is applied, the UAC2 processing unit inits w/o this error.

Fixes: 23caaf19b1 ("ALSA: usb-mixer: Add support for Audio Class v2.0")
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 18:40:12 +02:00
Alex Shi
9526378222 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2018-03-26 02:32:06 +00:00
Alex Shi
c5833b9603 Merge tag 'v4.4.124' into linux-linaro-lsk-v4.4
This is the 4.4.124 stable release
2018-03-26 02:31:53 +00:00
Deepa Dinamani
de54723bc1 time: Change posix clocks ops interfaces to use timespec64
[ Upstream commit d340266e19 ]

struct timespec is not y2038 safe on 32 bit machines.

The posix clocks apis use struct timespec directly and through struct
itimerspec.

Replace the posix clock interfaces to use struct timespec64 and struct
itimerspec64 instead.  Also fix up their implementations accordingly.

Note that the clock_getres() interface has also been changed to use
timespec64 even though this particular interface is not affected by the
y2038 problem. This helps verification for internal kernel code for y2038
readiness by getting rid of time_t/ timeval/ timespec.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: arnd@arndb.de
Cc: y2038@lists.linaro.org
Cc: netdev@vger.kernel.org
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: john.stultz@linaro.org
Link: http://lkml.kernel.org/r/1490555058-4603-3-git-send-email-deepa.kernel@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24 10:58:40 +01:00
Finley Xiao
d5e8f70d5f clk: rockchip: rk3308: Add pclk_wdt
Change-Id: I1946b3550c11d6fde424c8493eaf925ff2dcfce4
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-23 20:39:26 +08:00
Alex Shi
9c032b533b Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2018-03-23 02:33:06 +00:00
Alex Shi
78c39820dc Merge tag 'v4.4.123' into linux-linaro-lsk-v4.4
This is the 4.4.123 stable release
2018-03-23 02:32:54 +00:00
Eric W. Biederman
c8c71406b7 fs: Teach path_connected to handle nfs filesystems with multiple roots.
commit 95dd77580c upstream.

On nfsv2 and nfsv3 the nfs server can export subsets of the same
filesystem and report the same filesystem identifier, so that the nfs
client can know they are the same filesystem.  The subsets can be from
disjoint directory trees.  The nfsv2 and nfsv3 filesystems provides no
way to find the common root of all directory trees exported form the
server with the same filesystem identifier.

The practical result is that in struct super s_root for nfs s_root is
not necessarily the root of the filesystem.  The nfs mount code sets
s_root to the root of the first subset of the nfs filesystem that the
kernel mounts.

This effects the dcache invalidation code in generic_shutdown_super
currently called shrunk_dcache_for_umount and that code for years
has gone through an additional list of dentries that might be dentry
trees that need to be freed to accomodate nfs.

When I wrote path_connected I did not realize nfs was so special, and
it's hueristic for avoiding calling is_subdir can fail.

The practical case where this fails is when there is a move of a
directory from the subtree exposed by one nfs mount to the subtree
exposed by another nfs mount.  This move can happen either locally or
remotely.  With the remote case requiring that the move directory be cached
before the move and that after the move someone walks the path
to where the move directory now exists and in so doing causes the
already cached directory to be moved in the dcache through the magic
of d_splice_alias.

If someone whose working directory is in the move directory or a
subdirectory and now starts calling .. from the initial mount of nfs
(where s_root == mnt_root), then path_connected as a heuristic will
not bother with the is_subdir check.  As s_root really is not the root
of the nfs filesystem this heuristic is wrong, and the path may
actually not be connected and path_connected can fail.

The is_subdir function might be cheap enough that we can call it
unconditionally.  Verifying that will take some benchmarking and
the result may not be the same on all kernels this fix needs
to be backported to.  So I am avoiding that for now.

Filesystems with snapshots such as nilfs and btrfs do something
similar.  But as the directory tree of the snapshots are disjoint
from one another and from the main directory tree rename won't move
things between them and this problem will not occur.

Cc: stable@vger.kernel.org
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Fixes: 397d425dc2 ("vfs: Test for and handle paths that are unreachable from their mnt_root")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 09:23:31 +01:00
Vincent Stehlé
23e4e7b49c regulator: isl9305: fix array size
[ Upstream commit 0c08aaf873 ]

ISL9305_MAX_REGULATOR is the last index used to access the init_data[]
array, so we need to add one to this last index to obtain the necessary
array size.

This fixes the following smatch error:

  drivers/regulator/isl9305.c:160 isl9305_i2c_probe() error: buffer overflow 'pdata->init_data' 3 <= 3

Fixes: dec38b5ce6 ("regulator: isl9305: Add Intersil ISL9305/H driver")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 09:23:25 +01:00
Kirill A. Shutemov
610c361866 mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative()
[ Upstream commit 591a3d7c09 ]

0day testing by Fengguang Wu triggered this crash while running Trinity:

  kernel BUG at include/linux/pagemap.h:151!
  ...
  CPU: 0 PID: 458 Comm: trinity-c0 Not tainted 4.11.0-rc2-00251-g2947ba0 #1
  ...
  Call Trace:
   __get_user_pages_fast()
   get_user_pages_fast()
   get_futex_key()
   futex_requeue()
   do_futex()
   SyS_futex()
   do_syscall_64()
   entry_SYSCALL64_slow_path()

It' VM_BUG_ON() due to false-negative in_atomic(). We call
page_cache_get_speculative() with disabled local interrupts.
It should be atomic enough.

So let's check for disabled interrupts in the VM_BUG_ON() condition
too, to resolve this.

( This got triggered by the conversion of the x86 GUP code to the
  generic GUP code. )

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: LKP <lkp@01.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170324114709.pcytvyb3d6ajux33@black.fi.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 09:23:22 +01:00