Commit Graph

843824 Commits

Author SHA1 Message Date
Simon Xue
c8410c0f81 iommu/rockchip: disable iommu by attaching NULL
Iommu framework introduce default_domain for automatic
attach which we were not interesting before, now rockchip
iommu driver following this way that make things different:

iommu_detach_device function is not able to disable iommu anymore.
It just do following things either:

1. Just return
   Like Vcodec/ISP who does not allocate new domain

2. Attach default_domain
   Like vop who allocate new domain by vop driver

We have no way to temporary disable iommu,to fix this issue, master
driver need to attach a NULL domain,also master driver need more step:

1. iommu_attach_device(NULL, dev) -> disable iommu
2. iommu_detach_device(NULL, dev) -> attach default_domain

Above two steps must comes in pairs.

Following order called by driver is not permitted:

1. iommu_attach_device(domain, dev)
2. iommu_attach_device(NULL, dev)
3. iommu_detach_device(NULL, dev)
4. iommu_detach_device(domain, dev)

Correct is:

1. iommu_attach_device(domain, dev)
2. iommu_detach_device(domain, dev)
3. iommu_attach_device(NULL, dev)
4. iommu_detach_device(NULL, dev)

Change-Id: I12b1e27e5119fb1abd05ccce57c9e941f03e9498
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-06-28 15:03:10 +08:00
Simon Xue
2819c94d56 iommu/rockchip: add deferred attach for vop
When jumping from uboot to kernel, vop may page fault, this due
to vop working parallel to kernel probe dts node by cpu.
Defer vop iommu attach function when iommu_ops->add_device called,
and hand the attach function to vop driver is a solution.

Change-Id: I84822ac7a3d0884f96df774a2363c22cbf0f074a
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-06-28 15:03:10 +08:00
Elon Zhang
d779266766 OP-TEE: build optee_linuxdriver into kernel
Change-Id: I0f19cd74c3d247dbdf94ba0a2d952728fbfae366
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 20:02:27 +08:00
Elon Zhang
dc2876e75b OP-TEE: change 'struct kref' member read function
Since the refcount_t 'atomic' type is used to implement 'struct kref',
refcount_read() is used to replace atomic_read().

Change-Id: I9fc7876cfd7ed8107551bc1909fa0305ab41d9fd
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 20:02:27 +08:00
Elon Zhang
1b75213d7f OP-TEE: fix IS_ERR_VALUE compilation error
Fix the compilation error below:
error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

Change-Id: Ib7cbc813c6eeeded220171ef5e4434ad798d06d9
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 19:54:39 +08:00
Jeffy Chen
9dd42792b1 rtc: Add an RTC driver for rk-timer
This driver uses Rockchip timer to simulate RTC functions.

Only contains Kconfig/Makefile modifies, the driver itself is already
added in other commit.

Change-Id: I49eed6ecbb4c55527696c63b0d479afe837502d5
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-06-27 19:13:27 +08:00
Simon Xue
52dffbede7 arm64: dts: rockchip: convert rk-keys to adc-keys/gpio-keys for rk3399 board
To convert saradc value to voltage, we have the following formula:

voltage = (raw saradc value * saradc voltage ref voltage) / 1024

Take RK3399 excavator as an example, the saradc voltage reg voltage is 1800000uv,
the formula can simplify to :

voltage = raw saradc value * 1750 uv

Change-Id: I8703bcdc2e2b0305118dd9f5777533e8fac7c5a1
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-06-27 19:06:13 +08:00
Zhen Chen
c4e657e5ac Mali: midgard: remove kbase_mem_phy_alloc::zone_cache and relative codes
Some relative codes,
such as 'zone_page_state_add(1, zone, NR_SLAB_RECLAIMABLE);',
caused compile errors, when compiled with clang.
The corresponding interface(NR_SLAB_RECLAIMABLE, et.) was changed
between kernel v4.4 and v4.19.

These codes were used to updates the cachelines with the statistics,
and are removed in Midgard DDK r22.
Here, I remove them too, in current Midgard DDK r18.

Change-Id: I3a7e789c0456f28eba623b20564ea8a97109051f
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-27 19:05:57 +08:00
Amit Kucheria
64622f9045 UPSTREAM: cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device
Use the CPUFREQ_IS_COOLING_DEV flag to allow cpufreq core to
automatically register as a thermal cooling device.

This allows removal of boiler plate code from the driver.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit e248d8d35c)

Conflicts:
	drivers/cpufreq/cpufreq-dt.c

Change-Id: I140c2d0f625faa685643206a3a7556fc54868f71
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-27 18:10:00 +08:00
Amit Kucheria
2b5738267d UPSTREAM: cpufreq: Auto-register the driver as a thermal cooling device if asked
All cpufreq drivers do similar things to register as a cooling device.
Provide a cpufreq driver flag so drivers can just ask the cpufreq core
to register the cooling device on their behalf. This allows us to get
rid of duplicated code in the drivers.

In order to allow this, we add a struct thermal_cooling_device pointer
to struct cpufreq_policy so that drivers don't need to store it in a
private data structure.

Suggested-by: Stephen Boyd <swboyd@chromium.org>
Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 5c238a8b59)

Conflicts:
	drivers/cpufreq/cpufreq.c

Change-Id: I18aad43fce69f5a20388078dd5d18877f09839ee
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-27 18:10:00 +08:00
Finley Xiao
f56e208d80 cpufreq: dt: Fix memory leak when cpu on/off
Fixes: e51ed31ccd ("cpufreq: dt: Add support to get static power")
Change-Id: I613a14a061490fb69e913b8c2cf6677757c73ced
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-27 18:10:00 +08:00
Finley Xiao
a8ff5cd6e1 soc: rockchip: ipa: Get leakage when ipa power model init
Change-Id: Ib0f7855c6faa54fa5ca28010d1c05da8ba478d7e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-27 18:10:00 +08:00
Elon Zhang
d9a4e54f9c OP-TEE: modify _tee_shm_dma_buf_ops to match new 'struct dma_buf_ops'
Change-Id: Ia52642af4da1928f19c9091e54d272073fa3edbf
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 17:16:58 +08:00
Elon Zhang
c4861219a6 OP-TEE: fix missing mutex unlock
Change-Id: I4b4ba136b94da4dbe8d1fa561dbd03f7addfb350
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 17:14:33 +08:00
Elon Zhang
78f9f87a9d OP-TEE: optimize client application running process
Client applications are forbidden to run before supplicant
application is ready. Detection of supplicant application
status is added at the entry of open operation.

Change-Id: Ief4106bcd75251790b82d76e4d69092900af29e3
Signed-off-by: Elon Zhang <zhangzj@rock-chips.com>
2019-06-27 17:14:33 +08:00
Zhang Zhijie
08e8e9538e OPTEE: do uart port config when driver probe
Some logs may appear before tee-supplicant start,
so uart port config should be done as early as possible.

Change-Id: I51bdb6a9d0f5160a6dc66ad015577a77df6897b4
Signed-off-by: Zhang Zhijie <zhangzj@rock-chips.com>
2019-06-27 17:14:33 +08:00
Zhang Zhijie
5d5542e8fe OPTEE: check psci state when driver init
Kernel is running in secure mode on some platforms(e.g. rk3128/rv1108),
which has no secure OS to support TEE service.

Change-Id: I275413230b2a8ec3864fc5a5ba043a155d724ced
Signed-off-by: Zhang Zhijie <zhangzj@rock-chips.com>
2019-06-27 17:14:33 +08:00
Simon Xue
9a7a78b838 arm64: rockchip_defconfig: enable gpio key
Enable KEYBOARD_GPIO and disable KEYBOARD_ROCKCHIP
which is not supported anymore.

Change-Id: I2a1a63d4acc96e04ce39373b810c92b07ed9ee92
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-06-26 18:20:14 +08:00
Frank Wang
b2e17e3ba8 phy: phy-rockchip-inno-usb2: add exception handling for wakelock
The "OTG wakelock" should be destroyed if otg port was initialized
failed, in case of its memory allocate for other module and the
"wakeup_sources" list would be broken.

Change-Id: Ic478e7297e36def8e105a0736beb86c99ca6261d
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-06-26 10:08:57 +08:00
Frank Wang
b3390d3b60 phy: phy-rockchip-inno-usb2: fix otg-id irq error
For the 'otg-mux' irq in SoC should include 'otg-bvalid', 'linestate',
and 'otg-id'. This change fix the previous error condition.

Change-Id: I8fe46c8c9efd6ce04eead89c276227d4cc70902e
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-06-26 10:08:45 +08:00
Zhixiong Lin
b5ae994fe7 GPU: Kconfig: add gpu Kconfig to video Kconfig
Change-Id: I9938fe0377fc57e030c9e5109c216d6c62dbeef0
Signed-off-by: Zhixiong Lin <zhixiong.lin@rock-chips.com>
2019-06-24 14:23:17 +08:00
Zhen Chen
ae48165fb6 Mali: midgard: fix compile errors when ARCH=arm under kernel v4.19
Change-Id: I59be58843da8f55e242d82f15533f8c8aa48eece
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-24 11:58:59 +08:00
Zhixiong Lin
d40d76adb5 Mali: utgard: fix compile errors when ARCH=arm under kernel v4.19
Change-Id: Iea66ada0c6aef9fffc270175cdeca1377827542d
Signed-off-by: Zhixiong Lin <zhixiong.lin@rock-chips.com>
2019-06-24 11:07:12 +08:00
Tao Huang
85f56e2278 input: touchscreen: gt9xx: avoid clang warning
drivers/input/touchscreen/gt9xx/gt9xx_update.c:2744:19: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
 while ((ready == 0)) //Wait for measurement complete
         ~~~~~~^~~~

Change-Id: I6954c7cd8867e1d85d435a23ee857cd4e3c58b4b
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-06-24 10:47:11 +08:00
Tao Huang
fd0e3eb0c2 Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common
* android-4.19: (3557 commits)
  ANDROID: kernel: cgroup: cpuset: Clear cpus_requested for empty buf
  ANDROID: kernel: cgroup: cpuset: Add missing allocation of cpus_requested in alloc_trial_cpuset
  Linux 4.19.53
  rtc: pcf8523: don't return invalid date when battery is low
  drm: add fallback override/firmware EDID modes workaround
  drm/edid: abstract override/firmware EDID retrieval
  x86/resctrl: Prevent NULL pointer dereference when local MBM is disabled
  x86/mm/KASLR: Compute the size of the vmemmap section properly
  x86/kasan: Fix boot with 5-level paging and KASAN
  x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback
  RAS/CEC: Fix binary search function
  RAS/CEC: Convert the timer callback to a workqueue
  timekeeping: Repair ktime_get_coarse*() granularity
  USB: serial: option: add Telit 0x1260 and 0x1261 compositions
  USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode
  USB: serial: pl2303: add Allied Telesis VT-Kit3
  USB: usb-storage: Add new ID to ums-realtek
  USB: Fix chipmunk-like voice when using Logitech C270 for recording audio.
  usb: dwc2: host: Fix wMaxPacketSize handling (fix webcam regression)
  usb: dwc2: Fix DMA cache alignment issues
  ...

Conflicts:
	arch/arm/boot/dts/rk3288.dtsi
	drivers/bluetooth/hci_ldisc.c
	drivers/clk/clk-fractional-divider.c
	drivers/clk/rockchip/clk-rk3288.c
	drivers/gpu/drm/rockchip/rockchip_drm_vop.c
	init/main.c
	kernel/sched/fair.c

Change-Id: I8bcf9aad06fe9648fc2621bac8475a47be1212fb
2019-06-22 22:26:14 +08:00
Sandy Huang
12f7c4d9b5 drm/rockchip driver: update drm driver version and add open/close function
userspace can use drmGetVersion() to identify linux 4.4 or 4.19 drm
driver.

Change-Id: I5a21f9bce198cb18a107496cb924a82a44ac6cb4
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 19:28:32 +08:00
Tao Huang
6a94856ae3 drivers: rk_nand: include seq_file.h for rk_nand_blk.c
Change-Id: I2736a432c071fae0ff47f7015a87c39a39e07095
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-06-21 19:04:44 +08:00
Sandy Huang
8aaf010974 drm/rockchip: vop: add vop_win_disable for win state control
Change-Id: Idd0ee2e61331f6d01e7528172a464cae92c1b001
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 18:40:34 +08:00
Tao Huang
a9c39f81ac ARM: rockchip_defconfig: enable CONFIG_DRM_IGNORE_IOTCL_PERMIT
Change-Id: I3209ea740f25df7e7bbbb35b87ab5c64c7278d81
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-06-21 14:52:25 +08:00
Sandy Huang
f712fa991a arm64: rockchip_defconfig: enable CONFIG_DRM_IGNORE_IOTCL_PERMIT
Change-Id: I65857a834c225ba0a5451c7e56ee6a3bce16ae3c
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 14:51:10 +08:00
Sandy Huang
f39337d357 drm/rockchip: driver: init rockchip fb devices
Change-Id: I947ad0766a6dac55967e480f658486ea489d4e92
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 14:48:44 +08:00
Sandy Huang
169ade6134 drm/rockchip: vop: add support ARM FBDC format
Change-Id: Ief12f40ba4424358d5889c23c9cb11b3da32ca77
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 14:48:44 +08:00
Matteo Franchin
915836f39a UPSTREAM: drm/fourcc: Add modifier defininitions for AFBC 1.3
This commit adds definitions of format modifiers for version 1.3 of the
Arm Framebuffer Compression (AFBC).

Change-Id: Icdb3eb09cc83c55c1d71f1d48ed3945698fbfa9a
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Link: https://patchwork.freedesktop.org/patch/277333/
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 2db8ebca1f)
2019-06-21 14:36:15 +08:00
Mark Yao
83fcb2b69a drm/rockchip: support using reserved memory region for cma
Change-Id: I829162c21748052525b0583185db67015f24141d
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 09:52:10 +08:00
Sandy Huang
e8a16ec23b drm/rockchip: driver: add to get dclk pll source
Change-Id: I8f5f48a51d5ffa70312c142511aebe498f8eb796
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-21 09:45:59 +08:00
Yifeng Zhao
35de189e19 drivers: rk_nand: enable rk nand flash support
Change-Id: I2ea7fe6218b32666b91fce54bc17f976feb7f4d2
Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
2019-06-20 15:02:52 +08:00
Randy Li
f077059630 Mali: midgard: fix the memory translation for aarch32
When the clients are 32 bits while the kernel is 64 bits,
we need to translate the memory address before accessing.

The previous commit was refreshed by ddk update.

Change-Id: I7f47ab94da258e9d170613252aae9b396623cf48
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2019-06-20 14:58:49 +08:00
Zhen Chen
da6f49f0dd Mali: midgard: fix Spectre v1 vulnerability
user_atom.atom_number can be indirectly controlled by user-space,
hence leading to a potential exploitation
of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/gpu/arm/midgard/mali_kbase_jd.c:1397 kbase_jd_submit() warn:
potential spectre issue 'jctx->atoms' [r]
katom = &jctx->atoms[user_atom.atom_number];

Fix this by sanitizing user_atom.atom_number
before 'katom = &jctx->atoms[user_atom.atom_number];'.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Fixes: 5cf27d0b60 ("Mali: midgard: changes to enlarge BASE_JD_ATOM_COUNT to 512, for defect 184210")
Change-Id: If52f30d29a80a06c6693ddadd5947ab9fe8fbc25
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:58:49 +08:00
Zhen Chen
b8fd2316f9 Mali: midgard: changes to enlarge BASE_JD_ATOM_COUNT to 512, for defect 184210
The source code of mali_so must be modified correspondingly.

Change-Id: I3f4bd03fa2d369d912e6bc05c53d2d3abefb92d3
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:58:49 +08:00
Algea Cao
8e1fda9f83 drm/rockchip: dw_hdmi: Compatible with two inno hdmi phy names
4.4 kernel inno hdmi phy name is "hdmi_phy".
4.19 kernel inno hdmi phy name is "hdmi".

Change-Id: Ie87aa205c89154b417887a84703ce7bd9ffb2c7f
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-06-20 14:54:34 +08:00
Hu Kejun
29cea96f07 arm64: dts: rockchip: rk3399-sapphire-excavator-edp: add module information for ov13850/ov4689
Change-Id: I850c379e375571f7ab5100b65843759496687362
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-06-20 14:53:51 +08:00
Hu Kejun
74c395ca97 arm64: dts: rockchip: rk3399-sapphire-excavator-edp: enable rkisp and ov13850
Change-Id: Id747ebc37b6e0ce71e3e84204c0f2acced4321d6
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-06-20 14:53:36 +08:00
Hu Kejun
600b243039 media: i2c: ov13850: synchronize with kernel4.4 and update to v01.01.01
Change-Id: I50716a51c39570e68b179fd1adceb5ebb0669520
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-06-20 14:40:03 +08:00
Zhen Chen
732afe7d96 Mali: bifrost: adjust source codes for kernel v4.19
Change-Id: I80aaaa2cd9b14607336b2db2dd5890a84f260561
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:15:33 +08:00
Zhen Chen
6230ae439e arm64: dts: rockchip: rk3399: modify gpu node for ARM Midgard driver
Change-Id: I46ff1b61787172a5b4ba5b378e00c6de4cfa7f8d
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:14:58 +08:00
Zhen Chen
89ad87fb8e Mali: midgard: adjust source codes for kernel v4.19
Parts of the modifications are borrowed from Mali Bifrost DDK r13.

Change-Id: I82c68041a3185063ae2d8a40a7a7c17feaab0733
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:14:49 +08:00
Sandy Huang
a109506620 drm/rocckhip: driver: add support dmc and use rockchip atomic_commit
Change-Id: I30f7937d23a8092fc01d6d0baacb949264c7af0b
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-20 12:01:26 +08:00
Sandy Huang
3145e8695c drm/rockchip: driver: add debug and bandwidth calc function
Change-Id: I6273b05f4a1943000494a54a785bdec43b35cfb3
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-20 12:01:26 +08:00
Sandy Huang
35c52e2194 drm/rockchip: driver: add support more property
Change-Id: If2cbc617d9346713efaf7dc4dd5c393e8605f91d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-20 12:01:26 +08:00
Sandy Huang
8166dc7eb5 arm64: dts: rk3399: update display for rk3399-sapphire-excavator-edp
Change-Id: I6a30a25ce0bd5ace9ea8df3e0d9c1c9d8268ddb0
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-20 12:01:26 +08:00