Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c58a94a4d | ||
|
|
5336e17a06 | ||
|
|
a017fae49d | ||
|
|
96d59c2a40 | ||
|
|
1f23c3ac72 | ||
|
|
3f26a61d9a | ||
|
|
6a728d916f | ||
|
|
7f0ab07752 | ||
|
|
2b89de39e3 | ||
|
|
7d7a52732d | ||
|
|
2d6f692a4c | ||
|
|
279a4c4db1 | ||
|
|
a65db13c9e | ||
|
|
a592fc9866 | ||
|
|
66c1b016c9 | ||
|
|
1ca4275698 | ||
|
|
f9a3bccf7b | ||
|
|
1c95022184 | ||
|
|
d4deca66b2 | ||
|
|
1c2ef541ea | ||
|
|
55d84758a2 | ||
|
|
82010866b1 | ||
|
|
647a461a74 | ||
|
|
294ad6cd58 | ||
|
|
bfdedbffe6 | ||
|
|
d409e328be | ||
|
|
a6ae25da06 | ||
|
|
bc1266a44b | ||
|
|
c1eb0ac4cd | ||
|
|
9939422d10 | ||
|
|
51cf310472 | ||
|
|
f38a31eee3 | ||
|
|
e388662422 | ||
|
|
0258ef641d | ||
|
|
bf29dd3971 | ||
|
|
7314ce1963 | ||
|
|
70d69d3518 | ||
|
|
574c883207 | ||
|
|
5812ed014e | ||
|
|
13e4578b7a | ||
|
|
d6a700565e | ||
|
|
d9d8c96c70 | ||
|
|
329caf6c1c | ||
|
|
27ee3ef98f | ||
|
|
63967cf6c0 | ||
|
|
a874bb5fb5 | ||
|
|
dc4ee61809 | ||
|
|
febc4473d3 | ||
|
|
7b379e648c | ||
|
|
e4bff62923 | ||
|
|
3839e43428 | ||
|
|
9e8cccdf82 | ||
|
|
f87032c302 | ||
|
|
30aa775450 | ||
|
|
308fccd7b1 | ||
|
|
6e7bbdbe63 | ||
|
|
4c9a4aadc8 | ||
|
|
d340e79bea | ||
|
|
09cf67cb73 | ||
|
|
0ef7c459ca | ||
|
|
bf9795f70b | ||
|
|
712dcf9f74 | ||
|
|
c42dba1623 | ||
|
|
d44d271c28 | ||
|
|
501b4bd9f4 | ||
|
|
2fd14442c7 | ||
|
|
4efd038805 | ||
|
|
3e1adf8325 | ||
|
|
60e4d1a3cd | ||
|
|
a13089516e | ||
|
|
37615a135b | ||
|
|
e5734a9024 | ||
|
|
081f7124d7 | ||
|
|
9f584f2c6a | ||
|
|
a04fa47883 | ||
|
|
1e627fed34 | ||
|
|
661b39565f | ||
|
|
aa392e78a6 | ||
|
|
c37a6d4c8c | ||
|
|
2d870984e2 | ||
|
|
a860374d64 | ||
|
|
4d99243c91 | ||
|
|
803bfc8391 | ||
|
|
67e722b032 |
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<!-- READ THIS FIRST:
|
||||
- If you need additional help with this template please refer to https://www.home-assistant.io/help/reporting_issues/
|
||||
- Make sure you are running the latest version before reporting an issue: https://github.com/home-assistant/home-assistant/releases
|
||||
- Do not report issues for components here, plaese refer to https://github.com/home-assistant/home-assistant/issues
|
||||
- This is for bugs only. Feature and enhancement requests should go in our community forum: https://community.home-assistant.io/c/feature-requests
|
||||
- Provide as many details as possible. Paste logs, configuration sample and code into the backticks. Do not delete any text from this template!
|
||||
- If you have a problem with a Add-on, make a issue on there repository.
|
||||
-->
|
||||
|
||||
**HassOS release with the issue:**
|
||||
<!--
|
||||
- Frontend -> Developer tools -> Info
|
||||
- Or use this command: hass --version
|
||||
-->
|
||||
|
||||
**Supervisor logs:**
|
||||
<!--
|
||||
- Frontend -> Hass.io -> System
|
||||
- Or use this command: ha su logs
|
||||
-->
|
||||
|
||||
**Journal logs:**
|
||||
<!--
|
||||
- use this command: journalctl
|
||||
-->
|
||||
|
||||
**Kernel logs:**
|
||||
<!--
|
||||
- use this command: dmesg
|
||||
-->
|
||||
|
||||
**Description of problem:**
|
||||
@@ -1,9 +1,9 @@
|
||||
# Bluetooth
|
||||
|
||||
We support `bluetoothctl` on host. Later we want also support Bluetooth trought UI.
|
||||
We support `bluetoothctl` on the host. Later we want to support Bluetooth through the UI.
|
||||
All pairs and settings are persistent over reboots and updates.
|
||||
|
||||
If you want setup Bluetooth on host, use the `bluetoothctl` utility.
|
||||
If you want to setup Bluetooth on the host, use the `bluetoothctl` utility.
|
||||
|
||||
## Scan devices
|
||||
|
||||
|
||||
14
Documentation/boards/hardkernel/odroid-n2.md
Normal file
14
Documentation/boards/hardkernel/odroid-n2.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Odroid-N2
|
||||
|
||||
## eMMC
|
||||
|
||||
eMMC support is provided transparently. Just flash the image to the eMMC board as you would an SD card.
|
||||
|
||||
## Console
|
||||
|
||||
By default, console access is granted over the serial header and over HDMI. Certain startup messages will only appear on the serial console by default. To show the messages on the HDMI console instead, swap the order of the two consoles in the `cmdline.txt` file on the boot partition. You can also delete the AML0 console if you don't plan on using the serial adapter.
|
||||
eg. `console=ttyAML0,115200n8 console=tty0`
|
||||
|
||||
## GPIO
|
||||
|
||||
Refer to [the odroid wiki](https://wiki.odroid.com/odroid-n2/hardware/expansion_connectors).
|
||||
@@ -17,6 +17,7 @@ Requirements:
|
||||
| Device | Quirks |
|
||||
|--------|-----------|
|
||||
| Intel NUC5CPYH | |
|
||||
| Intel NUC6CAYH | |
|
||||
| Gigabyte GB-BPCE-3455 | needs 'nomodeset' in cmdline.txt if you want a console |
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# Building
|
||||
|
||||
Running `sudo ./enter.sh` will get you into the build Docker container.
|
||||
`make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig`
|
||||
|
||||
## Scripts
|
||||
|
||||
|
||||
|
||||
## Helpers
|
||||
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external menuconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-menuconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-menuconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-menuconfig`
|
||||
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external savedefconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-update-defconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-update-defconfig`
|
||||
- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-update-config`
|
||||
@@ -3,7 +3,7 @@
|
||||
## Automatic
|
||||
|
||||
You can use an USB drive with HassOS to configure network options, SSH access to the host and to install updates.
|
||||
Format a USB stick with FAT32/EXT4/NTFS and name it `CONFIG`. Alternative you can create a `CONFIG` folder inside boot partition. Use the following directory structure within the USB drive:
|
||||
Format a USB stick with FAT32/EXT4/NTFS and name it `CONFIG` (in all capitals). Alternative you can create a `CONFIG` folder inside boot partition. Use the following directory structure within the USB drive:
|
||||
|
||||
```text
|
||||
network/
|
||||
@@ -23,8 +23,8 @@ hassos-xy.raucb
|
||||
- The `timesyncd.conf` file allow you to set different NTP servers. HassOS won't boot without correct working time servers!
|
||||
- The `hassos-*.raucb` file is a firmware OTA update which will be installed. These can be found on on the [release][hassos-release] page.
|
||||
|
||||
You can put this USB stick into the device and it will be read on startup. You can also trigger this process later over the
|
||||
API/UI or by calling `systemctl restart hassos-config` on the host.
|
||||
You can put this USB stick into the device and it will be read on startup and files written to the correct places. You can also trigger this process later over the
|
||||
API/UI or by calling `systemctl restart hassos-config` on the host. *The USB Stick just needs to be insterted to the device during this setup process and can be disconnected afterwards.*
|
||||
|
||||
## Local
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
`BOOT_SYS`:
|
||||
- efi
|
||||
- hyprid
|
||||
- spl
|
||||
- mbr
|
||||
|
||||
HassOS is basicly used GPT. But for use GPT we need own the first 1024 of
|
||||
@@ -13,6 +12,12 @@ boot drive. Is that not possible, you can use MBR for your device, they work als
|
||||
|
||||
Hyprid and SPL use both a hyprid MBR/GPT table but SPL move the GPT header 8MB for give space to write SPL and boot images before.
|
||||
|
||||
`BOOT_SPL`:
|
||||
- true
|
||||
- false
|
||||
|
||||
Enable SPL update handling.
|
||||
|
||||
`BOOTLOADER`:
|
||||
- uboot
|
||||
- barebox
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
|
||||
# Kernel Version
|
||||
|
||||
Default Kernel tree: 5.4
|
||||
|
||||
| Board | Version |
|
||||
|-------|---------|
|
||||
| Open Virtual Applicance | 4.19.115 |
|
||||
| Open Virtual Applicance | 5.4.24 |
|
||||
| Raspberry Pi | 4.19.106 |
|
||||
| Tinker Board | 4.19.115 |
|
||||
| Odroid-C2 | 4.19.72 |
|
||||
| Odroid-XU4 | 4.19.72 |
|
||||
| Intel NUC | 4.19.115 |
|
||||
| Tinker Board | 4.19.88 |
|
||||
| Odroid-C2 | 5.4.24 |
|
||||
| Odroid-N2 | 5.4.24 |
|
||||
| Odroid-XU4 | 5.4.24 |
|
||||
| Intel NUC | 5.4.24 |
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Network
|
||||
|
||||
## Configure Network
|
||||
HassOS uses NetworkManager to control the host network. In future releases, you will be able to set up the configuration using the API/UI. Currently only a manual configuration using NetworkManager connection files is supported. Without a configuration file, the device will use DHCP by default. These network connection files can be placed on a USB drive and imported to the host as described in [Configuration][configuration-usb].
|
||||
|
||||
## Configuration Examples
|
||||
@@ -74,10 +75,10 @@ Replace the following configuration:
|
||||
```ini
|
||||
[ipv4]
|
||||
method=manual
|
||||
address=192.168.1.111/24,192.168.1.1
|
||||
address=192.168.1.111/24;192.168.1.1
|
||||
dns=8.8.8.8;8.8.4.4;
|
||||
```
|
||||
For address, the value before the comma is the IP address and subnet prefix bitlength; the second value is the IP address of the gateway.
|
||||
For address, the value before the semicolon is the IP address and subnet prefix bitlength; the second value is the IP address of the gateway.
|
||||
|
||||
## Tips
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ Hass.io OS based on [buildroot](https://buildroot.org/). It's a hypervisor for D
|
||||
|
||||
- Barebox as bootloader on EFI
|
||||
- U-Boot as bootloader on IoT
|
||||
- Linux/Buildroot LTS
|
||||
- RAUC for OTA updates
|
||||
- SquashFS LZ4 as filesystem
|
||||
- Docker 18.09.0
|
||||
- Docker-CE
|
||||
- AppArmor protected
|
||||
- ZRAM LZ4 for /tmp, /var, swap
|
||||
- Run every supervisor
|
||||
|
||||
@@ -10,9 +10,9 @@ pr:
|
||||
|
||||
variables:
|
||||
- name: versionHadolint
|
||||
value: 'v1.16.3'
|
||||
value: 'v1.17.2'
|
||||
- name: versionShellCheck
|
||||
value: 'v0.6.0'
|
||||
value: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ pr: none
|
||||
|
||||
variables:
|
||||
- name: versionGHR
|
||||
value: 'v0.12.1'
|
||||
value: 'v0.13.0'
|
||||
- group: github
|
||||
- group: rauc
|
||||
|
||||
@@ -46,6 +46,8 @@ jobs:
|
||||
board: 'intel_nuc'
|
||||
OdroidC2:
|
||||
board: 'odroid_c2'
|
||||
OdroidN2:
|
||||
board: 'odroid_n2'
|
||||
OdroidXU4:
|
||||
board: 'odroid_xu4'
|
||||
RaspberryPi:
|
||||
|
||||
@@ -3,5 +3,6 @@ BOARD_NAME="Asus TinkerBoard"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=zImage
|
||||
BOOT_SYS=spl
|
||||
BOOT_SYS=hyprid
|
||||
BOOT_SPL=true
|
||||
BOOT_ENV_SIZE=0x8000
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
# CONFIG_DOS_PARTITION is not set
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_CMD_FILEENV=y
|
||||
CONFIG_ENV_IS_NOWHERE=Y
|
||||
|
||||
@@ -77,8 +77,8 @@ m_bpp=32
|
||||
# Allows you to force HDMI thinking that the cable is connected.
|
||||
# true = HDMI will believe that cable is always connected
|
||||
# false = will let board/monitor negotiate the connection status
|
||||
hpd=true
|
||||
#hpd=false
|
||||
hpd=true
|
||||
|
||||
# Monitor output
|
||||
# Controls if HDMI PHY should output anything to the monitor
|
||||
|
||||
@@ -5,7 +5,7 @@ function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local BL1="${BINARIES_DIR}/bl1.bin.hardkernel"
|
||||
local UBOOT_GXBB="${BINARIES_DIR}/u-boot.gxbb"
|
||||
local spl_img="$(path_spl_img)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/config.txt"
|
||||
@@ -16,9 +16,9 @@ function hassos_pre_image() {
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BL1}" of="${spl_img}" conv=notrunc bs=1 count=440
|
||||
dd if="${BL1}" of="${spl_img}" conv=notrunc bs=512 skip=1 seek=1
|
||||
dd if="${UBOOT_GXBB}" of="${spl_img}" conv=notrunc bs=512 seek=97
|
||||
dd if="${BL1}" of="${SPL_IMG}" conv=notrunc bs=1 count=440
|
||||
dd if="${BL1}" of="${SPL_IMG}" conv=notrunc bs=512 skip=1 seek=1
|
||||
dd if="${UBOOT_GXBB}" of="${SPL_IMG}" conv=notrunc bs=512 seek=97
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,4 +4,5 @@ CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
BOOT_SPL=true
|
||||
BOOT_ENV_SIZE=0x2000
|
||||
|
||||
@@ -24,7 +24,7 @@ fi
|
||||
|
||||
# Board bootargs
|
||||
if test "${m}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi
|
||||
setenv bootargs_odroidc2 "${condev} no_console_suspend hdmimode=${m} ${cmode} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd} max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam}"
|
||||
setenv bootargs_odroidc2 "no_console_suspend hdmimode=${m} ${cmode} m_bpp=${m_bpp} vout=${vout} net.ifnames=0 elevator=noop disablehpd=${hpd} max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam}"
|
||||
|
||||
# HassOS bootargs
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor cgroup_enable=memory"
|
||||
@@ -38,7 +38,6 @@ usb start
|
||||
# Load extraargs
|
||||
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
|
||||
fatload mmc ${devnum}:1 ${fdt_addr_r} meson-gxbb-odroidc2.dtb
|
||||
#fdt addr ${fdt_addr_r}
|
||||
|
||||
# logical volumes get numbered after physical ones.
|
||||
# 1. boot
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
CONFIG_DOS_PARTITION=y
|
||||
# CONFIG_EFI_PARTITION is not set
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
CONFIG_USB=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_CMD_FILEENV=y
|
||||
CONFIG_ENV_IS_NOWHERE=Y
|
||||
|
||||
84
buildroot-external/board/hardkernel/odroid-n2/boot-env.txt
Normal file
84
buildroot-external/board/hardkernel/odroid-n2/boot-env.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
# Custom modeline!
|
||||
# To use custom modeline you need to disable all the below resolutions
|
||||
# and setup your own!
|
||||
# For more information check our wiki:
|
||||
# https://wiki.odroid.com/odroid-n2/application_note/software/set_display_mode
|
||||
|
||||
# HDMI Mode
|
||||
# Resolution Configuration
|
||||
# Symbol | Resolution
|
||||
# ----------------------+-------------
|
||||
# "480x320p60hz" | 480x320 Progressive 60Hz
|
||||
# "480p60hz" | 720x480 Progressive 60Hz
|
||||
# "576p50hz" | 720x576 Progressive 50Hz
|
||||
# "720p60hz" | 1280x720 Progressive 60Hz
|
||||
# "720p50hz" | 1280x720 Progressive 50Hz
|
||||
# "1080p60hz" | 1920x1080 Progressive 60Hz
|
||||
# "1080p50hz" | 1920x1080 Progressive 50Hz
|
||||
# "1080p30hz" | 1920x1080 Progressive 30Hz
|
||||
# "1080p24hz" | 1920x1080 Progressive 24Hz
|
||||
# "1080i60hz" | 1920x1080 Interlaced 60Hz
|
||||
# "1080i50hz" | 1920x1080 Interlaced 50Hz
|
||||
# "2160p60hz" | 3840x2160 Progressive 60Hz
|
||||
# "2160p50hz" | 3840x2160 Progressive 50Hz
|
||||
# "2160p30hz" | 3840x2160 Progressive 30Hz
|
||||
# "2160p25hz" | 3840x2160 Progressive 25Hz
|
||||
# "2160p24hz" | 3840x2160 Progressive 24Hz
|
||||
# "smpte24hz" | 3840x2160 Progressive 24Hz SMPTE
|
||||
# "2160p60hz420" | 3840x2160 Progressive 60Hz YCbCr 4:2:0
|
||||
# "2160p50hz420" | 3840x2160 Progressive 50Hz YCbCr 4:2:0
|
||||
# "640x480p60hz" | 640x480 Progressive 60Hz
|
||||
# "800x480p60hz" | 800x480 Progressive 60Hz
|
||||
# "800x600p60hz" | 800x600 Progressive 60Hz
|
||||
# "1024x600p60hz" | 1024x600 Progressive 60Hz
|
||||
# "1024x768p60hz" | 1024x768 Progressive 60Hz
|
||||
# "1280x800p60hz" | 1280x800 Progressive 60Hz
|
||||
# "1280x1024p60hz" | 1280x1024 Progressive 60Hz
|
||||
# "1360x768p60hz" | 1360x768 Progressive 60Hz
|
||||
# "1440x900p60hz" | 1440x900 Progressive 60Hz
|
||||
# "1600x900p60hz" | 1600x900 Progressive 60Hz
|
||||
# "1600x1200p60hz" | 1600x1200 Progressive 60Hz
|
||||
# "1680x1050p60hz" | 1680x1050 Progressive 60Hz
|
||||
# "1920x1200p60hz" | 1920x1200 Progressive 60Hz
|
||||
# "2560x1080p60hz" | 2560x1080 Progressive 60Hz
|
||||
# "2560x1440p60hz" | 2560x1440 Progressive 60Hz
|
||||
# "2560x1600p60hz" | 2560x1600 Progressive 60Hz
|
||||
# "3440x1440p60hz" | 3440x1440 Progressive 60Hz
|
||||
hdmimode=1080p60hz
|
||||
|
||||
# Overscan percentage
|
||||
# This value scales down the actual screen size by the percentage below
|
||||
# valid range is 80 to 100
|
||||
overscan=100
|
||||
|
||||
### voutmode : hdmi or dvi
|
||||
#voutmode=dvi
|
||||
voutmode=hdmi
|
||||
|
||||
# HPD enable/disable option
|
||||
disablehpd="false"
|
||||
|
||||
# max cpu frequency for big core, A73 in MHz unit
|
||||
# 1.8 GHz, default value
|
||||
#max_freq_a73=2004 # 2.004 GHz
|
||||
#max_freq_a73=1908 # 1.908 GHz
|
||||
#max_freq_a73=1704 # 1.704 GHz
|
||||
max_freq_a73=1800
|
||||
|
||||
# max cpu frequency for little core, A53 in MHz unit
|
||||
# 1.896 GHz, default value
|
||||
#max_freq_a53=1992 # 1.992 GHz
|
||||
#max_freq_a53=1704 # 1.704 GHz
|
||||
max_freq_a53=1896
|
||||
|
||||
|
||||
# max cpu-cores
|
||||
# Note:
|
||||
# CPU's 0 and 1 are the A53 (small cores)
|
||||
# CPU's 2 to 5 are the A73 (big cores)
|
||||
# Lowering this value disables only the bigger cores (the last cores).
|
||||
#maxcpus=4
|
||||
#maxcpus=5
|
||||
maxcpus=6
|
||||
25
buildroot-external/board/hardkernel/odroid-n2/hassos-hook.sh
Executable file
25
buildroot-external/board/hardkernel/odroid-n2/hassos-hook.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC2155
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local UBOOT_G12B="${BINARIES_DIR}/u-boot.g12b"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/config.txt"
|
||||
cp "${BINARIES_DIR}/meson-g12b-odroid-n2.dtb" "${BOOT_DATA}/meson-g12b-odroid-n2.dtb"
|
||||
|
||||
echo "console=tty0 console=ttyAML0,115200n8" > "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${UBOOT_G12B}" of="${SPL_IMG}" conv=notrunc bs=512 seek=1
|
||||
}
|
||||
|
||||
|
||||
function hassos_post_image() {
|
||||
convert_disk_image_gz
|
||||
}
|
||||
|
||||
6521
buildroot-external/board/hardkernel/odroid-n2/kernel.config
Normal file
6521
buildroot-external/board/hardkernel/odroid-n2/kernel.config
Normal file
File diff suppressed because it is too large
Load Diff
8
buildroot-external/board/hardkernel/odroid-n2/meta
Normal file
8
buildroot-external/board/hardkernel/odroid-n2/meta
Normal file
@@ -0,0 +1,8 @@
|
||||
BOARD_ID=odroid-n2
|
||||
BOARD_NAME="Hardkernel Odroid-N2"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
BOOT_SPL=true
|
||||
BOOT_ENV_SIZE=0x2000
|
||||
93
buildroot-external/board/hardkernel/odroid-n2/uboot-boot.ush
Normal file
93
buildroot-external/board/hardkernel/odroid-n2/uboot-boot.ush
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
###########################################
|
||||
|
||||
part start mmc ${devnum} 9 mmc_env
|
||||
mmc dev ${devnum}
|
||||
setenv loadbootstate " \
|
||||
echo 'loading env...'; \
|
||||
mmc read ${ramdisk_addr_r} ${mmc_env} 0x10; \
|
||||
env import -c ${ramdisk_addr_r} 0x2000;"
|
||||
|
||||
setenv storebootstate " \
|
||||
echo 'storing env...'; \
|
||||
env export -c -s 0x2000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \
|
||||
mmc write ${ramdisk_addr_r} ${mmc_env} 0x10;"
|
||||
|
||||
run loadbootstate
|
||||
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B"
|
||||
test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3
|
||||
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
|
||||
|
||||
if load mmc ${devnum}:1 ${ramdisk_addr_r} config.txt; then
|
||||
env import -t ${ramdisk_addr_r} ${filesize};
|
||||
fi
|
||||
|
||||
# Board bootargs
|
||||
if test "${hdmimode}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi
|
||||
|
||||
# Boot Args
|
||||
setenv bootargs_odroidn2 "clk_ignore_unused hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} ${cmode} voutmode=${voutmode} disablehpd=${disablehpd} overscan=${overscan}"
|
||||
|
||||
# HassOS bootargs
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor cgroup_enable=memory"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
|
||||
usb start
|
||||
|
||||
# Load extraargs
|
||||
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
|
||||
fatload mmc ${devnum}:1 ${fdt_addr_r} meson-g12b-odroid-n2.dtb
|
||||
|
||||
# logical volumes get numbered after physical ones.
|
||||
# 1. boot
|
||||
# 2. Extended partition
|
||||
# 3. Overlay
|
||||
# 4. Data
|
||||
# 5. KernelA
|
||||
# 6. SystemA
|
||||
# 7. KernelB
|
||||
# 8. SystemB
|
||||
# 9. BootInfo
|
||||
setenv bootargs
|
||||
for BOOT_SLOT in "${BOOT_ORDER}"; do
|
||||
if test "x${bootargs}" != "x"; then
|
||||
# skip remaining slots
|
||||
elif test "x${BOOT_SLOT}" = "xA"; then
|
||||
if test ${BOOT_A_LEFT} -gt 0; then
|
||||
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
|
||||
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc ${devnum}:5 ${kernel_addr_r} Image"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_odroidn2} ${bootargs_a} rauc.slot=A ${cmdline}"
|
||||
fi
|
||||
elif test "x${BOOT_SLOT}" = "xB"; then
|
||||
if test ${BOOT_B_LEFT} -gt 0; then
|
||||
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
|
||||
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc ${devnum}:7 ${kernel_addr_r} Image"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_odroidn2} ${bootargs_b} rauc.slot=B ${cmdline}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if test -n "${bootargs}"; then
|
||||
run storebootstate
|
||||
else
|
||||
echo "No valid slot found, resetting tries to 3"
|
||||
setenv BOOT_A_LEFT 3
|
||||
setenv BOOT_B_LEFT 3
|
||||
run storebootstate
|
||||
reset
|
||||
fi
|
||||
|
||||
echo "Loading kernel"
|
||||
run load_kernel
|
||||
echo " Starting kernel"
|
||||
printenv load_kernel
|
||||
printenv bootargs
|
||||
booti ${kernel_addr_r} - ${fdt_addr_r}
|
||||
|
||||
echo "Fails on boot"
|
||||
reset
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_DOS_PARTITION=y
|
||||
# CONFIG_EFI_PARTITION is not set
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
macaddr=00:1e:06:61:7a:39
|
||||
vout=hdmi
|
||||
vout=hdmi
|
||||
# - DVI Mode (disables sound over HDMI as per DVI compat)
|
||||
# vout=dvi
|
||||
|
||||
@@ -16,7 +15,7 @@ disable_vu7=false
|
||||
# DRAM Frequency
|
||||
# Sets the LPDDR3 memory frequency
|
||||
# Supported values: 933 825 728 633 (MHZ)
|
||||
ddr_freq 825
|
||||
ddr_freq=825
|
||||
|
||||
# External watchdog board enable
|
||||
external_watchdog=false
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,4 +4,5 @@ CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=zImage
|
||||
BOOT_SYS=mbr
|
||||
BOOT_SPL=true
|
||||
BOOT_ENV_SIZE=0x4000
|
||||
|
||||
@@ -7,14 +7,11 @@ mmc dev ${devnum}
|
||||
# Note that import is performed twice for backwards compatability.
|
||||
setenv loadbootstate " \
|
||||
echo 'loading env...'; \
|
||||
mw.b ${ramdisk_addr_r} 0 0x4000; \
|
||||
mmc read ${ramdisk_addr_r} ${mmc_env} 0x20; \
|
||||
env import -c ${ramdisk_addr_r} 0x2000 || \
|
||||
env import -c ${ramdisk_addr_r} 0x4000;"
|
||||
|
||||
setenv storebootstate " \
|
||||
echo 'storing env...'; \
|
||||
mw.b ${ramdisk_addr_r} 0 0x4000; \
|
||||
env export -c -s 0x4000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \
|
||||
mmc write ${ramdisk_addr_r} ${mmc_env} 0x20;"
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
CONFIG_DOS_PARTITION=y
|
||||
# CONFIG_EFI_PARTITION is not set
|
||||
CONFIG_CMD_FILEENV=y
|
||||
CONFIG_ENV_IS_NOWHERE=Y
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# Kernel
|
||||
https://github.com/akuster/meta-odroid
|
||||
https://github.com/superna9999/linux
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
From 6763c7964e9cb28e21497eee0032be053461bba5 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 13 Nov 2017 12:09:40 +0100
|
||||
Subject: [PATCH 01/53] 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 db8d364f8476..ab1cb51319e7 100644
|
||||
--- a/arch/arm64/configs/defconfig
|
||||
+++ b/arch/arm64/configs/defconfig
|
||||
@@ -413,6 +413,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
|
||||
@@ -424,6 +425,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
|
||||
@@ -444,6 +447,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
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,290 +0,0 @@
|
||||
From 6b2734923e6bf1d4bd98f918400e2c7a692a8db0 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 11:49:55 +0200
|
||||
Subject: [PATCH 02/53] 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/meson/Kconfig | 10 ++
|
||||
sound/soc/meson/Makefile | 4 +
|
||||
sound/soc/meson/audio-core.c | 190 +++++++++++++++++++++++++++++++++++
|
||||
sound/soc/meson/audio-core.h | 28 ++++++
|
||||
4 files changed, 232 insertions(+)
|
||||
create mode 100644 sound/soc/meson/audio-core.c
|
||||
create mode 100644 sound/soc/meson/audio-core.h
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index 8af8bc358a90..ed432d488b74 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -63,3 +63,13 @@ config SND_MESON_AXG_SPDIFOUT
|
||||
in the Amlogic AXG SoC family
|
||||
|
||||
endmenu
|
||||
+
|
||||
+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
|
||||
index c5e003b093db..768d7c414649 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -19,3 +19,7 @@ obj-$(CONFIG_SND_MESON_AXG_TDMIN) += snd-soc-meson-axg-tdmin.o
|
||||
obj-$(CONFIG_SND_MESON_AXG_TDMOUT) += snd-soc-meson-axg-tdmout.o
|
||||
obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o
|
||||
obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o
|
||||
+
|
||||
+snd-soc-meson-audio-core-objs := audio-core.o
|
||||
+
|
||||
+obj-$(CONFIG_SND_SOC_MESON) += snd-soc-meson-audio-core.o
|
||||
\ No newline at end of file
|
||||
diff --git a/sound/soc/meson/audio-core.c b/sound/soc/meson/audio-core.c
|
||||
new file mode 100644
|
||||
index 000000000000..99993ec4a5cc
|
||||
--- /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 000000000000..6e7a24cdc4a9
|
||||
--- /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_ */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
From c669757a7564c19d042bc5ac18199bb6f3f4e928 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Fri, 27 Sep 2019 15:16:38 +0200
|
||||
Subject: [PATCH 1/1] dwc3: add parkmode_disable_ss_quirk for G12A
|
||||
|
||||
Could you validate this fixes the following issue ?
|
||||
[ 221.141621] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
|
||||
[ 221.157631] xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
|
||||
[ 221.157635] xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead
|
||||
[ 221.159901] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
|
||||
[ 221.159961] hub 2-1.1:1.0: hub_ext_port_status failed (err = -22)
|
||||
[ 221.160076] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
|
||||
[ 221.165946] usb 2-1.1-port1: cannot reset (err = -22)
|
||||
|
||||
Cc: Tim <elatllat@gmail.com>
|
||||
CC: Dongjin Kim <tobetter@gmail.com>
|
||||
Cc: Jianxin Pan <jianxin.pan@amlogic.com>
|
||||
CC: linux-amlogic@lists.infradead.org
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
|
||||
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 +
|
||||
drivers/usb/dwc3/core.c | 5 +++++
|
||||
drivers/usb/dwc3/core.h | 4 ++++
|
||||
4 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
|
||||
index 66780a47ad85..c977a3ba2f35 100644
|
||||
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
|
||||
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
|
||||
@@ -75,6 +75,8 @@ Optional properties:
|
||||
from P0 to P1/P2/P3 without delay.
|
||||
- snps,dis-tx-ipgap-linecheck-quirk: when set, disable u2mac linestate check
|
||||
during HS transmit.
|
||||
+ - snps,parkmode-disable-ss-quirk: when set, all SuperSpeed bus instances in
|
||||
+ park mode are disabled.
|
||||
- snps,dis_metastability_quirk: when set, disable metastability workaround.
|
||||
CAUTION: use only if you are absolutely sure of it.
|
||||
- snps,is-utmi-l1-suspend: true when DWC3 asserts output signal
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 852cf9cf121b..139f24975c0e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -2401,6 +2401,7 @@
|
||||
dr_mode = "host";
|
||||
snps,dis_u2_susphy_quirk;
|
||||
snps,quirk-frame-length-adjustment;
|
||||
+ snps,parkmode-disable-ss-quirk;
|
||||
};
|
||||
};
|
||||
|
||||
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
|
||||
index c9bb93a2c81e..f64dba17a50d 100644
|
||||
--- a/drivers/usb/dwc3/core.c
|
||||
+++ b/drivers/usb/dwc3/core.c
|
||||
@@ -983,6 +983,9 @@ static int dwc3_core_init(struct dwc3 *dwc)
|
||||
if (dwc->dis_tx_ipgap_linecheck_quirk)
|
||||
reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS;
|
||||
|
||||
+ if (dwc->parkmode_disable_ss_quirk)
|
||||
+ reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS;
|
||||
+
|
||||
dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
|
||||
}
|
||||
|
||||
@@ -1294,6 +1297,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
|
||||
"snps,dis-del-phy-power-chg-quirk");
|
||||
dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev,
|
||||
"snps,dis-tx-ipgap-linecheck-quirk");
|
||||
+ dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev,
|
||||
+ "snps,parkmode-disable-ss-quirk");
|
||||
|
||||
dwc->tx_de_emphasis_quirk = device_property_read_bool(dev,
|
||||
"snps,tx_de_emphasis_quirk");
|
||||
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
|
||||
index 3dd783b889cb..ab071163b3b8 100644
|
||||
--- a/drivers/usb/dwc3/core.h
|
||||
+++ b/drivers/usb/dwc3/core.h
|
||||
@@ -249,6 +249,7 @@
|
||||
#define DWC3_GUCTL_HSTINAUTORETRY BIT(14)
|
||||
|
||||
/* Global User Control 1 Register */
|
||||
+#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17)
|
||||
#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28)
|
||||
#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)
|
||||
|
||||
@@ -1022,6 +1023,8 @@ struct dwc3_scratchpad_array {
|
||||
* change quirk.
|
||||
* @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate
|
||||
* check during HS transmit.
|
||||
+ * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed
|
||||
+ * instances in park mode.
|
||||
* @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
|
||||
* @tx_de_emphasis: Tx de-emphasis value
|
||||
* 0 - -6dB de-emphasis
|
||||
@@ -1211,6 +1214,7 @@ struct dwc3 {
|
||||
unsigned dis_u2_freeclk_exists_quirk:1;
|
||||
unsigned dis_del_phy_power_chg_quirk:1;
|
||||
unsigned dis_tx_ipgap_linecheck_quirk:1;
|
||||
+ unsigned parkmode_disable_ss_quirk:1;
|
||||
|
||||
unsigned tx_de_emphasis_quirk:1;
|
||||
unsigned tx_de_emphasis:2;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,360 +0,0 @@
|
||||
From 0b2aabc632854e317544bb293cbc0c63e120ddfa Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 12:00:10 +0200
|
||||
Subject: [PATCH 03/53] 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 000000000000..67391e64fe1c
|
||||
--- /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 000000000000..f224610e80e7
|
||||
--- /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_ */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,424 +0,0 @@
|
||||
From 61d387ffa57865531ead1a33d63b1d53a99e808b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 12:14:40 +0200
|
||||
Subject: [PATCH 04/53] 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 | 4 +-
|
||||
sound/soc/meson/aiu-i2s-dma.c | 370 ++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 380 insertions(+), 1 deletion(-)
|
||||
create mode 100644 sound/soc/meson/aiu-i2s-dma.c
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index ed432d488b74..6e030b5c7804 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -73,3 +73,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 768d7c414649..57960077aab2 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -21,5 +21,7 @@ obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o
|
||||
obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o
|
||||
|
||||
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
|
||||
\ No newline at end of file
|
||||
+obj-$(CONFIG_SND_SOC_MESON) += snd-soc-meson-audio-core.o
|
||||
+obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-aiu-i2s-dma.o
|
||||
\ No newline at end of file
|
||||
diff --git a/sound/soc/meson/aiu-i2s-dma.c b/sound/soc/meson/aiu-i2s-dma.c
|
||||
new file mode 100644
|
||||
index 000000000000..2684bd0db19e
|
||||
--- /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");
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 409a0daa72f6fc1652e17cfea7ea1055e9c483c9 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 21 Oct 2019 16:29:02 +0200
|
||||
Subject: [PATCH] arm64: dts: meson-g12b-odroid-n2: add missing amlogic, s922x
|
||||
compatible
|
||||
|
||||
This fixes the following DT schemas check errors:
|
||||
meson-g12b-odroid-n2.dt.yaml: /: compatible: ['hardkernel,odroid-n2', 'amlogic,g12b'] is not valid under any of the given schemas
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
index 42f15405750cd..0e54c1dc2842b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
|
||||
|
||||
/ {
|
||||
- compatible = "hardkernel,odroid-n2", "amlogic,g12b";
|
||||
+ compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
|
||||
model = "Hardkernel ODROID-N2";
|
||||
|
||||
aliases {
|
||||
@@ -1,518 +0,0 @@
|
||||
From 91eb80de0a4425e8856484d6480b2e347ccfa83d Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 12:17:27 +0200
|
||||
Subject: [PATCH 05/53] ASoC: meson: add initial i2s dai support
|
||||
|
||||
Add support for the i2s dai found on Amlogic Meson SoC family.
|
||||
With this initial implementation, only playback is supported.
|
||||
Capture will be part of furture work.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/Kconfig | 2 +-
|
||||
sound/soc/meson/Makefile | 4 +-
|
||||
sound/soc/meson/i2s-dai.c | 465 ++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 469 insertions(+), 2 deletions(-)
|
||||
create mode 100644 sound/soc/meson/i2s-dai.c
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index 6e030b5c7804..5904e9e50569 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -78,5 +78,5 @@ 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
|
||||
+ Say Y or M if you want to add support for i2s driver for Amlogic
|
||||
Meson SoCs.
|
||||
diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile
|
||||
index 57960077aab2..b8641f9f7fc1 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -22,6 +22,8 @@ obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o
|
||||
|
||||
snd-soc-meson-audio-core-objs := audio-core.o
|
||||
snd-soc-meson-aiu-i2s-dma-objs := aiu-i2s-dma.o
|
||||
+snd-soc-meson-i2s-dai-objs := i2s-dai.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
|
||||
\ No newline at end of file
|
||||
+obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-aiu-i2s-dma.o
|
||||
+obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-i2s-dai.o
|
||||
\ No newline at end of file
|
||||
diff --git a/sound/soc/meson/i2s-dai.c b/sound/soc/meson/i2s-dai.c
|
||||
new file mode 100644
|
||||
index 000000000000..1008af8d3972
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/i2s-dai.c
|
||||
@@ -0,0 +1,465 @@
|
||||
+/*
|
||||
+ * 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 <sound/soc-dai.h>
|
||||
+
|
||||
+#include "aiu-regs.h"
|
||||
+#include "audio-core.h"
|
||||
+
|
||||
+#define DRV_NAME "meson-i2s-dai"
|
||||
+
|
||||
+struct meson_i2s_dai {
|
||||
+ struct meson_audio_core_data *core;
|
||||
+ struct clk *mclk;
|
||||
+ struct clk *bclks;
|
||||
+ struct clk *iface;
|
||||
+ struct clk *fast;
|
||||
+ bool bclks_idle;
|
||||
+};
|
||||
+
|
||||
+#define AIU_CLK_CTRL_I2S_DIV_EN BIT(0)
|
||||
+#define AIU_CLK_CTRL_I2S_DIV_MASK GENMASK(3, 2)
|
||||
+#define AIU_CLK_CTRL_AOCLK_POLARITY_MASK BIT(6)
|
||||
+#define AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL (0 << 6)
|
||||
+#define AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED (1 << 6)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_POLARITY_MASK BIT(7)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL (0 << 7)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED (1 << 7)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_SKEW_MASK GENMASK(9, 8)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_LEFT_J (0 << 8)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_I2S (1 << 8)
|
||||
+#define AIU_CLK_CTRL_ALRCLK_RIGHT_J (2 << 8)
|
||||
+#define AIU_CLK_CTRL_MORE_I2S_DIV_MASK GENMASK(5, 0)
|
||||
+#define AIU_CLK_CTRL_MORE_I2S_DIV(div) (((div) - 1) << 0)
|
||||
+#define AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK GENMASK(11, 0)
|
||||
+#define AIU_CODEC_DAC_LRCLK_CTRL_DIV(div) (((div) - 1) << 0)
|
||||
+#define AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK GENMASK(1, 0)
|
||||
+#define AIU_I2S_DAC_CFG_AOCLK_32 (0 << 0)
|
||||
+#define AIU_I2S_DAC_CFG_AOCLK_48 (2 << 0)
|
||||
+#define AIU_I2S_DAC_CFG_AOCLK_64 (3 << 0)
|
||||
+#define AIU_I2S_MISC_HOLD_EN BIT(2)
|
||||
+#define AIU_I2S_SOURCE_DESC_MODE_8CH BIT(0)
|
||||
+#define AIU_I2S_SOURCE_DESC_MODE_24BIT BIT(5)
|
||||
+#define AIU_I2S_SOURCE_DESC_MODE_32BIT BIT(9)
|
||||
+#define AIU_I2S_SOURCE_DESC_MODE_SPLIT BIT(11)
|
||||
+
|
||||
+static void __hold(struct meson_i2s_dai *priv, bool enable)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_I2S_MISC,
|
||||
+ AIU_I2S_MISC_HOLD_EN,
|
||||
+ enable ? AIU_I2S_MISC_HOLD_EN : 0);
|
||||
+}
|
||||
+
|
||||
+static void __divider_enable(struct meson_i2s_dai *priv, bool enable)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_I2S_DIV_EN,
|
||||
+ enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0);
|
||||
+}
|
||||
+
|
||||
+static void __playback_start(struct meson_i2s_dai *priv)
|
||||
+{
|
||||
+ __divider_enable(priv, true);
|
||||
+ __hold(priv, false);
|
||||
+}
|
||||
+
|
||||
+static void __playback_stop(struct meson_i2s_dai *priv, bool clk_force)
|
||||
+{
|
||||
+ __hold(priv, true);
|
||||
+ /* Disable the bit clks if necessary */
|
||||
+ if (clk_force || !priv->bclks_idle)
|
||||
+ __divider_enable(priv, false);
|
||||
+}
|
||||
+
|
||||
+static int meson_i2s_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ bool clk_force_stop = false;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case SNDRV_PCM_TRIGGER_START:
|
||||
+ case SNDRV_PCM_TRIGGER_RESUME:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
+ __playback_start(priv);
|
||||
+ return 0;
|
||||
+
|
||||
+ case SNDRV_PCM_TRIGGER_STOP:
|
||||
+ case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
+ clk_force_stop = true;
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
+ __playback_stop(priv, clk_force_stop);
|
||||
+ return 0;
|
||||
+
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int __bclks_set_rate(struct meson_i2s_dai *priv, unsigned int srate,
|
||||
+ unsigned int width)
|
||||
+{
|
||||
+ unsigned int fs;
|
||||
+
|
||||
+ /* Get the oversampling factor */
|
||||
+ fs = DIV_ROUND_CLOSEST(clk_get_rate(priv->mclk), srate);
|
||||
+
|
||||
+ /*
|
||||
+ * This DAI is usually connected to the dw-hdmi which does not support
|
||||
+ * bclk being 32 * lrclk or 48 * lrclk
|
||||
+ * Restrict to blck = 64 * lrclk
|
||||
+ */
|
||||
+ if (fs % 64)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Set the divider between lrclk and bclk */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_I2S_DAC_CFG,
|
||||
+ AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK,
|
||||
+ AIU_I2S_DAC_CFG_AOCLK_64);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CODEC_DAC_LRCLK_CTRL,
|
||||
+ AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK,
|
||||
+ AIU_CODEC_DAC_LRCLK_CTRL_DIV(64));
|
||||
+
|
||||
+ /* Use CLK_MORE for the i2s divider */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_I2S_DIV_MASK,
|
||||
+ 0);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL_MORE,
|
||||
+ AIU_CLK_CTRL_MORE_I2S_DIV_MASK,
|
||||
+ AIU_CLK_CTRL_MORE_I2S_DIV(fs / 64));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __setup_desc(struct meson_i2s_dai *priv, unsigned int width,
|
||||
+ unsigned int channels)
|
||||
+{
|
||||
+ u32 desc = 0;
|
||||
+
|
||||
+ switch (width) {
|
||||
+ case 24:
|
||||
+ /*
|
||||
+ * For some reason, 24 bits wide audio don't play well
|
||||
+ * if the 32 bits mode is not set
|
||||
+ */
|
||||
+ desc |= (AIU_I2S_SOURCE_DESC_MODE_24BIT |
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_32BIT);
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ switch (channels) {
|
||||
+ case 2: /* Nothing to do */
|
||||
+ break;
|
||||
+ case 8:
|
||||
+ /* TODO: Still requires testing ... */
|
||||
+ desc |= AIU_I2S_SOURCE_DESC_MODE_8CH;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_I2S_SOURCE_DESC,
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_8CH |
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_24BIT |
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_32BIT,
|
||||
+ desc);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_i2s_dai_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ unsigned int width = params_width(params);
|
||||
+ unsigned int channels = params_channels(params);
|
||||
+ unsigned int rate = params_rate(params);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = __setup_desc(priv, width, channels);
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Unable set to set i2s description\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = __bclks_set_rate(priv, rate, width);
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Unable set to the i2s clock rates\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_i2s_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ u32 val;
|
||||
+
|
||||
+ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* DAI output mode */
|
||||
+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
+ case SND_SOC_DAIFMT_I2S:
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_I2S;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_LEFT_J:
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_LEFT_J;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_RIGHT_J:
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_RIGHT_J;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_ALRCLK_SKEW_MASK,
|
||||
+ val);
|
||||
+
|
||||
+ /* DAI clock polarity */
|
||||
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
|
||||
+ case SND_SOC_DAIFMT_IB_IF:
|
||||
+ /* Invert both clocks */
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED |
|
||||
+ AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_IB_NF:
|
||||
+ /* Invert bit clock */
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL |
|
||||
+ AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_NB_IF:
|
||||
+ /* Invert frame clock */
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED |
|
||||
+ AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_NB_NF:
|
||||
+ /* Normal clocks */
|
||||
+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL |
|
||||
+ AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_ALRCLK_POLARITY_MASK |
|
||||
+ AIU_CLK_CTRL_AOCLK_POLARITY_MASK,
|
||||
+ val);
|
||||
+
|
||||
+ switch (fmt & SND_SOC_DAIFMT_CLOCK_MASK) {
|
||||
+ case SND_SOC_DAIFMT_CONT:
|
||||
+ priv->bclks_idle = true;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_GATED:
|
||||
+ priv->bclks_idle = false;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_i2s_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
|
||||
+ unsigned int freq, int dir)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ int ret;
|
||||
+
|
||||
+ if (WARN_ON(clk_id != 0))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (dir == SND_SOC_CLOCK_IN)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = clk_set_rate(priv->mclk, freq);
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Failed to set sysclk to %uHz", freq);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_i2s_dai_startup(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Power up the i2s fast domain - can't write the registers w/o it */
|
||||
+ ret = clk_prepare_enable(priv->fast);
|
||||
+ if (ret)
|
||||
+ goto out_clk_fast;
|
||||
+
|
||||
+ /* Make sure nothing gets out of the DAI yet */
|
||||
+ __hold(priv, true);
|
||||
+
|
||||
+ /* I2S encoder needs the mixer interface gate */
|
||||
+ ret = clk_prepare_enable(priv->iface);
|
||||
+ if (ret)
|
||||
+ goto out_clk_iface;
|
||||
+
|
||||
+ /* Enable the i2s master clock */
|
||||
+ ret = clk_prepare_enable(priv->mclk);
|
||||
+ if (ret)
|
||||
+ goto out_mclk;
|
||||
+
|
||||
+ /* Enable the bit clock gate */
|
||||
+ ret = clk_prepare_enable(priv->bclks);
|
||||
+ if (ret)
|
||||
+ goto out_bclks;
|
||||
+
|
||||
+ /* Make sure the interface expect a memory layout we can work with */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_I2S_SOURCE_DESC,
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_SPLIT,
|
||||
+ AIU_I2S_SOURCE_DESC_MODE_SPLIT);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+out_bclks:
|
||||
+ clk_disable_unprepare(priv->mclk);
|
||||
+out_mclk:
|
||||
+ clk_disable_unprepare(priv->iface);
|
||||
+out_clk_iface:
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+out_clk_fast:
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void meson_i2s_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+
|
||||
+ clk_disable_unprepare(priv->bclks);
|
||||
+ clk_disable_unprepare(priv->mclk);
|
||||
+ clk_disable_unprepare(priv->iface);
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+}
|
||||
+
|
||||
+static const struct snd_soc_dai_ops meson_i2s_dai_ops = {
|
||||
+ .startup = meson_i2s_dai_startup,
|
||||
+ .shutdown = meson_i2s_dai_shutdown,
|
||||
+ .trigger = meson_i2s_dai_trigger,
|
||||
+ .hw_params = meson_i2s_dai_hw_params,
|
||||
+ .set_fmt = meson_i2s_dai_set_fmt,
|
||||
+ .set_sysclk = meson_i2s_dai_set_sysclk,
|
||||
+};
|
||||
+
|
||||
+static struct snd_soc_dai_driver meson_i2s_dai = {
|
||||
+ .playback = {
|
||||
+ .stream_name = "Playback",
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 8,
|
||||
+ .rates = SNDRV_PCM_RATE_8000_192000,
|
||||
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S24_LE)
|
||||
+ },
|
||||
+ .ops = &meson_i2s_dai_ops,
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_component_driver meson_i2s_dai_component = {
|
||||
+ .name = DRV_NAME,
|
||||
+};
|
||||
+
|
||||
+static int meson_i2s_dai_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct meson_i2s_dai *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 the i2s fast domain clock\n");
|
||||
+ return PTR_ERR(priv->fast);
|
||||
+ }
|
||||
+
|
||||
+ priv->iface = devm_clk_get(dev, "iface");
|
||||
+ if (IS_ERR(priv->iface)) {
|
||||
+ if (PTR_ERR(priv->iface) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get i2s dai clock gate\n");
|
||||
+ return PTR_ERR(priv->iface);
|
||||
+ }
|
||||
+
|
||||
+ priv->bclks = devm_clk_get(dev, "bclks");
|
||||
+ if (IS_ERR(priv->bclks)) {
|
||||
+ if (PTR_ERR(priv->bclks) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get bit clocks gate\n");
|
||||
+ return PTR_ERR(priv->bclks);
|
||||
+ }
|
||||
+
|
||||
+ priv->mclk = devm_clk_get(dev, "mclk");
|
||||
+ if (IS_ERR(priv->mclk)) {
|
||||
+ if (PTR_ERR(priv->mclk) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "failed to get the i2s master clock\n");
|
||||
+ return PTR_ERR(priv->mclk);
|
||||
+ }
|
||||
+
|
||||
+ return devm_snd_soc_register_component(dev, &meson_i2s_dai_component,
|
||||
+ &meson_i2s_dai, 1);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id meson_i2s_dai_of_match[] = {
|
||||
+ { .compatible = "amlogic,meson-i2s-dai", },
|
||||
+ { .compatible = "amlogic,meson-gxbb-i2s-dai", },
|
||||
+ { .compatible = "amlogic,meson-gxl-i2s-dai", },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, meson_i2s_dai_of_match);
|
||||
+
|
||||
+static struct platform_driver meson_i2s_dai_pdrv = {
|
||||
+ .probe = meson_i2s_dai_probe,
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .of_match_table = meson_i2s_dai_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(meson_i2s_dai_pdrv);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Meson i2s DAI ASoC Driver");
|
||||
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
From d80b817e975c0911f130d502292b209f34ea1e2c Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Tue, 27 Aug 2019 12:03:07 +0200
|
||||
Subject: [PATCH 171/200] FROMLIST: arm64: dts: meson-g12b: specify suspend OPP
|
||||
|
||||
Tag the 1,2GHz OPPs as suspend OPP to be set before going in suspend mode.
|
||||
|
||||
It has been reported that using various OPPs can lead to error or
|
||||
resume with a different OPP from the ROM, thus use this safe OPP as
|
||||
it is the default OPP used by the BL2 boot firmware on the 2 clusters.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 2 ++
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
index d61f43052a34..00ea181bc018 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
@@ -39,6 +39,7 @@
|
||||
opp-1200000000 {
|
||||
opp-hz = /bits/ 64 <1200000000>;
|
||||
opp-microvolt = <781000>;
|
||||
+ opp-suspend;
|
||||
};
|
||||
|
||||
opp-1398000000 {
|
||||
@@ -99,6 +100,7 @@
|
||||
opp-1200000000 {
|
||||
opp-hz = /bits/ 64 <1200000000>;
|
||||
opp-microvolt = <751000>;
|
||||
+ opp-suspend;
|
||||
};
|
||||
|
||||
opp-1398000000 {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
|
||||
index 046cc332d07f..d68323c6c780 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
|
||||
@@ -39,6 +39,7 @@
|
||||
opp-1200000000 {
|
||||
opp-hz = /bits/ 64 <1200000000>;
|
||||
opp-microvolt = <731000>;
|
||||
+ opp-suspend;
|
||||
};
|
||||
|
||||
opp-1398000000 {
|
||||
@@ -99,6 +100,7 @@
|
||||
opp-1200000000 {
|
||||
opp-hz = /bits/ 64 <1200000000>;
|
||||
opp-microvolt = <771000>;
|
||||
+ opp-suspend;
|
||||
};
|
||||
|
||||
opp-1398000000 {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,445 +0,0 @@
|
||||
From 99e6d5ba97d0615428f88850ee8366a9dc24168e Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 13:43:52 +0200
|
||||
Subject: [PATCH 06/53] ASoC: meson: add aiu spdif dma support
|
||||
|
||||
Add support for the spdif 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 | 4 +-
|
||||
sound/soc/meson/aiu-spdif-dma.c | 388 ++++++++++++++++++++++++++++++++
|
||||
3 files changed, 398 insertions(+), 1 deletion(-)
|
||||
create mode 100644 sound/soc/meson/aiu-spdif-dma.c
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index 5904e9e50569..712303ff8970 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -80,3 +80,10 @@ config SND_SOC_MESON_I2S
|
||||
help
|
||||
Say Y or M if you want to add support for i2s driver for Amlogic
|
||||
Meson SoCs.
|
||||
+
|
||||
+config SND_SOC_MESON_SPDIF
|
||||
+ tristate "Meson spdif interface"
|
||||
+ depends on SND_SOC_MESON
|
||||
+ help
|
||||
+ Say Y or M if you want to add support for spdif dma driver for Amlogic
|
||||
+ Meson SoCs.
|
||||
diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile
|
||||
index b8641f9f7fc1..dc5164a7e164 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -22,8 +22,10 @@ obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o
|
||||
|
||||
snd-soc-meson-audio-core-objs := audio-core.o
|
||||
snd-soc-meson-aiu-i2s-dma-objs := aiu-i2s-dma.o
|
||||
+snd-soc-meson-aiu-spdif-dma-objs := aiu-spdif-dma.o
|
||||
snd-soc-meson-i2s-dai-objs := i2s-dai.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
|
||||
-obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-i2s-dai.o
|
||||
\ No newline at end of file
|
||||
+obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-i2s-dai.o
|
||||
+obj-$(CONFIG_SND_SOC_MESON_SPDIF) += snd-soc-meson-aiu-spdif-dma.o
|
||||
\ No newline at end of file
|
||||
diff --git a/sound/soc/meson/aiu-spdif-dma.c b/sound/soc/meson/aiu-spdif-dma.c
|
||||
new file mode 100644
|
||||
index 000000000000..81c3b856fbf9
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/aiu-spdif-dma.c
|
||||
@@ -0,0 +1,388 @@
|
||||
+/*
|
||||
+ * 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-spdif-dma"
|
||||
+
|
||||
+struct aiu_spdif_dma {
|
||||
+ struct meson_audio_core_data *core;
|
||||
+ struct clk *fast;
|
||||
+ int irq;
|
||||
+};
|
||||
+
|
||||
+#define AIU_958_DCU_FF_CTRL_EN BIT(0)
|
||||
+#define AIU_958_DCU_FF_CTRL_AUTO_DISABLE BIT(1)
|
||||
+#define AIU_958_DCU_FF_CTRL_IRQ_MODE_MASK GENMASK(3, 2)
|
||||
+#define AIU_958_DCU_FF_CTRL_IRQ_OUT_THD BIT(2)
|
||||
+#define AIU_958_DCU_FF_CTRL_IRQ_FRAME_READ BIT(3)
|
||||
+#define AIU_958_DCU_FF_CTRL_SYNC_HEAD_EN BIT(4)
|
||||
+#define AIU_958_DCU_FF_CTRL_BYTE_SEEK BIT(5)
|
||||
+#define AIU_958_DCU_FF_CTRL_CONTINUE BIT(6)
|
||||
+#define AIU_MEM_IEC958_BUF_CNTL_INIT BIT(0)
|
||||
+#define AIU_MEM_IEC958_CONTROL_INIT BIT(0)
|
||||
+#define AIU_MEM_IEC958_CONTROL_FILL_EN BIT(1)
|
||||
+#define AIU_MEM_IEC958_CONTROL_EMPTY_EN BIT(2)
|
||||
+#define AIU_MEM_IEC958_CONTROL_ENDIAN_MASK GENMASK(5, 3)
|
||||
+#define AIU_MEM_IEC958_CONTROL_RD_DDR BIT(6)
|
||||
+#define AIU_MEM_IEC958_CONTROL_MODE_16BIT BIT(7)
|
||||
+#define AIU_MEM_IEC958_MASKS_CH_MEM_MASK GENMASK(15, 8)
|
||||
+#define AIU_MEM_IEC958_MASKS_CH_MEM(ch) ((ch) << 8)
|
||||
+#define AIU_MEM_IEC958_MASKS_CH_RD_MASK GENMASK(7, 0)
|
||||
+#define AIU_MEM_IEC958_MASKS_CH_RD(ch) ((ch) << 0)
|
||||
+
|
||||
+#define AIU_SPDIF_DMA_BURST 8
|
||||
+#define AIU_SPDIF_BPF_MAX USHRT_MAX
|
||||
+
|
||||
+static struct snd_pcm_hardware aiu_spdif_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),
|
||||
+
|
||||
+ .rates = (SNDRV_PCM_RATE_32000 |
|
||||
+ SNDRV_PCM_RATE_44100 |
|
||||
+ SNDRV_PCM_RATE_48000 |
|
||||
+ SNDRV_PCM_RATE_96000 |
|
||||
+ SNDRV_PCM_RATE_192000),
|
||||
+ /*
|
||||
+ * TODO: The DMA can change the endianness, the msb position
|
||||
+ * and deal with unsigned - support this later on
|
||||
+ */
|
||||
+
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 2,
|
||||
+ .period_bytes_min = AIU_SPDIF_DMA_BURST,
|
||||
+ .period_bytes_max = AIU_SPDIF_BPF_MAX,
|
||||
+ .periods_min = 2,
|
||||
+ .periods_max = UINT_MAX,
|
||||
+ .buffer_bytes_max = 1 * 1024 * 1024,
|
||||
+ .fifo_size = 0,
|
||||
+};
|
||||
+
|
||||
+static struct aiu_spdif_dma *aiu_spdif_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_spdif_dma_pointer(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+ unsigned int addr;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = regmap_read(priv->core->aiu, AIU_MEM_IEC958_RD_PTR,
|
||||
+ &addr);
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr);
|
||||
+}
|
||||
+
|
||||
+static void __dma_enable(struct aiu_spdif_dma *priv, bool enable)
|
||||
+{
|
||||
+ unsigned int en_mask = (AIU_MEM_IEC958_CONTROL_FILL_EN |
|
||||
+ AIU_MEM_IEC958_CONTROL_EMPTY_EN);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, en_mask,
|
||||
+ enable ? en_mask : 0);
|
||||
+}
|
||||
+
|
||||
+static void __dcu_fifo_enable(struct aiu_spdif_dma *priv, bool enable)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_958_DCU_FF_CTRL,
|
||||
+ AIU_958_DCU_FF_CTRL_EN,
|
||||
+ enable ? AIU_958_DCU_FF_CTRL_EN : 0);
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
+{
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case SNDRV_PCM_TRIGGER_START:
|
||||
+ case SNDRV_PCM_TRIGGER_RESUME:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
+ __dcu_fifo_enable(priv, true);
|
||||
+ __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);
|
||||
+ __dcu_fifo_enable(priv, false);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __dma_init_mem(struct aiu_spdif_dma *priv)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL,
|
||||
+ AIU_MEM_IEC958_CONTROL_INIT,
|
||||
+ AIU_MEM_IEC958_CONTROL_INIT);
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_BUF_CNTL,
|
||||
+ AIU_MEM_IEC958_BUF_CNTL_INIT,
|
||||
+ AIU_MEM_IEC958_BUF_CNTL_INIT);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL,
|
||||
+ AIU_MEM_IEC958_CONTROL_INIT,
|
||||
+ 0);
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_BUF_CNTL,
|
||||
+ AIU_MEM_IEC958_BUF_CNTL_INIT,
|
||||
+ 0);
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_prepare(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+
|
||||
+ __dma_init_mem(priv);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __setup_memory_layout(struct aiu_spdif_dma *priv,
|
||||
+ unsigned int width)
|
||||
+{
|
||||
+ u32 mem_ctl = AIU_MEM_IEC958_CONTROL_RD_DDR;
|
||||
+
|
||||
+ if (width == 16)
|
||||
+ mem_ctl |= AIU_MEM_IEC958_CONTROL_MODE_16BIT;
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL,
|
||||
+ AIU_MEM_IEC958_CONTROL_ENDIAN_MASK |
|
||||
+ AIU_MEM_IEC958_CONTROL_MODE_16BIT |
|
||||
+ AIU_MEM_IEC958_CONTROL_RD_DDR,
|
||||
+ mem_ctl);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params)
|
||||
+{
|
||||
+ struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+ int ret;
|
||||
+ dma_addr_t end_ptr;
|
||||
+
|
||||
+ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = __setup_memory_layout(priv, params_physical_width(params));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Initialize memory pointers */
|
||||
+ regmap_write(priv->core->aiu,
|
||||
+ AIU_MEM_IEC958_START_PTR, runtime->dma_addr);
|
||||
+ regmap_write(priv->core->aiu,
|
||||
+ AIU_MEM_IEC958_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_SPDIF_DMA_BURST;
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_IEC958_END_PTR, end_ptr);
|
||||
+
|
||||
+ /* Memory masks */
|
||||
+ regmap_write(priv->core->aiu, AIU_MEM_IEC958_MASKS,
|
||||
+ AIU_MEM_IEC958_MASKS_CH_RD(0xff) |
|
||||
+ AIU_MEM_IEC958_MASKS_CH_MEM(0xff));
|
||||
+
|
||||
+ /* Setup the number bytes read by the FIFO between each IRQ */
|
||||
+ regmap_write(priv->core->aiu, AIU_958_BPF, params_period_bytes(params));
|
||||
+
|
||||
+ /*
|
||||
+ * AUTO_DISABLE and SYNC_HEAD are enabled by default but
|
||||
+ * this should be disabled in PCM (uncompressed) mode
|
||||
+ */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_958_DCU_FF_CTRL,
|
||||
+ AIU_958_DCU_FF_CTRL_AUTO_DISABLE |
|
||||
+ AIU_958_DCU_FF_CTRL_IRQ_MODE_MASK |
|
||||
+ AIU_958_DCU_FF_CTRL_SYNC_HEAD_EN,
|
||||
+ AIU_958_DCU_FF_CTRL_IRQ_FRAME_READ);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_hw_free(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ return snd_pcm_lib_free_pages(substream);
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t aiu_spdif_dma_irq(int irq, void *dev_id)
|
||||
+{
|
||||
+ struct snd_pcm_substream *playback = dev_id;
|
||||
+
|
||||
+ snd_pcm_period_elapsed(playback);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_open(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+ int ret;
|
||||
+
|
||||
+ snd_soc_set_runtime_hwparams(substream, &aiu_spdif_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_SPDIF_DMA_BURST);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
|
||||
+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
+ AIU_SPDIF_DMA_BURST);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Request the SPDIF DDR irq */
|
||||
+ ret = request_irq(priv->irq, aiu_spdif_dma_irq, 0,
|
||||
+ DRV_NAME, substream);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Power up the spdif fast domain - can't write the register w/o it */
|
||||
+ ret = clk_prepare_enable(priv->fast);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Make sure the dma is initially halted */
|
||||
+ __dma_enable(priv, false);
|
||||
+ __dcu_fifo_enable(priv, false);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int aiu_spdif_dma_close(struct snd_pcm_substream *substream)
|
||||
+{
|
||||
+ struct aiu_spdif_dma *priv = aiu_spdif_dma_priv(substream);
|
||||
+
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+ free_irq(priv->irq, substream);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct snd_pcm_ops aiu_spdif_dma_ops = {
|
||||
+ .open = aiu_spdif_dma_open,
|
||||
+ .close = aiu_spdif_dma_close,
|
||||
+ .ioctl = snd_pcm_lib_ioctl,
|
||||
+ .hw_params = aiu_spdif_dma_hw_params,
|
||||
+ .hw_free = aiu_spdif_dma_hw_free,
|
||||
+ .prepare = aiu_spdif_dma_prepare,
|
||||
+ .pointer = aiu_spdif_dma_pointer,
|
||||
+ .trigger = aiu_spdif_dma_trigger,
|
||||
+};
|
||||
+
|
||||
+static int aiu_spdif_dma_new(struct snd_soc_pcm_runtime *rtd)
|
||||
+{
|
||||
+ struct snd_card *card = rtd->card->snd_card;
|
||||
+ size_t size = aiu_spdif_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_spdif_platform = {
|
||||
+ .ops = &aiu_spdif_dma_ops,
|
||||
+ .pcm_new = aiu_spdif_dma_new,
|
||||
+ .name = DRV_NAME,
|
||||
+};
|
||||
+
|
||||
+static int aiu_spdif_dma_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct aiu_spdif_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 spdif 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 spdif ddr irq\n");
|
||||
+ return priv->irq;
|
||||
+ }
|
||||
+
|
||||
+ return devm_snd_soc_register_component(dev, &aiu_spdif_platform,
|
||||
+ NULL, 0);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id aiu_spdif_dma_of_match[] = {
|
||||
+ { .compatible = "amlogic,meson-aiu-spdif-dma", },
|
||||
+ { .compatible = "amlogic,meson-gxbb-aiu-spdif-dma", },
|
||||
+ { .compatible = "amlogic,meson-gxl-aiu-spdif-dma", },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, aiu_spdif_dma_of_match);
|
||||
+
|
||||
+static struct platform_driver aiu_spdif_dma_pdrv = {
|
||||
+ .probe = aiu_spdif_dma_probe,
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .of_match_table = aiu_spdif_dma_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(aiu_spdif_dma_pdrv);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Meson AIU spdif DMA ASoC Driver");
|
||||
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
From 9ed437d69b49bd9ad39db7b6d69b60dfc47cac69 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Sep 2019 14:59:54 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12: add a g12 layer
|
||||
|
||||
While the sm1 is very close to the g12a/b family, somethings apply
|
||||
differently on the g12a/b and not the sm1. This introduce a new layer
|
||||
of dtsi for part which apply to the g12a and g12b but not the sm1.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 7 +++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 2 +-
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 2 +-
|
||||
3 files changed, 9 insertions(+), 2 deletions(-)
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..1e30061fb2a7
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -0,0 +1,7 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 BayLibre, SAS
|
||||
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
|
||||
+ */
|
||||
+
|
||||
+#include "meson-g12-common.dtsi"
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
index eb5d177d7a99..69339d69dfd4 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2018 Amlogic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
-#include "meson-g12-common.dtsi"
|
||||
+#include "meson-g12.dtsi"
|
||||
#include <dt-bindings/power/meson-g12a-power.h>
|
||||
|
||||
/ {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
index 5628ccd54531..eefac0ef092b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
@@ -4,7 +4,7 @@
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
|
||||
-#include "meson-g12-common.dtsi"
|
||||
+#include "meson-g12.dtsi"
|
||||
#include <dt-bindings/power/meson-g12a-power.h>
|
||||
|
||||
/ {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,432 +0,0 @@
|
||||
From ecabfe253aab181bdc241cc7e16e857a3574e528 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 13:46:03 +0200
|
||||
Subject: [PATCH 07/53] ASoC: meson: add initial spdif dai support
|
||||
|
||||
Add support for the spdif dai found on Amlogic Meson SoC family.
|
||||
With this initial implementation, only uncompressed pcm playback
|
||||
from the spdif dma is supported. Future work will add compressed
|
||||
support, pcm playback from i2s dma and capture.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/Kconfig | 3 +-
|
||||
sound/soc/meson/Makefile | 4 +-
|
||||
sound/soc/meson/spdif-dai.c | 374 ++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 379 insertions(+), 2 deletions(-)
|
||||
create mode 100644 sound/soc/meson/spdif-dai.c
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index 712303ff8970..bc3d6f22ed88 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -84,6 +84,7 @@ config SND_SOC_MESON_I2S
|
||||
config SND_SOC_MESON_SPDIF
|
||||
tristate "Meson spdif interface"
|
||||
depends on SND_SOC_MESON
|
||||
+ select SND_PCM_IEC958
|
||||
help
|
||||
- Say Y or M if you want to add support for spdif dma driver for Amlogic
|
||||
+ Say Y or M if you want to add support for spdif driver for Amlogic
|
||||
Meson SoCs.
|
||||
diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile
|
||||
index dc5164a7e164..44f79d8b91b7 100644
|
||||
--- a/sound/soc/meson/Makefile
|
||||
+++ b/sound/soc/meson/Makefile
|
||||
@@ -24,8 +24,10 @@ snd-soc-meson-audio-core-objs := audio-core.o
|
||||
snd-soc-meson-aiu-i2s-dma-objs := aiu-i2s-dma.o
|
||||
snd-soc-meson-aiu-spdif-dma-objs := aiu-spdif-dma.o
|
||||
snd-soc-meson-i2s-dai-objs := i2s-dai.o
|
||||
+snd-soc-meson-spdif-dai-objs := spdif-dai.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
|
||||
obj-$(CONFIG_SND_SOC_MESON_I2S) += snd-soc-meson-i2s-dai.o
|
||||
-obj-$(CONFIG_SND_SOC_MESON_SPDIF) += snd-soc-meson-aiu-spdif-dma.o
|
||||
\ No newline at end of file
|
||||
+obj-$(CONFIG_SND_SOC_MESON_SPDIF) += snd-soc-meson-aiu-spdif-dma.o
|
||||
+obj-$(CONFIG_SND_SOC_MESON_SPDIF) += snd-soc-meson-spdif-dai.o
|
||||
\ No newline at end of file
|
||||
diff --git a/sound/soc/meson/spdif-dai.c b/sound/soc/meson/spdif-dai.c
|
||||
new file mode 100644
|
||||
index 000000000000..e7630007c84b
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/meson/spdif-dai.c
|
||||
@@ -0,0 +1,374 @@
|
||||
+/*
|
||||
+ * 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 <sound/soc-dai.h>
|
||||
+#include <sound/pcm_iec958.h>
|
||||
+
|
||||
+#include "aiu-regs.h"
|
||||
+#include "audio-core.h"
|
||||
+
|
||||
+#define DRV_NAME "meson-spdif-dai"
|
||||
+
|
||||
+struct meson_spdif_dai {
|
||||
+ struct meson_audio_core_data *core;
|
||||
+ struct clk *iface;
|
||||
+ struct clk *fast;
|
||||
+ struct clk *mclk_i958;
|
||||
+ struct clk *mclk;
|
||||
+};
|
||||
+
|
||||
+#define AIU_CLK_CTRL_958_DIV_EN BIT(1)
|
||||
+#define AIU_CLK_CTRL_958_DIV_MASK GENMASK(5, 4)
|
||||
+#define AIU_CLK_CTRL_958_DIV_MORE BIT(12)
|
||||
+#define AIU_MEM_IEC958_CONTROL_MODE_LINEAR BIT(8)
|
||||
+#define AIU_958_CTRL_HOLD_EN BIT(0)
|
||||
+#define AIU_958_MISC_NON_PCM BIT(0)
|
||||
+#define AIU_958_MISC_MODE_16BITS BIT(1)
|
||||
+#define AIU_958_MISC_16BITS_ALIGN_MASK GENMASK(6, 5)
|
||||
+#define AIU_958_MISC_16BITS_ALIGN(val) ((val) << 5)
|
||||
+#define AIU_958_MISC_MODE_32BITS BIT(7)
|
||||
+#define AIU_958_MISC_32BITS_SHIFT_MASK GENMASK(10, 8)
|
||||
+#define AIU_958_MISC_32BITS_SHIFT(val) ((val) << 8)
|
||||
+#define AIU_958_MISC_U_FROM_STREAM BIT(12)
|
||||
+#define AIU_958_MISC_FORCE_LR BIT(13)
|
||||
+
|
||||
+#define AIU_CS_WORD_LEN 4
|
||||
+
|
||||
+static void __hold(struct meson_spdif_dai *priv, bool enable)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_958_CTRL,
|
||||
+ AIU_958_CTRL_HOLD_EN,
|
||||
+ enable ? AIU_958_CTRL_HOLD_EN : 0);
|
||||
+}
|
||||
+
|
||||
+static void __divider_enable(struct meson_spdif_dai *priv, bool enable)
|
||||
+{
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_958_DIV_EN,
|
||||
+ enable ? AIU_CLK_CTRL_958_DIV_EN : 0);
|
||||
+}
|
||||
+
|
||||
+static void __playback_start(struct meson_spdif_dai *priv)
|
||||
+{
|
||||
+ __divider_enable(priv, true);
|
||||
+ __hold(priv, false);
|
||||
+}
|
||||
+
|
||||
+static void __playback_stop(struct meson_spdif_dai *priv)
|
||||
+{
|
||||
+ __hold(priv, true);
|
||||
+ __divider_enable(priv, false);
|
||||
+}
|
||||
+
|
||||
+static int meson_spdif_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_spdif_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case SNDRV_PCM_TRIGGER_START:
|
||||
+ case SNDRV_PCM_TRIGGER_RESUME:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
+ __playback_start(priv);
|
||||
+ return 0;
|
||||
+
|
||||
+ case SNDRV_PCM_TRIGGER_STOP:
|
||||
+ case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
+ __playback_stop(priv);
|
||||
+ return 0;
|
||||
+
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int __setup_spdif_clk(struct meson_spdif_dai *priv, unsigned int rate)
|
||||
+{
|
||||
+ unsigned int mrate;
|
||||
+
|
||||
+ /* Leave the internal divisor alone */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL,
|
||||
+ AIU_CLK_CTRL_958_DIV_MASK |
|
||||
+ AIU_CLK_CTRL_958_DIV_MORE,
|
||||
+ 0);
|
||||
+
|
||||
+ /* 2 * 32bits per subframe * 2 channels = 128 */
|
||||
+ mrate = rate * 128;
|
||||
+ return clk_set_rate(priv->mclk, mrate);
|
||||
+}
|
||||
+
|
||||
+static int __setup_cs_word(struct meson_spdif_dai *priv,
|
||||
+ struct snd_pcm_hw_params *params)
|
||||
+{
|
||||
+ u8 cs[AIU_CS_WORD_LEN];
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = snd_pcm_create_iec958_consumer_hw_params(params, cs,
|
||||
+ AIU_CS_WORD_LEN);
|
||||
+ if (ret < 0)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Write the 1st half word */
|
||||
+ val = cs[1] | cs[0] << 8;
|
||||
+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_L0, val);
|
||||
+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_R0, val);
|
||||
+
|
||||
+ /* Write the 2nd half word */
|
||||
+ val = cs[3] | cs[2] << 8;
|
||||
+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_L1, val);
|
||||
+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_R1, val);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __setup_pcm_fmt(struct meson_spdif_dai *priv,
|
||||
+ unsigned int width)
|
||||
+{
|
||||
+ u32 val = 0;
|
||||
+
|
||||
+ switch (width) {
|
||||
+ case 16:
|
||||
+ val |= AIU_958_MISC_MODE_16BITS;
|
||||
+ val |= AIU_958_MISC_16BITS_ALIGN(2);
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ case 24:
|
||||
+ /*
|
||||
+ * Looks like this should only be set for 32bits mode, but the
|
||||
+ * vendor kernel sets it like this for 24bits as well, let's
|
||||
+ * try and see
|
||||
+ */
|
||||
+ val |= AIU_958_MISC_MODE_32BITS;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /* No idea what this actually does, copying the vendor kernel for now */
|
||||
+ val |= AIU_958_MISC_FORCE_LR;
|
||||
+ val |= AIU_958_MISC_U_FROM_STREAM;
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_958_MISC,
|
||||
+ AIU_958_MISC_NON_PCM |
|
||||
+ AIU_958_MISC_MODE_16BITS |
|
||||
+ AIU_958_MISC_16BITS_ALIGN_MASK |
|
||||
+ AIU_958_MISC_MODE_32BITS |
|
||||
+ AIU_958_MISC_FORCE_LR,
|
||||
+ val);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_spdif_dai_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_spdif_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = __setup_spdif_clk(priv, params_rate(params));
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Unable to set the spdif clock\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = __setup_cs_word(priv, params);
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Unable to set the channel status word\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = __setup_pcm_fmt(priv, params_width(params));
|
||||
+ if (ret) {
|
||||
+ dev_err(dai->dev, "Unable to set the pcm format\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_spdif_dai_startup(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_spdif_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Power up the spdif fast domain - can't write the registers w/o it */
|
||||
+ ret = clk_prepare_enable(priv->fast);
|
||||
+ if (ret)
|
||||
+ goto out_clk_fast;
|
||||
+
|
||||
+ /* Make sure nothing gets out of the DAI yet*/
|
||||
+ __hold(priv, true);
|
||||
+
|
||||
+ ret = clk_set_parent(priv->mclk, priv->mclk_i958);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Enable the clock gate */
|
||||
+ ret = clk_prepare_enable(priv->iface);
|
||||
+ if (ret)
|
||||
+ goto out_clk_iface;
|
||||
+
|
||||
+ /* Enable the spdif clock */
|
||||
+ ret = clk_prepare_enable(priv->mclk);
|
||||
+ if (ret)
|
||||
+ goto out_mclk;
|
||||
+
|
||||
+ /*
|
||||
+ * Make sure the interface expect a memory layout we can work with
|
||||
+ * MEM prefixed register usually belong to the DMA, but when the spdif
|
||||
+ * DAI takes data from the i2s buffer, we need to make sure it works in
|
||||
+ * split mode and not the "normal mode" (channel samples packed in
|
||||
+ * 32 bytes groups)
|
||||
+ */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL,
|
||||
+ AIU_MEM_IEC958_CONTROL_MODE_LINEAR,
|
||||
+ AIU_MEM_IEC958_CONTROL_MODE_LINEAR);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+out_mclk:
|
||||
+ clk_disable_unprepare(priv->iface);
|
||||
+out_clk_iface:
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+out_clk_fast:
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void meson_spdif_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct meson_spdif_dai *priv = snd_soc_dai_get_drvdata(dai);
|
||||
+
|
||||
+ clk_disable_unprepare(priv->iface);
|
||||
+ clk_disable_unprepare(priv->mclk);
|
||||
+ clk_disable_unprepare(priv->fast);
|
||||
+}
|
||||
+
|
||||
+static const struct snd_soc_dai_ops meson_spdif_dai_ops = {
|
||||
+ .startup = meson_spdif_dai_startup,
|
||||
+ .shutdown = meson_spdif_dai_shutdown,
|
||||
+ .trigger = meson_spdif_dai_trigger,
|
||||
+ .hw_params = meson_spdif_dai_hw_params,
|
||||
+};
|
||||
+
|
||||
+static struct snd_soc_dai_driver meson_spdif_dai = {
|
||||
+ .playback = {
|
||||
+ .stream_name = "Playback",
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 2,
|
||||
+ .rates = (SNDRV_PCM_RATE_32000 |
|
||||
+ SNDRV_PCM_RATE_44100 |
|
||||
+ SNDRV_PCM_RATE_48000 |
|
||||
+ SNDRV_PCM_RATE_96000 |
|
||||
+ SNDRV_PCM_RATE_192000),
|
||||
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S24_LE)
|
||||
+ },
|
||||
+ .ops = &meson_spdif_dai_ops,
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_component_driver meson_spdif_dai_component = {
|
||||
+ .name = DRV_NAME,
|
||||
+};
|
||||
+
|
||||
+static int meson_spdif_dai_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct meson_spdif_dai *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 spdif fast domain clockt\n");
|
||||
+ return PTR_ERR(priv->fast);
|
||||
+ }
|
||||
+
|
||||
+ priv->iface = devm_clk_get(dev, "iface");
|
||||
+ if (IS_ERR(priv->iface)) {
|
||||
+ if (PTR_ERR(priv->iface) != -EPROBE_DEFER)
|
||||
+ dev_err(dev,
|
||||
+ "Can't get the dai clock gate\n");
|
||||
+ return PTR_ERR(priv->iface);
|
||||
+ }
|
||||
+
|
||||
+ priv->mclk_i958 = devm_clk_get(dev, "mclk_i958");
|
||||
+ if (IS_ERR(priv->mclk_i958)) {
|
||||
+ if (PTR_ERR(priv->mclk_i958) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get the spdif master clock\n");
|
||||
+ return PTR_ERR(priv->mclk_i958);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * TODO: the spdif dai can also get its data from the i2s fifo.
|
||||
+ * For this use-case, the DAI driver will need to get the i2s master
|
||||
+ * clock in order to reparent the spdif clock from cts_mclk_i958 to
|
||||
+ * cts_amclk
|
||||
+ */
|
||||
+
|
||||
+ priv->mclk = devm_clk_get(dev, "mclk");
|
||||
+ if (IS_ERR(priv->mclk)) {
|
||||
+ if (PTR_ERR(priv->mclk) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get the spdif input mux clock\n");
|
||||
+ return PTR_ERR(priv->mclk);
|
||||
+ }
|
||||
+
|
||||
+ return devm_snd_soc_register_component(dev, &meson_spdif_dai_component,
|
||||
+ &meson_spdif_dai, 1);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id meson_spdif_dai_of_match[] = {
|
||||
+ { .compatible = "amlogic,meson-spdif-dai", },
|
||||
+ { .compatible = "amlogic,meson-gxbb-spdif-dai", },
|
||||
+ { .compatible = "amlogic,meson-gxl-spdif-dai", },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, meson_spdif_dai_of_match);
|
||||
+
|
||||
+static struct platform_driver meson_spdif_dai_pdrv = {
|
||||
+ .probe = meson_spdif_dai_probe,
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .of_match_table = meson_spdif_dai_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(meson_spdif_dai_pdrv);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Meson spdif DAI ASoC Driver");
|
||||
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From 2871626ba6e61e1ace43db491f766d39e6eacd5a Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Sep 2019 14:59:55 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12: factor the power domain.
|
||||
|
||||
The power domain declared in the g12a and g12b dtsi are the same.
|
||||
Move the declaration of these power domains in the g12 common dtsi.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 13 +++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 13 -------------
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 12 ------------
|
||||
3 files changed, 13 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
index 1e30061fb2a7..ac5833781611 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -5,3 +5,16 @@
|
||||
*/
|
||||
|
||||
#include "meson-g12-common.dtsi"
|
||||
+#include <dt-bindings/power/meson-g12a-power.h>
|
||||
+
|
||||
+ðmac {
|
||||
+ power-domains = <&pwrc PWRC_G12A_ETH_ID>;
|
||||
+};
|
||||
+
|
||||
+&vpu {
|
||||
+ power-domains = <&pwrc PWRC_G12A_VPU_ID>;
|
||||
+};
|
||||
+
|
||||
+&sd_emmc_a {
|
||||
+ amlogic,dram-access-quirk;
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
index 69339d69dfd4..07450c4babfc 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include "meson-g12.dtsi"
|
||||
-#include <dt-bindings/power/meson-g12a-power.h>
|
||||
|
||||
/ {
|
||||
compatible = "amlogic,g12a";
|
||||
@@ -110,15 +109,3 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
-
|
||||
-ðmac {
|
||||
- power-domains = <&pwrc PWRC_G12A_ETH_ID>;
|
||||
-};
|
||||
-
|
||||
-&vpu {
|
||||
- power-domains = <&pwrc PWRC_G12A_VPU_ID>;
|
||||
-};
|
||||
-
|
||||
-&sd_emmc_a {
|
||||
- amlogic,dram-access-quirk;
|
||||
-};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
index eefac0ef092b..a9e1db0f1158 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "meson-g12.dtsi"
|
||||
-#include <dt-bindings/power/meson-g12a-power.h>
|
||||
|
||||
/ {
|
||||
compatible = "amlogic,g12b";
|
||||
@@ -102,14 +101,3 @@
|
||||
compatible = "amlogic,g12b-clkc";
|
||||
};
|
||||
|
||||
-ðmac {
|
||||
- power-domains = <&pwrc PWRC_G12A_ETH_ID>;
|
||||
-};
|
||||
-
|
||||
-&vpu {
|
||||
- power-domains = <&pwrc PWRC_G12A_VPU_ID>;
|
||||
-};
|
||||
-
|
||||
-&sd_emmc_a {
|
||||
- amlogic,dram-access-quirk;
|
||||
-};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
From eabd19b9bb8a62764dfd5290205cf7431e0329d6 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Fri, 31 Mar 2017 15:55:03 +0200
|
||||
Subject: [PATCH 08/53] ARM64: defconfig: enable audio support for meson SoCs
|
||||
as module
|
||||
|
||||
Add audio support for meson SoCs. This includes the audio core
|
||||
driver and the i2s and spdif output interfaces
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
arch/arm64/configs/defconfig | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
|
||||
index ab1cb51319e7..a4bf54b3b50d 100644
|
||||
--- a/arch/arm64/configs/defconfig
|
||||
+++ b/arch/arm64/configs/defconfig
|
||||
@@ -464,6 +464,9 @@ CONFIG_SOUND=y
|
||||
CONFIG_SND=y
|
||||
CONFIG_SND_SOC=y
|
||||
CONFIG_SND_BCM2835_SOC_I2S=m
|
||||
+CONFIG_SND_SOC_MESON=m
|
||||
+CONFIG_SND_SOC_MESON_I2S=m
|
||||
+CONFIG_SND_SOC_MESON_SPDIF=m
|
||||
CONFIG_SND_SOC_ROCKCHIP=m
|
||||
CONFIG_SND_SOC_ROCKCHIP_I2S=m
|
||||
CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
From 8615d90edac5487f8639c5e4df40312972d7b2c9 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 30 Mar 2017 15:19:04 +0200
|
||||
Subject: [PATCH 09/53] ARM64: dts: meson-gx: add audio controller nodes
|
||||
|
||||
Add audio controller nodes for Amlogic meson gxbb and gxl.
|
||||
This includes the audio-core node, the i2s and spdif DAIs, i2s and spdif
|
||||
aiu DMAs.
|
||||
|
||||
Audio on this SoC family is still a work in progress. More nodes are likely
|
||||
to be added later on (pcm DAIs, input DMAs, etc ...)
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 35 ++++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 39 +++++++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 38 ++++++++++++++++++++
|
||||
3 files changed, 112 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index b8dc4dbb391b..6b64b63f2a68 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -203,6 +203,41 @@
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
+ audio: audio@5400 {
|
||||
+ compatible = "amlogic,meson-audio-core";
|
||||
+ reg = <0x0 0x5400 0x0 0x2ac>,
|
||||
+ <0x0 0xa000 0x0 0x304>;
|
||||
+ reg-names = "aiu", "audin";
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ aiu_i2s_dma: aiu_i2s_dma {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ compatible = "amlogic,meson-aiu-i2s-dma";
|
||||
+ interrupts = <GIC_SPI 48 IRQ_TYPE_EDGE_RISING>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ aiu_spdif_dma: aiu_spdif_dma {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ compatible = "amlogic,meson-aiu-spdif-dma";
|
||||
+ interrupts = <GIC_SPI 50 IRQ_TYPE_EDGE_RISING>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ i2s_dai: i2s_dai {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ compatible = "amlogic,meson-i2s-dai";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spdif_dai: spdif_dai {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ compatible = "amlogic,meson-spdif-dai";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
uart_A: serial@84c0 {
|
||||
compatible = "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x84c0 0x0 0x18>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
index 98cbba6809ca..79132496691f 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
@@ -659,6 +659,35 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ clocks = <&clkc CLKID_AIU>,
|
||||
+ <&clkc CLKID_AIU_GLUE>,
|
||||
+ <&clkc CLKID_I2S_SPDIF>;
|
||||
+ clock-names = "aiu_top", "aiu_glue", "audin";
|
||||
+ resets = <&reset RESET_AIU>,
|
||||
+ <&reset RESET_AUDIN>;
|
||||
+ reset-names = "aiu", "audin";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ clocks = <&clkc CLKID_I2S_OUT>;
|
||||
+ clock-names = "fast";
|
||||
+};
|
||||
+
|
||||
+&aiu_spdif_dma {
|
||||
+ clocks = <&clkc CLKID_IEC958>;
|
||||
+ clock-names = "fast";
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&i2s_dai {
|
||||
+ clocks = <&clkc CLKID_I2S_OUT>,
|
||||
+ <&clkc CLKID_MIXER_IFACE>,
|
||||
+ <&clkc CLKID_AOCLK_GATE>,
|
||||
+ <&clkc CLKID_CTS_AMCLK>;
|
||||
+ clock-names = "fast", "iface", "bclks", "mclk";
|
||||
+};
|
||||
+
|
||||
&pwrc_vpu {
|
||||
resets = <&reset RESET_VIU>,
|
||||
<&reset RESET_VENC>,
|
||||
@@ -741,6 +770,15 @@
|
||||
num-cs = <1>;
|
||||
};
|
||||
|
||||
+&spdif_dai {
|
||||
+ clocks = <&clkc CLKID_IEC958>,
|
||||
+ <&clkc CLKID_IEC958_GATE>,
|
||||
+ <&clkc CLKID_CTS_MCLK_I958>,
|
||||
+ <&clkc CLKID_CTS_AMCLK>,
|
||||
+ <&clkc CLKID_CTS_I958>;
|
||||
+ clock-names = "fast", "iface", "mclk_i958", "mclk_i2s", "mclk";
|
||||
+};
|
||||
+
|
||||
&spifc {
|
||||
clocks = <&clkc CLKID_SPI>;
|
||||
};
|
||||
@@ -774,3 +812,4 @@
|
||||
compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
index c87a80e9bcc6..20922cdc2c23 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
@@ -660,6 +660,34 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ clocks = <&clkc CLKID_AIU>,
|
||||
+ <&clkc CLKID_AIU_GLUE>,
|
||||
+ <&clkc CLKID_I2S_SPDIF>;
|
||||
+ clock-names = "aiu_top", "aiu_glue", "audin";
|
||||
+ resets = <&reset RESET_AIU>,
|
||||
+ <&reset RESET_AUDIN>;
|
||||
+ reset-names = "aiu", "audin";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ clocks = <&clkc CLKID_I2S_OUT>;
|
||||
+ clock-names = "fast";
|
||||
+};
|
||||
+
|
||||
+&aiu_spdif_dma {
|
||||
+ clocks = <&clkc CLKID_IEC958>;
|
||||
+ clock-names = "fast";
|
||||
+};
|
||||
+
|
||||
+&i2s_dai {
|
||||
+ clocks = <&clkc CLKID_I2S_OUT>,
|
||||
+ <&clkc CLKID_MIXER_IFACE>,
|
||||
+ <&clkc CLKID_AOCLK_GATE>,
|
||||
+ <&clkc CLKID_CTS_AMCLK>;
|
||||
+ clock-names = "fast", "iface", "bclks", "mclk";
|
||||
+};
|
||||
+
|
||||
&pwrc_vpu {
|
||||
resets = <&reset RESET_VIU>,
|
||||
<&reset RESET_VENC>,
|
||||
@@ -742,6 +770,15 @@
|
||||
num-cs = <1>;
|
||||
};
|
||||
|
||||
+&spdif_dai {
|
||||
+ clocks = <&clkc CLKID_IEC958>,
|
||||
+ <&clkc CLKID_IEC958_GATE>,
|
||||
+ <&clkc CLKID_CTS_MCLK_I958>,
|
||||
+ <&clkc CLKID_CTS_AMCLK>,
|
||||
+ <&clkc CLKID_CTS_I958>;
|
||||
+ clock-names = "fast", "iface", "mclk_i958", "mclk_i2s", "mclk";
|
||||
+};
|
||||
+
|
||||
&spifc {
|
||||
clocks = <&clkc CLKID_SPI>;
|
||||
};
|
||||
@@ -775,3 +812,4 @@
|
||||
compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,707 @@
|
||||
From 0f674df0c260d363d2f25efea17f07b73d287565 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Sep 2019 14:59:56 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12: move audio bus out of g12-common
|
||||
|
||||
The base address of the audio bus and pdm device are different
|
||||
between the g12 and sm1 SoC families. Overwriting the reg property
|
||||
only would leave with confusing node names on the sm1.
|
||||
|
||||
Move the audio related devices to the g12 dtsi. The appropriate nodes
|
||||
will be created for the sm1 later on.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12-common.dtsi | 320 -----------------
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 324 ++++++++++++++++++
|
||||
2 files changed, 324 insertions(+), 320 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 0ee8a369c547..95e9cf405fe9 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -5,13 +5,10 @@
|
||||
|
||||
#include <dt-bindings/phy/phy.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
-#include <dt-bindings/clock/axg-audio-clkc.h>
|
||||
#include <dt-bindings/clock/g12a-clkc.h>
|
||||
#include <dt-bindings/clock/g12a-aoclkc.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
-#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
|
||||
-#include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
|
||||
#include <dt-bindings/reset/amlogic,meson-g12a-reset.h>
|
||||
|
||||
/ {
|
||||
@@ -19,39 +16,6 @@
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
- tdmif_a: audio-controller-0 {
|
||||
- compatible = "amlogic,axg-tdm-iface";
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TDM_A";
|
||||
- clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_A_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
|
||||
- clock-names = "mclk", "sclk", "lrclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmif_b: audio-controller-1 {
|
||||
- compatible = "amlogic,axg-tdm-iface";
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TDM_B";
|
||||
- clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_B_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
|
||||
- clock-names = "mclk", "sclk", "lrclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmif_c: audio-controller-2 {
|
||||
- compatible = "amlogic,axg-tdm-iface";
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TDM_C";
|
||||
- clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_C_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_MST_C_LRCLK>;
|
||||
- clock-names = "mclk", "sclk", "lrclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
efuse: efuse {
|
||||
compatible = "amlogic,meson-gxbb-efuse";
|
||||
clocks = <&clkc CLKID_EFUSE>;
|
||||
@@ -1457,290 +1421,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
- pdm: audio-controller@40000 {
|
||||
- compatible = "amlogic,g12a-pdm",
|
||||
- "amlogic,axg-pdm";
|
||||
- reg = <0x0 0x40000 0x0 0x34>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "PDM";
|
||||
- clocks = <&clkc_audio AUD_CLKID_PDM>,
|
||||
- <&clkc_audio AUD_CLKID_PDM_DCLK>,
|
||||
- <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
|
||||
- clock-names = "pclk", "dclk", "sysclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- audio: bus@42000 {
|
||||
- compatible = "simple-bus";
|
||||
- reg = <0x0 0x42000 0x0 0x2000>;
|
||||
- #address-cells = <2>;
|
||||
- #size-cells = <2>;
|
||||
- ranges = <0x0 0x0 0x0 0x42000 0x0 0x2000>;
|
||||
-
|
||||
- clkc_audio: clock-controller@0 {
|
||||
- status = "disabled";
|
||||
- compatible = "amlogic,g12a-audio-clkc";
|
||||
- reg = <0x0 0x0 0x0 0xb4>;
|
||||
- #clock-cells = <1>;
|
||||
- #reset-cells = <1>;
|
||||
-
|
||||
- clocks = <&clkc CLKID_AUDIO>,
|
||||
- <&clkc CLKID_MPLL0>,
|
||||
- <&clkc CLKID_MPLL1>,
|
||||
- <&clkc CLKID_MPLL2>,
|
||||
- <&clkc CLKID_MPLL3>,
|
||||
- <&clkc CLKID_HIFI_PLL>,
|
||||
- <&clkc CLKID_FCLK_DIV3>,
|
||||
- <&clkc CLKID_FCLK_DIV4>,
|
||||
- <&clkc CLKID_GP0_PLL>;
|
||||
- clock-names = "pclk",
|
||||
- "mst_in0",
|
||||
- "mst_in1",
|
||||
- "mst_in2",
|
||||
- "mst_in3",
|
||||
- "mst_in4",
|
||||
- "mst_in5",
|
||||
- "mst_in6",
|
||||
- "mst_in7";
|
||||
-
|
||||
- resets = <&reset RESET_AUDIO>;
|
||||
- };
|
||||
-
|
||||
- toddr_a: audio-controller@100 {
|
||||
- compatible = "amlogic,g12a-toddr",
|
||||
- "amlogic,axg-toddr";
|
||||
- reg = <0x0 0x100 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TODDR_A";
|
||||
- interrupts = <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TODDR_A>;
|
||||
- resets = <&arb AXG_ARB_TODDR_A>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- toddr_b: audio-controller@140 {
|
||||
- compatible = "amlogic,g12a-toddr",
|
||||
- "amlogic,axg-toddr";
|
||||
- reg = <0x0 0x140 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TODDR_B";
|
||||
- interrupts = <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TODDR_B>;
|
||||
- resets = <&arb AXG_ARB_TODDR_B>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- toddr_c: audio-controller@180 {
|
||||
- compatible = "amlogic,g12a-toddr",
|
||||
- "amlogic,axg-toddr";
|
||||
- reg = <0x0 0x180 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "TODDR_C";
|
||||
- interrupts = <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TODDR_C>;
|
||||
- resets = <&arb AXG_ARB_TODDR_C>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- frddr_a: audio-controller@1c0 {
|
||||
- compatible = "amlogic,g12a-frddr",
|
||||
- "amlogic,axg-frddr";
|
||||
- reg = <0x0 0x1c0 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "FRDDR_A";
|
||||
- interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_A>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- frddr_b: audio-controller@200 {
|
||||
- compatible = "amlogic,g12a-frddr",
|
||||
- "amlogic,axg-frddr";
|
||||
- reg = <0x0 0x200 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "FRDDR_B";
|
||||
- interrupts = <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_FRDDR_B>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_B>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- frddr_c: audio-controller@240 {
|
||||
- compatible = "amlogic,g12a-frddr",
|
||||
- "amlogic,axg-frddr";
|
||||
- reg = <0x0 0x240 0x0 0x2c>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "FRDDR_C";
|
||||
- interrupts = <GIC_SPI 154 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_FRDDR_C>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_C>;
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- arb: reset-controller@280 {
|
||||
- status = "disabled";
|
||||
- compatible = "amlogic,meson-axg-audio-arb";
|
||||
- reg = <0x0 0x280 0x0 0x4>;
|
||||
- #reset-cells = <1>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_DDR_ARB>;
|
||||
- };
|
||||
-
|
||||
- tdmin_a: audio-controller@300 {
|
||||
- compatible = "amlogic,g12a-tdmin",
|
||||
- "amlogic,axg-tdmin";
|
||||
- reg = <0x0 0x300 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMIN_A";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMIN_A>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMIN_A>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmin_b: audio-controller@340 {
|
||||
- compatible = "amlogic,g12a-tdmin",
|
||||
- "amlogic,axg-tdmin";
|
||||
- reg = <0x0 0x340 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMIN_B";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMIN_B>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMIN_B>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmin_c: audio-controller@380 {
|
||||
- compatible = "amlogic,g12a-tdmin",
|
||||
- "amlogic,axg-tdmin";
|
||||
- reg = <0x0 0x380 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMIN_C";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMIN_C>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMIN_C>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmin_lb: audio-controller@3c0 {
|
||||
- compatible = "amlogic,g12a-tdmin",
|
||||
- "amlogic,axg-tdmin";
|
||||
- reg = <0x0 0x3c0 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMIN_LB";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMIN_LB>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- spdifin: audio-controller@400 {
|
||||
- compatible = "amlogic,g12a-spdifin",
|
||||
- "amlogic,axg-spdifin";
|
||||
- reg = <0x0 0x400 0x0 0x30>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "SPDIFIN";
|
||||
- interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
|
||||
- <&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
|
||||
- clock-names = "pclk", "refclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- spdifout: audio-controller@480 {
|
||||
- compatible = "amlogic,g12a-spdifout",
|
||||
- "amlogic,axg-spdifout";
|
||||
- reg = <0x0 0x480 0x0 0x50>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "SPDIFOUT";
|
||||
- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
|
||||
- <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
|
||||
- clock-names = "pclk", "mclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmout_a: audio-controller@500 {
|
||||
- compatible = "amlogic,g12a-tdmout";
|
||||
- reg = <0x0 0x500 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMOUT_A";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmout_b: audio-controller@540 {
|
||||
- compatible = "amlogic,g12a-tdmout";
|
||||
- reg = <0x0 0x540 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMOUT_B";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMOUT_B>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tdmout_c: audio-controller@580 {
|
||||
- compatible = "amlogic,g12a-tdmout";
|
||||
- reg = <0x0 0x580 0x0 0x40>;
|
||||
- sound-name-prefix = "TDMOUT_C";
|
||||
- resets = <&clkc_audio AUD_RESET_TDMOUT_C>;
|
||||
- clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>,
|
||||
- <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>;
|
||||
- clock-names = "pclk", "sclk", "sclk_sel",
|
||||
- "lrclk", "lrclk_sel";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- spdifout_b: audio-controller@680 {
|
||||
- compatible = "amlogic,g12a-spdifout",
|
||||
- "amlogic,axg-spdifout";
|
||||
- reg = <0x0 0x680 0x0 0x50>;
|
||||
- #sound-dai-cells = <0>;
|
||||
- sound-name-prefix = "SPDIFOUT_B";
|
||||
- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT_B>,
|
||||
- <&clkc_audio AUD_CLKID_SPDIFOUT_B_CLK>;
|
||||
- clock-names = "pclk", "mclk";
|
||||
- status = "disabled";
|
||||
- };
|
||||
-
|
||||
- tohdmitx: audio-controller@744 {
|
||||
- compatible = "amlogic,g12a-tohdmitx";
|
||||
- reg = <0x0 0x744 0x0 0x4>;
|
||||
- #sound-dai-cells = <1>;
|
||||
- sound-name-prefix = "TOHDMITX";
|
||||
- status = "disabled";
|
||||
- };
|
||||
- };
|
||||
-
|
||||
usb3_pcie_phy: phy@46000 {
|
||||
compatible = "amlogic,g12a-usb3-pcie-phy";
|
||||
reg = <0x0 0x46000 0x0 0x2000>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
index ac5833781611..0d9df29994f3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -5,7 +5,331 @@
|
||||
*/
|
||||
|
||||
#include "meson-g12-common.dtsi"
|
||||
+#include <dt-bindings/clock/axg-audio-clkc.h>
|
||||
#include <dt-bindings/power/meson-g12a-power.h>
|
||||
+#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
|
||||
+#include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
|
||||
+
|
||||
+/ {
|
||||
+ tdmif_a: audio-controller-0 {
|
||||
+ compatible = "amlogic,axg-tdm-iface";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TDM_A";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_A_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
|
||||
+ clock-names = "mclk", "sclk", "lrclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmif_b: audio-controller-1 {
|
||||
+ compatible = "amlogic,axg-tdm-iface";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TDM_B";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_B_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
|
||||
+ clock-names = "mclk", "sclk", "lrclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmif_c: audio-controller-2 {
|
||||
+ compatible = "amlogic,axg-tdm-iface";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TDM_C";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_C_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_MST_C_LRCLK>;
|
||||
+ clock-names = "mclk", "sclk", "lrclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&apb {
|
||||
+ pdm: audio-controller@40000 {
|
||||
+ compatible = "amlogic,g12a-pdm",
|
||||
+ "amlogic,axg-pdm";
|
||||
+ reg = <0x0 0x40000 0x0 0x34>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "PDM";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_PDM>,
|
||||
+ <&clkc_audio AUD_CLKID_PDM_DCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
|
||||
+ clock-names = "pclk", "dclk", "sysclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ audio: bus@42000 {
|
||||
+ compatible = "simple-bus";
|
||||
+ reg = <0x0 0x42000 0x0 0x2000>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges = <0x0 0x0 0x0 0x42000 0x0 0x2000>;
|
||||
+
|
||||
+ clkc_audio: clock-controller@0 {
|
||||
+ status = "disabled";
|
||||
+ compatible = "amlogic,g12a-audio-clkc";
|
||||
+ reg = <0x0 0x0 0x0 0xb4>;
|
||||
+ #clock-cells = <1>;
|
||||
+ #reset-cells = <1>;
|
||||
+
|
||||
+ clocks = <&clkc CLKID_AUDIO>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>,
|
||||
+ <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL3>,
|
||||
+ <&clkc CLKID_HIFI_PLL>,
|
||||
+ <&clkc CLKID_FCLK_DIV3>,
|
||||
+ <&clkc CLKID_FCLK_DIV4>,
|
||||
+ <&clkc CLKID_GP0_PLL>;
|
||||
+ clock-names = "pclk",
|
||||
+ "mst_in0",
|
||||
+ "mst_in1",
|
||||
+ "mst_in2",
|
||||
+ "mst_in3",
|
||||
+ "mst_in4",
|
||||
+ "mst_in5",
|
||||
+ "mst_in6",
|
||||
+ "mst_in7";
|
||||
+
|
||||
+ resets = <&reset RESET_AUDIO>;
|
||||
+ };
|
||||
+
|
||||
+ toddr_a: audio-controller@100 {
|
||||
+ compatible = "amlogic,g12a-toddr",
|
||||
+ "amlogic,axg-toddr";
|
||||
+ reg = <0x0 0x100 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TODDR_A";
|
||||
+ interrupts = <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TODDR_A>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_A>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ toddr_b: audio-controller@140 {
|
||||
+ compatible = "amlogic,g12a-toddr",
|
||||
+ "amlogic,axg-toddr";
|
||||
+ reg = <0x0 0x140 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TODDR_B";
|
||||
+ interrupts = <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TODDR_B>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_B>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ toddr_c: audio-controller@180 {
|
||||
+ compatible = "amlogic,g12a-toddr",
|
||||
+ "amlogic,axg-toddr";
|
||||
+ reg = <0x0 0x180 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "TODDR_C";
|
||||
+ interrupts = <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TODDR_C>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_C>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ frddr_a: audio-controller@1c0 {
|
||||
+ compatible = "amlogic,g12a-frddr",
|
||||
+ "amlogic,axg-frddr";
|
||||
+ reg = <0x0 0x1c0 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "FRDDR_A";
|
||||
+ interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_A>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ frddr_b: audio-controller@200 {
|
||||
+ compatible = "amlogic,g12a-frddr",
|
||||
+ "amlogic,axg-frddr";
|
||||
+ reg = <0x0 0x200 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "FRDDR_B";
|
||||
+ interrupts = <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_FRDDR_B>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_B>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ frddr_c: audio-controller@240 {
|
||||
+ compatible = "amlogic,g12a-frddr",
|
||||
+ "amlogic,axg-frddr";
|
||||
+ reg = <0x0 0x240 0x0 0x2c>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "FRDDR_C";
|
||||
+ interrupts = <GIC_SPI 154 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_FRDDR_C>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_C>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ arb: reset-controller@280 {
|
||||
+ status = "disabled";
|
||||
+ compatible = "amlogic,meson-axg-audio-arb";
|
||||
+ reg = <0x0 0x280 0x0 0x4>;
|
||||
+ #reset-cells = <1>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_DDR_ARB>;
|
||||
+ };
|
||||
+
|
||||
+ tdmin_a: audio-controller@300 {
|
||||
+ compatible = "amlogic,g12a-tdmin",
|
||||
+ "amlogic,axg-tdmin";
|
||||
+ reg = <0x0 0x300 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMIN_A";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMIN_A>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMIN_A>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmin_b: audio-controller@340 {
|
||||
+ compatible = "amlogic,g12a-tdmin",
|
||||
+ "amlogic,axg-tdmin";
|
||||
+ reg = <0x0 0x340 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMIN_B";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMIN_B>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMIN_B>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmin_c: audio-controller@380 {
|
||||
+ compatible = "amlogic,g12a-tdmin",
|
||||
+ "amlogic,axg-tdmin";
|
||||
+ reg = <0x0 0x380 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMIN_C";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMIN_C>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMIN_C>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmin_lb: audio-controller@3c0 {
|
||||
+ compatible = "amlogic,g12a-tdmin",
|
||||
+ "amlogic,axg-tdmin";
|
||||
+ reg = <0x0 0x3c0 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMIN_LB";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMIN_LB>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spdifin: audio-controller@400 {
|
||||
+ compatible = "amlogic,g12a-spdifin",
|
||||
+ "amlogic,axg-spdifin";
|
||||
+ reg = <0x0 0x400 0x0 0x30>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "SPDIFIN";
|
||||
+ interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
|
||||
+ <&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
|
||||
+ clock-names = "pclk", "refclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spdifout: audio-controller@480 {
|
||||
+ compatible = "amlogic,g12a-spdifout",
|
||||
+ "amlogic,axg-spdifout";
|
||||
+ reg = <0x0 0x480 0x0 0x50>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "SPDIFOUT";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
|
||||
+ <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
|
||||
+ clock-names = "pclk", "mclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmout_a: audio-controller@500 {
|
||||
+ compatible = "amlogic,g12a-tdmout";
|
||||
+ reg = <0x0 0x500 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMOUT_A";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmout_b: audio-controller@540 {
|
||||
+ compatible = "amlogic,g12a-tdmout";
|
||||
+ reg = <0x0 0x540 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMOUT_B";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMOUT_B>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tdmout_c: audio-controller@580 {
|
||||
+ compatible = "amlogic,g12a-tdmout";
|
||||
+ reg = <0x0 0x580 0x0 0x40>;
|
||||
+ sound-name-prefix = "TDMOUT_C";
|
||||
+ resets = <&clkc_audio AUD_RESET_TDMOUT_C>;
|
||||
+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>,
|
||||
+ <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>;
|
||||
+ clock-names = "pclk", "sclk", "sclk_sel",
|
||||
+ "lrclk", "lrclk_sel";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spdifout_b: audio-controller@680 {
|
||||
+ compatible = "amlogic,g12a-spdifout",
|
||||
+ "amlogic,axg-spdifout";
|
||||
+ reg = <0x0 0x680 0x0 0x50>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "SPDIFOUT_B";
|
||||
+ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT_B>,
|
||||
+ <&clkc_audio AUD_CLKID_SPDIFOUT_B_CLK>;
|
||||
+ clock-names = "pclk", "mclk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ tohdmitx: audio-controller@744 {
|
||||
+ compatible = "amlogic,g12a-tohdmitx";
|
||||
+ reg = <0x0 0x744 0x0 0x4>;
|
||||
+ #sound-dai-cells = <1>;
|
||||
+ sound-name-prefix = "TOHDMITX";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
|
||||
ðmac {
|
||||
power-domains = <&pwrc PWRC_G12A_ETH_ID>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
From c725fb00dfe3409720be24fad54b9acde26c5f11 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Wed, 25 Sep 2019 11:33:58 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12a: add audio devices resets
|
||||
|
||||
Provide the reset lines coming from the audio clock controller to
|
||||
the audio devices of the g12 family
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 28 +++++++++++++++++-----
|
||||
1 file changed, 22 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
index 0d9df29994f3..3cf74fc96434 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -103,7 +103,9 @@
|
||||
sound-name-prefix = "TODDR_A";
|
||||
interrupts = <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_TODDR_A>;
|
||||
- resets = <&arb AXG_ARB_TODDR_A>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_A>,
|
||||
+ <&clkc_audio AUD_RESET_TODDR_A>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -115,7 +117,9 @@
|
||||
sound-name-prefix = "TODDR_B";
|
||||
interrupts = <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_TODDR_B>;
|
||||
- resets = <&arb AXG_ARB_TODDR_B>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_B>,
|
||||
+ <&clkc_audio AUD_RESET_TODDR_B>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -127,7 +131,9 @@
|
||||
sound-name-prefix = "TODDR_C";
|
||||
interrupts = <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_TODDR_C>;
|
||||
- resets = <&arb AXG_ARB_TODDR_C>;
|
||||
+ resets = <&arb AXG_ARB_TODDR_C>,
|
||||
+ <&clkc_audio AUD_RESET_TODDR_C>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -139,7 +145,9 @@
|
||||
sound-name-prefix = "FRDDR_A";
|
||||
interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_A>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_A>,
|
||||
+ <&clkc_audio AUD_RESET_FRDDR_A>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -151,7 +159,9 @@
|
||||
sound-name-prefix = "FRDDR_B";
|
||||
interrupts = <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_FRDDR_B>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_B>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_B>,
|
||||
+ <&clkc_audio AUD_RESET_FRDDR_B>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -163,7 +173,9 @@
|
||||
sound-name-prefix = "FRDDR_C";
|
||||
interrupts = <GIC_SPI 154 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&clkc_audio AUD_CLKID_FRDDR_C>;
|
||||
- resets = <&arb AXG_ARB_FRDDR_C>;
|
||||
+ resets = <&arb AXG_ARB_FRDDR_C>,
|
||||
+ <&clkc_audio AUD_RESET_FRDDR_C>;
|
||||
+ reset-names = "arb", "rst";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -249,6 +261,7 @@
|
||||
clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
|
||||
<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
|
||||
clock-names = "pclk", "refclk";
|
||||
+ resets = <&clkc_audio AUD_RESET_SPDIFIN>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -261,6 +274,7 @@
|
||||
clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
|
||||
<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
|
||||
clock-names = "pclk", "mclk";
|
||||
+ resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -318,6 +332,7 @@
|
||||
clocks = <&clkc_audio AUD_CLKID_SPDIFOUT_B>,
|
||||
<&clkc_audio AUD_CLKID_SPDIFOUT_B_CLK>;
|
||||
clock-names = "pclk", "mclk";
|
||||
+ resets = <&clkc_audio AUD_RESET_SPDIFOUT_B>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -326,6 +341,7 @@
|
||||
reg = <0x0 0x744 0x0 0x4>;
|
||||
#sound-dai-cells = <1>;
|
||||
sound-name-prefix = "TOHDMITX";
|
||||
+ resets = <&clkc_audio AUD_RESET_TOHDMITX>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
From 5608714afb7c71054a01e4ad208b3eaa044041d4 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Fri, 7 Jul 2017 17:39:21 +0200
|
||||
Subject: [PATCH 10/53] snd: meson: activate HDMI audio path
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/i2s-dai.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/sound/soc/meson/i2s-dai.c b/sound/soc/meson/i2s-dai.c
|
||||
index 1008af8d3972..63fe098ecf82 100644
|
||||
--- a/sound/soc/meson/i2s-dai.c
|
||||
+++ b/sound/soc/meson/i2s-dai.c
|
||||
@@ -56,8 +56,19 @@ struct meson_i2s_dai {
|
||||
#define AIU_CLK_CTRL_ALRCLK_RIGHT_J (2 << 8)
|
||||
#define AIU_CLK_CTRL_MORE_I2S_DIV_MASK GENMASK(5, 0)
|
||||
#define AIU_CLK_CTRL_MORE_I2S_DIV(div) (((div) - 1) << 0)
|
||||
+#define AIU_CLK_CTRL_MORE_HDMI_TX_SEL_MASK BIT(6)
|
||||
+#define AIU_CLK_CTRL_MORE_HDMI_TX_I958_CLK (0 << 6)
|
||||
+#define AIU_CLK_CTRL_MORE_HDMI_TX_INT_CLK (1 << 6)
|
||||
#define AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK GENMASK(11, 0)
|
||||
#define AIU_CODEC_DAC_LRCLK_CTRL_DIV(div) (((div) - 1) << 0)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_MASK GENMASK(1, 0)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_DISABLE (0 << 0)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_PCM (1 << 0)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_I2S (2 << 0)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_MASK GENMASK(5, 4)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_MUTE (0 << 4)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_PCM (1 << 4)
|
||||
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_I2S (2 << 4)
|
||||
#define AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK GENMASK(1, 0)
|
||||
#define AIU_I2S_DAC_CFG_AOCLK_32 (0 << 0)
|
||||
#define AIU_I2S_DAC_CFG_AOCLK_48 (2 << 0)
|
||||
@@ -221,6 +232,17 @@ static int meson_i2s_dai_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ /* Quick and dirty hack for HDMI */
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_HDMI_CLK_DATA_CTRL,
|
||||
+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_MASK |
|
||||
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_MASK,
|
||||
+ AIU_HDMI_CLK_DATA_CTRL_CLK_I2S |
|
||||
+ AIU_HDMI_CLK_DATA_CTRL_DATA_I2S);
|
||||
+
|
||||
+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL_MORE,
|
||||
+ AIU_CLK_CTRL_MORE_HDMI_TX_SEL_MASK,
|
||||
+ AIU_CLK_CTRL_MORE_HDMI_TX_INT_CLK);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From de82e74a9f2631e6718ab6a90e0dfbbcd7d952b4 Mon Sep 17 00:00:00 2001
|
||||
From: Carlo Caione <ccaione@baylibre.com>
|
||||
Date: Wed, 31 Jul 2019 09:23:38 +0100
|
||||
Subject: [PATCH] arm64: dts: meson: Link nvmem and secure-monitor nodes
|
||||
|
||||
The former is going to use the latter to retrieve the efuses data.
|
||||
|
||||
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
index bb4a2acb9970..04803c3bccfa 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
|
||||
@@ -117,6 +117,7 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
read-only;
|
||||
+ secure-monitor = <&sm>;
|
||||
};
|
||||
|
||||
psci {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 95e9cf405fe9..0f6ec1704343 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -22,6 +22,7 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
read-only;
|
||||
+ secure-monitor = <&sm>;
|
||||
};
|
||||
|
||||
psci {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 6733050d735f..e5a601e75ef2 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -161,6 +161,7 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
read-only;
|
||||
+ secure-monitor = <&sm>;
|
||||
|
||||
sn: sn@14 {
|
||||
reg = <0x14 0x10>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
From 5b3d41b6ad8275d53b758d6d4b95441b53cd320b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Tue, 14 Feb 2017 19:18:04 +0100
|
||||
Subject: [PATCH 11/53] drm/meson: select dw-hdmi i2s audio for meson hdmi
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
|
||||
index 3ce51d8dfe1c..02d400b8795c 100644
|
||||
--- a/drivers/gpu/drm/meson/Kconfig
|
||||
+++ b/drivers/gpu/drm/meson/Kconfig
|
||||
@@ -13,3 +13,4 @@ config DRM_MESON_DW_HDMI
|
||||
depends on DRM_MESON
|
||||
default y if DRM_MESON
|
||||
select DRM_DW_HDMI
|
||||
+ select DRM_DW_HDMI_I2S_AUDIO
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
From 461a8ba1e73d38b8cd8f8c931a8ae27676cdb085 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Wed, 20 Sep 2017 18:01:26 +0200
|
||||
Subject: [PATCH 12/53] ARM64: dts: meson-gx: add sound-dai-cells to HDMI node
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
index 79132496691f..2a4d506bad4e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
@@ -305,6 +305,7 @@
|
||||
<&clkc CLKID_CLK81>,
|
||||
<&clkc CLKID_GCLK_VENCI_INT0>;
|
||||
clock-names = "isfr", "iahb", "venci";
|
||||
+ #sound-dai-cells = <0>;
|
||||
};
|
||||
|
||||
&sysctrl {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
index 20922cdc2c23..9f4b6185a61d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
@@ -257,6 +257,7 @@
|
||||
<&clkc CLKID_CLK81>,
|
||||
<&clkc CLKID_GCLK_VENCI_INT0>;
|
||||
clock-names = "isfr", "iahb", "venci";
|
||||
+ #sound-dai-cells = <0>;
|
||||
};
|
||||
|
||||
&sysctrl {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
From 1f8607d597635c283e397e87575b49184874d507 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 16 Sep 2019 14:50:21 +0200
|
||||
Subject: [PATCH] arm64: dts: meson-g12a: Add PCIe node
|
||||
|
||||
This adds the Amlogic G12A PCI Express controller node, also
|
||||
using the USB3+PCIe Combo PHY.
|
||||
|
||||
The PHY mode selection is static, thus the USB3+PCIe Combo PHY
|
||||
phandle would need to be removed from the USB control node if the
|
||||
shared differential lines are used for PCIe instead of USB3.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12-common.dtsi | 33 +++++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 4 +++
|
||||
2 files changed, 37 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 0f6ec1704343..f76773cabdb1 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -60,6 +60,39 @@
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
+ pcie: pcie@fc000000 {
|
||||
+ compatible = "amlogic,g12a-pcie", "snps,dw-pcie";
|
||||
+ reg = <0x0 0xfc000000 0x0 0x400000
|
||||
+ 0x0 0xff648000 0x0 0x2000
|
||||
+ 0x0 0xfc400000 0x0 0x200000>;
|
||||
+ reg-names = "elbi", "cfg", "config";
|
||||
+ interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-map-mask = <0 0 0 0>;
|
||||
+ interrupt-map = <0 0 0 0 &gic GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ bus-range = <0x0 0xff>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ device_type = "pci";
|
||||
+ ranges = <0x81000000 0 0 0x0 0xfc600000 0 0x00100000
|
||||
+ 0x82000000 0 0xfc700000 0x0 0xfc700000 0 0x1900000>;
|
||||
+
|
||||
+ clocks = <&clkc CLKID_PCIE_PHY
|
||||
+ &clkc CLKID_PCIE_COMB
|
||||
+ &clkc CLKID_PCIE_PLL>;
|
||||
+ clock-names = "general",
|
||||
+ "pclk",
|
||||
+ "port";
|
||||
+ resets = <&reset RESET_PCIE_CTRL_A>,
|
||||
+ <&reset RESET_PCIE_APB>;
|
||||
+ reset-names = "port",
|
||||
+ "apb";
|
||||
+ num-lanes = <1>;
|
||||
+ phys = <&usb3_pcie_phy PHY_TYPE_PCIE>;
|
||||
+ phy-names = "pcie";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
ethmac: ethernet@ff3f0000 {
|
||||
compatible = "amlogic,meson-axg-dwmac",
|
||||
"snps,dwmac-3.70a",
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 6152e928aef2..1fdc5af5ae23 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -139,6 +139,10 @@
|
||||
"amlogic,meson-gpio-intc";
|
||||
};
|
||||
|
||||
+&pcie {
|
||||
+ power-domains = <&pwrc PWRC_SM1_PCIE_ID>;
|
||||
+};
|
||||
+
|
||||
&pwrc {
|
||||
compatible = "amlogic,meson-sm1-pwrc";
|
||||
};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,864 +0,0 @@
|
||||
From dc4eb517f2800001f77bec852f8f688f0164e51b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Wed, 20 Sep 2017 18:10:08 +0200
|
||||
Subject: [PATCH 13/53] ARM64: dts: meson: activate hdmi audio HDMI enabled
|
||||
boards
|
||||
|
||||
This patch activate audio over HDMI on selected boards
|
||||
|
||||
Please note that this audio support is based on WIP changes
|
||||
This should be considered as preview and it does not reflect
|
||||
the audio I expect to see merged
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 45 +++++++++++++++++++
|
||||
.../dts/amlogic/meson-gxbb-nexbox-a95x.dts | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxbb-odroidc2.dts | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxbb-p20x.dtsi | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxbb-wetek.dtsi | 45 +++++++++++++++++++
|
||||
.../amlogic/meson-gxl-s905x-khadas-vim.dts | 45 +++++++++++++++++++
|
||||
.../amlogic/meson-gxl-s905x-libretech-cc.dts | 45 +++++++++++++++++++
|
||||
.../amlogic/meson-gxl-s905x-nexbox-a95x.dts | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxl-s905x-p212.dts | 45 +++++++++++++++++++
|
||||
.../dts/amlogic/meson-gxm-khadas-vim2.dts | 45 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 45 +++++++++++++++++++
|
||||
12 files changed, 540 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
index 765247bc4f24..fb9ad6faa745 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
@@ -102,6 +102,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -111,6 +144,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
@@ -133,6 +174,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
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 cbe99bd4e06d..5b10de9a0bad 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
@@ -88,6 +88,39 @@
|
||||
clock-names = "ext_clock";
|
||||
};
|
||||
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
vcc1v8: regulator-vcc1v8 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "VCC1.8V";
|
||||
@@ -131,6 +164,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cec_AO {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&ao_cec_pins>;
|
||||
@@ -185,6 +226,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
|
||||
index 4cf7f6e80c6a..ff87bdc7ddbf 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
|
||||
@@ -119,6 +119,39 @@
|
||||
clock-names = "ext_clock";
|
||||
};
|
||||
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
cvbs-connector {
|
||||
compatible = "composite-video-connector";
|
||||
|
||||
@@ -154,6 +187,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
ðmac {
|
||||
status = "okay";
|
||||
pinctrl-0 = <ð_rmii_pins>;
|
||||
@@ -190,6 +231,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 54954b314a45..3da33090b8fe 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -110,6 +110,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -119,6 +152,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
ðmac {
|
||||
status = "okay";
|
||||
pinctrl-0 = <ð_rgmii_pins>;
|
||||
@@ -181,6 +222,10 @@
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
|
||||
index ce862266b9aa..84eb93b4229f 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
|
||||
@@ -113,6 +113,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -122,6 +155,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
@@ -140,6 +181,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
index 70325b273bd2..7d1f1726f29d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
|
||||
@@ -105,6 +105,47 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -159,6 +200,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
index d32cf3846370..f053595ebdc4 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
@@ -65,6 +65,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -74,6 +107,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&hdmi_tx {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
@@ -86,6 +127,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c_A {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2c_a_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
index f63bceb88caa..f56969efffba 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
@@ -84,6 +84,39 @@
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
vcc_3v3: regulator-vcc_3v3 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "VCC_3V3";
|
||||
@@ -130,6 +163,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
@@ -151,6 +192,10 @@
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&hdmi_tx {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts
|
||||
index 6739697be1de..e3e777f665c0 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts
|
||||
@@ -102,6 +102,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -111,6 +144,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
@@ -135,6 +176,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
index 5896e8a5d86b..f8c66a7972b3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
@@ -32,6 +32,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -41,12 +74,24 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&hdmi_tx {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
index 313f88f8759e..4fbfa5a850cc 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
@@ -85,6 +85,39 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
pwmleds {
|
||||
compatible = "pwm-leds";
|
||||
|
||||
@@ -205,6 +238,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cpu0 {
|
||||
#cooling-cells = <2>;
|
||||
};
|
||||
@@ -279,6 +320,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c_A {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2c_a_pins>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
|
||||
index f7a1cffab4a8..b9c5e6444daa 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
|
||||
@@ -75,6 +75,39 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "meson-gx-audio";
|
||||
+
|
||||
+ assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
+ <&clkc CLKID_MPLL0>,
|
||||
+ <&clkc CLKID_MPLL1>;
|
||||
+ assigned-clock-parents = <0>, <0>, <0>;
|
||||
+ assigned-clock-rates = <294912000>,
|
||||
+ <270950400>,
|
||||
+ <393216000>;
|
||||
+
|
||||
+ simple-audio-card,dai-link@0 {
|
||||
+ /* HDMI Output */
|
||||
+ format = "i2s";
|
||||
+ mclk-fs = <256>;
|
||||
+ bitclock-master = <&i2s_dai>;
|
||||
+ frame-master = <&i2s_dai>;
|
||||
+
|
||||
+ plat {
|
||||
+ sound-dai = <&aiu_i2s_dma>;
|
||||
+ };
|
||||
+
|
||||
+ cpu {
|
||||
+ sound-dai = <&i2s_dai>;
|
||||
+ };
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&hdmi_tx>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cec_AO {
|
||||
@@ -84,6 +117,14 @@
|
||||
hdmi-phandle = <&hdmi_tx>;
|
||||
};
|
||||
|
||||
+&audio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&aiu_i2s_dma {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cvbs_vdac_port {
|
||||
cvbs_vdac_out: endpoint {
|
||||
remote-endpoint = <&cvbs_connector_in>;
|
||||
@@ -129,6 +170,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s_dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ir {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&remote_input_ao_pins>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
From 15767cfd81eb9ff2fb783d0c6f458b90efa7d4d3 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Thu, 3 Oct 2019 15:08:41 +0200
|
||||
Subject: [PATCH] arm64: dts: meson-g12: add support for simplefb
|
||||
|
||||
SimpleFB allows transferring a framebuffer from the firmware/bootloader
|
||||
to the kernel, while making sure the related clocks and power supplies
|
||||
stay enabled.
|
||||
|
||||
Add nodes for CVBS and HDMI Simple Framebuffers, based on the GXBB/GXL/GXM
|
||||
support at [1].
|
||||
|
||||
[1] 03b370357907 ("arm64: dts: meson-gx: add support for simplef")
|
||||
|
||||
Cc: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12-common.dtsi | 26 +++++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 8 ++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 8 ++++++
|
||||
3 files changed, 42 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index f76773cabdb1..21c155f4508c 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -16,6 +16,32 @@
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
+ chosen {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ simplefb_cvbs: framebuffer-cvbs {
|
||||
+ compatible = "amlogic,simple-framebuffer",
|
||||
+ "simple-framebuffer";
|
||||
+ amlogic,pipeline = "vpu-cvbs";
|
||||
+ clocks = <&clkc CLKID_HDMI>,
|
||||
+ <&clkc CLKID_HTX_PCLK>,
|
||||
+ <&clkc CLKID_VPU_INTR>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ simplefb_hdmi: framebuffer-hdmi {
|
||||
+ compatible = "amlogic,simple-framebuffer",
|
||||
+ "simple-framebuffer";
|
||||
+ amlogic,pipeline = "vpu-hdmi";
|
||||
+ clocks = <&clkc CLKID_HDMI>,
|
||||
+ <&clkc CLKID_HTX_PCLK>,
|
||||
+ <&clkc CLKID_VPU_INTR>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
efuse: efuse {
|
||||
compatible = "amlogic,meson-gxbb-efuse";
|
||||
clocks = <&clkc CLKID_EFUSE>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
index 3cf74fc96434..1e0e056c3d62 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -358,3 +358,11 @@
|
||||
&sd_emmc_a {
|
||||
amlogic,dram-access-quirk;
|
||||
};
|
||||
+
|
||||
+&simplefb_cvbs {
|
||||
+ power-domains = <&pwrc PWRC_G12A_VPU_ID>;
|
||||
+};
|
||||
+
|
||||
+&simplefb_hdmi {
|
||||
+ power-domains = <&pwrc PWRC_G12A_VPU_ID>;
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 1fdc5af5ae23..f89d744c9648 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -147,6 +147,14 @@
|
||||
compatible = "amlogic,meson-sm1-pwrc";
|
||||
};
|
||||
|
||||
+&simplefb_cvbs {
|
||||
+ power-domains = <&pwrc PWRC_SM1_VPU_ID>;
|
||||
+};
|
||||
+
|
||||
+&simplefb_hdmi {
|
||||
+ power-domains = <&pwrc PWRC_SM1_VPU_ID>;
|
||||
+};
|
||||
+
|
||||
&vpu {
|
||||
power-domains = <&pwrc PWRC_SM1_VPU_ID>;
|
||||
};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 8656783f07613ad2a4e511e417c88c544e220113 Mon Sep 17 00:00:00 2001
|
||||
From: Guillaume La Roque <glaroque@baylibre.com>
|
||||
Date: Fri, 4 Oct 2019 11:01:10 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12: add temperature sensor
|
||||
|
||||
Add cpu and ddr temperature sensors for G12 Socs
|
||||
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Tested-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12-common.dtsi | 20 +++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 21c155f4508c..f153194b9bf3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -1380,6 +1380,26 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ cpu_temp: temperature-sensor@34800 {
|
||||
+ compatible = "amlogic,g12a-cpu-thermal",
|
||||
+ "amlogic,g12a-thermal";
|
||||
+ reg = <0x0 0x34800 0x0 0x50>;
|
||||
+ interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc CLKID_TS>;
|
||||
+ #thermal-sensor-cells = <0>;
|
||||
+ amlogic,ao-secure = <&sec_AO>;
|
||||
+ };
|
||||
+
|
||||
+ ddr_temp: temperature-sensor@34c00 {
|
||||
+ compatible = "amlogic,g12a-ddr-thermal",
|
||||
+ "amlogic,g12a-thermal";
|
||||
+ reg = <0x0 0x34c00 0x0 0x50>;
|
||||
+ interrupts = <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>;
|
||||
+ clocks = <&clkc CLKID_TS>;
|
||||
+ #thermal-sensor-cells = <0>;
|
||||
+ amlogic,ao-secure = <&sec_AO>;
|
||||
+ };
|
||||
+
|
||||
usb2_phy0: phy@36000 {
|
||||
compatible = "amlogic,g12a-usb2-phy";
|
||||
reg = <0x0 0x36000 0x0 0x2000>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
From de9e307aca194c9918a3ace8d809c9f3b18000b9 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 2 Jul 2018 12:21:55 +0200
|
||||
Subject: [PATCH 14/53] drm: bridge: dw-hdmi: Use AUTO CTS setup mode when
|
||||
non-AHB audio
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 41 ++++++++++++++---------
|
||||
1 file changed, 26 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
index 5971976284bf..1fc12708dbb5 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
@@ -430,8 +430,12 @@ static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts,
|
||||
/* nshift factor = 0 */
|
||||
hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3);
|
||||
|
||||
- hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
|
||||
- HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||
+ /* Use Auto CTS mode with CTS is unknown */
|
||||
+ if (cts)
|
||||
+ hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
|
||||
+ HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||
+ else
|
||||
+ hdmi_writeb(hdmi, 0, HDMI_AUD_CTS3);
|
||||
hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2);
|
||||
hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
|
||||
|
||||
@@ -501,24 +505,31 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
|
||||
{
|
||||
unsigned long ftdms = pixel_clk;
|
||||
unsigned int n, cts;
|
||||
+ u8 config3;
|
||||
u64 tmp;
|
||||
|
||||
n = hdmi_compute_n(sample_rate, pixel_clk);
|
||||
|
||||
- /*
|
||||
- * Compute the CTS value from the N value. Note that CTS and N
|
||||
- * can be up to 20 bits in total, so we need 64-bit math. Also
|
||||
- * note that our TDMS clock is not fully accurate; it is accurate
|
||||
- * to kHz. This can introduce an unnecessary remainder in the
|
||||
- * calculation below, so we don't try to warn about that.
|
||||
- */
|
||||
- tmp = (u64)ftdms * n;
|
||||
- do_div(tmp, 128 * sample_rate);
|
||||
- cts = tmp;
|
||||
+ config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID);
|
||||
|
||||
- dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n",
|
||||
- __func__, sample_rate, ftdms / 1000000, (ftdms / 1000) % 1000,
|
||||
- n, cts);
|
||||
+ if (config3 & HDMI_CONFIG3_AHBAUDDMA) {
|
||||
+ /*
|
||||
+ * Compute the CTS value from the N value. Note that CTS and N
|
||||
+ * can be up to 20 bits in total, so we need 64-bit math. Also
|
||||
+ * note that our TDMS clock is not fully accurate; it is
|
||||
+ * accurate to kHz. This can introduce an unnecessary remainder
|
||||
+ * in the calculation below, so we don't try to warn about that.
|
||||
+ */
|
||||
+ tmp = (u64)ftdms * n;
|
||||
+ do_div(tmp, 128 * sample_rate);
|
||||
+ cts = tmp;
|
||||
+
|
||||
+ dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n",
|
||||
+ __func__, sample_rate,
|
||||
+ ftdms / 1000000, (ftdms / 1000) % 1000,
|
||||
+ n, cts);
|
||||
+ } else
|
||||
+ cts = 0;
|
||||
|
||||
spin_lock_irq(&hdmi->audio_lock);
|
||||
hdmi->audio_n = n;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
From e7251ed74ef79b80fc5e77636832be7baf1f40a6 Mon Sep 17 00:00:00 2001
|
||||
From: Guillaume La Roque <glaroque@baylibre.com>
|
||||
Date: Fri, 4 Oct 2019 11:01:11 +0200
|
||||
Subject: [PATCH] arm64: dts: meson: g12: Add minimal thermal zone
|
||||
|
||||
Add minimal thermal zone for two temperature sensor
|
||||
One is located close to the DDR and the other one is
|
||||
located close to the PLLs (between the CPU and GPU)
|
||||
|
||||
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Tested-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12-common.dtsi | 57 +++++++++++++++++++
|
||||
1 file changed, 57 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index f153194b9bf3..a063d49b9cb1 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/reset/amlogic,meson-g12a-reset.h>
|
||||
+#include <dt-bindings/thermal/thermal.h>
|
||||
|
||||
/ {
|
||||
interrupt-parent = <&gic>;
|
||||
@@ -119,6 +120,61 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ thermal-zones {
|
||||
+ cpu_thermal: cpu-thermal {
|
||||
+ polling-delay = <1000>;
|
||||
+ polling-delay-passive = <100>;
|
||||
+ thermal-sensors = <&cpu_temp>;
|
||||
+
|
||||
+ trips {
|
||||
+ cpu_passive: cpu-passive {
|
||||
+ temperature = <85000>; /* millicelsius */
|
||||
+ hysteresis = <2000>; /* millicelsius */
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+
|
||||
+ cpu_hot: cpu-hot {
|
||||
+ temperature = <95000>; /* millicelsius */
|
||||
+ hysteresis = <2000>; /* millicelsius */
|
||||
+ type = "hot";
|
||||
+ };
|
||||
+
|
||||
+ cpu_critical: cpu-critical {
|
||||
+ temperature = <110000>; /* millicelsius */
|
||||
+ hysteresis = <2000>; /* millicelsius */
|
||||
+ type = "critical";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ ddr_thermal: ddr-thermal {
|
||||
+ polling-delay = <1000>;
|
||||
+ polling-delay-passive = <100>;
|
||||
+ thermal-sensors = <&ddr_temp>;
|
||||
+
|
||||
+ trips {
|
||||
+ ddr_passive: ddr-passive {
|
||||
+ temperature = <85000>; /* millicelsius */
|
||||
+ hysteresis = <2000>; /* millicelsius */
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+
|
||||
+ ddr_critical: ddr-critical {
|
||||
+ temperature = <110000>; /* millicelsius */
|
||||
+ hysteresis = <2000>; /* millicelsius */
|
||||
+ type = "critical";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cooling-maps {
|
||||
+ map {
|
||||
+ trip = <&ddr_passive>;
|
||||
+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
ethmac: ethernet@ff3f0000 {
|
||||
compatible = "amlogic,meson-axg-dwmac",
|
||||
"snps,dwmac-3.70a",
|
||||
@@ -2169,6 +2225,7 @@
|
||||
assigned-clock-rates = <0>, /* Do Nothing */
|
||||
<800000000>,
|
||||
<0>; /* Do Nothing */
|
||||
+ #cooling-cells = <2>;
|
||||
};
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From ca4d7cc46fc5788da89609691ccb0b001bdbdc2d Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 28 Feb 2018 16:07:18 +0100
|
||||
Subject: [PATCH 15/53] drm/meson: Call drm_crtc_vblank_on /
|
||||
drm_crtc_vblank_off
|
||||
|
||||
Make sure that the CRTC code will call the enable/disable_vblank hooks.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_crtc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
index 709475d5cc30..2680be54a1d1 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_crtc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
@@ -104,6 +104,8 @@ static void meson_crtc_atomic_enable(struct drm_crtc *crtc,
|
||||
drm_crtc_vblank_on(crtc);
|
||||
|
||||
priv->viu.osd1_enabled = true;
|
||||
+
|
||||
+ drm_crtc_vblank_on(crtc);
|
||||
}
|
||||
|
||||
static void meson_crtc_atomic_disable(struct drm_crtc *crtc,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
From 6eeaf4d2452ec8b1ece58776812140734fc2e088 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Hartung <supervisedthinking@gmail.com>
|
||||
Date: Sat, 14 Sep 2019 06:49:40 +0400
|
||||
Subject: [PATCH] arm64: dts: meson: Add capacity-dmips-mhz attributes to G12B
|
||||
|
||||
Meson G12B SoCs (S922X and A311D) are a big-little design where not all CPUs
|
||||
are equal; the A53s cores are weaker than the A72s.
|
||||
|
||||
Include capacity-dmips-mhz properties to tell the OS there is a difference
|
||||
in processing capacity. The dmips values are based on similar submissions for
|
||||
other A53/A72 SoCs: HiSilicon 3660 [1] and Rockchip RK3399 [2].
|
||||
|
||||
This change is particularly beneficial for use-cases like retro gaming where
|
||||
emulators often run on a single core. The OS now chooses an A72 core instead
|
||||
of an A53 core.
|
||||
|
||||
[1] https://lore.kernel.org/patchwork/patch/862742/
|
||||
[2] https://patchwork.kernel.org/patch/10836577/
|
||||
|
||||
Signed-off-by: Frank Hartung <supervisedthinking@gmail.com>
|
||||
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
index a9e1db0f1158..b3f9e3a02963 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi
|
||||
@@ -48,6 +48,7 @@
|
||||
compatible = "arm,cortex-a53";
|
||||
reg = <0x0 0x0>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <592>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
@@ -56,6 +57,7 @@
|
||||
compatible = "arm,cortex-a53";
|
||||
reg = <0x0 0x1>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <592>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
@@ -64,6 +66,7 @@
|
||||
compatible = "arm,cortex-a73";
|
||||
reg = <0x0 0x100>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <1024>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
@@ -72,6 +75,7 @@
|
||||
compatible = "arm,cortex-a73";
|
||||
reg = <0x0 0x101>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <1024>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
@@ -80,6 +84,7 @@
|
||||
compatible = "arm,cortex-a73";
|
||||
reg = <0x0 0x102>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <1024>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
@@ -88,6 +93,7 @@
|
||||
compatible = "arm,cortex-a73";
|
||||
reg = <0x0 0x103>;
|
||||
enable-method = "psci";
|
||||
+ capacity-dmips-mhz = <1024>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,316 +0,0 @@
|
||||
From d28f2758958eff3be784b80eff63c144d342539b 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 16/53] 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 b04f6e4aedbc..2f282b472912 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 8fa321893928..0ab16d35ac36 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 000000000000..fce33ca76bb6
|
||||
--- /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 000000000000..b4dde2fbeb3f
|
||||
--- /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
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From 83a293f5c56ec7cb763edba40c9cbf4f79ed6393 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 17/53] 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 6b64b63f2a68..fb6435431a94 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -458,6 +458,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>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 711f9cb1f13aff940cd0a469dcb1a041330af019 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 21 Oct 2019 16:29:00 +0200
|
||||
Subject: [PATCH] arm64: dts: meson-g12a: fix gpu irq order
|
||||
|
||||
This fixes the following DT schemas check errors:
|
||||
meson-g12b-s922x-khadas-vim3.dt.yaml: gpu@ffe40000: interrupt-names:0: 'job' was expected
|
||||
meson-g12b-s922x-khadas-vim3.dt.yaml: gpu@ffe40000: interrupt-names:2: 'gpu' was expected
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index a063d49b9cb1..7fabc8d9654a 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -2204,10 +2204,10 @@
|
||||
compatible = "amlogic,meson-g12a-mali", "arm,mali-bifrost";
|
||||
reg = <0x0 0xffe40000 0x0 0x40000>;
|
||||
interrupt-parent = <&gic>;
|
||||
- interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
|
||||
- <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- interrupt-names = "gpu", "mmu", "job";
|
||||
+ <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "job", "mmu", "gpu";
|
||||
clocks = <&clkc CLKID_MALI>;
|
||||
resets = <&reset RESET_DVALIN_CAPB3>, <&reset RESET_DVALIN>;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
From b1ef71bf75024008c4221e0415f84af57cd128ac Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Mon, 15 Oct 2018 14:37:18 +0200
|
||||
Subject: [PATCH 18/53] drm/meson: Use optional canvas provider
|
||||
|
||||
This is the first step into converting the meson/drm driver to use
|
||||
the canvas module.
|
||||
|
||||
If a canvas provider node is detected in DT, use it. Otherwise,
|
||||
fall back to what is currently being done.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/Kconfig | 1 +
|
||||
drivers/gpu/drm/meson/meson_crtc.c | 14 ++++++---
|
||||
drivers/gpu/drm/meson/meson_drv.c | 46 ++++++++++++++++++-----------
|
||||
drivers/gpu/drm/meson/meson_drv.h | 4 +++
|
||||
drivers/gpu/drm/meson/meson_plane.c | 8 ++++-
|
||||
5 files changed, 51 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
|
||||
index 02d400b8795c..892905825fea 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/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
index 2680be54a1d1..910b92def5d2 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_crtc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
@@ -199,10 +199,16 @@ 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);
|
||||
+ if (priv->canvas)
|
||||
+ 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);
|
||||
+ else
|
||||
+ 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);
|
||||
|
||||
/* 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 588b3b0c8315..874c7a74a7c1 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.c
|
||||
@@ -220,24 +220,33 @@ 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;
|
||||
- goto free_drm;
|
||||
- }
|
||||
+ priv->canvas = meson_canvas_get(dev);
|
||||
+ if (!IS_ERR(priv->canvas)) {
|
||||
+ ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1);
|
||||
+ if (ret)
|
||||
+ goto free_drm;
|
||||
+ } else {
|
||||
+ priv->canvas = NULL;
|
||||
|
||||
- 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);
|
||||
- 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;
|
||||
+ 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);
|
||||
+ goto free_drm;
|
||||
+ }
|
||||
}
|
||||
|
||||
priv->vsync_irq = platform_get_irq(pdev, 0);
|
||||
@@ -322,6 +331,9 @@ static void meson_drv_unbind(struct device *dev)
|
||||
struct meson_drm *priv = dev_get_drvdata(dev);
|
||||
struct drm_device *drm = priv->drm;
|
||||
|
||||
+ if (priv->canvas)
|
||||
+ meson_canvas_free(priv->canvas, priv->canvas_id_osd1);
|
||||
+
|
||||
drm_dev_unregister(drm);
|
||||
drm_irq_uninstall(drm);
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
|
||||
index 8450d6ac8c9b..728d0ca33732 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#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 {
|
||||
@@ -31,6 +32,9 @@ struct meson_drm {
|
||||
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 12c80dfcff59..51bec8e98a39 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_plane.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_plane.c
|
||||
@@ -90,6 +90,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
.y2 = state->crtc_y + state->crtc_h,
|
||||
};
|
||||
unsigned long flags;
|
||||
+ u8 canvas_id_osd1;
|
||||
|
||||
/*
|
||||
* Update Coordinates
|
||||
@@ -104,8 +105,13 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
(0xFF << OSD_GLOBAL_ALPHA_SHIFT) |
|
||||
OSD_BLK0_ENABLE;
|
||||
|
||||
+ if (priv->canvas)
|
||||
+ canvas_id_osd1 = priv->canvas_id_osd1;
|
||||
+ else
|
||||
+ canvas_id_osd1 = MESON_CANVAS_ID_OSD1;
|
||||
+
|
||||
/* 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] = ((canvas_id_osd1 << OSD_CANVAS_SEL) |
|
||||
OSD_ENDIANNESS_LE);
|
||||
|
||||
/* On GXBB, Use the old non-HDR RGB2YUV converter */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From c16450ca851dbe9b7ad58464cea210610dd0433c Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Mon, 15 Oct 2018 14:38:24 +0200
|
||||
Subject: [PATCH 19/53] arm64: dts: meson-gx: Add canvas provider node to the
|
||||
vpu
|
||||
|
||||
Allows the vpu driver to optionally use a canvas provider node.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index fb6435431a94..5012607c95d2 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -540,6 +540,7 @@
|
||||
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 {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From fcf19f29d79dfe4edce0376dd027ea7a5456ea32 Mon Sep 17 00:00:00 2001
|
||||
From: Anand Moon <linux.amoon@gmail.com>
|
||||
Date: Mon, 2 Sep 2019 05:49:33 +0000
|
||||
Subject: [PATCH] arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input
|
||||
|
||||
As per the schematic Monolithic Power Systems MP2161GJ-C499
|
||||
supply a fixed output voltage of 5.0V. This supplies linked
|
||||
to VDD_EE, HDMI_P5V0, USB_POWER, VCCK, VDDIO_AO1V8, VDDIO_AO3V3,
|
||||
VDD3V3, DDR3_1V5 according to the schematics.
|
||||
|
||||
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Cc: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 6039adda12ee..0cb5831d9daf 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -50,6 +50,15 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ p5v0: regulator-p5v0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+
|
||||
+ regulator-name = "P5V0";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
tflash_vdd: regulator-tflash_vdd {
|
||||
/*
|
||||
* signal name from schematics: TFLASH_VDD_EN
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 47a8bddb6df98cc4062661fe68ad5d4382337d0e Mon Sep 17 00:00:00 2001
|
||||
From: Anand Moon <linux.amoon@gmail.com>
|
||||
Date: Mon, 2 Sep 2019 05:49:34 +0000
|
||||
Subject: [PATCH] arm64: dts: meson: odroid-c2: Add missing linking regulator
|
||||
to usb bus
|
||||
|
||||
Add missing linking regulator node to usb bus for power usb devices.
|
||||
|
||||
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Cc: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||||
[ khilman: minor typo fixup ]
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 0cb5831d9daf..e2ce767a4324 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -36,8 +36,15 @@
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
|
||||
+ /*
|
||||
+ * signal name from schematics: PWREN
|
||||
+ */
|
||||
gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
|
||||
enable-active-high;
|
||||
+ /*
|
||||
+ * signal name from schematics: USB_POWER
|
||||
+ */
|
||||
+ vin-supply = <&p5v0>;
|
||||
};
|
||||
|
||||
leds {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,200 +0,0 @@
|
||||
From 1d7b86b1151ec8ad46c689138977c57053c99608 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 29 Oct 2018 17:04:05 +0100
|
||||
Subject: [PATCH 21/53] drm/meson: move OSD scaler management into plane atomic
|
||||
update
|
||||
|
||||
In preparation to support the Primary Plane scaling, move the basic
|
||||
OSD Interlace-Only scaler setup code into the primary plane atomic
|
||||
update callback and handle the vsync scaler update like the overlay
|
||||
plane scaling registers update.
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_crtc.c | 35 ++++++++++++----------
|
||||
drivers/gpu/drm/meson/meson_drv.h | 10 +++++++
|
||||
drivers/gpu/drm/meson/meson_plane.c | 39 +++++++++++++++++++++++-
|
||||
drivers/gpu/drm/meson/meson_vpp.c | 46 -----------------------------
|
||||
4 files changed, 68 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
index b292e9aedf52..23df4abd95c9 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_crtc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
@@ -195,21 +195,26 @@ void meson_crtc_irq(struct meson_drm *priv)
|
||||
priv->io_base + _REG(VIU_OSD1_BLK0_CFG_W3));
|
||||
writel_relaxed(priv->viu.osd1_blk0_cfg[4],
|
||||
priv->io_base + _REG(VIU_OSD1_BLK0_CFG_W4));
|
||||
-
|
||||
- /* If output is interlace, make use of the Scaler */
|
||||
- if (priv->viu.osd1_interlace) {
|
||||
- struct drm_plane *plane = priv->primary_plane;
|
||||
- struct drm_plane_state *state = plane->state;
|
||||
- struct drm_rect dest = {
|
||||
- .x1 = state->crtc_x,
|
||||
- .y1 = state->crtc_y,
|
||||
- .x2 = state->crtc_x + state->crtc_w,
|
||||
- .y2 = state->crtc_y + state->crtc_h,
|
||||
- };
|
||||
-
|
||||
- meson_vpp_setup_interlace_vscaler_osd1(priv, &dest);
|
||||
- } else
|
||||
- meson_vpp_disable_interlace_vscaler_osd1(priv);
|
||||
+ writel_relaxed(priv->viu.osd_sc_ctrl0,
|
||||
+ priv->io_base + _REG(VPP_OSD_SC_CTRL0));
|
||||
+ writel_relaxed(priv->viu.osd_sc_i_wh_m1,
|
||||
+ priv->io_base + _REG(VPP_OSD_SCI_WH_M1));
|
||||
+ writel_relaxed(priv->viu.osd_sc_o_h_start_end,
|
||||
+ priv->io_base + _REG(VPP_OSD_SCO_H_START_END));
|
||||
+ writel_relaxed(priv->viu.osd_sc_o_v_start_end,
|
||||
+ priv->io_base + _REG(VPP_OSD_SCO_V_START_END));
|
||||
+ writel_relaxed(priv->viu.osd_sc_v_ini_phase,
|
||||
+ priv->io_base + _REG(VPP_OSD_VSC_INI_PHASE));
|
||||
+ writel_relaxed(priv->viu.osd_sc_v_phase_step,
|
||||
+ priv->io_base + _REG(VPP_OSD_VSC_PHASE_STEP));
|
||||
+ writel_relaxed(priv->viu.osd_sc_h_ini_phase,
|
||||
+ priv->io_base + _REG(VPP_OSD_HSC_INI_PHASE));
|
||||
+ writel_relaxed(priv->viu.osd_sc_h_phase_step,
|
||||
+ priv->io_base + _REG(VPP_OSD_HSC_PHASE_STEP));
|
||||
+ writel_relaxed(priv->viu.osd_sc_h_ctrl0,
|
||||
+ priv->io_base + _REG(VPP_OSD_HSC_CTRL0));
|
||||
+ writel_relaxed(priv->viu.osd_sc_v_ctrl0,
|
||||
+ priv->io_base + _REG(VPP_OSD_VSC_CTRL0));
|
||||
|
||||
if (priv->canvas)
|
||||
meson_canvas_config(priv->canvas, priv->canvas_id_osd1,
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
|
||||
index c971557d4a48..a955354711ce 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.h
|
||||
@@ -54,6 +54,16 @@ struct meson_drm {
|
||||
uint32_t osd1_addr;
|
||||
uint32_t osd1_stride;
|
||||
uint32_t osd1_height;
|
||||
+ uint32_t osd_sc_ctrl0;
|
||||
+ uint32_t osd_sc_i_wh_m1;
|
||||
+ uint32_t osd_sc_o_h_start_end;
|
||||
+ uint32_t osd_sc_o_v_start_end;
|
||||
+ uint32_t osd_sc_v_ini_phase;
|
||||
+ uint32_t osd_sc_v_phase_step;
|
||||
+ uint32_t osd_sc_h_ini_phase;
|
||||
+ uint32_t osd_sc_h_phase_step;
|
||||
+ uint32_t osd_sc_h_ctrl0;
|
||||
+ uint32_t osd_sc_v_ctrl0;
|
||||
|
||||
bool vd1_enabled;
|
||||
bool vd1_commit;
|
||||
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
|
||||
index 51bec8e98a39..f915a79ae81c 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_plane.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_plane.c
|
||||
@@ -143,13 +143,50 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
break;
|
||||
};
|
||||
|
||||
+ /*
|
||||
+ * When the output is interlaced, the OSD must switch between
|
||||
+ * each field using the INTERLACE_SEL_ODD (0) of VIU_OSD1_BLK0_CFG_W0
|
||||
+ * at each vsync.
|
||||
+ * But the vertical scaler can provide such funtionnality if
|
||||
+ * is configured for 2:1 scaling with interlace options enabled.
|
||||
+ */
|
||||
if (state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) {
|
||||
priv->viu.osd1_interlace = true;
|
||||
|
||||
dest.y1 /= 2;
|
||||
dest.y2 /= 2;
|
||||
- } else
|
||||
+
|
||||
+ priv->viu.osd_sc_ctrl0 = BIT(3)| /* Enable scaler */
|
||||
+ BIT(2); /* Select OSD1 */
|
||||
+
|
||||
+ /* 2:1 scaling */
|
||||
+ priv->viu.osd_sc_i_wh_m1 = ((drm_rect_width(&dest) - 1) << 16) |
|
||||
+ (drm_rect_height(&dest) - 1);
|
||||
+ priv->viu.osd_sc_o_h_start_end = (dest.x1 << 16) | dest.x2;
|
||||
+ priv->viu.osd_sc_o_v_start_end = (dest.y1 << 16) | dest.y2;
|
||||
+
|
||||
+ /* 2:1 vertical scaling values */
|
||||
+ priv->viu.osd_sc_v_ini_phase = BIT(16);
|
||||
+ priv->viu.osd_sc_v_phase_step = BIT(25);
|
||||
+ priv->viu.osd_sc_v_ctrl0 =
|
||||
+ (4 << 0) | /* osd_vsc_bank_length */
|
||||
+ (4 << 3) | /* osd_vsc_top_ini_rcv_num0 */
|
||||
+ (1 << 8) | /* osd_vsc_top_rpt_p0_num0 */
|
||||
+ (6 << 11) | /* osd_vsc_bot_ini_rcv_num0 */
|
||||
+ (2 << 16) | /* osd_vsc_bot_rpt_p0_num0 */
|
||||
+ BIT(23) | /* osd_prog_interlace */
|
||||
+ BIT(24); /* Enable vertical scaler */
|
||||
+
|
||||
+ /* No horizontal scaling */
|
||||
+ priv->viu.osd_sc_h_ini_phase = 0;
|
||||
+ priv->viu.osd_sc_h_phase_step = 0;
|
||||
+ priv->viu.osd_sc_h_ctrl0 = 0;
|
||||
+ } else {
|
||||
priv->viu.osd1_interlace = false;
|
||||
+ priv->viu.osd_sc_ctrl0 = 0;
|
||||
+ priv->viu.osd_sc_h_ctrl0 = 0;
|
||||
+ priv->viu.osd_sc_v_ctrl0 = 0;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* The format of these registers is (x2 << 16 | x1),
|
||||
diff --git a/drivers/gpu/drm/meson/meson_vpp.c b/drivers/gpu/drm/meson/meson_vpp.c
|
||||
index 5dc24a99e978..f9efb431e953 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_vpp.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_vpp.c
|
||||
@@ -51,52 +51,6 @@ void meson_vpp_setup_mux(struct meson_drm *priv, unsigned int mux)
|
||||
writel(mux, priv->io_base + _REG(VPU_VIU_VENC_MUX_CTRL));
|
||||
}
|
||||
|
||||
-/*
|
||||
- * When the output is interlaced, the OSD must switch between
|
||||
- * each field using the INTERLACE_SEL_ODD (0) of VIU_OSD1_BLK0_CFG_W0
|
||||
- * at each vsync.
|
||||
- * But the vertical scaler can provide such funtionnality if
|
||||
- * is configured for 2:1 scaling with interlace options enabled.
|
||||
- */
|
||||
-void meson_vpp_setup_interlace_vscaler_osd1(struct meson_drm *priv,
|
||||
- struct drm_rect *input)
|
||||
-{
|
||||
- writel_relaxed(BIT(3) /* Enable scaler */ |
|
||||
- BIT(2), /* Select OSD1 */
|
||||
- priv->io_base + _REG(VPP_OSD_SC_CTRL0));
|
||||
-
|
||||
- writel_relaxed(((drm_rect_width(input) - 1) << 16) |
|
||||
- (drm_rect_height(input) - 1),
|
||||
- priv->io_base + _REG(VPP_OSD_SCI_WH_M1));
|
||||
- /* 2:1 scaling */
|
||||
- writel_relaxed(((input->x1) << 16) | (input->x2),
|
||||
- priv->io_base + _REG(VPP_OSD_SCO_H_START_END));
|
||||
- writel_relaxed(((input->y1 >> 1) << 16) | (input->y2 >> 1),
|
||||
- priv->io_base + _REG(VPP_OSD_SCO_V_START_END));
|
||||
-
|
||||
- /* 2:1 scaling values */
|
||||
- writel_relaxed(BIT(16), priv->io_base + _REG(VPP_OSD_VSC_INI_PHASE));
|
||||
- writel_relaxed(BIT(25), priv->io_base + _REG(VPP_OSD_VSC_PHASE_STEP));
|
||||
-
|
||||
- writel_relaxed(0, priv->io_base + _REG(VPP_OSD_HSC_CTRL0));
|
||||
-
|
||||
- writel_relaxed((4 << 0) /* osd_vsc_bank_length */ |
|
||||
- (4 << 3) /* osd_vsc_top_ini_rcv_num0 */ |
|
||||
- (1 << 8) /* osd_vsc_top_rpt_p0_num0 */ |
|
||||
- (6 << 11) /* osd_vsc_bot_ini_rcv_num0 */ |
|
||||
- (2 << 16) /* osd_vsc_bot_rpt_p0_num0 */ |
|
||||
- BIT(23) /* osd_prog_interlace */ |
|
||||
- BIT(24), /* Enable vertical scaler */
|
||||
- priv->io_base + _REG(VPP_OSD_VSC_CTRL0));
|
||||
-}
|
||||
-
|
||||
-void meson_vpp_disable_interlace_vscaler_osd1(struct meson_drm *priv)
|
||||
-{
|
||||
- writel_relaxed(0, priv->io_base + _REG(VPP_OSD_SC_CTRL0));
|
||||
- writel_relaxed(0, priv->io_base + _REG(VPP_OSD_VSC_CTRL0));
|
||||
- writel_relaxed(0, priv->io_base + _REG(VPP_OSD_HSC_CTRL0));
|
||||
-}
|
||||
-
|
||||
static unsigned int vpp_filter_coefs_4point_bspline[] = {
|
||||
0x15561500, 0x14561600, 0x13561700, 0x12561800,
|
||||
0x11551a00, 0x11541b00, 0x10541c00, 0x0f541d00,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 60c5abf6a8f54dee2ccb94a7ec58f73883e6c56d Mon Sep 17 00:00:00 2001
|
||||
From: Anand Moon <linux.amoon@gmail.com>
|
||||
Date: Tue, 1 Oct 2019 07:38:59 +0000
|
||||
Subject: [PATCH] arm64: dts: meson: odroid-c2: Add missing regulator linked to
|
||||
P5V0 regulator
|
||||
|
||||
As per schematics VDDIO_AO18, VDDIO_AO3V3/VDD3V3 DDR3_1V5/DDR_VDDC:
|
||||
fixed regulator output which is supplied by P5V0.
|
||||
|
||||
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Cc: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-gxbb-odroidc2.dts | 30 +++++++++++++++++++
|
||||
1 file changed, 30 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index e739f10f9442..5adecdf3b175 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -111,6 +111,36 @@
|
||||
regulator-max-microvolt = <3300000>;
|
||||
};
|
||||
|
||||
+ vddio_ao1v8: regulator-vddio-ao1v8 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "VDDIO_AO1V8";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ /* U17 RT9179GB */
|
||||
+ vin-supply = <&p5v0>;
|
||||
+ };
|
||||
+
|
||||
+ vddio_ao3v3: regulator-vddio-ao3v3 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "VDDIO_AO3V3";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ /* U11 MP2161GJ-C499 */
|
||||
+ vin-supply = <&p5v0>;
|
||||
+ };
|
||||
+
|
||||
+ ddr3_1v5: regulator-ddr3_1v5 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "DDR3_1V5";
|
||||
+ regulator-min-microvolt = <1500000>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
+ regulator-always-on;
|
||||
+ /* U15 MP2161GJ-C499 */
|
||||
+ vin-supply = <&p5v0>;
|
||||
+ };
|
||||
+
|
||||
emmc_pwrseq: emmc-pwrseq {
|
||||
compatible = "mmc-pwrseq-emmc";
|
||||
reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
From 166c3c3d19c030becc0c403cb638560d3165ff14 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Tue, 30 Oct 2018 14:29:10 +0100
|
||||
Subject: [PATCH 22/53] drm/meson: Add primary plane scaling
|
||||
|
||||
This patch adds support for the Primary Plane scaling.
|
||||
|
||||
On the Amlogic GX SoCs, the primary plane is used as On-Screen-Display
|
||||
layer on top of video, and it's needed to keep the OSD layer to a lower
|
||||
size as the physical display size to :
|
||||
- lower the memory bandwidth
|
||||
- lower the OSD rendering
|
||||
- lower the memory usage
|
||||
|
||||
This use-case is used when setting the display mode to 3840x2160 and the
|
||||
OSD layer is rendered using the GPU. In this case, the GXBB & GXL cannot
|
||||
work on more than 2000x2000 buffer, thus needing the OSD layer to be kept
|
||||
at 1920x1080 and upscaled to 3840x2160 in hardware.
|
||||
|
||||
The primary plane atomic check still allow 1:1 scaling, allowing native
|
||||
3840x2160 if needed by user-space applications.
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_plane.c | 186 +++++++++++++++++++++-------
|
||||
1 file changed, 141 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
|
||||
index f915a79ae81c..12a47b4f65a5 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_plane.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_plane.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
+#include <linux/bitfield.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
@@ -39,12 +40,50 @@
|
||||
#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
+/* OSD_SCI_WH_M1 */
|
||||
+#define SCI_WH_M1_W(w) FIELD_PREP(GENMASK(28, 16), w)
|
||||
+#define SCI_WH_M1_H(h) FIELD_PREP(GENMASK(12, 0), h)
|
||||
+
|
||||
+/* OSD_SCO_H_START_END */
|
||||
+/* OSD_SCO_V_START_END */
|
||||
+#define SCO_HV_START(start) FIELD_PREP(GENMASK(27, 16), start)
|
||||
+#define SCO_HV_END(end) FIELD_PREP(GENMASK(11, 0), end)
|
||||
+
|
||||
+/* OSD_SC_CTRL0 */
|
||||
+#define SC_CTRL0_PATH_EN BIT(3)
|
||||
+#define SC_CTRL0_SEL_OSD1 BIT(2)
|
||||
+
|
||||
+/* OSD_VSC_CTRL0 */
|
||||
+#define VSC_BANK_LEN(value) FIELD_PREP(GENMASK(2, 0), value)
|
||||
+#define VSC_TOP_INI_RCV_NUM(value) FIELD_PREP(GENMASK(6, 3), value)
|
||||
+#define VSC_TOP_RPT_L0_NUM(value) FIELD_PREP(GENMASK(9, 8), value)
|
||||
+#define VSC_BOT_INI_RCV_NUM(value) FIELD_PREP(GENMASK(14, 11), value)
|
||||
+#define VSC_BOT_RPT_L0_NUM(value) FIELD_PREP(GENMASK(17, 16), value)
|
||||
+#define VSC_PROG_INTERLACE BIT(23)
|
||||
+#define VSC_VERTICAL_SCALER_EN BIT(24)
|
||||
+
|
||||
+/* OSD_VSC_INI_PHASE */
|
||||
+#define VSC_INI_PHASE_BOT(bottom) FIELD_PREP(GENMASK(31, 16), bottom)
|
||||
+#define VSC_INI_PHASE_TOP(top) FIELD_PREP(GENMASK(15, 0), top)
|
||||
+
|
||||
+/* OSD_HSC_CTRL0 */
|
||||
+#define HSC_BANK_LENGTH(value) FIELD_PREP(GENMASK(2, 0), value)
|
||||
+#define HSC_INI_RCV_NUM0(value) FIELD_PREP(GENMASK(6, 3), value)
|
||||
+#define HSC_RPT_P0_NUM0(value) FIELD_PREP(GENMASK(9, 8), value)
|
||||
+#define HSC_HORIZ_SCALER_EN BIT(22)
|
||||
+
|
||||
+/* VPP_OSD_VSC_PHASE_STEP */
|
||||
+/* VPP_OSD_HSC_PHASE_STEP */
|
||||
+#define SC_PHASE_STEP(value) FIELD_PREP(GENMASK(27, 0), value)
|
||||
+
|
||||
struct meson_plane {
|
||||
struct drm_plane base;
|
||||
struct meson_drm *priv;
|
||||
};
|
||||
#define to_meson_plane(x) container_of(x, struct meson_plane, base)
|
||||
|
||||
+#define FRAC_16_16(mult, div) (((mult) << 16) / (div))
|
||||
+
|
||||
static int meson_plane_atomic_check(struct drm_plane *plane,
|
||||
struct drm_plane_state *state)
|
||||
{
|
||||
@@ -57,10 +96,15 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
+ /*
|
||||
+ * Only allow :
|
||||
+ * - Upscaling up to 5x, vertical and horizontal
|
||||
+ * - Final coordinates must match crtc size
|
||||
+ */
|
||||
return drm_atomic_helper_check_plane_state(state, crtc_state,
|
||||
+ FRAC_16_16(1, 5),
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
- DRM_PLANE_HELPER_NO_SCALING,
|
||||
- true, true);
|
||||
+ false, true);
|
||||
}
|
||||
|
||||
/* Takes a fixed 16.16 number and converts it to integer. */
|
||||
@@ -74,22 +118,19 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
{
|
||||
struct meson_plane *meson_plane = to_meson_plane(plane);
|
||||
struct drm_plane_state *state = plane->state;
|
||||
- struct drm_framebuffer *fb = state->fb;
|
||||
+ struct drm_rect dest = drm_plane_state_dest(state);
|
||||
struct meson_drm *priv = meson_plane->priv;
|
||||
+ struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_gem_cma_object *gem;
|
||||
- struct drm_rect src = {
|
||||
- .x1 = (state->src_x),
|
||||
- .y1 = (state->src_y),
|
||||
- .x2 = (state->src_x + state->src_w),
|
||||
- .y2 = (state->src_y + state->src_h),
|
||||
- };
|
||||
- struct drm_rect dest = {
|
||||
- .x1 = state->crtc_x,
|
||||
- .y1 = state->crtc_y,
|
||||
- .x2 = state->crtc_x + state->crtc_w,
|
||||
- .y2 = state->crtc_y + state->crtc_h,
|
||||
- };
|
||||
unsigned long flags;
|
||||
+ int vsc_ini_rcv_num, vsc_ini_rpt_p0_num;
|
||||
+ int vsc_bot_rcv_num, vsc_bot_rpt_p0_num;
|
||||
+ int hsc_ini_rcv_num, hsc_ini_rpt_p0_num;
|
||||
+ int hf_phase_step, vf_phase_step;
|
||||
+ int src_w, src_h, dst_w, dst_h;
|
||||
+ int bot_ini_phase;
|
||||
+ int hf_bank_len;
|
||||
+ int vf_bank_len;
|
||||
u8 canvas_id_osd1;
|
||||
|
||||
/*
|
||||
@@ -143,6 +184,27 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
break;
|
||||
};
|
||||
|
||||
+ /* Default scaler parameters */
|
||||
+ vsc_bot_rcv_num = 0;
|
||||
+ vsc_bot_rpt_p0_num = 0;
|
||||
+ hf_bank_len = 4;
|
||||
+ vf_bank_len = 4;
|
||||
+
|
||||
+ if (state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) {
|
||||
+ vsc_bot_rcv_num = 6;
|
||||
+ vsc_bot_rpt_p0_num = 2;
|
||||
+ }
|
||||
+
|
||||
+ hsc_ini_rcv_num = hf_bank_len;
|
||||
+ vsc_ini_rcv_num = vf_bank_len;
|
||||
+ hsc_ini_rpt_p0_num = (hf_bank_len / 2) - 1;
|
||||
+ vsc_ini_rpt_p0_num = (vf_bank_len / 2) - 1;
|
||||
+
|
||||
+ src_w = fixed16_to_int(state->src_w);
|
||||
+ src_h = fixed16_to_int(state->src_h);
|
||||
+ dst_w = state->crtc_w;
|
||||
+ dst_h = state->crtc_h;
|
||||
+
|
||||
/*
|
||||
* When the output is interlaced, the OSD must switch between
|
||||
* each field using the INTERLACE_SEL_ODD (0) of VIU_OSD1_BLK0_CFG_W0
|
||||
@@ -151,41 +213,73 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
* is configured for 2:1 scaling with interlace options enabled.
|
||||
*/
|
||||
if (state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) {
|
||||
- priv->viu.osd1_interlace = true;
|
||||
-
|
||||
dest.y1 /= 2;
|
||||
dest.y2 /= 2;
|
||||
+ dst_h /= 2;
|
||||
+ }
|
||||
|
||||
- priv->viu.osd_sc_ctrl0 = BIT(3)| /* Enable scaler */
|
||||
- BIT(2); /* Select OSD1 */
|
||||
+ hf_phase_step = ((src_w << 18) / dst_w) << 6;
|
||||
+ vf_phase_step = (src_h << 20) / dst_h;
|
||||
|
||||
- /* 2:1 scaling */
|
||||
- priv->viu.osd_sc_i_wh_m1 = ((drm_rect_width(&dest) - 1) << 16) |
|
||||
- (drm_rect_height(&dest) - 1);
|
||||
- priv->viu.osd_sc_o_h_start_end = (dest.x1 << 16) | dest.x2;
|
||||
- priv->viu.osd_sc_o_v_start_end = (dest.y1 << 16) | dest.y2;
|
||||
+ if (state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
|
||||
+ bot_ini_phase = ((vf_phase_step / 2) >> 4);
|
||||
+ else
|
||||
+ bot_ini_phase = 0;
|
||||
+
|
||||
+ vf_phase_step = (vf_phase_step << 4);
|
||||
+
|
||||
+ /* In interlaced mode, scaler is always active */
|
||||
+ if (src_h != dst_h || src_w != dst_w) {
|
||||
+ priv->viu.osd_sc_i_wh_m1 = SCI_WH_M1_W(src_w - 1) |
|
||||
+ SCI_WH_M1_H(src_h - 1);
|
||||
+ priv->viu.osd_sc_o_h_start_end = SCO_HV_START(dest.x1) |
|
||||
+ SCO_HV_END(dest.x2 - 1);
|
||||
+ priv->viu.osd_sc_o_v_start_end = SCO_HV_START(dest.y1) |
|
||||
+ SCO_HV_END(dest.y2 - 1);
|
||||
+ /* Enable OSD Scaler */
|
||||
+ priv->viu.osd_sc_ctrl0 = SC_CTRL0_PATH_EN | SC_CTRL0_SEL_OSD1;
|
||||
+ } else {
|
||||
+ priv->viu.osd_sc_i_wh_m1 = 0;
|
||||
+ priv->viu.osd_sc_o_h_start_end = 0;
|
||||
+ priv->viu.osd_sc_o_v_start_end = 0;
|
||||
+ priv->viu.osd_sc_ctrl0 = 0;
|
||||
+ }
|
||||
|
||||
- /* 2:1 vertical scaling values */
|
||||
- priv->viu.osd_sc_v_ini_phase = BIT(16);
|
||||
- priv->viu.osd_sc_v_phase_step = BIT(25);
|
||||
+ /* In interlaced mode, vertical scaler is always active */
|
||||
+ if (src_h != dst_h) {
|
||||
priv->viu.osd_sc_v_ctrl0 =
|
||||
- (4 << 0) | /* osd_vsc_bank_length */
|
||||
- (4 << 3) | /* osd_vsc_top_ini_rcv_num0 */
|
||||
- (1 << 8) | /* osd_vsc_top_rpt_p0_num0 */
|
||||
- (6 << 11) | /* osd_vsc_bot_ini_rcv_num0 */
|
||||
- (2 << 16) | /* osd_vsc_bot_rpt_p0_num0 */
|
||||
- BIT(23) | /* osd_prog_interlace */
|
||||
- BIT(24); /* Enable vertical scaler */
|
||||
-
|
||||
- /* No horizontal scaling */
|
||||
+ VSC_BANK_LEN(vf_bank_len) |
|
||||
+ VSC_TOP_INI_RCV_NUM(vsc_ini_rcv_num) |
|
||||
+ VSC_TOP_RPT_L0_NUM(vsc_ini_rpt_p0_num) |
|
||||
+ VSC_VERTICAL_SCALER_EN;
|
||||
+
|
||||
+ if (state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
|
||||
+ priv->viu.osd_sc_v_ctrl0 |=
|
||||
+ VSC_BOT_INI_RCV_NUM(vsc_bot_rcv_num) |
|
||||
+ VSC_BOT_RPT_L0_NUM(vsc_bot_rpt_p0_num) |
|
||||
+ VSC_PROG_INTERLACE;
|
||||
+
|
||||
+ priv->viu.osd_sc_v_phase_step = SC_PHASE_STEP(vf_phase_step);
|
||||
+ priv->viu.osd_sc_v_ini_phase = VSC_INI_PHASE_BOT(bot_ini_phase);
|
||||
+ } else {
|
||||
+ priv->viu.osd_sc_v_ctrl0 = 0;
|
||||
+ priv->viu.osd_sc_v_phase_step = 0;
|
||||
+ priv->viu.osd_sc_v_ini_phase = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Horizontal scaler is only used if width does not match */
|
||||
+ if (src_w != dst_w) {
|
||||
+ priv->viu.osd_sc_h_ctrl0 =
|
||||
+ HSC_BANK_LENGTH(hf_bank_len) |
|
||||
+ HSC_INI_RCV_NUM0(hsc_ini_rcv_num) |
|
||||
+ HSC_RPT_P0_NUM0(hsc_ini_rpt_p0_num) |
|
||||
+ HSC_HORIZ_SCALER_EN;
|
||||
+ priv->viu.osd_sc_h_phase_step = SC_PHASE_STEP(hf_phase_step);
|
||||
priv->viu.osd_sc_h_ini_phase = 0;
|
||||
- priv->viu.osd_sc_h_phase_step = 0;
|
||||
- priv->viu.osd_sc_h_ctrl0 = 0;
|
||||
} else {
|
||||
- priv->viu.osd1_interlace = false;
|
||||
- priv->viu.osd_sc_ctrl0 = 0;
|
||||
priv->viu.osd_sc_h_ctrl0 = 0;
|
||||
- priv->viu.osd_sc_v_ctrl0 = 0;
|
||||
+ priv->viu.osd_sc_h_phase_step = 0;
|
||||
+ priv->viu.osd_sc_h_ini_phase = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -193,10 +287,12 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
* where x2 is exclusive.
|
||||
* e.g. +30x1920 would be (1919 << 16) | 30
|
||||
*/
|
||||
- priv->viu.osd1_blk0_cfg[1] = ((fixed16_to_int(src.x2) - 1) << 16) |
|
||||
- fixed16_to_int(src.x1);
|
||||
- priv->viu.osd1_blk0_cfg[2] = ((fixed16_to_int(src.y2) - 1) << 16) |
|
||||
- fixed16_to_int(src.y1);
|
||||
+ priv->viu.osd1_blk0_cfg[1] =
|
||||
+ ((fixed16_to_int(state->src.x2) - 1) << 16) |
|
||||
+ fixed16_to_int(state->src.x1);
|
||||
+ priv->viu.osd1_blk0_cfg[2] =
|
||||
+ ((fixed16_to_int(state->src.y2) - 1) << 16) |
|
||||
+ fixed16_to_int(state->src.y1);
|
||||
priv->viu.osd1_blk0_cfg[3] = ((dest.x2 - 1) << 16) | dest.x1;
|
||||
priv->viu.osd1_blk0_cfg[4] = ((dest.y2 - 1) << 16) | dest.y1;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
From df39b5239d696e1fc9a88103f69c2d3696bdb0bc Mon Sep 17 00:00:00 2001
|
||||
From: Anand Moon <linux.amoon@gmail.com>
|
||||
Date: Tue, 1 Oct 2019 07:39:00 +0000
|
||||
Subject: [PATCH] arm64: dts: meson: odroid-c2: Add missing regulator linked to
|
||||
VDDIO_AO3V3 regulator
|
||||
|
||||
As per schematics TFLASH_VDD, TF_IO, VCC3V3 fixed regulator output which
|
||||
is supplied by VDDIO_AO3V3.
|
||||
|
||||
While here, move the comment name with the signal name in the
|
||||
schematics above the gpio property to make it consistent with other
|
||||
regulators.
|
||||
|
||||
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Cc: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 5adecdf3b175..2fcd512373a3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -67,17 +67,19 @@
|
||||
};
|
||||
|
||||
tflash_vdd: regulator-tflash_vdd {
|
||||
- /*
|
||||
- * signal name from schematics: TFLASH_VDD_EN
|
||||
- */
|
||||
compatible = "regulator-fixed";
|
||||
|
||||
regulator-name = "TFLASH_VDD";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
|
||||
+ /*
|
||||
+ * signal name from schematics: TFLASH_VDD_EN
|
||||
+ */
|
||||
gpio = <&gpio GPIOY_12 GPIO_ACTIVE_HIGH>;
|
||||
enable-active-high;
|
||||
+ /* U16 RT9179GB */
|
||||
+ vin-supply = <&vddio_ao3v3>;
|
||||
};
|
||||
|
||||
tf_io: gpio-regulator-tf_io {
|
||||
@@ -95,6 +97,8 @@
|
||||
|
||||
states = <3300000 0>,
|
||||
<1800000 1>;
|
||||
+ /* U12/U13 RT9179GB */
|
||||
+ vin-supply = <&vddio_ao3v3>;
|
||||
};
|
||||
|
||||
vcc1v8: regulator-vcc1v8 {
|
||||
@@ -102,6 +106,9 @@
|
||||
regulator-name = "VCC1V8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ /* U18 RT9179GB */
|
||||
+ vin-supply = <&vddio_ao3v3>;
|
||||
};
|
||||
|
||||
vcc3v3: regulator-vcc3v3 {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
From 47a84b0f881a1e52f95b4b31cf7ca01a88b469d4 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 7 Nov 2018 11:34:47 +0100
|
||||
Subject: [PATCH 23/53] pinctrl: meson-gxl: remove invalid GPIOX tsin_a pins
|
||||
|
||||
The GPIOX tsin_a pins wrongly uses the SDCard pinctrl bits, this
|
||||
patch completely removes these pins entries until we find out what
|
||||
are the correct bits and registers to be used instead.
|
||||
|
||||
Fixes: 5a6ae9b80139 ("pinctrl: meson-gxl: add tsin_a pins")
|
||||
---
|
||||
drivers/pinctrl/meson/pinctrl-meson-gxl.c | 12 ++----------
|
||||
1 file changed, 2 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
|
||||
index 158f618f1695..0c0a5018102b 100644
|
||||
--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c
|
||||
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
|
||||
@@ -239,13 +239,9 @@ static const unsigned int eth_link_led_pins[] = { GPIOZ_14 };
|
||||
static const unsigned int eth_act_led_pins[] = { GPIOZ_15 };
|
||||
|
||||
static const unsigned int tsin_a_d0_pins[] = { GPIODV_0 };
|
||||
-static const unsigned int tsin_a_d0_x_pins[] = { GPIOX_10 };
|
||||
static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 };
|
||||
-static const unsigned int tsin_a_clk_x_pins[] = { GPIOX_11 };
|
||||
static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 };
|
||||
-static const unsigned int tsin_a_sop_x_pins[] = { GPIOX_8 };
|
||||
static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 };
|
||||
-static const unsigned int tsin_a_d_valid_x_pins[] = { GPIOX_9 };
|
||||
static const unsigned int tsin_a_fail_pins[] = { GPIODV_11 };
|
||||
static const unsigned int tsin_a_dp_pins[] = {
|
||||
GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7,
|
||||
@@ -432,10 +428,6 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] = {
|
||||
GROUP(spi_miso, 5, 2),
|
||||
GROUP(spi_ss0, 5, 1),
|
||||
GROUP(spi_sclk, 5, 0),
|
||||
- GROUP(tsin_a_sop_x, 6, 3),
|
||||
- GROUP(tsin_a_d_valid_x, 6, 2),
|
||||
- GROUP(tsin_a_d0_x, 6, 1),
|
||||
- GROUP(tsin_a_clk_x, 6, 0),
|
||||
|
||||
/* Bank Z */
|
||||
GROUP(eth_mdio, 4, 23),
|
||||
@@ -698,8 +690,8 @@ static const char * const eth_led_groups[] = {
|
||||
};
|
||||
|
||||
static const char * const tsin_a_groups[] = {
|
||||
- "tsin_a_clk", "tsin_a_clk_x", "tsin_a_sop", "tsin_a_sop_x",
|
||||
- "tsin_a_d_valid", "tsin_a_d_valid_x", "tsin_a_d0", "tsin_a_d0_x",
|
||||
+ "tsin_a_clk", "tsin_a_sop",
|
||||
+ "tsin_a_d_valid", "tsin_a_d0",
|
||||
"tsin_a_dp", "tsin_a_fail",
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0e580116d8afa1dcab823eb31ca415c4714bf48a Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Thu, 8 Nov 2018 14:24:38 +0100
|
||||
Subject: [PATCH 24/53] arm64: dts: meson-gx: Add hdmi_5v regulator as hdmi tx
|
||||
supply
|
||||
|
||||
The hdmi_5v regulator must be enabled to provide power to the physical HDMI
|
||||
PHY and enables the HDMI 5V presence loopback for the monitor.
|
||||
|
||||
Fixes: b409f625a6d5 ("ARM64: dts: meson-gx: Add HDMI_5V regulator on selected boards")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts | 1 +
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 1 +
|
||||
5 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
index fb9ad6faa745..774f8afd2c65 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
|
||||
@@ -166,6 +166,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_5v>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
index f053595ebdc4..e5ef9b0b91c1 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
@@ -119,6 +119,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_5v>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
index f56969efffba..ca0228e0d585 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
@@ -200,6 +200,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_5v>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
index f8c66a7972b3..29c9837bd7ea 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
|
||||
@@ -96,6 +96,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_5v>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
index 4fbfa5a850cc..fe8e726a4210 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
|
||||
@@ -312,6 +312,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_5v>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 0ac0be655dbbedb50dd216a631213daab6e98d88 Mon Sep 17 00:00:00 2001
|
||||
From: Anand Moon <linux.amoon@gmail.com>
|
||||
Date: Tue, 1 Oct 2019 07:39:01 +0000
|
||||
Subject: [PATCH] arm64: dts: meson: odroid-c2: Add missing regulator linked to
|
||||
HDMI supply
|
||||
|
||||
As per schematics HDMI_P5V0 is supplied by P5V0 so add missing link.
|
||||
|
||||
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Cc: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 2fcd512373a3..6ded279c40c8 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -66,6 +66,15 @@
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
+ hdmi_p5v0: regulator-hdmi_p5v0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "HDMI_P5V0";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ /* AP2331SA-7 */
|
||||
+ vin-supply = <&p5v0>;
|
||||
+ };
|
||||
+
|
||||
tflash_vdd: regulator-tflash_vdd {
|
||||
compatible = "regulator-fixed";
|
||||
|
||||
@@ -220,6 +229,7 @@
|
||||
status = "okay";
|
||||
pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
|
||||
pinctrl-names = "default";
|
||||
+ hdmi-supply = <&hdmi_p5v0>;
|
||||
};
|
||||
|
||||
&hdmi_tx_tmds_port {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From 15611dee35c448dd0409a1e06a4f87f0dbf59876 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 7 Nov 2018 11:45:47 +0100
|
||||
Subject: [PATCH 25/53] arm64: dts: meson-gxl-libretech-cc: fix GPIO lines
|
||||
names
|
||||
|
||||
The gpio line names were set in the pinctrl node instead of the gpio node,
|
||||
at the time it was merged, it worked, but was obviously wrong.
|
||||
This patch moves the properties to the gpio nodes.
|
||||
|
||||
Fixes: 47884c5c746e ("ARM64: dts: meson-gxl-libretech-cc: Add GPIO lines names")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
index ca0228e0d585..bb2a8c750589 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts
|
||||
@@ -209,7 +209,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
-&pinctrl_aobus {
|
||||
+&gpio_ao {
|
||||
gpio-line-names = "UART TX",
|
||||
"UART RX",
|
||||
"Blue LED",
|
||||
@@ -224,7 +224,7 @@
|
||||
"7J1 Header Pin15";
|
||||
};
|
||||
|
||||
-&pinctrl_periphs {
|
||||
+&gpio {
|
||||
gpio-line-names = /* Bank GPIOZ */
|
||||
"", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 706947bf855b187bbd8d8b5786b38e84e571ca9b Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 7 Nov 2018 11:45:48 +0100
|
||||
Subject: [PATCH 26/53] arm64: dts: meson-gxbb-nanopi-k2: fix GPIO lines names
|
||||
|
||||
The gpio line names were set in the pinctrl node instead of the gpio node,
|
||||
at the time it was merged, it worked, but was obviously wrong.
|
||||
This patch moves the properties to the gpio nodes.
|
||||
|
||||
Fixes: 12ada0513d7a ("ARM64: dts: meson-gxbb-nanopi-k2: Add GPIO lines names")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
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 5b10de9a0bad..8ea5ed5a1c62 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
|
||||
@@ -236,7 +236,7 @@
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
-&pinctrl_aobus {
|
||||
+&gpio_ao {
|
||||
gpio-line-names = "UART TX", "UART RX", "Power Control", "Power Key In",
|
||||
"VCCK En", "CON1 Header Pin31",
|
||||
"I2S Header Pin6", "IR In", "I2S Header Pin7",
|
||||
@@ -246,7 +246,7 @@
|
||||
"";
|
||||
};
|
||||
|
||||
-&pinctrl_periphs {
|
||||
+&gpio {
|
||||
gpio-line-names = /* Bank GPIOZ */
|
||||
"Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
|
||||
"Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 62b3002dc67232b0a8cc5f51a5df991a48f062c7 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 7 Nov 2018 11:45:49 +0100
|
||||
Subject: [PATCH 27/53] arm64: dts: meson-gxbb-odroidc2: fix GPIO lines names
|
||||
|
||||
The gpio line names were set in the pinctrl node instead of the gpio node,
|
||||
at the time it was merged, it worked, but was obviously wrong.
|
||||
This patch moves the properties to the gpio nodes.
|
||||
|
||||
Fixes: b03c7d6438bb ("ARM64: dts: meson-gxbb-odroidc2: Add GPIO lines names")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
index 3da33090b8fe..73cc80143c04 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
|
||||
@@ -232,7 +232,7 @@
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
-&pinctrl_aobus {
|
||||
+&gpio_ao {
|
||||
gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
|
||||
"USB HUB nRESET", "USB OTG Power En",
|
||||
"J7 Header Pin2", "IR In", "J7 Header Pin4",
|
||||
@@ -242,7 +242,7 @@
|
||||
"";
|
||||
};
|
||||
|
||||
-&pinctrl_periphs {
|
||||
+&gpio {
|
||||
gpio-line-names = /* Bank GPIOZ */
|
||||
"Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
|
||||
"Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From db194607c28989a307f60f2fd89a4996b6ae4f02 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 7 Nov 2018 11:45:50 +0100
|
||||
Subject: [PATCH 28/53] arm64: dts: meson-gxl-khadas-vim: fix GPIO lines names
|
||||
|
||||
The gpio line names were set in the pinctrl node instead of the gpio node,
|
||||
at the time it was merged, it worked, but was obviously wrong.
|
||||
This patch moves the properties to the gpio nodes.
|
||||
|
||||
Fixes: 60795933b709 ("ARM64: dts: meson-gxl-khadas-vim: Add GPIO lines names")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
index e5ef9b0b91c1..1a4b3f3b8ace 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
|
||||
@@ -158,7 +158,7 @@
|
||||
linux,rc-map-name = "rc-geekbox";
|
||||
};
|
||||
|
||||
-&pinctrl_aobus {
|
||||
+&gpio_ao {
|
||||
gpio-line-names = "UART TX",
|
||||
"UART RX",
|
||||
"Power Key In",
|
||||
@@ -173,7 +173,7 @@
|
||||
"";
|
||||
};
|
||||
|
||||
-&pinctrl_periphs {
|
||||
+&gpio {
|
||||
gpio-line-names = /* Bank GPIOZ */
|
||||
"", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,330 +0,0 @@
|
||||
From b63cbf7b44a26e219c55da750662e1d0ae9f565b Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Tue, 6 Nov 2018 11:54:35 +0100
|
||||
Subject: [PATCH 29/53] drm/meson: Add support for VIC alternate timings
|
||||
|
||||
This change is an attempt to handle the alternate clock for the CEA mode.
|
||||
60Hz vs. 59.94Hz, 30Hz vs 29.97Hz or 24Hz vs 23.97Hz on the Amlogic Meson SoC
|
||||
DRM Driver pixel clock generation.
|
||||
|
||||
The actual clock generation will be moved to the Common Clock framework once
|
||||
all the video clock are handled by the Amlogic Meson SoC clock driver,
|
||||
then these alternate timings will be handled in the same time in a cleaner
|
||||
fashion.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_dw_hdmi.c | 12 +--
|
||||
drivers/gpu/drm/meson/meson_vclk.c | 127 +++++++++++++++++---------
|
||||
drivers/gpu/drm/meson/meson_vclk.h | 2 +
|
||||
3 files changed, 89 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
index 2cb2ad26d716..807111ebfdd9 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
@@ -594,17 +594,7 @@ dw_hdmi_mode_valid(struct drm_connector *connector,
|
||||
dev_dbg(connector->dev->dev, "%s: vclk:%d venc=%d hdmi=%d\n", __func__,
|
||||
vclk_freq, venc_freq, hdmi_freq);
|
||||
|
||||
- /* Finally filter by configurable vclk frequencies for VIC modes */
|
||||
- switch (vclk_freq) {
|
||||
- case 54000:
|
||||
- case 74250:
|
||||
- case 148500:
|
||||
- case 297000:
|
||||
- case 594000:
|
||||
- return MODE_OK;
|
||||
- }
|
||||
-
|
||||
- return MODE_CLOCK_RANGE;
|
||||
+ return meson_vclk_vic_supported_freq(vclk_freq);
|
||||
}
|
||||
|
||||
/* Encoder */
|
||||
diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
index ae5473257f72..5acccebd026d 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_vclk.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
@@ -117,6 +117,8 @@
|
||||
#define HDMI_PLL_RESET BIT(28)
|
||||
#define HDMI_PLL_LOCK BIT(31)
|
||||
|
||||
+#define FREQ_1000_1001(_freq) DIV_ROUND_CLOSEST(_freq * 1000, 1001)
|
||||
+
|
||||
/* VID PLL Dividers */
|
||||
enum {
|
||||
VID_PLL_DIV_1 = 0,
|
||||
@@ -323,7 +325,7 @@ static void meson_venci_cvbs_clock_config(struct meson_drm *priv)
|
||||
enum {
|
||||
/* PLL O1 O2 O3 VP DV EN TX */
|
||||
/* 4320 /4 /4 /1 /5 /1 => /2 /2 */
|
||||
- MESON_VCLK_HDMI_ENCI_54000 = 1,
|
||||
+ MESON_VCLK_HDMI_ENCI_54000 = 0,
|
||||
/* 4320 /4 /4 /1 /5 /1 => /1 /2 */
|
||||
MESON_VCLK_HDMI_DDR_54000,
|
||||
/* 2970 /4 /1 /1 /5 /1 => /1 /2 */
|
||||
@@ -339,6 +341,7 @@ enum {
|
||||
};
|
||||
|
||||
struct meson_vclk_params {
|
||||
+ unsigned int pixel_freq;
|
||||
unsigned int pll_base_freq;
|
||||
unsigned int pll_od1;
|
||||
unsigned int pll_od2;
|
||||
@@ -347,6 +350,7 @@ struct meson_vclk_params {
|
||||
unsigned int vclk_div;
|
||||
} params[] = {
|
||||
[MESON_VCLK_HDMI_ENCI_54000] = {
|
||||
+ .pixel_freq = 54000,
|
||||
.pll_base_freq = 4320000,
|
||||
.pll_od1 = 4,
|
||||
.pll_od2 = 4,
|
||||
@@ -355,6 +359,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 1,
|
||||
},
|
||||
[MESON_VCLK_HDMI_DDR_54000] = {
|
||||
+ .pixel_freq = 54000,
|
||||
.pll_base_freq = 4320000,
|
||||
.pll_od1 = 4,
|
||||
.pll_od2 = 4,
|
||||
@@ -363,6 +368,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 1,
|
||||
},
|
||||
[MESON_VCLK_HDMI_DDR_148500] = {
|
||||
+ .pixel_freq = 148500,
|
||||
.pll_base_freq = 2970000,
|
||||
.pll_od1 = 4,
|
||||
.pll_od2 = 1,
|
||||
@@ -371,6 +377,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 1,
|
||||
},
|
||||
[MESON_VCLK_HDMI_74250] = {
|
||||
+ .pixel_freq = 74250,
|
||||
.pll_base_freq = 2970000,
|
||||
.pll_od1 = 2,
|
||||
.pll_od2 = 2,
|
||||
@@ -379,6 +386,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 1,
|
||||
},
|
||||
[MESON_VCLK_HDMI_148500] = {
|
||||
+ .pixel_freq = 148500,
|
||||
.pll_base_freq = 2970000,
|
||||
.pll_od1 = 1,
|
||||
.pll_od2 = 2,
|
||||
@@ -387,6 +395,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 1,
|
||||
},
|
||||
[MESON_VCLK_HDMI_297000] = {
|
||||
+ .pixel_freq = 297000,
|
||||
.pll_base_freq = 2970000,
|
||||
.pll_od1 = 1,
|
||||
.pll_od2 = 1,
|
||||
@@ -395,6 +404,7 @@ struct meson_vclk_params {
|
||||
.vclk_div = 2,
|
||||
},
|
||||
[MESON_VCLK_HDMI_594000] = {
|
||||
+ .pixel_freq = 594000,
|
||||
.pll_base_freq = 5940000,
|
||||
.pll_od1 = 1,
|
||||
.pll_od2 = 1,
|
||||
@@ -402,6 +412,7 @@ struct meson_vclk_params {
|
||||
.vid_pll_div = VID_PLL_DIV_5,
|
||||
.vclk_div = 1,
|
||||
},
|
||||
+ { /* sentinel */ },
|
||||
};
|
||||
|
||||
static inline unsigned int pll_od_to_reg(unsigned int od)
|
||||
@@ -626,12 +637,37 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv,
|
||||
pll_freq);
|
||||
}
|
||||
|
||||
+enum drm_mode_status
|
||||
+meson_vclk_vic_supported_freq(unsigned int freq)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ DRM_DEBUG_DRIVER("freq = %d\n", freq);
|
||||
+
|
||||
+ for (i = 0 ; params[i].pixel_freq ; ++i) {
|
||||
+ DRM_DEBUG_DRIVER("i = %d pixel_freq = %d alt = %d\n",
|
||||
+ i, params[i].pixel_freq,
|
||||
+ FREQ_1000_1001(params[i].pixel_freq));
|
||||
+ /* Match strict frequency */
|
||||
+ if (freq == params[i].pixel_freq)
|
||||
+ return MODE_OK;
|
||||
+ /* Match 1000/1001 variant */
|
||||
+ if (freq == FREQ_1000_1001(params[i].pixel_freq))
|
||||
+ return MODE_OK;
|
||||
+ }
|
||||
+
|
||||
+ return MODE_CLOCK_RANGE;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_vclk_vic_supported_freq);
|
||||
+
|
||||
static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
|
||||
unsigned int od1, unsigned int od2, unsigned int od3,
|
||||
unsigned int vid_pll_div, unsigned int vclk_div,
|
||||
unsigned int hdmi_tx_div, unsigned int venc_div,
|
||||
- bool hdmi_use_enci)
|
||||
+ bool hdmi_use_enci, bool vic_alternate_clock)
|
||||
{
|
||||
+ unsigned int m, frac;
|
||||
+
|
||||
/* Set HDMI-TX sys clock */
|
||||
regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL,
|
||||
CTS_HDMI_SYS_SEL_MASK, 0);
|
||||
@@ -646,34 +682,38 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
|
||||
} else if (meson_vpu_is_compatible(priv, "amlogic,meson-gxbb-vpu")) {
|
||||
switch (pll_base_freq) {
|
||||
case 2970000:
|
||||
- meson_hdmi_pll_set_params(priv, 0x3d, 0xe00,
|
||||
- od1, od2, od3);
|
||||
+ m = 0x3d;
|
||||
+ frac = vic_alternate_clock ? 0xd02 : 0xe00;
|
||||
break;
|
||||
case 4320000:
|
||||
- meson_hdmi_pll_set_params(priv, 0x5a, 0,
|
||||
- od1, od2, od3);
|
||||
+ m = vic_alternate_clock ? 0x59 : 0x5a;
|
||||
+ frac = vic_alternate_clock ? 0xe8f : 0;
|
||||
break;
|
||||
case 5940000:
|
||||
- meson_hdmi_pll_set_params(priv, 0x7b, 0xc00,
|
||||
- od1, od2, od3);
|
||||
+ m = 0x7b;
|
||||
+ frac = vic_alternate_clock ? 0xa05 : 0xc00;
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
|
||||
} else if (meson_vpu_is_compatible(priv, "amlogic,meson-gxm-vpu") ||
|
||||
meson_vpu_is_compatible(priv, "amlogic,meson-gxl-vpu")) {
|
||||
switch (pll_base_freq) {
|
||||
case 2970000:
|
||||
- meson_hdmi_pll_set_params(priv, 0x7b, 0x300,
|
||||
- od1, od2, od3);
|
||||
+ m = 0x7b;
|
||||
+ frac = vic_alternate_clock ? 0x281 : 0x300;
|
||||
break;
|
||||
case 4320000:
|
||||
- meson_hdmi_pll_set_params(priv, 0xb4, 0,
|
||||
- od1, od2, od3);
|
||||
+ m = vic_alternate_clock ? 0xb3 : 0xb4;
|
||||
+ frac = vic_alternate_clock ? 0x347 : 0;
|
||||
break;
|
||||
case 5940000:
|
||||
- meson_hdmi_pll_set_params(priv, 0xf7, 0x200,
|
||||
- od1, od2, od3);
|
||||
+ m = 0xf7;
|
||||
+ frac = vic_alternate_clock ? 0x102 : 0x200;
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
|
||||
}
|
||||
|
||||
/* Setup vid_pll divider */
|
||||
@@ -826,6 +866,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
|
||||
unsigned int vclk_freq, unsigned int venc_freq,
|
||||
unsigned int dac_freq, bool hdmi_use_enci)
|
||||
{
|
||||
+ bool vic_alternate_clock = false;
|
||||
unsigned int freq;
|
||||
unsigned int hdmi_tx_div;
|
||||
unsigned int venc_div;
|
||||
@@ -843,7 +884,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
|
||||
* - encp encoder
|
||||
*/
|
||||
meson_vclk_set(priv, vclk_freq * 10, 0, 0, 0,
|
||||
- VID_PLL_DIV_5, 2, 1, 1, false);
|
||||
+ VID_PLL_DIV_5, 2, 1, 1, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -863,31 +904,35 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
|
||||
return;
|
||||
}
|
||||
|
||||
- switch (vclk_freq) {
|
||||
- case 54000:
|
||||
- if (hdmi_use_enci)
|
||||
- freq = MESON_VCLK_HDMI_ENCI_54000;
|
||||
- else
|
||||
- freq = MESON_VCLK_HDMI_DDR_54000;
|
||||
- break;
|
||||
- case 74250:
|
||||
- freq = MESON_VCLK_HDMI_74250;
|
||||
- break;
|
||||
- case 148500:
|
||||
- if (dac_freq != 148500)
|
||||
- freq = MESON_VCLK_HDMI_DDR_148500;
|
||||
- else
|
||||
- freq = MESON_VCLK_HDMI_148500;
|
||||
- break;
|
||||
- case 297000:
|
||||
- freq = MESON_VCLK_HDMI_297000;
|
||||
- break;
|
||||
- case 594000:
|
||||
- freq = MESON_VCLK_HDMI_594000;
|
||||
- break;
|
||||
- default:
|
||||
- pr_err("Fatal Error, invalid HDMI vclk freq %d\n",
|
||||
- vclk_freq);
|
||||
+ for (freq = 0 ; params[freq].pixel_freq ; ++freq) {
|
||||
+ if (vclk_freq == params[freq].pixel_freq ||
|
||||
+ vclk_freq == FREQ_1000_1001(params[freq].pixel_freq)) {
|
||||
+ if (vclk_freq != params[freq].pixel_freq)
|
||||
+ vic_alternate_clock = true;
|
||||
+ else
|
||||
+ vic_alternate_clock = false;
|
||||
+
|
||||
+ if (freq == MESON_VCLK_HDMI_ENCI_54000 &&
|
||||
+ !hdmi_use_enci)
|
||||
+ continue;
|
||||
+
|
||||
+ if (freq == MESON_VCLK_HDMI_DDR_54000 &&
|
||||
+ hdmi_use_enci)
|
||||
+ continue;
|
||||
+
|
||||
+ if (freq == MESON_VCLK_HDMI_DDR_148500 &&
|
||||
+ dac_freq == vclk_freq)
|
||||
+ continue;
|
||||
+
|
||||
+ if (freq == MESON_VCLK_HDMI_148500 &&
|
||||
+ dac_freq != vclk_freq)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!params[freq].pixel_freq) {
|
||||
+ pr_err("Fatal Error, invalid HDMI vclk freq %d\n", vclk_freq);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -895,6 +940,6 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
|
||||
params[freq].pll_od1, params[freq].pll_od2,
|
||||
params[freq].pll_od3, params[freq].vid_pll_div,
|
||||
params[freq].vclk_div, hdmi_tx_div, venc_div,
|
||||
- hdmi_use_enci);
|
||||
+ hdmi_use_enci, vic_alternate_clock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(meson_vclk_setup);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_vclk.h b/drivers/gpu/drm/meson/meson_vclk.h
|
||||
index 869fa3a3073e..4bd8752da02a 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_vclk.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_vclk.h
|
||||
@@ -32,6 +32,8 @@ enum {
|
||||
|
||||
enum drm_mode_status
|
||||
meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq);
|
||||
+enum drm_mode_status
|
||||
+meson_vclk_vic_supported_freq(unsigned int freq);
|
||||
|
||||
void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
|
||||
unsigned int vclk_freq, unsigned int venc_freq,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
From c8482bffc8ced44e3e22f403413b23c7b20af1be Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Tue, 4 Sep 2018 10:07:08 +0200
|
||||
Subject: [PATCH 31/53] MAINTAINERS: Add meson video decoder
|
||||
|
||||
Add an entry for the meson video decoder for amlogic SoCs.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
MAINTAINERS | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 11a59e82d92e..d2c0c0f8b406 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -9526,6 +9526,14 @@ F: drivers/media/platform/meson/ao-cec.c
|
||||
F: Documentation/devicetree/bindings/media/meson-ao-cec.txt
|
||||
T: git git://linuxtv.org/media_tree.git
|
||||
|
||||
+MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS
|
||||
+M: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
+L: linux-media@lists.freedesktop.org
|
||||
+L: linux-amlogic@lists.infradead.org
|
||||
+S: Supported
|
||||
+F: drivers/media/platform/meson/vdec/
|
||||
+T: git git://linuxtv.org/media_tree.git
|
||||
+
|
||||
MICROBLAZE ARCHITECTURE
|
||||
M: Michal Simek <monstr@monstr.eu>
|
||||
W: http://www.monstr.eu/fdt/
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 91e2dc23af4fb673e609a4fddf2b813ea3f833b8 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:02 +0200
|
||||
Subject: [PATCH 32/53] 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 | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 5012607c95d2..5d2820ef9a88 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -445,6 +445,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ 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>;
|
||||
+ interrupt-names = "vdec", "esparser";
|
||||
+
|
||||
+ amlogic,ao-sysctrl = <&sysctrl_AO>;
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+ };
|
||||
+
|
||||
periphs: periphs@c8834000 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0xc8834000 0x0 0x2000>;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
From f9f1d0b0b197f94502ea2a13a27d6d4534f8150f Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:22 +0200
|
||||
Subject: [PATCH 33/53] 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 | 10 ++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 10 ++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 4 ++++
|
||||
3 files changed, 24 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
index 2a4d506bad4e..96145e49ea44 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
@@ -814,3 +814,13 @@
|
||||
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 9f4b6185a61d..6ca93ae1e496 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
@@ -814,3 +814,13 @@
|
||||
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 247888d68a3a..2f356495be5e 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";
|
||||
+};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
From c5ad2d518874fe080e249c2a11497064c28d9b1b Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 10 Oct 2018 17:22:27 +0200
|
||||
Subject: [PATCH 34/53] meson: vdec: introduce controls and
|
||||
V4L2_CID_MIN_BUFFERS_FOR_CAPTURE
|
||||
|
||||
---
|
||||
drivers/media/platform/meson/vdec/Makefile | 2 +-
|
||||
drivers/media/platform/meson/vdec/vdec.c | 7 +++
|
||||
drivers/media/platform/meson/vdec/vdec.h | 2 +
|
||||
.../media/platform/meson/vdec/vdec_ctrls.c | 45 +++++++++++++++++++
|
||||
.../media/platform/meson/vdec/vdec_ctrls.h | 8 ++++
|
||||
5 files changed, 63 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/media/platform/meson/vdec/vdec_ctrls.c
|
||||
create mode 100644 drivers/media/platform/meson/vdec/vdec_ctrls.h
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/Makefile b/drivers/media/platform/meson/vdec/Makefile
|
||||
index 6bea129084b7..eba86083aadb 100644
|
||||
--- a/drivers/media/platform/meson/vdec/Makefile
|
||||
+++ b/drivers/media/platform/meson/vdec/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Makefile for Amlogic meson video decoder driver
|
||||
|
||||
-meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o
|
||||
+meson-vdec-objs = esparser.o vdec.o vdec_ctrls.o vdec_helpers.o vdec_platform.o
|
||||
meson-vdec-objs += vdec_1.o
|
||||
meson-vdec-objs += codec_mpeg12.o
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec.c b/drivers/media/platform/meson/vdec/vdec.c
|
||||
index d8db52c01fbe..1c5d3e912bee 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "vdec.h"
|
||||
#include "esparser.h"
|
||||
#include "vdec_helpers.h"
|
||||
+#include "vdec_ctrls.h"
|
||||
|
||||
struct dummy_buf {
|
||||
struct vb2_v4l2_buffer vb;
|
||||
@@ -290,6 +291,7 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
sess->keyframe_found = 0;
|
||||
sess->last_offset = 0;
|
||||
sess->wrap_count = 0;
|
||||
+ sess->dpb_size = 0;
|
||||
sess->pixelaspect.numerator = 1;
|
||||
sess->pixelaspect.denominator = 1;
|
||||
atomic_set(&sess->esparser_queued_bufs, 0);
|
||||
@@ -812,6 +814,10 @@ static int vdec_open(struct file *file)
|
||||
goto err_m2m_release;
|
||||
}
|
||||
|
||||
+ ret = amvdec_init_ctrls(&sess->ctrl_handler);
|
||||
+ if (ret)
|
||||
+ goto err_m2m_release;
|
||||
+
|
||||
sess->pixfmt_cap = formats[0].pixfmts_cap[0];
|
||||
sess->fmt_out = &formats[0];
|
||||
sess->width = 1280;
|
||||
@@ -827,6 +833,7 @@ static int vdec_open(struct file *file)
|
||||
spin_lock_init(&sess->ts_spinlock);
|
||||
|
||||
v4l2_fh_init(&sess->fh, core->vdev_dec);
|
||||
+ sess->fh.ctrl_handler = &sess->ctrl_handler;
|
||||
v4l2_fh_add(&sess->fh);
|
||||
sess->fh.m2m_ctx = sess->m2m_ctx;
|
||||
file->private_data = &sess->fh;
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec.h b/drivers/media/platform/meson/vdec/vdec.h
|
||||
index 4e8c3f1742ac..6be7de2849b6 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec.h
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec.h
|
||||
@@ -203,6 +203,7 @@ struct amvdec_session {
|
||||
struct v4l2_fh fh;
|
||||
struct v4l2_m2m_dev *m2m_dev;
|
||||
struct v4l2_m2m_ctx *m2m_ctx;
|
||||
+ struct v4l2_ctrl_handler ctrl_handler;
|
||||
struct mutex lock;
|
||||
|
||||
const struct amvdec_format *fmt_out;
|
||||
@@ -242,6 +243,7 @@ struct amvdec_session {
|
||||
u64 last_irq_jiffies;
|
||||
u32 last_offset;
|
||||
u32 wrap_count;
|
||||
+ u32 dpb_size;
|
||||
|
||||
void *priv;
|
||||
};
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_ctrls.c b/drivers/media/platform/meson/vdec/vdec_ctrls.c
|
||||
new file mode 100644
|
||||
index 000000000000..cd6dd6d87172
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_ctrls.c
|
||||
@@ -0,0 +1,45 @@
|
||||
+#include "vdec_ctrls.h"
|
||||
+
|
||||
+static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ struct amvdec_session *sess =
|
||||
+ container_of(ctrl->handler, struct amvdec_session, ctrl_handler);
|
||||
+
|
||||
+ switch (ctrl->id) {
|
||||
+ case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
|
||||
+ ctrl->val = sess->dpb_size;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ };
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct v4l2_ctrl_ops vdec_ctrl_ops = {
|
||||
+ .g_volatile_ctrl = vdec_op_g_volatile_ctrl,
|
||||
+};
|
||||
+
|
||||
+int amvdec_init_ctrls(struct v4l2_ctrl_handler *ctrl_handler)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct v4l2_ctrl *ctrl;
|
||||
+
|
||||
+ ret = v4l2_ctrl_handler_init(ctrl_handler, 1);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ctrl = v4l2_ctrl_new_std(ctrl_handler, &vdec_ctrl_ops,
|
||||
+ V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 1, 32, 1, 1);
|
||||
+ if (ctrl)
|
||||
+ ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
|
||||
+
|
||||
+ ret = ctrl_handler->error;
|
||||
+ if (ret) {
|
||||
+ v4l2_ctrl_handler_free(ctrl_handler);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(amvdec_init_ctrls);
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_ctrls.h b/drivers/media/platform/meson/vdec/vdec_ctrls.h
|
||||
new file mode 100644
|
||||
index 000000000000..4bcc5e68865c
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_ctrls.h
|
||||
@@ -0,0 +1,8 @@
|
||||
+#ifndef __MESON_VDEC_CTRLS_H_
|
||||
+#define __MESON_VDEC_CTRLS_H_
|
||||
+
|
||||
+#include "vdec.h"
|
||||
+
|
||||
+int amvdec_init_ctrls(struct v4l2_ctrl_handler *ctrl_handler);
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 2688d1304cbb41d4e2c8514ec2bdcd2b48f2f88a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Thu, 4 Oct 2018 15:37:39 +0200
|
||||
Subject: [PATCH 35/53] media: videodev2: add V4L2_FMT_FLAG_NO_SOURCE_CHANGE
|
||||
|
||||
When a v4l2 driver exposes V4L2_EVENT_SOURCE_CHANGE, some (usually
|
||||
OUTPUT) formats may not be able to trigger this event.
|
||||
|
||||
Add a enum_fmt format flag to tag those specific formats.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 5 +++++
|
||||
include/uapi/linux/videodev2.h | 5 +++--
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
|
||||
index 019c513df217..e0040b36ac43 100644
|
||||
--- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
|
||||
+++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
|
||||
@@ -116,6 +116,11 @@ one until ``EINVAL`` is returned.
|
||||
- This format is not native to the device but emulated through
|
||||
software (usually libv4l2), where possible try to use a native
|
||||
format instead for better performance.
|
||||
+ * - ``V4L2_FMT_FLAG_NO_SOURCE_CHANGE``
|
||||
+ - 0x0004
|
||||
+ - The event ``V4L2_EVENT_SOURCE_CHANGE`` is not supported
|
||||
+ for this format.
|
||||
+
|
||||
|
||||
|
||||
Return Value
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 1aae2e4b8f10..f44bdef62d0b 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -733,8 +733,9 @@ struct v4l2_fmtdesc {
|
||||
__u32 reserved[4];
|
||||
};
|
||||
|
||||
-#define V4L2_FMT_FLAG_COMPRESSED 0x0001
|
||||
-#define V4L2_FMT_FLAG_EMULATED 0x0002
|
||||
+#define V4L2_FMT_FLAG_COMPRESSED 0x0001
|
||||
+#define V4L2_FMT_FLAG_EMULATED 0x0002
|
||||
+#define V4L2_FMT_FLAG_NO_SOURCE_CHANGE 0x0004
|
||||
|
||||
/* Frame Size and frame rate enumeration */
|
||||
/*
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
From b1d313fb821e3a4196bb32c86c585b8be23d491a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 10 Oct 2018 15:44:56 +0200
|
||||
Subject: [PATCH 36/53] meson: vdec: allow subscribing to
|
||||
V4L2_EVENT_SOURCE_CHANGE
|
||||
|
||||
Flag MPEG1/MPEG2 as NO_SOURCE_CHANGE.
|
||||
---
|
||||
drivers/media/platform/meson/vdec/vdec.c | 20 +++++++++++--
|
||||
drivers/media/platform/meson/vdec/vdec.h | 13 +++++++++
|
||||
.../media/platform/meson/vdec/vdec_helpers.c | 28 +++++++++++++++++++
|
||||
.../media/platform/meson/vdec/vdec_helpers.h | 1 +
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 6 ++++
|
||||
5 files changed, 66 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec.c b/drivers/media/platform/meson/vdec/vdec.c
|
||||
index 1c5d3e912bee..ca6404546eb8 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec.c
|
||||
@@ -230,7 +230,8 @@ static int vdec_queue_setup(struct vb2_queue *q,
|
||||
* are free to choose any of them to write frames to. As such,
|
||||
* we need all of them to be queued into the driver
|
||||
*/
|
||||
- q->min_buffers_needed = q->num_buffers + *num_buffers;
|
||||
+ sess->num_dst_bufs = q->num_buffers + *num_buffers;
|
||||
+ q->min_buffers_needed = sess->num_dst_bufs;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -260,6 +261,7 @@ static void vdec_vb2_buf_queue(struct vb2_buffer *vb)
|
||||
static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
{
|
||||
struct amvdec_session *sess = vb2_get_drv_priv(q);
|
||||
+ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops;
|
||||
struct amvdec_core *core = sess->core;
|
||||
struct vb2_v4l2_buffer *buf;
|
||||
int ret;
|
||||
@@ -277,6 +279,13 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
if (!sess->streamon_out || !sess->streamon_cap)
|
||||
return 0;
|
||||
|
||||
+ if (sess->status == STATUS_NEEDS_RESUME &&
|
||||
+ q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
|
||||
+ codec_ops->resume(sess);
|
||||
+ sess->status = STATUS_RUNNING;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
sess->vififo_size = SIZE_VIFIFO;
|
||||
sess->vififo_vaddr =
|
||||
dma_alloc_coherent(sess->core->dev, sess->vififo_size,
|
||||
@@ -305,6 +314,7 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
sess->recycle_thread = kthread_run(vdec_recycle_thread, sess,
|
||||
"vdec_recycle");
|
||||
|
||||
+ sess->status = STATUS_RUNNING;
|
||||
core->cur_sess = sess;
|
||||
|
||||
return 0;
|
||||
@@ -362,7 +372,9 @@ static void vdec_stop_streaming(struct vb2_queue *q)
|
||||
struct amvdec_core *core = sess->core;
|
||||
struct vb2_v4l2_buffer *buf;
|
||||
|
||||
- if (sess->streamon_out && sess->streamon_cap) {
|
||||
+ if (sess->status == STATUS_RUNNING ||
|
||||
+ (sess->status == STATUS_NEEDS_RESUME &&
|
||||
+ (!sess->streamon_out || !sess->streamon_cap))) {
|
||||
if (vdec_codec_needs_recycle(sess))
|
||||
kthread_stop(sess->recycle_thread);
|
||||
|
||||
@@ -375,6 +387,7 @@ static void vdec_stop_streaming(struct vb2_queue *q)
|
||||
kfree(sess->priv);
|
||||
sess->priv = NULL;
|
||||
core->cur_sess = NULL;
|
||||
+ sess->status = STATUS_STOPPED;
|
||||
}
|
||||
|
||||
if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
|
||||
@@ -611,6 +624,7 @@ static int vdec_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f)
|
||||
|
||||
fmt_out = &platform->formats[f->index];
|
||||
f->pixelformat = fmt_out->pixfmt;
|
||||
+ f->flags = fmt_out->flags;
|
||||
} else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
|
||||
fmt_out = sess->fmt_out;
|
||||
if (f->index >= 4 || !fmt_out->pixfmts_cap[f->index])
|
||||
@@ -703,6 +717,8 @@ static int vdec_subscribe_event(struct v4l2_fh *fh,
|
||||
switch (sub->type) {
|
||||
case V4L2_EVENT_EOS:
|
||||
return v4l2_event_subscribe(fh, sub, 2, NULL);
|
||||
+ case V4L2_EVENT_SOURCE_CHANGE:
|
||||
+ return v4l2_src_change_event_subscribe(fh, sub);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec.h b/drivers/media/platform/meson/vdec/vdec.h
|
||||
index 6be7de2849b6..8f8ce629c698 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec.h
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec.h
|
||||
@@ -101,6 +101,7 @@ struct amvdec_ops {
|
||||
u32 (*vififo_level)(struct amvdec_session *sess);
|
||||
};
|
||||
|
||||
+
|
||||
/**
|
||||
* struct amvdec_codec_ops - codec operations
|
||||
*
|
||||
@@ -127,6 +128,7 @@ struct amvdec_codec_ops {
|
||||
int (*can_recycle)(struct amvdec_core *core);
|
||||
void (*recycle)(struct amvdec_core *core, u32 buf_idx);
|
||||
void (*drain)(struct amvdec_session *sess);
|
||||
+ void (*resume)(struct amvdec_session *sess);
|
||||
const u8 * (*eos_sequence)(u32 *len);
|
||||
irqreturn_t (*isr)(struct amvdec_session *sess);
|
||||
irqreturn_t (*threaded_isr)(struct amvdec_session *sess);
|
||||
@@ -140,6 +142,7 @@ struct amvdec_codec_ops {
|
||||
* @max_buffers: maximum amount of CAPTURE (dst) buffers
|
||||
* @max_width: maximum picture width supported
|
||||
* @max_height: maximum picture height supported
|
||||
+ * @flags: enum flags associated with this pixfmt
|
||||
* @vdec_ops: the VDEC operations that support this format
|
||||
* @codec_ops: the codec operations that support this format
|
||||
* @firmware_path: Path to the firmware that supports this format
|
||||
@@ -151,6 +154,7 @@ struct amvdec_format {
|
||||
u32 max_buffers;
|
||||
u32 max_width;
|
||||
u32 max_height;
|
||||
+ u32 flags;
|
||||
|
||||
struct amvdec_ops *vdec_ops;
|
||||
struct amvdec_codec_ops *codec_ops;
|
||||
@@ -159,6 +163,12 @@ struct amvdec_format {
|
||||
u32 pixfmts_cap[4];
|
||||
};
|
||||
|
||||
+enum amvdec_status {
|
||||
+ STATUS_STOPPED,
|
||||
+ STATUS_RUNNING,
|
||||
+ STATUS_NEEDS_RESUME,
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* struct amvdec_session - decoding session parameters
|
||||
*
|
||||
@@ -195,6 +205,7 @@ struct amvdec_format {
|
||||
* @timestamps: chronological list of src timestamps
|
||||
* @ts_spinlock: spinlock for the timestamps list
|
||||
* @last_irq_jiffies: tracks last time the vdec triggered an IRQ
|
||||
+ * @status: current decoding status
|
||||
* @priv: codec private data
|
||||
*/
|
||||
struct amvdec_session {
|
||||
@@ -225,6 +236,7 @@ struct amvdec_session {
|
||||
unsigned int sequence_cap;
|
||||
unsigned int should_stop;
|
||||
unsigned int keyframe_found;
|
||||
+ unsigned int num_dst_bufs;
|
||||
|
||||
u8 canvas_alloc[MAX_CANVAS];
|
||||
u32 canvas_num;
|
||||
@@ -245,6 +257,7 @@ struct amvdec_session {
|
||||
u32 wrap_count;
|
||||
u32 dpb_size;
|
||||
|
||||
+ enum amvdec_status status;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_helpers.c b/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
index 02090c5b089e..b982b2869fd2 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_helpers.c
|
||||
@@ -403,6 +403,34 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amvdec_set_par_from_dar);
|
||||
|
||||
+void amvdec_src_change(struct amvdec_session *sess, u32 width, u32 height, u32 dpb_size)
|
||||
+{
|
||||
+ static const struct v4l2_event ev = {
|
||||
+ .type = V4L2_EVENT_SOURCE_CHANGE,
|
||||
+ .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION };
|
||||
+
|
||||
+ sess->dpb_size = dpb_size;
|
||||
+
|
||||
+ /* Check if the capture queue is already configured well for our
|
||||
+ * usecase. If so, keep decoding with it and do not send the event
|
||||
+ */
|
||||
+ if (sess->width == width &&
|
||||
+ sess->height == height &&
|
||||
+ dpb_size <= sess->num_dst_bufs) {
|
||||
+ sess->fmt_out->codec_ops->resume(sess);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ sess->width = width;
|
||||
+ sess->height = height;
|
||||
+ sess->status = STATUS_NEEDS_RESUME;
|
||||
+
|
||||
+ dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB size %u\n",
|
||||
+ width, height, dpb_size);
|
||||
+ v4l2_event_queue_fh(&sess->fh, &ev);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(amvdec_src_change);
|
||||
+
|
||||
void amvdec_abort(struct amvdec_session *sess)
|
||||
{
|
||||
dev_info(sess->core->dev, "Aborting decoding session!\n");
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_helpers.h b/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
index b9250a8157c4..060799b5e4d4 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_helpers.h
|
||||
@@ -44,5 +44,6 @@ void amvdec_remove_ts(struct amvdec_session *sess, u64 ts);
|
||||
void amvdec_set_par_from_dar(struct amvdec_session *sess,
|
||||
u32 dar_num, u32 dar_den);
|
||||
|
||||
+void amvdec_src_change(struct amvdec_session *sess, u32 width, u32 height, u32 dpb_size);
|
||||
void amvdec_abort(struct amvdec_session *sess);
|
||||
#endif
|
||||
diff --git a/drivers/media/platform/meson/vdec/vdec_platform.c b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
index 46eeb7426f54..291f1eeb27d9 100644
|
||||
--- a/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
+++ b/drivers/media/platform/meson/vdec/vdec_platform.c
|
||||
@@ -17,6 +17,7 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
@@ -27,6 +28,7 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
@@ -41,6 +43,7 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
@@ -51,6 +54,7 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
@@ -65,6 +69,7 @@ static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
@@ -75,6 +80,7 @@ static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
.max_buffers = 8,
|
||||
.max_width = 1920,
|
||||
.max_height = 1080,
|
||||
+ .flags = V4L2_FMT_FLAG_NO_SOURCE_CHANGE,
|
||||
.vdec_ops = &vdec_1_ops,
|
||||
.codec_ops = &codec_mpeg12_ops,
|
||||
.firmware_path = "meson/gx/vmpeg12_mc",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,593 +0,0 @@
|
||||
From fecc45672255e63d4e99b9eaf24ac00083a5d4b6 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:42:56 +0200
|
||||
Subject: [PATCH 37/53] 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 | 478 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_h264.h | 13 +
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 31 ++
|
||||
4 files changed, 523 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 eba86083aadb..01dc9603abdd 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_ctrls.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 000000000000..6ac0115afaa3
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_h264.c
|
||||
@@ -0,0 +1,478 @@
|
||||
+// 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
|
||||
+
|
||||
+/* ISR status */
|
||||
+#define CMD_MASK GENMASK(7, 0)
|
||||
+#define CMD_SRC_CHANGE 1
|
||||
+#define CMD_FRAMES_READY 2
|
||||
+#define CMD_FATAL_ERROR 6
|
||||
+#define CMD_BAD_WIDTH 7
|
||||
+#define CMD_BAD_HEIGHT 8
|
||||
+
|
||||
+#define SEI_DATA_READY BIT(15)
|
||||
+
|
||||
+/* Picture type */
|
||||
+#define PIC_TOP_BOT 5
|
||||
+#define PIC_BOT_TOP 6
|
||||
+
|
||||
+/* Size of Motion Vector per macroblock */
|
||||
+#define MB_MV_SIZE 96
|
||||
+
|
||||
+/* Frame status data */
|
||||
+#define PIC_STRUCT_BIT 5
|
||||
+#define PIC_STRUCT_MASK GENMASK(2, 0)
|
||||
+#define BUF_IDX_MASK GENMASK(4, 0)
|
||||
+#define ERROR_FLAG BIT(9)
|
||||
+#define OFFSET_BIT 16
|
||||
+#define OFFSET_MASK GENMASK(15, 0)
|
||||
+
|
||||
+/* Bitstream parsed data */
|
||||
+#define MB_TOTAL_BIT 8
|
||||
+#define MB_TOTAL_MASK GENMASK(15, 0)
|
||||
+#define MB_WIDTH_MASK GENMASK(7, 0)
|
||||
+#define MAX_REF_BIT 24
|
||||
+#define MAX_REF_MASK GENMASK(6, 0)
|
||||
+#define AR_IDC_BIT 16
|
||||
+#define AR_IDC_MASK GENMASK(7, 0)
|
||||
+#define AR_PRESENT_FLAG BIT(0)
|
||||
+#define AR_EXTEND 0xff
|
||||
+
|
||||
+/* Buffer to send to the ESPARSER to signal End Of Stream for H.264.
|
||||
+ * This is a 16x16 encoded picture that will trigger drain firmware-side.
|
||||
+ * There is no known alternative.
|
||||
+ */
|
||||
+static const u8 eos_sequence[SZ_1K] = {
|
||||
+ 0x00, 0x00, 0x00, 0x01, 0x06, 0x05, 0xff, 0xe4, 0xdc, 0x45, 0xe9, 0xbd,
|
||||
+ 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef,
|
||||
+ 0x78, 0x32, 0x36, 0x34, 0x20, 0x2d, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20,
|
||||
+ 0x36, 0x37, 0x20, 0x72, 0x31, 0x31, 0x33, 0x30, 0x20, 0x38, 0x34, 0x37,
|
||||
+ 0x35, 0x39, 0x37, 0x37, 0x20, 0x2d, 0x20, 0x48, 0x2e, 0x32, 0x36, 0x34,
|
||||
+ 0x2f, 0x4d, 0x50, 0x45, 0x47, 0x2d, 0x34, 0x20, 0x41, 0x56, 0x43, 0x20,
|
||||
+ 0x63, 0x6f, 0x64, 0x65, 0x63, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x70, 0x79,
|
||||
+ 0x6c, 0x65, 0x66, 0x74, 0x20, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x30,
|
||||
+ 0x30, 0x39, 0x20, 0x2d, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
|
||||
+ 0x77, 0x77, 0x77, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6c, 0x61, 0x6e,
|
||||
+ 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x78, 0x32, 0x36, 0x34, 0x2e, 0x68, 0x74,
|
||||
+ 0x6d, 0x6c, 0x20, 0x2d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
+ 0x3a, 0x20, 0x63, 0x61, 0x62, 0x61, 0x63, 0x3d, 0x31, 0x20, 0x72, 0x65,
|
||||
+ 0x66, 0x3d, 0x31, 0x20, 0x64, 0x65, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x3d,
|
||||
+ 0x31, 0x3a, 0x30, 0x3a, 0x30, 0x20, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73,
|
||||
+ 0x65, 0x3d, 0x30, 0x78, 0x31, 0x3a, 0x30, 0x78, 0x31, 0x31, 0x31, 0x20,
|
||||
+ 0x6d, 0x65, 0x3d, 0x68, 0x65, 0x78, 0x20, 0x73, 0x75, 0x62, 0x6d, 0x65,
|
||||
+ 0x3d, 0x36, 0x20, 0x70, 0x73, 0x79, 0x5f, 0x72, 0x64, 0x3d, 0x31, 0x2e,
|
||||
+ 0x30, 0x3a, 0x30, 0x2e, 0x30, 0x20, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f,
|
||||
+ 0x72, 0x65, 0x66, 0x3d, 0x30, 0x20, 0x6d, 0x65, 0x5f, 0x72, 0x61, 0x6e,
|
||||
+ 0x67, 0x65, 0x3d, 0x31, 0x36, 0x20, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x61,
|
||||
+ 0x5f, 0x6d, 0x65, 0x3d, 0x31, 0x20, 0x74, 0x72, 0x65, 0x6c, 0x6c, 0x69,
|
||||
+ 0x73, 0x3d, 0x30, 0x20, 0x38, 0x78, 0x38, 0x64, 0x63, 0x74, 0x3d, 0x30,
|
||||
+ 0x20, 0x63, 0x71, 0x6d, 0x3d, 0x30, 0x20, 0x64, 0x65, 0x61, 0x64, 0x7a,
|
||||
+ 0x6f, 0x6e, 0x65, 0x3d, 0x32, 0x31, 0x2c, 0x31, 0x31, 0x20, 0x63, 0x68,
|
||||
+ 0x72, 0x6f, 0x6d, 0x61, 0x5f, 0x71, 0x70, 0x5f, 0x6f, 0x66, 0x66, 0x73,
|
||||
+ 0x65, 0x74, 0x3d, 0x2d, 0x32, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64,
|
||||
+ 0x73, 0x3d, 0x31, 0x20, 0x6e, 0x72, 0x3d, 0x30, 0x20, 0x64, 0x65, 0x63,
|
||||
+ 0x69, 0x6d, 0x61, 0x74, 0x65, 0x3d, 0x31, 0x20, 0x6d, 0x62, 0x61, 0x66,
|
||||
+ 0x66, 0x3d, 0x30, 0x20, 0x62, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x3d,
|
||||
+ 0x30, 0x20, 0x6b, 0x65, 0x79, 0x69, 0x6e, 0x74, 0x3d, 0x32, 0x35, 0x30,
|
||||
+ 0x20, 0x6b, 0x65, 0x79, 0x69, 0x6e, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x3d,
|
||||
+ 0x32, 0x35, 0x20, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x63, 0x75, 0x74, 0x3d,
|
||||
+ 0x34, 0x30, 0x20, 0x72, 0x63, 0x3d, 0x61, 0x62, 0x72, 0x20, 0x62, 0x69,
|
||||
+ 0x74, 0x72, 0x61, 0x74, 0x65, 0x3d, 0x31, 0x30, 0x20, 0x72, 0x61, 0x74,
|
||||
+ 0x65, 0x74, 0x6f, 0x6c, 0x3d, 0x31, 0x2e, 0x30, 0x20, 0x71, 0x63, 0x6f,
|
||||
+ 0x6d, 0x70, 0x3d, 0x30, 0x2e, 0x36, 0x30, 0x20, 0x71, 0x70, 0x6d, 0x69,
|
||||
+ 0x6e, 0x3d, 0x31, 0x30, 0x20, 0x71, 0x70, 0x6d, 0x61, 0x78, 0x3d, 0x35,
|
||||
+ 0x31, 0x20, 0x71, 0x70, 0x73, 0x74, 0x65, 0x70, 0x3d, 0x34, 0x20, 0x69,
|
||||
+ 0x70, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x3d, 0x31, 0x2e, 0x34, 0x30,
|
||||
+ 0x20, 0x61, 0x71, 0x3d, 0x31, 0x3a, 0x31, 0x2e, 0x30, 0x30, 0x00, 0x80,
|
||||
+ 0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x40, 0x0a, 0x9a, 0x74, 0xf4, 0x20,
|
||||
+ 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x06, 0x51, 0xe2, 0x44, 0xd4,
|
||||
+ 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x32, 0xc8, 0x00, 0x00, 0x00, 0x01,
|
||||
+ 0x65, 0x88, 0x80, 0x20, 0x00, 0x08, 0x7f, 0xea, 0x6a, 0xe2, 0x99, 0xb6,
|
||||
+ 0x57, 0xae, 0x49, 0x30, 0xf5, 0xfe, 0x5e, 0x46, 0x0b, 0x72, 0x44, 0xc4,
|
||||
+ 0xe1, 0xfc, 0x62, 0xda, 0xf1, 0xfb, 0xa2, 0xdb, 0xd6, 0xbe, 0x5c, 0xd7,
|
||||
+ 0x24, 0xa3, 0xf5, 0xb9, 0x2f, 0x57, 0x16, 0x49, 0x75, 0x47, 0x77, 0x09,
|
||||
+ 0x5c, 0xa1, 0xb4, 0xc3, 0x4f, 0x60, 0x2b, 0xb0, 0x0c, 0xc8, 0xd6, 0x66,
|
||||
+ 0xba, 0x9b, 0x82, 0x29, 0x33, 0x92, 0x26, 0x99, 0x31, 0x1c, 0x7f, 0x9b
|
||||
+};
|
||||
+
|
||||
+static const u8 *codec_h264_eos_sequence(u32 *len)
|
||||
+{
|
||||
+ *len = ARRAY_SIZE(eos_sequence);
|
||||
+ return eos_sequence;
|
||||
+}
|
||||
+
|
||||
+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;
|
||||
+
|
||||
+ u32 mb_width;
|
||||
+ u32 mb_height;
|
||||
+ u32 max_refs;
|
||||
+};
|
||||
+
|
||||
+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));
|
||||
+
|
||||
+ 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);
|
||||
+
|
||||
+ /* 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;
|
||||
+
|
||||
+ if (len < SIZE_EXT_FW)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ h264 = kzalloc(sizeof(*h264), GFP_KERNEL);
|
||||
+ if (!h264)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ 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");
|
||||
+ kfree(h264);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(h264->ext_fw_vaddr, data, SIZE_EXT_FW);
|
||||
+ sess->priv = h264;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct v4l2_fract par_table[] = {
|
||||
+ { 1, 1 }, { 1, 1 }, { 12, 11 }, { 10, 11 },
|
||||
+ { 16, 11 }, { 40, 33 }, { 24, 11 }, { 20, 11 },
|
||||
+ { 32, 11 }, { 80, 33 }, { 18, 11 }, { 15, 11 },
|
||||
+ { 64, 33 }, { 160, 99 }, { 4, 3 }, { 3, 2 },
|
||||
+ { 2, 1 }
|
||||
+};
|
||||
+
|
||||
+static void codec_h264_set_par(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ u32 seq_info = amvdec_read_dos(core, AV_SCRATCH_2);
|
||||
+ u32 ar_idc = (seq_info >> AR_IDC_BIT) & AR_IDC_MASK;
|
||||
+
|
||||
+ if (!(seq_info & AR_PRESENT_FLAG))
|
||||
+ return;
|
||||
+
|
||||
+ if (ar_idc == AR_EXTEND) {
|
||||
+ u32 ar_info = amvdec_read_dos(core, AV_SCRATCH_3);
|
||||
+ sess->pixelaspect.numerator = ar_info & 0xffff;
|
||||
+ sess->pixelaspect.denominator = (ar_info >> 16) & 0xffff;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (ar_idc >= ARRAY_SIZE(par_table))
|
||||
+ return;
|
||||
+
|
||||
+ sess->pixelaspect = par_table[ar_idc];
|
||||
+}
|
||||
+
|
||||
+static void codec_h264_resume(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ u32 mb_width, mb_height, mb_total;
|
||||
+
|
||||
+ amvdec_set_canvases(sess, (u32[]){ ANC0_CANVAS_ADDR, 0 },
|
||||
+ (u32[]){ 24, 0 });
|
||||
+
|
||||
+ dev_dbg(core->dev,
|
||||
+ "max_refs = %u; actual_dpb_size = %u\n",
|
||||
+ h264->max_refs, sess->num_dst_bufs);
|
||||
+
|
||||
+ /* Align to a multiple of 4 macroblocks */
|
||||
+ mb_width = ALIGN(h264->mb_width, 4);
|
||||
+ mb_height = ALIGN(h264->mb_height, 4);
|
||||
+ mb_total = mb_width * mb_height;
|
||||
+
|
||||
+ h264->ref_size = mb_total * MB_MV_SIZE * h264->max_refs;
|
||||
+ 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, (h264->max_refs << 24) |
|
||||
+ (sess->num_dst_bufs << 16) |
|
||||
+ ((h264->max_refs - 1) << 8));
|
||||
+}
|
||||
+
|
||||
+/* Configure the H.264 decoder when the parser detected a parameter set change
|
||||
+ */
|
||||
+static void codec_h264_src_change(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ struct codec_h264 *h264 = sess->priv;
|
||||
+ u32 parsed_info, mb_total;
|
||||
+ u32 crop_infor, crop_bottom, crop_right;
|
||||
+ u32 frame_width, frame_height;
|
||||
+
|
||||
+ sess->keyframe_found = 1;
|
||||
+
|
||||
+ parsed_info = amvdec_read_dos(core, AV_SCRATCH_1);
|
||||
+
|
||||
+ /* Total number of 16x16 macroblocks */
|
||||
+ mb_total = (parsed_info >> MB_TOTAL_BIT) & MB_TOTAL_MASK;
|
||||
+ /* Number of macroblocks per line */
|
||||
+ h264->mb_width = parsed_info & MB_WIDTH_MASK;
|
||||
+ /* Number of macroblock lines */
|
||||
+ h264->mb_height = mb_total / h264->mb_width;
|
||||
+
|
||||
+ h264->max_refs = ((parsed_info >> MAX_REF_BIT) & MAX_REF_MASK) + 1;
|
||||
+
|
||||
+ crop_infor = amvdec_read_dos(core, AV_SCRATCH_6);
|
||||
+ crop_bottom = (crop_infor & 0xff);
|
||||
+ crop_right = (crop_infor >> 16) & 0xff;
|
||||
+
|
||||
+ frame_width = h264->mb_width * 16 - crop_right;
|
||||
+ frame_height = h264->mb_height * 16 - crop_bottom;
|
||||
+
|
||||
+ dev_info(core->dev, "frame: %ux%u; crop: %u %u\n",
|
||||
+ frame_width, frame_height, crop_right, crop_bottom);
|
||||
+
|
||||
+ codec_h264_set_par(sess);
|
||||
+ amvdec_src_change(sess, frame_width, frame_height, h264->max_refs + 5);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * The offset is split in half in 2 different registers
|
||||
+ */
|
||||
+static u32 get_offset_msb(struct amvdec_core *core, int frame_num)
|
||||
+{
|
||||
+ int take_msb = frame_num % 2;
|
||||
+ int reg_offset = (frame_num / 2) * 4;
|
||||
+ u32 offset_msb = amvdec_read_dos(core, AV_SCRATCH_A + reg_offset);
|
||||
+
|
||||
+ if (take_msb)
|
||||
+ return offset_msb & 0xffff0000;
|
||||
+
|
||||
+ return (offset_msb & 0x0000ffff) << 16;
|
||||
+}
|
||||
+
|
||||
+static void codec_h264_frames_ready(struct amvdec_session *sess, u32 status)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ 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 & BUF_IDX_MASK;
|
||||
+ u32 pic_struct = (frame_status >> PIC_STRUCT_BIT) &
|
||||
+ PIC_STRUCT_MASK;
|
||||
+ u32 offset = (frame_status >> OFFSET_BIT) & OFFSET_MASK;
|
||||
+ 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 (frame_status & ERROR_FLAG)
|
||||
+ dev_dbg(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;
|
||||
+
|
||||
+ offset |= get_offset_msb(core, i);
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, offset, field);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t codec_h264_threaded_isr(struct amvdec_session *sess)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ u32 status;
|
||||
+ u32 size;
|
||||
+ u8 cmd;
|
||||
+
|
||||
+ status = amvdec_read_dos(core, AV_SCRATCH_0);
|
||||
+ cmd = status & CMD_MASK;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case CMD_SRC_CHANGE:
|
||||
+ codec_h264_src_change(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: /* Unused but not worth printing for */
|
||||
+ case 9:
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_info(core->dev, "Unexpected H264 ISR: %08X\n", cmd);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (cmd && cmd != CMD_SRC_CHANGE)
|
||||
+ 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,
|
||||
+ .eos_sequence = codec_h264_eos_sequence,
|
||||
+ .resume = codec_h264_resume,
|
||||
+};
|
||||
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 000000000000..7a1597611faf
|
||||
--- /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 291f1eeb27d9..baecf5921d56 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 = 2,
|
||||
+ .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, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -38,6 +49,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_H264,
|
||||
+ .min_buffers = 2,
|
||||
+ .max_buffers = 24,
|
||||
+ .max_width = 3840,
|
||||
+ .max_height = 2160,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_h264_ops,
|
||||
+ .firmware_path = "meson/gxl/vh264_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
@@ -64,6 +85,16 @@ static const struct amvdec_format vdec_formats_gxl[] = {
|
||||
|
||||
static const struct amvdec_format vdec_formats_gxm[] = {
|
||||
{
|
||||
+ .pixfmt = V4L2_PIX_FMT_H264,
|
||||
+ .min_buffers = 2,
|
||||
+ .max_buffers = 24,
|
||||
+ .max_width = 3840,
|
||||
+ .max_height = 2160,
|
||||
+ .vdec_ops = &vdec_1_ops,
|
||||
+ .codec_ops = &codec_h264_ops,
|
||||
+ .firmware_path = "meson/gxm/vh264_mc",
|
||||
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
|
||||
+ }, {
|
||||
.pixfmt = V4L2_PIX_FMT_MPEG1,
|
||||
.min_buffers = 8,
|
||||
.max_buffers = 8,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
From cbb607b67a4a169b94884436208b05062bd2f93b Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 16:01:55 +0200
|
||||
Subject: [PATCH 38/53] 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 | 139 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_mpeg4.h | 13 ++
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 91 ++++++++++++
|
||||
4 files changed, 244 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 01dc9603abdd..bb7a134e2728 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_ctrls.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 000000000000..1d574e576112
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mpeg4.c
|
||||
@@ -0,0 +1,139 @@
|
||||
+// 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 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 MP4_OFFSET_REG AV_SCRATCH_C
|
||||
+#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 */
|
||||
+ 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, ~BIT(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;
|
||||
+
|
||||
+ /* 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;
|
||||
+ }
|
||||
+
|
||||
+ /* 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 });
|
||||
+
|
||||
+ 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);
|
||||
+
|
||||
+ sess->keyframe_found = 1;
|
||||
+ sess->priv = mpeg4;
|
||||
+
|
||||
+ 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)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ u32 reg;
|
||||
+ u32 buffer_index;
|
||||
+ u32 field = V4L2_FIELD_NONE;
|
||||
+
|
||||
+ reg = amvdec_read_dos(core, MREG_FATAL_ERROR);
|
||||
+ 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)
|
||||
+ goto end;
|
||||
+
|
||||
+ 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, -1, field);
|
||||
+ amvdec_write_dos(core, MREG_BUFFEROUT, 0);
|
||||
+
|
||||
+end:
|
||||
+ 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 000000000000..b91b26413185
|
||||
--- /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 baecf5921d56..80b43fd5d01f 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 = 2,
|
||||
.max_buffers = 24,
|
||||
@@ -49,6 +80,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 = 2,
|
||||
.max_buffers = 24,
|
||||
@@ -85,6 +146,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 = 2,
|
||||
.max_buffers = 24,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
From 1434c8fcc8ae00e748225ca4922c0d0b7bd15b02 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Sun, 21 Oct 2018 15:14:27 +0200
|
||||
Subject: [PATCH 39/53] 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 | 140 ++++++++++++++++++
|
||||
.../media/platform/meson/vdec/codec_mjpeg.h | 13 ++
|
||||
.../media/platform/meson/vdec/vdec_platform.c | 31 ++++
|
||||
4 files changed, 185 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 bb7a134e2728..acf07f3c3dac 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_ctrls.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 000000000000..abea9e3f944c
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/meson/vdec/codec_mjpeg.c
|
||||
@@ -0,0 +1,140 @@
|
||||
+// 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
|
||||
+#define MREG_FRAME_OFFSET AV_SCRATCH_A
|
||||
+
|
||||
+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)
|
||||
+{
|
||||
+ struct amvdec_core *core = sess->core;
|
||||
+ u32 reg;
|
||||
+ u32 buffer_index;
|
||||
+ u32 offset;
|
||||
+
|
||||
+ 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;
|
||||
+ offset = amvdec_read_dos(core, MREG_FRAME_OFFSET);
|
||||
+ amvdec_dst_buf_done_idx(sess, buffer_index, offset, 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 000000000000..cc1cf731050d
|
||||
--- /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 80b43fd5d01f..61def155a5fd 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,
|
||||
@@ -80,6 +91,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,
|
||||
@@ -146,6 +167,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,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
From 8bb24f445a3b532a06a1d5bde70daad0c4f3da4f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Date: Sat, 13 Oct 2018 14:04:46 +0400
|
||||
Subject: [PATCH 40/53] clk: meson-gxbb: set fclk_div3 as CLK_IS_CRITICAL
|
||||
|
||||
On the Khadas VIM2 (GXM) and LePotato (GXL) board there are problems
|
||||
with reboot; e.g. a ~60 second delay between issuing reboot and the
|
||||
board power cycling (and in some OS configurations reboot will fail
|
||||
and require manual power cycling).
|
||||
|
||||
Similar to 'commit c987ac6f1f088663b6dad39281071aeb31d450a8 ("clk:
|
||||
meson-gxbb: set fclk_div2 as CLK_IS_CRITICAL")' the SCPI Cortex-M4
|
||||
Co-Processor seems to depend on FCLK_DIV3 being operational.
|
||||
|
||||
Bisect gives 'commit 05f814402d6174369b3b29832cbb5eb5ed287059 ("clk:
|
||||
meson: add fdiv clock gates") between 4.16 and 4.16-rc1 as the first
|
||||
bad commit. This added support for the missing clock gates before the
|
||||
fixed PLL fixed dividers (FCLK_DIVx) and the clock framework which
|
||||
disabled all the unused fixed dividers, thus it disabled a critical
|
||||
clock path for the SCPI Co-Processor.
|
||||
|
||||
This change simply sets the FCLK_DIV3 gate as critical to ensure
|
||||
nothing can disable it.
|
||||
|
||||
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
---
|
||||
drivers/clk/meson/gxbb.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
|
||||
index 4d4f6d842c31..a6fae1c00df3 100644
|
||||
--- a/drivers/clk/meson/gxbb.c
|
||||
+++ b/drivers/clk/meson/gxbb.c
|
||||
@@ -513,6 +513,7 @@ static struct clk_fixed_factor gxbb_fclk_div3_div = {
|
||||
.ops = &clk_fixed_factor_ops,
|
||||
.parent_names = (const char *[]){ "fixed_pll" },
|
||||
.num_parents = 1,
|
||||
+ .flags = CLK_IS_CRITICAL,
|
||||
},
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
From cb1d14ed8b5d2dc67b8d7769b5314fd5b9010f23 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Fri, 20 Jul 2018 15:29:18 +0200
|
||||
Subject: [PATCH 41/53] drm/meson: Add HDMI 1.4 4k modes
|
||||
|
||||
Add the timings for the HDMI 1.4 4K modes support :
|
||||
- 3840x2160@30
|
||||
- 3840x2160@25
|
||||
- 3840x2160@24
|
||||
|
||||
Since the 297000Hz pixel clock is already managed and the modes are
|
||||
compatible with the HDMI 1.4 current HDMI PHY+Controller support, only
|
||||
the missing timings values needs to be added.
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_venc.c | 129 +++++++++++++++++++++++++++++
|
||||
1 file changed, 129 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
|
||||
index 7a3a6ed9f27b..0fbe525b94c8 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_venc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_venc.c
|
||||
@@ -698,6 +698,132 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p60 = {
|
||||
},
|
||||
};
|
||||
|
||||
+union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p24 = {
|
||||
+ .encp = {
|
||||
+ .dvi_settings = 0x1,
|
||||
+ .video_mode = 0x4040,
|
||||
+ .video_mode_adv = 0x8,
|
||||
+ /* video_sync_mode */
|
||||
+ /* video_yc_dly */
|
||||
+ /* video_rgb_ctrl */
|
||||
+ .video_filt_ctrl = 0x1000,
|
||||
+ .video_filt_ctrl_present = true,
|
||||
+ /* video_ofld_voav_ofst */
|
||||
+ .yfp1_htime = 140,
|
||||
+ .yfp2_htime = 140+3840,
|
||||
+ .max_pxcnt = 3840+1660-1,
|
||||
+ .hspuls_begin = 2156+1920,
|
||||
+ .hspuls_end = 44,
|
||||
+ .hspuls_switch = 44,
|
||||
+ .vspuls_begin = 140,
|
||||
+ .vspuls_end = 2059+1920,
|
||||
+ .vspuls_bline = 0,
|
||||
+ .vspuls_eline = 4,
|
||||
+ .havon_begin = 148,
|
||||
+ .havon_end = 3987,
|
||||
+ .vavon_bline = 89,
|
||||
+ .vavon_eline = 2248,
|
||||
+ /* eqpuls_begin */
|
||||
+ /* eqpuls_end */
|
||||
+ /* eqpuls_bline */
|
||||
+ /* eqpuls_eline */
|
||||
+ .hso_begin = 44,
|
||||
+ .hso_end = 2156+1920,
|
||||
+ .vso_begin = 2100+1920,
|
||||
+ .vso_end = 2164+1920,
|
||||
+ .vso_bline = 51,
|
||||
+ .vso_eline = 53,
|
||||
+ .vso_eline_present = true,
|
||||
+ /* sy_val */
|
||||
+ /* sy2_val */
|
||||
+ .max_lncnt = 2249,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p25 = {
|
||||
+ .encp = {
|
||||
+ .dvi_settings = 0x1,
|
||||
+ .video_mode = 0x4040,
|
||||
+ .video_mode_adv = 0x8,
|
||||
+ /* video_sync_mode */
|
||||
+ /* video_yc_dly */
|
||||
+ /* video_rgb_ctrl */
|
||||
+ .video_filt_ctrl = 0x1000,
|
||||
+ .video_filt_ctrl_present = true,
|
||||
+ /* video_ofld_voav_ofst */
|
||||
+ .yfp1_htime = 140,
|
||||
+ .yfp2_htime = 140+3840,
|
||||
+ .max_pxcnt = 3840+1440-1,
|
||||
+ .hspuls_begin = 2156+1920,
|
||||
+ .hspuls_end = 44,
|
||||
+ .hspuls_switch = 44,
|
||||
+ .vspuls_begin = 140,
|
||||
+ .vspuls_end = 2059+1920,
|
||||
+ .vspuls_bline = 0,
|
||||
+ .vspuls_eline = 4,
|
||||
+ .havon_begin = 148,
|
||||
+ .havon_end = 3987,
|
||||
+ .vavon_bline = 89,
|
||||
+ .vavon_eline = 2248,
|
||||
+ /* eqpuls_begin */
|
||||
+ /* eqpuls_end */
|
||||
+ /* eqpuls_bline */
|
||||
+ /* eqpuls_eline */
|
||||
+ .hso_begin = 44,
|
||||
+ .hso_end = 2156+1920,
|
||||
+ .vso_begin = 2100+1920,
|
||||
+ .vso_end = 2164+1920,
|
||||
+ .vso_bline = 51,
|
||||
+ .vso_eline = 53,
|
||||
+ .vso_eline_present = true,
|
||||
+ /* sy_val */
|
||||
+ /* sy2_val */
|
||||
+ .max_lncnt = 2249,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p30 = {
|
||||
+ .encp = {
|
||||
+ .dvi_settings = 0x1,
|
||||
+ .video_mode = 0x4040,
|
||||
+ .video_mode_adv = 0x8,
|
||||
+ /* video_sync_mode */
|
||||
+ /* video_yc_dly */
|
||||
+ /* video_rgb_ctrl */
|
||||
+ .video_filt_ctrl = 0x1000,
|
||||
+ .video_filt_ctrl_present = true,
|
||||
+ /* video_ofld_voav_ofst */
|
||||
+ .yfp1_htime = 140,
|
||||
+ .yfp2_htime = 140+3840,
|
||||
+ .max_pxcnt = 3840+560-1,
|
||||
+ .hspuls_begin = 2156+1920,
|
||||
+ .hspuls_end = 44,
|
||||
+ .hspuls_switch = 44,
|
||||
+ .vspuls_begin = 140,
|
||||
+ .vspuls_end = 2059+1920,
|
||||
+ .vspuls_bline = 0,
|
||||
+ .vspuls_eline = 4,
|
||||
+ .havon_begin = 148,
|
||||
+ .havon_end = 3987,
|
||||
+ .vavon_bline = 89,
|
||||
+ .vavon_eline = 2248,
|
||||
+ /* eqpuls_begin */
|
||||
+ /* eqpuls_end */
|
||||
+ /* eqpuls_bline */
|
||||
+ /* eqpuls_eline */
|
||||
+ .hso_begin = 44,
|
||||
+ .hso_end = 2156+1920,
|
||||
+ .vso_begin = 2100+1920,
|
||||
+ .vso_end = 2164+1920,
|
||||
+ .vso_bline = 51,
|
||||
+ .vso_eline = 53,
|
||||
+ .vso_eline_present = true,
|
||||
+ /* sy_val */
|
||||
+ /* sy2_val */
|
||||
+ .max_lncnt = 2249,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
struct meson_hdmi_venc_vic_mode {
|
||||
unsigned int vic;
|
||||
union meson_hdmi_venc_mode *mode;
|
||||
@@ -719,6 +845,9 @@ struct meson_hdmi_venc_vic_mode {
|
||||
{ 34, &meson_hdmi_encp_mode_1080p30 },
|
||||
{ 31, &meson_hdmi_encp_mode_1080p50 },
|
||||
{ 16, &meson_hdmi_encp_mode_1080p60 },
|
||||
+ { 93, &meson_hdmi_encp_mode_2160p24 },
|
||||
+ { 94, &meson_hdmi_encp_mode_2160p25 },
|
||||
+ { 95, &meson_hdmi_encp_mode_2160p30 },
|
||||
{ 0, NULL}, /* sentinel */
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
From 040f80b511f207308bbd7c177e148551cbd2c110 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
|
||||
Date: Sat, 8 Sep 2018 15:46:33 +0200
|
||||
Subject: [PATCH 42/53] drm/meson: Use drm_fbdev_generic_setup()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The CMA helper is already using the drm_fb_helper_generic_probe part of
|
||||
the generic fbdev emulation. This patch makes full use of the generic
|
||||
fbdev emulation by using its drm_client callbacks. This means that
|
||||
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
|
||||
now handled by the emulation code. Additionally fbdev unregister happens
|
||||
automatically on drm_dev_unregister().
|
||||
|
||||
The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
|
||||
driver. This is done to highlight the fact that fbdev emulation is an
|
||||
internal client that makes use of the driver, it is not part of the
|
||||
driver as such. If fbdev setup fails, an error is printed, but the driver
|
||||
succeeds probing.
|
||||
|
||||
Cc: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_drv.c | 18 ++----------------
|
||||
drivers/gpu/drm/meson/meson_drv.h | 1 -
|
||||
2 files changed, 2 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
|
||||
index 63bb2727b183..a13704ab5d11 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.c
|
||||
@@ -69,15 +69,7 @@
|
||||
* - Powering Up HDMI controller and PHY
|
||||
*/
|
||||
|
||||
-static void meson_fb_output_poll_changed(struct drm_device *dev)
|
||||
-{
|
||||
- struct meson_drm *priv = dev->dev_private;
|
||||
-
|
||||
- drm_fbdev_cma_hotplug_event(priv->fbdev);
|
||||
-}
|
||||
-
|
||||
static const struct drm_mode_config_funcs meson_mode_config_funcs = {
|
||||
- .output_poll_changed = meson_fb_output_poll_changed,
|
||||
.atomic_check = drm_atomic_helper_check,
|
||||
.atomic_commit = drm_atomic_helper_commit,
|
||||
.fb_create = drm_gem_fb_create,
|
||||
@@ -319,13 +311,6 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
|
||||
|
||||
drm_mode_config_reset(drm);
|
||||
|
||||
- priv->fbdev = drm_fbdev_cma_init(drm, 32,
|
||||
- drm->mode_config.num_connector);
|
||||
- if (IS_ERR(priv->fbdev)) {
|
||||
- ret = PTR_ERR(priv->fbdev);
|
||||
- goto free_drm;
|
||||
- }
|
||||
-
|
||||
drm_kms_helper_poll_init(drm);
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
@@ -334,6 +319,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
|
||||
if (ret)
|
||||
goto uninstall_irq;
|
||||
|
||||
+ drm_fbdev_generic_setup(drm, 32);
|
||||
+
|
||||
return 0;
|
||||
|
||||
uninstall_irq:
|
||||
@@ -364,7 +351,6 @@ static void meson_drv_unbind(struct device *dev)
|
||||
drm_dev_unregister(drm);
|
||||
drm_irq_uninstall(drm);
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
- drm_fbdev_cma_fini(priv->fbdev);
|
||||
drm_mode_config_cleanup(drm);
|
||||
drm_dev_put(drm);
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
|
||||
index a955354711ce..4dccf4cd042a 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.h
|
||||
@@ -40,7 +40,6 @@ struct meson_drm {
|
||||
|
||||
struct drm_device *drm;
|
||||
struct drm_crtc *crtc;
|
||||
- struct drm_fbdev_cma *fbdev;
|
||||
struct drm_plane *primary_plane;
|
||||
struct drm_plane *overlay_plane;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
From 3514e950490879dcdd75c74196e26eab8f5b740d Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 14 Nov 2018 16:48:50 +0100
|
||||
Subject: [PATCH 43/53] drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling
|
||||
support
|
||||
|
||||
Add support for SCDC Setup for TMDS Clock > 3.4GHz and enable TMDS
|
||||
Scrambling when supported or mandatory.
|
||||
|
||||
This patch also adds an helper to setup the control bit to support
|
||||
the hight TMDS Bit Period/TMDS Clock-Period Ratio as required with
|
||||
TMDS Clock > 3.4GHz for HDMI2.0 3840x2160@60/50 modes.
|
||||
|
||||
These changes were based on work done by Huicong Xu <xhc@rock-chips.com>
|
||||
and Nickey Yang <nickey.yang@rock-chips.com> to support HDMI2.0 modes
|
||||
on the Rockchip 4.4 BSP kernel at [1]
|
||||
|
||||
[1] https://github.com/rockchip-linux/kernel/tree/release-4.4
|
||||
|
||||
Cc: Nickey Yang <nickey.yang@rock-chips.com>
|
||||
Cc: Huicong Xu <xhc@rock-chips.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 +++++++++++++++++++++--
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 1 +
|
||||
include/drm/bridge/dw_hdmi.h | 1 +
|
||||
3 files changed, 44 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
index 1fc12708dbb5..2a30d8393477 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_encoder_slave.h>
|
||||
+#include <drm/drm_scdc_helper.h>
|
||||
#include <drm/bridge/dw_hdmi.h>
|
||||
|
||||
#include <uapi/linux/media-bus-format.h>
|
||||
@@ -1026,6 +1027,20 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
|
||||
|
||||
+void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi)
|
||||
+{
|
||||
+ unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mpixelclock;
|
||||
+
|
||||
+ /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
|
||||
+ if (hdmi->connector.display_info.hdmi.scdc.supported) {
|
||||
+ if (mtmdsclock > 340000000)
|
||||
+ drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
|
||||
+ else
|
||||
+ drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 0);
|
||||
+ }
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(dw_hdmi_set_high_tmds_clock_ratio);
|
||||
+
|
||||
static void dw_hdmi_phy_enable_powerdown(struct dw_hdmi *hdmi, bool enable)
|
||||
{
|
||||
hdmi_mask_writeb(hdmi, !enable, HDMI_PHY_CONF0,
|
||||
@@ -1351,11 +1366,12 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi)
|
||||
|
||||
static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
|
||||
{
|
||||
+ bool is_hdmi2_sink = hdmi->connector.display_info.hdmi.scdc.supported;
|
||||
struct hdmi_avi_infoframe frame;
|
||||
u8 val;
|
||||
|
||||
/* Initialise info frame from DRM mode */
|
||||
- drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
||||
+ drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, is_hdmi2_sink);
|
||||
|
||||
if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
|
||||
frame.colorspace = HDMI_COLORSPACE_YUV444;
|
||||
@@ -1514,7 +1530,8 @@ static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi,
|
||||
static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
- u8 inv_val;
|
||||
+ u8 inv_val, bytes;
|
||||
+ struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi;
|
||||
struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode;
|
||||
int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len;
|
||||
unsigned int vdisplay;
|
||||
@@ -1524,7 +1541,9 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock);
|
||||
|
||||
/* Set up HDMI_FC_INVIDCONF */
|
||||
- inv_val = (hdmi->hdmi_data.hdcp_enable ?
|
||||
+ inv_val = (hdmi->hdmi_data.hdcp_enable ||
|
||||
+ vmode->mpixelclock > 340000000 ||
|
||||
+ hdmi_info->scdc.scrambling.low_rates ?
|
||||
HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
|
||||
HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE);
|
||||
|
||||
@@ -1573,6 +1592,26 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
vsync_len /= 2;
|
||||
}
|
||||
|
||||
+ /* Scrambling Control */
|
||||
+ if (hdmi_info->scdc.supported) {
|
||||
+ if (vmode->mpixelclock > 340000000 ||
|
||||
+ hdmi_info->scdc.scrambling.low_rates) {
|
||||
+ drm_scdc_readb(&hdmi->i2c->adap, SCDC_SINK_VERSION,
|
||||
+ &bytes);
|
||||
+ drm_scdc_writeb(&hdmi->i2c->adap, SCDC_SOURCE_VERSION,
|
||||
+ bytes);
|
||||
+ drm_scdc_set_scrambling(&hdmi->i2c->adap, 1);
|
||||
+ hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
|
||||
+ HDMI_MC_SWRSTZ);
|
||||
+ hdmi_writeb(hdmi, 1, HDMI_FC_SCRAMBLER_CTRL);
|
||||
+ } else {
|
||||
+ hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL);
|
||||
+ hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
|
||||
+ HDMI_MC_SWRSTZ);
|
||||
+ drm_scdc_set_scrambling(&hdmi->i2c->adap, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Set up horizontal active pixel width */
|
||||
hdmi_writeb(hdmi, mode->hdisplay >> 8, HDMI_FC_INHACTV1);
|
||||
hdmi_writeb(hdmi, mode->hdisplay, HDMI_FC_INHACTV0);
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
|
||||
index 9d90eb9c46e5..3f3c616eba97 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
|
||||
@@ -255,6 +255,7 @@
|
||||
#define HDMI_FC_MASK2 0x10DA
|
||||
#define HDMI_FC_POL2 0x10DB
|
||||
#define HDMI_FC_PRCONF 0x10E0
|
||||
+#define HDMI_FC_SCRAMBLER_CTRL 0x10E1
|
||||
|
||||
#define HDMI_FC_GMD_STAT 0x1100
|
||||
#define HDMI_FC_GMD_EN 0x1101
|
||||
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
|
||||
index ccb5aa8468e0..d7cc5d094270 100644
|
||||
--- a/include/drm/bridge/dw_hdmi.h
|
||||
+++ b/include/drm/bridge/dw_hdmi.h
|
||||
@@ -156,6 +156,7 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense);
|
||||
void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
|
||||
void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
|
||||
void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
|
||||
+void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi);
|
||||
|
||||
/* PHY configuration */
|
||||
void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
From 9f4886b1df0a93a313bc8a238ca6f020fbe8ae90 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 12 Nov 2018 16:08:13 +0100
|
||||
Subject: [PATCH 44/53] drm/meson: add HDMI div40 TMDS mode
|
||||
|
||||
Add support for TMDS Clock > 3.4GHz for HDMI2.0 display modes.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_dw_hdmi.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
index 807111ebfdd9..b8775102b100 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
|
||||
@@ -365,7 +365,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
|
||||
unsigned int wr_clk =
|
||||
readl_relaxed(priv->io_base + _REG(VPU_HDMI_SETTING));
|
||||
|
||||
- DRM_DEBUG_DRIVER("%d:\"%s\"\n", mode->base.id, mode->name);
|
||||
+ DRM_DEBUG_DRIVER("%d:\"%s\" div%d\n", mode->base.id, mode->name,
|
||||
+ mode->clock > 340000 ? 40 : 10);
|
||||
|
||||
/* Enable clocks */
|
||||
regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100);
|
||||
@@ -385,9 +386,17 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
|
||||
/* Enable normal output to PHY */
|
||||
dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
|
||||
|
||||
- /* TMDS pattern setup (TOFIX pattern for 4k2k scrambling) */
|
||||
- dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, 0x001f001f);
|
||||
- dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23, 0x001f001f);
|
||||
+ /* TMDS pattern setup (TOFIX Handle the YUV420 case) */
|
||||
+ if (mode->clock > 340000) {
|
||||
+ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, 0);
|
||||
+ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23,
|
||||
+ 0x03ff03ff);
|
||||
+ } else {
|
||||
+ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01,
|
||||
+ 0x001f001f);
|
||||
+ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23,
|
||||
+ 0x001f001f);
|
||||
+ }
|
||||
|
||||
/* Load TMDS pattern */
|
||||
dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_CNTL, 0x1);
|
||||
@@ -413,6 +422,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
|
||||
/* Disable clock, fifo, fifo_wr */
|
||||
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
|
||||
|
||||
+ dw_hdmi_set_high_tmds_clock_ratio(hdmi);
|
||||
+
|
||||
msleep(100);
|
||||
|
||||
/* Reset PHY 3 times in a row */
|
||||
@@ -562,6 +573,11 @@ dw_hdmi_mode_valid(struct drm_connector *connector,
|
||||
mode->vdisplay, mode->vsync_start,
|
||||
mode->vsync_end, mode->vtotal, mode->type, mode->flags);
|
||||
|
||||
+ /* If sink max TMDS clock < 340MHz, we reject the HDMI2.0 modes */
|
||||
+ if (mode->clock > 340000 &&
|
||||
+ connector->display_info.max_tmds_clock < 340000)
|
||||
+ return MODE_BAD;
|
||||
+
|
||||
/* Check against non-VIC supported modes */
|
||||
if (!vic) {
|
||||
status = meson_venc_hdmi_supported_mode(mode);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 954b1e933ad1dd534c3f5b01fde7b52a62b78973 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 12 Nov 2018 16:10:07 +0100
|
||||
Subject: [PATCH 45/53] drm/meson: add support for HDMI2.0 2160p modes
|
||||
|
||||
Now we support the TMDS Clock > 3.4GHz and support the SCDC Control
|
||||
operation in the DW-HDMI Controller, we can enable support for the
|
||||
HDMI2.0 3840x2160@60/50 RGB444 display modes.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_venc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
|
||||
index 0fbe525b94c8..1bcd642b6e42 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_venc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_venc.c
|
||||
@@ -848,6 +848,8 @@ struct meson_hdmi_venc_vic_mode {
|
||||
{ 93, &meson_hdmi_encp_mode_2160p24 },
|
||||
{ 94, &meson_hdmi_encp_mode_2160p25 },
|
||||
{ 95, &meson_hdmi_encp_mode_2160p30 },
|
||||
+ { 96, &meson_hdmi_encp_mode_2160p25 },
|
||||
+ { 97, &meson_hdmi_encp_mode_2160p30 },
|
||||
{ 0, NULL}, /* sentinel */
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
From afdd89304db8f3e858ee32cefaf29ed0be12500e Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 14 Nov 2018 17:19:36 +0100
|
||||
Subject: [PATCH 46/53] drm/bridge: dw-hdmi: add support for YUV420 output
|
||||
|
||||
In order to support the HDMI2.0 YUV420 display modes, this patch
|
||||
adds support for the YUV420 TMDS Clock divided by 2 and the controller
|
||||
passthrough mode.
|
||||
|
||||
This patch is based on work from Zheng Yang <zhengyang@rock-chips.com> in
|
||||
the Rockchip Linux 4.4 BSP at [1]
|
||||
|
||||
[1] https://github.com/rockchip-linux/kernel/tree/release-4.4
|
||||
|
||||
Cc: Zheng Yang <zhengyang@rock-chips.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 63 ++++++++++++++++++-----
|
||||
1 file changed, 50 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
index 2a30d8393477..c3e4ed1e2d1c 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
@@ -94,6 +94,7 @@ struct hdmi_vmode {
|
||||
unsigned int mpixelclock;
|
||||
unsigned int mpixelrepetitioninput;
|
||||
unsigned int mpixelrepetitionoutput;
|
||||
+ unsigned int mtmdsclock;
|
||||
};
|
||||
|
||||
struct hdmi_data_info {
|
||||
@@ -549,7 +550,7 @@ static void hdmi_init_clk_regenerator(struct dw_hdmi *hdmi)
|
||||
static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi)
|
||||
{
|
||||
mutex_lock(&hdmi->audio_mutex);
|
||||
- hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock,
|
||||
+ hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock,
|
||||
hdmi->sample_rate);
|
||||
mutex_unlock(&hdmi->audio_mutex);
|
||||
}
|
||||
@@ -558,7 +559,7 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate)
|
||||
{
|
||||
mutex_lock(&hdmi->audio_mutex);
|
||||
hdmi->sample_rate = rate;
|
||||
- hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock,
|
||||
+ hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock,
|
||||
hdmi->sample_rate);
|
||||
mutex_unlock(&hdmi->audio_mutex);
|
||||
}
|
||||
@@ -659,6 +660,20 @@ static bool hdmi_bus_fmt_is_yuv422(unsigned int bus_format)
|
||||
}
|
||||
}
|
||||
|
||||
+static bool hdmi_bus_fmt_is_yuv420(unsigned int bus_format)
|
||||
+{
|
||||
+ switch (bus_format) {
|
||||
+ case MEDIA_BUS_FMT_UYYVYY8_0_5X24:
|
||||
+ case MEDIA_BUS_FMT_UYYVYY10_0_5X30:
|
||||
+ case MEDIA_BUS_FMT_UYYVYY12_0_5X36:
|
||||
+ case MEDIA_BUS_FMT_UYYVYY16_0_5X48:
|
||||
+ return true;
|
||||
+
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int hdmi_bus_fmt_color_depth(unsigned int bus_format)
|
||||
{
|
||||
switch (bus_format) {
|
||||
@@ -888,7 +903,8 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi)
|
||||
u8 val, vp_conf;
|
||||
|
||||
if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) ||
|
||||
- hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) {
|
||||
+ hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) ||
|
||||
+ hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) {
|
||||
switch (hdmi_bus_fmt_color_depth(
|
||||
hdmi->hdmi_data.enc_out_bus_format)) {
|
||||
case 8:
|
||||
@@ -1029,7 +1045,7 @@ EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
|
||||
|
||||
void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi)
|
||||
{
|
||||
- unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mpixelclock;
|
||||
+ unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock;
|
||||
|
||||
/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
|
||||
if (hdmi->connector.display_info.hdmi.scdc.supported) {
|
||||
@@ -1370,6 +1386,9 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
|
||||
struct hdmi_avi_infoframe frame;
|
||||
u8 val;
|
||||
|
||||
+ if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format))
|
||||
+ is_hdmi2_sink = true;
|
||||
+
|
||||
/* Initialise info frame from DRM mode */
|
||||
drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, is_hdmi2_sink);
|
||||
|
||||
@@ -1377,6 +1396,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
|
||||
frame.colorspace = HDMI_COLORSPACE_YUV444;
|
||||
else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format))
|
||||
frame.colorspace = HDMI_COLORSPACE_YUV422;
|
||||
+ else if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format))
|
||||
+ frame.colorspace = HDMI_COLORSPACE_YUV420;
|
||||
else
|
||||
frame.colorspace = HDMI_COLORSPACE_RGB;
|
||||
|
||||
@@ -1534,15 +1555,18 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi;
|
||||
struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode;
|
||||
int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len;
|
||||
- unsigned int vdisplay;
|
||||
+ unsigned int vdisplay, hdisplay;
|
||||
|
||||
- vmode->mpixelclock = mode->clock * 1000;
|
||||
+ vmode->mtmdsclock = vmode->mpixelclock = mode->clock * 1000;
|
||||
|
||||
dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock);
|
||||
|
||||
+ if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format))
|
||||
+ vmode->mtmdsclock /= 2;
|
||||
+
|
||||
/* Set up HDMI_FC_INVIDCONF */
|
||||
inv_val = (hdmi->hdmi_data.hdcp_enable ||
|
||||
- vmode->mpixelclock > 340000000 ||
|
||||
+ vmode->mtmdsclock > 340000000 ||
|
||||
hdmi_info->scdc.scrambling.low_rates ?
|
||||
HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
|
||||
HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE);
|
||||
@@ -1576,6 +1600,22 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
|
||||
hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF);
|
||||
|
||||
+ hdisplay = mode->hdisplay;
|
||||
+ hblank = mode->htotal - mode->hdisplay;
|
||||
+ h_de_hs = mode->hsync_start - mode->hdisplay;
|
||||
+ hsync_len = mode->hsync_end - mode->hsync_start;
|
||||
+
|
||||
+ /*
|
||||
+ * When we're setting a YCbCr420 mode, we need
|
||||
+ * to adjust the horizontal timing to suit.
|
||||
+ */
|
||||
+ if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) {
|
||||
+ hdisplay /= 2;
|
||||
+ hblank /= 2;
|
||||
+ h_de_hs /= 2;
|
||||
+ hsync_len /= 2;
|
||||
+ }
|
||||
+
|
||||
vdisplay = mode->vdisplay;
|
||||
vblank = mode->vtotal - mode->vdisplay;
|
||||
v_de_vs = mode->vsync_start - mode->vdisplay;
|
||||
@@ -1594,7 +1634,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
|
||||
/* Scrambling Control */
|
||||
if (hdmi_info->scdc.supported) {
|
||||
- if (vmode->mpixelclock > 340000000 ||
|
||||
+ if (vmode->mtmdsclock > 340000000 ||
|
||||
hdmi_info->scdc.scrambling.low_rates) {
|
||||
drm_scdc_readb(&hdmi->i2c->adap, SCDC_SINK_VERSION,
|
||||
&bytes);
|
||||
@@ -1613,15 +1653,14 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
}
|
||||
|
||||
/* Set up horizontal active pixel width */
|
||||
- hdmi_writeb(hdmi, mode->hdisplay >> 8, HDMI_FC_INHACTV1);
|
||||
- hdmi_writeb(hdmi, mode->hdisplay, HDMI_FC_INHACTV0);
|
||||
+ hdmi_writeb(hdmi, hdisplay >> 8, HDMI_FC_INHACTV1);
|
||||
+ hdmi_writeb(hdmi, hdisplay, HDMI_FC_INHACTV0);
|
||||
|
||||
/* Set up vertical active lines */
|
||||
hdmi_writeb(hdmi, vdisplay >> 8, HDMI_FC_INVACTV1);
|
||||
hdmi_writeb(hdmi, vdisplay, HDMI_FC_INVACTV0);
|
||||
|
||||
/* Set up horizontal blanking pixel region width */
|
||||
- hblank = mode->htotal - mode->hdisplay;
|
||||
hdmi_writeb(hdmi, hblank >> 8, HDMI_FC_INHBLANK1);
|
||||
hdmi_writeb(hdmi, hblank, HDMI_FC_INHBLANK0);
|
||||
|
||||
@@ -1629,7 +1668,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
hdmi_writeb(hdmi, vblank, HDMI_FC_INVBLANK);
|
||||
|
||||
/* Set up HSYNC active edge delay width (in pixel clks) */
|
||||
- h_de_hs = mode->hsync_start - mode->hdisplay;
|
||||
hdmi_writeb(hdmi, h_de_hs >> 8, HDMI_FC_HSYNCINDELAY1);
|
||||
hdmi_writeb(hdmi, h_de_hs, HDMI_FC_HSYNCINDELAY0);
|
||||
|
||||
@@ -1637,7 +1675,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
|
||||
hdmi_writeb(hdmi, v_de_vs, HDMI_FC_VSYNCINDELAY);
|
||||
|
||||
/* Set up HSYNC active pulse width (in pixel clks) */
|
||||
- hsync_len = mode->hsync_end - mode->hsync_start;
|
||||
hdmi_writeb(hdmi, hsync_len >> 8, HDMI_FC_HSYNCINWIDTH1);
|
||||
hdmi_writeb(hdmi, hsync_len, HDMI_FC_HSYNCINWIDTH0);
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user