Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef6acf30ed | ||
|
|
f0d1521138 | ||
|
|
2719ef7193 | ||
|
|
7f0c797d94 | ||
|
|
f2895f47a2 | ||
|
|
bc3af3e4b4 | ||
|
|
25e521819e | ||
|
|
25654151d6 | ||
|
|
744306d6ff | ||
|
|
9d7f57b527 | ||
|
|
5173b3d130 | ||
|
|
a9a5ba42ca | ||
|
|
844c8e6fef | ||
|
|
0a08493994 | ||
|
|
92d05e0e82 | ||
|
|
117dd5f07f | ||
|
|
0973ea8130 | ||
|
|
7abbbbab22 | ||
|
|
32d4b18c1f | ||
|
|
8f8817cacd | ||
|
|
abdf83c17d | ||
|
|
69d1f39bc8 | ||
|
|
88dd3d31aa | ||
|
|
cb5343a6fa | ||
|
|
b403b7a73e | ||
|
|
8e56d8b8c8 | ||
|
|
c37a6d4c8c | ||
|
|
d677e2d5b2 | ||
|
|
2d44748080 | ||
|
|
b959d9c805 | ||
|
|
5e9ba3bb7a | ||
|
|
3d91ac2374 | ||
|
|
b0f95fcaec | ||
|
|
fffa24ed1e | ||
|
|
07bec45d8a | ||
|
|
5835b6a683 | ||
|
|
2d870984e2 | ||
|
|
e858c774d2 | ||
|
|
4aa07960d8 | ||
|
|
5fc32d2eb7 | ||
|
|
2be8aecfbd | ||
|
|
e0e87141c6 | ||
|
|
76553bf984 | ||
|
|
96e7e57fc4 | ||
|
|
26d427ef1d | ||
|
|
f7eb215016 | ||
|
|
8810b0409c | ||
|
|
5adc9d0080 | ||
|
|
59dba51f38 | ||
|
|
f711123582 | ||
|
|
3cbe6c9816 | ||
|
|
a5aaf01042 | ||
|
|
934b276a3c | ||
|
|
615daddbf6 | ||
|
|
9bc61e6318 |
50
Documentation/boards/nuc.md
Normal file
50
Documentation/boards/nuc.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Intel NUC
|
||||
|
||||
This board configuration supports the Intel NUC mini PCs and compatibles.
|
||||
Probably most recent computers will work.
|
||||
|
||||
Requirements:
|
||||
- x86-64 support
|
||||
- UEFI boot
|
||||
- SATA/AHCI storage
|
||||
- Supported NIC:
|
||||
- Intel Gigabit NIC (e1000, e1000e, igb)
|
||||
- Realtek Gigabit NIC (r8169)
|
||||
- Intel Wireless Wifi 802.11ac (iwlwifi, see below)
|
||||
|
||||
## Tested Hardware
|
||||
|
||||
| Device | Quirks |
|
||||
|--------|-----------|
|
||||
| Intel NUC5CPYH | |
|
||||
| Gigabyte GB-BPCE-3455 | needs 'nomodeset' in cmdline.txt if you want a console |
|
||||
|
||||
|
||||
## Wifi
|
||||
|
||||
The following cards are supported:
|
||||
|
||||
- Intel Wireless 3160
|
||||
- Intel Wireless 7260
|
||||
- Intel Wireless 7265
|
||||
- Intel Wireless-AC 3165
|
||||
- Intel Wireless-AC 3168
|
||||
- Intel Wireless-AC 8260
|
||||
- Intel Wireless-AC 8265
|
||||
- Intel Wireless-AC 9260
|
||||
- Intel Wireless-AC 9461
|
||||
- Intel Wireless-AC 9462
|
||||
- Intel Wireless-AC 9560
|
||||
|
||||
## Bluetooth
|
||||
|
||||
Bluetooth is untested.
|
||||
|
||||
## Installation
|
||||
|
||||
Currently there is no shiny installation method. Checklist:
|
||||
- Boot PC to live-environment using PXE or USB
|
||||
- Copy or download the hassos image into your live environment
|
||||
- zcat the image to local harddisk
|
||||
- Reboot
|
||||
|
||||
20
Documentation/boards/orangepi.md
Normal file
20
Documentation/boards/orangepi.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Raspberry PI
|
||||
|
||||
Supported Hardware:
|
||||
|
||||
| Device | Board |
|
||||
|--------|-----------|
|
||||
| Orange Pi Prime | opi-prime |
|
||||
|
||||
## Serial console
|
||||
|
||||
The serial port on the Orange Pi Prime is a 3 pin header located between the
|
||||
power and reset buttons. The pins are labelled away from the board edge. Flow
|
||||
control must be disabled in order to send data. The serial specs are 3.3V TTL,
|
||||
115200,8,n,1
|
||||
|
||||
## I2C
|
||||
|
||||
Add `dtparam=i2c0=on` to `cmdline.txt`
|
||||
|
||||
[config]: ../configuration.md#automatic
|
||||
@@ -9,14 +9,7 @@ We provide 3 different types of release builds:
|
||||
## Versioning
|
||||
|
||||
The format of version is *MAJOR.BUILD*. Everytime we create a new release with same userland, we bump the build number.
|
||||
The development use here own major number they will be bump for the stable version and the development version go to next major number.
|
||||
|
||||
```
|
||||
0.x = development
|
||||
1.x = stable
|
||||
2.x = development
|
||||
3.x = stable
|
||||
```
|
||||
The development number they will be bump for the stable release version and the development version go to next major number.
|
||||
|
||||
## Git branch/Tag
|
||||
|
||||
|
||||
@@ -47,18 +47,18 @@ Note that the current iteration of `enter.sh` will try to load the **overlayfs**
|
||||
|
||||
```
|
||||
root@somehashinhex:/build#
|
||||
root@somehashinhex:/build# cat scripts/build-all.sh
|
||||
root@somehashinhex:/build# make help
|
||||
[...]
|
||||
```
|
||||
|
||||
The _hassos_ developers provides another convenience script that will build hassos images for a (rather long!) list of targets - if you're not interested in building artifacts for all supported platforms, make sure to take a peek inside and monkeypatch away... After you're done making changes, start it, and go make a cup of tea. Or fifteen.
|
||||
The _hassos_ developers provide a Makefile that will build hassos images for a (rather long!) list of targets. For example run the command below to start building the _ova_ variant, and go make a cup of tea. Or fifteen.
|
||||
|
||||
```
|
||||
root@0db6f7079872:/build# scripts/build-all.sh
|
||||
root@0db6f7079872:/build# make ova
|
||||
[...]
|
||||
```
|
||||
|
||||
Personally, I removed all advertised build targets from the `all_platforms` array variable, expect for the _ova_ variant. That will result in a single VMDK image file at the very end of the build process. This image file is a compressed block device dump with a proper GPT partition table, prepared to ship into any OVA-compatible hypervisor's innards. For me, the end of the **ova** build steps looks like this:
|
||||
That will result in a single VMDK image file at the very end of the build process. This image file is a compressed block device dump with a proper GPT partition table, prepared to ship into any OVA-compatible hypervisor's innards. For me, the end of the **ova** build steps looks like this:
|
||||
|
||||
```
|
||||
[...]
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
| Board | Version |
|
||||
|-------|---------|
|
||||
| Open Virtual Applicance | 4.14.82 |
|
||||
| Raspberry Pi | 4.14.81 |
|
||||
| Tinker Board | 4.14.82 |
|
||||
| Odroid-C2 | 4.18.20 |
|
||||
| Open Virtual Applicance | 4.19.20 |
|
||||
| Raspberry Pi | 4.14.98 |
|
||||
| Tinker Board | 4.19.20 |
|
||||
| Odroid-C2 | 4.19.15 |
|
||||
| Odroid-XU4 | 4.19.15 |
|
||||
| Orangepi-Prime | 4.19.13 |
|
||||
| Intel NUC | 4.14.82 |
|
||||
|
||||
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
RELEASE_DIR = /build/release
|
||||
|
||||
BUILDROOT=/build/buildroot
|
||||
BUILDROOT_EXTERNAL=/build/buildroot-external
|
||||
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs
|
||||
|
||||
TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||
|
||||
.NOTPARALLEL: $(TARGETS) $(TARGETS_CONFIG) all
|
||||
|
||||
.PHONY: $(TARGETS) $(TARGETS_CONFIG) all clean help
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(RELEASE_DIR):
|
||||
mkdir -p $(RELEASE_DIR)
|
||||
|
||||
$(TARGETS_CONFIG): %-config:
|
||||
@echo "config $*"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig"
|
||||
|
||||
$(TARGETS): %: $(RELEASE_DIR) %-config
|
||||
@echo "build $@"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
|
||||
cp -f $(BUILDROOT)/output/images/hassos_* $(RELEASE_DIR)/
|
||||
|
||||
# Do not clean when building for one target
|
||||
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
|
||||
@echo "clean $@"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
|
||||
endif
|
||||
@echo "finished $@"
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
|
||||
|
||||
help:
|
||||
@echo "Supported targets: $(TARGETS)"
|
||||
@echo "Run 'make <target>' to build a target image."
|
||||
@echo "Run 'make all' to build all target images."
|
||||
@echo "Run 'make clean' to clean the build output."
|
||||
@echo "Run 'make <target>-config' to configure buildroot for a target."
|
||||
@@ -3,12 +3,11 @@ Hass.io OS based on [buildroot](https://buildroot.org/). It's a hypervisor for D
|
||||
|
||||
## Focus
|
||||
|
||||
- Linux kernel 4.14 (LT)
|
||||
- Barebox as bootloader on EFI
|
||||
- U-Boot as bootloader on IoT
|
||||
- RAUC for OTA updates
|
||||
- SquashFS LZ4 as filesystem
|
||||
- Docker 18.03.1
|
||||
- Docker 18.09.0
|
||||
- AppArmor protected
|
||||
- ZRAM LZ4 for /tmp, /var, swap
|
||||
- Run every supervisor
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
||||
From ee7f0a678fff8316ec0be973f1b3780a63f50942 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Mon, 11 Dec 2017 21:04:56 +0100
|
||||
Subject: [PATCH] gpu: arm: Midgard: setup_timer() -> timer_setup()
|
||||
|
||||
This patch is due the changes provoked by series of commit ending
|
||||
at 513ae785c63c30741e46f43960213d4ae5382ec0, and removing the
|
||||
setup_timer macros.
|
||||
The previous patches replaced made sure that timers were all set
|
||||
up with setup_timer and replaced setup_timer calls by timer_setup
|
||||
calls.
|
||||
|
||||
This changed was introduced in the 4.15-rc1.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/arm/midgard/mali_kbase.h | 2 +-
|
||||
drivers/gpu/arm/midgard/mali_kbase_context.c | 4 ++--
|
||||
drivers/gpu/arm/midgard/mali_kbase_softjobs.c | 4 ++--
|
||||
drivers/gpu/arm/midgard/mali_kbase_tlstream.c | 6 ++----
|
||||
4 files changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase.h b/drivers/gpu/arm/midgard/mali_kbase.h
|
||||
index a4ceab9e0..27bde3b71 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase.h
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase.h
|
||||
@@ -213,7 +213,7 @@ int kbase_soft_event_update(struct kbase_context *kctx,
|
||||
|
||||
bool kbase_replay_process(struct kbase_jd_atom *katom);
|
||||
|
||||
-void kbasep_soft_job_timeout_worker(unsigned long data);
|
||||
+void kbasep_soft_job_timeout_worker(struct timer_list *t);
|
||||
void kbasep_complete_triggered_soft_events(struct kbase_context *kctx, u64 evt);
|
||||
|
||||
/* api used internally for register access. Contains validation and tracing */
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase_context.c b/drivers/gpu/arm/midgard/mali_kbase_context.c
|
||||
index f43db48fd..589df768c 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase_context.c
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase_context.c
|
||||
@@ -165,9 +165,9 @@ kbase_create_context(struct kbase_device *kbdev, bool is_compat)
|
||||
|
||||
mutex_init(&kctx->vinstr_cli_lock);
|
||||
|
||||
- setup_timer(&kctx->soft_job_timeout,
|
||||
+ timer_setup(&kctx->soft_job_timeout,
|
||||
kbasep_soft_job_timeout_worker,
|
||||
- (uintptr_t)kctx);
|
||||
+ 0);
|
||||
|
||||
return kctx;
|
||||
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase_softjobs.c b/drivers/gpu/arm/midgard/mali_kbase_softjobs.c
|
||||
index 127ada07f..019edf562 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase_softjobs.c
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase_softjobs.c
|
||||
@@ -370,9 +370,9 @@ static void kbase_fence_debug_timeout(struct kbase_jd_atom *katom)
|
||||
}
|
||||
#endif /* CONFIG_MALI_FENCE_DEBUG */
|
||||
|
||||
-void kbasep_soft_job_timeout_worker(unsigned long data)
|
||||
+void kbasep_soft_job_timeout_worker(struct timer_list *t)
|
||||
{
|
||||
- struct kbase_context *kctx = (struct kbase_context *)data;
|
||||
+ struct kbase_context *kctx = from_timer(kctx, t, soft_job_timeout);
|
||||
u32 timeout_ms = (u32)atomic_read(
|
||||
&kctx->kbdev->js_data.soft_job_timeout_ms);
|
||||
struct timer_list *timer = &kctx->soft_job_timeout;
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase_tlstream.c b/drivers/gpu/arm/midgard/mali_kbase_tlstream.c
|
||||
index d01aa23b2..11d8b59c7 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase_tlstream.c
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase_tlstream.c
|
||||
@@ -1042,13 +1042,11 @@ static void kbasep_tlstream_flush_stream(enum tl_stream_type stype)
|
||||
* Timer is executed periodically to check if any of the stream contains
|
||||
* buffer ready to be submitted to user space.
|
||||
*/
|
||||
-static void kbasep_tlstream_autoflush_timer_callback(unsigned long data)
|
||||
+static void kbasep_tlstream_autoflush_timer_callback(struct timer_list *unused)
|
||||
{
|
||||
enum tl_stream_type stype;
|
||||
int rcode;
|
||||
|
||||
- CSTD_UNUSED(data);
|
||||
-
|
||||
for (stype = 0; stype < TL_STREAM_TYPE_COUNT; stype++) {
|
||||
struct tl_stream *stream = tl_stream[stype];
|
||||
unsigned long flags;
|
||||
@@ -1371,7 +1369,7 @@ int kbase_tlstream_init(void)
|
||||
|
||||
/* Initialize autoflush timer. */
|
||||
atomic_set(&autoflush_timer_active, 0);
|
||||
- setup_timer(&autoflush_timer,
|
||||
+ timer_setup(&autoflush_timer,
|
||||
kbasep_tlstream_autoflush_timer_callback,
|
||||
0);
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 44a5ba2e969adfb64c84f294c16490194988dcc7 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Sun, 24 Dec 2017 19:30:12 +0100
|
||||
Subject: [PATCH] drivers: gpu: Arm: Midgard: Replace ACCESS_ONCE by READ_ONCE
|
||||
|
||||
The ACCESS_ONCE macro has now been removed in the 4.15.0-rc4,
|
||||
and every ACCESS_ONCE call has been replaced by either READ_ONCE or
|
||||
WRITE_ONCE calls.
|
||||
Since the Midgard GPU drivers are not mainlined, the change
|
||||
needs to be applied manually.
|
||||
|
||||
See commit b899a850431e2dd0943205a63a68573f3e312d0d and its parents,
|
||||
for more informations.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/arm/midgard/mali_kbase_mem.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase_mem.h b/drivers/gpu/arm/midgard/mali_kbase_mem.h
|
||||
index e9a8d5dd6..eac685699 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase_mem.h
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase_mem.h
|
||||
@@ -591,7 +591,7 @@ void kbase_mem_pool_free_pages(struct kbase_mem_pool *pool, size_t nr_pages,
|
||||
*/
|
||||
static inline size_t kbase_mem_pool_size(struct kbase_mem_pool *pool)
|
||||
{
|
||||
- return ACCESS_ONCE(pool->cur_size);
|
||||
+ return READ_ONCE(pool->cur_size);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 47e8aad9419ff8843a373c3e5aa2c9d261d8cd07 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Mon, 23 Apr 2018 20:54:13 +0200
|
||||
Subject: [PATCH] gpu: arm: midgard: Remove sys_close references
|
||||
|
||||
sys_close is now replaced by ksys_close in an effort to remove
|
||||
in-kernel system calls references.
|
||||
|
||||
See 2ca2a09d6215fd9621aa3e2db7cc9428a61f2911 and
|
||||
https://lkml.org/lkml/2018/3/25/93 for more details.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/arm/midgard/mali_kbase_sync.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/gpu/arm/midgard/mali_kbase_sync.h b/drivers/gpu/arm/midgard/mali_kbase_sync.h
|
||||
index de72147d..33b58059 100644
|
||||
--- a/drivers/gpu/arm/midgard/mali_kbase_sync.h
|
||||
+++ b/drivers/gpu/arm/midgard/mali_kbase_sync.h
|
||||
@@ -156,7 +156,7 @@ void kbase_sync_fence_out_remove(struct kbase_jd_atom *katom);
|
||||
*/
|
||||
static inline void kbase_sync_fence_close_fd(int fd)
|
||||
{
|
||||
- sys_close(fd);
|
||||
+ ksys_close(fd);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
From 9bf91a052d8ceddfd5808547a51e167fb7463754 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Wed, 18 Jul 2018 19:59:21 +0200
|
||||
Subject: [PATCH] GPU: Mali: Midgard: remove rcu_read_lock references
|
||||
|
||||
This patch is actually based on @mihailescu2m patch.
|
||||
This removes references to rcu_read_lock when acquiring the OPP table,
|
||||
as it is useless since.
|
||||
See :
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/base/power/opp/core.c?id=5b650b388844f26c61c70564865598836d05dcb3
|
||||
|
||||
The current rcu_read_lock actually generates some issues with recent
|
||||
kernels.
|
||||
See here :
|
||||
https://community.arm.com/graphics/f/discussions/9207/midgard-r20p0-kernel-drivers-errors
|
||||
|
||||
The patch has been recreated since it does not apply directly on r19p0
|
||||
sources (I guess the affected line numbers slightly differ...).
|
||||
|
||||
@mihailescu2m patch for the Mali Midgard r20p0 kernel driver can be
|
||||
acquired here :
|
||||
https://github.com/mihailescu2m/linux/commit/bbe73c3c1143e5991bdcaee3afaecf5c31af0647
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
|
||||
index e280322e..bf69d897 100644
|
||||
--- a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
|
||||
+++ b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
|
||||
@@ -87,10 +87,9 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
|
||||
|
||||
freq = *target_freq;
|
||||
|
||||
- rcu_read_lock();
|
||||
opp = devfreq_recommended_opp(dev, &freq, flags);
|
||||
voltage = dev_pm_opp_get_voltage(opp);
|
||||
- rcu_read_unlock();
|
||||
+
|
||||
if (IS_ERR_OR_NULL(opp)) {
|
||||
dev_err(dev, "Failed to get opp (%ld)\n", PTR_ERR(opp));
|
||||
return PTR_ERR(opp);
|
||||
@@ -186,20 +185,17 @@ static int kbase_devfreq_init_freq_table(struct kbase_device *kbdev,
|
||||
unsigned long freq;
|
||||
struct dev_pm_opp *opp;
|
||||
|
||||
- rcu_read_lock();
|
||||
count = dev_pm_opp_get_opp_count(kbdev->dev);
|
||||
if (count < 0) {
|
||||
rcu_read_unlock();
|
||||
return count;
|
||||
}
|
||||
- rcu_read_unlock();
|
||||
|
||||
dp->freq_table = kmalloc_array(count, sizeof(dp->freq_table[0]),
|
||||
GFP_KERNEL);
|
||||
if (!dp->freq_table)
|
||||
return -ENOMEM;
|
||||
|
||||
- rcu_read_lock();
|
||||
for (i = 0, freq = ULONG_MAX; i < count; i++, freq--) {
|
||||
opp = dev_pm_opp_find_freq_floor(kbdev->dev, &freq);
|
||||
if (IS_ERR(opp))
|
||||
@@ -207,7 +203,6 @@ static int kbase_devfreq_init_freq_table(struct kbase_device *kbdev,
|
||||
|
||||
dp->freq_table[i] = freq;
|
||||
}
|
||||
- rcu_read_unlock();
|
||||
|
||||
if (count != i)
|
||||
dev_warn(kbdev->dev, "Unable to enumerate all OPPs (%d!=%d\n",
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
Patches act8846 regulator providing the proper reset handle and exploit
|
||||
the SIPC bit in GLB_POWER_OFF register. Mainly used to reset some rockchip
|
||||
boards.
|
||||
|
||||
Origin: <https://patchwork.kernel.org/patch/6409521/>
|
||||
|
||||
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
|
||||
index 2ff73d7..836d10b 100644
|
||||
--- a/drivers/regulator/act8865-regulator.c
|
||||
+++ b/drivers/regulator/act8865-regulator.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/regmap.h>
|
||||
+#include <linux/reboot.h>
|
||||
|
||||
/*
|
||||
* ACT8600 Global Register Map.
|
||||
@@ -133,6 +134,8 @@
|
||||
#define ACT8865_VOLTAGE_NUM 64
|
||||
#define ACT8600_SUDCDC_VOLTAGE_NUM 255
|
||||
|
||||
+#define ACT8846_SIPC_MASK 0x01
|
||||
+
|
||||
struct act8865 {
|
||||
struct regmap *regmap;
|
||||
int off_reg;
|
||||
@@ -402,6 +405,22 @@ static void act8865_power_off(void)
|
||||
while (1);
|
||||
}
|
||||
|
||||
+static int act8846_power_cycle(struct notifier_block *this,
|
||||
+ unsigned long code, void *unused)
|
||||
+{
|
||||
+ struct act8865 *act8846;
|
||||
+
|
||||
+ act8846 = i2c_get_clientdata(act8865_i2c_client);
|
||||
+ regmap_write(act8846->regmap, ACT8846_GLB_OFF_CTRL, ACT8846_SIPC_MASK);
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block act8846_restart_handler = {
|
||||
+ .notifier_call = act8846_power_cycle,
|
||||
+ .priority = 129,
|
||||
+};
|
||||
+
|
||||
static int act8865_pmic_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *i2c_id)
|
||||
{
|
||||
@@ -484,6 +503,8 @@ static int act8865_pmic_probe(struct i2c_client *client,
|
||||
}
|
||||
|
||||
if (of_device_is_system_power_controller(dev->of_node)) {
|
||||
+ int ret;
|
||||
+
|
||||
if (!pm_power_off && (off_reg > 0)) {
|
||||
act8865_i2c_client = client;
|
||||
act8865->off_reg = off_reg;
|
||||
@@ -492,6 +513,14 @@ static int act8865_pmic_probe(struct i2c_client *client,
|
||||
} else {
|
||||
dev_err(dev, "Failed to set poweroff capability, already defined\n");
|
||||
}
|
||||
+
|
||||
+ if (type == ACT8846) {
|
||||
+ act8865_i2c_client = client;
|
||||
+ ret = register_restart_handler(&act8846_restart_handler);
|
||||
+ if (ret)
|
||||
+ pr_err("%s: cannot register restart handler, %d\n",
|
||||
+ __func__, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Finally register devices */
|
||||
@@ -1,65 +0,0 @@
|
||||
From 7de25b73e152830587740d8f2ffaad94c72d90ac Mon Sep 17 00:00:00 2001
|
||||
From: Myy <myy@miouyouyou.fr>
|
||||
Date: Mon, 17 Jul 2017 11:24:47 +0000
|
||||
Subject: [PATCH 1/5] Integrating the Mali drivers
|
||||
|
||||
Changses required in order to select and compile the previously copied
|
||||
Mali Midgard drivers.
|
||||
|
||||
Signed-off-by: Myy <myy@miouyouyou.fr>
|
||||
|
||||
---
|
||||
drivers/base/Kconfig | 2 ++
|
||||
drivers/base/Makefile | 1 +
|
||||
drivers/gpu/Makefile | 2 +-
|
||||
drivers/video/Kconfig | 1 +
|
||||
4 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
|
||||
index f046d21..b0982fc 100644
|
||||
--- a/drivers/base/Kconfig
|
||||
+++ b/drivers/base/Kconfig
|
||||
@@ -348,3 +348,5 @@ config GENERIC_ARCH_TOPOLOGY
|
||||
runtime.
|
||||
|
||||
endmenu
|
||||
+
|
||||
+source "drivers/base/ump/Kconfig"
|
||||
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
|
||||
index 397e5c3..251e0cf 100644
|
||||
--- a/drivers/base/Makefile
|
||||
+++ b/drivers/base/Makefile
|
||||
@@ -24,6 +24,7 @@ obj-$(CONFIG_PINCTRL) += pinctrl.o
|
||||
obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o
|
||||
obj-$(CONFIG_GENERIC_MSI_IRQ_DOMAIN) += platform-msi.o
|
||||
obj-$(CONFIG_GENERIC_ARCH_TOPOLOGY) += arch_topology.o
|
||||
+obj-$(CONFIG_UMP) += ump/
|
||||
|
||||
obj-y += test/
|
||||
|
||||
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
|
||||
index e9ed439..66386b4 100644
|
||||
--- a/drivers/gpu/Makefile
|
||||
+++ b/drivers/gpu/Makefile
|
||||
@@ -2,5 +2,5 @@
|
||||
# taken to initialize them in the correct order. Link order is the only way
|
||||
# to ensure this currently.
|
||||
obj-$(CONFIG_TEGRA_HOST1X) += host1x/
|
||||
-obj-y += drm/ vga/
|
||||
+obj-y += drm/ vga/ arm/
|
||||
obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/
|
||||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
|
||||
index 3c20af9..041e15f 100644
|
||||
--- a/drivers/video/Kconfig
|
||||
+++ b/drivers/video/Kconfig
|
||||
@@ -17,6 +17,7 @@ source "drivers/gpu/vga/Kconfig"
|
||||
|
||||
source "drivers/gpu/host1x/Kconfig"
|
||||
source "drivers/gpu/ipu-v3/Kconfig"
|
||||
+source "drivers/gpu/arm/midgard/Kconfig"
|
||||
|
||||
source "drivers/gpu/drm/Kconfig"
|
||||
|
||||
--
|
||||
2.10.2
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From fe85565d9ed8212cbda2148d4731418a36a8d088 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Mon, 11 Dec 2017 21:53:28 +0100
|
||||
Subject: [PATCH 1/3] drivers: Integrating Mali Midgard video and gpu drivers.
|
||||
|
||||
I'm dropping the UMP drivers. They are not maintained.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/Makefile | 2 +-
|
||||
drivers/video/Kconfig | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
|
||||
index e9ed439a5..66386b42a 100644
|
||||
--- a/drivers/gpu/Makefile
|
||||
+++ b/drivers/gpu/Makefile
|
||||
@@ -2,5 +2,5 @@
|
||||
# taken to initialize them in the correct order. Link order is the only way
|
||||
# to ensure this currently.
|
||||
obj-$(CONFIG_TEGRA_HOST1X) += host1x/
|
||||
-obj-y += drm/ vga/
|
||||
+obj-y += drm/ vga/ arm/
|
||||
obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/
|
||||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
|
||||
index 3c20af999..041e15f2c 100644
|
||||
--- a/drivers/video/Kconfig
|
||||
+++ b/drivers/video/Kconfig
|
||||
@@ -17,6 +17,7 @@ source "drivers/gpu/vga/Kconfig"
|
||||
|
||||
source "drivers/gpu/host1x/Kconfig"
|
||||
source "drivers/gpu/ipu-v3/Kconfig"
|
||||
+source "drivers/gpu/arm/midgard/Kconfig"
|
||||
|
||||
source "drivers/gpu/drm/Kconfig"
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
From 1aeeeeaf10ad5888c1a5b3ab9b780be91c7dada9 Mon Sep 17 00:00:00 2001
|
||||
From: Myy <myy@miouyouyou.fr>
|
||||
Date: Mon, 24 Jul 2017 23:09:31 +0000
|
||||
Subject: [PATCH] Last try for the reboot hack
|
||||
From bf9b932f6ae506baf5b79c8407089448ed77fc56 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Sun, 17 Dec 2017 16:15:03 +0100
|
||||
Subject: [PATCH] ASUS Tinkerboard: Stupid reboot patch
|
||||
|
||||
If this one does not work, get a refund for your CantRebootBoard.
|
||||
This patch is ugly as shit and will be reworked when possible.
|
||||
|
||||
Signed-off-by: Myy <myy@miouyouyou.fr>
|
||||
Meanwhile, this fixes an issue with the ASUS Tinkerboard which
|
||||
cannot reboot correctly. The issue is that the MMC hardware is
|
||||
shutdown during the reboot phase and is not powered again after
|
||||
the power cycle, leading to a dead board awaiting a hard power
|
||||
cycle.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/mmc/host/dw_mmc-rockchip.c | 24 ++++++++++++++++++++++++
|
||||
drivers/mmc/host/dw_mmc.c | 26 ++++++++++++++++++++++++++
|
||||
include/linux/reboot.h | 3 +++
|
||||
drivers/mmc/host/dw_mmc.c | 28 ++++++++++++++++++++++++++++
|
||||
include/linux/reboot.h | 2 ++
|
||||
kernel/reboot.c | 1 +
|
||||
4 files changed, 54 insertions(+)
|
||||
4 files changed, 55 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
index aaed6f9b..71131020 100644
|
||||
index a3f1c2b30..52c13733f 100644
|
||||
--- a/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
@@ -14,10 +14,12 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/mmc/slot-gpio.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
+#include <linux/regulator/consumer.h> // Hack
|
||||
+#include <linux/regulator/consumer.h> // Stupid Tinkerboard Hack
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "dw_mmc.h"
|
||||
#include "dw_mmc-pltfm.h"
|
||||
+#include "../core/core.h" // Hack
|
||||
+#include "../core/core.h" // Stupid Tinkerboard Hack
|
||||
|
||||
#define RK3288_CLKGEN_DIV 2
|
||||
|
||||
@@ -34,6 +40,7 @@ index aaed6f9b..71131020 100644
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Stupid Tinkerboard Hack */
|
||||
+static void dw_mci_rockchip_platfm_shutdown(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct dw_mci *host = platform_get_drvdata(pdev);
|
||||
@@ -53,7 +60,6 @@ index aaed6f9b..71131020 100644
|
||||
+ regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int dw_mci_rockchip_remove(struct platform_device *pdev)
|
||||
{
|
||||
@@ -62,29 +68,30 @@ index aaed6f9b..71131020 100644
|
||||
static struct platform_driver dw_mci_rockchip_pltfm_driver = {
|
||||
.probe = dw_mci_rockchip_probe,
|
||||
.remove = dw_mci_rockchip_remove,
|
||||
+ .shutdown = dw_mci_rockchip_platfm_shutdown,
|
||||
+ .shutdown = dw_mci_rockchip_platfm_shutdown, // Stupid Tinkerboard Hack
|
||||
.driver = {
|
||||
.name = "dwmmc_rockchip",
|
||||
.of_match_table = dw_mci_rockchip_match,
|
||||
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
|
||||
index a9dfb269..ee956a57 100644
|
||||
index 0aa39975f..70f7ce21b 100644
|
||||
--- a/drivers/mmc/host/dw_mmc.c
|
||||
+++ b/drivers/mmc/host/dw_mmc.c
|
||||
@@ -39,8 +39,10 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/mmc/slot-gpio.h>
|
||||
+#include <linux/reboot.h> // Hack
|
||||
+#include <linux/reboot.h> // Stupid Tinkerboard Hack
|
||||
|
||||
#include "dw_mmc.h"
|
||||
+#include "../core/core.h" // Hack
|
||||
+#include "../core/core.h" // Stupid Tinkerboard Hack
|
||||
|
||||
/* Common flag combinations */
|
||||
#define DW_MCI_DATA_ERROR_FLAGS (SDMMC_INT_DRTO | SDMMC_INT_DCRC | \
|
||||
@@ -2687,6 +2689,28 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
|
||||
@@ -2778,6 +2780,29 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
+/* Stupid Tinkerboard Hack */
|
||||
+struct dw_mci *mSdhost;
|
||||
+void setmmcEmergency() {
|
||||
+ struct mmc_host *mmc;
|
||||
@@ -110,47 +117,41 @@ index a9dfb269..ee956a57 100644
|
||||
static int dw_mci_init_slot(struct dw_mci *host)
|
||||
{
|
||||
struct mmc_host *mmc;
|
||||
@@ -2718,6 +2742,8 @@ static int dw_mci_init_slot(struct dw_mci *host)
|
||||
@@ -2809,6 +2834,9 @@ static int dw_mci_init_slot(struct dw_mci *host)
|
||||
mmc->f_max = freq[1];
|
||||
}
|
||||
|
||||
+ /* Stupid Tinkerboard Hack */
|
||||
+ if (of_find_property(host->dev->of_node, "supports-sd", NULL))
|
||||
+ mSdhost = host;
|
||||
/*if there are external regulators, get them*/
|
||||
ret = mmc_regulator_get_supply(mmc);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
if (ret)
|
||||
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
|
||||
index a7ff409f..586e4504 100644
|
||||
index e63799a6e..057d3ce0c 100644
|
||||
--- a/include/linux/reboot.h
|
||||
+++ b/include/linux/reboot.h
|
||||
@@ -72,12 +72,15 @@ extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
|
||||
@@ -77,6 +77,8 @@ extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
|
||||
|
||||
extern void orderly_poweroff(bool force);
|
||||
extern void orderly_reboot(void);
|
||||
+// Wonderful ASUS hack
|
||||
+/* Stupid Tinkerboard Hack */
|
||||
+extern void setmmcEmergency(void);
|
||||
|
||||
/*
|
||||
* Emergency restart, callable from an interrupt handler.
|
||||
*/
|
||||
|
||||
extern void emergency_restart(void);
|
||||
+
|
||||
#include <asm/emergency-restart.h>
|
||||
|
||||
#endif /* _LINUX_REBOOT_H */
|
||||
diff --git a/kernel/reboot.c b/kernel/reboot.c
|
||||
index bd30a973..9f99488f 100644
|
||||
index e4ced883d..c8e678ce6 100644
|
||||
--- a/kernel/reboot.c
|
||||
+++ b/kernel/reboot.c
|
||||
@@ -61,6 +61,7 @@ void (*pm_power_off_prepare)(void);
|
||||
void emergency_restart(void)
|
||||
{
|
||||
kmsg_dump(KMSG_DUMP_EMERG);
|
||||
+ setmmcEmergency();
|
||||
+ setmmcEmergency(); // Stupid Tinkerboard Hack
|
||||
machine_emergency_restart();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(emergency_restart);
|
||||
--
|
||||
2.13.0
|
||||
2.14.1
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
From 302cd9b8a9f1f8a7735fabea3b9a7645dc40f9cc Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Sun, 7 Jan 2018 01:52:44 +0100
|
||||
Subject: [PATCH] drivers: mmc: dw-mci-rockchip: Handle ASUS Tinkerboard reboot
|
||||
|
||||
On ASUS Tinkerboard systems, if the SDMMC hardware is shutdown before
|
||||
rebooting, the system will be dead, as the SDMMC is the only way to
|
||||
boot anything, and the hardware doesn't power up the SDMMC hardware
|
||||
automatically when rebooting.
|
||||
|
||||
So, when using an ASUS Tinkerboard system, a new reboot handler is
|
||||
installed. This reboot handler takes care of powering the SDMMC
|
||||
hardware again before restarting the system, resolving the issue.
|
||||
|
||||
The code was inspired by the pwrseq_emmc.c, which seems to overcome
|
||||
similar effects with eMMC hardware.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/mmc/host/dw_mmc-rockchip.c | 66 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 66 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
index a3f1c2b30..7eac1f221 100644
|
||||
--- a/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
@@ -16,6 +16,11 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
+#include <linux/regulator/consumer.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include "../core/core.h"
|
||||
+
|
||||
#include "dw_mmc.h"
|
||||
#include "dw_mmc-pltfm.h"
|
||||
|
||||
@@ -334,6 +339,66 @@ static const struct of_device_id dw_mci_rockchip_match[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, dw_mci_rockchip_match);
|
||||
|
||||
+struct dw_mci_rockchip_broken_boards_data {
|
||||
+ struct notifier_block reset_nb;
|
||||
+ struct platform_device *pdev;
|
||||
+};
|
||||
+
|
||||
+/* This reboot handler handles cases where disabling the SDMMC on
|
||||
+ * reboot will cause the hardware to be unable to start correctly
|
||||
+ * after rebooting.
|
||||
+ *
|
||||
+ * This happens with Tinkerboard systems...
|
||||
+ */
|
||||
+static int dw_mci_rockchip_broken_boards_reset_nb(
|
||||
+ struct notifier_block *this,
|
||||
+ unsigned long mode, void *cmd)
|
||||
+{
|
||||
+ struct dw_mci_rockchip_broken_boards_data const *data =
|
||||
+ container_of(this,
|
||||
+ struct dw_mci_rockchip_broken_boards_data,
|
||||
+ reset_nb);
|
||||
+ struct dw_mci *host = platform_get_drvdata(data->pdev);
|
||||
+ struct mmc_host *mmc = host->slot->mmc;
|
||||
+
|
||||
+ printk(KERN_ERR "Meow.\n");
|
||||
+
|
||||
+ mmc_power_off(mmc);
|
||||
+
|
||||
+ mdelay(20);
|
||||
+
|
||||
+ if (!IS_ERR(mmc->supply.vmmc))
|
||||
+ regulator_enable(mmc->supply.vmmc);
|
||||
+
|
||||
+ if (!IS_ERR(mmc->supply.vqmmc))
|
||||
+ regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
|
||||
+
|
||||
+ printk(KERN_ERR "woeM.\n");
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static void dw_mci_rockchip_register_broken_boards_reboot_handler(
|
||||
+ struct platform_device *pdev)
|
||||
+{
|
||||
+ struct dw_mci_rockchip_broken_boards_data *data;
|
||||
+
|
||||
+ if (!of_machine_is_compatible("asus,rk3288-tinker"))
|
||||
+ return;
|
||||
+
|
||||
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
|
||||
+
|
||||
+ if (!data)
|
||||
+ return;
|
||||
+
|
||||
+ data->reset_nb.notifier_call =
|
||||
+ dw_mci_rockchip_broken_boards_reset_nb;
|
||||
+ data->reset_nb.priority = 255;
|
||||
+ register_restart_handler(&data->reset_nb);
|
||||
+
|
||||
+ data->pdev = pdev;
|
||||
+}
|
||||
+
|
||||
static int dw_mci_rockchip_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct dw_mci_drv_data *drv_data;
|
||||
@@ -361,6 +426,7 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
pm_runtime_put_autosuspend(&pdev->dev);
|
||||
+ dw_mci_rockchip_register_broken_boards_reboot_handler(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.14.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
From 4ffe79de7272234408a9179aa4c403ee1b67a362 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 7 Dec 2017 21:27:52 +0100
|
||||
Subject: [PATCH] soc: rockchip: power-domain: export idle request
|
||||
|
||||
We need to put the power status of HEVC/RKVDEC IP into IDLE
|
||||
unless we can't reset that IP or the SoC would crash down.
|
||||
rockchip_pmu_idle_request(dev, true)---> enter idle
|
||||
rockchip_pmu_idle_request(dev, false)---> exit idle
|
||||
|
||||
Only the video codec drivers of rockchip platform would
|
||||
request this patch currently.
|
||||
|
||||
I am not sure whether it is necessary to add a new function
|
||||
at generic power domain. I want someone give me some advises
|
||||
here.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++
|
||||
include/linux/rockchip_pmu.h | 15 +++++++++++++++
|
||||
2 files changed, 38 insertions(+)
|
||||
create mode 100644 include/linux/rockchip_pmu.h
|
||||
|
||||
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
|
||||
index 40b75748..0006ed53 100644
|
||||
--- a/drivers/soc/rockchip/pm_domains.c
|
||||
+++ b/drivers/soc/rockchip/pm_domains.c
|
||||
@@ -180,6 +180,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle)
|
||||
+{
|
||||
+ struct generic_pm_domain *genpd;
|
||||
+ struct rockchip_pm_domain *pd;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev->pm_domain))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ genpd = pd_to_genpd(dev->pm_domain);
|
||||
+ pd = to_rockchip_pd(genpd);
|
||||
+
|
||||
+ mutex_lock(&pd->pmu->mutex);
|
||||
+ ret = rockchip_pmu_set_idle_request(pd, idle);
|
||||
+ mutex_unlock(&pd->pmu->mutex);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL(rockchip_pmu_idle_request);
|
||||
+
|
||||
static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd)
|
||||
{
|
||||
int i;
|
||||
diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h
|
||||
new file mode 100644
|
||||
index 00000000..720b3314
|
||||
--- /dev/null
|
||||
+++ b/include/linux/rockchip_pmu.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+/*
|
||||
+ * pm_domain.h - Definitions and headers related to device power domains.
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Randy Li <ayaka@soulik.info>.
|
||||
+ *
|
||||
+ * This file is released under the GPLv2.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _LINUX_ROCKCHIP_PM_H
|
||||
+#define _LINUX_ROCKCHIP_PM_H
|
||||
+#include <linux/device.h>
|
||||
+
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle);
|
||||
+
|
||||
+#endif /* _LINUX_ROCKCHIP_PM_H */
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From c9f505dba7e4a3adc62054b852349e8bbae10326 Mon Sep 17 00:00:00 2001
|
||||
From: Jacob Chen <jacob-chen@iotwrt.com>
|
||||
Date: Mon, 26 Jun 2017 22:53:22 +0800
|
||||
Subject: [PATCH 5/9] dt-bindings: Document the Rockchip RGA bindings
|
||||
|
||||
Add DT bindings documentation for Rockchip RGA
|
||||
|
||||
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
|
||||
Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
|
||||
---
|
||||
.../devicetree/bindings/media/rockchip-rga.txt | 36 ++++++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/media/rockchip-rga.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/rockchip-rga.txt b/Documentation/devicetree/bindings/media/rockchip-rga.txt
|
||||
new file mode 100644
|
||||
index 00000000..48a260e5
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/media/rockchip-rga.txt
|
||||
@@ -0,0 +1,36 @@
|
||||
+device-tree bindings for rockchip 2D raster graphic acceleration controller (RGA)
|
||||
+
|
||||
+RGA is a separate 2D raster graphic acceleration unit. It accelerates 2D
|
||||
+graphics operations, such as point/line drawing, image scaling, rotation,
|
||||
+BitBLT, alpha blending and image blur/sharpness.
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: value should be one of the following
|
||||
+ "rockchip,rk3228-rga";
|
||||
+ "rockchip,rk3288-rga";
|
||||
+ "rockchip,rk3399-rga";
|
||||
+
|
||||
+- interrupts: RGA interrupt number.
|
||||
+
|
||||
+- clocks: phandle to RGA sclk/hclk/aclk clocks
|
||||
+
|
||||
+- clock-names: should be "aclk" "hclk" and "sclk"
|
||||
+
|
||||
+- resets: Must contain an entry for each entry in reset-names.
|
||||
+ See ../reset/reset.txt for details.
|
||||
+- reset-names: should be "core" "axi" and "ahb"
|
||||
+
|
||||
+Example:
|
||||
+SoC specific DT entry:
|
||||
+ rga: rga@ff680000 {
|
||||
+ compatible = "rockchip,rk3399-rga";
|
||||
+ reg = <0xff680000 0x10000>;
|
||||
+ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "rga";
|
||||
+ clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>;
|
||||
+ clock-names = "aclk", "hclk", "sclk";
|
||||
+
|
||||
+ resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
|
||||
+ reset-names = "core, "axi", "ahb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
--
|
||||
2.13.0
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
|
||||
index 7b6eb0ad513b..96b6935dc0d7 100644
|
||||
--- a/drivers/usb/dwc2/hcd.c
|
||||
+++ b/drivers/usb/dwc2/hcd.c
|
||||
@@ -2748,6 +2748,8 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
|
||||
chan->xfer_len = urb->length - urb->actual_length;
|
||||
chan->xfer_count = 0;
|
||||
|
||||
+ chan->csplit_nak = 0;
|
||||
+
|
||||
/* Set the split attributes if required */
|
||||
if (qh->do_split)
|
||||
dwc2_hc_init_split(hsotg, chan, qtd, urb);
|
||||
diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h
|
||||
index 78e9e01051b5..e54f1351225b 100644
|
||||
--- a/drivers/usb/dwc2/hcd.h
|
||||
+++ b/drivers/usb/dwc2/hcd.h
|
||||
@@ -143,6 +143,7 @@ struct dwc2_host_chan {
|
||||
u8 halt_pending;
|
||||
u8 do_split;
|
||||
u8 complete_split;
|
||||
+ u8 csplit_nak;
|
||||
u8 hub_addr;
|
||||
u8 hub_port;
|
||||
u8 xact_pos;
|
||||
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
|
||||
index 916d991b96b8..551cfacd2252 100644
|
||||
--- a/drivers/usb/dwc2/hcd_intr.c
|
||||
+++ b/drivers/usb/dwc2/hcd_intr.c
|
||||
@@ -691,6 +691,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg,
|
||||
enum dwc2_transaction_type tr_type;
|
||||
u32 haintmsk;
|
||||
int free_qtd = 0;
|
||||
+ int continue_trans = 1;
|
||||
|
||||
if (dbg_hc(chan))
|
||||
dev_vdbg(hsotg->dev, " %s: channel %d, halt_status %d\n",
|
||||
@@ -719,6 +720,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg,
|
||||
* deactivated. Don't want to do anything except release the
|
||||
* host channel and try to queue more transfers.
|
||||
*/
|
||||
+ continue_trans = 0;
|
||||
goto cleanup;
|
||||
case DWC2_HC_XFER_PERIODIC_INCOMPLETE:
|
||||
dev_vdbg(hsotg->dev, " Complete URB with I/O error\n");
|
||||
@@ -730,6 +732,11 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg,
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (chan->csplit_nak) {
|
||||
+ continue_trans = 0;
|
||||
+ chan->csplit_nak = 0;
|
||||
+ }
|
||||
+
|
||||
dwc2_deactivate_qh(hsotg, chan->qh, free_qtd);
|
||||
|
||||
cleanup:
|
||||
@@ -767,9 +774,11 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg,
|
||||
dwc2_writel(haintmsk, hsotg->regs + HAINTMSK);
|
||||
|
||||
/* Try to queue more transfers now that there's a free channel */
|
||||
- tr_type = dwc2_hcd_select_transactions(hsotg);
|
||||
- if (tr_type != DWC2_TRANSACTION_NONE)
|
||||
- dwc2_hcd_queue_transactions(hsotg, tr_type);
|
||||
+ if (continue_trans) {
|
||||
+ tr_type = dwc2_hcd_select_transactions(hsotg);
|
||||
+ if (tr_type != DWC2_TRANSACTION_NONE)
|
||||
+ dwc2_hcd_queue_transactions(hsotg, tr_type);
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1205,6 +1214,7 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg,
|
||||
if (chan->do_split) {
|
||||
if (chan->complete_split)
|
||||
qtd->error_count = 0;
|
||||
+ chan->csplit_nak = 1;
|
||||
qtd->complete_split = 0;
|
||||
dwc2_halt_channel(hsotg, chan, qtd, DWC2_HC_XFER_NAK);
|
||||
goto handle_nak_done;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 04fbf78e4e569bf872f1ffcb0a6f9b89569dc913 Mon Sep 17 00:00:00 2001
|
||||
From: Hal Emmerich <hal@halemmerich.com>
|
||||
Date: Thu, 19 Jul 2018 21:48:08 -0500
|
||||
Subject: [PATCH] usb: dwc2: disable power_down on rockchip devices
|
||||
|
||||
The bug would let the usb controller enter partial power down,
|
||||
which was formally known as hibernate, upon boot if nothing was plugged
|
||||
in to the port. Partial power down couldn't be exited properly, so any
|
||||
usb devices plugged in after boot would not be usable.
|
||||
|
||||
Before the name change, params.hibernation was false by default, so
|
||||
_dwc2_hcd_suspend() would skip entering hibernation. With the
|
||||
rename, _dwc2_hcd_suspend() was changed to use params.power_down
|
||||
to decide whether or not to enter partial power down.
|
||||
|
||||
Since params.power_down is non-zero by default, it needs to be set
|
||||
to 0 for rockchip devices to restore functionality.
|
||||
|
||||
This bug was reported in the linux-usb thread:
|
||||
REGRESSION: usb: dwc2: USB device not seen after boot
|
||||
|
||||
The commit that caused this regression is:
|
||||
6d23ee9caa6790aea047f9aca7f3c03cb8d96eb6
|
||||
|
||||
Signed-off-by: Hal Emmerich <hal@halemmerich.com>
|
||||
---
|
||||
drivers/usb/dwc2/params.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
|
||||
index f03e418..492607a 100644
|
||||
--- a/drivers/usb/dwc2/params.c
|
||||
+++ b/drivers/usb/dwc2/params.c
|
||||
@@ -82,6 +82,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
|
||||
p->host_perio_tx_fifo_size = 256;
|
||||
p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 <<
|
||||
GAHBCFG_HBSTLEN_SHIFT;
|
||||
+ p->power_down = 0;
|
||||
}
|
||||
|
||||
static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg)
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
From bc16cd0aa3cdaaff27b9bf2d3282ccfff81d8784 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Sat, 29 Sep 2018 02:56:32 +0200
|
||||
Subject: [PATCH 5/6] drivers: clk-rk3288: support for dedicating NPLL to a VOP
|
||||
|
||||
This patch is taken from Urja Rannikko ( @urjaman ) patchset here :
|
||||
https://github.com/urjaman/arch-c201/blob/master/linux-c201/0020-RK3288-HDMI-clock-hacks-combined.patch
|
||||
https://www.spinics.net/lists/arm-kernel/msg673156.html
|
||||
|
||||
I'm not really sure what this does exactly. It basically sets the
|
||||
parent clock of the newly added clocks, if the newly added property
|
||||
"rockchip,npll-for-vop" is detected and set.
|
||||
|
||||
I have no clear idea how HDMI Neuronal PLL (and PLL in general) work,
|
||||
so I cannot comment on what it's doing and if it's a good idea in
|
||||
general.
|
||||
|
||||
The only thing I know from this patchset is that it works and have
|
||||
resolved some purple line issue at the left of my HDMI screen, when
|
||||
connected to MiQi or Tinkerboard devices.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/clk/rockchip/clk-rk3288.c | 98 ++++++++++++++++++++++++++++++++-------
|
||||
drivers/clk/rockchip/clk.h | 3 ++
|
||||
2 files changed, 85 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
|
||||
index fd2058f7d..b5b56169d 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3288.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3288.c
|
||||
@@ -83,22 +83,43 @@ static struct rockchip_pll_rate_table rk3288_pll_rates[] = {
|
||||
RK3066_PLL_RATE( 768000000, 1, 64, 2),
|
||||
RK3066_PLL_RATE( 742500000, 8, 495, 2),
|
||||
RK3066_PLL_RATE( 696000000, 1, 58, 2),
|
||||
+ RK3066_PLL_RATE_NB(621000000, 1, 207, 8, 1),
|
||||
RK3066_PLL_RATE( 600000000, 1, 50, 2),
|
||||
RK3066_PLL_RATE_NB(594000000, 1, 198, 8, 1),
|
||||
RK3066_PLL_RATE( 552000000, 1, 46, 2),
|
||||
RK3066_PLL_RATE( 504000000, 1, 84, 4),
|
||||
RK3066_PLL_RATE( 500000000, 3, 125, 2),
|
||||
RK3066_PLL_RATE( 456000000, 1, 76, 4),
|
||||
+ RK3066_PLL_RATE( 428000000, 1, 107, 6),
|
||||
RK3066_PLL_RATE( 408000000, 1, 68, 4),
|
||||
RK3066_PLL_RATE( 400000000, 3, 100, 2),
|
||||
+ RK3066_PLL_RATE_NB( 394000000, 1, 197, 12, 1),
|
||||
RK3066_PLL_RATE( 384000000, 2, 128, 4),
|
||||
RK3066_PLL_RATE( 360000000, 1, 60, 4),
|
||||
+ RK3066_PLL_RATE_NB( 356000000, 1, 178, 12, 1),
|
||||
+ RK3066_PLL_RATE_NB( 324000000, 1, 189, 14, 1),
|
||||
RK3066_PLL_RATE( 312000000, 1, 52, 4),
|
||||
- RK3066_PLL_RATE( 300000000, 1, 50, 4),
|
||||
- RK3066_PLL_RATE( 297000000, 2, 198, 8),
|
||||
+ RK3066_PLL_RATE_NB( 308000000, 1, 154, 12, 1),
|
||||
+ RK3066_PLL_RATE_NB( 303000000, 1, 202, 16, 1),
|
||||
+ RK3066_PLL_RATE( 300000000, 1, 75, 6),
|
||||
+ RK3066_PLL_RATE_NB( 297750000, 2, 397, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 293250000, 2, 391, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 292500000, 1, 195, 16, 1),
|
||||
+ RK3066_PLL_RATE( 273600000, 1, 114, 10),
|
||||
+ RK3066_PLL_RATE_NB( 273000000, 1, 182, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 270000000, 1, 180, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 266250000, 2, 355, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 256500000, 1, 171, 16, 1),
|
||||
RK3066_PLL_RATE( 252000000, 1, 84, 8),
|
||||
- RK3066_PLL_RATE( 216000000, 1, 72, 8),
|
||||
- RK3066_PLL_RATE( 148500000, 2, 99, 8),
|
||||
+ RK3066_PLL_RATE_NB( 250500000, 1, 167, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 243428571, 1, 142, 14, 1),
|
||||
+ RK3066_PLL_RATE( 238000000, 1, 119, 12),
|
||||
+ RK3066_PLL_RATE_NB( 219750000, 2, 293, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 216000000, 1, 144, 16, 1),
|
||||
+ RK3066_PLL_RATE_NB( 213000000, 1, 142, 16, 1),
|
||||
+ RK3066_PLL_RATE( 195428571, 1, 114, 14),
|
||||
+ RK3066_PLL_RATE( 160000000, 1, 80, 12),
|
||||
+ RK3066_PLL_RATE( 157500000, 1, 105, 16),
|
||||
RK3066_PLL_RATE( 126000000, 1, 84, 16),
|
||||
RK3066_PLL_RATE( 48000000, 1, 64, 32),
|
||||
{ /* sentinel */ },
|
||||
@@ -194,10 +215,14 @@ PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" };
|
||||
PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu" };
|
||||
|
||||
PNAME(mux_pll_src_cpll_gpll_p) = { "cpll", "gpll" };
|
||||
-PNAME(mux_pll_src_npll_cpll_gpll_p) = { "npll", "cpll", "gpll" };
|
||||
-PNAME(mux_pll_src_cpll_gpll_npll_p) = { "cpll", "gpll", "npll" };
|
||||
+PNAME_ED(mux_pll_src_npll_cpll_gpll_p) = { "npll", "cpll", "gpll" };
|
||||
+
|
||||
+PNAME_ED(mux_pll_src_cgn_pll_nonvop_p) = { "cpll", "gpll", "npll" };
|
||||
+PNAME_ED(mux_pll_src_cgn_pll_vop0_p) = { "cpll", "gpll", "npll" };
|
||||
+PNAME_ED(mux_pll_src_cgn_pll_vop1_p) = { "cpll", "gpll", "npll" };
|
||||
+
|
||||
PNAME(mux_pll_src_cpll_gpll_usb480m_p) = { "cpll", "gpll", "usbphy480m_src" };
|
||||
-PNAME(mux_pll_src_cpll_gll_usb_npll_p) = { "cpll", "gpll", "usbphy480m_src", "npll" };
|
||||
+PNAME_ED(mux_pll_src_cpll_gll_usb_npll_p) = { "cpll", "gpll", "usbphy480m_src", "npll" };
|
||||
|
||||
PNAME(mux_mmc_src_p) = { "cpll", "gpll", "xin24m", "xin24m" };
|
||||
PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" };
|
||||
@@ -443,24 +468,24 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
RK3288_CLKSEL_CON(30), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 4, GFLAGS),
|
||||
|
||||
- COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cgn_pll_vop0_p, 0,
|
||||
RK3288_CLKSEL_CON(27), 0, 2, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 1, GFLAGS),
|
||||
- COMPOSITE(DCLK_VOP1, "dclk_vop1", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(DCLK_VOP1, "dclk_vop1", mux_pll_src_cgn_pll_vop1_p, 0,
|
||||
RK3288_CLKSEL_CON(29), 6, 2, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 3, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(SCLK_EDP_24M, "sclk_edp_24m", mux_edp_24m_p, 0,
|
||||
RK3288_CLKSEL_CON(28), 15, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 12, GFLAGS),
|
||||
- COMPOSITE(SCLK_EDP, "sclk_edp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(SCLK_EDP, "sclk_edp", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 13, GFLAGS),
|
||||
|
||||
- COMPOSITE(SCLK_ISP, "sclk_isp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(SCLK_ISP, "sclk_isp", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(6), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 14, GFLAGS),
|
||||
- COMPOSITE(SCLK_ISP_JPE, "sclk_isp_jpe", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(SCLK_ISP_JPE, "sclk_isp_jpe", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(6), 14, 2, MFLAGS, 8, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 15, GFLAGS),
|
||||
|
||||
@@ -469,16 +494,16 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
GATE(SCLK_HDMI_CEC, "sclk_hdmi_cec", "xin32k", 0,
|
||||
RK3288_CLKGATE_CON(5), 11, GFLAGS),
|
||||
|
||||
- COMPOSITE(ACLK_HEVC, "aclk_hevc", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(ACLK_HEVC, "aclk_hevc", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(39), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 13, GFLAGS),
|
||||
DIV(HCLK_HEVC, "hclk_hevc", "aclk_hevc", 0,
|
||||
RK3288_CLKSEL_CON(40), 12, 2, DFLAGS),
|
||||
|
||||
- COMPOSITE(SCLK_HEVC_CABAC, "sclk_hevc_cabac", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(SCLK_HEVC_CABAC, "sclk_hevc_cabac", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(42), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 14, GFLAGS),
|
||||
- COMPOSITE(SCLK_HEVC_CORE, "sclk_hevc_core", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(SCLK_HEVC_CORE, "sclk_hevc_core", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(42), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 15, GFLAGS),
|
||||
|
||||
@@ -552,7 +577,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
COMPOSITE(0, "sclk_tspout", mux_tspout_p, 0,
|
||||
RK3288_CLKSEL_CON(35), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 11, GFLAGS),
|
||||
- COMPOSITE(0, "sclk_tsp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
+ COMPOSITE(0, "sclk_tsp", mux_pll_src_cgn_pll_nonvop_p, 0,
|
||||
RK3288_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 10, GFLAGS),
|
||||
|
||||
@@ -912,6 +937,7 @@ static void __init rk3288_clk_init(struct device_node *np)
|
||||
{
|
||||
struct rockchip_clk_provider *ctx;
|
||||
struct clk *clk;
|
||||
+ s32 npll_vop = -1;
|
||||
|
||||
rk3288_cru_base = of_iomap(np, 0);
|
||||
if (!rk3288_cru_base) {
|
||||
@@ -919,6 +945,46 @@ static void __init rk3288_clk_init(struct device_node *np)
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (!of_property_read_s32(np, "rockchip,npll-for-vop", &npll_vop)) {
|
||||
+ if ((npll_vop < -1) || (npll_vop > 1)) {
|
||||
+ pr_warn("%s: invalid VOP to dedicate NPLL to: %d\n",
|
||||
+ __func__, npll_vop);
|
||||
+ } else if (npll_vop >= 0) {
|
||||
+ unsigned int vop_clk_id;
|
||||
+ const char ** npll_names;
|
||||
+ const char ** non_npll_names;
|
||||
+ int i;
|
||||
+
|
||||
+ /* Firstly, not-VOP needs to not use npll */
|
||||
+ mux_pll_src_npll_cpll_gpll_p[0] = "dummy_npll";
|
||||
+ mux_pll_src_cgn_pll_nonvop_p[2] = "dummy_npll";
|
||||
+ mux_pll_src_cpll_gll_usb_npll_p[3] = "dummy_npll";
|
||||
+
|
||||
+ /* Then the npll VOP needs to only use npll, and the other one not use npll. */
|
||||
+ if (npll_vop) {
|
||||
+ vop_clk_id = DCLK_VOP1;
|
||||
+ npll_names = mux_pll_src_cgn_pll_vop1_p;
|
||||
+ non_npll_names = mux_pll_src_cgn_pll_vop0_p;
|
||||
+ } else {
|
||||
+ vop_clk_id = DCLK_VOP0;
|
||||
+ npll_names = mux_pll_src_cgn_pll_vop0_p;
|
||||
+ non_npll_names = mux_pll_src_cgn_pll_vop1_p;
|
||||
+ }
|
||||
+ npll_names[0] = "dummy_cpll";
|
||||
+ npll_names[1] = "dummy_gpll";
|
||||
+ non_npll_names[2] = "dummy_npll";
|
||||
+
|
||||
+ /* Lastly the npll-dedicated-VOP needs to be able to control npll. */
|
||||
+ for (i = 0; i < ARRAY_SIZE(rk3288_clk_branches); i++) {
|
||||
+ if (rk3288_clk_branches[i].id == vop_clk_id) {
|
||||
+ rk3288_clk_branches[i].flags |= CLK_SET_RATE_PARENT;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ pr_debug("%s: npll dedicated for VOP %d\n", __func__, npll_vop);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ctx = rockchip_clk_init(np, rk3288_cru_base, CLK_NR_CLKS);
|
||||
if (IS_ERR(ctx)) {
|
||||
pr_err("%s: rockchip clk init failed\n", __func__);
|
||||
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
|
||||
index 6b53fff4c..dbda9d281 100644
|
||||
--- a/drivers/clk/rockchip/clk.h
|
||||
+++ b/drivers/clk/rockchip/clk.h
|
||||
@@ -382,6 +382,9 @@ struct clk *rockchip_clk_register_muxgrf(const char *name,
|
||||
|
||||
#define PNAME(x) static const char *const x[] __initconst
|
||||
|
||||
+/* For when you want to be able to modify the pointers. */
|
||||
+#define PNAME_ED(x) static const char * x[] __initdata
|
||||
+
|
||||
enum rockchip_clk_branch_type {
|
||||
branch_composite,
|
||||
branch_mux,
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
From 6c86916e81fa18394d9b57b4af44f9948e100e96 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Sat, 29 Sep 2018 03:02:10 +0200
|
||||
Subject: [PATCH 6/6] drm: dw_hdmi-rockchip: better clock selection logic and
|
||||
dts-based rate list
|
||||
|
||||
This patch is taken from Urja Rannikko ( @urjaman ) patchset here :
|
||||
https://github.com/urjaman/arch-c201/blob/master/linux-c201/0020-RK3288-HDMI-clock-hacks-combined.patch
|
||||
https://www.spinics.net/lists/arm-kernel/msg673156.html
|
||||
|
||||
The original description was :
|
||||
This contains traces of the following commits from the ChromeOS 3.14
|
||||
tree, which improve RF/EMI performance and detach the clock selection
|
||||
logic from the HDMI PHY configurations, plus support for configuring
|
||||
the allowed clock rates via device tree as they are dependent on
|
||||
PLL configuration and maybe even the PCB layout and other hardware things,
|
||||
eg. interference to wifi or such (EMI).
|
||||
|
||||
Rates that were allowed previous to this patch are added as the fallback
|
||||
list if no dts configuration exists.
|
||||
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: Adjust rockchip_mpll_cfg for 146.25
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: expand the informal mpll config
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: add slop to more tables
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: redo rockchip hdmi to allow slop
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: Use auto-generated tables
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: Fixup the clock to be what we expect
|
||||
CHROMIUM: drm/rockchip: hdmi: adjust cklvl & txlvl for RF/EMI
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: Set cur_ctr to 0 always
|
||||
CHROMIUM: drm: rockchip/dw_hdmi-rockchip: Decrease slop
|
||||
|
||||
https://www.spinics.net/lists/arm-kernel/msg673163.html
|
||||
|
||||
This is the patch that takes into account the new property
|
||||
"rockchip,hdmi-rates-hz" that allows the definition of the HDMI
|
||||
frequencies in the DTS file.
|
||||
This also change a lot of HDMI frequencies definition, so that
|
||||
*will* require some extensive testing.
|
||||
|
||||
Still, if it works fine, this should make tinkering the HDMI
|
||||
frequencies easier, in case you have a very special HDMI screen.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 269 ++++++++++++++++++----------
|
||||
1 file changed, 175 insertions(+), 94 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
|
||||
index 11309a2a4..740b0aeea 100644
|
||||
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
|
||||
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
|
||||
@@ -49,122 +49,141 @@ struct rockchip_hdmi {
|
||||
struct clk *vpll_clk;
|
||||
struct clk *grf_clk;
|
||||
struct dw_hdmi *hdmi;
|
||||
+ u32* rates;
|
||||
+ u32 rates_cnt;
|
||||
};
|
||||
|
||||
+#define CLK_SLOP(clk) ((clk) / 1000)
|
||||
+#define CLK_PLUS_SLOP(clk) ((clk) + CLK_SLOP(clk))
|
||||
+
|
||||
#define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x)
|
||||
|
||||
+/* These were the rates allowed by the driver before rates list in device tree,
|
||||
+ * so keep them around as a fallback */
|
||||
+static const u32 dw_hdmi_fallback_rates[] = {
|
||||
+ 27000000,
|
||||
+ 36000000,
|
||||
+ 40000000,
|
||||
+ 54000000,
|
||||
+ 65000000,
|
||||
+ 66000000,
|
||||
+ 74250000,
|
||||
+ 83500000,
|
||||
+ 106500000,
|
||||
+ 108000000,
|
||||
+ 146250000,
|
||||
+ 148500000
|
||||
+};
|
||||
+
|
||||
static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
|
||||
{
|
||||
- 27000000, {
|
||||
- { 0x00b3, 0x0000},
|
||||
- { 0x2153, 0x0000},
|
||||
- { 0x40f3, 0x0000}
|
||||
+ 30666000, {
|
||||
+ { 0x00b3, 0x0000 },
|
||||
+ { 0x2153, 0x0000 },
|
||||
+ { 0x40f3, 0x0000 },
|
||||
+ },
|
||||
+ }, {
|
||||
+ 36800000, {
|
||||
+ { 0x00b3, 0x0000 },
|
||||
+ { 0x2153, 0x0000 },
|
||||
+ { 0x40a2, 0x0001 },
|
||||
},
|
||||
- }, {
|
||||
- 36000000, {
|
||||
- { 0x00b3, 0x0000},
|
||||
- { 0x2153, 0x0000},
|
||||
- { 0x40f3, 0x0000}
|
||||
+ }, {
|
||||
+ 46000000, {
|
||||
+ { 0x00b3, 0x0000 },
|
||||
+ { 0x2142, 0x0001 },
|
||||
+ { 0x40a2, 0x0001 },
|
||||
},
|
||||
- }, {
|
||||
- 40000000, {
|
||||
- { 0x00b3, 0x0000},
|
||||
- { 0x2153, 0x0000},
|
||||
- { 0x40f3, 0x0000}
|
||||
+ }, {
|
||||
+ 61333000, {
|
||||
+ { 0x0072, 0x0001 },
|
||||
+ { 0x2142, 0x0001 },
|
||||
+ { 0x40a2, 0x0001 },
|
||||
},
|
||||
- }, {
|
||||
- 54000000, {
|
||||
- { 0x0072, 0x0001},
|
||||
- { 0x2142, 0x0001},
|
||||
- { 0x40a2, 0x0001},
|
||||
+ }, {
|
||||
+ 73600000, {
|
||||
+ { 0x0072, 0x0001 },
|
||||
+ { 0x2142, 0x0001 },
|
||||
+ { 0x4061, 0x0002 },
|
||||
},
|
||||
- }, {
|
||||
- 65000000, {
|
||||
- { 0x0072, 0x0001},
|
||||
- { 0x2142, 0x0001},
|
||||
- { 0x40a2, 0x0001},
|
||||
+ }, {
|
||||
+ 92000000, {
|
||||
+ { 0x0072, 0x0001 },
|
||||
+ { 0x2145, 0x0002 },
|
||||
+ { 0x4061, 0x0002 },
|
||||
},
|
||||
- }, {
|
||||
- 66000000, {
|
||||
- { 0x013e, 0x0003},
|
||||
- { 0x217e, 0x0002},
|
||||
- { 0x4061, 0x0002}
|
||||
+ }, {
|
||||
+ 122666000, {
|
||||
+ { 0x0051, 0x0002 },
|
||||
+ { 0x2145, 0x0002 },
|
||||
+ { 0x4061, 0x0002 },
|
||||
},
|
||||
- }, {
|
||||
- 74250000, {
|
||||
- { 0x0072, 0x0001},
|
||||
- { 0x2145, 0x0002},
|
||||
- { 0x4061, 0x0002}
|
||||
+ }, {
|
||||
+ 147200000, {
|
||||
+ { 0x0051, 0x0002 },
|
||||
+ { 0x2145, 0x0002 },
|
||||
+ { 0x4064, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
- 83500000, {
|
||||
- { 0x0072, 0x0001},
|
||||
+ }, {
|
||||
+ 184000000, {
|
||||
+ { 0x0051, 0x0002 },
|
||||
+ { 0x214c, 0x0003 },
|
||||
+ { 0x4064, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
- 108000000, {
|
||||
- { 0x0051, 0x0002},
|
||||
- { 0x2145, 0x0002},
|
||||
- { 0x4061, 0x0002}
|
||||
+ }, {
|
||||
+ 226666000, {
|
||||
+ { 0x0040, 0x0003 },
|
||||
+ { 0x214c, 0x0003 },
|
||||
+ { 0x4064, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
- 106500000, {
|
||||
- { 0x0051, 0x0002},
|
||||
- { 0x2145, 0x0002},
|
||||
- { 0x4061, 0x0002}
|
||||
+ }, {
|
||||
+ 272000000, {
|
||||
+ { 0x0040, 0x0003 },
|
||||
+ { 0x214c, 0x0003 },
|
||||
+ { 0x5a64, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
- 146250000, {
|
||||
- { 0x0051, 0x0002},
|
||||
- { 0x2145, 0x0002},
|
||||
- { 0x4061, 0x0002}
|
||||
+ }, {
|
||||
+ 340000000, {
|
||||
+ { 0x0040, 0x0003 },
|
||||
+ { 0x3b4c, 0x0003 },
|
||||
+ { 0x5a64, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
- 148500000, {
|
||||
- { 0x0051, 0x0003},
|
||||
- { 0x214c, 0x0003},
|
||||
- { 0x4064, 0x0003}
|
||||
+ }, {
|
||||
+ 600000000, {
|
||||
+ { 0x1a40, 0x0003 },
|
||||
+ { 0x3b4c, 0x0003 },
|
||||
+ { 0x5a64, 0x0003 },
|
||||
},
|
||||
- }, {
|
||||
+ }, {
|
||||
~0UL, {
|
||||
- { 0x00a0, 0x000a },
|
||||
- { 0x2001, 0x000f },
|
||||
- { 0x4002, 0x000f },
|
||||
+ { 0x0000, 0x0000 },
|
||||
+ { 0x0000, 0x0000 },
|
||||
+ { 0x0000, 0x0000 },
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
|
||||
- /* pixelclk bpp8 bpp10 bpp12 */
|
||||
+ /* pixelclk bpp8 bpp10 bpp12 */
|
||||
{
|
||||
- 40000000, { 0x0018, 0x0018, 0x0018 },
|
||||
- }, {
|
||||
- 65000000, { 0x0028, 0x0028, 0x0028 },
|
||||
- }, {
|
||||
- 66000000, { 0x0038, 0x0038, 0x0038 },
|
||||
- }, {
|
||||
- 74250000, { 0x0028, 0x0038, 0x0038 },
|
||||
- }, {
|
||||
- 83500000, { 0x0028, 0x0038, 0x0038 },
|
||||
- }, {
|
||||
- 146250000, { 0x0038, 0x0038, 0x0038 },
|
||||
- }, {
|
||||
- 148500000, { 0x0000, 0x0038, 0x0038 },
|
||||
- }, {
|
||||
- ~0UL, { 0x0000, 0x0000, 0x0000},
|
||||
- }
|
||||
+ 600000000, { 0x0000, 0x0000, 0x0000 },
|
||||
+ }, {
|
||||
+ ~0UL, { 0x0000, 0x0000, 0x0000 },
|
||||
+ },
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_phy_config rockchip_phy_config[] = {
|
||||
/*pixelclk symbol term vlev*/
|
||||
- { 74250000, 0x8009, 0x0004, 0x0272},
|
||||
- { 148500000, 0x802b, 0x0004, 0x028d},
|
||||
- { 297000000, 0x8039, 0x0005, 0x028d},
|
||||
- { ~0UL, 0x0000, 0x0000, 0x0000}
|
||||
+ { CLK_PLUS_SLOP(74250000), 0x8009, 0x0004, 0x0272},
|
||||
+ { CLK_PLUS_SLOP(165000000), 0x802b, 0x0004, 0x0209},
|
||||
+ { CLK_PLUS_SLOP(297000000), 0x8039, 0x0005, 0x028d},
|
||||
+ { ~0UL, 0x0000, 0x0000, 0x0000}
|
||||
};
|
||||
|
||||
static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
|
||||
{
|
||||
struct device_node *np = hdmi->dev->of_node;
|
||||
+ int rates_cnt;
|
||||
|
||||
hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
|
||||
if (IS_ERR(hdmi->regmap)) {
|
||||
@@ -192,26 +211,55 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
|
||||
return PTR_ERR(hdmi->grf_clk);
|
||||
}
|
||||
|
||||
+ if ((rates_cnt = of_property_count_u32_elems(np, "rockchip,hdmi-rates-hz")) > 0) {
|
||||
+ int rv;
|
||||
+ u32 *rates = devm_kmalloc_array(hdmi->dev, rates_cnt, sizeof(u32), GFP_KERNEL);
|
||||
+ if (!rates)
|
||||
+ return -ENOMEM;
|
||||
+ rv = of_property_read_u32_array(np, "rockchip,hdmi-rates-hz", rates, rates_cnt);
|
||||
+ if (rv)
|
||||
+ return rv;
|
||||
+ hdmi->rates = rates;
|
||||
+ hdmi->rates_cnt = rates_cnt;
|
||||
+ } else {
|
||||
+ rates_cnt = ARRAY_SIZE(dw_hdmi_fallback_rates);
|
||||
+ hdmi->rates = devm_kmalloc_array(hdmi->dev, rates_cnt, sizeof(u32), GFP_KERNEL);
|
||||
+ if (!hdmi->rates)
|
||||
+ return -ENOMEM;
|
||||
+ memcpy(hdmi->rates, dw_hdmi_fallback_rates, rates_cnt * sizeof(u32));
|
||||
+ hdmi->rates_cnt = rates_cnt;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
-dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
|
||||
+dw_hdmi_rockchip_encoder_mode_valid(struct drm_encoder *encoder,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
- const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
|
||||
+ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
|
||||
int pclk = mode->clock * 1000;
|
||||
- bool valid = false;
|
||||
+ int num_rates = hdmi->rates_cnt;
|
||||
int i;
|
||||
|
||||
- for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
|
||||
- if (pclk == mpll_cfg[i].mpixelclock) {
|
||||
- valid = true;
|
||||
- break;
|
||||
- }
|
||||
+ /*
|
||||
+ * Pixel clocks we support are always < 2GHz and so fit in an
|
||||
+ * int. We should make sure source rate does too so we don't get
|
||||
+ * overflow when we multiply by 1000.
|
||||
+ */
|
||||
+ if (mode->clock > INT_MAX / 1000)
|
||||
+ return MODE_BAD;
|
||||
+
|
||||
+ for (i = 0; i < num_rates; i++) {
|
||||
+ int slop = CLK_SLOP(pclk);
|
||||
+
|
||||
+ if ((pclk >= hdmi->rates[i] - slop) &&
|
||||
+ (pclk <= hdmi->rates[i] + slop))
|
||||
+ return MODE_OK;
|
||||
}
|
||||
|
||||
- return (valid) ? MODE_OK : MODE_BAD;
|
||||
+ return MODE_BAD;
|
||||
}
|
||||
|
||||
static const struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
|
||||
@@ -227,7 +275,39 @@ dw_hdmi_rockchip_encoder_mode_fixup(struct drm_encoder *encoder,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adj_mode)
|
||||
{
|
||||
- return true;
|
||||
+ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
|
||||
+ int pclk = adj_mode->clock * 1000;
|
||||
+ int best_diff = INT_MAX;
|
||||
+ int best_clock = 0;
|
||||
+ int slop;
|
||||
+ int i;
|
||||
+
|
||||
+ /* Pick the best clock */
|
||||
+ for (i = 0; i < hdmi->rates_cnt; i++) {
|
||||
+ int diff = hdmi->rates[i] - pclk;
|
||||
+
|
||||
+ if (diff < 0)
|
||||
+ diff = -diff;
|
||||
+ if (diff < best_diff) {
|
||||
+ best_diff = diff;
|
||||
+ best_clock = hdmi->rates[i];
|
||||
+
|
||||
+ /* Bail early if we're exact */
|
||||
+ if (best_diff == 0)
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Double check that it's OK */
|
||||
+ slop = CLK_SLOP(pclk);
|
||||
+ if ((pclk >= best_clock - slop) && (pclk <= best_clock + slop)) {
|
||||
+ adj_mode->clock = DIV_ROUND_UP(best_clock, 1000);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ /* Shoudn't be here; we should have said rate wasn't valid */
|
||||
+ dev_warn(hdmi->dev, "tried to set invalid rate %d\n", adj_mode->clock);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
|
||||
@@ -280,6 +360,7 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
|
||||
}
|
||||
|
||||
static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = {
|
||||
+ .mode_valid = dw_hdmi_rockchip_encoder_mode_valid,
|
||||
.mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup,
|
||||
.mode_set = dw_hdmi_rockchip_encoder_mode_set,
|
||||
.enable = dw_hdmi_rockchip_encoder_enable,
|
||||
@@ -294,7 +375,6 @@ static struct rockchip_hdmi_chip_data rk3288_chip_data = {
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = {
|
||||
- .mode_valid = dw_hdmi_rockchip_mode_valid,
|
||||
.mpll_cfg = rockchip_mpll_cfg,
|
||||
.cur_ctr = rockchip_cur_ctr,
|
||||
.phy_config = rockchip_phy_config,
|
||||
@@ -308,7 +388,6 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = {
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = {
|
||||
- .mode_valid = dw_hdmi_rockchip_mode_valid,
|
||||
.mpll_cfg = rockchip_mpll_cfg,
|
||||
.cur_ctr = rockchip_cur_ctr,
|
||||
.phy_config = rockchip_phy_config,
|
||||
@@ -387,6 +466,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
|
||||
*/
|
||||
if (IS_ERR(hdmi->hdmi)) {
|
||||
ret = PTR_ERR(hdmi->hdmi);
|
||||
+ devm_kfree(hdmi->dev, hdmi->rates);
|
||||
drm_encoder_cleanup(encoder);
|
||||
clk_disable_unprepare(hdmi->vpll_clk);
|
||||
}
|
||||
@@ -399,6 +479,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
|
||||
{
|
||||
struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
|
||||
|
||||
+ devm_kfree(hdmi->dev, hdmi->rates);
|
||||
dw_hdmi_unbind(hdmi->hdmi);
|
||||
clk_disable_unprepare(hdmi->vpll_clk);
|
||||
}
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
From 1680a655127a62e74cbcfb84782e04a9c55dcf81 Mon Sep 17 00:00:00 2001
|
||||
From: Shunqian Zheng <zhengsq@rock-chips.com>
|
||||
Date: Wed, 5 Sep 2018 19:00:09 -0300
|
||||
Subject: [PATCH 3/6] media: Add JPEG_RAW format
|
||||
|
||||
Add V4L2_PIX_FMT_JPEG_RAW format that does not contain
|
||||
JPEG header in the output frame.
|
||||
|
||||
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
---
|
||||
Documentation/media/uapi/v4l/pixfmt-compressed.rst | 9 +++++++++
|
||||
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
3 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/pixfmt-compressed.rst b/Documentation/media/uapi/v4l/pixfmt-compressed.rst
|
||||
index d382e7a5..4dffe400 100644
|
||||
--- a/Documentation/media/uapi/v4l/pixfmt-compressed.rst
|
||||
+++ b/Documentation/media/uapi/v4l/pixfmt-compressed.rst
|
||||
@@ -23,6 +23,15 @@ Compressed Formats
|
||||
- 'JPEG'
|
||||
- TBD. See also :ref:`VIDIOC_G_JPEGCOMP <VIDIOC_G_JPEGCOMP>`,
|
||||
:ref:`VIDIOC_S_JPEGCOMP <VIDIOC_G_JPEGCOMP>`.
|
||||
+ * .. _V4L2-PIX-FMT-JPEG-RAW:
|
||||
+
|
||||
+ - ``V4L2_PIX_FMT_JPEG_RAW``
|
||||
+ - 'Raw JPEG'
|
||||
+ - Raw JPEG bitstream, containing a compressed payload. This format
|
||||
+ contains an image scan, i.e. without any metadata or headers.
|
||||
+ The user is expected to set the needed metadata such as
|
||||
+ quantization and entropy encoding tables, via ``V4L2_CID_JPEG``
|
||||
+ controls, see :ref:`jpeg-control-id`.
|
||||
* .. _V4L2-PIX-FMT-MPEG:
|
||||
|
||||
- ``V4L2_PIX_FMT_MPEG``
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
index 54afc9c7..0dcd95f4 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1301,6 +1301,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
/* Max description length mask: descr = "0123456789012345678901234567890" */
|
||||
case V4L2_PIX_FMT_MJPEG: descr = "Motion-JPEG"; break;
|
||||
case V4L2_PIX_FMT_JPEG: descr = "JFIF JPEG"; break;
|
||||
+ case V4L2_PIX_FMT_JPEG_RAW: descr = "Raw JPEG"; break;
|
||||
case V4L2_PIX_FMT_DV: descr = "1394"; break;
|
||||
case V4L2_PIX_FMT_MPEG: descr = "MPEG-1/2/4"; break;
|
||||
case V4L2_PIX_FMT_H264: descr = "H.264"; break;
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 5d1a3685..f271048c 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -627,6 +627,7 @@ struct v4l2_pix_format {
|
||||
/* compressed formats */
|
||||
#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
|
||||
#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
|
||||
+#define V4L2_PIX_FMT_JPEG_RAW v4l2_fourcc('J', 'P', 'G', 'R') /* JFIF JPEG RAW without headers */
|
||||
#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
|
||||
#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
|
||||
#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
From 82da876c36ccc7791d5b20e7ee8b50379f7b19aa Mon Sep 17 00:00:00 2001
|
||||
From: Shunqian Zheng <zhengsq@rock-chips.com>
|
||||
Date: Wed, 5 Sep 2018 19:00:10 -0300
|
||||
Subject: [PATCH 4/6] media: Add controls for JPEG quantization tables
|
||||
|
||||
Add V4L2_CID_JPEG_QUANTIZATION compound control to allow userspace
|
||||
configure the JPEG quantization tables.
|
||||
|
||||
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
---
|
||||
Documentation/media/uapi/v4l/extended-controls.rst | 31 ++++++++++++++++++++++
|
||||
Documentation/media/videodev2.h.rst.exceptions | 1 +
|
||||
drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++++++
|
||||
include/uapi/linux/v4l2-controls.h | 12 +++++++++
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
5 files changed, 55 insertions(+)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst
|
||||
index 9f7312bf..1335d27d 100644
|
||||
--- a/Documentation/media/uapi/v4l/extended-controls.rst
|
||||
+++ b/Documentation/media/uapi/v4l/extended-controls.rst
|
||||
@@ -3354,7 +3354,38 @@ JPEG Control IDs
|
||||
Specify which JPEG markers are included in compressed stream. This
|
||||
control is valid only for encoders.
|
||||
|
||||
+.. _jpeg-quant-tables-control:
|
||||
|
||||
+``V4L2_CID_JPEG_QUANTIZATION (struct)``
|
||||
+ Specifies the luma and chroma quantization matrices for encoding
|
||||
+ or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. The :ref:`itu-t81`
|
||||
+ specification allows 8-bit quantization coefficients for
|
||||
+ baseline profile images, and 8-bit or 16-bit for extended profile
|
||||
+ images. Supporting or not 16-bit precision coefficients is driver-specific.
|
||||
+ Coefficients must be set in JPEG zigzag scan order.
|
||||
+
|
||||
+
|
||||
+.. c:type:: struct v4l2_ctrl_jpeg_quantization
|
||||
+
|
||||
+.. cssclass:: longtable
|
||||
+
|
||||
+.. flat-table:: struct v4l2_ctrl_jpeg_quantization
|
||||
+ :header-rows: 0
|
||||
+ :stub-columns: 0
|
||||
+ :widths: 1 1 2
|
||||
+
|
||||
+ * - __u8
|
||||
+ - ``precision``
|
||||
+ - Specifies the coefficient precision. User shall set 0
|
||||
+ for 8-bit, and 1 for 16-bit.
|
||||
+
|
||||
+ * - __u16
|
||||
+ - ``luma_quantization_matrix[64]``
|
||||
+ - Sets the luma quantization table.
|
||||
+
|
||||
+ * - __u16
|
||||
+ - ``chroma_quantization_matrix[64]``
|
||||
+ - Sets the chroma quantization table.
|
||||
|
||||
.. flat-table::
|
||||
:header-rows: 0
|
||||
diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions
|
||||
index ca9f0edc..a0a38e92 100644
|
||||
--- a/Documentation/media/videodev2.h.rst.exceptions
|
||||
+++ b/Documentation/media/videodev2.h.rst.exceptions
|
||||
@@ -129,6 +129,7 @@ replace symbol V4L2_CTRL_TYPE_STRING :c:type:`v4l2_ctrl_type`
|
||||
replace symbol V4L2_CTRL_TYPE_U16 :c:type:`v4l2_ctrl_type`
|
||||
replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type`
|
||||
replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type`
|
||||
+replace symbol V4L2_CTRL_TYPE_JPEG_QUANTIZATION :c:type:`v4l2_ctrl_type`
|
||||
|
||||
# V4L2 capability defines
|
||||
replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
index 599c1cbf..305bd7a9 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
@@ -999,6 +999,7 @@ const char *v4l2_ctrl_get_name(u32 id)
|
||||
case V4L2_CID_JPEG_RESTART_INTERVAL: return "Restart Interval";
|
||||
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
|
||||
case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers";
|
||||
+ case V4L2_CID_JPEG_QUANTIZATION: return "JPEG Quantization Tables";
|
||||
|
||||
/* Image source controls */
|
||||
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
|
||||
@@ -1286,6 +1287,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
||||
case V4L2_CID_DETECT_MD_REGION_GRID:
|
||||
*type = V4L2_CTRL_TYPE_U8;
|
||||
break;
|
||||
+ case V4L2_CID_JPEG_QUANTIZATION:
|
||||
+ *type = V4L2_CTRL_TYPE_JPEG_QUANTIZATION;
|
||||
+ break;
|
||||
case V4L2_CID_DETECT_MD_THRESHOLD_GRID:
|
||||
*type = V4L2_CTRL_TYPE_U16;
|
||||
break;
|
||||
@@ -1612,6 +1616,9 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||
return -ERANGE;
|
||||
return 0;
|
||||
|
||||
+ case V4L2_CTRL_TYPE_JPEG_QUANTIZATION:
|
||||
+ return 0;
|
||||
+
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2133,6 +2140,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
|
||||
case V4L2_CTRL_TYPE_U32:
|
||||
elem_size = sizeof(u32);
|
||||
break;
|
||||
+ case V4L2_CTRL_TYPE_JPEG_QUANTIZATION:
|
||||
+ elem_size = sizeof(struct v4l2_ctrl_jpeg_quantization);
|
||||
+ break;
|
||||
default:
|
||||
if (type < V4L2_CTRL_COMPOUND_TYPES)
|
||||
elem_size = sizeof(s32);
|
||||
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
|
||||
index e4ee10ee..856b3325 100644
|
||||
--- a/include/uapi/linux/v4l2-controls.h
|
||||
+++ b/include/uapi/linux/v4l2-controls.h
|
||||
@@ -987,6 +987,18 @@ enum v4l2_jpeg_chroma_subsampling {
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
|
||||
|
||||
+#define V4L2_CID_JPEG_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5)
|
||||
+struct v4l2_ctrl_jpeg_quantization {
|
||||
+ /* ITU-T.81 specifies two quantization coefficient precisions:
|
||||
+ * 8-bit for baseline profile,
|
||||
+ * 8-bit or 16-bit for extended profile.
|
||||
+ *
|
||||
+ * User shall set "precision" to 0 for 8-bit and 1 for 16-bit.
|
||||
+ */
|
||||
+ __u8 precision;
|
||||
+ __u16 luma_quantization_matrix[64];
|
||||
+ __u16 chroma_quantization_matrix[64];
|
||||
+};
|
||||
|
||||
/* Image source controls */
|
||||
#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index f271048c..e998d074 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -1630,6 +1630,7 @@ enum v4l2_ctrl_type {
|
||||
V4L2_CTRL_TYPE_U8 = 0x0100,
|
||||
V4L2_CTRL_TYPE_U16 = 0x0101,
|
||||
V4L2_CTRL_TYPE_U32 = 0x0102,
|
||||
+ V4L2_CTRL_TYPE_JPEG_QUANTIZATION = 0x0103,
|
||||
};
|
||||
|
||||
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 3fe37d29b53e3d06c8f4314cfc113bfa679f67eb Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 21:48:05 +0200
|
||||
Subject: [PATCH 15/28] ARM: DTSI: rk3288.dtsi: Add the RGA node
|
||||
|
||||
Imported from @wzyy2 patches.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288.dtsi | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 10ecebb4..455446f6 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -1159,6 +1159,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ rga: rga@ff920000 {
|
||||
+ compatible = "rockchip,rk3288-rga";
|
||||
+ reg = <0x0 0xff920000 0x0 0x180>;
|
||||
+ interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "rga";
|
||||
+ clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;
|
||||
+ clock-names = "aclk", "hclk", "sclk";
|
||||
+ power-domains = <&power RK3288_PD_VIO>;
|
||||
+ resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cru SRST_RGA_AHB>;
|
||||
+
|
||||
+ reset-names = "core", "axi", "ahb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
vpu_mmu: iommu@ff9a0800 {
|
||||
compatible = "rockchip,iommu";
|
||||
reg = <0x0 0xff9a0800 0x0 0x100>;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From d4775f623b25009039a8ef3f28332033c7766ecc Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 22:20:33 +0200
|
||||
Subject: [PATCH 19/28] ARM: DTS: rk3288-tinker.dts: Improving the CPU max
|
||||
voltage
|
||||
|
||||
Taken from the various patches provided by @TonyMac32 .
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288-tinker.dts | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index c552fd95..4ce94698 100644
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -243,7 +243,7 @@
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <750000>;
|
||||
- regulator-max-microvolt = <1350000>;
|
||||
+ regulator-max-microvolt = <1450000>;
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -30,12 +30,12 @@ index 90c1a251..67a3ce6f 100644
|
||||
+ afc0:af-controller@0 {
|
||||
+ status = "okay";
|
||||
+ compatible = "silicon touch,vm149C-v4l2-i2c-subdev";
|
||||
+ reg = <0x0 0x0c>;
|
||||
+ reg = <0x0c>;
|
||||
+ };
|
||||
+
|
||||
+ eeprom:m24c08@50 {
|
||||
+ compatible = "at,24c08";
|
||||
+ reg = <0x0 0x50>;
|
||||
+ reg = <0x50>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
@@ -1,35 +0,0 @@
|
||||
From 8ca607f3fe77c80a3367d8363703d5dc1d6781d4 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 22:36:02 +0200
|
||||
Subject: [PATCH 22/28] ARM: DTS: rk3288-tinker.dts: Add the MIPI DSI node
|
||||
|
||||
Taken from, and tested by @TonyMac32 .
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288-tinker.dts | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index 67a3ce6f..6f4c0843 100644
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -443,6 +443,15 @@
|
||||
sdcard-supply = <&vccio_sd>;
|
||||
};
|
||||
|
||||
+&mipi_dsi {
|
||||
+ status = "okay";
|
||||
+ mipi_panel: mipi-panel {
|
||||
+ compatible ="asus,tc358762";
|
||||
+ reg = <0x0 0>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&sdio0 {
|
||||
status = "okay";
|
||||
clock-frequency = <50000000>;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
From 14f951ca2d354ad8fd068d0f3d8648d5c0d1e60e Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 22:40:26 +0200
|
||||
Subject: [PATCH 23/28] ARM: DTS: rk3288-tinker.dts: Defining the SPI interface
|
||||
|
||||
Taken from, and tested by @TonyMac32 .
|
||||
|
||||
Well, the original one was tested by him but I had to adapt the
|
||||
registers definitions to the new 64-bits LPAE-compliant syntax.
|
||||
|
||||
Therefore that *might* break, along with a few other patches.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288-tinker.dts | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index 6f4c0843..f4b4525c 100644
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -471,6 +471,24 @@
|
||||
|
||||
};
|
||||
|
||||
+&spi2 {
|
||||
+ status = "okay";
|
||||
+ max-freq = <50000000>;
|
||||
+ spidev@0 {
|
||||
+ compatible = "rockchip,spi_tinker";
|
||||
+ reg = <0x0 0>;
|
||||
+ spi-max-frequency = <50000000>;
|
||||
+ spi-cpha = <1>;
|
||||
+ };
|
||||
+ spidev@1 {
|
||||
+ compatible = "rockchip,spi_tinker";
|
||||
+ reg = <0x0 1>;
|
||||
+ spi-max-frequency = <50000000>;
|
||||
+ spi-cpha = <1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+
|
||||
&pinctrl {
|
||||
pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
|
||||
drive-strength = <8>;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 29ef524e8890bbfd24602a61e14234259df92349 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 25 Jun 2018 17:05:37 +0200
|
||||
Subject: [PATCH 25/26] ARM: DTSI: rk3288: Renamed the VPU services clocks
|
||||
|
||||
In order to conform to the naming scheme used in the whole DTSI.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288.dtsi | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 796609e3..45ec4e89 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -1242,7 +1242,7 @@
|
||||
<GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "irq_enc", "irq_dec";
|
||||
clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
|
||||
- clock-names = "aclk_vcodec", "hclk_vcodec";
|
||||
+ clock-names = "aclk", "iface";
|
||||
power-domains = <&power RK3288_PD_VIDEO>;
|
||||
rockchip,grf = <&grf>;
|
||||
resets = <&cru SRST_VCODEC_AXI>, <&cru SRST_VCODEC_AHB>;
|
||||
@@ -1277,8 +1277,8 @@
|
||||
<&cru SCLK_HEVC_CORE>,
|
||||
<&cru SCLK_HEVC_CABAC>;
|
||||
clock-names =
|
||||
- "aclk_vcodec",
|
||||
- "hclk_vcodec",
|
||||
+ "aclk",
|
||||
+ "iface",
|
||||
"clk_core",
|
||||
"clk_cabac";
|
||||
/*
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From d3d3fe433d9038dcd1a98f4d6711c0777ed06703 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 25 Jun 2018 17:08:32 +0200
|
||||
Subject: [PATCH 26/26] ARM: DTSI: rk3288: Set the VPU MMU power domains
|
||||
|
||||
Without that, the auto-activation of the VPU hardware IOMMU fails
|
||||
when enabling the hardware, before the "probe" phase of its device
|
||||
driver.
|
||||
|
||||
Basically, when loading a "of_platform" device driver targeting
|
||||
the VPU devices, you'll get these errors without this patch :
|
||||
|
||||
[12753.996950] rk_iommu ff9c0440.iommu: Error during raw reset. MMU_DTE_ADDR is not functioning
|
||||
[12754.007483] rk_iommu ff9c0440.iommu: Disable stall request timed out, status: 0xffffffff
|
||||
[12754.026652] rk_iommu ff9c0440.iommu: Disable paging request timed out, status: 0xffffffff
|
||||
[12754.045975] rk_iommu ff9c0440.iommu: Disable stall request timed out, status: 0xffffffff
|
||||
|
||||
When using this patch, the errors disappear.
|
||||
|
||||
This seems to be due to the IOMMU device sharing the same power domain
|
||||
than the device.
|
||||
When loading an "of_platform" driver, the kernel logic seems to try
|
||||
enabling the associated IOMMU device before letting the driver handles
|
||||
anything with the actual VPU hardware.
|
||||
It appears that setting the power domain of the VPU IOMMU nodes let the
|
||||
IOMMU driver enable the IOMMU shared power domain, and make the IOMMU
|
||||
device useable.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288.dtsi | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 45ec4e89..46e1b8e2 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -1230,6 +1230,7 @@
|
||||
interrupt-names = "vpu_mmu";
|
||||
clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
|
||||
clock-names = "aclk", "iface";
|
||||
+ power-domains = <&power RK3288_PD_VIDEO>;
|
||||
#iommu-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -1262,6 +1263,7 @@
|
||||
interrupt-names = "hevc_mmu";
|
||||
clocks = <&cru ACLK_HEVC>, <&cru HCLK_HEVC>;
|
||||
clock-names = "aclk", "iface";
|
||||
+ power-domains = <&power RK3288_PD_HEVC>;
|
||||
#iommu-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 7f8607ba9a20f8ddb5c24559d9b875af762d4717 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Tue, 11 Sep 2018 02:55:55 +0200
|
||||
Subject: [PATCH] ARM: dtsi: The VPU service as defined in the V4L2 driver
|
||||
|
||||
Let's try the V4L2 road.
|
||||
They've got a lot of things ready, like an entire H264
|
||||
movie with the V4L2 data of *every frame*.
|
||||
|
||||
That might help in this endless endeavour.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rk3288.dtsi | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 72c36af6..d23c7fa5 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -1246,7 +1246,18 @@
|
||||
clock-names = "aclk", "iface";
|
||||
power-domains = <&power RK3288_PD_VIDEO>;
|
||||
#iommu-cells = <0>;
|
||||
- status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ vpu: video-codec@ff9a0000 {
|
||||
+ clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
|
||||
+ clock-names = "aclk", "hclk";
|
||||
+ compatible = "rockchip,rk3288-vpu";
|
||||
+ interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "vepu", "vdpu";
|
||||
+ iommus = <&vpu_mmu>;
|
||||
+ power-domains = <&power RK3288_PD_VIDEO>;
|
||||
+ reg = <0x0 0xff9a0000 0x0 0x800>;
|
||||
};
|
||||
|
||||
hevc_mmu: iommu@ff9c0440 {
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index 925b277..33b198e 100644
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -100,6 +100,12 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ rk3288-gpiomem {
|
||||
+ compatible = "rockchip,rk3288-gpiomem";
|
||||
+ reg = <0x0 0xff750000 0x0 0x1000>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
@@ -1,364 +0,0 @@
|
||||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
|
||||
index c28dca0..d9df49d 100644
|
||||
--- a/drivers/char/Kconfig
|
||||
+++ b/drivers/char/Kconfig
|
||||
@@ -6,6 +6,7 @@
|
||||
menu "Character devices"
|
||||
|
||||
source "drivers/tty/Kconfig"
|
||||
+source "drivers/char/rockchip/Kconfig"
|
||||
|
||||
config DEVMEM
|
||||
bool "/dev/mem virtual device support"
|
||||
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
|
||||
index 7dc3abe..5d43b1d 100644
|
||||
--- a/drivers/char/Makefile
|
||||
+++ b/drivers/char/Makefile
|
||||
@@ -60,3 +60,5 @@ js-rtc-y = rtc.o
|
||||
obj-$(CONFIG_TILE_SROM) += tile-srom.o
|
||||
obj-$(CONFIG_XILLYBUS) += xillybus/
|
||||
obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
|
||||
+
|
||||
+obj-$(CONFIG_RK_CHAR_DRIVERS) += rockchip/
|
||||
diff --git a/drivers/char/rockchip/Kconfig b/drivers/char/rockchip/Kconfig
|
||||
new file mode 100644
|
||||
index 0000000..867d51e
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/Kconfig
|
||||
@@ -0,0 +1,16 @@
|
||||
+#
|
||||
+# Broadcom char driver config
|
||||
+#
|
||||
+
|
||||
+menuconfig RK_CHAR_DRIVERS
|
||||
+ bool "Rockchip Char Drivers"
|
||||
+ help
|
||||
+ Rockchip's char drivers
|
||||
+
|
||||
+config RK3288_DEVGPIOMEM
|
||||
+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the RK3288"
|
||||
+ default y
|
||||
+ help
|
||||
+ Provides users with root-free access to the GPIO registers
|
||||
+ on the 3288. Calling mmap(/dev/gpiomem) will map the GPIO
|
||||
+ register page to the user's pointer.
|
||||
diff --git a/drivers/char/rockchip/Makefile b/drivers/char/rockchip/Makefile
|
||||
new file mode 100644
|
||||
index 0000000..e7df7f2
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/Makefile
|
||||
@@ -0,0 +1 @@
|
||||
+obj-$(CONFIG_RK3288_DEVGPIOMEM)+= rk3288-gpiomem.o
|
||||
diff --git a/drivers/char/rockchip/rk3288-gpiomem.c b/drivers/char/rockchip/rk3288-gpiomem.c
|
||||
new file mode 100644
|
||||
index 0000000..c289041
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/rk3288-gpiomem.c
|
||||
@@ -0,0 +1,307 @@
|
||||
+/**
|
||||
+ * GPIO memory device driver
|
||||
+ *
|
||||
+ * Creates a chardev /dev/gpiomem which will provide user access to
|
||||
+ * the rk3288's GPIO registers when it is mmap()'d.
|
||||
+ * No longer need root for user GPIO access, but without relaxing permissions
|
||||
+ * on /dev/mem.
|
||||
+ *
|
||||
+ * Written by Luke Wren <luke@raspberrypi.org>
|
||||
+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions, and the following disclaimer,
|
||||
+ * without modification.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ * 3. The names of the above-listed copyright holders may not be used
|
||||
+ * to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
+ * GNU General Public License ("GPL") version 2, as published by the Free
|
||||
+ * Software Foundation.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * Ported to rk3288 from Jörg Wolff, 2017
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/mm.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/cdev.h>
|
||||
+#include <linux/pagemap.h>
|
||||
+#include <linux/io.h>
|
||||
+
|
||||
+#define DEVICE_NAME "rk3288-gpiomem"
|
||||
+#define DRIVER_NAME "gpiomem-rk3288"
|
||||
+#define DEVICE_MINOR 0
|
||||
+
|
||||
+struct rk3288_gpiomem_instance {
|
||||
+ unsigned long gpio_regs_phys;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static struct cdev rk3288_gpiomem_cdev;
|
||||
+static dev_t rk3288_gpiomem_devid;
|
||||
+static struct class *rk3288_gpiomem_class;
|
||||
+static struct device *rk3288_gpiomem_dev;
|
||||
+static struct rk3288_gpiomem_instance *inst;
|
||||
+
|
||||
+
|
||||
+/****************************************************************************
|
||||
+*
|
||||
+* GPIO mem chardev file ops
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+static int rk3288_gpiomem_open(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device: %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_release(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct vm_operations_struct rk3288_gpiomem_vm_ops = {
|
||||
+#ifdef CONFIG_HAVE_IOREMAP_PROT
|
||||
+ .access = generic_access_phys
|
||||
+#endif
|
||||
+};
|
||||
+static int address_is_allowed(unsigned long pfn, unsigned long size)
|
||||
+{
|
||||
+ unsigned long address = pfn << PAGE_SHIFT;
|
||||
+
|
||||
+ dev_info(inst->dev, "address_is_allowed.pfn: 0x%08lx", address);
|
||||
+
|
||||
+ switch(address) {
|
||||
+
|
||||
+ case 0xff750000:
|
||||
+ case 0xff760000:
|
||||
+ case 0xff780000:
|
||||
+ case 0xff790000:
|
||||
+ case 0xff7a0000:
|
||||
+ case 0xff7b0000:
|
||||
+ case 0xff7c0000:
|
||||
+ case 0xff7d0000:
|
||||
+ case 0xff7e0000:
|
||||
+ case 0xff7f0000:
|
||||
+ case 0xff7f2000:
|
||||
+ case 0xff770000:
|
||||
+ case 0xff730000:
|
||||
+ case 0xff680000:
|
||||
+ dev_info(inst->dev, "address_is_allowed.return 1");
|
||||
+ return 1;
|
||||
+ break;
|
||||
+ default :
|
||||
+ dev_info(inst->dev, "address_is_allowed.return 0");
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
+{
|
||||
+
|
||||
+ size_t size;
|
||||
+
|
||||
+ size = vma->vm_end - vma->vm_start;
|
||||
+
|
||||
+
|
||||
+ if (!address_is_allowed(vma->vm_pgoff, size))
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
|
||||
+ size,
|
||||
+ vma->vm_page_prot);
|
||||
+
|
||||
+ vma->vm_ops = &rk3288_gpiomem_vm_ops;
|
||||
+
|
||||
+ /* Remap-pfn-range will mark the range VM_IO */
|
||||
+ if (remap_pfn_range(vma,
|
||||
+ vma->vm_start,
|
||||
+ vma->vm_pgoff,
|
||||
+ size,
|
||||
+ vma->vm_page_prot)) {
|
||||
+ return -EAGAIN;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct file_operations
|
||||
+rk3288_gpiomem_fops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .open = rk3288_gpiomem_open,
|
||||
+ .release = rk3288_gpiomem_release,
|
||||
+ .mmap = rk3288_gpiomem_mmap,
|
||||
+};
|
||||
+
|
||||
+static int rk3288_gpiomem_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
+{
|
||||
+ add_uevent_var(env, "DEVMODE=%#o", 0660);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+ /****************************************************************************
|
||||
+*
|
||||
+* Probe and remove functions
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+
|
||||
+static int rk3288_gpiomem_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int err;
|
||||
+ void *ptr_err;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct resource *ioresource;
|
||||
+
|
||||
+ /* Allocate buffers and instance data */
|
||||
+
|
||||
+ inst = kzalloc(sizeof(struct rk3288_gpiomem_instance), GFP_KERNEL);
|
||||
+
|
||||
+ if (!inst) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto failed_inst_alloc;
|
||||
+ }
|
||||
+
|
||||
+ inst->dev = dev;
|
||||
+
|
||||
+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (ioresource) {
|
||||
+ inst->gpio_regs_phys = ioresource->start;
|
||||
+ } else {
|
||||
+ dev_err(inst->dev, "failed to get IO resource");
|
||||
+ err = -ENOENT;
|
||||
+ goto failed_get_resource;
|
||||
+ }
|
||||
+
|
||||
+ /* Create character device entries */
|
||||
+
|
||||
+ err = alloc_chrdev_region(&rk3288_gpiomem_devid,
|
||||
+ DEVICE_MINOR, 1, DEVICE_NAME);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to allocate device number");
|
||||
+ goto failed_alloc_chrdev;
|
||||
+ }
|
||||
+ cdev_init(&rk3288_gpiomem_cdev, &rk3288_gpiomem_fops);
|
||||
+ rk3288_gpiomem_cdev.owner = THIS_MODULE;
|
||||
+ err = cdev_add(&rk3288_gpiomem_cdev, rk3288_gpiomem_devid, 1);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to register device");
|
||||
+ goto failed_cdev_add;
|
||||
+ }
|
||||
+
|
||||
+ /* Create sysfs entries */
|
||||
+
|
||||
+ rk3288_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME);
|
||||
+ ptr_err = rk3288_gpiomem_class;
|
||||
+ if (IS_ERR(ptr_err))
|
||||
+ goto failed_class_create;
|
||||
+ rk3288_gpiomem_class->dev_uevent = rk3288_gpiomem_dev_uevent;
|
||||
+ rk3288_gpiomem_dev = device_create(rk3288_gpiomem_class, NULL,
|
||||
+ rk3288_gpiomem_devid, NULL,
|
||||
+ "gpiomem");
|
||||
+ ptr_err = rk3288_gpiomem_dev;
|
||||
+ if (IS_ERR(ptr_err))
|
||||
+ goto failed_device_create;
|
||||
+
|
||||
+ dev_info(inst->dev, "Initialised: Registers at 0x%08lx",
|
||||
+ inst->gpio_regs_phys);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+failed_device_create:
|
||||
+ class_destroy(rk3288_gpiomem_class);
|
||||
+failed_class_create:
|
||||
+ cdev_del(&rk3288_gpiomem_cdev);
|
||||
+ err = PTR_ERR(ptr_err);
|
||||
+failed_cdev_add:
|
||||
+ unregister_chrdev_region(rk3288_gpiomem_devid, 1);
|
||||
+failed_alloc_chrdev:
|
||||
+failed_get_resource:
|
||||
+ kfree(inst);
|
||||
+failed_inst_alloc:
|
||||
+ dev_err(inst->dev, "could not load rk3288_gpiomem");
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = inst->dev;
|
||||
+
|
||||
+ kfree(inst);
|
||||
+ device_destroy(rk3288_gpiomem_class, rk3288_gpiomem_devid);
|
||||
+ class_destroy(rk3288_gpiomem_class);
|
||||
+ cdev_del(&rk3288_gpiomem_cdev);
|
||||
+ unregister_chrdev_region(rk3288_gpiomem_devid, 1);
|
||||
+
|
||||
+ dev_info(dev, "GPIO mem driver removed - OK");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+ /****************************************************************************
|
||||
+*
|
||||
+* Register the driver with device tree
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+static const struct of_device_id rk3288_gpiomem_of_match[] = {
|
||||
+ {.compatible = "rockchip,rk3288-gpiomem",},
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+MODULE_DEVICE_TABLE(of, rk3288_gpiomem_of_match);
|
||||
+
|
||||
+static struct platform_driver rk3288_gpiomem_driver = {
|
||||
+ .probe = rk3288_gpiomem_probe,
|
||||
+ .remove = rk3288_gpiomem_remove,
|
||||
+ .driver = {
|
||||
+ .name = DRIVER_NAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rk3288_gpiomem_of_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(rk3288_gpiomem_driver);
|
||||
+
|
||||
+MODULE_ALIAS("platform:gpiomem-rk3288");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace");
|
||||
+MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>");
|
||||
@@ -0,0 +1,45 @@
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index 2601316da..08ec7aa4b 100644
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -210,8 +210,8 @@
|
||||
vdd_cpu: DCDC_REG1 {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <750000>;
|
||||
- regulator-max-microvolt = <1450000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
@@ -222,8 +222,8 @@
|
||||
vdd_gpu: DCDC_REG2 {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <850000>;
|
||||
- regulator-max-microvolt = <1250000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-name = "vdd_gpu";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 22bcaaa29..2fcd46098 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -149,6 +149,14 @@
|
||||
opp-hz = /bits/ 64 <1608000000>;
|
||||
opp-microvolt = <1350000>;
|
||||
};
|
||||
+ opp@1704000000 {
|
||||
+ opp-hz = /bits/ 64 <1704000000>;
|
||||
+ opp-microvolt = <1350000>;
|
||||
+ };
|
||||
+ opp@1800000000 {
|
||||
+ opp-hz = /bits/ 64 <1800000000>;
|
||||
+ opp-microvolt = <1400000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
amba {
|
||||
@@ -1,19 +1,19 @@
|
||||
diff --git a/sound/usb/card.c b/sound/usb/card.c
|
||||
index 23d1d23..98610ae 100644
|
||||
index 2bfe4e80a..cea93aaf5 100644
|
||||
--- a/sound/usb/card.c
|
||||
+++ b/sound/usb/card.c
|
||||
@@ -434,6 +434,14 @@ static int snd_usb_audio_create(struct usb_interface *intf,
|
||||
@@ -382,6 +382,14 @@ static void usb_audio_make_shortname(struct usb_device *dev,
|
||||
}
|
||||
strim(card->shortname);
|
||||
|
||||
strim(card->shortname);
|
||||
+
|
||||
+ /* Tinker Board ALC4040 CODEC */
|
||||
+
|
||||
+ if(USB_ID_VENDOR(chip->usb_id) == 0x0bda &&
|
||||
+ USB_ID_PRODUCT(chip->usb_id) == 0x481a) {
|
||||
+ strlcat(card->shortname, " OnBoard", sizeof(card->shortname));
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/* retrieve the vendor and device strings as longname */
|
||||
if (quirk && quirk->vendor_name && *quirk->vendor_name) {
|
||||
len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
static void usb_audio_make_longname(struct usb_device *dev,
|
||||
@@ -0,0 +1,37 @@
|
||||
From 24d6638302b48328a58c13439276d4531af4ca7d Mon Sep 17 00:00:00 2001
|
||||
From: Katsuhiro Suzuki <katsuhiro@katsuster.net>
|
||||
Date: Tue, 11 Sep 2018 01:39:32 +0900
|
||||
Subject: ASoC: rockchip: add missing INTERLEAVED PCM attribute
|
||||
|
||||
This patch adds SNDRV_PCM_INFO_INTERLEAVED into PCM hardware info.
|
||||
|
||||
Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
sound/soc/rockchip/rockchip_pcm.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
(limited to 'sound/soc/rockchip')
|
||||
|
||||
Armbian Note: this patch has been backported from 4.20 to 4.19 due to break in rockchip HDMI/I2S audio. This
|
||||
can be safely removed once there is a new kernel bump.
|
||||
Origin: <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/sound/soc/rockchip?h=linux-4.20.y&id=24d6638302b48328a58c13439276d4531af4ca7d>
|
||||
|
||||
diff --git a/sound/soc/rockchip/rockchip_pcm.c b/sound/soc/rockchip/rockchip_pcm.c
|
||||
index f77538319221..9e7b5fa4cf59 100644
|
||||
--- a/sound/soc/rockchip/rockchip_pcm.c
|
||||
+++ b/sound/soc/rockchip/rockchip_pcm.c
|
||||
@@ -21,7 +21,8 @@ static const struct snd_pcm_hardware snd_rockchip_hardware = {
|
||||
.info = SNDRV_PCM_INFO_MMAP |
|
||||
SNDRV_PCM_INFO_MMAP_VALID |
|
||||
SNDRV_PCM_INFO_PAUSE |
|
||||
- SNDRV_PCM_INFO_RESUME,
|
||||
+ SNDRV_PCM_INFO_RESUME |
|
||||
+ SNDRV_PCM_INFO_INTERLEAVED,
|
||||
.period_bytes_min = 32,
|
||||
.period_bytes_max = 8192,
|
||||
.periods_min = 1,
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
index 07b4af4..f71fa24
|
||||
--- a/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rk3288-tinker.dts
|
||||
@@ -175,10 +175,83 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+ cpu0_opp_table: opp_table {
|
||||
+ compatible = "operating-points-v2";
|
||||
+ opp-shared;
|
||||
+
|
||||
+ opp@600000000 {
|
||||
+ opp-hz = /bits/ 64 <600000000>;
|
||||
+ opp-microvolt = <900000>;
|
||||
+ };
|
||||
+ opp@816000000 {
|
||||
+ opp-hz = /bits/ 64 <816000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+ opp@1008000000 {
|
||||
+ opp-hz = /bits/ 64 <1008000000>;
|
||||
+ opp-microvolt = <1050000>;
|
||||
+ };
|
||||
+ opp@1200000000 {
|
||||
+ opp-hz = /bits/ 64 <1200000000>;
|
||||
+ opp-microvolt = <1100000>;
|
||||
+ };
|
||||
+ opp@1416000000 {
|
||||
+ opp-hz = /bits/ 64 <1416000000>;
|
||||
+ opp-microvolt = <1200000>;
|
||||
+ };
|
||||
+ opp@1512000000 {
|
||||
+ opp-hz = /bits/ 64 <1512000000>;
|
||||
+ opp-microvolt = <1250000>;
|
||||
+ };
|
||||
+ opp@1608000000 {
|
||||
+ opp-hz = /bits/ 64 <1608000000>;
|
||||
+ opp-microvolt = <1300000>;
|
||||
+ };
|
||||
+ opp@1704000000 {
|
||||
+ opp-hz = /bits/ 64 <1704000000>;
|
||||
+ opp-microvolt = <1350000>;
|
||||
+ };
|
||||
+ opp@1800000000 {
|
||||
+ opp-hz = /bits/ 64 <1800000000>;
|
||||
+ opp-microvolt = <1400000>;
|
||||
+ };
|
||||
+ /* boot-only frequencies below */
|
||||
+ opp@1896000000 {
|
||||
+ opp-hz = /bits/ 64 <1896000000>;
|
||||
+ opp-microvolt = <1425000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ opp@1920000000 {
|
||||
+ opp-hz = /bits/ 64 <1920000000>;
|
||||
+ opp-microvolt = <1425000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ opp@1992000000 {
|
||||
+ opp-hz = /bits/ 64 <1992000000>;
|
||||
+ opp-microvolt = <1450000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ opp@2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1475000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ opp@2040000000 {
|
||||
+ opp-hz = /bits/ 64 <2040000000>;
|
||||
+ opp-microvolt = <1475000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ opp@2064000000 {
|
||||
+ opp-hz = /bits/ 64 <2064000000>;
|
||||
+ opp-microvolt = <1475000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
cpu0-supply = <&vdd_cpu>;
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
|
||||
&gmac {
|
||||
@@ -345,8 +345,8 @@
|
||||
vdd_cpu: DCDC_REG1 {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <750000>;
|
||||
- regulator-max-microvolt = <1350000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
@@ -357,8 +357,8 @@
|
||||
vdd_gpu: DCDC_REG2 {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <850000>;
|
||||
- regulator-max-microvolt = <1250000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-name = "vdd_gpu";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
@@ -652,6 +755,11 @@
|
||||
};
|
||||
|
||||
&usb_otg {
|
||||
+ /*
|
||||
+ * The otg controller is the only system power source,
|
||||
+ * so needs to always stay in device mode.
|
||||
+ */
|
||||
+ dr_mode = "peripheral";
|
||||
status= "okay";
|
||||
};
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/sound/soc/rockchip/rk3288_hdmi_analog.c b/sound/soc/rockchip/rk3288_hdmi_analog.c
|
||||
index fa44e3901336..929b3fe289b0 100644
|
||||
--- a/sound/soc/rockchip/rk3288_hdmi_analog.c
|
||||
+++ b/sound/soc/rockchip/rk3288_hdmi_analog.c
|
||||
@@ -155,7 +155,7 @@ static struct snd_soc_dai_link_component rk_codecs[] = {
|
||||
{ },
|
||||
{
|
||||
.name = "hdmi-audio-codec.2.auto",
|
||||
- .dai_name = "hdmi-hifi.0",
|
||||
+ .dai_name = "i2s-hifi",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index eff87a3..58fade2 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -762,6 +762,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk3288-r89.dtb \
|
||||
rk3288-rock2-square.dtb \
|
||||
rk3288-tinker.dtb \
|
||||
+ rk3288-miniarm.dtb \
|
||||
rk3288-veyron-brain.dtb \
|
||||
rk3288-veyron-jaq.dtb \
|
||||
rk3288-veyron-jerry.dtb \
|
||||
diff --git a/arch/arm/boot/dts/rk3288-miniarm.dts b/arch/arm/boot/dts/rk3288-miniarm.dts
|
||||
new file mode 120000
|
||||
index 0000000..830ab68
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/rk3288-miniarm.dts
|
||||
@@ -0,0 +1 @@
|
||||
+rk3288-tinker.dts
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,31 @@
|
||||
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
|
||||
index 0840ffb3..5393f2cd 100644
|
||||
--- a/arch/arm/boot/dts/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rk3288.dtsi
|
||||
@@ -894,6 +894,8 @@
|
||||
reg = <0x320>;
|
||||
clocks = <&cru SCLK_OTGPHY0>;
|
||||
clock-names = "phyclk";
|
||||
+ resets = <&cru SRST_USBOTG_PHY>;
|
||||
+ reset-names = "phy-reset";
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
|
||||
@@ -902,6 +904,8 @@
|
||||
reg = <0x334>;
|
||||
clocks = <&cru SCLK_OTGPHY1>;
|
||||
clock-names = "phyclk";
|
||||
+ resets = <&cru SRST_USBHOST0_PHY>;
|
||||
+ reset-names = "phy-reset";
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
|
||||
@@ -910,6 +914,8 @@
|
||||
reg = <0x348>;
|
||||
clocks = <&cru SCLK_OTGPHY2>;
|
||||
clock-names = "phyclk";
|
||||
+ resets = <&cru SRST_USBHOST1_PHY>;
|
||||
+ reset-names = "phy-reset";
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
|
||||
index cc9c93af..3ff41d87 100644
|
||||
--- a/drivers/usb/dwc2/core.h
|
||||
+++ b/drivers/usb/dwc2/core.h
|
||||
@@ -1021,6 +1021,7 @@ struct dwc2_hsotg {
|
||||
u16 frame_number;
|
||||
|
||||
struct phy *phy;
|
||||
+ struct work_struct phy_rst_work;
|
||||
struct usb_phy *uphy;
|
||||
struct dwc2_hsotg_plat *plat;
|
||||
struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES];
|
||||
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
|
||||
index 19ae2595..f1270bf1 100644
|
||||
--- a/drivers/usb/dwc2/core_intr.c
|
||||
+++ b/drivers/usb/dwc2/core_intr.c
|
||||
@@ -396,6 +396,7 @@ static void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg)
|
||||
static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
int ret;
|
||||
+ struct device_node *np = hsotg->dev->of_node;
|
||||
|
||||
/* Clear interrupt */
|
||||
dwc2_writel(hsotg, GINTSTS_WKUPINT, GINTSTS);
|
||||
@@ -435,6 +436,16 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
|
||||
/* Restart the Phy Clock */
|
||||
pcgcctl &= ~PCGCTL_STOPPCLK;
|
||||
dwc2_writel(hsotg, pcgcctl, PCGCTL);
|
||||
+
|
||||
+ /*
|
||||
+ * It is a quirk in Rockchip RK3288, causing by
|
||||
+ * a hardware bug. This will propagate out and
|
||||
+ * eventually we'll re-enumerate the device.
|
||||
+ * Not great but the best we can do.
|
||||
+ */
|
||||
+ if (of_device_is_compatible(np, "rockchip,rk3288-usb"))
|
||||
+ schedule_work(&hsotg->phy_rst_work);
|
||||
+
|
||||
mod_timer(&hsotg->wkp_timer,
|
||||
jiffies + msecs_to_jiffies(71));
|
||||
} else {
|
||||
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
|
||||
index 57764289..748763bd 100644
|
||||
--- a/drivers/usb/dwc2/platform.c
|
||||
+++ b/drivers/usb/dwc2/platform.c
|
||||
@@ -208,6 +208,14 @@ int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/* Only used to reset usb phy at interrupter runtime */
|
||||
+static void dwc2_reset_phy_work(struct work_struct *data)
|
||||
+{
|
||||
+ struct dwc2_hsotg *hsotg = container_of(data, struct dwc2_hsotg,
|
||||
+ phy_rst_work);
|
||||
+ phy_reset(hsotg->phy);
|
||||
+}
|
||||
+
|
||||
static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
int i, ret;
|
||||
@@ -252,6 +260,7 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
+ INIT_WORK(&hsotg->phy_rst_work, dwc2_reset_phy_work);
|
||||
|
||||
if (!hsotg->phy) {
|
||||
hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2);
|
||||
@@ -0,0 +1,665 @@
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 2d0b2f4c4..d5c9022e7 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -859,6 +859,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk3288-firefly-beta.dtb \
|
||||
rk3288-firefly.dtb \
|
||||
rk3288-firefly-reload.dtb \
|
||||
+ rk3288-miniarm.dtb \
|
||||
rk3288-miqi.dtb \
|
||||
rk3288-phycore-rdk.dtb \
|
||||
rk3288-popmetal.dtb \
|
||||
diff --git a/arch/arm/boot/dts/rk3288-miniarm.dts b/arch/arm/boot/dts/rk3288-miniarm.dts
|
||||
new file mode 100644
|
||||
index 000000000..d0961c35d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/rk3288-miniarm.dts
|
||||
@@ -0,0 +1,647 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "rk3288.dtsi"
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+#include <dt-bindings/clock/rockchip,rk808.h>
|
||||
+
|
||||
+/ {
|
||||
+ model = "Rockchip RK3288 Tinker Board";
|
||||
+ compatible = "asus,rk3288-tinker", "rockchip,rk3288";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial2:115200n8";
|
||||
+ };
|
||||
+
|
||||
+ memory {
|
||||
+ reg = <0x0 0x0 0x0 0x80000000>;
|
||||
+ device_type = "memory";
|
||||
+ };
|
||||
+
|
||||
+ ext_gmac: external-gmac-clock {
|
||||
+ compatible = "fixed-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <125000000>;
|
||||
+ clock-output-names = "ext_gmac";
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ autorepeat;
|
||||
+
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwrbtn>;
|
||||
+
|
||||
+ button@0 {
|
||||
+ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_POWER>;
|
||||
+ label = "GPIO Key Power";
|
||||
+ linux,input-type = <1>;
|
||||
+ wakeup-source;
|
||||
+ debounce-interval = <100>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpio-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ act-led {
|
||||
+ gpios=<&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger="mmc0";
|
||||
+ };
|
||||
+
|
||||
+ heartbeat-led {
|
||||
+ gpios=<&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger="heartbeat";
|
||||
+ };
|
||||
+
|
||||
+ pwr-led {
|
||||
+ gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "default-on";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,name = "rockchip,tinker-codec";
|
||||
+ simple-audio-card,mclk-fs = <512>;
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /* This is essential to get SDIO devices working.
|
||||
+ The Wifi depends on SDIO ! */
|
||||
+ sdio_pwrseq: sdio-pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ clocks = <&rk808 RK808_CLKOUT1>;
|
||||
+ clock-names = "ext_clock";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&chip_enable_h>, <&wifi_enable_h>;
|
||||
+
|
||||
+ /*
|
||||
+ * On the module itself this is one of these (depending
|
||||
+ * on the actual card populated):
|
||||
+ * - SDIO_RESET_L_WL_REG_ON
|
||||
+ * - PDN (power down when low)
|
||||
+ */
|
||||
+ reset-gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>, <&gpio4 RK_PD3 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ vcc_sys: vsys-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc_sys";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ vcc_sd: sdmmc-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_pwr>;
|
||||
+ regulator-name = "vcc_sd";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ startup-delay-us = <100000>;
|
||||
+ vin-supply = <&vcc_io>;
|
||||
+ };
|
||||
+
|
||||
+ wireless-wlan {
|
||||
+ compatible = "wlan-platdata";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ wifi_chip_type = "8723bs";
|
||||
+ sdio_vref = <1800>;
|
||||
+ WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+/*
|
||||
+ wireless-bluetooth {
|
||||
+ compatible = "bluetooth-platdata";
|
||||
+ uart_rts_gpios = <&gpio4 19 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-names = "default","rts_gpio";
|
||||
+ pinctrl-0 = <&uart0_rts>;
|
||||
+ pinctrl-1 = <&uart0_gpios>;
|
||||
+ BT,reset_gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
|
||||
+ BT,wake_gpio = <&gpio4 26 GPIO_ACTIVE_HIGH>;
|
||||
+ BT,wake_host_irq = <&gpio4 31 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+*/
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&cpu0 {
|
||||
+ cpu0-supply = <&vdd_cpu>;
|
||||
+};
|
||||
+
|
||||
+&gmac {
|
||||
+ assigned-clocks = <&cru SCLK_MAC>;
|
||||
+ assigned-clock-parents = <&ext_gmac>;
|
||||
+ clock_in_out = "input";
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-supply = <&vcc33_lan>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins>;
|
||||
+ snps,reset-gpio = <&gpio4 7 0>;
|
||||
+ snps,reset-active-low;
|
||||
+ snps,reset-delays-us = <0 10000 1000000>;
|
||||
+ tx_delay = <0x30>;
|
||||
+ rx_delay = <0x10>;
|
||||
+ status = "ok";
|
||||
+};
|
||||
+
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_gpu>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ ddc-i2c-bus = <&i2c5>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ rk808: pmic@1b {
|
||||
+ compatible = "rockchip,rk808";
|
||||
+ reg = <0x1b>;
|
||||
+ interrupt-parent = <&gpio0>;
|
||||
+ interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ #clock-cells = <1>;
|
||||
+ clock-output-names = "xin32k", "rk808-clkout2";
|
||||
+ dvs-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>,
|
||||
+ <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pmic_int &global_pwroff &dvs_1 &dvs_2>;
|
||||
+ rockchip,system-power-controller;
|
||||
+ wakeup-source;
|
||||
+
|
||||
+ vcc1-supply = <&vcc_sys>;
|
||||
+ vcc2-supply = <&vcc_sys>;
|
||||
+ vcc3-supply = <&vcc_sys>;
|
||||
+ vcc4-supply = <&vcc_sys>;
|
||||
+ vcc6-supply = <&vcc_sys>;
|
||||
+ vcc7-supply = <&vcc_sys>;
|
||||
+ vcc8-supply = <&vcc_io>;
|
||||
+ vcc9-supply = <&vcc_io>;
|
||||
+ vcc10-supply = <&vcc_io>;
|
||||
+ vcc11-supply = <&vcc_sys>;
|
||||
+ vcc12-supply = <&vcc_io>;
|
||||
+ vddio-supply = <&vcc_io>;
|
||||
+
|
||||
+ regulators {
|
||||
+ vdd_cpu: DCDC_REG1 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
+ regulator-name = "vdd_arm";
|
||||
+ regulator-ramp-delay = <6000>;
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_gpu: DCDC_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
+ regulator-name = "vdd_gpu";
|
||||
+ regulator-ramp-delay = <6000>;
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_ddr: DCDC_REG3 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc_ddr";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_io: DCDC_REG4 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vcc_io";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3300000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_ldo1: LDO_REG1 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_ldo1";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_mipi: LDO_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vcc33_mipi";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_10: LDO_REG3 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-name = "vdd_10";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_codec: LDO_REG4 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_codec";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vccio_sd: LDO_REG5 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vccio_sd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3300000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd10_lcd: LDO_REG6 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-name = "vdd10_lcd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_18: LDO_REG7 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc_18";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_lcd: LDO_REG8 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-name = "vcc18_lcd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_sd: SWITCH_REG1 {
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc33_sd";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc33_lan: SWITCH_REG2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-name = "vcc33_lan";
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ afc0:af-controller@0 {
|
||||
+ status = "okay";
|
||||
+ compatible = "silicon touch,vm149C-v4l2-i2c-subdev";
|
||||
+ reg = <0x0c>;
|
||||
+ };
|
||||
+
|
||||
+ eeprom:m24c08@50 {
|
||||
+ compatible = "at,24c08";
|
||||
+ reg = <0x50>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c3 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c4 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c5 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2s {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&io_domains {
|
||||
+ status = "okay";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ wifi-supply = <&vcc_18>;
|
||||
+ sdcard-supply = <&vccio_sd>;
|
||||
+};
|
||||
+
|
||||
+&sdio0 {
|
||||
+ status = "okay";
|
||||
+ clock-frequency = <50000000>;
|
||||
+ clock-freq-min-max = <200000 50000000>;
|
||||
+ bus-width = <4>;
|
||||
+ cap-sd-highspeed;
|
||||
+ cap-sdio-irq;
|
||||
+ disable-wp;
|
||||
+ keep-power-in-suspend;
|
||||
+ mmc-pwrseq = <&sdio_pwrseq>;
|
||||
+ non-removable;
|
||||
+ num-slots = <1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
|
||||
+ sd-uhs-sdr104;
|
||||
+ supports-sdio;
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
|
||||
+ bias-pull-up;
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ backlight {
|
||||
+ bl_en: bl-en {
|
||||
+ rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ buttons {
|
||||
+ pwrbtn: pwrbtn {
|
||||
+ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ eth_phy {
|
||||
+ eth_phy_pwr: eth-phy-pwr {
|
||||
+ rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pmic {
|
||||
+ pmic_int: pmic-int {
|
||||
+ rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ dvs_1: dvs-1 {
|
||||
+ rockchip,pins = <RK_GPIO0 11 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ dvs_2: dvs-2 {
|
||||
+ rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO \
|
||||
+ &pcfg_pull_down>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sdio-pwrseq {
|
||||
+ wifi_enable_h: wifienable-h {
|
||||
+ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ chip_enable_h: chip-enable-h {
|
||||
+ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sdmmc {
|
||||
+ sdmmc_bus4: sdmmc-bus4 {
|
||||
+ rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_clk: sdmmc-clk {
|
||||
+ rockchip,pins = <6 20 RK_FUNC_1 \
|
||||
+ &pcfg_pull_none_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_cmd: sdmmc-cmd {
|
||||
+ rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_pwr: sdmmc-pwr {
|
||||
+ rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ usb {
|
||||
+ host_vbus_drv: host-vbus-drv {
|
||||
+ rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ pwr_3g: pwr-3g {
|
||||
+ rockchip,pins = <7 8 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ wireless-bluetooth {
|
||||
+ uart0_gpios: uart0-gpios {
|
||||
+ rockchip,pins = <4 19 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&pwm0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&saradc {
|
||||
+ vref-supply = <&vcc18_ldo1>;
|
||||
+ status ="okay";
|
||||
+};
|
||||
+
|
||||
+&sdmmc {
|
||||
+ bus-width = <4>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-sd-highspeed;
|
||||
+ card-detect-delay = <200>;
|
||||
+ disable-wp; /* wp not hooked up */
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
|
||||
+ sd-uhs-sdr12;
|
||||
+ sd-uhs-sdr25;
|
||||
+ sd-uhs-sdr50;
|
||||
+ sd-uhs-sdr104;
|
||||
+ status = "okay";
|
||||
+ supports-sd;
|
||||
+ vmmc-supply = <&vcc33_sd>;
|
||||
+ vqmmc-supply = <&vccio_sd>;
|
||||
+};
|
||||
+
|
||||
+&emmc {
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ disable-wp;
|
||||
+ non-removable;
|
||||
+ num-slots = <1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
|
||||
+ max-frequency = <150000000>;
|
||||
+ mmc-hs200-1_8v;
|
||||
+ mmc-ddr-1_8v;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tsadc {
|
||||
+ rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
|
||||
+ rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart3 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart4 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbphy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_host0_ehci {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_host1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_otg {
|
||||
+ status= "okay";
|
||||
+};
|
||||
+
|
||||
+&vopb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopb_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vpu_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vpu_service {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_service {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wdt {
|
||||
+ status = "okay";
|
||||
+};
|
||||
@@ -0,0 +1,23 @@
|
||||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
index a907d7b06..ec71996c7 100644
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
@@ -619,13 +619,17 @@ BRCMF_FW_DEF(4354, "brcmfmac4354-sdio");
|
||||
BRCMF_FW_DEF(4356, "brcmfmac4356-sdio");
|
||||
BRCMF_FW_DEF(4373, "brcmfmac4373-sdio");
|
||||
|
||||
+/* AMPAK */
|
||||
+BRCMF_FW_DEF(AP6330, "brcmfmac-ap6330-sdio");
|
||||
+
|
||||
static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329),
|
||||
- BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
|
||||
+ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFEF, 4330),
|
||||
+ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0x10, AP6330),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340),
|
||||
@@ -0,0 +1,27 @@
|
||||
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
|
||||
index 3216e09..21bce28
|
||||
--- a/arch/arm64/mm/dma-mapping.c
|
||||
+++ b/arch/arm64/mm/dma-mapping.c
|
||||
@@ -44,7 +44,7 @@ static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,
|
||||
|
||||
static struct gen_pool *atomic_pool;
|
||||
|
||||
-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
|
||||
+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M
|
||||
static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE;
|
||||
|
||||
static int __init early_coherent_pool(char *p)
|
||||
|
||||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
|
||||
index ada8eb2..8df220f
|
||||
--- a/arch/arm/mm/dma-mapping.c
|
||||
+++ b/arch/arm/mm/dma-mapping.c
|
||||
@@ -381,7 +381,7 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
|
||||
VM_ARM_DMA_CONSISTENT | VM_USERMAP);
|
||||
}
|
||||
|
||||
-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
|
||||
+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M
|
||||
static struct gen_pool *atomic_pool __ro_after_init;
|
||||
|
||||
static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE;
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
|
||||
index bd83c53..af7cfe3
|
||||
--- a/arch/arm/mm/dma-mapping.c
|
||||
+++ b/arch/arm/mm/dma-mapping.c
|
||||
@@ -374,7 +374,7 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
|
||||
VM_ARM_DMA_CONSISTENT | VM_USERMAP);
|
||||
}
|
||||
|
||||
-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
|
||||
+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M
|
||||
static struct gen_pool *atomic_pool;
|
||||
|
||||
static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
|
||||
@@ -1,26 +0,0 @@
|
||||
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||
index 6285b72faa9a..ad65cd74c3c8 100644
|
||||
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||
@@ -1008,6 +1008,7 @@ static struct recv_buf *sd_recv_rxfifo(struct
|
||||
adapter *padapter, u32 size)
|
||||
}
|
||||
|
||||
if (precvbuf->pskb == NULL) {
|
||||
+ rtw_enqueue_recvbuf(precvbuf, &precvpriv->free_recv_buf_queue);
|
||||
DBG_871X("%s: alloc_skb fail! read =%d\n", __func__, readsize);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1017,6 +1018,7 @@ static struct recv_buf *sd_recv_rxfifo(struct
|
||||
adapter *padapter, u32 size)
|
||||
preadbuf = precvbuf->pskb->data;
|
||||
ret = sdio_read_port(&padapter->iopriv.intf, WLAN_RX0FF_DEVICE_ID,
|
||||
readsize, preadbuf);
|
||||
if (ret == _FAIL) {
|
||||
+ rtw_enqueue_recvbuf(precvbuf, &precvpriv->free_recv_buf_queue);
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("%s: read port FAIL!\n",
|
||||
__func__));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
|
||||
index 820a061506cc..80cf5a8b1557 100644
|
||||
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
|
||||
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
|
||||
@@ -34,7 +34,7 @@ void _ips_enter(struct adapter *padapter)
|
||||
|
||||
if (rf_off == pwrpriv->change_rfpwrstate) {
|
||||
pwrpriv->bpower_saving = true;
|
||||
- DBG_871X_LEVEL(_drv_always_, "nolinked power save enter\n");
|
||||
+ DBG_871X("nolinked power save enter\n");
|
||||
|
||||
if (pwrpriv->ips_mode == IPS_LEVEL_2)
|
||||
pwrpriv->bkeepfwalive = true;
|
||||
@@ -73,7 +73,7 @@ int _ips_leave(struct adapter *padapter)
|
||||
if (result == _SUCCESS) {
|
||||
pwrpriv->rf_pwrstate = rf_on;
|
||||
}
|
||||
- DBG_871X_LEVEL(_drv_always_, "nolinked power save leave\n");
|
||||
+ DBG_871X("nolinked power save leave\n");
|
||||
|
||||
DBG_871X("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c));
|
||||
pwrpriv->bips_processing = false;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
|
||||
index 918f449..561b71c 100644
|
||||
--- a/drivers/net/wireless/Kconfig
|
||||
+++ b/drivers/net/wireless/Kconfig
|
||||
@@ -39,6 +39,8 @@ source "drivers/net/wireless/cisco/Kconfig"
|
||||
source "drivers/net/wireless/intel/Kconfig"
|
||||
source "drivers/net/wireless/intersil/Kconfig"
|
||||
source "drivers/net/wireless/marvell/Kconfig"
|
||||
+source "drivers/net/wireless/rtl8812au/Kconfig"
|
||||
+source "drivers/net/wireless/rtl8814au/Kconfig"
|
||||
source "drivers/net/wireless/mediatek/Kconfig"
|
||||
source "drivers/net/wireless/ralink/Kconfig"
|
||||
source "drivers/net/wireless/realtek/Kconfig"
|
||||
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
|
||||
index 59df552..614ddf4 100644
|
||||
--- a/drivers/net/wireless/Makefile
|
||||
+++ b/drivers/net/wireless/Makefile
|
||||
@@ -12,6 +12,8 @@ obj-$(CONFIG_WLAN_VENDOR_CISCO) += cisco/
|
||||
obj-$(CONFIG_WLAN_VENDOR_INTEL) += intel/
|
||||
obj-$(CONFIG_WLAN_VENDOR_INTERSIL) += intersil/
|
||||
obj-$(CONFIG_WLAN_VENDOR_MARVELL) += marvell/
|
||||
+obj-$(CONFIG_RTL8812AU) += rtl8812au/
|
||||
+obj-$(CONFIG_RTL8814AU) += rtl8814au/
|
||||
obj-$(CONFIG_WLAN_VENDOR_MEDIATEK) += mediatek/
|
||||
obj-$(CONFIG_WLAN_VENDOR_RALINK) += ralink/
|
||||
obj-$(CONFIG_WLAN_VENDOR_REALTEK) += realtek/
|
||||
@@ -1,46 +0,0 @@
|
||||
diff --git a/drivers/net/wireless/rtl8812au/Kconfig b/drivers/net/wireless/rtl8812au/Kconfig
|
||||
index 16d3567..f87653d 100644
|
||||
--- a/drivers/net/wireless/rtl8812au/Kconfig
|
||||
+++ b/drivers/net/wireless/rtl8812au/Kconfig
|
||||
@@ -4,8 +4,3 @@ config RTL8812AU
|
||||
---help---
|
||||
Help message of RTL8812AU
|
||||
|
||||
-config RTL8814AU
|
||||
- tristate "Realtek 8814A USB WiFi"
|
||||
- depends on USB
|
||||
- ---help---
|
||||
- Help message of RTL8814AU
|
||||
diff --git a/drivers/net/wireless/rtl8814au/Kconfig b/drivers/net/wireless/rtl8814au/Kconfig
|
||||
index 16d3567..730c4e0 100644
|
||||
--- a/drivers/net/wireless/rtl8814au/Kconfig
|
||||
+++ b/drivers/net/wireless/rtl8814au/Kconfig
|
||||
@@ -1,9 +1,3 @@
|
||||
-config RTL8812AU
|
||||
- tristate "Realtek 8812A USB WiFi"
|
||||
- depends on USB
|
||||
- ---help---
|
||||
- Help message of RTL8812AU
|
||||
-
|
||||
config RTL8814AU
|
||||
tristate "Realtek 8814A USB WiFi"
|
||||
depends on USB
|
||||
diff --git a/drivers/net/wireless/rtl8814au/Makefile b/drivers/net/wireless/rtl8814au/Makefile
|
||||
index ef959e7..f71f524 100644
|
||||
--- a/drivers/net/wireless/rtl8814au/Makefile
|
||||
+++ b/drivers/net/wireless/rtl8814au/Makefile
|
||||
@@ -32,11 +32,11 @@ CONFIG_AUTOCFG_CP = n
|
||||
########################## WIFI IC ############################
|
||||
CONFIG_MULTIDRV = n
|
||||
CONFIG_RTL8188E = n
|
||||
-CONFIG_RTL8812A = y
|
||||
-CONFIG_RTL8821A = y
|
||||
+CONFIG_RTL8812A = n
|
||||
+CONFIG_RTL8821A = n
|
||||
CONFIG_RTL8192E = n
|
||||
CONFIG_RTL8723B = n
|
||||
-CONFIG_RTL8814A = n
|
||||
+CONFIG_RTL8814A = y
|
||||
CONFIG_RTL8723C = n
|
||||
CONFIG_RTL8188F = n
|
||||
CONFIG_RTL8822B = n
|
||||
File diff suppressed because it is too large
Load Diff
@@ -301875,7 +301875,7 @@ new file mode 100644
|
||||
index 0000000000000..324b45bd223fd
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/wireless/rtl8188eu/include/wifi.h
|
||||
@@ -0,0 +1,1103 @@
|
||||
@@ -0,0 +1,1105 @@
|
||||
+/******************************************************************************
|
||||
+ *
|
||||
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
||||
@@ -302608,7 +302608,9 @@ index 0000000000000..324b45bd223fd
|
||||
+ * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
|
||||
+ */
|
||||
+#define IEEE80211_MIN_AMPDU_BUF 0x8
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0))
|
||||
+#define IEEE80211_MAX_AMPDU_BUF 0x40
|
||||
+#endif
|
||||
+
|
||||
+/* Spatial Multiplexing Power Save Modes */
|
||||
+#define WLAN_HT_CAP_SM_PS_STATIC 0
|
||||
@@ -311898,7 +311900,7 @@ new file mode 100644
|
||||
index 0000000000000..fadf117a54b6a
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/wireless/rtl8188eu/os_dep/os_intfs.c
|
||||
@@ -0,0 +1,1273 @@
|
||||
@@ -0,0 +1,1276 @@
|
||||
+/******************************************************************************
|
||||
+ *
|
||||
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
@@ -312553,7 +312555,10 @@ index 0000000000000..fadf117a54b6a
|
||||
+}
|
||||
+
|
||||
+static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
|
||||
+ ,struct net_device *sb_dev
|
||||
+ ,select_queue_fallback_t fallback
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
|
||||
+ ,void *unused
|
||||
+ ,select_queue_fallback_t fallback
|
||||
+#elif (LINUX_VERSION_CODE == KERNEL_VERSION(3, 13, 0))
|
||||
|
||||
@@ -0,0 +1,972 @@
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/rk3288-xt-q8l-v10.dts 2018-12-06 21:46:51.493688015 +0000
|
||||
@@ -0,0 +1,969 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2014, 2015 FUKAUMI Naoki <naobsd@gmail.com>
|
||||
+ * 2018 Paolo Sabatino <paolo.sabatino@gm**l.com>
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively,
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use,
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "rk3288.dtsi"
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+
|
||||
+/ {
|
||||
+ model = "XT-Q8L-V10-RK3288";
|
||||
+ compatible = "generic,xt-q8l-v10-rk3288", "rockchip,rk3288";
|
||||
+
|
||||
+ memory {
|
||||
+ reg = <0x0 0x0 0x0 0x80000000>;
|
||||
+ device_type = "memory";
|
||||
+ };
|
||||
+
|
||||
+ cpu0_opp_table: opp_table {
|
||||
+ compatible = "operating-points-v2";
|
||||
+ opp-shared;
|
||||
+
|
||||
+ opp@600000000 {
|
||||
+ opp-hz = /bits/ 64 <600000000>;
|
||||
+ opp-microvolt = <900000>;
|
||||
+ };
|
||||
+ opp@816000000 {
|
||||
+ opp-hz = /bits/ 64 <816000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+ opp@1008000000 {
|
||||
+ opp-hz = /bits/ 64 <1008000000>;
|
||||
+ opp-microvolt = <1050000>;
|
||||
+ };
|
||||
+ opp@1200000000 {
|
||||
+ opp-hz = /bits/ 64 <1200000000>;
|
||||
+ opp-microvolt = <1100000>;
|
||||
+ };
|
||||
+ opp@1416000000 {
|
||||
+ opp-hz = /bits/ 64 <1416000000>;
|
||||
+ opp-microvolt = <1200000>;
|
||||
+ };
|
||||
+ opp@1512000000 {
|
||||
+ opp-hz = /bits/ 64 <1512000000>;
|
||||
+ opp-microvolt = <1250000>;
|
||||
+ };
|
||||
+ opp@1608000000 {
|
||||
+ opp-hz = /bits/ 64 <1608000000>;
|
||||
+ opp-microvolt = <1300000>;
|
||||
+ };
|
||||
+ /*
|
||||
+ opp@1704000000 {
|
||||
+ opp-hz = /bits/ 64 <1704000000>;
|
||||
+ opp-microvolt = <1350000>;
|
||||
+ };
|
||||
+ opp@1800000000 {
|
||||
+ opp-hz = /bits/ 64 <1800000000>;
|
||||
+ opp-microvolt = <1400000>;
|
||||
+ };
|
||||
+ */
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Peripheral from original q8 device tree, currently no references
|
||||
+ * for drivers in linux kernel.
|
||||
+ rockchip-hsadc@ff080000 {
|
||||
+ compatible = "rockchip-hsadc";
|
||||
+ reg = <0xff080000 0x4000>;
|
||||
+ interrupts = <0x0 0x1f 0x4>;
|
||||
+ #address-cells = <0x1>;
|
||||
+ #size-cells = <0x0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <0x9a>;
|
||||
+ clocks = <0x79 0x7 0x8 0x39>;
|
||||
+ clock-names = "hclk_hsadc", "clk_hsadc_out", "clk_hsadc_ext";
|
||||
+ dmas = <0x9b 0x0>;
|
||||
+ dma-names = "data";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ */
|
||||
+
|
||||
+ ext_gmac: external-gmac-clock {
|
||||
+ compatible = "fixed-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <125000000>;
|
||||
+ clock-output-names = "ext_gmac";
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Handle the IR receiver using the gpio-ir-receiver kernel module.
|
||||
+ * This works flawlessy, the original xt-q8l-v10 remote uses a NEC
|
||||
+ * protocol and the keymap rc-xt-q8l-v10 has to be compiled in the
|
||||
+ * kernel for the remote to work as an input device
|
||||
+ */
|
||||
+ ir: ir-receiver {
|
||||
+ compatible = "gpio-ir-receiver";
|
||||
+ gpios = <&gpio7 RK_PA0 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ir_int>;
|
||||
+ linux,rc-map-name = "rc-xt-q8l-v10";
|
||||
+ wakeup-source;
|
||||
+ };
|
||||
+
|
||||
+ keys: gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwr_key>;
|
||||
+
|
||||
+ button@0 {
|
||||
+ gpio-key,wakeup = <1>;
|
||||
+ gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
|
||||
+ label = "GPIO Power";
|
||||
+ linux,code = <KEY_POWER>;
|
||||
+ wakeup-source;
|
||||
+ debounce-interval = <100>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ power {
|
||||
+ /*
|
||||
+ Power led is active high, but we set it here active low
|
||||
+ so while there is mass storage access it turns red and
|
||||
+ when it is idle is blue
|
||||
+ */
|
||||
+ gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
|
||||
+ label = "power";
|
||||
+ linux,default-trigger = "mmc0";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&power_led>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ vcc_sys: vsys-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc_sys";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ vcc_sd: sdmmc-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_pwr>;
|
||||
+ regulator-name = "vcc_sd";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ startup-delay-us = <100000>;
|
||||
+ vin-supply = <&vcc_io>;
|
||||
+ };
|
||||
+
|
||||
+ vcc_flash: flash-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc_flash";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ vin-supply = <&vcc_io>;
|
||||
+ };
|
||||
+
|
||||
+ vcc_host_5v: usb-host-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&host_vbus_drv>;
|
||||
+ regulator-name = "vcc_host_5v";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ enable-active-high;
|
||||
+// startup-delay-us = <1000>;
|
||||
+ vin-supply = <&vcc_sys>;
|
||||
+ };
|
||||
+
|
||||
+
|
||||
+ vcc_otg_5v: usb-otg-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ enable-active-high;
|
||||
+ gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&otg_vbus_drv>;
|
||||
+ regulator-name = "vcc_otg_5v";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+// startup-delay-us = <1000>;
|
||||
+ regulator-always-on;
|
||||
+ vin-supply = <&vcc_sys>;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Required power sequence to properly enable the wireless/bluetooth
|
||||
+ * module connected to sdio0
|
||||
+ */
|
||||
+ sdio0_pwrseq: sdio0_pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&wifi_enable_h>, <&bt_enable_h>;
|
||||
+ reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>, <&gpio4 29 GPIO_ACTIVE_LOW>;
|
||||
+ post-power-on-delay-ms = <100>;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Sound taken from tinkerboard device tree, adapted to q8.
|
||||
+ */
|
||||
+ soundcard-hdmi {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,name = "DW-I2S-HDMI";
|
||||
+ simple-audio-card,mclk-fs = <512>;
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ soundcard-spdif {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "SPDIF";
|
||||
+ simple-audio-card,dai-link@1 {
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&spdif>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&spdif_out>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spdif_out: spdif-out {
|
||||
+ compatible = "linux,spdif-dit";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
+
|
||||
+
|
||||
+&io_domains {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ audio-supply = <&vcca_33>;
|
||||
+ bb-supply = <&vcc_io>;
|
||||
+ dvp-supply = <&vcc_18>;
|
||||
+ flash0-supply = <&vcc_flash>;
|
||||
+ flash1-supply = <&vcc_lan>;
|
||||
+ gpio30-supply = <&vcc_io>;
|
||||
+ gpio1830-supply = <&vcc_io>;
|
||||
+ lcdc-supply = <&vcc_io>;
|
||||
+ sdcard-supply = <&vccio_sd>;
|
||||
+ wifi-supply = <&vcc_18>;
|
||||
+};
|
||||
+
|
||||
+&cpu0 {
|
||||
+ cpu0-supply = <&vdd_cpu>;
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+ /delete-node/operating-points;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+ /delete-node/operating-points;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+ /delete-node/operating-points;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+ /delete-node/operating-points;
|
||||
+};
|
||||
+
|
||||
+&gmac {
|
||||
+ assigned-clocks = <&cru SCLK_MAC>;
|
||||
+ assigned-clock-parents = <&ext_gmac>;
|
||||
+ clock_in_out = "input";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins>, <&phy_rst>, <&phy_pmeb>, <&phy_int>;
|
||||
+ phy-supply = <&vcc_lan>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ snps,reset-active-low;
|
||||
+ snps,reset-delays-us = <0 10000 1000000>;
|
||||
+ snps,reset-gpio = <&gpio4 8 GPIO_ACTIVE_LOW>;
|
||||
+ tx_delay = <0x30>;
|
||||
+ rx_delay = <0x10>;
|
||||
+ status = "ok";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ ddc-i2c-bus = <&i2c5>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_gpu>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ vdd_cpu: syr827@40 {
|
||||
+ compatible = "silergy,syr827";
|
||||
+ fcs,suspend-voltage-selector = <1>;
|
||||
+ reg = <0x40>;
|
||||
+ regulator-name = "vdd_cpu";
|
||||
+ regulator-min-microvolt = <850000>;
|
||||
+ regulator-max-microvolt = <1350000>;
|
||||
+ regulator-ramp-delay = <8000>;
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ vin-supply = <&vcc_sys>;
|
||||
+ };
|
||||
+
|
||||
+ vdd_gpu: syr828@41 {
|
||||
+ compatible = "silergy,syr828";
|
||||
+ fcs,suspend-voltage-selector = <1>;
|
||||
+ reg = <0x41>;
|
||||
+ regulator-name = "vdd_gpu";
|
||||
+ regulator-min-microvolt = <850000>;
|
||||
+ regulator-max-microvolt = <1350000>;
|
||||
+ regulator-ramp-delay = <8000>;
|
||||
+ regulator-always-on;
|
||||
+ vin-supply = <&vcc_sys>;
|
||||
+ };
|
||||
+
|
||||
+ hym8563: hym8563@51 {
|
||||
+ compatible = "haoyu,hym8563";
|
||||
+ reg = <0x51>;
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <32768>;
|
||||
+ clock-output-names = "xin32k";
|
||||
+ interrupt-parent = <&gpio0>;
|
||||
+ interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rtc_int>;
|
||||
+ };
|
||||
+
|
||||
+ act8846: act8846@5a {
|
||||
+ compatible = "active-semi,act8846";
|
||||
+ reg = <0x5a>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pmic_vsel>;
|
||||
+ system-power-controller;
|
||||
+
|
||||
+ vp1-supply = <&vcc_sys>;
|
||||
+ vp2-supply = <&vcc_sys>;
|
||||
+ vp3-supply = <&vcc_sys>;
|
||||
+ vp4-supply = <&vcc_sys>;
|
||||
+ inl1-supply = <&vcc_sys>;
|
||||
+ inl2-supply = <&vcc_sys>;
|
||||
+ inl3-supply = <&vcc_20>;
|
||||
+ wakeup-source;
|
||||
+
|
||||
+ regulators {
|
||||
+
|
||||
+ /*
|
||||
+ * Regulator controlling DDR memory - always on
|
||||
+ */
|
||||
+ vcc_ddr: REG1 {
|
||||
+ regulator-name = "vcc_ddr";
|
||||
+ regulator-min-microvolt = <1200000>;
|
||||
+ regulator-max-microvolt = <1200000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Regulator controlling various IO functions of the rk3288.
|
||||
+ * Always on
|
||||
+ */
|
||||
+ vcc_io: REG2 {
|
||||
+ regulator-name = "vcc_io";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Regulator controlling various board logic.
|
||||
+ * Always on.
|
||||
+ * rk3288 electrical datasheet says it should have variable
|
||||
+ * voltage depending upon dvfs
|
||||
+ */
|
||||
+ vdd_log: REG3 {
|
||||
+ regulator-name = "vdd_log";
|
||||
+ regulator-min-microvolt = <1100000>;
|
||||
+ regulator-max-microvolt = <1100000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * No reference for this on electrical datasheet. Maybe this
|
||||
+ * is vcc_18? Maybe this is vcc18_flash on electrical datasheet.
|
||||
+ * So far we disable it.
|
||||
+ */
|
||||
+ vcc_20: REG4 {
|
||||
+ regulator-name = "vcc_20";
|
||||
+ regulator-min-microvolt = <2000000>;
|
||||
+ regulator-max-microvolt = <2000000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * This regulator controls SDIO. Electrical datasheet says
|
||||
+ * this regulator can be operated between 1.8 and 3.3 volts
|
||||
+ */
|
||||
+ vccio_sd: REG5 {
|
||||
+ regulator-name = "vccio_sd";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Controlling HDMI and LCD controller on rk3288. 1.0 volts
|
||||
+ * by reference
|
||||
+ */
|
||||
+ vdd10_lcd: REG6 {
|
||||
+ regulator-name = "vdd10_lcd";
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * From the rk3288 electrical datasheet, this regulator powers
|
||||
+ * the rk1000 chip, which is absent in our device, but it
|
||||
+ * is also supplying bluetooth, so we enable it.
|
||||
+ */
|
||||
+ vcca_18: REG7 {
|
||||
+ regulator-name = "vcca_18";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * This regulator controls, among other things, the SPDIF
|
||||
+ * interface, so we enable it
|
||||
+ */
|
||||
+ vcca_33: REG8 {
|
||||
+ regulator-name = "vcca_33";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on; // Turn this on to get SPDIF!
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * LAN regulator
|
||||
+ */
|
||||
+ vcc_lan: REG9 {
|
||||
+ regulator-name = "vcc_lan";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Regulator controlling PMU, USB PHY and rk3288 PLLs.
|
||||
+ * 1.0 volts by reference
|
||||
+ */
|
||||
+ vdd_10: REG10 {
|
||||
+ regulator-name = "vdd_10";
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Regulator controlling Wifi over SDIO, SARADC and USB PHY.
|
||||
+ * Better turn this on
|
||||
+ */
|
||||
+ vccio_wl: vcc_18: REG11 {
|
||||
+ regulator-name = "vcc_18";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * Not clear: apparently this controls HDMI and LCD controller
|
||||
+ * on rk3368 devices.
|
||||
+ * 1.8 volts by reference
|
||||
+ */
|
||||
+ vcc18_lcd: REG12 {
|
||||
+ regulator-name = "vcc18_lcd";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c4 {
|
||||
+
|
||||
+ /*
|
||||
+ * Here should go the RK1000 audio codec parts, but seems that
|
||||
+ * there is no driver in linux kernel at the moment, so we can't
|
||||
+ * describe it.
|
||||
+ * Also, most important, there is no RK1000 on our board :)
|
||||
+ * Datasheet is available here:
|
||||
+ * http://dl.radxa.com/rock/docs/hw/ds/RK1000-S%20DATASHEET%20V14.pdf
|
||||
+ */
|
||||
+ status = "okay";
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&i2c5 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+
|
||||
+ /*
|
||||
+ These two lines here, these must be commented out! Otherwise for some reason the kernel
|
||||
+ does not see the boot device anymore and will stay stuck in initramfs!
|
||||
+ On the contrary, these are required by u-boot to keep the power holding so the device does not
|
||||
+ automatically turns off after a small timeout
|
||||
+ */
|
||||
+ /*pinctrl-names = "default";*/
|
||||
+ /*pinctrl-0 = <&pwr_hold>;*/
|
||||
+
|
||||
+ pcfg_output_high: pcfg-output-high {
|
||||
+ output-high;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_output_low: pcfg-output-low {
|
||||
+ output-low;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_wl: pcfg-wl {
|
||||
+ bias-pull-up;
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
|
||||
+ bias-pull-up;
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_pull_none_8ma: pcfg-pull-none-8ma {
|
||||
+ bias-disable;
|
||||
+ drive-strength = <8>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_wl_clk: pcfg-wl-clk {
|
||||
+ bias-disable;
|
||||
+ drive-strength = <12>;
|
||||
+ };
|
||||
+
|
||||
+ pcfg_wl_int: pcfg-wl-int {
|
||||
+ bias-pull-up;
|
||||
+ };
|
||||
+
|
||||
+ act8846 {
|
||||
+
|
||||
+ /*
|
||||
+ * Original q8 device tree says:
|
||||
+ * - gpio0 11 HIGH -> power hold
|
||||
+ * - gpio7 1 LOW -> possibly pmic-vsel, we don't care
|
||||
+ */
|
||||
+ pmic_vsel: pmic-vsel {
|
||||
+ rockchip,pins = <7 1 RK_FUNC_GPIO &pcfg_output_low>;
|
||||
+ };
|
||||
+
|
||||
+ pwr_hold: pwr-hold {
|
||||
+ rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gmac {
|
||||
+ phy_int: phy-int {
|
||||
+ rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ phy_pmeb: phy-pmeb {
|
||||
+ rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ phy_rst: phy-rst {
|
||||
+ rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ hym8563 {
|
||||
+ rtc_int: rtc-int {
|
||||
+ rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ pwr_key: pwr-key {
|
||||
+ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ power_led: power-led {
|
||||
+ rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ ir {
|
||||
+ ir_int: ir-int {
|
||||
+ rockchip,pins = <7 0 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sdmmc {
|
||||
+
|
||||
+ /*
|
||||
+ * Copied from firefly board definition to give more drive to
|
||||
+ * the sdmmc pins. The Q8 seems to be quite able to drive
|
||||
+ * ultra high speed uSD cards, so we give a bit more energy
|
||||
+ * to the gpio pins
|
||||
+ */
|
||||
+ sdmmc_bus4: sdmmc-bus4 {
|
||||
+ rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
+ <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_clk: sdmmc-clk {
|
||||
+ rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_cmd: sdmmc-cmd {
|
||||
+ rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
+ };
|
||||
+
|
||||
+ sdmmc_pwr: sdmmc-pwr {
|
||||
+ rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ usb_host1 {
|
||||
+ host_vbus_drv: host-vbus-drv {
|
||||
+ rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ usb_otg {
|
||||
+ otg_vbus_drv: otg-vbus-drv {
|
||||
+ rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sdio0 {
|
||||
+ wifi_enable_h: wifienable-h {
|
||||
+ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_output_high>;
|
||||
+ };
|
||||
+
|
||||
+ bt_enable_h: bt-enable-h {
|
||||
+ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_output_high>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+
|
||||
+ wireless-bluetooth {
|
||||
+ uart0_gpios: uart0-gpios {
|
||||
+ rockchip,pins = <4 19 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&saradc {
|
||||
+ vref-supply = <&vcc_18>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&emmc {
|
||||
+
|
||||
+ /*
|
||||
+ * eMMC seems to be 52Mhz device on q8 devices, so set it here
|
||||
+ * vmmc-supply and vqmmc-supply are removed because they hang
|
||||
+ * u-boot >= v2018.03
|
||||
+ * From the original q8l firmware and eMMC datasheet it also should
|
||||
+ * support DDR highspeed mode, but using mmc-ddr-3_3v or mmc-ddr-1_8v
|
||||
+ * properties are not working
|
||||
+ */
|
||||
+ clock-frequency = <50000000>;
|
||||
+
|
||||
+ broken-cd;
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ disable-wp;
|
||||
+ non-removable;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sdmmc {
|
||||
+ supports-sd;
|
||||
+
|
||||
+ bus-width = <4>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-sd-highspeed;
|
||||
+ card-detect-delay = <200>;
|
||||
+ disable-wp;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
|
||||
+ vmmc-supply = <&vcc_sd>;
|
||||
+ vqmmc-supply = <&vccio_sd>;
|
||||
+ sd-uhs-sdr12;
|
||||
+ sd-uhs-sdr25;
|
||||
+ sd-uhs-sdr50;
|
||||
+ sd-uhs-sdr104;
|
||||
+ sd-uhs-ddr50;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sdio0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ bus-width = <4>;
|
||||
+ mmc-pwrseq = <&sdio0_pwrseq>;
|
||||
+
|
||||
+ vmmc-supply = <&vcc_io>;
|
||||
+ vqmmc-supply = <&vcc_18>; // This must be the same as in io_domains,
|
||||
+ // otherwise the mmc1 device won't be detected properly
|
||||
+
|
||||
+// clock-frequency = <50000000>;
|
||||
+// max-frequency = <50000000>;
|
||||
+
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdio0_bus4>, <&sdio0_cmd>, <&sdio0_clk>, <&sdio0_int>;
|
||||
+
|
||||
+ cap-sdio-irq;
|
||||
+ no-mmc;
|
||||
+ no-sd;
|
||||
+ cap-sd-highspeed; // required, otherwise does not work!
|
||||
+ supports-sdio;
|
||||
+ non-removable;
|
||||
+
|
||||
+ keep-power-in-suspend;
|
||||
+ disable-wp;
|
||||
+
|
||||
+
|
||||
+ status = "okay";
|
||||
+
|
||||
+ brcmf: bcrmf@1 {
|
||||
+ reg = <1>;
|
||||
+ compatible = "brcm,bcm4329-fmac";
|
||||
+ interrupt-parent = <&gpio4>;
|
||||
+ interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "host-wake";
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ //sd-uhs-sdr104; // required to be disabled, otherwise the device get
|
||||
+ // detected, but there is no communication
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi0_clk>, <&spi0_cs0>, <&spi0_tx>, <&spi0_rx>, <&spi0_cs1>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tsadc {
|
||||
+ rockchip,hw-tshut-mode = <0>;
|
||||
+ rockchip,hw-tshut-polarity = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * These dmas described here for uarts are present in original q8 board
|
||||
+ * dts, so I replicate them here because documentation says that serial
|
||||
+ * ports can have dmas.
|
||||
+ * note:
|
||||
+ * - uart0 is the serial port connected to the bluetooth module
|
||||
+ * - uart2 is the onboard serial port
|
||||
+ *
|
||||
+ * As ok kernel 4.19 DMA for serial ports is disabled because it makes
|
||||
+ * the ports unusable
|
||||
+ *
|
||||
+ */
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
|
||||
+ //dmas = <&dmac_peri 1 &dmac_peri 2>;
|
||||
+ //dma-names = "tx", "rx";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ //dmas = <&dmac_peri 3 &dmac_peri 4>;
|
||||
+ //dma-names = "tx", "rx";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart2 {
|
||||
+ //dmas = <&dmac_bus_s 4 &dmac_bus_s 5>;
|
||||
+ //dma-names = "tx", "rx";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart3 {
|
||||
+ //dmas = <&dmac_peri 7 &dmac_peri 8>;
|
||||
+ //dma-names = "tx", "rx";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart4 {
|
||||
+ //dmas = <&dmac_peri 9 &dmac_peri 10>;
|
||||
+ //dma-names = "tx", "rx";
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Here usbphy* should have their proper reset lines described in rk3288.dtsi
|
||||
+ * Describing resets for usb phy is important because otherwise the USB
|
||||
+ * port gets stuck in case it goes into autosuspend: plugging any device
|
||||
+ * when the port is autosuspended will actually kill the port itself and
|
||||
+ * require a power cycle.
|
||||
+ * This is required for the usbphy1 phy, nonetheless it is a good idea to
|
||||
+ * specify the proper resources for all the phys though.
|
||||
+ * The reference patch which works in conjuction with the reset lines:
|
||||
+ * https://patchwork.kernel.org/patch/9469811/
|
||||
+ *
|
||||
+ */
|
||||
+&usbphy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbphy0 {
|
||||
+ vbus-supply = <&vcc_otg_5v>;
|
||||
+};
|
||||
+
|
||||
+&usbphy2 {
|
||||
+ vbus-supply = <&vcc_host_5v>;
|
||||
+};
|
||||
+
|
||||
+&usb_host0_ehci {
|
||||
+ dr_mode = "host";
|
||||
+ reg = <0x0 0xff500000 0x0 0x20000>;
|
||||
+ status = "disable";
|
||||
+};
|
||||
+
|
||||
+&usb_host1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_otg {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Enable VPU services and complete the relative IOMMU configurations
|
||||
+ */
|
||||
+&vopb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopb_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vopl_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vpu_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&vpu_service {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_service {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wdt {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+// i2s bus is present on q8 device, enable it
|
||||
+&i2s {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+// spdif is present on q8 device, enable it
|
||||
+&spdif {
|
||||
+ status = "okay";
|
||||
+};
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 37a3de760..6bcfceede 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -832,6 +832,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk3188-radxarock.dtb \
|
||||
rk3228-evb.dtb \
|
||||
rk3229-evb.dtb \
|
||||
+ rk3288-xt-q8l-v10.dtb \
|
||||
rk3288-evb-act8846.dtb \
|
||||
rk3288-evb-rk808.dtb \
|
||||
rk3288-fennec.dtb \
|
||||
@@ -0,0 +1,103 @@
|
||||
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
|
||||
index bfa3017..c2a21bb 100644
|
||||
--- a/include/media/rc-map.h
|
||||
+++ b/include/media/rc-map.h
|
||||
@@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name);
|
||||
#define RC_MAP_WINFAST "rc-winfast"
|
||||
#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
|
||||
#define RC_MAP_SU3000 "rc-su3000"
|
||||
+#define RC_MAP_XT_Q8L_V10 "rc-xt-q8l-v10"
|
||||
#define RC_MAP_ZX_IRDEC "rc-zx-irdec"
|
||||
|
||||
/*
|
||||
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
|
||||
index d6b913a..ee00ce5 100644
|
||||
--- a/drivers/media/rc/keymaps/Makefile
|
||||
+++ b/drivers/media/rc/keymaps/Makefile
|
||||
@@ -116,4 +116,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
|
||||
rc-winfast.o \
|
||||
rc-winfast-usbii-deluxe.o \
|
||||
rc-su3000.o \
|
||||
+ rc-xt-q8l-v10.o \
|
||||
rc-zx-irdec.o
|
||||
diff --git a/drivers/media/rc/keymaps/rc-xt-q8l-v10.c b/drivers/media/rc/keymaps/rc-xt-q8l-v10.c
|
||||
index e69de29..19c7d9e 100644
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/rc/keymaps/rc-xt-q8l-v10.c
|
||||
@@ -0,0 +1,76 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+// rc-xt-q8l-v10.c - Keytable for xt-q8l-v10 tv box remote controller
|
||||
+//
|
||||
+// keymap imported from ir-keymaps.c
|
||||
+//
|
||||
+// Copyright (c) 2018 Paolo Sabatino
|
||||
+
|
||||
+#include <media/rc-map.h>
|
||||
+#include <linux/module.h>
|
||||
+
|
||||
+/*
|
||||
+
|
||||
+*/
|
||||
+
|
||||
+static struct rc_map_table xt_q8l_v10[] = {
|
||||
+
|
||||
+ { 0xcc1d11, KEY_ENTER },
|
||||
+ { 0xcc1d00, KEY_POWER },
|
||||
+ { 0xcc1d15, KEY_PLAYPAUSE },
|
||||
+ { 0xcc1d16, KEY_STOP },
|
||||
+ { 0xcc1d06, KEY_PREVIOUSSONG },
|
||||
+ { 0xcc1d0a, KEY_NEXTSONG },
|
||||
+ { 0xcc1d41, KEY_1 },
|
||||
+ { 0xcc1d45, KEY_2 },
|
||||
+ { 0xcc1d4d, KEY_3 },
|
||||
+ { 0xcc1d42, KEY_4 },
|
||||
+ { 0xcc1d46, KEY_5 },
|
||||
+ { 0xcc1d4e, KEY_6 },
|
||||
+ { 0xcc1d43, KEY_7 },
|
||||
+ { 0xcc1d47, KEY_8 },
|
||||
+ { 0xcc1d4f, KEY_9 },
|
||||
+ { 0xcc1d49, KEY_0 },
|
||||
+ { 0xcc1d4a, KEY_BACKSPACE },
|
||||
+ { 0xcc1d48, KEY_F6 },
|
||||
+ { 0xcc1d03, KEY_HOME },
|
||||
+ { 0xcc1d0f, KEY_BACK },
|
||||
+ { 0xcc1d40, KEY_MENU },
|
||||
+ { 0xcc1d4c, KEY_TEXT },
|
||||
+ { 0xcc1d10, KEY_LEFT },
|
||||
+ { 0xcc1d12, KEY_RIGHT },
|
||||
+ { 0xcc1d44, KEY_DOWN },
|
||||
+ { 0xcc1d07, KEY_UP },
|
||||
+ { 0xcc1d02, KEY_VOLUMEDOWN },
|
||||
+ { 0xcc1d0c, KEY_MUTE },
|
||||
+ { 0xcc1d0e, KEY_VOLUMEUP },
|
||||
+ { 0xcc1d01, KEY_F1 },
|
||||
+ { 0xcc1d05, KEY_F2 },
|
||||
+ { 0xcc1d09, KEY_F3 },
|
||||
+ { 0xcc1d0d, KEY_F4 },
|
||||
+
|
||||
+};
|
||||
+
|
||||
+static struct rc_map_list xt_q8l_v10_map = {
|
||||
+ .map = {
|
||||
+ .scan = xt_q8l_v10,
|
||||
+ .size = ARRAY_SIZE(xt_q8l_v10),
|
||||
+ .rc_proto = RC_PROTO_NEC, /* Legacy IR type */
|
||||
+ .name = RC_MAP_XT_Q8L_V10,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static int __init init_rc_map_xt_q8l_v10(void)
|
||||
+{
|
||||
+ return rc_map_register(&xt_q8l_v10_map);
|
||||
+}
|
||||
+
|
||||
+static void __exit exit_rc_map_xt_q8l_v10(void)
|
||||
+{
|
||||
+ rc_map_unregister(&xt_q8l_v10_map);
|
||||
+}
|
||||
+
|
||||
+module_init(init_rc_map_xt_q8l_v10)
|
||||
+module_exit(exit_rc_map_xt_q8l_v10)
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Paolo Sabatino");
|
||||
@@ -0,0 +1,25 @@
|
||||
From cd0236ef771fd72e2975ca294ba2f1872d7dbc0b Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 22 Oct 2017 12:48:24 +0200
|
||||
Subject: [PATCH 2/2] rockchip: tinker: enable rockchip video driver
|
||||
|
||||
---
|
||||
configs/tinker-rk3288_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
|
||||
index 1315be3ee8..3a81328b48 100644
|
||||
--- a/configs/tinker-rk3288_defconfig
|
||||
+++ b/configs/tinker-rk3288_defconfig
|
||||
@@ -78,6 +78,11 @@ CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
CONFIG_USB_ETHER_SMSC95XX=y
|
||||
+CONFIG_DM_VIDEO=y
|
||||
+CONFIG_DISPLAY=y
|
||||
+CONFIG_VIDEO_ROCKCHIP=y
|
||||
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
|
||||
+CONFIG_CONSOLE_SCROLL_LINES=10
|
||||
CONFIG_USE_TINY_PRINTF=y
|
||||
CONFIG_CMD_DHRYSTONE=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
@@ -1,2 +0,0 @@
|
||||
kernel patches from scpcom
|
||||
https://forum.odroid.com/viewtopic.php?f=135&t=22717&start=900#p233963
|
||||
@@ -0,0 +1,50 @@
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
index b160bd1084de..fffd55787981 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
@@ -461,7 +461,7 @@
|
||||
compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac";
|
||||
reg = <0x0 0xff3f0000 0x0 0x10000
|
||||
0x0 0xff634540 0x0 0x8>;
|
||||
- interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>;
|
||||
+ interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "macirq";
|
||||
clocks = <&clkc CLKID_ETH>,
|
||||
<&clkc CLKID_FCLK_DIV2>,
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index ed336c7a98a7..44c5c51ff1fa 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -467,7 +467,7 @@
|
||||
compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", "snps,dwmac";
|
||||
reg = <0x0 0xc9410000 0x0 0x10000
|
||||
0x0 0xc8834540 0x0 0x4>;
|
||||
- interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>;
|
||||
+ interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "macirq";
|
||||
status = "disabled";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 00f7be6d83f7..2e1cd5e3a246 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -143,7 +143,6 @@
|
||||
interrupt-parent = <&gpio_intc>;
|
||||
/* MAC_INTR on GPIOZ_15 */
|
||||
interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
|
||||
- eee-broken-1000t;
|
||||
};
|
||||
};
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
index 70325b273bd2..ec09bb5792b7 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
@@ -142,7 +142,6 @@
|
||||
eth_phy0: ethernet-phy@0 {
|
||||
/* Realtek RTL8211F (0x001cc916) */
|
||||
reg = <0>;
|
||||
- eee-broken-1000t;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
|
||||
index f839ecd9..cd276162 100644
|
||||
--- a/arch/arm64/Makefile
|
||||
+++ b/arch/arm64/Makefile
|
||||
@@ -103,7 +103,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
|
||||
|
||||
# Default target when executing plain make
|
||||
boot := arch/arm64/boot
|
||||
-KBUILD_IMAGE := $(boot)/Image.gz
|
||||
+KBUILD_IMAGE := $(boot)/Image
|
||||
KBUILD_DTBS := dtbs
|
||||
|
||||
all: Image.gz $(KBUILD_DTBS)
|
||||
@@ -1,49 +0,0 @@
|
||||
From 4796e434b5785e3d9f95e988363c407b1e09bb91 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Sat, 28 Jul 2018 22:40:27 +0200
|
||||
Subject: [PATCH] dt-bindings: soc: amlogic: add meson-canvas documentation
|
||||
|
||||
DT bindings doc for amlogic,meson-canvas
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
.../bindings/soc/amlogic/amlogic,canvas.txt | 29 +++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt b/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
new file mode 100644
|
||||
index 0000000000000..436d2106e80da
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
@@ -0,0 +1,29 @@
|
||||
+Amlogic Canvas
|
||||
+================================
|
||||
+
|
||||
+A canvas is a collection of metadata that describes a pixel buffer.
|
||||
+Those metadata include: width, height, phyaddr, wrapping, block mode
|
||||
+and endianness.
|
||||
+
|
||||
+Many IPs within Amlogic SoCs rely on canvas indexes to read/write pixel data
|
||||
+rather than use the phy addresses directly. For instance, this is the case for
|
||||
+the video decoders and the display.
|
||||
+
|
||||
+Amlogic SoCs have 256 canvas.
|
||||
+
|
||||
+Device Tree Bindings:
|
||||
+---------------------
|
||||
+
|
||||
+Video Lookup Table
|
||||
+--------------------------
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: "amlogic,canvas"
|
||||
+- reg: Base physical address and size of the canvas registers.
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+canvas: video-lut@48 {
|
||||
+ compatible = "amlogic,canvas";
|
||||
+ reg = <0x0 0x48 0x0 0x14>;
|
||||
+};
|
||||
@@ -1,313 +0,0 @@
|
||||
From 21c3e7d31208b0c4fb4a6c0a8c52e6820a40596a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 13:17:07 +0200
|
||||
Subject: [PATCH] soc: amlogic: add meson-canvas driver
|
||||
|
||||
Amlogic SoCs have a repository of 256 canvas which they use to
|
||||
describe pixel buffers.
|
||||
|
||||
They contain metadata like width, height, block mode, endianness [..]
|
||||
|
||||
Many IPs within those SoCs like vdec/vpu rely on those canvas to read/write
|
||||
pixels.
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
drivers/soc/amlogic/Kconfig | 7 +
|
||||
drivers/soc/amlogic/Makefile | 1 +
|
||||
drivers/soc/amlogic/meson-canvas.c | 185 +++++++++++++++++++++++
|
||||
include/linux/soc/amlogic/meson-canvas.h | 65 ++++++++
|
||||
4 files changed, 258 insertions(+)
|
||||
create mode 100644 drivers/soc/amlogic/meson-canvas.c
|
||||
create mode 100644 include/linux/soc/amlogic/meson-canvas.h
|
||||
|
||||
diff --git a/drivers/soc/amlogic/Kconfig b/drivers/soc/amlogic/Kconfig
|
||||
index b04f6e4aedbc1..2f282b4729120 100644
|
||||
--- a/drivers/soc/amlogic/Kconfig
|
||||
+++ b/drivers/soc/amlogic/Kconfig
|
||||
@@ -1,5 +1,12 @@
|
||||
menu "Amlogic SoC drivers"
|
||||
|
||||
+config MESON_CANVAS
|
||||
+ tristate "Amlogic Meson Canvas driver"
|
||||
+ depends on ARCH_MESON || COMPILE_TEST
|
||||
+ default n
|
||||
+ help
|
||||
+ Say yes to support the canvas IP for Amlogic SoCs.
|
||||
+
|
||||
config MESON_GX_SOCINFO
|
||||
bool "Amlogic Meson GX SoC Information driver"
|
||||
depends on ARCH_MESON || COMPILE_TEST
|
||||
diff --git a/drivers/soc/amlogic/Makefile b/drivers/soc/amlogic/Makefile
|
||||
index 8fa321893928d..0ab16d35ac36d 100644
|
||||
--- a/drivers/soc/amlogic/Makefile
|
||||
+++ b/drivers/soc/amlogic/Makefile
|
||||
@@ -1,3 +1,4 @@
|
||||
+obj-$(CONFIG_MESON_CANVAS) += meson-canvas.o
|
||||
obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o
|
||||
obj-$(CONFIG_MESON_GX_PM_DOMAINS) += meson-gx-pwrc-vpu.o
|
||||
obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o
|
||||
diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
|
||||
new file mode 100644
|
||||
index 0000000000000..fce33ca76bb62
|
||||
--- /dev/null
|
||||
+++ b/drivers/soc/amlogic/meson-canvas.c
|
||||
@@ -0,0 +1,185 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 BayLibre, SAS
|
||||
+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2014 Endless Mobile
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/soc/amlogic/meson-canvas.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/io.h>
|
||||
+
|
||||
+#define NUM_CANVAS 256
|
||||
+
|
||||
+/* DMC Registers */
|
||||
+#define DMC_CAV_LUT_DATAL 0x00
|
||||
+ #define CANVAS_WIDTH_LBIT 29
|
||||
+ #define CANVAS_WIDTH_LWID 3
|
||||
+#define DMC_CAV_LUT_DATAH 0x04
|
||||
+ #define CANVAS_WIDTH_HBIT 0
|
||||
+ #define CANVAS_HEIGHT_BIT 9
|
||||
+ #define CANVAS_WRAP_BIT 22
|
||||
+ #define CANVAS_BLKMODE_BIT 24
|
||||
+ #define CANVAS_ENDIAN_BIT 26
|
||||
+#define DMC_CAV_LUT_ADDR 0x08
|
||||
+ #define CANVAS_LUT_WR_EN BIT(9)
|
||||
+ #define CANVAS_LUT_RD_EN BIT(8)
|
||||
+
|
||||
+struct meson_canvas {
|
||||
+ struct device *dev;
|
||||
+ void __iomem *reg_base;
|
||||
+ spinlock_t lock; /* canvas device lock */
|
||||
+ u8 used[NUM_CANVAS];
|
||||
+};
|
||||
+
|
||||
+static void canvas_write(struct meson_canvas *canvas, u32 reg, u32 val)
|
||||
+{
|
||||
+ writel_relaxed(val, canvas->reg_base + reg);
|
||||
+}
|
||||
+
|
||||
+static u32 canvas_read(struct meson_canvas *canvas, u32 reg)
|
||||
+{
|
||||
+ return readl_relaxed(canvas->reg_base + reg);
|
||||
+}
|
||||
+
|
||||
+struct meson_canvas *meson_canvas_get(struct device *dev)
|
||||
+{
|
||||
+ struct device_node *canvas_node;
|
||||
+ struct platform_device *canvas_pdev;
|
||||
+
|
||||
+ canvas_node = of_parse_phandle(dev->of_node, "amlogic,canvas", 0);
|
||||
+ if (!canvas_node)
|
||||
+ return ERR_PTR(-ENODEV);
|
||||
+
|
||||
+ canvas_pdev = of_find_device_by_node(canvas_node);
|
||||
+ if (!canvas_pdev)
|
||||
+ return ERR_PTR(-EPROBE_DEFER);
|
||||
+
|
||||
+ return dev_get_drvdata(&canvas_pdev->dev);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_get);
|
||||
+
|
||||
+int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index,
|
||||
+ u32 addr, u32 stride, u32 height,
|
||||
+ unsigned int wrap,
|
||||
+ unsigned int blkmode,
|
||||
+ unsigned int endian)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ if (!canvas->used[canvas_index]) {
|
||||
+ dev_err(canvas->dev,
|
||||
+ "Trying to setup non allocated canvas %u\n",
|
||||
+ canvas_index);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_DATAL,
|
||||
+ ((addr + 7) >> 3) |
|
||||
+ (((stride + 7) >> 3) << CANVAS_WIDTH_LBIT));
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_DATAH,
|
||||
+ ((((stride + 7) >> 3) >> CANVAS_WIDTH_LWID) <<
|
||||
+ CANVAS_WIDTH_HBIT) |
|
||||
+ (height << CANVAS_HEIGHT_BIT) |
|
||||
+ (wrap << CANVAS_WRAP_BIT) |
|
||||
+ (blkmode << CANVAS_BLKMODE_BIT) |
|
||||
+ (endian << CANVAS_ENDIAN_BIT));
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_ADDR,
|
||||
+ CANVAS_LUT_WR_EN | canvas_index);
|
||||
+
|
||||
+ /* Force a read-back to make sure everything is flushed. */
|
||||
+ canvas_read(canvas, DMC_CAV_LUT_DATAH);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_config);
|
||||
+
|
||||
+int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index)
|
||||
+{
|
||||
+ int i;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ for (i = 0; i < NUM_CANVAS; ++i) {
|
||||
+ if (!canvas->used[i]) {
|
||||
+ canvas->used[i] = 1;
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ *canvas_index = i;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ dev_err(canvas->dev, "No more canvas available\n");
|
||||
+ return -ENODEV;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_alloc);
|
||||
+
|
||||
+int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ if (!canvas->used[canvas_index]) {
|
||||
+ dev_err(canvas->dev,
|
||||
+ "Trying to free unused canvas %u\n", canvas_index);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ canvas->used[canvas_index] = 0;
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_free);
|
||||
+
|
||||
+static int meson_canvas_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ struct meson_canvas *canvas;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+
|
||||
+ canvas = devm_kzalloc(dev, sizeof(*canvas), GFP_KERNEL);
|
||||
+ if (!canvas)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ canvas->reg_base = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(canvas->reg_base))
|
||||
+ return PTR_ERR(canvas->reg_base);
|
||||
+
|
||||
+ canvas->dev = dev;
|
||||
+ spin_lock_init(&canvas->lock);
|
||||
+ dev_set_drvdata(dev, canvas);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id canvas_dt_match[] = {
|
||||
+ { .compatible = "amlogic,canvas" },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, canvas_dt_match);
|
||||
+
|
||||
+static struct platform_driver meson_canvas_driver = {
|
||||
+ .probe = meson_canvas_probe,
|
||||
+ .driver = {
|
||||
+ .name = "amlogic-canvas",
|
||||
+ .of_match_table = canvas_dt_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(meson_canvas_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Amlogic Canvas driver");
|
||||
+MODULE_AUTHOR("Maxime Jourdan <mjourdan@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff --git a/include/linux/soc/amlogic/meson-canvas.h b/include/linux/soc/amlogic/meson-canvas.h
|
||||
new file mode 100644
|
||||
index 0000000000000..b4dde2fbeb3fb
|
||||
--- /dev/null
|
||||
+++ b/include/linux/soc/amlogic/meson-canvas.h
|
||||
@@ -0,0 +1,65 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 BayLibre, SAS
|
||||
+ */
|
||||
+#ifndef __SOC_MESON_CANVAS_H
|
||||
+#define __SOC_MESON_CANVAS_H
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+
|
||||
+#define MESON_CANVAS_WRAP_NONE 0x00
|
||||
+#define MESON_CANVAS_WRAP_X 0x01
|
||||
+#define MESON_CANVAS_WRAP_Y 0x02
|
||||
+
|
||||
+#define MESON_CANVAS_BLKMODE_LINEAR 0x00
|
||||
+#define MESON_CANVAS_BLKMODE_32x32 0x01
|
||||
+#define MESON_CANVAS_BLKMODE_64x64 0x02
|
||||
+
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP16 0x1
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP32 0x3
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP64 0x7
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP128 0xf
|
||||
+
|
||||
+struct meson_canvas;
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_get() - get a canvas provider instance
|
||||
+ *
|
||||
+ * @dev: consumer device pointer
|
||||
+ */
|
||||
+struct meson_canvas *meson_canvas_get(struct device *dev);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_alloc() - take ownership of a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: will be filled with the canvas ID
|
||||
+ */
|
||||
+int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_free() - remove ownership from a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
|
||||
+ */
|
||||
+int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_config() - configure a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
|
||||
+ * @addr: physical address to the pixel buffer
|
||||
+ * @stride: width of the buffer
|
||||
+ * @height: height of the buffer
|
||||
+ * @wrap: undocumented
|
||||
+ * @blkmode: block mode (linear, 32x32, 64x64)
|
||||
+ * @endian: byte swapping (swap16, swap32, swap64, swap128)
|
||||
+ */
|
||||
+int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index,
|
||||
+ u32 addr, u32 stride, u32 height,
|
||||
+ unsigned int wrap, unsigned int blkmode,
|
||||
+ unsigned int endian);
|
||||
+
|
||||
+#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
From e4c19f493a541cd00df42c02ec8f544f9835cbe5 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 16:09:09 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson-gx: add dmcbus and canvas nodes.
|
||||
|
||||
DMC is a small memory region with various registers,
|
||||
including the ones needed for the canvas module.
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index b8dc4dbb391b6..5dd63ecf8b05b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -423,6 +423,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ dmcbus: bus@c8838000 {
|
||||
+ compatible = "simple-bus";
|
||||
+ reg = <0x0 0xc8838000 0x0 0x400>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges = <0x0 0x0 0x0 0xc8838000 0x0 0x400>;
|
||||
+
|
||||
+ canvas: video-lut@48 {
|
||||
+ compatible = "amlogic,canvas";
|
||||
+ reg = <0x0 0x48 0x0 0x14>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
hiubus: bus@c883c000 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0xc883c000 0x0 0x2000>;
|
||||
@@ -1,366 +0,0 @@
|
||||
From 665dbad80386dcb9ac78ec6153d8d518da9bb50e Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 16:22:17 +0200
|
||||
Subject: [PATCH] drm/meson: convert to the new canvas module
|
||||
|
||||
This removes the meson_canvas files within the meson/drm layer
|
||||
and makes use of the new canvas module that is referenced in the dts.
|
||||
|
||||
Canvases can be used by different IPs and modules, and it is as such
|
||||
preferable to rely on a module that can safely dispatch canvases on
|
||||
demand.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
---
|
||||
.../bindings/display/amlogic,meson-vpu.txt | 9 +--
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 7 +-
|
||||
drivers/gpu/drm/meson/Kconfig | 1 +
|
||||
drivers/gpu/drm/meson/Makefile | 2 +-
|
||||
drivers/gpu/drm/meson/meson_canvas.c | 70 -------------------
|
||||
drivers/gpu/drm/meson/meson_canvas.h | 42 -----------
|
||||
drivers/gpu/drm/meson/meson_crtc.c | 9 ++-
|
||||
drivers/gpu/drm/meson/meson_drv.c | 22 ++----
|
||||
drivers/gpu/drm/meson/meson_drv.h | 5 +-
|
||||
drivers/gpu/drm/meson/meson_plane.c | 3 +-
|
||||
drivers/gpu/drm/meson/meson_viu.c | 1 -
|
||||
11 files changed, 26 insertions(+), 145 deletions(-)
|
||||
delete mode 100644 drivers/gpu/drm/meson/meson_canvas.c
|
||||
delete mode 100644 drivers/gpu/drm/meson/meson_canvas.h
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
index 057b81335775e..60b6e13986365 100644
|
||||
--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
+++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
@@ -60,9 +60,9 @@ Required properties:
|
||||
- reg: base address and size of he following memory-mapped regions :
|
||||
- vpu
|
||||
- hhi
|
||||
- - dmc
|
||||
- reg-names: should contain the names of the previous memory regions
|
||||
- interrupts: should contain the VENC Vsync interrupt number
|
||||
+- amlogic,canvas: should point to a meson canvas provider node
|
||||
|
||||
Optional properties:
|
||||
- power-domains: Optional phandle to associated power domain as described in
|
||||
@@ -98,13 +98,14 @@ tv-connector {
|
||||
vpu: vpu@d0100000 {
|
||||
compatible = "amlogic,meson-gxbb-vpu";
|
||||
reg = <0x0 0xd0100000 0x0 0x100000>,
|
||||
- <0x0 0xc883c000 0x0 0x1000>,
|
||||
- <0x0 0xc8838000 0x0 0x1000>;
|
||||
- reg-names = "vpu", "hhi", "dmc";
|
||||
+ <0x0 0xc883c000 0x0 0x1000>;
|
||||
+ reg-names = "vpu", "hhi";
|
||||
interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
/* CVBS VDAC output port */
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 5dd63ecf8b05b..737b741df0355 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -499,13 +499,14 @@
|
||||
vpu: vpu@d0100000 {
|
||||
compatible = "amlogic,meson-gx-vpu";
|
||||
reg = <0x0 0xd0100000 0x0 0x100000>,
|
||||
- <0x0 0xc883c000 0x0 0x1000>,
|
||||
- <0x0 0xc8838000 0x0 0x1000>;
|
||||
- reg-names = "vpu", "hhi", "dmc";
|
||||
+ <0x0 0xc883c000 0x0 0x1000>;
|
||||
+ reg-names = "vpu", "hhi";
|
||||
interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
/* CVBS VDAC output port */
|
||||
cvbs_vdac_port: port@0 {
|
||||
reg = <0>;
|
||||
diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
|
||||
index 3ce51d8dfe1c8..c28b69f485555 100644
|
||||
--- a/drivers/gpu/drm/meson/Kconfig
|
||||
+++ b/drivers/gpu/drm/meson/Kconfig
|
||||
@@ -7,6 +7,7 @@ config DRM_MESON
|
||||
select DRM_GEM_CMA_HELPER
|
||||
select VIDEOMODE_HELPERS
|
||||
select REGMAP_MMIO
|
||||
+ select MESON_CANVAS
|
||||
|
||||
config DRM_MESON_DW_HDMI
|
||||
tristate "HDMI Synopsys Controller support for Amlogic Meson Display"
|
||||
diff --git a/drivers/gpu/drm/meson/Makefile b/drivers/gpu/drm/meson/Makefile
|
||||
index c5c4cc362f024..bd67429185ff7 100644
|
||||
--- a/drivers/gpu/drm/meson/Makefile
|
||||
+++ b/drivers/gpu/drm/meson/Makefile
|
||||
@@ -1,5 +1,5 @@
|
||||
meson-drm-y := meson_drv.o meson_plane.o meson_crtc.o meson_venc_cvbs.o
|
||||
-meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o meson_canvas.o
|
||||
+meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o
|
||||
|
||||
obj-$(CONFIG_DRM_MESON) += meson-drm.o
|
||||
obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o
|
||||
diff --git a/drivers/gpu/drm/meson/meson_canvas.c b/drivers/gpu/drm/meson/meson_canvas.c
|
||||
deleted file mode 100644
|
||||
index 08f6073d967e0..0000000000000
|
||||
--- a/drivers/gpu/drm/meson/meson_canvas.c
|
||||
+++ /dev/null
|
||||
@@ -1,70 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (C) 2016 BayLibre, SAS
|
||||
- * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
- * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
|
||||
- * Copyright (C) 2014 Endless Mobile
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or
|
||||
- * modify it under the terms of the GNU General Public License as
|
||||
- * published by the Free Software Foundation; either version 2 of the
|
||||
- * License, or (at your option) any later version.
|
||||
- *
|
||||
- * This program is distributed in the hope that it will be useful, but
|
||||
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
- * General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
- */
|
||||
-
|
||||
-#include <linux/kernel.h>
|
||||
-#include <linux/module.h>
|
||||
-#include "meson_drv.h"
|
||||
-#include "meson_canvas.h"
|
||||
-#include "meson_registers.h"
|
||||
-
|
||||
-/**
|
||||
- * DOC: Canvas
|
||||
- *
|
||||
- * CANVAS is a memory zone where physical memory frames information
|
||||
- * are stored for the VIU to scanout.
|
||||
- */
|
||||
-
|
||||
-/* DMC Registers */
|
||||
-#define DMC_CAV_LUT_DATAL 0x48 /* 0x12 offset in data sheet */
|
||||
-#define CANVAS_WIDTH_LBIT 29
|
||||
-#define CANVAS_WIDTH_LWID 3
|
||||
-#define DMC_CAV_LUT_DATAH 0x4c /* 0x13 offset in data sheet */
|
||||
-#define CANVAS_WIDTH_HBIT 0
|
||||
-#define CANVAS_HEIGHT_BIT 9
|
||||
-#define CANVAS_BLKMODE_BIT 24
|
||||
-#define DMC_CAV_LUT_ADDR 0x50 /* 0x14 offset in data sheet */
|
||||
-#define CANVAS_LUT_WR_EN (0x2 << 8)
|
||||
-#define CANVAS_LUT_RD_EN (0x1 << 8)
|
||||
-
|
||||
-void meson_canvas_setup(struct meson_drm *priv,
|
||||
- uint32_t canvas_index, uint32_t addr,
|
||||
- uint32_t stride, uint32_t height,
|
||||
- unsigned int wrap,
|
||||
- unsigned int blkmode)
|
||||
-{
|
||||
- unsigned int val;
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_DATAL,
|
||||
- (((addr + 7) >> 3)) |
|
||||
- (((stride + 7) >> 3) << CANVAS_WIDTH_LBIT));
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_DATAH,
|
||||
- ((((stride + 7) >> 3) >> CANVAS_WIDTH_LWID) <<
|
||||
- CANVAS_WIDTH_HBIT) |
|
||||
- (height << CANVAS_HEIGHT_BIT) |
|
||||
- (wrap << 22) |
|
||||
- (blkmode << CANVAS_BLKMODE_BIT));
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_ADDR,
|
||||
- CANVAS_LUT_WR_EN | canvas_index);
|
||||
-
|
||||
- /* Force a read-back to make sure everything is flushed. */
|
||||
- regmap_read(priv->dmc, DMC_CAV_LUT_DATAH, &val);
|
||||
-}
|
||||
diff --git a/drivers/gpu/drm/meson/meson_canvas.h b/drivers/gpu/drm/meson/meson_canvas.h
|
||||
deleted file mode 100644
|
||||
index af1759da4b275..0000000000000
|
||||
--- a/drivers/gpu/drm/meson/meson_canvas.h
|
||||
+++ /dev/null
|
||||
@@ -1,42 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (C) 2016 BayLibre, SAS
|
||||
- * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
- * Copyright (C) 2014 Endless Mobile
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or
|
||||
- * modify it under the terms of the GNU General Public License as
|
||||
- * published by the Free Software Foundation; either version 2 of the
|
||||
- * License, or (at your option) any later version.
|
||||
- *
|
||||
- * This program is distributed in the hope that it will be useful, but
|
||||
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
- * General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
- */
|
||||
-
|
||||
-/* Canvas LUT Memory */
|
||||
-
|
||||
-#ifndef __MESON_CANVAS_H
|
||||
-#define __MESON_CANVAS_H
|
||||
-
|
||||
-#define MESON_CANVAS_ID_OSD1 0x4e
|
||||
-
|
||||
-/* Canvas configuration. */
|
||||
-#define MESON_CANVAS_WRAP_NONE 0x00
|
||||
-#define MESON_CANVAS_WRAP_X 0x01
|
||||
-#define MESON_CANVAS_WRAP_Y 0x02
|
||||
-
|
||||
-#define MESON_CANVAS_BLKMODE_LINEAR 0x00
|
||||
-#define MESON_CANVAS_BLKMODE_32x32 0x01
|
||||
-#define MESON_CANVAS_BLKMODE_64x64 0x02
|
||||
-
|
||||
-void meson_canvas_setup(struct meson_drm *priv,
|
||||
- uint32_t canvas_index, uint32_t addr,
|
||||
- uint32_t stride, uint32_t height,
|
||||
- unsigned int wrap,
|
||||
- unsigned int blkmode);
|
||||
-
|
||||
-#endif /* __MESON_CANVAS_H */
|
||||
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
index 05520202c9677..1ca9c6c45f9b9 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_crtc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "meson_venc.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
/* CRTC definition */
|
||||
@@ -193,10 +192,10 @@ void meson_crtc_irq(struct meson_drm *priv)
|
||||
} else
|
||||
meson_vpp_disable_interlace_vscaler_osd1(priv);
|
||||
|
||||
- meson_canvas_setup(priv, MESON_CANVAS_ID_OSD1,
|
||||
- priv->viu.osd1_addr, priv->viu.osd1_stride,
|
||||
- priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE,
|
||||
- MESON_CANVAS_BLKMODE_LINEAR);
|
||||
+ meson_canvas_config(priv->canvas, priv->canvas_id_osd1,
|
||||
+ priv->viu.osd1_addr, priv->viu.osd1_stride,
|
||||
+ priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE,
|
||||
+ MESON_CANVAS_BLKMODE_LINEAR, 0);
|
||||
|
||||
/* Enable OSD1 */
|
||||
writel_bits_relaxed(VPP_OSD1_POSTBLEND, VPP_OSD1_POSTBLEND,
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
|
||||
index d3443125e6616..fb5b0e3c5efce 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.c
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
#include "meson_venc.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
#define DRIVER_NAME "meson"
|
||||
@@ -216,25 +215,15 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
|
||||
goto free_drm;
|
||||
}
|
||||
|
||||
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc");
|
||||
- if (!res) {
|
||||
- ret = -EINVAL;
|
||||
- goto free_drm;
|
||||
- }
|
||||
- /* Simply ioremap since it may be a shared register zone */
|
||||
- regs = devm_ioremap(dev, res->start, resource_size(res));
|
||||
- if (!regs) {
|
||||
- ret = -EADDRNOTAVAIL;
|
||||
+ priv->canvas = meson_canvas_get(dev);
|
||||
+ if (IS_ERR(priv->canvas)) {
|
||||
+ ret = PTR_ERR(priv->canvas);
|
||||
goto free_drm;
|
||||
}
|
||||
|
||||
- priv->dmc = devm_regmap_init_mmio(dev, regs,
|
||||
- &meson_regmap_config);
|
||||
- if (IS_ERR(priv->dmc)) {
|
||||
- dev_err(&pdev->dev, "Couldn't create the DMC regmap\n");
|
||||
- ret = PTR_ERR(priv->dmc);
|
||||
+ ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1);
|
||||
+ if (ret)
|
||||
goto free_drm;
|
||||
- }
|
||||
|
||||
priv->vsync_irq = platform_get_irq(pdev, 0);
|
||||
|
||||
@@ -315,6 +304,7 @@ static void meson_drv_unbind(struct device *dev)
|
||||
struct drm_device *drm = dev_get_drvdata(dev);
|
||||
struct meson_drm *priv = drm->dev_private;
|
||||
|
||||
+ meson_canvas_free(priv->canvas, priv->canvas_id_osd1);
|
||||
drm_dev_unregister(drm);
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
drm_fbdev_cma_fini(priv->fbdev);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
|
||||
index 8450d6ac8c9bc..9e902a6df7843 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.h
|
||||
@@ -22,15 +22,18 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/of.h>
|
||||
+#include <linux/soc/amlogic/meson-canvas.h>
|
||||
#include <drm/drmP.h>
|
||||
|
||||
struct meson_drm {
|
||||
struct device *dev;
|
||||
void __iomem *io_base;
|
||||
struct regmap *hhi;
|
||||
- struct regmap *dmc;
|
||||
int vsync_irq;
|
||||
|
||||
+ struct meson_canvas *canvas;
|
||||
+ u8 canvas_id_osd1;
|
||||
+
|
||||
struct drm_device *drm;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_fbdev_cma *fbdev;
|
||||
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
|
||||
index 12c80dfcff59b..8745f9209625b 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_plane.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_plane.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "meson_plane.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
struct meson_plane {
|
||||
@@ -105,7 +104,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
OSD_BLK0_ENABLE;
|
||||
|
||||
/* Set up BLK0 to point to the right canvas */
|
||||
- priv->viu.osd1_blk0_cfg[0] = ((MESON_CANVAS_ID_OSD1 << OSD_CANVAS_SEL) |
|
||||
+ priv->viu.osd1_blk0_cfg[0] = ((priv->canvas_id_osd1 << OSD_CANVAS_SEL) |
|
||||
OSD_ENDIANNESS_LE);
|
||||
|
||||
/* On GXBB, Use the old non-HDR RGB2YUV converter */
|
||||
diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c
|
||||
index 6bcfa527c1801..5b48c4c0985b5 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_viu.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_viu.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "meson_viu.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_venc.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
/**
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0ceff9fb866173338b3ca79657ce6bf9aa3b2a9a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:05:05 +0200
|
||||
Subject: [PATCH] dt-bindings: media: add Amlogic Video Decoder Bindings
|
||||
|
||||
Add documentation for the meson vdec dts node.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
.../bindings/media/amlogic,vdec.txt | 63 +++++++++++++++++++
|
||||
1 file changed, 63 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/amlogic,vdec.txt b/Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
new file mode 100644
|
||||
index 0000000000000..c6450f2e7f28f
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
@@ -0,0 +1,63 @@
|
||||
+Amlogic Video Decoder
|
||||
+================================
|
||||
+
|
||||
+The VDEC IP is composed of the following blocks :
|
||||
+
|
||||
+- ESPARSER is a bitstream parser that outputs to a VIFIFO. Further VDEC blocks
|
||||
+then feed from this VIFIFO.
|
||||
+- VDEC_1 can decode MPEG-1, MPEG-2, MPEG-4 part 2, H.263, H.264.
|
||||
+- VDEC_2 is used as a helper for corner cases like H.264 4K on older SoCs.
|
||||
+It is not handled by this driver.
|
||||
+- VDEC_HCODEC is the H.264 encoding block. It is not handled by this driver.
|
||||
+- VDEC_HEVC can decode HEVC and VP9.
|
||||
+
|
||||
+Device Tree Bindings:
|
||||
+---------------------
|
||||
+
|
||||
+VDEC: Video Decoder
|
||||
+--------------------------
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: value should be different for each SoC family as :
|
||||
+ - GXBB (S905) : "amlogic,gxbb-vdec"
|
||||
+ - GXL (S905X, S905D) : "amlogic,gxl-vdec"
|
||||
+ - GXM (S912) : "amlogic,gxm-vdec"
|
||||
+- reg: base address and size of he following memory-mapped regions :
|
||||
+ - dos
|
||||
+ - esparser
|
||||
+- reg-names: should contain the names of the previous memory regions
|
||||
+- interrupts: should contain the vdec and esparser IRQs.
|
||||
+- amlogic,ao-sysctrl: should point to the AOBUS sysctrl node
|
||||
+- amlogic,canvas: should point to a canvas provider node
|
||||
+- clocks: should contain the following clocks :
|
||||
+ - dos_parser
|
||||
+ - dos
|
||||
+ - vdec_1
|
||||
+ - vdec_hevc
|
||||
+- clock-names: should contain the names of the previous clocks
|
||||
+- resets: should contain the parser reset.
|
||||
+- reset-names: should be "esparser".
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+vdec: video-decoder@c8820000 {
|
||||
+ compatible = "amlogic,gxbb-vdec";
|
||||
+ reg = <0x0 0xc8820000 0x0 0x10000>,
|
||||
+ <0x0 0xc110a580 0x0 0xe4>;
|
||||
+ reg-names = "dos", "esparser";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 44 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 32 IRQ_TYPE_EDGE_RISING>;
|
||||
+
|
||||
+ amlogic,ao-sysctrl = <&sysctrl_AO>;
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +0,0 @@
|
||||
From b73062fd0c0c9630ad00ec5c0e9880798a994875 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:02 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson-gx: add vdec entry
|
||||
|
||||
Add the video decoder dts entry
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 737b741df0355..d9e0fea71dbe3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -410,6 +410,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ vdec: video-decoder@c8820000 {
|
||||
+ compatible = "amlogic,gx-vdec";
|
||||
+ reg = <0x0 0xc8820000 0x0 0x10000>,
|
||||
+ <0x0 0xc110a580 0x0 0xe4>;
|
||||
+ reg-names = "dos", "esparser";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 44 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 32 IRQ_TYPE_EDGE_RISING>;
|
||||
+
|
||||
+ amlogic,ao-sysctrl = <&sysctrl_AO>;
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+ };
|
||||
+
|
||||
periphs: periphs@c8834000 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0xc8834000 0x0 0x2000>;
|
||||
@@ -1,64 +0,0 @@
|
||||
From c7b0311f4676661ad445f9e36c669886f1bc7835 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:22 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson: add vdec entries
|
||||
|
||||
This enables the video decoder for gxbb, gxl and gxm chips
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 11 +++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 11 +++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 4 ++++
|
||||
3 files changed, 26 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
index 98cbba6809caa..daee53a755d75 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
@@ -774,3 +774,14 @@
|
||||
compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxbb-vdec";
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
index c87a80e9bcc6a..bfd65d1a89591 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
@@ -775,3 +775,14 @@
|
||||
compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxl-vdec";
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
index 247888d68a3aa..2f356495be5ef 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
@@ -117,3 +117,7 @@
|
||||
&dwc3 {
|
||||
phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxm-vdec";
|
||||
+};
|
||||
@@ -1,466 +0,0 @@
|
||||
From 9d2683700060a36200da3b296671485b7fec747f Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:42:56 +0200
|
||||
Subject: [PATCH] media: meson: vdec: add H.264 decoding support
|
||||
|
||||
Add support for V4L2_PIX_FMT_H264
|
||||
---
|
||||
drivers/media/platform/meson/vdec/Makefile | 2 +-
|
||||
.../media/platform/meson/vdec/codec_h264.c | 354 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_h264.h | 13 +
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 31 ++
|
||||
4 files changed, 399 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_h264.c
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_h264.h
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/Makefile b/drivers/media/platform/meson/vdec/Makefile
|
||||
index 6bea129084b76..711d990c760e0 100644
|
||||
--- a/drivers/media/platform/meson/vdec/Makefile
|
||||
+++ b/drivers/media/platform/meson/vdec/Makefile
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o
|
||||
meson-vdec-objs += vdec_1.o
|
||||
-meson-vdec-objs += codec_mpeg12.o
|
||||
+meson-vdec-objs += codec_mpeg12.o codec_h264.o
|
||||
|
||||
obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_h264.c b/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
new file mode 100644
|
||||
index 0000000000000..7c47ec35efa54
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
@@ -0,0 +1,354 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#include <media/v4l2-mem2mem.h>
|
||||
+#include <media/videobuf2-dma-contig.h>
|
||||
+
|
||||
+#include "vdec_helpers.h"
|
||||
+#include "dos_regs.h"
|
||||
+
|
||||
+#define SIZE_EXT_FW (20 * SZ_1K)
|
||||
+#define SIZE_WORKSPACE 0x1ee000
|
||||
+#define SIZE_SEI (8 * SZ_1K)
|
||||
+
|
||||
+/* Offset added by the firmware which must be substracted
|
||||
+ * from the workspace phyaddr
|
||||
+ */
|
||||
+#define WORKSPACE_BUF_OFFSET 0x1000000
|
||||
+
|
||||
+#define SEI_DATA_READY BIT(15)
|
||||
+
|
||||
+/* ISR status */
|
||||
+#define CMD_SET_PARAM 1
|
||||
+#define CMD_FRAMES_READY 2
|
||||
+#define CMD_FATAL_ERROR 6
|
||||
+#define CMD_BAD_WIDTH 7
|
||||
+#define CMD_BAD_HEIGHT 8
|
||||
+
|
||||
+/* Picture type */
|
||||
+#define PIC_SINGLE_FRAME 0
|
||||
+#define PIC_TOP_BOT_TOP 1
|
||||
+#define PIC_BOT_TOP_BOT 2
|
||||
+#define PIC_DOUBLE_FRAME 3
|
||||
+#define PIC_TRIPLE_FRAME 4
|
||||
+#define PIC_TOP_BOT 5
|
||||
+#define PIC_BOT_TOP 6
|
||||
+#define PIC_INVALID 7
|
||||
+
|
||||
+/* Size of Motion Vector per macroblock */
|
||||
+#define MB_MV_SIZE 96
|
||||
+
|
||||
+struct codec_h264 {
|
||||
+ /* H.264 decoder requires an extended firmware */
|
||||
+ void *ext_fw_vaddr;
|
||||
+ dma_addr_t ext_fw_paddr;
|
||||
+
|
||||
+ /* Buffer for the H.264 Workspace */
|
||||
+ void *workspace_vaddr;
|
||||
+ dma_addr_t workspace_paddr;
|
||||
+
|
||||
+ /* Buffer for the H.264 references MV */
|
||||
+ void *ref_vaddr;
|
||||
+ dma_addr_t ref_paddr;
|
||||
+ u32 ref_size;
|
||||
+
|
||||
+ /* Buffer for parsed SEI data */
|
||||
+ void *sei_vaddr;
|
||||
+ dma_addr_t sei_paddr;
|
||||
+
|
||||
+ int received_0;
|
||||
+};
|
||||
+
|
||||
+static int codec_h264_can_recycle(struct amvdec_core *core)
|
||||
+{
|
||||
+ return !amvdec_read_dos(core, AV_SCRATCH_7) ||
|
||||
+ !amvdec_read_dos(core, AV_SCRATCH_8);
|
||||
+}
|
||||
+
|
||||
+static void codec_h264_recycle(struct amvdec_core *core, u32 buf_idx)
|
||||
+{
|
||||
+ /* Tell the decoder he can recycle this buffer.
|
||||
+ * AV_SCRATCH_8 serves the same purpose.
|
||||
+ */
|
||||
+ if (!amvdec_read_dos(core, AV_SCRATCH_7))
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_7, buf_idx + 1);
|
||||
+ else
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_8, buf_idx + 1);
|
||||
+}
|
||||
+
|
||||
+static int codec_h264_start(struct amvdec_session *sess) {
|
||||
+ u32 workspace_offset;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+
|
||||
+ /* Allocate some memory for the H.264 decoder's state */
|
||||
+ h264->workspace_vaddr =
|
||||
+ dma_alloc_coherent(core->dev, SIZE_WORKSPACE, &h264->workspace_paddr, GFP_KERNEL);
|
||||
+ if (!h264->workspace_vaddr) {
|
||||
+ dev_err(core->dev, "Failed to alloc H.264 Workspace\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ /* Allocate some memory for the H.264 SEI dump */
|
||||
+ h264->sei_vaddr =
|
||||
+ dma_alloc_coherent(core->dev, SIZE_SEI, &h264->sei_paddr, GFP_KERNEL);
|
||||
+ if (!h264->sei_vaddr) {
|
||||
+ dev_err(core->dev, "Failed to alloc H.264 SEI\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ amvdec_write_dos_bits(core, POWER_CTL_VLD, BIT(9) | BIT(6));
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_CTRL, 0);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_0, 0);
|
||||
+
|
||||
+ workspace_offset = h264->workspace_paddr - WORKSPACE_BUF_OFFSET;
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_1, workspace_offset);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_G, h264->ext_fw_paddr);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_I, h264->sei_paddr - workspace_offset);
|
||||
+
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_7, 0);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_8, 0);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_9, 0);
|
||||
+
|
||||
+ /* Enable "error correction" */
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_F, (amvdec_read_dos(core, AV_SCRATCH_F) & 0xffffffc3) | BIT(4) | BIT(7));
|
||||
+
|
||||
+ amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int codec_h264_stop(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ if (h264->ext_fw_vaddr)
|
||||
+ dma_free_coherent(core->dev, SIZE_EXT_FW,
|
||||
+ h264->ext_fw_vaddr, h264->ext_fw_paddr);
|
||||
+
|
||||
+ if (h264->workspace_vaddr)
|
||||
+ dma_free_coherent(core->dev, SIZE_WORKSPACE,
|
||||
+ h264->workspace_vaddr, h264->workspace_paddr);
|
||||
+
|
||||
+ if (h264->ref_vaddr)
|
||||
+ dma_free_coherent(core->dev, h264->ref_size,
|
||||
+ h264->ref_vaddr, h264->ref_paddr);
|
||||
+
|
||||
+ if (h264->sei_vaddr)
|
||||
+ dma_free_coherent(core->dev, SIZE_SEI,
|
||||
+ h264->sei_vaddr, h264->sei_paddr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int codec_h264_load_extended_firmware(struct amvdec_session *sess, const u8 *data, u32 len)
|
||||
+{
|
||||
+ struct codec_h264 *h264;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ h264 = kzalloc(sizeof(*h264), GFP_KERNEL);
|
||||
+ if (!h264)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ sess->priv = h264;
|
||||
+
|
||||
+ if (len < SIZE_EXT_FW)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ h264->ext_fw_vaddr = dma_alloc_coherent(core->dev, SIZE_EXT_FW,
|
||||
+ &h264->ext_fw_paddr, GFP_KERNEL);
|
||||
+ if (!h264->ext_fw_vaddr) {
|
||||
+ dev_err(core->dev, "Failed to alloc H.264 extended fw\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(h264->ext_fw_vaddr, data, SIZE_EXT_FW);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* Configure the H.264 decoder when the esparser finished parsing
|
||||
+ * the first keyframe
|
||||
+ */
|
||||
+static void codec_h264_set_param(struct amvdec_session *sess) {
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ u32 max_reference_size;
|
||||
+ u32 parsed_info, mb_width, mb_height, mb_total;
|
||||
+ u32 actual_dpb_size = v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx);
|
||||
+ u32 max_dpb_size = 4;
|
||||
+
|
||||
+ sess->keyframe_found = 1;
|
||||
+
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_7, 0);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_8, 0);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_9, 0);
|
||||
+
|
||||
+ parsed_info = amvdec_read_dos(core, AV_SCRATCH_1);
|
||||
+
|
||||
+ /* Total number of 16x16 macroblocks */
|
||||
+ mb_total = (parsed_info >> 8) & 0xffff;
|
||||
+
|
||||
+ /* Number of macroblocks per line */
|
||||
+ mb_width = parsed_info & 0xff;
|
||||
+
|
||||
+ /* Number of macroblock lines */
|
||||
+ mb_height = mb_total / mb_width;
|
||||
+
|
||||
+ max_reference_size = (parsed_info >> 24) & 0x7f;
|
||||
+
|
||||
+ /* Align to a multiple of 4 macroblocks */
|
||||
+ mb_width = ALIGN(mb_width, 4);
|
||||
+ mb_height = ALIGN(mb_height, 4);
|
||||
+ mb_total = mb_width * mb_height;
|
||||
+
|
||||
+ amvdec_set_canvases(sess, (u32[]){ ANC0_CANVAS_ADDR, 0 },
|
||||
+ (u32[]){ 24, 0 });
|
||||
+
|
||||
+ if (max_reference_size > max_dpb_size)
|
||||
+ max_dpb_size = max_reference_size;
|
||||
+
|
||||
+ max_reference_size++;
|
||||
+ dev_dbg(core->dev,
|
||||
+ "max_ref_size = %u; max_dpb_size = %u; actual_dpb_size = %u\n",
|
||||
+ max_reference_size, max_dpb_size, actual_dpb_size);
|
||||
+
|
||||
+ h264->ref_size = mb_total * MB_MV_SIZE * max_reference_size;
|
||||
+ h264->ref_vaddr = dma_alloc_coherent(core->dev, h264->ref_size,
|
||||
+ &h264->ref_paddr, GFP_KERNEL);
|
||||
+ if (!h264->ref_vaddr) {
|
||||
+ dev_err(core->dev, "Failed to alloc refs (%u)\n",
|
||||
+ h264->ref_size);
|
||||
+ amvdec_abort(sess);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Address to store the references' MVs */
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_1, h264->ref_paddr);
|
||||
+ /* End of ref MV */
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_4, h264->ref_paddr + h264->ref_size);
|
||||
+
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_0, (max_reference_size << 24) |
|
||||
+ (actual_dpb_size << 16) |
|
||||
+ (max_dpb_size << 8));
|
||||
+}
|
||||
+
|
||||
+static void codec_h264_frames_ready(struct amvdec_session *sess, u32 status)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ int error_count;
|
||||
+ int num_frames;
|
||||
+ int i;
|
||||
+
|
||||
+ error_count = amvdec_read_dos(core, AV_SCRATCH_D);
|
||||
+ num_frames = (status >> 8) & 0xff;
|
||||
+ if (error_count) {
|
||||
+ dev_warn(core->dev,
|
||||
+ "decoder error(s) happened, count %d\n", error_count);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_D, 0);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < num_frames; i++) {
|
||||
+ u32 frame_status = amvdec_read_dos(core, AV_SCRATCH_1 + i * 4);
|
||||
+ u32 buffer_index = frame_status & 0x1f;
|
||||
+ u32 error = frame_status & 0x200;
|
||||
+ u32 pic_struct = (frame_status >> 5) & 0x7;
|
||||
+ u32 field = V4L2_FIELD_NONE;
|
||||
+
|
||||
+ /* A buffer decode error means it was decoded,
|
||||
+ * but part of the picture will have artifacts.
|
||||
+ * Typical reason is a temporarily corrupted bitstream
|
||||
+ */
|
||||
+ if (error)
|
||||
+ dev_info(core->dev, "Buffer %d decode error\n",
|
||||
+ buffer_index);
|
||||
+
|
||||
+ if (pic_struct == PIC_TOP_BOT)
|
||||
+ field = V4L2_FIELD_INTERLACED_TB;
|
||||
+ else if (pic_struct == PIC_BOT_TOP)
|
||||
+ field = V4L2_FIELD_INTERLACED_BT;
|
||||
+
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, field);
|
||||
+
|
||||
+ if (field != V4L2_FIELD_NONE && !h264->received_0)
|
||||
+ amvdec_rm_first_ts(sess);
|
||||
+
|
||||
+ h264->received_0 = 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t codec_h264_threaded_isr(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ u32 status;
|
||||
+ u32 size;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ status = amvdec_read_dos(core, AV_SCRATCH_0);
|
||||
+ cmd = status & 0xff;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case CMD_SET_PARAM:
|
||||
+ codec_h264_set_param(sess);
|
||||
+ break;
|
||||
+ case CMD_FRAMES_READY:
|
||||
+ codec_h264_frames_ready(sess, status);
|
||||
+ break;
|
||||
+ case CMD_FATAL_ERROR:
|
||||
+ dev_err(core->dev, "H.264 decoder fatal error\n");
|
||||
+ goto abort;
|
||||
+ case CMD_BAD_WIDTH:
|
||||
+ size = (amvdec_read_dos(core, AV_SCRATCH_1) + 1) * 16;
|
||||
+ dev_err(core->dev, "Unsupported video width: %u\n", size);
|
||||
+ goto abort;
|
||||
+ case CMD_BAD_HEIGHT:
|
||||
+ size = (amvdec_read_dos(core, AV_SCRATCH_1) + 1) * 16;
|
||||
+ dev_err(core->dev, "Unsupported video height: %u\n", size);
|
||||
+ goto abort;
|
||||
+ case 0:
|
||||
+ h264->received_0 = 1;
|
||||
+ break;
|
||||
+ case 9: /* Unused but not worth printing for */
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_info(core->dev, "Unexpected H264 ISR: %08X\n", cmd);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (cmd && cmd != CMD_SET_PARAM)
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_0, 0);
|
||||
+
|
||||
+ /* Decoder has some SEI data for us ; ignore */
|
||||
+ if (amvdec_read_dos(core, AV_SCRATCH_J) & SEI_DATA_READY)
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_J, 0);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+abort:
|
||||
+ amvdec_abort(sess);
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t codec_h264_isr(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1);
|
||||
+
|
||||
+ return IRQ_WAKE_THREAD;
|
||||
+}
|
||||
+
|
||||
+struct amvdec_codec_ops codec_h264_ops = {
|
||||
+ .start = codec_h264_start,
|
||||
+ .stop = codec_h264_stop,
|
||||
+ .load_extended_firmware = codec_h264_load_extended_firmware,
|
||||
+ .isr = codec_h264_isr,
|
||||
+ .threaded_isr = codec_h264_threaded_isr,
|
||||
+ .can_recycle = codec_h264_can_recycle,
|
||||
+ .recycle = codec_h264_recycle,
|
||||
+};
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_h264.h b/drivers/media/platform/meson/vdec/codec_h264.h
|
||||
new file mode 100644
|
||||
index 0000000000000..7a1597611faff
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_h264.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __MESON_VDEC_CODEC_H264_H_
|
||||
+#define __MESON_VDEC_CODEC_H264_H_
|
||||
+
|
||||
+#include "vdec.h"
|
||||
+
|
||||
+extern struct amvdec_codec_ops codec_h264_ops;
|
||||
+
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_platform.c b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
index 46eeb7426f547..9f7872feef74d 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
@@ -9,9 +9,20 @@
|
||||
|
||||
#include "vdec_1.h"
|
||||
#include "codec_mpeg12.h"
|
||||
+#include "codec_h264.h"
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_H264,
|
||||
+ .min_buffers = 21,
|
||||
+ .max_buffers = 24,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_h264_ops,
|
||||
+ .firmware_path = "meson/gxbb/vh264_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -36,6 +47,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_H264,
|
||||
+ .min_buffers = 21,
|
||||
+ .max_buffers = 24,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_h264_ops,
|
||||
+ .firmware_path = "meson/gxl/vh264_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -60,6 +81,16 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_H264,
|
||||
+ .min_buffers = 21,
|
||||
+ .max_buffers = 24,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_h264_ops,
|
||||
+ .firmware_path = "meson/gxm/vh264_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -1,304 +0,0 @@
|
||||
From 4e628eee07aed9d006a4c4b4a75d41f05924b4c8 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 16:01:55 +0200
|
||||
Subject: [PATCH] media: meson: vdec: add MPEG4 decoding support
|
||||
|
||||
Add support for V4L2_PIX_FMT_MPEG4, V4L2_PIX_FMT_XVID and
|
||||
V4L2_PIX_FMT_H.263
|
||||
---
|
||||
drivers/media/platform/meson/vdec/Makefile | 2 +-
|
||||
.../media/platform/meson/vdec/codec_mpeg4.c | 131 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_mpeg4.h | 13 ++
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 91 ++++++++++++
|
||||
4 files changed, 236 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_mpeg4.h
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/Makefile b/drivers/media/platform/meson/vdec/Makefile
|
||||
index 711d990c760e0..f167a61acb36d 100644
|
||||
--- a/drivers/media/platform/meson/vdec/Makefile
|
||||
+++ b/drivers/media/platform/meson/vdec/Makefile
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o
|
||||
meson-vdec-objs += vdec_1.o
|
||||
-meson-vdec-objs += codec_mpeg12.o codec_h264.o
|
||||
+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o
|
||||
|
||||
obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_mpeg4.c b/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
new file mode 100644
|
||||
index 0000000000000..c6db2640c91a7
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
@@ -0,0 +1,131 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#include <media/v4l2-mem2mem.h>
|
||||
+#include <media/videobuf2-dma-contig.h>
|
||||
+
|
||||
+#include "vdec_helpers.h"
|
||||
+#include "dos_regs.h"
|
||||
+
|
||||
+#define SIZE_WORKSPACE SZ_1M
|
||||
+/* Offset added by firmware, to substract from workspace paddr */
|
||||
+#define DCAC_BUFF_START_IP 0x02b00000
|
||||
+
|
||||
+/* map FW registers to known MPEG4 functions */
|
||||
+#define MP4_PIC_RATIO AV_SCRATCH_5
|
||||
+#define MP4_ERR_COUNT AV_SCRATCH_6
|
||||
+#define MP4_PIC_WH AV_SCRATCH_7
|
||||
+#define MREG_BUFFERIN AV_SCRATCH_8
|
||||
+#define MREG_BUFFEROUT AV_SCRATCH_9
|
||||
+#define MP4_NOT_CODED_CNT AV_SCRATCH_A
|
||||
+#define MP4_VOP_TIME_INC AV_SCRATCH_B
|
||||
+#define MP4_OFFSET_REG AV_SCRATCH_C
|
||||
+#define MP4_SYS_RATE AV_SCRATCH_E
|
||||
+#define MEM_OFFSET_REG AV_SCRATCH_F
|
||||
+#define MREG_FATAL_ERROR AV_SCRATCH_L
|
||||
+
|
||||
+struct codec_mpeg4 {
|
||||
+ /* Buffer for the MPEG4 Workspace */
|
||||
+ void *workspace_vaddr;
|
||||
+ dma_addr_t workspace_paddr;
|
||||
+};
|
||||
+
|
||||
+static int codec_mpeg4_can_recycle(struct amvdec_core *core)
|
||||
+{
|
||||
+ return !amvdec_read_dos(core, MREG_BUFFERIN);
|
||||
+}
|
||||
+
|
||||
+static void codec_mpeg4_recycle(struct amvdec_core *core, u32 buf_idx)
|
||||
+{
|
||||
+ amvdec_write_dos(core, MREG_BUFFERIN, ~(1 << buf_idx));
|
||||
+}
|
||||
+
|
||||
+static int codec_mpeg4_start(struct amvdec_session *sess) {
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_mpeg4 *mpeg4 = sess->priv;
|
||||
+ int ret;
|
||||
+
|
||||
+ mpeg4 = kzalloc(sizeof(*mpeg4), GFP_KERNEL);
|
||||
+ if (!mpeg4)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ sess->priv = mpeg4;
|
||||
+
|
||||
+ /* Allocate some memory for the MPEG4 decoder's state */
|
||||
+ mpeg4->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE,
|
||||
+ &mpeg4->workspace_paddr,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!mpeg4->workspace_vaddr) {
|
||||
+ dev_err(core->dev, "Failed to request MPEG4 Workspace\n");
|
||||
+ ret = -ENOMEM;
|
||||
+ goto free_mpeg4;
|
||||
+ }
|
||||
+
|
||||
+ amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_0, AV_SCRATCH_G, 0 },
|
||||
+ (u32[]){ 4, 4, 0 });
|
||||
+
|
||||
+ amvdec_write_dos(core, MEM_OFFSET_REG,
|
||||
+ mpeg4->workspace_paddr - DCAC_BUFF_START_IP);
|
||||
+ amvdec_write_dos(core, PSCALE_CTRL, 0);
|
||||
+ amvdec_write_dos(core, MP4_NOT_CODED_CNT, 0);
|
||||
+ amvdec_write_dos(core, MREG_BUFFERIN, 0);
|
||||
+ amvdec_write_dos(core, MREG_BUFFEROUT, 0);
|
||||
+ amvdec_write_dos(core, MREG_FATAL_ERROR, 0);
|
||||
+ amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+free_mpeg4:
|
||||
+ kfree(mpeg4);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int codec_mpeg4_stop(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct codec_mpeg4 *mpeg4 = sess->priv;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ if (mpeg4->workspace_vaddr) {
|
||||
+ dma_free_coherent(core->dev, SIZE_WORKSPACE,
|
||||
+ mpeg4->workspace_vaddr,
|
||||
+ mpeg4->workspace_paddr);
|
||||
+ mpeg4->workspace_vaddr = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t codec_mpeg4_isr(struct amvdec_session *sess)
|
||||
+{
|
||||
+ u32 reg;
|
||||
+ u32 buffer_index;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ reg = amvdec_read_dos(core, MREG_FATAL_ERROR);
|
||||
+ if (reg == 1)
|
||||
+ dev_err(core->dev, "mpeg4 fatal error\n");
|
||||
+
|
||||
+ reg = amvdec_read_dos(core, MREG_BUFFEROUT);
|
||||
+ if (reg) {
|
||||
+ sess->keyframe_found = 1;
|
||||
+ amvdec_read_dos(core, MP4_NOT_CODED_CNT);
|
||||
+ amvdec_read_dos(core, MP4_VOP_TIME_INC);
|
||||
+ buffer_index = reg & 0x7;
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, V4L2_FIELD_NONE);
|
||||
+ amvdec_write_dos(core, MREG_BUFFEROUT, 0);
|
||||
+ }
|
||||
+
|
||||
+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+struct amvdec_codec_ops codec_mpeg4_ops = {
|
||||
+ .start = codec_mpeg4_start,
|
||||
+ .stop = codec_mpeg4_stop,
|
||||
+ .isr = codec_mpeg4_isr,
|
||||
+ .can_recycle = codec_mpeg4_can_recycle,
|
||||
+ .recycle = codec_mpeg4_recycle,
|
||||
+};
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_mpeg4.h b/drivers/media/platform/meson/vdec/codec_mpeg4.h
|
||||
new file mode 100644
|
||||
index 0000000000000..b91b264131854
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mpeg4.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __MESON_VDEC_CODEC_MPEG4_H_
|
||||
+#define __MESON_VDEC_CODEC_MPEG4_H_
|
||||
+
|
||||
+#include "vdec.h"
|
||||
+
|
||||
+extern struct amvdec_codec_ops codec_mpeg4_ops;
|
||||
+
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_platform.c b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
index 9f7872feef74d..135d7566d716a 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
@@ -10,9 +10,40 @@
|
||||
#include "vdec_1.h"
|
||||
#include "codec_mpeg12.h"
|
||||
#include "codec_h264.h"
|
||||
+#include "codec_mpeg4.h"
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_H263,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/h263_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_XVID,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_H264,
|
||||
.min_buffers = 21,
|
||||
.max_buffers = 24,
|
||||
@@ -47,6 +78,36 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_H263,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/h263_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_XVID,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_H264,
|
||||
.min_buffers = 21,
|
||||
.max_buffers = 24,
|
||||
@@ -81,6 +142,36 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_H263,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/h263_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
+ .pixfmt = V4L2_PIX_FMT_XVID,
|
||||
+ .min_buffers = 8,
|
||||
+ .max_buffers = 8,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mpeg4_ops,
|
||||
+ .firmware_path = "meson/gx/vmpeg4_mc_5",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_H264,
|
||||
.min_buffers = 21,
|
||||
.max_buffers = 24,
|
||||
@@ -1,249 +0,0 @@
|
||||
From 920fefae2df25f616552de3c842965f671dd9bae Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 16:05:28 +0200
|
||||
Subject: [PATCH] media: meson: vdec: add MJPEG decoding support
|
||||
|
||||
Add support for V4L2_PIX_FMT_MJPEG
|
||||
---
|
||||
drivers/media/platform/meson/vdec/Makefile | 2 +-
|
||||
.../media/platform/meson/vdec/codec_mjpeg.c | 137 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_mjpeg.h | 13 ++
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 31 ++++
|
||||
4 files changed, 182 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_mjpeg.c
|
||||
create mode 100644 drivers/media/platform/meson/vdec/codec_mjpeg.h
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/Makefile b/drivers/media/platform/meson/vdec/Makefile
|
||||
index f167a61acb36d..20c23f9015ebd 100644
|
||||
--- a/drivers/media/platform/meson/vdec/Makefile
|
||||
+++ b/drivers/media/platform/meson/vdec/Makefile
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o
|
||||
meson-vdec-objs += vdec_1.o
|
||||
-meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o
|
||||
+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o
|
||||
|
||||
obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_mjpeg.c b/drivers/media/platform/meson/vdec/codec_mjpeg.c
|
||||
new file mode 100644
|
||||
index 0000000000000..f632c51c8fffe
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mjpeg.c
|
||||
@@ -0,0 +1,137 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#include <media/v4l2-mem2mem.h>
|
||||
+#include <media/videobuf2-dma-contig.h>
|
||||
+
|
||||
+#include "vdec_helpers.h"
|
||||
+#include "dos_regs.h"
|
||||
+
|
||||
+/* map FW registers to known MJPEG functions */
|
||||
+#define MREG_DECODE_PARAM AV_SCRATCH_2
|
||||
+#define MREG_TO_AMRISC AV_SCRATCH_8
|
||||
+#define MREG_FROM_AMRISC AV_SCRATCH_9
|
||||
+
|
||||
+static int codec_mjpeg_can_recycle(struct amvdec_core *core)
|
||||
+{
|
||||
+ return !amvdec_read_dos(core, MREG_TO_AMRISC);
|
||||
+}
|
||||
+
|
||||
+static void codec_mjpeg_recycle(struct amvdec_core *core, u32 buf_idx)
|
||||
+{
|
||||
+ amvdec_write_dos(core, MREG_TO_AMRISC, buf_idx + 1);
|
||||
+}
|
||||
+
|
||||
+/* 4 point triangle */
|
||||
+static const uint32_t filt_coef[] = {
|
||||
+ 0x20402000, 0x20402000, 0x1f3f2101, 0x1f3f2101,
|
||||
+ 0x1e3e2202, 0x1e3e2202, 0x1d3d2303, 0x1d3d2303,
|
||||
+ 0x1c3c2404, 0x1c3c2404, 0x1b3b2505, 0x1b3b2505,
|
||||
+ 0x1a3a2606, 0x1a3a2606, 0x19392707, 0x19392707,
|
||||
+ 0x18382808, 0x18382808, 0x17372909, 0x17372909,
|
||||
+ 0x16362a0a, 0x16362a0a, 0x15352b0b, 0x15352b0b,
|
||||
+ 0x14342c0c, 0x14342c0c, 0x13332d0d, 0x13332d0d,
|
||||
+ 0x12322e0e, 0x12322e0e, 0x11312f0f, 0x11312f0f,
|
||||
+ 0x10303010
|
||||
+};
|
||||
+
|
||||
+static void codec_mjpeg_init_scaler(struct amvdec_core *core)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ /* PSCALE cbus bmem enable */
|
||||
+ amvdec_write_dos(core, PSCALE_CTRL, 0xc000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 0);
|
||||
+ for (i = 0; i < ARRAY_SIZE(filt_coef); ++i) {
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, filt_coef[i]);
|
||||
+ }
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 74);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 82);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 78);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 86);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 73);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 81);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 77);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 85);
|
||||
+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000);
|
||||
+
|
||||
+ amvdec_write_dos(core, PSCALE_RST, 0x7);
|
||||
+ amvdec_write_dos(core, PSCALE_RST, 0);
|
||||
+}
|
||||
+
|
||||
+static int codec_mjpeg_start(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_0, 12);
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_1, 0x031a);
|
||||
+
|
||||
+ amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_4, 0 },
|
||||
+ (u32[]){ 4, 0 });
|
||||
+ codec_mjpeg_init_scaler(core);
|
||||
+
|
||||
+ amvdec_write_dos(core, MREG_TO_AMRISC, 0);
|
||||
+ amvdec_write_dos(core, MREG_FROM_AMRISC, 0);
|
||||
+ amvdec_write_dos(core, MCPU_INTR_MSK, 0xffff);
|
||||
+ amvdec_write_dos(core, MREG_DECODE_PARAM,
|
||||
+ (sess->height << 4) | 0x8000);
|
||||
+ amvdec_write_dos(core, VDEC_ASSIST_AMR1_INT8, 8);
|
||||
+
|
||||
+ /* Intra-only codec */
|
||||
+ sess->keyframe_found = 1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int codec_mjpeg_stop(struct amvdec_session *sess)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t codec_mjpeg_isr(struct amvdec_session *sess)
|
||||
+{
|
||||
+ u32 reg;
|
||||
+ u32 buffer_index;
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+
|
||||
+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1);
|
||||
+
|
||||
+ reg = amvdec_read_dos(core, MREG_FROM_AMRISC);
|
||||
+ if (!(reg & 0x7))
|
||||
+ return IRQ_HANDLED;
|
||||
+
|
||||
+ buffer_index = ((reg & 0x7) - 1) & 3;
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, V4L2_FIELD_NONE);
|
||||
+
|
||||
+ amvdec_write_dos(core, MREG_FROM_AMRISC, 0);
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+struct amvdec_codec_ops codec_mjpeg_ops = {
|
||||
+ .start = codec_mjpeg_start,
|
||||
+ .stop = codec_mjpeg_stop,
|
||||
+ .isr = codec_mjpeg_isr,
|
||||
+ .can_recycle = codec_mjpeg_can_recycle,
|
||||
+ .recycle = codec_mjpeg_recycle,
|
||||
+};
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_mjpeg.h b/drivers/media/platform/meson/vdec/codec_mjpeg.h
|
||||
new file mode 100644
|
||||
index 0000000000000..cc1cf731050d1
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mjpeg.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __MESON_VDEC_CODEC_MJPEG_H_
|
||||
+#define __MESON_VDEC_CODEC_MJPEG_H_
|
||||
+
|
||||
+#include "vdec.h"
|
||||
+
|
||||
+extern struct amvdec_codec_ops codec_mjpeg_ops;
|
||||
+
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_platform.c b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
index 135d7566d716a..1181832b5fe1e 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
@@ -11,9 +11,20 @@
|
||||
#include "codec_mpeg12.h"
|
||||
#include "codec_h264.h"
|
||||
#include "codec_mpeg4.h"
|
||||
+#include "codec_mjpeg.h"
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MJPEG,
|
||||
+ .min_buffers = 4,
|
||||
+ .max_buffers = 4,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mjpeg_ops,
|
||||
+ .firmware_path = "meson/gx/vmjpeg_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -78,6 +89,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MJPEG,
|
||||
+ .min_buffers = 4,
|
||||
+ .max_buffers = 4,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mjpeg_ops,
|
||||
+ .firmware_path = "meson/gx/vmjpeg_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -142,6 +163,16 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_MJPEG,
|
||||
+ .min_buffers = 4,
|
||||
+ .max_buffers = 4,
|
||||
+ .max_width = 1920,
|
||||
+ .max_height = 1080,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_mjpeg_ops,
|
||||
+ .firmware_path = "meson/gx/vmjpeg_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG4,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -1,26 +0,0 @@
|
||||
From 4f40ed63fe484c78d02e3d0583a7f44f815980f3 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 18:36:09 +0200
|
||||
Subject: [PATCH] media: videodev2.h; Add Amlogic compressed format
|
||||
|
||||
Add V4L2_PIX_FMT_AM21C which is a lossless, compressed framebuffer
|
||||
format.
|
||||
|
||||
It is used by the video decoding and the display IP on many Amlogic
|
||||
SoCs.
|
||||
---
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 600877be5c229..0568053e3aff9 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -668,6 +668,7 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */
|
||||
#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
|
||||
#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
|
||||
+#define V4L2_PIX_FMT_AM21C v4l2_fourcc('A', 'M', '2', '1') /* Amlogic compressed block mode */
|
||||
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
|
||||
|
||||
/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
|
||||
@@ -1,103 +0,0 @@
|
||||
From 88eb5d85f62d7a41559f3b9c15ec69b07c4ee005 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 18:46:31 +0200
|
||||
Subject: [PATCH] media: meson: vdec: add V4L2_PIX_FMT_AM21C support
|
||||
|
||||
Support the lossless, framebuffer compression format from Amlogic.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
drivers/media/platform/meson/vdec/vdec.c | 7 +++++
|
||||
.../media/platform/meson/vdec/vdec_helpers.c | 31 +++++++++++++++++++
|
||||
.../media/platform/meson/vdec/vdec_helpers.h | 4 +++
|
||||
3 files changed, 42 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec.c b/drivers/media/platform/meson/vdec/vdec.c
|
||||
index 32e1e22282970..d5f8fed2886f5 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec.c
|
||||
@@ -182,6 +182,9 @@ static int vdec_queue_setup(struct vb2_queue *q,
|
||||
sizes[1] = amvdec_get_output_size(sess) / 4;
|
||||
sizes[2] = amvdec_get_output_size(sess) / 4;
|
||||
*num_planes = 3;
|
||||
+ } else if (pixfmt_cap == V4L2_PIX_FMT_AM21C) {
|
||||
+ sizes[0] = amvdec_am21c_size(sess->width, sess->height);
|
||||
+ *num_planes = 1;
|
||||
}
|
||||
*num_buffers = min(max(*num_buffers, fmt_out->min_buffers),
|
||||
fmt_out->max_buffers);
|
||||
@@ -444,6 +447,10 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size,
|
||||
get_output_size(pixmp->width, pixmp->height) / 4;
|
||||
pfmt[2].bytesperline = ALIGN(pixmp->width, 64) / 2;
|
||||
pixmp->num_planes = 3;
|
||||
+ } else if (pixmp->pixelformat == V4L2_PIX_FMT_AM21C) {
|
||||
+ pfmt[0].sizeimage =
|
||||
+ amvdec_am21c_size(pixmp->width, pixmp->height);
|
||||
+ pfmt[0].bytesperline = 0;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_helpers.c b/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
index 6151076297655..1c3a015eb3b33 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
@@ -49,6 +49,33 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amvdec_write_parser);
|
||||
|
||||
+/* 4 KiB per 64x32 block */
|
||||
+u32 amvdec_am21c_body_size(u32 width, u32 height)
|
||||
+{
|
||||
+ u32 width_64 = ALIGN(width, 64) / 64;
|
||||
+ u32 height_32 = ALIGN(height, 32) / 32;
|
||||
+
|
||||
+ return SZ_4K * width_64 * height_32;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(amvdec_am21c_body_size);
|
||||
+
|
||||
+/* 32 bytes per 128x64 block */
|
||||
+u32 amvdec_am21c_head_size(u32 width, u32 height)
|
||||
+{
|
||||
+ u32 width_128 = ALIGN(width, 128) / 128;
|
||||
+ u32 height_64 = ALIGN(height, 64) / 64;
|
||||
+
|
||||
+ return 32 * width_128 * height_64;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(amvdec_am21c_head_size);
|
||||
+
|
||||
+u32 amvdec_am21c_size(u32 width, u32 height)
|
||||
+{
|
||||
+ return ALIGN(amvdec_am21c_body_size(width, height) +
|
||||
+ amvdec_am21c_head_size(width, height), SZ_64K);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(amvdec_am21c_size);
|
||||
+
|
||||
static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id)
|
||||
{
|
||||
int ret;
|
||||
@@ -228,6 +255,10 @@ void amvdec_dst_buf_done(struct amvdec_session *sess,
|
||||
vbuf->vb2_buf.planes[1].bytesused = output_size / 4;
|
||||
vbuf->vb2_buf.planes[2].bytesused = output_size / 4;
|
||||
break;
|
||||
+ case V4L2_PIX_FMT_AM21C:
|
||||
+ vbuf->vb2_buf.planes[0].bytesused =
|
||||
+ amvdec_am21c_size(sess->width, sess->height);
|
||||
+ break;
|
||||
}
|
||||
vbuf->vb2_buf.timestamp = tmp->ts;
|
||||
vbuf->sequence = sess->sequence_cap++;
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_helpers.h b/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
index 352c6b4c4b84c..d8a4a2c563af0 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
@@ -26,6 +26,10 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val);
|
||||
u32 amvdec_read_parser(struct amvdec_core *core, u32 reg);
|
||||
void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val);
|
||||
|
||||
+u32 amvdec_am21c_body_size(u32 width, u32 height);
|
||||
+u32 amvdec_am21c_head_size(u32 width, u32 height);
|
||||
+u32 amvdec_am21c_size(u32 width, u32 height);
|
||||
+
|
||||
void amvdec_dst_buf_done_idx(struct amvdec_session *sess, u32 buf_idx,
|
||||
u32 field);
|
||||
void amvdec_dst_buf_done(struct amvdec_session *sess,
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,127 +0,0 @@
|
||||
From 36c532fff8000ef7a125b9260753a374ec746426 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Fri, 31 Aug 2018 14:03:23 +0200
|
||||
Subject: [PATCH] mpeg4: fixes & cleanups
|
||||
|
||||
* Remove unused registers
|
||||
* Use constants for bits and masks
|
||||
* abort on fatal error
|
||||
* Don't set sess->priv until the end
|
||||
---
|
||||
.../media/platform/meson/vdec/codec_mpeg4.c | 59 +++++++++++--------
|
||||
1 file changed, 33 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_mpeg4.c b/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
index c6db2640c91a7..b28e3d477df0d 100644
|
||||
--- a/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
@@ -13,18 +13,16 @@
|
||||
/* Offset added by firmware, to substract from workspace paddr */
|
||||
#define DCAC_BUFF_START_IP 0x02b00000
|
||||
|
||||
-/* map FW registers to known MPEG4 functions */
|
||||
-#define MP4_PIC_RATIO AV_SCRATCH_5
|
||||
-#define MP4_ERR_COUNT AV_SCRATCH_6
|
||||
-#define MP4_PIC_WH AV_SCRATCH_7
|
||||
-#define MREG_BUFFERIN AV_SCRATCH_8
|
||||
-#define MREG_BUFFEROUT AV_SCRATCH_9
|
||||
-#define MP4_NOT_CODED_CNT AV_SCRATCH_A
|
||||
-#define MP4_VOP_TIME_INC AV_SCRATCH_B
|
||||
-#define MP4_OFFSET_REG AV_SCRATCH_C
|
||||
-#define MP4_SYS_RATE AV_SCRATCH_E
|
||||
-#define MEM_OFFSET_REG AV_SCRATCH_F
|
||||
-#define MREG_FATAL_ERROR AV_SCRATCH_L
|
||||
+/* map firmware registers to known MPEG4 functions */
|
||||
+#define MREG_BUFFERIN AV_SCRATCH_8
|
||||
+#define MREG_BUFFEROUT AV_SCRATCH_9
|
||||
+#define MP4_NOT_CODED_CNT AV_SCRATCH_A
|
||||
+#define MEM_OFFSET_REG AV_SCRATCH_F
|
||||
+#define MREG_FATAL_ERROR AV_SCRATCH_L
|
||||
+
|
||||
+#define BUF_IDX_MASK GENMASK(2, 0)
|
||||
+#define INTERLACE_FLAG BIT(7)
|
||||
+#define TOP_FIELD_FIRST_FLAG BIT(6)
|
||||
|
||||
struct codec_mpeg4 {
|
||||
/* Buffer for the MPEG4 Workspace */
|
||||
@@ -39,7 +37,7 @@ static int codec_mpeg4_can_recycle(struct amvdec_core *core)
|
||||
|
||||
static void codec_mpeg4_recycle(struct amvdec_core *core, u32 buf_idx)
|
||||
{
|
||||
- amvdec_write_dos(core, MREG_BUFFERIN, ~(1 << buf_idx));
|
||||
+ amvdec_write_dos(core, MREG_BUFFERIN, ~BIT(buf_idx));
|
||||
}
|
||||
|
||||
static int codec_mpeg4_start(struct amvdec_session *sess) {
|
||||
@@ -51,8 +49,6 @@ static int codec_mpeg4_start(struct amvdec_session *sess) {
|
||||
if (!mpeg4)
|
||||
return -ENOMEM;
|
||||
|
||||
- sess->priv = mpeg4;
|
||||
-
|
||||
/* Allocate some memory for the MPEG4 decoder's state */
|
||||
mpeg4->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE,
|
||||
&mpeg4->workspace_paddr,
|
||||
@@ -63,6 +59,7 @@ static int codec_mpeg4_start(struct amvdec_session *sess) {
|
||||
goto free_mpeg4;
|
||||
}
|
||||
|
||||
+ /* Canvas regs: AV_SCRATCH_0-AV_SCRATCH_4;AV_SCRATCH_G-AV_SCRATCH_J */
|
||||
amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_0, AV_SCRATCH_G, 0 },
|
||||
(u32[]){ 4, 4, 0 });
|
||||
|
||||
@@ -75,6 +72,8 @@ static int codec_mpeg4_start(struct amvdec_session *sess) {
|
||||
amvdec_write_dos(core, MREG_FATAL_ERROR, 0);
|
||||
amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa);
|
||||
|
||||
+ sess->priv = mpeg4;
|
||||
+
|
||||
return 0;
|
||||
|
||||
free_mpeg4:
|
||||
@@ -99,26 +98,34 @@ static int codec_mpeg4_stop(struct amvdec_session *sess)
|
||||
|
||||
static irqreturn_t codec_mpeg4_isr(struct amvdec_session *sess)
|
||||
{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
u32 reg;
|
||||
u32 buffer_index;
|
||||
- struct amvdec_core *core = sess->core;
|
||||
+ u32 field = V4L2_FIELD_NONE;
|
||||
|
||||
reg = amvdec_read_dos(core, MREG_FATAL_ERROR);
|
||||
- if (reg == 1)
|
||||
+ if (reg == 1) {
|
||||
dev_err(core->dev, "mpeg4 fatal error\n");
|
||||
+ amvdec_abort(sess);
|
||||
+ return IRQ_HANDLED;
|
||||
+ }
|
||||
|
||||
reg = amvdec_read_dos(core, MREG_BUFFEROUT);
|
||||
- if (reg) {
|
||||
- sess->keyframe_found = 1;
|
||||
- amvdec_read_dos(core, MP4_NOT_CODED_CNT);
|
||||
- amvdec_read_dos(core, MP4_VOP_TIME_INC);
|
||||
- buffer_index = reg & 0x7;
|
||||
- amvdec_dst_buf_done_idx(sess, buffer_index, V4L2_FIELD_NONE);
|
||||
- amvdec_write_dos(core, MREG_BUFFEROUT, 0);
|
||||
- }
|
||||
+ if (!reg)
|
||||
+ goto end;
|
||||
|
||||
- amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1);
|
||||
+ sess->keyframe_found = 1;
|
||||
+ buffer_index = reg & BUF_IDX_MASK;
|
||||
+ if (reg & INTERLACE_FLAG)
|
||||
+ field = (reg & TOP_FIELD_FIRST_FLAG) ?
|
||||
+ V4L2_FIELD_INTERLACED_TB :
|
||||
+ V4L2_FIELD_INTERLACED_BT;
|
||||
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, field);
|
||||
+ amvdec_write_dos(core, MREG_BUFFEROUT, 0);
|
||||
+
|
||||
+end:
|
||||
+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
From 89c2edfb991fb85fab722d087e98a40758f8ff8c Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Fri, 31 Aug 2018 14:04:10 +0200
|
||||
Subject: [PATCH] H.264: fixes & cleanups
|
||||
|
||||
* fix GXL and GXM max width/height
|
||||
* 80+ lines
|
||||
* remove unused defines
|
||||
---
|
||||
.../media/platform/meson/vdec/codec_h264.c | 24 +++++++++----------
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 8 +++----
|
||||
2 files changed, 15 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/codec_h264.c b/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
index 7c47ec35efa54..decd3c601cde3 100644
|
||||
--- a/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
@@ -28,14 +28,8 @@
|
||||
#define CMD_BAD_HEIGHT 8
|
||||
|
||||
/* Picture type */
|
||||
-#define PIC_SINGLE_FRAME 0
|
||||
-#define PIC_TOP_BOT_TOP 1
|
||||
-#define PIC_BOT_TOP_BOT 2
|
||||
-#define PIC_DOUBLE_FRAME 3
|
||||
-#define PIC_TRIPLE_FRAME 4
|
||||
#define PIC_TOP_BOT 5
|
||||
#define PIC_BOT_TOP 6
|
||||
-#define PIC_INVALID 7
|
||||
|
||||
/* Size of Motion Vector per macroblock */
|
||||
#define MB_MV_SIZE 96
|
||||
@@ -84,16 +78,16 @@ static int codec_h264_start(struct amvdec_session *sess) {
|
||||
struct codec_h264 *h264 = sess->priv;
|
||||
|
||||
/* Allocate some memory for the H.264 decoder's state */
|
||||
- h264->workspace_vaddr =
|
||||
- dma_alloc_coherent(core->dev, SIZE_WORKSPACE, &h264->workspace_paddr, GFP_KERNEL);
|
||||
+ h264->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE,
|
||||
+ &h264->workspace_paddr, GFP_KERNEL);
|
||||
if (!h264->workspace_vaddr) {
|
||||
dev_err(core->dev, "Failed to alloc H.264 Workspace\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Allocate some memory for the H.264 SEI dump */
|
||||
- h264->sei_vaddr =
|
||||
- dma_alloc_coherent(core->dev, SIZE_SEI, &h264->sei_paddr, GFP_KERNEL);
|
||||
+ h264->sei_vaddr = dma_alloc_coherent(core->dev, SIZE_SEI,
|
||||
+ &h264->sei_paddr, GFP_KERNEL);
|
||||
if (!h264->sei_vaddr) {
|
||||
dev_err(core->dev, "Failed to alloc H.264 SEI\n");
|
||||
return -ENOMEM;
|
||||
@@ -114,7 +108,9 @@ static int codec_h264_start(struct amvdec_session *sess) {
|
||||
amvdec_write_dos(core, AV_SCRATCH_9, 0);
|
||||
|
||||
/* Enable "error correction" */
|
||||
- amvdec_write_dos(core, AV_SCRATCH_F, (amvdec_read_dos(core, AV_SCRATCH_F) & 0xffffffc3) | BIT(4) | BIT(7));
|
||||
+ amvdec_write_dos(core, AV_SCRATCH_F,
|
||||
+ (amvdec_read_dos(core, AV_SCRATCH_F) & 0xffffffc3) |
|
||||
+ BIT(4) | BIT(7));
|
||||
|
||||
amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa);
|
||||
|
||||
@@ -145,7 +141,8 @@ static int codec_h264_stop(struct amvdec_session *sess)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int codec_h264_load_extended_firmware(struct amvdec_session *sess, const u8 *data, u32 len)
|
||||
+static int codec_h264_load_extended_firmware(struct amvdec_session *sess,
|
||||
+ const u8 *data, u32 len)
|
||||
{
|
||||
struct codec_h264 *h264;
|
||||
struct amvdec_core *core = sess->core;
|
||||
@@ -160,7 +157,7 @@ static int codec_h264_load_extended_firmware(struct amvdec_session *sess, const
|
||||
return -EINVAL;
|
||||
|
||||
h264->ext_fw_vaddr = dma_alloc_coherent(core->dev, SIZE_EXT_FW,
|
||||
- &h264->ext_fw_paddr, GFP_KERNEL);
|
||||
+ &h264->ext_fw_paddr, GFP_KERNEL);
|
||||
if (!h264->ext_fw_vaddr) {
|
||||
dev_err(core->dev, "Failed to alloc H.264 extended fw\n");
|
||||
return -ENOMEM;
|
||||
@@ -275,6 +272,7 @@ static void codec_h264_frames_ready(struct amvdec_session *sess, u32 status)
|
||||
|
||||
amvdec_dst_buf_done_idx(sess, buffer_index, field);
|
||||
|
||||
+ /* 2 src packets per dst frame ; delete additional timestamp */
|
||||
if (field != V4L2_FIELD_NONE && !h264->received_0)
|
||||
amvdec_rm_first_ts(sess);
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_platform.c b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
index a8d03426e53d0..99dd3ae9c463b 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
@@ -154,8 +154,8 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
.pixfmt = V4L2_PIX_FMT_H264,
|
||||
.min_buffers = 21,
|
||||
.max_buffers = 24,
|
||||
- .max_width = 1920,
|
||||
- .max_height = 1080,
|
||||
+ .max_width = 3840,
|
||||
+ .max_height = 2160,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_h264_ops,
|
||||
.firmware_path = "meson/gxl/vh264_mc",
|
||||
@@ -238,8 +238,8 @@ static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
.pixfmt = V4L2_PIX_FMT_H264,
|
||||
.min_buffers = 21,
|
||||
.max_buffers = 24,
|
||||
- .max_width = 1920,
|
||||
- .max_height = 1080,
|
||||
+ .max_width = 3840,
|
||||
+ .max_height = 2160,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_h264_ops,
|
||||
.firmware_path = "meson/gxm/vh264_mc",
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +0,0 @@
|
||||
From 6c5aaf27886c9b308e9c4e4d613990e540f23ec8 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Tue, 26 Jun 2018 09:37:39 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson-gxbb-nanopi-k2: Add HDMI, CEC and CVBS
|
||||
nodes
|
||||
|
||||
The Amlogic Meson GXBB based Nanopi-K2 board has an HDMI connector
|
||||
with CEC and CVBS available on the 40pin header.
|
||||
This patch adds the nodes to enable HDMI, CEC and CVBS functionnalities.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 48 ++++++++++++++++++++++
|
||||
1 file changed, 48 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
index 7d5709c..cbe99bd 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
@@ -106,6 +106,42 @@
|
||||
compatible = "mmc-pwrseq-emmc";
|
||||
reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
+
|
||||
+ /* CVBS is available on CON1 pin 36, disabled by default */
|
||||
+ cvbs-connector {
|
||||
+ compatible = "composite-video-connector";
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ port {
|
||||
+ cvbs_connector_in: endpoint {
|
||||
+ remote-endpoint = <&cvbs_vdac_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ hdmi-connector {
|
||||
+ compatible = "hdmi-connector";
|
||||
+ type = "a";
|
||||
+
|
||||
+ port {
|
||||
+ hdmi_connector_in: endpoint {
|
||||
+ remote-endpoint = <&hdmi_tx_tmds_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cec_AO {
|
||||
+ status = "okay";
|
||||
+ pinctrl-0 = <&ao_cec_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ hdmi-phandle = <&hdmi_tx>;
|
||||
+};
|
||||
+
|
||||
+&cvbs_vdac_port {
|
||||
+ cvbs_vdac_out: endpoint {
|
||||
+ remote-endpoint = <&cvbs_connector_in>;
|
||||
+ };
|
||||
};
|
||||
|
||||
ðmac {
|
||||
@@ -137,6 +173,18 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&hdmi_tx {
|
||||
+ status = "okay";
|
||||
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+};
|
||||
+
|
||||
+&hdmi_tx_tmds_port {
|
||||
+ hdmi_tx_tmds_out: endpoint {
|
||||
+ remote-endpoint = <&hdmi_connector_in>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
@@ -1,44 +0,0 @@
|
||||
From e41c06328d1cd0989899d6a0897c6857d0cf9a4b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 13 Nov 2017 12:09:40 +0100
|
||||
Subject: [PATCH] ARM64: defconfig: enable CEC support
|
||||
|
||||
Turn on CONFIG_CEC_SUPPORT and CONFIG_CEC_PLATFORM_DRIVERS
|
||||
Turn on CONFIG_VIDEO_MESON_AO_CEC as module
|
||||
Turn on CONFIG_DRM_DW_HDMI_CEC as module
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/configs/defconfig | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
|
||||
index f9a186f..2584605 100644
|
||||
--- a/arch/arm64/configs/defconfig
|
||||
+++ b/arch/arm64/configs/defconfig
|
||||
@@ -402,6 +402,7 @@ CONFIG_MEDIA_SUPPORT=m
|
||||
CONFIG_MEDIA_CAMERA_SUPPORT=y
|
||||
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
|
||||
CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
|
||||
+CONFIG_MEDIA_CEC_SUPPORT=y
|
||||
CONFIG_MEDIA_CONTROLLER=y
|
||||
CONFIG_VIDEO_V4L2_SUBDEV_API=y
|
||||
# CONFIG_DVB_NET is not set
|
||||
@@ -411,6 +412,8 @@ CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
|
||||
CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
|
||||
CONFIG_VIDEO_RENESAS_FCP=m
|
||||
CONFIG_VIDEO_RENESAS_VSP1=m
|
||||
+CONFIG_CEC_PLATFORM_DRIVERS=y
|
||||
+CONFIG_VIDEO_MESON_AO_CEC=m
|
||||
CONFIG_DRM=m
|
||||
CONFIG_DRM_NOUVEAU=m
|
||||
CONFIG_DRM_EXYNOS=m
|
||||
@@ -431,6 +434,7 @@ CONFIG_DRM_RCAR_LVDS=m
|
||||
CONFIG_DRM_TEGRA=m
|
||||
CONFIG_DRM_PANEL_SIMPLE=m
|
||||
CONFIG_DRM_I2C_ADV7511=m
|
||||
+CONFIG_DRM_DW_HDMI_CEC=m
|
||||
CONFIG_DRM_VC4=m
|
||||
CONFIG_DRM_HISI_HIBMC=m
|
||||
CONFIG_DRM_HISI_KIRIN=m
|
||||
@@ -1,44 +0,0 @@
|
||||
From 0cecf963b9d815699fe50b7a7ee4a93ece3ed834 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Tue, 19 Jun 2018 18:14:49 +0200
|
||||
Subject: [PATCH] clk: meson: switch gxbb cts-amclk div to the generic divider
|
||||
|
||||
clk-audio-divider was a (poor) attempt to use CCF rate propagation
|
||||
while making sure the PLL rate would be high enough to work with
|
||||
audio use cases. The result is far from optimal. We can do better
|
||||
by carefully choosing the PLL rates for the audio use cases.
|
||||
Doing so, we don't need to use clk-audio-divider anymore. The
|
||||
generic will do
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
drivers/clk/meson/gxbb.c | 12 +++++-------
|
||||
1 file changed, 5 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
|
||||
index 177fffb..69a58cb 100644
|
||||
--- a/drivers/clk/meson/gxbb.c
|
||||
+++ b/drivers/clk/meson/gxbb.c
|
||||
@@ -982,17 +982,15 @@ static struct clk_regmap gxbb_cts_amclk_sel = {
|
||||
};
|
||||
|
||||
static struct clk_regmap gxbb_cts_amclk_div = {
|
||||
- .data = &(struct meson_clk_audio_div_data){
|
||||
- .div = {
|
||||
- .reg_off = HHI_AUD_CLK_CNTL,
|
||||
- .shift = 0,
|
||||
- .width = 8,
|
||||
- },
|
||||
+ .data = &(struct clk_regmap_div_data) {
|
||||
+ .offset = HHI_AUD_CLK_CNTL,
|
||||
+ .shift = 0,
|
||||
+ .width = 8,
|
||||
.flags = CLK_DIVIDER_ROUND_CLOSEST,
|
||||
},
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "cts_amclk_div",
|
||||
- .ops = &meson_clk_audio_divider_ops,
|
||||
+ .ops = &clk_regmap_divider_ops,
|
||||
.parent_names = (const char *[]){ "cts_amclk_sel" },
|
||||
.num_parents = 1,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
@@ -1,48 +0,0 @@
|
||||
From e87dd7b11611e4ac5279ba4ad4f1fea4d0900273 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Tue, 19 Jun 2018 18:23:28 +0200
|
||||
Subject: [PATCH] clk: meson: remove unused clk-audio-divider driver
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
drivers/clk/meson/Makefile | 2 +-
|
||||
drivers/clk/meson/clkc.h | 7 -------
|
||||
2 files changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
|
||||
index d0d13ae..e40fea9 100644
|
||||
--- a/drivers/clk/meson/Makefile
|
||||
+++ b/drivers/clk/meson/Makefile
|
||||
@@ -2,7 +2,7 @@
|
||||
# Makefile for Meson specific clk
|
||||
#
|
||||
|
||||
-obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o clk-audio-divider.o
|
||||
+obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o
|
||||
obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o
|
||||
obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o
|
||||
obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o gxbb-aoclk-32k.o
|
||||
diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h
|
||||
index 2fb0843..48db024 100644
|
||||
--- a/drivers/clk/meson/clkc.h
|
||||
+++ b/drivers/clk/meson/clkc.h
|
||||
@@ -91,11 +91,6 @@ struct meson_clk_mpll_data {
|
||||
|
||||
#define CLK_MESON_MPLL_ROUND_CLOSEST BIT(0)
|
||||
|
||||
-struct meson_clk_audio_div_data {
|
||||
- struct parm div;
|
||||
- u8 flags;
|
||||
-};
|
||||
-
|
||||
#define MESON_GATE(_name, _reg, _bit) \
|
||||
struct clk_regmap _name = { \
|
||||
.data = &(struct clk_regmap_gate_data){ \
|
||||
@@ -117,7 +112,5 @@ extern const struct clk_ops meson_clk_pll_ops;
|
||||
extern const struct clk_ops meson_clk_cpu_ops;
|
||||
extern const struct clk_ops meson_clk_mpll_ro_ops;
|
||||
extern const struct clk_ops meson_clk_mpll_ops;
|
||||
-extern const struct clk_ops meson_clk_audio_divider_ro_ops;
|
||||
-extern const struct clk_ops meson_clk_audio_divider_ops;
|
||||
|
||||
#endif /* __CLKC_H */
|
||||
@@ -1,308 +0,0 @@
|
||||
From 878d41be386f0bcbe1475f65acd8b9fb304529a0 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 11:49:55 +0200
|
||||
Subject: [PATCH] ASoC: meson: add meson audio core driver
|
||||
|
||||
This patch adds support for the audio core driver for the Amlogic Meson SoC
|
||||
family. The purpose of this driver is to properly reset the audio block and
|
||||
provide register access for the different devices scattered in this address
|
||||
space. This includes output and input DMAs, pcm, i2s and spdif dai, card
|
||||
level routing, internal codec for the gxl variant
|
||||
|
||||
For more information, please refer to the section 5 of the public datasheet
|
||||
of the S905 (gxbb). This datasheet is available here: [0].
|
||||
|
||||
[0]: http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/Kconfig | 1 +
|
||||
sound/soc/Makefile | 1 +
|
||||
sound/soc/meson/Kconfig | 9 ++
|
||||
sound/soc/meson/Makefile | 3 +
|
||||
sound/soc/meson/audio-core.c | 190 +++++++++++++++++++++++++++++++++++++++++++
|
||||
sound/soc/meson/audio-core.h | 28 +++++++
|
||||
6 files changed, 232 insertions(+)
|
||||
create mode 100644 sound/soc/meson/Kconfig
|
||||
create mode 100644 sound/soc/meson/Makefile
|
||||
create mode 100644 sound/soc/meson/audio-core.c
|
||||
create mode 100644 sound/soc/meson/audio-core.h
|
||||
|
||||
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
|
||||
index 41af6b9..1cf11cf 100644
|
||||
--- a/sound/soc/Kconfig
|
||||
+++ b/sound/soc/Kconfig
|
||||
@@ -57,6 +57,7 @@ source "sound/soc/kirkwood/Kconfig"
|
||||
source "sound/soc/img/Kconfig"
|
||||
source "sound/soc/intel/Kconfig"
|
||||
source "sound/soc/mediatek/Kconfig"
|
||||
+source "sound/soc/meson/Kconfig"
|
||||
source "sound/soc/mxs/Kconfig"
|
||||
source "sound/soc/pxa/Kconfig"
|
||||
source "sound/soc/qcom/Kconfig"
|
||||
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
|
||||
index 06389a5..62a5f87 100644
|
||||
--- a/sound/soc/Makefile
|
||||
+++ b/sound/soc/Makefile
|
||||
@@ -38,6 +38,7 @@ obj-$(CONFIG_SND_SOC) += jz4740/
|
||||
obj-$(CONFIG_SND_SOC) += img/
|
||||
obj-$(CONFIG_SND_SOC) += intel/
|
||||
obj-$(CONFIG_SND_SOC) += mediatek/
|
||||
+obj-$(CONFIG_SND_SOC) += meson/
|
||||
obj-$(CONFIG_SND_SOC) += mxs/
|
||||
obj-$(CONFIG_SND_SOC) += nuc900/
|
||||
obj-$(CONFIG_SND_SOC) += omap/
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
new file mode 100644
|
||||
index 0000000..ca0e3e9
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -0,0 +1,9 @@
|
||||
+menuconfig SND_SOC_MESON
|
||||
+ tristate "ASoC support for Amlogic Meson SoCs"
|
||||
+ depends on ARCH_MESON
|
||||
+ select MFD_CORE
|
||||
+ select REGMAP_MMIO
|
||||
+ help
|
||||
+ Say Y or M if you want to add support for codecs attached to
|
||||
+ the Amlogic Meson SoCs Audio interfaces. You will also need to
|
||||
+ select the audio interfaces to support below.
|
||||
diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile
|
||||
new file mode 100644
|
||||
index 0000000..22028ab
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -0,0 +1,3 @@
|
||||
+snd-soc-meson-audio-core-objs := audio-core.o
|
||||
+
|
||||
+obj-$(CONFIG_SND_SOC_MESON) += snd-soc-meson-audio-core.o
|
||||
diff --git a/sound/soc/meson/audio-core.c b/sound/soc/meson/audio-core.c
|
||||
new file mode 100644
|
||||
index 0000000..99993ec
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/audio-core.c
|
||||
@@ -0,0 +1,190 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/mfd/core.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/reset.h>
|
||||
+
|
||||
+#include "audio-core.h"
|
||||
+
|
||||
+#define DRV_NAME "meson-audio-core"
|
||||
+
|
||||
+static const char * const acore_clock_names[] = { "aiu_top",
|
||||
+ "aiu_glue",
|
||||
+ "audin" };
|
||||
+
|
||||
+static int meson_acore_init_clocks(struct device *dev)
|
||||
+{
|
||||
+ struct clk *clock;
|
||||
+ int i, ret;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(acore_clock_names); i++) {
|
||||
+ clock = devm_clk_get(dev, acore_clock_names[i]);
|
||||
+ if (IS_ERR(clock)) {
|
||||
+ if (PTR_ERR(clock) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Failed to get %s clock\n",
|
||||
+ acore_clock_names[i]);
|
||||
+ return PTR_ERR(clock);
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(clock);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Failed to enable %s clock\n",
|
||||
+ acore_clock_names[i]);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = devm_add_action_or_reset(dev,
|
||||
+ (void(*)(void *))clk_disable_unprepare,
|
||||
+ clock);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const char * const acore_reset_names[] = { "aiu",
|
||||
+ "audin" };
|
||||
+
|
||||
+static int meson_acore_init_resets(struct device *dev)
|
||||
+{
|
||||
+ struct reset_control *reset;
|
||||
+ int i, ret;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(acore_reset_names); i++) {
|
||||
+ reset = devm_reset_control_get_exclusive(dev,
|
||||
+ acore_reset_names[i]);
|
||||
+ if (IS_ERR(reset)) {
|
||||
+ if (PTR_ERR(reset) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Failed to get %s reset\n",
|
||||
+ acore_reset_names[i]);
|
||||
+ return PTR_ERR(reset);
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_reset(reset);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Failed to pulse %s reset\n",
|
||||
+ acore_reset_names[i]);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct regmap_config meson_acore_regmap_config = {
|
||||
+ .reg_bits = 32,
|
||||
+ .val_bits = 32,
|
||||
+ .reg_stride = 4,
|
||||
+};
|
||||
+
|
||||
+static const struct mfd_cell meson_acore_devs[] = {
|
||||
+ {
|
||||
+ .name = "meson-i2s-dai",
|
||||
+ .of_compatible = "amlogic,meson-i2s-dai",
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "meson-spdif-dai",
|
||||
+ .of_compatible = "amlogic,meson-spdif-dai",
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "meson-aiu-i2s-dma",
|
||||
+ .of_compatible = "amlogic,meson-aiu-i2s-dma",
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "meson-aiu-spdif-dma",
|
||||
+ .of_compatible = "amlogic,meson-aiu-spdif-dma",
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int meson_acore_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct meson_audio_core_data *data;
|
||||
+ struct resource *res;
|
||||
+ void __iomem *regs;
|
||||
+ int ret;
|
||||
+
|
||||
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
|
||||
+ if (!data)
|
||||
+ return -ENOMEM;
|
||||
+ platform_set_drvdata(pdev, data);
|
||||
+
|
||||
+ ret = meson_acore_init_clocks(dev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = meson_acore_init_resets(dev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "aiu");
|
||||
+ regs = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(regs))
|
||||
+ return PTR_ERR(regs);
|
||||
+
|
||||
+ data->aiu = devm_regmap_init_mmio(dev, regs,
|
||||
+ &meson_acore_regmap_config);
|
||||
+ if (IS_ERR(data->aiu)) {
|
||||
+ dev_err(dev, "Couldn't create the AIU regmap\n");
|
||||
+ return PTR_ERR(data->aiu);
|
||||
+ }
|
||||
+
|
||||
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "audin");
|
||||
+ regs = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(regs))
|
||||
+ return PTR_ERR(regs);
|
||||
+
|
||||
+ data->audin = devm_regmap_init_mmio(dev, regs,
|
||||
+ &meson_acore_regmap_config);
|
||||
+ if (IS_ERR(data->audin)) {
|
||||
+ dev_err(dev, "Couldn't create the AUDIN regmap\n");
|
||||
+ return PTR_ERR(data->audin);
|
||||
+ }
|
||||
+
|
||||
+ return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, meson_acore_devs,
|
||||
+ ARRAY_SIZE(meson_acore_devs), NULL, 0,
|
||||
+ NULL);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id meson_acore_of_match[] = {
|
||||
+ { .compatible = "amlogic,meson-audio-core", },
|
||||
+ { .compatible = "amlogic,meson-gxbb-audio-core", },
|
||||
+ { .compatible = "amlogic,meson-gxl-audio-core", },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, meson_acore_of_match);
|
||||
+
|
||||
+static struct platform_driver meson_acore_pdrv = {
|
||||
+ .probe = meson_acore_probe,
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .of_match_table = meson_acore_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(meson_acore_pdrv);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Meson Audio Core Driver");
|
||||
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
diff --git a/sound/soc/meson/audio-core.h b/sound/soc/meson/audio-core.h
|
||||
new file mode 100644
|
||||
index 0000000..6e7a24c
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/audio-core.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _MESON_AUDIO_CORE_H_
|
||||
+#define _MESON_AUDIO_CORE_H_
|
||||
+
|
||||
+struct meson_audio_core_data {
|
||||
+ struct regmap *aiu;
|
||||
+ struct regmap *audin;
|
||||
+};
|
||||
+
|
||||
+#endif /* _MESON_AUDIO_CORE_H_ */
|
||||
@@ -1,357 +0,0 @@
|
||||
From f6c0ce626b08f5ba85bd9bfe000044c4f9e7da24 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 12:00:10 +0200
|
||||
Subject: [PATCH] ASoC: meson: add register definitions
|
||||
|
||||
Add the register definition for the AIU and AUDIN blocks
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/aiu-regs.h | 182 +++++++++++++++++++++++++++++++++++++++++++
|
||||
sound/soc/meson/audin-regs.h | 148 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 330 insertions(+)
|
||||
create mode 100644 sound/soc/meson/aiu-regs.h
|
||||
create mode 100644 sound/soc/meson/audin-regs.h
|
||||
|
||||
diff --git a/sound/soc/meson/aiu-regs.h b/sound/soc/meson/aiu-regs.h
|
||||
new file mode 100644
|
||||
index 0000000..67391e6
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/aiu-regs.h
|
||||
@@ -0,0 +1,182 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _AIU_REGS_H_
|
||||
+#define _AIU_REGS_H_
|
||||
+
|
||||
+#define AIU_958_BPF 0x000
|
||||
+#define AIU_958_BRST 0x004
|
||||
+#define AIU_958_LENGTH 0x008
|
||||
+#define AIU_958_PADDSIZE 0x00C
|
||||
+#define AIU_958_MISC 0x010
|
||||
+#define AIU_958_FORCE_LEFT 0x014 /* Unknown */
|
||||
+#define AIU_958_DISCARD_NUM 0x018
|
||||
+#define AIU_958_DCU_FF_CTRL 0x01C
|
||||
+#define AIU_958_CHSTAT_L0 0x020
|
||||
+#define AIU_958_CHSTAT_L1 0x024
|
||||
+#define AIU_958_CTRL 0x028
|
||||
+#define AIU_958_RPT 0x02C
|
||||
+#define AIU_I2S_MUTE_SWAP 0x030
|
||||
+#define AIU_I2S_SOURCE_DESC 0x034
|
||||
+#define AIU_I2S_MED_CTRL 0x038
|
||||
+#define AIU_I2S_MED_THRESH 0x03C
|
||||
+#define AIU_I2S_DAC_CFG 0x040
|
||||
+#define AIU_I2S_SYNC 0x044 /* Unknown */
|
||||
+#define AIU_I2S_MISC 0x048
|
||||
+#define AIU_I2S_OUT_CFG 0x04C
|
||||
+#define AIU_I2S_FF_CTRL 0x050 /* Unknown */
|
||||
+#define AIU_RST_SOFT 0x054
|
||||
+#define AIU_CLK_CTRL 0x058
|
||||
+#define AIU_MIX_ADCCFG 0x05C
|
||||
+#define AIU_MIX_CTRL 0x060
|
||||
+#define AIU_CLK_CTRL_MORE 0x064
|
||||
+#define AIU_958_POP 0x068
|
||||
+#define AIU_MIX_GAIN 0x06C
|
||||
+#define AIU_958_SYNWORD1 0x070
|
||||
+#define AIU_958_SYNWORD2 0x074
|
||||
+#define AIU_958_SYNWORD3 0x078
|
||||
+#define AIU_958_SYNWORD1_MASK 0x07C
|
||||
+#define AIU_958_SYNWORD2_MASK 0x080
|
||||
+#define AIU_958_SYNWORD3_MASK 0x084
|
||||
+#define AIU_958_FFRDOUT_THD 0x088
|
||||
+#define AIU_958_LENGTH_PER_PAUSE 0x08C
|
||||
+#define AIU_958_PAUSE_NUM 0x090
|
||||
+#define AIU_958_PAUSE_PAYLOAD 0x094
|
||||
+#define AIU_958_AUTO_PAUSE 0x098
|
||||
+#define AIU_958_PAUSE_PD_LENGTH 0x09C
|
||||
+#define AIU_CODEC_DAC_LRCLK_CTRL 0x0A0
|
||||
+#define AIU_CODEC_ADC_LRCLK_CTRL 0x0A4
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL 0x0A8
|
||||
+#define AIU_CODEC_CLK_DATA_CTRL 0x0AC
|
||||
+#define AIU_ACODEC_CTRL 0x0B0
|
||||
+#define AIU_958_CHSTAT_R0 0x0C0
|
||||
+#define AIU_958_CHSTAT_R1 0x0C4
|
||||
+#define AIU_958_VALID_CTRL 0x0C8
|
||||
+#define AIU_AUDIO_AMP_REG0 0x0F0 /* Unknown */
|
||||
+#define AIU_AUDIO_AMP_REG1 0x0F4 /* Unknown */
|
||||
+#define AIU_AUDIO_AMP_REG2 0x0F8 /* Unknown */
|
||||
+#define AIU_AUDIO_AMP_REG3 0x0FC /* Unknown */
|
||||
+#define AIU_AIFIFO2_CTRL 0x100
|
||||
+#define AIU_AIFIFO2_STATUS 0x104
|
||||
+#define AIU_AIFIFO2_GBIT 0x108
|
||||
+#define AIU_AIFIFO2_CLB 0x10C
|
||||
+#define AIU_CRC_CTRL 0x110
|
||||
+#define AIU_CRC_STATUS 0x114
|
||||
+#define AIU_CRC_SHIFT_REG 0x118
|
||||
+#define AIU_CRC_IREG 0x11C
|
||||
+#define AIU_CRC_CAL_REG1 0x120
|
||||
+#define AIU_CRC_CAL_REG0 0x124
|
||||
+#define AIU_CRC_POLY_COEF1 0x128
|
||||
+#define AIU_CRC_POLY_COEF0 0x12C
|
||||
+#define AIU_CRC_BIT_SIZE1 0x130
|
||||
+#define AIU_CRC_BIT_SIZE0 0x134
|
||||
+#define AIU_CRC_BIT_CNT1 0x138
|
||||
+#define AIU_CRC_BIT_CNT0 0x13C
|
||||
+#define AIU_AMCLK_GATE_HI 0x140
|
||||
+#define AIU_AMCLK_GATE_LO 0x144
|
||||
+#define AIU_AMCLK_MSR 0x148
|
||||
+#define AIU_AUDAC_CTRL0 0x14C /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA0 0x154 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA1 0x158 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA2 0x15C /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA3 0x160 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA4 0x164 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA5 0x168 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA6 0x16C /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA7 0x170 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA_LCNTS 0x174 /* Unknown */
|
||||
+#define AIU_DELTA_SIGMA_RCNTS 0x178 /* Unknown */
|
||||
+#define AIU_MEM_I2S_START_PTR 0x180
|
||||
+#define AIU_MEM_I2S_RD_PTR 0x184
|
||||
+#define AIU_MEM_I2S_END_PTR 0x188
|
||||
+#define AIU_MEM_I2S_MASKS 0x18C
|
||||
+#define AIU_MEM_I2S_CONTROL 0x190
|
||||
+#define AIU_MEM_IEC958_START_PTR 0x194
|
||||
+#define AIU_MEM_IEC958_RD_PTR 0x198
|
||||
+#define AIU_MEM_IEC958_END_PTR 0x19C
|
||||
+#define AIU_MEM_IEC958_MASKS 0x1A0
|
||||
+#define AIU_MEM_IEC958_CONTROL 0x1A4
|
||||
+#define AIU_MEM_AIFIFO2_START_PTR 0x1A8
|
||||
+#define AIU_MEM_AIFIFO2_CURR_PTR 0x1AC
|
||||
+#define AIU_MEM_AIFIFO2_END_PTR 0x1B0
|
||||
+#define AIU_MEM_AIFIFO2_BYTES_AVAIL 0x1B4
|
||||
+#define AIU_MEM_AIFIFO2_CONTROL 0x1B8
|
||||
+#define AIU_MEM_AIFIFO2_MAN_WP 0x1BC
|
||||
+#define AIU_MEM_AIFIFO2_MAN_RP 0x1C0
|
||||
+#define AIU_MEM_AIFIFO2_LEVEL 0x1C4
|
||||
+#define AIU_MEM_AIFIFO2_BUF_CNTL 0x1C8
|
||||
+#define AIU_MEM_I2S_MAN_WP 0x1CC
|
||||
+#define AIU_MEM_I2S_MAN_RP 0x1D0
|
||||
+#define AIU_MEM_I2S_LEVEL 0x1D4
|
||||
+#define AIU_MEM_I2S_BUF_CNTL 0x1D8
|
||||
+#define AIU_MEM_I2S_BUF_WRAP_COUNT 0x1DC
|
||||
+#define AIU_MEM_I2S_MEM_CTL 0x1E0
|
||||
+#define AIU_MEM_IEC958_MEM_CTL 0x1E4
|
||||
+#define AIU_MEM_IEC958_WRAP_COUNT 0x1E8
|
||||
+#define AIU_MEM_IEC958_IRQ_LEVEL 0x1EC
|
||||
+#define AIU_MEM_IEC958_MAN_WP 0x1F0
|
||||
+#define AIU_MEM_IEC958_MAN_RP 0x1F4
|
||||
+#define AIU_MEM_IEC958_LEVEL 0x1F8
|
||||
+#define AIU_MEM_IEC958_BUF_CNTL 0x1FC
|
||||
+#define AIU_AIFIFO_CTRL 0x200
|
||||
+#define AIU_AIFIFO_STATUS 0x204
|
||||
+#define AIU_AIFIFO_GBIT 0x208
|
||||
+#define AIU_AIFIFO_CLB 0x20C
|
||||
+#define AIU_MEM_AIFIFO_START_PTR 0x210
|
||||
+#define AIU_MEM_AIFIFO_CURR_PTR 0x214
|
||||
+#define AIU_MEM_AIFIFO_END_PTR 0x218
|
||||
+#define AIU_MEM_AIFIFO_BYTES_AVAIL 0x21C
|
||||
+#define AIU_MEM_AIFIFO_CONTROL 0x220
|
||||
+#define AIU_MEM_AIFIFO_MAN_WP 0x224
|
||||
+#define AIU_MEM_AIFIFO_MAN_RP 0x228
|
||||
+#define AIU_MEM_AIFIFO_LEVEL 0x22C
|
||||
+#define AIU_MEM_AIFIFO_BUF_CNTL 0x230
|
||||
+#define AIU_MEM_AIFIFO_BUF_WRAP_COUNT 0x234
|
||||
+#define AIU_MEM_AIFIFO2_BUF_WRAP_COUNT 0x238
|
||||
+#define AIU_MEM_AIFIFO_MEM_CTL 0x23C
|
||||
+#define AIFIFO_TIME_STAMP_CNTL 0x240
|
||||
+#define AIFIFO_TIME_STAMP_SYNC_0 0x244
|
||||
+#define AIFIFO_TIME_STAMP_SYNC_1 0x248
|
||||
+#define AIFIFO_TIME_STAMP_0 0x24C
|
||||
+#define AIFIFO_TIME_STAMP_1 0x250
|
||||
+#define AIFIFO_TIME_STAMP_2 0x254
|
||||
+#define AIFIFO_TIME_STAMP_3 0x258
|
||||
+#define AIFIFO_TIME_STAMP_LENGTH 0x25C
|
||||
+#define AIFIFO2_TIME_STAMP_CNTL 0x260
|
||||
+#define AIFIFO2_TIME_STAMP_SYNC_0 0x264
|
||||
+#define AIFIFO2_TIME_STAMP_SYNC_1 0x268
|
||||
+#define AIFIFO2_TIME_STAMP_0 0x26C
|
||||
+#define AIFIFO2_TIME_STAMP_1 0x270
|
||||
+#define AIFIFO2_TIME_STAMP_2 0x274
|
||||
+#define AIFIFO2_TIME_STAMP_3 0x278
|
||||
+#define AIFIFO2_TIME_STAMP_LENGTH 0x27C
|
||||
+#define IEC958_TIME_STAMP_CNTL 0x280
|
||||
+#define IEC958_TIME_STAMP_SYNC_0 0x284
|
||||
+#define IEC958_TIME_STAMP_SYNC_1 0x288
|
||||
+#define IEC958_TIME_STAMP_0 0x28C
|
||||
+#define IEC958_TIME_STAMP_1 0x290
|
||||
+#define IEC958_TIME_STAMP_2 0x294
|
||||
+#define IEC958_TIME_STAMP_3 0x298
|
||||
+#define IEC958_TIME_STAMP_LENGTH 0x29C
|
||||
+#define AIU_MEM_AIFIFO2_MEM_CTL 0x2A0
|
||||
+#define AIU_I2S_CBUS_DDR_CNTL 0x2A4
|
||||
+#define AIU_I2S_CBUS_DDR_WDATA 0x2A8
|
||||
+#define AIU_I2S_CBUS_DDR_ADDR 0x2AC
|
||||
+
|
||||
+#endif /* _AIU_REGS_H_ */
|
||||
diff --git a/sound/soc/meson/audin-regs.h b/sound/soc/meson/audin-regs.h
|
||||
new file mode 100644
|
||||
index 0000000..f224610
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/audin-regs.h
|
||||
@@ -0,0 +1,148 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _AUDIN_REGS_H_
|
||||
+#define _AUDIN_REGS_H_
|
||||
+
|
||||
+/*
|
||||
+ * Note :
|
||||
+ * Datasheet issue page 196
|
||||
+ * AUDIN_MUTE_VAL 0x35 => impossible: Already assigned to AUDIN_FIFO1_PTR
|
||||
+ * AUDIN_FIFO1_PTR is more likely to be correct here since surrounding registers
|
||||
+ * also deal with AUDIN_FIFO1
|
||||
+ *
|
||||
+ * Clarification needed from Amlogic
|
||||
+ */
|
||||
+
|
||||
+#define AUDIN_SPDIF_MODE 0x000
|
||||
+#define AUDIN_SPDIF_FS_CLK_RLTN 0x004
|
||||
+#define AUDIN_SPDIF_CHNL_STS_A 0x008
|
||||
+#define AUDIN_SPDIF_CHNL_STS_B 0x00C
|
||||
+#define AUDIN_SPDIF_MISC 0x010
|
||||
+#define AUDIN_SPDIF_NPCM_PCPD 0x014
|
||||
+#define AUDIN_SPDIF_END 0x03C /* Unknown */
|
||||
+#define AUDIN_I2SIN_CTRL 0x040
|
||||
+#define AUDIN_SOURCE_SEL 0x044
|
||||
+#define AUDIN_DECODE_FORMAT 0x048
|
||||
+#define AUDIN_DECODE_CONTROL_STATUS 0x04C
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_0 0x050
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_1 0x054
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_2 0x058
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_3 0x05C
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_4 0x060
|
||||
+#define AUDIN_DECODE_CHANNEL_STATUS_A_5 0x064
|
||||
+#define AUDIN_FIFO0_START 0x080
|
||||
+#define AUDIN_FIFO0_END 0x084
|
||||
+#define AUDIN_FIFO0_PTR 0x088
|
||||
+#define AUDIN_FIFO0_INTR 0x08C
|
||||
+#define AUDIN_FIFO0_RDPTR 0x090
|
||||
+#define AUDIN_FIFO0_CTRL 0x094
|
||||
+#define AUDIN_FIFO0_CTRL1 0x098
|
||||
+#define AUDIN_FIFO0_LVL0 0x09C
|
||||
+#define AUDIN_FIFO0_LVL1 0x0A0
|
||||
+#define AUDIN_FIFO0_LVL2 0x0A4
|
||||
+#define AUDIN_FIFO0_REQID 0x0C0
|
||||
+#define AUDIN_FIFO0_WRAP 0x0C4
|
||||
+#define AUDIN_FIFO1_START 0x0CC
|
||||
+#define AUDIN_FIFO1_END 0x0D0
|
||||
+#define AUDIN_FIFO1_PTR 0x0D4
|
||||
+#define AUDIN_FIFO1_INTR 0x0D8
|
||||
+#define AUDIN_FIFO1_RDPTR 0x0DC
|
||||
+#define AUDIN_FIFO1_CTRL 0x0E0
|
||||
+#define AUDIN_FIFO1_CTRL1 0x0E4
|
||||
+#define AUDIN_FIFO1_LVL0 0x100
|
||||
+#define AUDIN_FIFO1_LVL1 0x104
|
||||
+#define AUDIN_FIFO1_LVL2 0x108
|
||||
+#define AUDIN_FIFO1_REQID 0x10C
|
||||
+#define AUDIN_FIFO1_WRAP 0x110
|
||||
+#define AUDIN_FIFO2_START 0x114
|
||||
+#define AUDIN_FIFO2_END 0x118
|
||||
+#define AUDIN_FIFO2_PTR 0x11C
|
||||
+#define AUDIN_FIFO2_INTR 0x120
|
||||
+#define AUDIN_FIFO2_RDPTR 0x124
|
||||
+#define AUDIN_FIFO2_CTRL 0x128
|
||||
+#define AUDIN_FIFO2_CTRL1 0x12C
|
||||
+#define AUDIN_FIFO2_LVL0 0x130
|
||||
+#define AUDIN_FIFO2_LVL1 0x134
|
||||
+#define AUDIN_FIFO2_LVL2 0x138
|
||||
+#define AUDIN_FIFO2_REQID 0x13C
|
||||
+#define AUDIN_FIFO2_WRAP 0x140
|
||||
+#define AUDIN_INT_CTRL 0x144
|
||||
+#define AUDIN_FIFO_INT 0x148
|
||||
+#define PCMIN_CTRL0 0x180
|
||||
+#define PCMIN_CTRL1 0x184
|
||||
+#define PCMIN1_CTRL0 0x188
|
||||
+#define PCMIN1_CTRL1 0x18C
|
||||
+#define PCMOUT_CTRL0 0x1C0
|
||||
+#define PCMOUT_CTRL1 0x1C4
|
||||
+#define PCMOUT_CTRL2 0x1C8
|
||||
+#define PCMOUT_CTRL3 0x1CC
|
||||
+#define PCMOUT1_CTRL0 0x1D0
|
||||
+#define PCMOUT1_CTRL1 0x1D4
|
||||
+#define PCMOUT1_CTRL2 0x1D8
|
||||
+#define PCMOUT1_CTRL3 0x1DC
|
||||
+#define AUDOUT_CTRL 0x200
|
||||
+#define AUDOUT_CTRL1 0x204
|
||||
+#define AUDOUT_BUF0_STA 0x208
|
||||
+#define AUDOUT_BUF0_EDA 0x20C
|
||||
+#define AUDOUT_BUF0_WPTR 0x210
|
||||
+#define AUDOUT_BUF1_STA 0x214
|
||||
+#define AUDOUT_BUF1_EDA 0x218
|
||||
+#define AUDOUT_BUF1_WPTR 0x21C
|
||||
+#define AUDOUT_FIFO_RPTR 0x220
|
||||
+#define AUDOUT_INTR_PTR 0x224
|
||||
+#define AUDOUT_FIFO_STS 0x228
|
||||
+#define AUDOUT1_CTRL 0x240
|
||||
+#define AUDOUT1_CTRL1 0x244
|
||||
+#define AUDOUT1_BUF0_STA 0x248
|
||||
+#define AUDOUT1_BUF0_EDA 0x24C
|
||||
+#define AUDOUT1_BUF0_WPTR 0x250
|
||||
+#define AUDOUT1_BUF1_STA 0x254
|
||||
+#define AUDOUT1_BUF1_EDA 0x258
|
||||
+#define AUDOUT1_BUF1_WPTR 0x25C
|
||||
+#define AUDOUT1_FIFO_RPTR 0x260
|
||||
+#define AUDOUT1_INTR_PTR 0x264
|
||||
+#define AUDOUT1_FIFO_STS 0x268
|
||||
+#define AUDIN_HDMI_MEAS_CTRL 0x280
|
||||
+#define AUDIN_HDMI_MEAS_CYCLES_M1 0x284
|
||||
+#define AUDIN_HDMI_MEAS_INTR_MASKN 0x288
|
||||
+#define AUDIN_HDMI_MEAS_INTR_STAT 0x28C
|
||||
+#define AUDIN_HDMI_REF_CYCLES_STAT_0 0x290
|
||||
+#define AUDIN_HDMI_REF_CYCLES_STAT_1 0x294
|
||||
+#define AUDIN_HDMIRX_AFIFO_STAT 0x298
|
||||
+#define AUDIN_FIFO0_PIO_STS 0x2C0
|
||||
+#define AUDIN_FIFO0_PIO_RDL 0x2C4
|
||||
+#define AUDIN_FIFO0_PIO_RDH 0x2C8
|
||||
+#define AUDIN_FIFO1_PIO_STS 0x2CC
|
||||
+#define AUDIN_FIFO1_PIO_RDL 0x2D0
|
||||
+#define AUDIN_FIFO1_PIO_RDH 0x2D4
|
||||
+#define AUDIN_FIFO2_PIO_STS 0x2D8
|
||||
+#define AUDIN_FIFO2_PIO_RDL 0x2DC
|
||||
+#define AUDIN_FIFO2_PIO_RDH 0x2E0
|
||||
+#define AUDOUT_FIFO_PIO_STS 0x2E4
|
||||
+#define AUDOUT_FIFO_PIO_WRL 0x2E8
|
||||
+#define AUDOUT_FIFO_PIO_WRH 0x2EC
|
||||
+#define AUDOUT1_FIFO_PIO_STS 0x2F0 /* Unknown */
|
||||
+#define AUDOUT1_FIFO_PIO_WRL 0x2F4 /* Unknown */
|
||||
+#define AUDOUT1_FIFO_PIO_WRH 0x2F8 /* Unknown */
|
||||
+#define AUD_RESAMPLE_CTRL0 0x2FC
|
||||
+#define AUD_RESAMPLE_CTRL1 0x300
|
||||
+#define AUD_RESAMPLE_STATUS 0x304
|
||||
+
|
||||
+#endif /* _AUDIN_REGS_H_ */
|
||||
@@ -1,416 +0,0 @@
|
||||
From bb5102086db1579c1289440fa8aa184a70cb7c64 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 12:14:40 +0200
|
||||
Subject: [PATCH] ASoC: meson: add aiu i2s dma support
|
||||
|
||||
Add support for the i2s output dma which is part of the AIU block
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/Kconfig | 7 +
|
||||
sound/soc/meson/Makefile | 2 +
|
||||
sound/soc/meson/aiu-i2s-dma.c | 370 ++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 379 insertions(+)
|
||||
create mode 100644 sound/soc/meson/aiu-i2s-dma.c
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index ca0e3e9..88fbfc2 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -7,3 +7,10 @@ menuconfig SND_SOC_MESON
|
||||
Say Y or M if you want to add support for codecs attached to
|
||||
the Amlogic Meson SoCs Audio interfaces. You will also need to
|
||||
select the audio interfaces to support below.
|
||||
+
|
||||
+config SND_SOC_MESON_I2S
|
||||
+ tristate "Meson i2s interface"
|
||||
+ depends on SND_SOC_MESON
|
||||
+ help
|
||||
+ Say Y or M if you want to add support for i2s dma driver for Amlogic
|
||||
+ Meson SoCs.
|
||||
diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile
|
||||
index 22028ab..273f275 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -1,3 +1,5 @@
|
||||
snd-soc-meson-audio-core-objs := audio-core.o
|
||||
+snd-soc-meson-aiu-i2s-dma-objs := aiu-i2s-dma.o
|
||||
|
||||
obj-$(CONFIG_SND_SOC_MESON) += snd-soc-meson-audio-core.o
|
||||
+obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-aiu-i2s-dma.o
|
||||
diff --git a/sound/soc/meson/aiu-i2s-dma.c b/sound/soc/meson/aiu-i2s-dma.c
|
||||
new file mode 100644
|
||||
index 0000000..2684bd0
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/aiu-i2s-dma.c
|
||||
@@ -0,0 +1,370 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/regmap.h>
|
||||
+
|
||||
+#include <sound/pcm_params.h>
|
||||
+#include <sound/soc.h>
|
||||
+
|
||||
+#include "aiu-regs.h"
|
||||
+#include "audio-core.h"
|
||||
+
|
||||
+#define DRV_NAME "meson-aiu-i2s-dma"
|
||||
+
|
||||
+struct aiu_i2s_dma {
|
||||
+ struct meson_audio_core_data *core;
|
||||
+ struct clk *fast;
|
||||
+ int irq;
|
||||
+};
|
||||
+
|
||||
+#define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0)
|
||||
+#define AIU_MEM_I2S_CONTROL_INIT BIT(0)
|
||||
+#define AIU_MEM_I2S_CONTROL_FILL_EN BIT(1)
|
||||
+#define AIU_MEM_I2S_CONTROL_EMPTY_EN BIT(2)
|
||||
+#define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6)
|
||||
+#define AIU_MEM_I2S_CONTROL_BUSY BIT(7)
|
||||
+#define AIU_MEM_I2S_CONTROL_DATA_READY BIT(8)
|
||||
+#define AIU_MEM_I2S_CONTROL_LEVEL_CNTL BIT(9)
|
||||
+#define AIU_MEM_I2S_MASKS_IRQ_BLOCK_MASK GENMASK(31, 16)
|
||||
+#define AIU_MEM_I2S_MASKS_IRQ_BLOCK(n) ((n) << 16)
|
||||
+#define AIU_MEM_I2S_MASKS_CH_MEM_MASK GENMASK(15, 8)
|
||||
+#define AIU_MEM_I2S_MASKS_CH_MEM(ch) ((ch) << 8)
|
||||
+#define AIU_MEM_I2S_MASKS_CH_RD_MASK GENMASK(7, 0)
|
||||
+#define AIU_MEM_I2S_MASKS_CH_RD(ch) ((ch) << 0)
|
||||
+#define AIU_RST_SOFT_I2S_FAST_DOMAIN BIT(0)
|
||||
+#define AIU_RST_SOFT_I2S_SLOW_DOMAIN BIT(1)
|
||||
+
|
||||
+/*
|
||||
+ * The DMA works by i2s "blocks" (or DMA burst). The burst size and the memory
|
||||
+ * layout expected depends on the mode of operation.
|
||||
+ *
|
||||
+ * - Normal mode: The channels are expected to be packed in 32 bytes groups
|
||||
+ * interleaved the buffer. AIU_MEM_I2S_MASKS_CH_MEM is a bitfield representing
|
||||
+ * the channels present in memory. AIU_MEM_I2S_MASKS_CH_MEM represents the
|
||||
+ * channels read by the DMA. This is very flexible but the unsual memory layout
|
||||
+ * makes it less easy to deal with. The burst size is 32 bytes times the number
|
||||
+ * of channels read.
|
||||
+ *
|
||||
+ * - Split mode:
|
||||
+ * Classical channel interleaved frame organisation. In this mode,
|
||||
+ * AIU_MEM_I2S_MASKS_CH_MEM and AIU_MEM_I2S_MASKS_CH_MEM must be set to 0xff and
|
||||
+ * the burst size is fixed to 256 bytes. The input can be either 2 or 8
|
||||
+ * channels.
|
||||
+ *
|
||||
+ * The following driver implements the split mode.
|
||||
+ */
|
||||
+
|
||||
+#define AIU_I2S_DMA_BURST 256
|
||||
+
|
||||
+static struct snd_pcm_hardware aiu_i2s_dma_hw = {
|
||||
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
|
||||
+ SNDRV_PCM_INFO_MMAP |
|
||||
+ SNDRV_PCM_INFO_MMAP_VALID |
|
||||
+ SNDRV_PCM_INFO_PAUSE),
|
||||
+
|
||||
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S24_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S32_LE),
|
||||
+
|
||||
+ /*
|
||||
+ * TODO: The DMA can change the endianness, the msb position
|
||||
+ * and deal with unsigned - support this later on
|
||||
+ */
|
||||
+
|
||||
+ .rate_min = 8000,
|
||||
+ .rate_max = 192000,
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 8,
|
||||
+ .period_bytes_min = AIU_I2S_DMA_BURST,
|
||||
+ .period_bytes_max = AIU_I2S_DMA_BURST * 65535,
|
||||
+ .periods_min = 2,
|
||||
+ .periods_max = UINT_MAX,
|
||||
+ .buffer_bytes_max = 1 * 1024 * 1024,
|
||||
+ .fifo_size = 0,
|
||||
+};
|
||||
+
|
||||
+static struct aiu_i2s_dma *aiu_i2s_dma_priv(struct snd_pcm_substream *s)
|
||||
+{
|
||||
+ struct snd_soc_pcm_runtime *rtd = s->private_data;
|
||||
+ struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
+
|
||||
+ return snd_soc_component_get_drvdata(component);
|
||||
+}
|
||||
+
|
||||
+static snd_pcm_uframes_t
|
||||
+aiu_i2s_dma_pointer(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+ unsigned int addr;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = regmap_read(priv->core->aiu, AIU_MEM_I2S_RD_PTR,
|
||||
+ &addr);
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr);
|
||||
+}
|
||||
+
|
||||
+static void __dma_enable(struct aiu_i2s_dma *priv, bool enable)
|
||||
+{
|
||||
+ unsigned int en_mask = (AIU_MEM_I2S_CONTROL_FILL_EN |
|
||||
+ AIU_MEM_I2S_CONTROL_EMPTY_EN);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, en_mask,
|
||||
+ enable ? en_mask : 0);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
+{
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case SNDRV_PCM_TRIGGER_START:
|
||||
+ case SNDRV_PCM_TRIGGER_RESUME:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
+ __dma_enable(priv, true);
|
||||
+ break;
|
||||
+ case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
+ case SNDRV_PCM_TRIGGER_STOP:
|
||||
+ __dma_enable(priv, false);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __dma_init_mem(struct aiu_i2s_dma *priv)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL,
|
||||
+ AIU_MEM_I2S_CONTROL_INIT,
|
||||
+ AIU_MEM_I2S_CONTROL_INIT);
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_BUF_CNTL,
|
||||
+ AIU_MEM_I2S_BUF_CNTL_INIT,
|
||||
+ AIU_MEM_I2S_BUF_CNTL_INIT);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL,
|
||||
+ AIU_MEM_I2S_CONTROL_INIT,
|
||||
+ 0);
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_BUF_CNTL,
|
||||
+ AIU_MEM_I2S_BUF_CNTL_INIT,
|
||||
+ 0);
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_prepare(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+
|
||||
+ __dma_init_mem(priv);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params)
|
||||
+{
|
||||
+ struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+ int ret;
|
||||
+ u32 burst_num, mem_ctl;
|
||||
+ dma_addr_t end_ptr;
|
||||
+
|
||||
+ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Setup memory layout */
|
||||
+ if (params_physical_width(params) == 16)
|
||||
+ mem_ctl = AIU_MEM_I2S_CONTROL_MODE_16BIT;
|
||||
+ else
|
||||
+ mem_ctl = 0;
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL,
|
||||
+ AIU_MEM_I2S_CONTROL_MODE_16BIT,
|
||||
+ mem_ctl);
|
||||
+
|
||||
+ /* Initialize memory pointers */
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_I2S_START_PTR, runtime->dma_addr);
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_I2S_RD_PTR, runtime->dma_addr);
|
||||
+
|
||||
+ /* The end pointer is the address of the last valid block */
|
||||
+ end_ptr = runtime->dma_addr + runtime->dma_bytes - AIU_I2S_DMA_BURST;
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_I2S_END_PTR, end_ptr);
|
||||
+
|
||||
+ /* Memory masks */
|
||||
+ burst_num = params_period_bytes(params) / AIU_I2S_DMA_BURST;
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_I2S_MASKS,
|
||||
+ AIU_MEM_I2S_MASKS_CH_RD(0xff) |
|
||||
+ AIU_MEM_I2S_MASKS_CH_MEM(0xff) |
|
||||
+ AIU_MEM_I2S_MASKS_IRQ_BLOCK(burst_num));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_hw_free(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ return snd_pcm_lib_free_pages(substream);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static irqreturn_t aiu_i2s_dma_irq_block(int irq, void *dev_id)
|
||||
+{
|
||||
+ struct snd_pcm_substream *playback = dev_id;
|
||||
+
|
||||
+ snd_pcm_period_elapsed(playback);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_open(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+ int ret;
|
||||
+
|
||||
+ snd_soc_set_runtime_hwparams(substream, &aiu_i2s_dma_hw);
|
||||
+
|
||||
+ /*
|
||||
+ * Make sure the buffer and period size are multiple of the DMA burst
|
||||
+ * size
|
||||
+ */
|
||||
+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
|
||||
+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
+ AIU_I2S_DMA_BURST);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
|
||||
+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
+ AIU_I2S_DMA_BURST);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Request the I2S DDR irq */
|
||||
+ ret = request_irq(priv->irq, aiu_i2s_dma_irq_block, 0,
|
||||
+ DRV_NAME, substream);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Power up the i2s fast domain - can't write the registers w/o it */
|
||||
+ ret = clk_prepare_enable(priv->fast);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Make sure the dma is initially disabled */
|
||||
+ __dma_enable(priv, false);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_i2s_dma_close(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_i2s_dma *priv = aiu_i2s_dma_priv(substream);
|
||||
+
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+ free_irq(priv->irq, substream);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct snd_pcm_ops aiu_i2s_dma_ops = {
|
||||
+ .open = aiu_i2s_dma_open,
|
||||
+ .close = aiu_i2s_dma_close,
|
||||
+ .ioctl = snd_pcm_lib_ioctl,
|
||||
+ .hw_params = aiu_i2s_dma_hw_params,
|
||||
+ .hw_free = aiu_i2s_dma_hw_free,
|
||||
+ .prepare = aiu_i2s_dma_prepare,
|
||||
+ .pointer = aiu_i2s_dma_pointer,
|
||||
+ .trigger = aiu_i2s_dma_trigger,
|
||||
+};
|
||||
+
|
||||
+static int aiu_i2s_dma_new(struct snd_soc_pcm_runtime *rtd)
|
||||
+{
|
||||
+ struct snd_card *card = rtd->card->snd_card;
|
||||
+ size_t size = aiu_i2s_dma_hw.buffer_bytes_max;
|
||||
+
|
||||
+ return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm,
|
||||
+ SNDRV_DMA_TYPE_DEV,
|
||||
+ card->dev, size, size);
|
||||
+}
|
||||
+
|
||||
+static const struct snd_soc_component_driver aiu_i2s_platform = {
|
||||
+ .ops = &aiu_i2s_dma_ops,
|
||||
+ .pcm_new = aiu_i2s_dma_new,
|
||||
+ .name = DRV_NAME,
|
||||
+};
|
||||
+
|
||||
+static int aiu_i2s_dma_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct aiu_i2s_dma *priv;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ platform_set_drvdata(pdev, priv);
|
||||
+ priv->core = dev_get_drvdata(dev->parent);
|
||||
+
|
||||
+ priv->fast = devm_clk_get(dev, "fast");
|
||||
+ if (IS_ERR(priv->fast)) {
|
||||
+ if (PTR_ERR(priv->fast) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get i2s fast domain clock\n");
|
||||
+ return PTR_ERR(priv->fast);
|
||||
+ }
|
||||
+
|
||||
+ priv->irq = platform_get_irq(pdev, 0);
|
||||
+ if (priv->irq <= 0) {
|
||||
+ dev_err(dev, "Can't get i2s ddr irq\n");
|
||||
+ return priv->irq;
|
||||
+ }
|
||||
+
|
||||
+ return devm_snd_soc_register_component(dev, &aiu_i2s_platform,
|
||||
+ NULL, 0);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id aiu_i2s_dma_of_match[] = {
|
||||
+ { .compatible = "amlogic,meson-aiu-i2s-dma", },
|
||||
+ { .compatible = "amlogic,meson-gxbb-aiu-i2s-dma", },
|
||||
+ { .compatible = "amlogic,meson-gxl-aiu-i2s-dma", },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, aiu_i2s_dma_of_match);
|
||||
+
|
||||
+static struct platform_driver aiu_i2s_dma_pdrv = {
|
||||
+ .probe = aiu_i2s_dma_probe,
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .of_match_table = aiu_i2s_dma_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(aiu_i2s_dma_pdrv);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Meson AIU i2s DMA ASoC Driver");
|
||||
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user