Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a860374d64 | ||
|
|
42c2f88588 | ||
|
|
2107a6b64d | ||
|
|
75e721e77e | ||
|
|
fd707ba270 | ||
|
|
76fad70ebe | ||
|
|
d6ad746fda | ||
|
|
60c9013535 | ||
|
|
ae0a2fe264 | ||
|
|
bc3cc20629 | ||
|
|
d94095a565 | ||
|
|
8ed63a9aab | ||
|
|
27a94565ea | ||
|
|
d46e2a808f | ||
|
|
50bc0451d0 | ||
|
|
5ff51846e2 | ||
|
|
4411307353 | ||
|
|
a9bbc7babe | ||
|
|
80f5fe0722 | ||
|
|
519acca46d | ||
|
|
566641bf8a | ||
|
|
4d99243c91 | ||
|
|
18640da277 | ||
|
|
5351b542ff | ||
|
|
033e153d49 | ||
|
|
ad898040ac | ||
|
|
9e29a12f95 | ||
|
|
0ab78a97c7 | ||
|
|
43c423243a | ||
|
|
19488834e4 | ||
|
|
dc35208efe | ||
|
|
2435ca9065 | ||
|
|
404efdee52 | ||
|
|
cbd9b45adc | ||
|
|
56992c6a77 | ||
|
|
47bb76acec | ||
|
|
caf708e14a | ||
|
|
809abbfde2 | ||
|
|
a2363d9a27 | ||
|
|
5cdf66c2c8 | ||
|
|
a7fa7efbf9 | ||
|
|
976e9b0bce | ||
|
|
960e11dc4f | ||
|
|
2291e8599e | ||
|
|
bcb9c3fa1f | ||
|
|
b827a90a35 | ||
|
|
921dd693dd | ||
|
|
005cbc0b89 | ||
|
|
482e6f7a7b | ||
|
|
b83bfc5910 | ||
|
|
c475daf889 | ||
|
|
dac76b1632 | ||
|
|
faa371191f | ||
|
|
8cde7f9192 | ||
|
|
1112a10509 | ||
|
|
ad9f21fdfb | ||
|
|
55cc60fc8e | ||
|
|
075799aaa8 | ||
|
|
3733a07bac | ||
|
|
eb553bec07 | ||
|
|
803bfc8391 | ||
|
|
e7e2dc2aad | ||
|
|
352072cc5a | ||
|
|
5d90fa9e20 | ||
|
|
54389be443 | ||
|
|
ae8dec9f72 | ||
|
|
064ee9ef84 | ||
|
|
21e3a30012 | ||
|
|
8d86fa9ec9 | ||
|
|
1ead97f64a | ||
|
|
703f0168bf | ||
|
|
7cea5a829f | ||
|
|
0bc81f78ec | ||
|
|
331336a2d4 | ||
|
|
8086b55acd | ||
|
|
2a0d551667 | ||
|
|
61b0b333f0 | ||
|
|
dc0f6367cb | ||
|
|
486161f2d8 | ||
|
|
9441f6b16e | ||
|
|
514c59796f | ||
|
|
ebf84216e9 | ||
|
|
74ff13e25e | ||
|
|
9b170812d6 | ||
|
|
3b45011982 | ||
|
|
8e1af1313b | ||
|
|
0f8010bc90 | ||
|
|
7006a5fd64 | ||
|
|
170ed2db00 | ||
|
|
ef40d38b12 | ||
|
|
d144f72868 | ||
|
|
11088580c5 | ||
|
|
5c8f8bea48 | ||
|
|
8bb3732934 | ||
|
|
86f88aae0a | ||
|
|
10e310d8b5 | ||
|
|
6467f343cd | ||
|
|
e20249676a |
@@ -1,3 +1,7 @@
|
||||
buildroot
|
||||
buildroot-external
|
||||
buildroot-patches
|
||||
# We don't need this folder because we map the hole folder
|
||||
buildroot/
|
||||
buildroot-external/
|
||||
buildroot-patches/
|
||||
|
||||
# Ignore too
|
||||
release/
|
||||
|
||||
13
.github/move.yml
vendored
13
.github/move.yml
vendored
@@ -1,13 +0,0 @@
|
||||
# Configuration for move-issues - https://github.com/dessant/move-issues
|
||||
|
||||
# Delete the command comment. Ignored when the comment also contains other content
|
||||
deleteCommand: true
|
||||
# Close the source issue after moving
|
||||
closeSourceIssue: true
|
||||
# Lock the source issue after moving
|
||||
lockSourceIssue: false
|
||||
# Set custom aliases for targets
|
||||
# aliases:
|
||||
# r: repo
|
||||
# or: owner/repo
|
||||
|
||||
25
.travis.yml
Normal file
25
.travis.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
language: bash
|
||||
|
||||
sudo: required
|
||||
service: docker
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
|
||||
before_install:
|
||||
- shopt -s globstar
|
||||
- docker pull koalaman/shellcheck
|
||||
|
||||
script:
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck scripts/*.sh
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/scripts/*.sh
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/scripts/*.sh
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/board/**/*.sh
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/rootfs-overlay/usr/sbin/*
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/rootfs-overlay/usr/libexec/*
|
||||
- docker run -v $(pwd):/mnt koalaman/shellcheck buildroot-external/rootfs-overlay/usr/lib/rauc/*
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
@@ -1,9 +1,9 @@
|
||||
# Bluetooth
|
||||
|
||||
We support `bluetoothctl` on host. Later we want also support bluetooth trought UI.
|
||||
We support `bluetoothctl` on host. Later we want also support Bluetooth trought 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 setup Bluetooth on host, use the `bluetoothctl` utility.
|
||||
|
||||
## Scan devices
|
||||
|
||||
|
||||
22
Documentation/boards/odroid-c2.md
Normal file
22
Documentation/boards/odroid-c2.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Odroid-C2
|
||||
|
||||
## 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`
|
||||
|
||||
## USB
|
||||
|
||||
A long-standing kernel bug currently results in some odd behavior. To use the USB, a device must be plugged into one of the USB ports at hard boot. If all devices are removed from the USB ports, the USB will cease to function until a reboot.
|
||||
|
||||
### OTG
|
||||
|
||||
The OTG USB is untested.
|
||||
|
||||
## GPIO
|
||||
|
||||
Refer to [the odroid wiki](https://wiki.odroid.com/odroid-c2/hardware/expansion_connectors).
|
||||
@@ -1,7 +1,7 @@
|
||||
# OVA
|
||||
|
||||
The OVA stay for open virtual appliance. Currently we had remove the ova files and publish a vmdk virtual disk,
|
||||
until we have better OVF template to generate our OVA. This vmdk work with (maybe you need convert the disk):
|
||||
OVA stands for Open Virtual Appliance. Currently we had remove the ova files and publish a vmdk virtual disk,
|
||||
until we have better OVF template to generate our OVA. This VMDK work with (maybe you need convert the disk):
|
||||
- HyperV
|
||||
- VirtualBox
|
||||
- VMware
|
||||
|
||||
@@ -16,7 +16,7 @@ The 64bit version is under development by RPi-Team. It work very nice but it cou
|
||||
|
||||
## Serial console
|
||||
|
||||
For access to terminal over serial console, add `console=ttyAMA0,115200` to `cmdline.txt` and `enable_uart=1` into `config.txt`. GPIO pins are: 6 = GND / 8 = UART TXD / 10 = UART RXD.
|
||||
For access to terminal over serial console, add `console=ttyAMA0,115200` to `cmdline.txt` and `enable_uart=1`, `dtoverlay=pi3-disable-bt` into `config.txt`. GPIO pins are: 6 = GND / 8 = UART TXD / 10 = UART RXD.
|
||||
|
||||
## I2C
|
||||
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
|
||||
## Automatic
|
||||
|
||||
You can use a 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`. Use the following directory structure within the USB drive:
|
||||
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:
|
||||
|
||||
```
|
||||
```text
|
||||
network/
|
||||
modules/
|
||||
udev/
|
||||
authorized_keys
|
||||
timesyncd.conf
|
||||
hassos-xy.raucb
|
||||
```
|
||||
|
||||
- The `network` folder can contain any kind of NetworkManager connection files. For more information see [Network][network.md].
|
||||
- The `modules` folder is for modules-load configuration files.
|
||||
- The `udev` folder is for udev rules files.
|
||||
- The `authorized_keys` file activates debug SSH access on port `22222`. See [Debugging Hassio][debug-hassio].
|
||||
- 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
|
||||
@@ -24,15 +28,29 @@ API/UI or by calling `systemctl restart hassos-config` on the host.
|
||||
|
||||
### Bootargs
|
||||
|
||||
You can edit or create a `cmdline.txt` into your boot partition. That will be read from our bootloader.
|
||||
You can edit or create a `cmdline.txt` in your boot partition. That will be read from the bootloader.
|
||||
|
||||
### Kernel-Module
|
||||
|
||||
The kernel module folder `/etc/modules-load.d` is persistent and you can add your config files there. See [Systemd modules load][systemd-modules].
|
||||
The kernel module folder `/etc/modules-load.d` is persistent and you can add your configuration files there. See [Systemd modules load][systemd-modules].
|
||||
|
||||
### Udev rules
|
||||
|
||||
The udev rules folder `/etc/udev/rules.d` is persistent and you can add your configuration files there.
|
||||
|
||||
### Network
|
||||
|
||||
You can manual add, edit or remove connections configs from `/etc/NetworkManager/system-connections`.
|
||||
You can manual add, edit or remove connections configurations from `/etc/NetworkManager/system-connections`.
|
||||
|
||||
### NTP
|
||||
|
||||
You can manual edit the systemd timesync file on `/etc/systemd/timesyncd.conf`.
|
||||
Our default ntp configuration look like:
|
||||
```
|
||||
[Time]
|
||||
NTP=time1.google.com time2.google.com time3.google.com
|
||||
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
|
||||
```
|
||||
|
||||
[systemd-modules]: https://www.freedesktop.org/software/systemd/man/modules-load.d.html
|
||||
[network.md]: network.md
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# Deployment
|
||||
|
||||
We know 3 types of release builds:
|
||||
We provide 3 different types of release builds:
|
||||
|
||||
- development (beta/dev)
|
||||
- staging (rc)
|
||||
- production (stable)
|
||||
|
||||
## Versioning
|
||||
|
||||
The format of version is *MAJOR.BUILD*. Everytime we create a new release with same userland, we bump the build number.
|
||||
The development use here own major number they will be bump for the stable version and the development version go to next major number.
|
||||
|
||||
@@ -16,11 +18,11 @@ The development use here own major number they will be bump for the stable versi
|
||||
3.x = stable
|
||||
```
|
||||
|
||||
## GIT Branch/Tag
|
||||
The branch `dev` ist the actual development branch and from there we never make a release. The `master` branch hould the development
|
||||
version from they we build a beta release.
|
||||
## Git branch/Tag
|
||||
|
||||
If we create a new staging/productive release, we create a new branch `rel-{MAJOR}`. They will be used for the hole cycle of this release.
|
||||
The branch `dev` ist the actual development branch and from there we never make a release. The `master` branch contains the development version and from there we build a beta release.
|
||||
|
||||
If we create a new staging/productive release, we create a new branch `rel-{MAJOR}`. They will be used for the whole cycle of this release.
|
||||
|
||||
## Upload release files
|
||||
|
||||
|
||||
24
Documentation/development.md
Normal file
24
Documentation/development.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Development
|
||||
|
||||
## Boot system
|
||||
|
||||
`BOOT_SYS`:
|
||||
- efi
|
||||
- hyprid
|
||||
- spl
|
||||
- mbr
|
||||
|
||||
HassOS is basicly used GPT. But for use GPT we need own the first 1024 of
|
||||
boot drive. Is that not possible, you can use MBR for your device, they work also with SPLs.
|
||||
|
||||
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.
|
||||
|
||||
`BOOTLOADER`:
|
||||
- uboot
|
||||
- barebox
|
||||
|
||||
We support mainly uboot but for uefi system we can also use barebox. In future we hope to remove barebox with uboot also on uefi.
|
||||
|
||||
`DISK_SIZE`:
|
||||
Default 2. That is the size of end image in GB.
|
||||
|
||||
106
Documentation/getting_started_development.md
Normal file
106
Documentation/getting_started_development.md
Normal file
@@ -0,0 +1,106 @@
|
||||
Getting started with Hassos development using Docker on GNU/Linux
|
||||
=================================================================
|
||||
|
||||
First, install **docker** for your distribution - I'd advise to use your distro's provided packages, since that will make sure permissions et al. are sanely set up for what you are about to run. You're also expected to have your current user properly set up in in your sudoers policy, so that this account may elevate to root and execute arbitrary commands as UID 0 (this is required, since at some point during the build process, a new loopback device-backed filesystem image will be mounted inside a docker container - which requires a "privileged" container to run, which can only be done as root).
|
||||
|
||||
Next, make sure the docker daemon is running:
|
||||
|
||||
```
|
||||
$ sudo systemctl status docker
|
||||
● docker.service - Docker Application Container Engine
|
||||
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
|
||||
Active: inactive (dead)
|
||||
Docs: https://docs.docker.com
|
||||
```
|
||||
|
||||
My desktop distro doesn't start newly installed services by default, which means I'll have to manually fire up the `docker` service:
|
||||
|
||||
```
|
||||
$ sudo systemctl start docker
|
||||
$ sudo systemctl --no-pager status docker -n0
|
||||
● docker.service - Docker Application Container Engine
|
||||
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
|
||||
Active: active (running) since Wed 2018-10-10 21:08:23 CEST; 25s ago
|
||||
Docs: https://docs.docker.com
|
||||
Main PID: 1531 (dockerd)
|
||||
Tasks: 27 (limit: 4915)
|
||||
Memory: 163.4M
|
||||
CGroup: /system.slice/docker.service
|
||||
├─1531 /usr/bin/dockerd -H fd://
|
||||
└─1539 docker-containerd --config /var/run/docker/containerd/containerd.toml
|
||||
```
|
||||
|
||||
Now, change your working directory to your hassos repo checkout (please adapt pathnames as needed), make sure your intended changes to the source tree are applied (and committed, ideally :)), and execute the `enter.sh` helper script:
|
||||
|
||||
```
|
||||
$ cd ~/codebase/hassos/
|
||||
$ sudo scripts/enter.sh
|
||||
Sending build context to Docker daemon 30.48MB
|
||||
Step 1/6 : FROM ubuntu:18.04
|
||||
[...]
|
||||
---> 4dc25a21556b
|
||||
Successfully built 4dc25a21556b
|
||||
Successfully tagged hassbuildroot:latest
|
||||
```
|
||||
|
||||
Note that the current iteration of `enter.sh` will try to load the **overlayfs** kernel module, which is not strictly required for docker's operation, as far as I can tell. It's OK if loading that module fails; the shell script will continue executing. If everything works out, you will find yourself in an interactive login shell inside your docker container/build environment, where you can peek around:
|
||||
|
||||
```
|
||||
root@somehashinhex:/build#
|
||||
root@somehashinhex:/build# cat scripts/build-all.sh
|
||||
[...]
|
||||
```
|
||||
|
||||
The _hassos_ developers provides another convenience script that will build hassos images for a (rather long!) list of targets - if you're not interested in building artifacts for all supported platforms, make sure to take a peek inside and monkeypatch away... After you're done making changes, start it, and go make a cup of tea. Or fifteen.
|
||||
|
||||
```
|
||||
root@0db6f7079872:/build# scripts/build-all.sh
|
||||
[...]
|
||||
```
|
||||
|
||||
Personally, I removed all advertised build targets from the `all_platforms` array variable, expect for the _ova_ variant. That will result in a single VMDK image file at the very end of the build process. This image file is a compressed block device dump with a proper GPT partition table, prepared to ship into any OVA-compatible hypervisor's innards. For me, the end of the **ova** build steps looks like this:
|
||||
|
||||
```
|
||||
[...]
|
||||
2097152+0 records out
|
||||
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 12.2145 s, 87.9 MB/s
|
||||
make: Leaving directory '/build/buildroot'
|
||||
make: Entering directory '/build/buildroot'
|
||||
rm -rf /build/buildroot/output/target /build/buildroot/output/images /build/buildroot/output/host \
|
||||
/build/buildroot/output/build /build/buildroot/output/staging \
|
||||
/build/buildroot/output/legal-info /build/buildroot/output/graphs
|
||||
make: Leaving directory '/build/buildroot'
|
||||
```
|
||||
|
||||
The artifacts you just built are placed in the `target/` subdirectory:
|
||||
|
||||
```
|
||||
root@fd292c061896:/build# ls -lh release/
|
||||
total 141M
|
||||
-rw-r--r-- 1 root root 141M Oct 10 20:22 hassos_ova-2.2.vmdk.gz
|
||||
```
|
||||
|
||||
In order to be able to use this image file with the **qemu** hypervisor, you'll need to unpack it, and convert it to an image format that qemu can work with. Conveniently, the _hassos_ buildenv already provides all the tools we need for this conversion:
|
||||
|
||||
```
|
||||
root@fd292c061896:/build# gunzip release/hassos_ova-2.2.vmdk.gz
|
||||
root@fd292c061896:/build# qemu-img convert -O qcow2 release/hassos_ova-2.2.vmdk release/hassos_ova-2.2.qcow2
|
||||
root@fd292c061896:/build# ls -lh release/
|
||||
total 673M
|
||||
-rw-r--r-- 1 root root 337M Oct 10 20:25 hassos_ova-2.2.qcow2
|
||||
-rw-r--r-- 1 root root 337M Oct 10 20:22 hassos_ova-2.2.vmdk
|
||||
```
|
||||
|
||||
Now, exit the docker container's environment, and find the build artifacts in the `releases/` directory beneath your repository checkout dir. (The generated files will be owned by _root_; make sure to `chown` them to your user account, if needed.)
|
||||
|
||||
From there, qemu can try to boot it. Since the generated image assumes UEFI support in the host/hypervisor, this is slightly more tricky than with "classic"(/legacy) MBR-based images. On the *Debian* host I use to run my qemu virtual machine on, you'll need to install the **ovmf** package, which is described as providing "UEFI firmware for 64-bit x86 virtual machines". That package will install a _TianoCore_-derived qemu UEFI image build at `/usr/share/OVMF/OVMF_CODE.fd`, which we'll use with qemu to boot the generated qcow2 image. (Please adapt pathnames as necessary, for example if you have installed the ovmf firmware image at another location.)
|
||||
|
||||
```
|
||||
$ /usr/bin/qemu-system-x86_64 -enable-kvm -name hassos_ova -smp 2 -m 1024 -drive file=release/hassos_ova-2.2.qcow2,index=0,media=disk,if=ide,cache=none,format=qcow2 -drive file=/usr/share/ovmf/x64/OVMF_CODE.fd,if=pflash,format=raw,readonly=on
|
||||
```
|
||||
|
||||
This should pop up qemu's SDL frontend, displaying _hassos_' VT/CLI environment. Specifying addtional options and flags to qemu for network access, keyboard layout et al. are left as an exercise for the reader.
|
||||
|
||||
After the boot process has finished, you can log in to _hassos_ without a password, providing *root* as the username. From there, executing `login` on the *hassio>* shell prompt will yield a root shell in the host OS.
|
||||
|
||||
Happy hacking! :)
|
||||
@@ -3,5 +3,7 @@
|
||||
|
||||
| Board | Version |
|
||||
|-------|---------|
|
||||
| Open Virtual Applicance | 4.14.59 |
|
||||
| Raspberry Pi | 4.14.58 |
|
||||
| Open Virtual Applicance | 4.14.82 |
|
||||
| Raspberry Pi | 4.14.81 |
|
||||
| Tinker Board | 4.14.82 |
|
||||
| Odroid-C2 | 4.18.20 |
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# 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 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 as described in [Configuration][configuration-usb].
|
||||
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
|
||||
|
||||
You can also read the [Official Manual][keyfile] or there are a lot of examples accross internet. The system is read only, if you don't want the IP address to change every boot, you should set the uuid property with a generic [UUID4][uuid]. Inside the `network` folder create the file `my-network` and add the appropriate contents below:
|
||||
You can read the [Official Manual][keyfile] or find many configuration examples across the internet. The system is read-only, if you don't want the IP address to change on every boot, you should set the UUID property with a generic [UUID4][uuid]. Inside `\CONFIG\network\` on the USB or SD, create a file called `my-network` and add the appropriate contents below:
|
||||
|
||||
### Default
|
||||
|
||||
We have a preinstalled connection profile:
|
||||
```
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
id=HassOS default
|
||||
uuid=f62bf7c2-e565-49ff-bbfc-a4cf791e6add
|
||||
@@ -24,6 +25,7 @@ method=auto
|
||||
```
|
||||
|
||||
### LAN
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
id=hassos-network
|
||||
@@ -39,6 +41,7 @@ method=auto
|
||||
```
|
||||
|
||||
### Wireless WPA/PSK
|
||||
|
||||
```ini
|
||||
[connection]
|
||||
id=hassos-network
|
||||
@@ -48,11 +51,13 @@ type=802-11-wireless
|
||||
[802-11-wireless]
|
||||
mode=infrastructure
|
||||
ssid=MY_SSID
|
||||
# Uncomment below if your SSID is not broadcasted
|
||||
#hidden=true
|
||||
|
||||
[802-11-wireless-security]
|
||||
auth-alg=open
|
||||
key-mgmt=wpa-psk
|
||||
psk=MY_WLAN_SECRED_KEY
|
||||
psk=MY_WLAN_SECRET_KEY
|
||||
|
||||
[ipv4]
|
||||
method=auto
|
||||
@@ -64,19 +69,22 @@ method=auto
|
||||
|
||||
### Static IP
|
||||
|
||||
Replace follow configs:
|
||||
Replace the following configuration:
|
||||
|
||||
```ini
|
||||
[ipv4]
|
||||
method=manual
|
||||
address1=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.
|
||||
|
||||
## Tips
|
||||
|
||||
### Reset network
|
||||
|
||||
If you want reset the network configuration to default, use follow commands on host:
|
||||
If you want to reset the network configuration back to the default DHCP settings, use the following commands on the host:
|
||||
|
||||
```bash
|
||||
$ rm /etc/NetworkManager/system-connections/*
|
||||
$ cp /usr/share/system-connections/* /etc/NetworkManager/system-connections/
|
||||
@@ -86,11 +94,50 @@ $ nmcli con reload
|
||||
### Powersave
|
||||
|
||||
If you have trouble with powersave you can do following:
|
||||
|
||||
```ini
|
||||
[wifi]
|
||||
# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable).
|
||||
powersave=0
|
||||
```
|
||||
## Using nmcli to set a static IPV4 address
|
||||
|
||||
Log into the HASSOS base system via a console:
|
||||
|
||||
```
|
||||
Welcome to HassOS
|
||||
Hassio login:
|
||||
```
|
||||
Login as `root` (no password needed)
|
||||
|
||||
At the `hassio >` prompt, type `login` (as instructed).
|
||||
|
||||
From here you will use the `nmcli` configuration tool.
|
||||
|
||||
`# nmcli connection show` will list the “HassOS default” connection in use.
|
||||
|
||||
`# nmcli con show "HassOS default"` will list all the properties of the connection.
|
||||
|
||||
`# nmcli con edit "HassOS default"` will put you in a position to edit the connection.
|
||||
|
||||
`nmcli> print ipv4` will show you the ipv4 properties of this connection.
|
||||
|
||||
To add your static IP address (select 'yes' for manual method);
|
||||
```
|
||||
nmcli> set ipv4.addresses 192.168.100.10/24
|
||||
Do you also want to set 'ipv4.method' to 'manual'? [yes]:
|
||||
```
|
||||
In addition I have found it is wise to set the dns server and the local gateway. For most home routers these will be the same address. If you are using Pi-Hole you can set the dns to that.
|
||||
```
|
||||
nmcli> set ipv4.dns 192.168.100.1
|
||||
nmcli> set ipv4.gateway 192.168.100.1
|
||||
nmcli> save
|
||||
nmcli> quit
|
||||
```
|
||||
|
||||
If you now view the default connection `cat /etc/NetworkManager/system-connections/default` you should see the method is manual and the address is set.
|
||||
|
||||
Doing a `nmcli con reload` does not always work so restart the VM.
|
||||
|
||||
[keyfile]: https://developer.gnome.org/NetworkManager/stable/nm-settings.html
|
||||
[configuration-usb]: configuration.md
|
||||
|
||||
@@ -3,3 +3,4 @@ source "$BR2_EXTERNAL_HASSOS_PATH/package/libapparmor/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/apparmor/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/bluetooth-bcm43xx/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/bluetooth-rtl8723/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/hardkernel-boot/Config.in"
|
||||
|
||||
28
buildroot-external/board/asus/hassos-hook.sh
Executable file
28
buildroot-external/board/asus/hassos-hook.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC2155
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp -t "${BOOT_DATA}" \
|
||||
"${BINARIES_DIR}/boot.scr" \
|
||||
"${BINARIES_DIR}/rk3288-tinker.dtb"
|
||||
|
||||
echo "console=tty1" > "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# Create boot binary
|
||||
rm -f "${BINARIES_DIR}/u-boot-spl-dtb.img"
|
||||
mkimage -n rk3288 -T rksd -d "${BINARIES_DIR}/u-boot-spl-dtb.bin" "${BINARIES_DIR}/u-boot-spl-dtb.img"
|
||||
cat "${BINARIES_DIR}/u-boot-dtb.bin" >> "${BINARIES_DIR}/u-boot-spl-dtb.img"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BINARIES_DIR}/u-boot-spl-dtb.img" of="${SPL_IMG}" conv=notrunc bs=512 seek=64
|
||||
}
|
||||
|
||||
|
||||
function hassos_post_image() {
|
||||
convert_disk_image_gz
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
BOARD_ID=tinker
|
||||
BOARD_NAME="Tinker Board"
|
||||
BOARD_NAME="Asus TinkerBoard"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=zImage
|
||||
5
buildroot-external/board/asus/tinker/patches/README.md
Normal file
5
buildroot-external/board/asus/tinker/patches/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
## Kernel
|
||||
https://github.com/armbian/build/tree/master/patch/kernel/rockchip-next
|
||||
|
||||
## u-boot
|
||||
https://github.com/armbian/build/tree/master/patch/u-boot/u-boot-rockchip/board_tinkerboard
|
||||
@@ -1,3 +1,17 @@
|
||||
|
||||
part start mmc ${devnum} 6 mmc_env
|
||||
mmc dev ${devnum}
|
||||
setenv loadbootstate " \
|
||||
echo 'loading env...'; \
|
||||
mmc read ${ramdisk_addr_r} ${mmc_env} 0x40; \
|
||||
env import -c ${ramdisk_addr_r} 0x8000;"
|
||||
|
||||
setenv storebootstate " \
|
||||
echo 'storing env...'; \
|
||||
env export -c -s 0x8000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \
|
||||
mmc write ${ramdisk_addr_r} ${mmc_env} 0x40;"
|
||||
|
||||
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
|
||||
@@ -10,10 +24,10 @@ setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro"
|
||||
|
||||
# Load extraargs
|
||||
fileenv mmc 1:1 ${ramdisk_addr_r} cmdline.txt cmdline
|
||||
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
|
||||
|
||||
# Load device tree
|
||||
fatload mmc 1:1 ${fdt_addr_r} rk3288-tinker.dtb
|
||||
fatload mmc ${devnum}:1 ${fdt_addr_r} rk3288-tinker.dtb
|
||||
|
||||
setenv bootargs
|
||||
for BOOT_SLOT in "${BOOT_ORDER}"; do
|
||||
@@ -23,26 +37,26 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
|
||||
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 1:2 ${kernel_addr_r} zImage"
|
||||
setenv load_kernel "ext4load mmc ${devnum}:2 ${kernel_addr_r} zImage"
|
||||
setenv bootargs "${bootargs_hassos} ${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 1:4 ${kernel_addr_r} zImage"
|
||||
setenv load_kernel "ext4load mmc ${devnum}:4 ${kernel_addr_r} zImage"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if test -n "${bootargs}"; then
|
||||
saveenv
|
||||
run storebootstate
|
||||
else
|
||||
echo "No valid slot found, resetting tries to 3"
|
||||
setenv BOOT_A_LEFT 3
|
||||
setenv BOOT_B_LEFT 3
|
||||
saveenv
|
||||
run storebootstate
|
||||
reset
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# CONFIG_USB_STORAGE is not set
|
||||
# CONFIG_DOS_PARTITION is not set
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_CMD_FILEENV=y
|
||||
CONFIG_ENV_OFFSET=0x25100000
|
||||
CONFIG_ENV_IS_NOWHERE=Y
|
||||
131
buildroot-external/board/hardkernel/odroid-c2/boot-env.txt
Normal file
131
buildroot-external/board/hardkernel/odroid-c2/boot-env.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
|
||||
|
||||
# Custom modeline!
|
||||
# To use custom modeline you need to disable all the below resolutions
|
||||
# and setup your own!
|
||||
# For more information check our wiki:
|
||||
# http://odroid.com/dokuwiki/doku.php?id=en:c2_hdmi_autosetting
|
||||
# Example below:
|
||||
#m=custombuilt
|
||||
#modeline=1920,1200,154000,74040,60,1920,1968,2000,2080,1200,1202,1208,1235,1,0,1
|
||||
|
||||
# 480 Lines (720x480)
|
||||
#m=480i60hz
|
||||
#m=480i_rpt
|
||||
#m=480p60hz
|
||||
#m=480p_rpt
|
||||
|
||||
# 576 Lines (720x576)
|
||||
#m=576i50hz
|
||||
#m=576i_rpt
|
||||
#m=576p50hz
|
||||
#m=576p_rpt
|
||||
|
||||
# 720 Lines (1280x720)
|
||||
#m=720p50hz
|
||||
#m=720p60hz
|
||||
|
||||
# 1080 Lines (1920x1080)
|
||||
#m=1080i60hz
|
||||
m=1080p60hz
|
||||
#m=1080i50hz
|
||||
#m=1080p50hz
|
||||
#m=1080p24hz
|
||||
|
||||
# 4K (3840x2160)
|
||||
#m=2160p30hz
|
||||
#m=2160p25hz
|
||||
#m=2160p24hz
|
||||
#m=smpte24hz
|
||||
#m=2160p50hz
|
||||
#m=2160p60hz
|
||||
#m=2160p50hz420
|
||||
#m=2160p60hz420
|
||||
|
||||
### VESA modes ###
|
||||
#m=640x480p60hz
|
||||
#m=800x480p60hz
|
||||
#m=480x800p60hz
|
||||
#m=800x600p60hz
|
||||
#m=1024x600p60hz
|
||||
#m=1024x768p60hz
|
||||
#m=1280x800p60hz
|
||||
#m=1280x1024p60hz
|
||||
#m=1360x768p60hz
|
||||
#m=1440x900p60hz
|
||||
#m=1600x900p60hz
|
||||
#m=1680x1050p60hz
|
||||
#m=1600x1200p60hz
|
||||
#m=1920x1200p60hz
|
||||
#m=2560x1080p60hz
|
||||
#m=2560x1440p60hz
|
||||
#m=2560x1600p60hz
|
||||
#m=3440x1440p60hz
|
||||
|
||||
# HDMI BPP Mode
|
||||
m_bpp=32
|
||||
#m_bpp=24
|
||||
#m_bpp=16
|
||||
|
||||
# HDMI DVI/VGA modes
|
||||
# By default its set to HDMI, if needed change below.
|
||||
# Uncomment only a single Line.
|
||||
#vout=dvi
|
||||
#vout=vga
|
||||
|
||||
# HDMI HotPlug Detection control
|
||||
# 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
|
||||
|
||||
# Monitor output
|
||||
# Controls if HDMI PHY should output anything to the monitor
|
||||
monitor_onoff=false
|
||||
|
||||
# Server Mode (aka. No Graphics)
|
||||
# Setting nographics to 1 will disable all video subsystem
|
||||
# This mode is ideal of server type usage. (Saves ~300Mb of RAM)
|
||||
nographics=0
|
||||
|
||||
# Meson Timer
|
||||
# 1 - Meson Timer
|
||||
# 0 - Arch Timer
|
||||
# Using meson_timer improves the video playback however it breaks KVM (virtualization).
|
||||
# Using arch timer allows KVM/Virtualization to work however you'll experience poor video
|
||||
mesontimer=1
|
||||
|
||||
# UHS (Ultra High Speed) MicroSD mode enable/disable
|
||||
disableuhs=false
|
||||
|
||||
# MicroSD Card Detection enable/disable
|
||||
# Force the MMC controlled to believe that a card is connected.
|
||||
mmc_removable=true
|
||||
|
||||
# USB Multi WebCam tweak
|
||||
# Only enable this if you use it.
|
||||
usbmulticam=false
|
||||
|
||||
# CPU Frequency / Cores control
|
||||
###########################################
|
||||
### WARNING!!! WARNING!!! WARNING!!!
|
||||
# Before changing anything here please read the wiki entry:
|
||||
# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq
|
||||
#
|
||||
# MAX CPU's
|
||||
#maxcpus=1
|
||||
#maxcpus=2
|
||||
#maxcpus=3
|
||||
maxcpus=4
|
||||
|
||||
# MAX Frequency
|
||||
#max_freq=2016
|
||||
#max_freq=1944
|
||||
#max_freq=1944
|
||||
#max_freq=1920
|
||||
#max_freq=1896
|
||||
#max_freq=1752
|
||||
#max_freq=1680
|
||||
#max_freq=1656
|
||||
max_freq=1536
|
||||
28
buildroot-external/board/hardkernel/odroid-c2/hassos-hook.sh
Executable file
28
buildroot-external/board/hardkernel/odroid-c2/hassos-hook.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC2155
|
||||
|
||||
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)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/config.txt"
|
||||
cp "${BINARIES_DIR}/meson-gxbb-odroidc2.dtb" "${BOOT_DATA}/meson-gxbb-odroidc2.dtb"
|
||||
|
||||
echo "console=tty0 console=ttyAML0,115200n8" > "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
|
||||
function hassos_post_image() {
|
||||
convert_disk_image_gz
|
||||
}
|
||||
|
||||
3324
buildroot-external/board/hardkernel/odroid-c2/kernel.config
Normal file
3324
buildroot-external/board/hardkernel/odroid-c2/kernel.config
Normal file
File diff suppressed because it is too large
Load Diff
7
buildroot-external/board/hardkernel/odroid-c2/meta
Normal file
7
buildroot-external/board/hardkernel/odroid-c2/meta
Normal file
@@ -0,0 +1,7 @@
|
||||
BOARD_ID=odroid-c2
|
||||
BOARD_NAME="Hardkernel Odroid-C2"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
BOOT_ENV_SIZE=0x2000
|
||||
@@ -0,0 +1,2 @@
|
||||
kernel patches from scpcom
|
||||
https://forum.odroid.com/viewtopic.php?f=135&t=22717&start=900#p233963
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
|
||||
index f839ecd9..cd276162 100644
|
||||
--- a/arch/arm64/Makefile
|
||||
+++ b/arch/arm64/Makefile
|
||||
@@ -103,7 +103,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
|
||||
|
||||
# Default target when executing plain make
|
||||
boot := arch/arm64/boot
|
||||
-KBUILD_IMAGE := $(boot)/Image.gz
|
||||
+KBUILD_IMAGE := $(boot)/Image
|
||||
KBUILD_DTBS := dtbs
|
||||
|
||||
all: Image.gz $(KBUILD_DTBS)
|
||||
@@ -0,0 +1,49 @@
|
||||
From 4796e434b5785e3d9f95e988363c407b1e09bb91 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Sat, 28 Jul 2018 22:40:27 +0200
|
||||
Subject: [PATCH] dt-bindings: soc: amlogic: add meson-canvas documentation
|
||||
|
||||
DT bindings doc for amlogic,meson-canvas
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
.../bindings/soc/amlogic/amlogic,canvas.txt | 29 +++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt b/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
new file mode 100644
|
||||
index 0000000000000..436d2106e80da
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.txt
|
||||
@@ -0,0 +1,29 @@
|
||||
+Amlogic Canvas
|
||||
+================================
|
||||
+
|
||||
+A canvas is a collection of metadata that describes a pixel buffer.
|
||||
+Those metadata include: width, height, phyaddr, wrapping, block mode
|
||||
+and endianness.
|
||||
+
|
||||
+Many IPs within Amlogic SoCs rely on canvas indexes to read/write pixel data
|
||||
+rather than use the phy addresses directly. For instance, this is the case for
|
||||
+the video decoders and the display.
|
||||
+
|
||||
+Amlogic SoCs have 256 canvas.
|
||||
+
|
||||
+Device Tree Bindings:
|
||||
+---------------------
|
||||
+
|
||||
+Video Lookup Table
|
||||
+--------------------------
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: "amlogic,canvas"
|
||||
+- reg: Base physical address and size of the canvas registers.
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+canvas: video-lut@48 {
|
||||
+ compatible = "amlogic,canvas";
|
||||
+ reg = <0x0 0x48 0x0 0x14>;
|
||||
+};
|
||||
@@ -0,0 +1,313 @@
|
||||
From 21c3e7d31208b0c4fb4a6c0a8c52e6820a40596a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 13:17:07 +0200
|
||||
Subject: [PATCH] soc: amlogic: add meson-canvas driver
|
||||
|
||||
Amlogic SoCs have a repository of 256 canvas which they use to
|
||||
describe pixel buffers.
|
||||
|
||||
They contain metadata like width, height, block mode, endianness [..]
|
||||
|
||||
Many IPs within those SoCs like vdec/vpu rely on those canvas to read/write
|
||||
pixels.
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
drivers/soc/amlogic/Kconfig | 7 +
|
||||
drivers/soc/amlogic/Makefile | 1 +
|
||||
drivers/soc/amlogic/meson-canvas.c | 185 +++++++++++++++++++++++
|
||||
include/linux/soc/amlogic/meson-canvas.h | 65 ++++++++
|
||||
4 files changed, 258 insertions(+)
|
||||
create mode 100644 drivers/soc/amlogic/meson-canvas.c
|
||||
create mode 100644 include/linux/soc/amlogic/meson-canvas.h
|
||||
|
||||
diff --git a/drivers/soc/amlogic/Kconfig b/drivers/soc/amlogic/Kconfig
|
||||
index b04f6e4aedbc1..2f282b4729120 100644
|
||||
--- a/drivers/soc/amlogic/Kconfig
|
||||
+++ b/drivers/soc/amlogic/Kconfig
|
||||
@@ -1,5 +1,12 @@
|
||||
menu "Amlogic SoC drivers"
|
||||
|
||||
+config MESON_CANVAS
|
||||
+ tristate "Amlogic Meson Canvas driver"
|
||||
+ depends on ARCH_MESON || COMPILE_TEST
|
||||
+ default n
|
||||
+ help
|
||||
+ Say yes to support the canvas IP for Amlogic SoCs.
|
||||
+
|
||||
config MESON_GX_SOCINFO
|
||||
bool "Amlogic Meson GX SoC Information driver"
|
||||
depends on ARCH_MESON || COMPILE_TEST
|
||||
diff --git a/drivers/soc/amlogic/Makefile b/drivers/soc/amlogic/Makefile
|
||||
index 8fa321893928d..0ab16d35ac36d 100644
|
||||
--- a/drivers/soc/amlogic/Makefile
|
||||
+++ b/drivers/soc/amlogic/Makefile
|
||||
@@ -1,3 +1,4 @@
|
||||
+obj-$(CONFIG_MESON_CANVAS) += meson-canvas.o
|
||||
obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o
|
||||
obj-$(CONFIG_MESON_GX_PM_DOMAINS) += meson-gx-pwrc-vpu.o
|
||||
obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o
|
||||
diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
|
||||
new file mode 100644
|
||||
index 0000000000000..fce33ca76bb62
|
||||
--- /dev/null
|
||||
+++ b/drivers/soc/amlogic/meson-canvas.c
|
||||
@@ -0,0 +1,185 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 BayLibre, SAS
|
||||
+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2014 Endless Mobile
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/soc/amlogic/meson-canvas.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/io.h>
|
||||
+
|
||||
+#define NUM_CANVAS 256
|
||||
+
|
||||
+/* DMC Registers */
|
||||
+#define DMC_CAV_LUT_DATAL 0x00
|
||||
+ #define CANVAS_WIDTH_LBIT 29
|
||||
+ #define CANVAS_WIDTH_LWID 3
|
||||
+#define DMC_CAV_LUT_DATAH 0x04
|
||||
+ #define CANVAS_WIDTH_HBIT 0
|
||||
+ #define CANVAS_HEIGHT_BIT 9
|
||||
+ #define CANVAS_WRAP_BIT 22
|
||||
+ #define CANVAS_BLKMODE_BIT 24
|
||||
+ #define CANVAS_ENDIAN_BIT 26
|
||||
+#define DMC_CAV_LUT_ADDR 0x08
|
||||
+ #define CANVAS_LUT_WR_EN BIT(9)
|
||||
+ #define CANVAS_LUT_RD_EN BIT(8)
|
||||
+
|
||||
+struct meson_canvas {
|
||||
+ struct device *dev;
|
||||
+ void __iomem *reg_base;
|
||||
+ spinlock_t lock; /* canvas device lock */
|
||||
+ u8 used[NUM_CANVAS];
|
||||
+};
|
||||
+
|
||||
+static void canvas_write(struct meson_canvas *canvas, u32 reg, u32 val)
|
||||
+{
|
||||
+ writel_relaxed(val, canvas->reg_base + reg);
|
||||
+}
|
||||
+
|
||||
+static u32 canvas_read(struct meson_canvas *canvas, u32 reg)
|
||||
+{
|
||||
+ return readl_relaxed(canvas->reg_base + reg);
|
||||
+}
|
||||
+
|
||||
+struct meson_canvas *meson_canvas_get(struct device *dev)
|
||||
+{
|
||||
+ struct device_node *canvas_node;
|
||||
+ struct platform_device *canvas_pdev;
|
||||
+
|
||||
+ canvas_node = of_parse_phandle(dev->of_node, "amlogic,canvas", 0);
|
||||
+ if (!canvas_node)
|
||||
+ return ERR_PTR(-ENODEV);
|
||||
+
|
||||
+ canvas_pdev = of_find_device_by_node(canvas_node);
|
||||
+ if (!canvas_pdev)
|
||||
+ return ERR_PTR(-EPROBE_DEFER);
|
||||
+
|
||||
+ return dev_get_drvdata(&canvas_pdev->dev);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_get);
|
||||
+
|
||||
+int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index,
|
||||
+ u32 addr, u32 stride, u32 height,
|
||||
+ unsigned int wrap,
|
||||
+ unsigned int blkmode,
|
||||
+ unsigned int endian)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ if (!canvas->used[canvas_index]) {
|
||||
+ dev_err(canvas->dev,
|
||||
+ "Trying to setup non allocated canvas %u\n",
|
||||
+ canvas_index);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_DATAL,
|
||||
+ ((addr + 7) >> 3) |
|
||||
+ (((stride + 7) >> 3) << CANVAS_WIDTH_LBIT));
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_DATAH,
|
||||
+ ((((stride + 7) >> 3) >> CANVAS_WIDTH_LWID) <<
|
||||
+ CANVAS_WIDTH_HBIT) |
|
||||
+ (height << CANVAS_HEIGHT_BIT) |
|
||||
+ (wrap << CANVAS_WRAP_BIT) |
|
||||
+ (blkmode << CANVAS_BLKMODE_BIT) |
|
||||
+ (endian << CANVAS_ENDIAN_BIT));
|
||||
+
|
||||
+ canvas_write(canvas, DMC_CAV_LUT_ADDR,
|
||||
+ CANVAS_LUT_WR_EN | canvas_index);
|
||||
+
|
||||
+ /* Force a read-back to make sure everything is flushed. */
|
||||
+ canvas_read(canvas, DMC_CAV_LUT_DATAH);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_config);
|
||||
+
|
||||
+int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index)
|
||||
+{
|
||||
+ int i;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ for (i = 0; i < NUM_CANVAS; ++i) {
|
||||
+ if (!canvas->used[i]) {
|
||||
+ canvas->used[i] = 1;
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ *canvas_index = i;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ dev_err(canvas->dev, "No more canvas available\n");
|
||||
+ return -ENODEV;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_alloc);
|
||||
+
|
||||
+int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&canvas->lock, flags);
|
||||
+ if (!canvas->used[canvas_index]) {
|
||||
+ dev_err(canvas->dev,
|
||||
+ "Trying to free unused canvas %u\n", canvas_index);
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ canvas->used[canvas_index] = 0;
|
||||
+ spin_unlock_irqrestore(&canvas->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(meson_canvas_free);
|
||||
+
|
||||
+static int meson_canvas_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ struct meson_canvas *canvas;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+
|
||||
+ canvas = devm_kzalloc(dev, sizeof(*canvas), GFP_KERNEL);
|
||||
+ if (!canvas)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ canvas->reg_base = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(canvas->reg_base))
|
||||
+ return PTR_ERR(canvas->reg_base);
|
||||
+
|
||||
+ canvas->dev = dev;
|
||||
+ spin_lock_init(&canvas->lock);
|
||||
+ dev_set_drvdata(dev, canvas);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id canvas_dt_match[] = {
|
||||
+ { .compatible = "amlogic,canvas" },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, canvas_dt_match);
|
||||
+
|
||||
+static struct platform_driver meson_canvas_driver = {
|
||||
+ .probe = meson_canvas_probe,
|
||||
+ .driver = {
|
||||
+ .name = "amlogic-canvas",
|
||||
+ .of_match_table = canvas_dt_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(meson_canvas_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Amlogic Canvas driver");
|
||||
+MODULE_AUTHOR("Maxime Jourdan <mjourdan@baylibre.com>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff --git a/include/linux/soc/amlogic/meson-canvas.h b/include/linux/soc/amlogic/meson-canvas.h
|
||||
new file mode 100644
|
||||
index 0000000000000..b4dde2fbeb3fb
|
||||
--- /dev/null
|
||||
+++ b/include/linux/soc/amlogic/meson-canvas.h
|
||||
@@ -0,0 +1,65 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 BayLibre, SAS
|
||||
+ */
|
||||
+#ifndef __SOC_MESON_CANVAS_H
|
||||
+#define __SOC_MESON_CANVAS_H
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+
|
||||
+#define MESON_CANVAS_WRAP_NONE 0x00
|
||||
+#define MESON_CANVAS_WRAP_X 0x01
|
||||
+#define MESON_CANVAS_WRAP_Y 0x02
|
||||
+
|
||||
+#define MESON_CANVAS_BLKMODE_LINEAR 0x00
|
||||
+#define MESON_CANVAS_BLKMODE_32x32 0x01
|
||||
+#define MESON_CANVAS_BLKMODE_64x64 0x02
|
||||
+
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP16 0x1
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP32 0x3
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP64 0x7
|
||||
+#define MESON_CANVAS_ENDIAN_SWAP128 0xf
|
||||
+
|
||||
+struct meson_canvas;
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_get() - get a canvas provider instance
|
||||
+ *
|
||||
+ * @dev: consumer device pointer
|
||||
+ */
|
||||
+struct meson_canvas *meson_canvas_get(struct device *dev);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_alloc() - take ownership of a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: will be filled with the canvas ID
|
||||
+ */
|
||||
+int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_free() - remove ownership from a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
|
||||
+ */
|
||||
+int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index);
|
||||
+
|
||||
+/**
|
||||
+ * meson_canvas_config() - configure a canvas
|
||||
+ *
|
||||
+ * @canvas: canvas provider instance retrieved from meson_canvas_get()
|
||||
+ * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
|
||||
+ * @addr: physical address to the pixel buffer
|
||||
+ * @stride: width of the buffer
|
||||
+ * @height: height of the buffer
|
||||
+ * @wrap: undocumented
|
||||
+ * @blkmode: block mode (linear, 32x32, 64x64)
|
||||
+ * @endian: byte swapping (swap16, swap32, swap64, swap128)
|
||||
+ */
|
||||
+int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index,
|
||||
+ u32 addr, u32 stride, u32 height,
|
||||
+ unsigned int wrap, unsigned int blkmode,
|
||||
+ unsigned int endian);
|
||||
+
|
||||
+#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
From e4c19f493a541cd00df42c02ec8f544f9835cbe5 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 16:09:09 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson-gx: add dmcbus and canvas nodes.
|
||||
|
||||
DMC is a small memory region with various registers,
|
||||
including the ones needed for the canvas module.
|
||||
|
||||
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index b8dc4dbb391b6..5dd63ecf8b05b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -423,6 +423,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ dmcbus: bus@c8838000 {
|
||||
+ compatible = "simple-bus";
|
||||
+ reg = <0x0 0xc8838000 0x0 0x400>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges = <0x0 0x0 0x0 0xc8838000 0x0 0x400>;
|
||||
+
|
||||
+ canvas: video-lut@48 {
|
||||
+ compatible = "amlogic,canvas";
|
||||
+ reg = <0x0 0x48 0x0 0x14>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
hiubus: bus@c883c000 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0xc883c000 0x0 0x2000>;
|
||||
@@ -0,0 +1,366 @@
|
||||
From 665dbad80386dcb9ac78ec6153d8d518da9bb50e Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
Date: Fri, 20 Apr 2018 16:22:17 +0200
|
||||
Subject: [PATCH] drm/meson: convert to the new canvas module
|
||||
|
||||
This removes the meson_canvas files within the meson/drm layer
|
||||
and makes use of the new canvas module that is referenced in the dts.
|
||||
|
||||
Canvases can be used by different IPs and modules, and it is as such
|
||||
preferable to rely on a module that can safely dispatch canvases on
|
||||
demand.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <maxi.jourdan@wanadoo.fr>
|
||||
---
|
||||
.../bindings/display/amlogic,meson-vpu.txt | 9 +--
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 7 +-
|
||||
drivers/gpu/drm/meson/Kconfig | 1 +
|
||||
drivers/gpu/drm/meson/Makefile | 2 +-
|
||||
drivers/gpu/drm/meson/meson_canvas.c | 70 -------------------
|
||||
drivers/gpu/drm/meson/meson_canvas.h | 42 -----------
|
||||
drivers/gpu/drm/meson/meson_crtc.c | 9 ++-
|
||||
drivers/gpu/drm/meson/meson_drv.c | 22 ++----
|
||||
drivers/gpu/drm/meson/meson_drv.h | 5 +-
|
||||
drivers/gpu/drm/meson/meson_plane.c | 3 +-
|
||||
drivers/gpu/drm/meson/meson_viu.c | 1 -
|
||||
11 files changed, 26 insertions(+), 145 deletions(-)
|
||||
delete mode 100644 drivers/gpu/drm/meson/meson_canvas.c
|
||||
delete mode 100644 drivers/gpu/drm/meson/meson_canvas.h
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
index 057b81335775e..60b6e13986365 100644
|
||||
--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
+++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
|
||||
@@ -60,9 +60,9 @@ Required properties:
|
||||
- reg: base address and size of he following memory-mapped regions :
|
||||
- vpu
|
||||
- hhi
|
||||
- - dmc
|
||||
- reg-names: should contain the names of the previous memory regions
|
||||
- interrupts: should contain the VENC Vsync interrupt number
|
||||
+- amlogic,canvas: should point to a meson canvas provider node
|
||||
|
||||
Optional properties:
|
||||
- power-domains: Optional phandle to associated power domain as described in
|
||||
@@ -98,13 +98,14 @@ tv-connector {
|
||||
vpu: vpu@d0100000 {
|
||||
compatible = "amlogic,meson-gxbb-vpu";
|
||||
reg = <0x0 0xd0100000 0x0 0x100000>,
|
||||
- <0x0 0xc883c000 0x0 0x1000>,
|
||||
- <0x0 0xc8838000 0x0 0x1000>;
|
||||
- reg-names = "vpu", "hhi", "dmc";
|
||||
+ <0x0 0xc883c000 0x0 0x1000>;
|
||||
+ reg-names = "vpu", "hhi";
|
||||
interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
/* CVBS VDAC output port */
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 5dd63ecf8b05b..737b741df0355 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -499,13 +499,14 @@
|
||||
vpu: vpu@d0100000 {
|
||||
compatible = "amlogic,meson-gx-vpu";
|
||||
reg = <0x0 0xd0100000 0x0 0x100000>,
|
||||
- <0x0 0xc883c000 0x0 0x1000>,
|
||||
- <0x0 0xc8838000 0x0 0x1000>;
|
||||
- reg-names = "vpu", "hhi", "dmc";
|
||||
+ <0x0 0xc883c000 0x0 0x1000>;
|
||||
+ reg-names = "vpu", "hhi";
|
||||
interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
/* CVBS VDAC output port */
|
||||
cvbs_vdac_port: port@0 {
|
||||
reg = <0>;
|
||||
diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
|
||||
index 3ce51d8dfe1c8..c28b69f485555 100644
|
||||
--- a/drivers/gpu/drm/meson/Kconfig
|
||||
+++ b/drivers/gpu/drm/meson/Kconfig
|
||||
@@ -7,6 +7,7 @@ config DRM_MESON
|
||||
select DRM_GEM_CMA_HELPER
|
||||
select VIDEOMODE_HELPERS
|
||||
select REGMAP_MMIO
|
||||
+ select MESON_CANVAS
|
||||
|
||||
config DRM_MESON_DW_HDMI
|
||||
tristate "HDMI Synopsys Controller support for Amlogic Meson Display"
|
||||
diff --git a/drivers/gpu/drm/meson/Makefile b/drivers/gpu/drm/meson/Makefile
|
||||
index c5c4cc362f024..bd67429185ff7 100644
|
||||
--- a/drivers/gpu/drm/meson/Makefile
|
||||
+++ b/drivers/gpu/drm/meson/Makefile
|
||||
@@ -1,5 +1,5 @@
|
||||
meson-drm-y := meson_drv.o meson_plane.o meson_crtc.o meson_venc_cvbs.o
|
||||
-meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o meson_canvas.o
|
||||
+meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o
|
||||
|
||||
obj-$(CONFIG_DRM_MESON) += meson-drm.o
|
||||
obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o
|
||||
diff --git a/drivers/gpu/drm/meson/meson_canvas.c b/drivers/gpu/drm/meson/meson_canvas.c
|
||||
deleted file mode 100644
|
||||
index 08f6073d967e0..0000000000000
|
||||
--- a/drivers/gpu/drm/meson/meson_canvas.c
|
||||
+++ /dev/null
|
||||
@@ -1,70 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (C) 2016 BayLibre, SAS
|
||||
- * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
- * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
|
||||
- * Copyright (C) 2014 Endless Mobile
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or
|
||||
- * modify it under the terms of the GNU General Public License as
|
||||
- * published by the Free Software Foundation; either version 2 of the
|
||||
- * License, or (at your option) any later version.
|
||||
- *
|
||||
- * This program is distributed in the hope that it will be useful, but
|
||||
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
- * General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
- */
|
||||
-
|
||||
-#include <linux/kernel.h>
|
||||
-#include <linux/module.h>
|
||||
-#include "meson_drv.h"
|
||||
-#include "meson_canvas.h"
|
||||
-#include "meson_registers.h"
|
||||
-
|
||||
-/**
|
||||
- * DOC: Canvas
|
||||
- *
|
||||
- * CANVAS is a memory zone where physical memory frames information
|
||||
- * are stored for the VIU to scanout.
|
||||
- */
|
||||
-
|
||||
-/* DMC Registers */
|
||||
-#define DMC_CAV_LUT_DATAL 0x48 /* 0x12 offset in data sheet */
|
||||
-#define CANVAS_WIDTH_LBIT 29
|
||||
-#define CANVAS_WIDTH_LWID 3
|
||||
-#define DMC_CAV_LUT_DATAH 0x4c /* 0x13 offset in data sheet */
|
||||
-#define CANVAS_WIDTH_HBIT 0
|
||||
-#define CANVAS_HEIGHT_BIT 9
|
||||
-#define CANVAS_BLKMODE_BIT 24
|
||||
-#define DMC_CAV_LUT_ADDR 0x50 /* 0x14 offset in data sheet */
|
||||
-#define CANVAS_LUT_WR_EN (0x2 << 8)
|
||||
-#define CANVAS_LUT_RD_EN (0x1 << 8)
|
||||
-
|
||||
-void meson_canvas_setup(struct meson_drm *priv,
|
||||
- uint32_t canvas_index, uint32_t addr,
|
||||
- uint32_t stride, uint32_t height,
|
||||
- unsigned int wrap,
|
||||
- unsigned int blkmode)
|
||||
-{
|
||||
- unsigned int val;
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_DATAL,
|
||||
- (((addr + 7) >> 3)) |
|
||||
- (((stride + 7) >> 3) << CANVAS_WIDTH_LBIT));
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_DATAH,
|
||||
- ((((stride + 7) >> 3) >> CANVAS_WIDTH_LWID) <<
|
||||
- CANVAS_WIDTH_HBIT) |
|
||||
- (height << CANVAS_HEIGHT_BIT) |
|
||||
- (wrap << 22) |
|
||||
- (blkmode << CANVAS_BLKMODE_BIT));
|
||||
-
|
||||
- regmap_write(priv->dmc, DMC_CAV_LUT_ADDR,
|
||||
- CANVAS_LUT_WR_EN | canvas_index);
|
||||
-
|
||||
- /* Force a read-back to make sure everything is flushed. */
|
||||
- regmap_read(priv->dmc, DMC_CAV_LUT_DATAH, &val);
|
||||
-}
|
||||
diff --git a/drivers/gpu/drm/meson/meson_canvas.h b/drivers/gpu/drm/meson/meson_canvas.h
|
||||
deleted file mode 100644
|
||||
index af1759da4b275..0000000000000
|
||||
--- a/drivers/gpu/drm/meson/meson_canvas.h
|
||||
+++ /dev/null
|
||||
@@ -1,42 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (C) 2016 BayLibre, SAS
|
||||
- * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
- * Copyright (C) 2014 Endless Mobile
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or
|
||||
- * modify it under the terms of the GNU General Public License as
|
||||
- * published by the Free Software Foundation; either version 2 of the
|
||||
- * License, or (at your option) any later version.
|
||||
- *
|
||||
- * This program is distributed in the hope that it will be useful, but
|
||||
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
- * General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
- */
|
||||
-
|
||||
-/* Canvas LUT Memory */
|
||||
-
|
||||
-#ifndef __MESON_CANVAS_H
|
||||
-#define __MESON_CANVAS_H
|
||||
-
|
||||
-#define MESON_CANVAS_ID_OSD1 0x4e
|
||||
-
|
||||
-/* Canvas configuration. */
|
||||
-#define MESON_CANVAS_WRAP_NONE 0x00
|
||||
-#define MESON_CANVAS_WRAP_X 0x01
|
||||
-#define MESON_CANVAS_WRAP_Y 0x02
|
||||
-
|
||||
-#define MESON_CANVAS_BLKMODE_LINEAR 0x00
|
||||
-#define MESON_CANVAS_BLKMODE_32x32 0x01
|
||||
-#define MESON_CANVAS_BLKMODE_64x64 0x02
|
||||
-
|
||||
-void meson_canvas_setup(struct meson_drm *priv,
|
||||
- uint32_t canvas_index, uint32_t addr,
|
||||
- uint32_t stride, uint32_t height,
|
||||
- unsigned int wrap,
|
||||
- unsigned int blkmode);
|
||||
-
|
||||
-#endif /* __MESON_CANVAS_H */
|
||||
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
index 05520202c9677..1ca9c6c45f9b9 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_crtc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_crtc.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "meson_venc.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
/* CRTC definition */
|
||||
@@ -193,10 +192,10 @@ void meson_crtc_irq(struct meson_drm *priv)
|
||||
} else
|
||||
meson_vpp_disable_interlace_vscaler_osd1(priv);
|
||||
|
||||
- meson_canvas_setup(priv, MESON_CANVAS_ID_OSD1,
|
||||
- priv->viu.osd1_addr, priv->viu.osd1_stride,
|
||||
- priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE,
|
||||
- MESON_CANVAS_BLKMODE_LINEAR);
|
||||
+ meson_canvas_config(priv->canvas, priv->canvas_id_osd1,
|
||||
+ priv->viu.osd1_addr, priv->viu.osd1_stride,
|
||||
+ priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE,
|
||||
+ MESON_CANVAS_BLKMODE_LINEAR, 0);
|
||||
|
||||
/* Enable OSD1 */
|
||||
writel_bits_relaxed(VPP_OSD1_POSTBLEND, VPP_OSD1_POSTBLEND,
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
|
||||
index d3443125e6616..fb5b0e3c5efce 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.c
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
#include "meson_venc.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
#define DRIVER_NAME "meson"
|
||||
@@ -216,25 +215,15 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
|
||||
goto free_drm;
|
||||
}
|
||||
|
||||
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc");
|
||||
- if (!res) {
|
||||
- ret = -EINVAL;
|
||||
- goto free_drm;
|
||||
- }
|
||||
- /* Simply ioremap since it may be a shared register zone */
|
||||
- regs = devm_ioremap(dev, res->start, resource_size(res));
|
||||
- if (!regs) {
|
||||
- ret = -EADDRNOTAVAIL;
|
||||
+ priv->canvas = meson_canvas_get(dev);
|
||||
+ if (IS_ERR(priv->canvas)) {
|
||||
+ ret = PTR_ERR(priv->canvas);
|
||||
goto free_drm;
|
||||
}
|
||||
|
||||
- priv->dmc = devm_regmap_init_mmio(dev, regs,
|
||||
- &meson_regmap_config);
|
||||
- if (IS_ERR(priv->dmc)) {
|
||||
- dev_err(&pdev->dev, "Couldn't create the DMC regmap\n");
|
||||
- ret = PTR_ERR(priv->dmc);
|
||||
+ ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1);
|
||||
+ if (ret)
|
||||
goto free_drm;
|
||||
- }
|
||||
|
||||
priv->vsync_irq = platform_get_irq(pdev, 0);
|
||||
|
||||
@@ -315,6 +304,7 @@ static void meson_drv_unbind(struct device *dev)
|
||||
struct drm_device *drm = dev_get_drvdata(dev);
|
||||
struct meson_drm *priv = drm->dev_private;
|
||||
|
||||
+ meson_canvas_free(priv->canvas, priv->canvas_id_osd1);
|
||||
drm_dev_unregister(drm);
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
drm_fbdev_cma_fini(priv->fbdev);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
|
||||
index 8450d6ac8c9bc..9e902a6df7843 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_drv.h
|
||||
+++ b/drivers/gpu/drm/meson/meson_drv.h
|
||||
@@ -22,15 +22,18 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/of.h>
|
||||
+#include <linux/soc/amlogic/meson-canvas.h>
|
||||
#include <drm/drmP.h>
|
||||
|
||||
struct meson_drm {
|
||||
struct device *dev;
|
||||
void __iomem *io_base;
|
||||
struct regmap *hhi;
|
||||
- struct regmap *dmc;
|
||||
int vsync_irq;
|
||||
|
||||
+ struct meson_canvas *canvas;
|
||||
+ u8 canvas_id_osd1;
|
||||
+
|
||||
struct drm_device *drm;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_fbdev_cma *fbdev;
|
||||
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
|
||||
index 12c80dfcff59b..8745f9209625b 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_plane.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_plane.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "meson_plane.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_viu.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
struct meson_plane {
|
||||
@@ -105,7 +104,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
|
||||
OSD_BLK0_ENABLE;
|
||||
|
||||
/* Set up BLK0 to point to the right canvas */
|
||||
- priv->viu.osd1_blk0_cfg[0] = ((MESON_CANVAS_ID_OSD1 << OSD_CANVAS_SEL) |
|
||||
+ priv->viu.osd1_blk0_cfg[0] = ((priv->canvas_id_osd1 << OSD_CANVAS_SEL) |
|
||||
OSD_ENDIANNESS_LE);
|
||||
|
||||
/* On GXBB, Use the old non-HDR RGB2YUV converter */
|
||||
diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c
|
||||
index 6bcfa527c1801..5b48c4c0985b5 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_viu.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_viu.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "meson_viu.h"
|
||||
#include "meson_vpp.h"
|
||||
#include "meson_venc.h"
|
||||
-#include "meson_canvas.h"
|
||||
#include "meson_registers.h"
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,82 @@
|
||||
From 0ceff9fb866173338b3ca79657ce6bf9aa3b2a9a Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:05:05 +0200
|
||||
Subject: [PATCH] dt-bindings: media: add Amlogic Video Decoder Bindings
|
||||
|
||||
Add documentation for the meson vdec dts node.
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
.../bindings/media/amlogic,vdec.txt | 63 +++++++++++++++++++
|
||||
1 file changed, 63 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/amlogic,vdec.txt b/Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
new file mode 100644
|
||||
index 0000000000000..c6450f2e7f28f
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/media/amlogic,vdec.txt
|
||||
@@ -0,0 +1,63 @@
|
||||
+Amlogic Video Decoder
|
||||
+================================
|
||||
+
|
||||
+The VDEC IP is composed of the following blocks :
|
||||
+
|
||||
+- ESPARSER is a bitstream parser that outputs to a VIFIFO. Further VDEC blocks
|
||||
+then feed from this VIFIFO.
|
||||
+- VDEC_1 can decode MPEG-1, MPEG-2, MPEG-4 part 2, H.263, H.264.
|
||||
+- VDEC_2 is used as a helper for corner cases like H.264 4K on older SoCs.
|
||||
+It is not handled by this driver.
|
||||
+- VDEC_HCODEC is the H.264 encoding block. It is not handled by this driver.
|
||||
+- VDEC_HEVC can decode HEVC and VP9.
|
||||
+
|
||||
+Device Tree Bindings:
|
||||
+---------------------
|
||||
+
|
||||
+VDEC: Video Decoder
|
||||
+--------------------------
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: value should be different for each SoC family as :
|
||||
+ - GXBB (S905) : "amlogic,gxbb-vdec"
|
||||
+ - GXL (S905X, S905D) : "amlogic,gxl-vdec"
|
||||
+ - GXM (S912) : "amlogic,gxm-vdec"
|
||||
+- reg: base address and size of he following memory-mapped regions :
|
||||
+ - dos
|
||||
+ - esparser
|
||||
+- reg-names: should contain the names of the previous memory regions
|
||||
+- interrupts: should contain the vdec and esparser IRQs.
|
||||
+- amlogic,ao-sysctrl: should point to the AOBUS sysctrl node
|
||||
+- amlogic,canvas: should point to a canvas provider node
|
||||
+- clocks: should contain the following clocks :
|
||||
+ - dos_parser
|
||||
+ - dos
|
||||
+ - vdec_1
|
||||
+ - vdec_hevc
|
||||
+- clock-names: should contain the names of the previous clocks
|
||||
+- resets: should contain the parser reset.
|
||||
+- reset-names: should be "esparser".
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+vdec: video-decoder@c8820000 {
|
||||
+ compatible = "amlogic,gxbb-vdec";
|
||||
+ reg = <0x0 0xc8820000 0x0 0x10000>,
|
||||
+ <0x0 0xc110a580 0x0 0xe4>;
|
||||
+ reg-names = "dos", "esparser";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 44 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 32 IRQ_TYPE_EDGE_RISING>;
|
||||
+
|
||||
+ amlogic,ao-sysctrl = <&sysctrl_AO>;
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
From b73062fd0c0c9630ad00ec5c0e9880798a994875 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:02 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson-gx: add vdec entry
|
||||
|
||||
Add the video decoder dts entry
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
index 737b741df0355..d9e0fea71dbe3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
|
||||
@@ -410,6 +410,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ vdec: video-decoder@c8820000 {
|
||||
+ compatible = "amlogic,gx-vdec";
|
||||
+ reg = <0x0 0xc8820000 0x0 0x10000>,
|
||||
+ <0x0 0xc110a580 0x0 0xe4>;
|
||||
+ reg-names = "dos", "esparser";
|
||||
+
|
||||
+ interrupts = <GIC_SPI 44 IRQ_TYPE_EDGE_RISING>,
|
||||
+ <GIC_SPI 32 IRQ_TYPE_EDGE_RISING>;
|
||||
+
|
||||
+ amlogic,ao-sysctrl = <&sysctrl_AO>;
|
||||
+ amlogic,canvas = <&canvas>;
|
||||
+ };
|
||||
+
|
||||
periphs: periphs@c8834000 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0xc8834000 0x0 0x2000>;
|
||||
@@ -0,0 +1,64 @@
|
||||
From c7b0311f4676661ad445f9e36c669886f1bc7835 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Date: Wed, 29 Aug 2018 15:24:22 +0200
|
||||
Subject: [PATCH] ARM64: dts: meson: add vdec entries
|
||||
|
||||
This enables the video decoder for gxbb, gxl and gxm chips
|
||||
|
||||
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 11 +++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 11 +++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 4 ++++
|
||||
3 files changed, 26 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
index 98cbba6809caa..daee53a755d75 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
|
||||
@@ -774,3 +774,14 @@
|
||||
compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxbb-vdec";
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
index c87a80e9bcc6a..bfd65d1a89591 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
|
||||
@@ -775,3 +775,14 @@
|
||||
compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
|
||||
power-domains = <&pwrc_vpu>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxl-vdec";
|
||||
+ clocks = <&clkc CLKID_DOS_PARSER>,
|
||||
+ <&clkc CLKID_DOS>,
|
||||
+ <&clkc CLKID_VDEC_1>,
|
||||
+ <&clkc CLKID_VDEC_HEVC>;
|
||||
+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
|
||||
+ resets = <&reset RESET_PARSER>;
|
||||
+ reset-names = "esparser";
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
index 247888d68a3aa..2f356495be5ef 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
|
||||
@@ -117,3 +117,7 @@
|
||||
&dwc3 {
|
||||
phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>;
|
||||
};
|
||||
+
|
||||
+&vdec {
|
||||
+ compatible = "amlogic,gxm-vdec";
|
||||
+};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user