meson64: edge: rework to kernel 5.19 (#3941)

* meson64-edge/5.19: use `tag:v5.19-rc2`, meson64 kernel config and kernel patches, by @adeepv

* meson64-edge/5.19: we don't need `CONFIG_ARCH_ROCKCHIP=y` for meson64, right?

* meson64-edge/5.19: remove `meson_drv_shutdown` revert patch, instead `CONFIG_DRM_MESON=y` and its dependencies in .config

- this allows other meson64's to shutdown properly, while allowing the N2(+) to reboot without kernel-side hangs

* meson64-edge/5.19: odroidn2(+): remove SD UHS modes patch for ODROID N2(+)

- it works when cold-booted
- but changes voltage to enable
- when rebooted, voltage persists and uboot can't read the SD anymore
- adding the "odroid,reboot" driver+dt that is supposed to fix this, doesn't
- so for now remove it

* meson64-edge/5.19: odroidn2(+): add dumb gpio fan at 30 celsius

- backport from rework in 5.10

* meson64-edge/5.19: odroidhc4: bring back `fan1_input` by adding fan details to DT

- yeah, I know; the cooling map is right there too, so empty, poor thing. for later.

* meson64-edge/5.19: bump to 5.19-rc3

* meson64-edge/5.19: radxa-zero: add patch to remove UHS mode so `wifi` works

- sent by @pyavitz: https://raw.githubusercontent.com/pyavitz/debian-image-builder/feature/patches/amlogic/radxazero/wifi/001-arm64-dts-amlogic-radxa-zero-sdio-card-speed.patch
- tested by @lanefu

* meson64-edge/5.19: bump to 5.19-rc4

* meson64-edge/5.19: bump to 5.19-rc5

* meson64-edge/5.19: bump to 5.19-rc7

* meson64-edge/5.19: bump to 5.19.y branch, which is 5.19.0 right now

* Add kernel config - tested on Odroid N2+

Co-authored-by: Vyacheslav Bocharov <adeep@lexina.in>
Co-authored-by: Igor Pecovnik <igor.pecovnik@gmail.com>
This commit is contained in:
Ricardo Pardini
2022-08-04 21:50:40 +02:00
committed by GitHub
parent 1a276577a4
commit 73691a9e24
56 changed files with 7513 additions and 549 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ CPUMAX=${CPUMAX:-1536000}
GOVERNOR=${GOVERNOR:-ondemand} GOVERNOR=${GOVERNOR:-ondemand}
case $BRANCH in case $BRANCH in
legacy) legacy)
KERNELSOURCE='https://github.com/hardkernel/linux' KERNELSOURCE='https://github.com/hardkernel/linux'
#KERNELBRANCH='branch:odroidg12-4.9.y' #KERNELBRANCH='branch:odroidg12-4.9.y'
@@ -35,7 +35,7 @@ case $BRANCH in
;; ;;
edge) edge)
KERNELBRANCH='branch:linux-5.17.y' KERNELBRANCH='branch:linux-5.19.y'
KERNELPATCHDIR='meson64-edge' KERNELPATCHDIR='meson64-edge'
;; ;;
@@ -289,7 +289,7 @@ family_tweaks_bsp()
cat <<-EOF > "$destination"/etc/X11/xorg.conf cat <<-EOF > "$destination"/etc/X11/xorg.conf
Section "Device" Section "Device"
Identifier "DRM Graphics Acclerated" Identifier "DRM Graphics Acclerated"
## Use modesetting and glamor ## Use modesetting and glamor
Driver "modesetting" Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable. Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable.
@@ -297,9 +297,9 @@ family_tweaks_bsp()
Option "Dri2Vsync" "true" Option "Dri2Vsync" "true"
Option "TripleBuffer" "True" Option "TripleBuffer" "True"
## End glamor configuration ## End glamor configuration
EndSection EndSection
Section "Screen" Section "Screen"
Identifier "Default Screen" Identifier "Default Screen"
SubSection "Display" SubSection "Display"
@@ -312,7 +312,7 @@ family_tweaks_bsp()
} }
# This is an extension method, put directly in meson64_common. A "built-in" extension if you will. # This is an extension method, put directly in meson64_common. A "built-in" extension if you will.
# If used in more than one place, it could be moved to an extension: enable_extension "amlogic-fip-tools" # If used in more than one place, it could be moved to an extension: enable_extension "amlogic-fip-tools"
function fetch_sources_tools__amlogic_fip() { function fetch_sources_tools__amlogic_fip() {
fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master" fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master"
fetch_from_repo "https://github.com/LibreELEC/amlogic-boot-fip" "amlogic-boot-fip" "branch:master" fetch_from_repo "https://github.com/LibreELEC/amlogic-boot-fip" "amlogic-boot-fip" "branch:master"

View File

@@ -0,0 +1,576 @@
From 9c2db9e795f4d73e78a02f6c8cb313e6bcf34f7e Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Wed, 16 Feb 2022 07:27:07 +0000
Subject: [PATCH 69/90] WIP: dt-bindings: arm: amlogic: add support for Radxa
Zero2
The Radxa Zero2 is a small form-factor SBC using the Amlogic
A311D chip.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 05365bb50b29..d069aecabeb3 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -152,6 +152,7 @@ properties:
items:
- enum:
- khadas,vim3
+ - radxa,zero2
- const: amlogic,a311d
- const: amlogic,g12b
--
2.35.1
From aadb6d12609309106f6ab7a56face84c19859796 Mon Sep 17 00:00:00 2001
From: Yuntian Zhang <yt@radxa.com>
Date: Fri, 14 Jan 2022 15:50:02 +0000
Subject: [PATCH 70/90] WIP: arm64: dts: meson: add support for Radxa Zero2
Radxa Zero2 is a small form factor SBC based on the Amlogic A311D
chipset that ships in a number of eMMC configurations:
- Amlogic A311D (Quad A73 + Dual A53) CPU
- 4GB LPDDR4 RAM
- 32/64/128GB eMMC
- Mali G52-MP4 GPU
- HDMI 2.1 output (micro)
- BCM4345 WiFi (2.4/5GHz a/b/g/n/ac) and BT 5.0
- 1x USB 2.0 port - Type C (OTG)
- 1x USB 3.0 port - Type C (Host)
- 1x micro SD Card slot
- 40 Pin GPIO header
Signed-off-by: Yuntian Zhang <yt@radxa.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../dts/amlogic/meson-g12b-radxa-zero2.dts | 499 ++++++++++++++++++
2 files changed, 500 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 8773211df50e..f231280cd808 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -12,6 +12,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-radxa-zero2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-kii-pro.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts
new file mode 100644
index 000000000000..fefa6f2b7abf
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts
@@ -0,0 +1,499 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
+ * Copyright (c) 2022 Radxa Limited
+ * Author: Yuntian Zhang <yt@radxa.com>
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-a311d.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+
+/ {
+ compatible = "radxa,zero2", "amlogic,a311d", "amlogic,g12b";
+ model = "Radxa Zero2";
+
+ aliases {
+ serial0 = &uart_AO;
+ serial2 = &uart_A;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x80000000>;
+ };
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ poll-interval = <100>;
+ power-button {
+ label = "power";
+ linux,code = <KEY_POWER>;
+ gpios = <&gpio_ao GPIOAO_3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-green {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio GPIOA_12 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "heartbeat";
+ };
+ };
+
+ cvbs-connector {
+ status = "disabled";
+ compatible = "composite-video-connector";
+
+ port {
+ cvbs_connector_in: endpoint {
+ remote-endpoint = <&cvbs_vdac_out>;
+ };
+ };
+ };
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ emmc_pwrseq: emmc-pwrseq {
+ compatible = "mmc-pwrseq-emmc";
+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+ };
+
+ sdio_pwrseq: sdio-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+ clocks = <&wifi32k>;
+ clock-names = "ext_clock";
+ };
+
+ ao_5v: regulator-ao_5v {
+ compatible = "regulator-fixed";
+ regulator-name = "AO_5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ vcc_1v8: regulator-vcc_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc_3v3>;
+ regulator-always-on;
+ };
+
+ vcc_3v3: regulator-vcc_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ /* FIXME: actually controlled by VDDCPU_B_EN */
+ };
+
+ vddao_1v8: regulator-vddao_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDIO_AO1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ };
+
+ vddao_3v3: regulator-vddao_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&ao_5v>;
+ regulator-always-on;
+ };
+
+ vddcpu_a: regulator-vddcpu-a {
+ /*
+ * MP8756GD Regulator.
+ */
+ compatible = "pwm-regulator";
+
+ regulator-name = "VDDCPU_A";
+ regulator-min-microvolt = <730000>;
+ regulator-max-microvolt = <1022000>;
+
+ pwm-supply = <&ao_5v>;
+
+ pwms = <&pwm_ab 0 1250 0>;
+ pwm-dutycycle-range = <100 0>;
+
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ vddcpu_b: regulator-vddcpu-b {
+ /*
+ * Silergy SY8120B1ABC Regulator.
+ */
+ compatible = "pwm-regulator";
+
+ regulator-name = "VDDCPU_B";
+ regulator-min-microvolt = <730000>;
+ regulator-max-microvolt = <1022000>;
+
+ pwm-supply = <&ao_5v>;
+
+ pwms = <&pwm_AO_cd 1 1250 0>;
+ pwm-dutycycle-range = <100 0>;
+
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ sound {
+ compatible = "amlogic,axg-sound-card";
+ model = "RADXA-ZERO2";
+ audio-aux-devs = <&tdmout_b>;
+ audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+ "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+ "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+ "TDM_B Playback", "TDMOUT_B OUT";
+
+ assigned-clocks = <&clkc CLKID_MPLL2>,
+ <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>;
+ assigned-clock-parents = <0>, <0>, <0>;
+ assigned-clock-rates = <294912000>,
+ <270950400>,
+ <393216000>;
+ status = "okay";
+
+ dai-link-0 {
+ sound-dai = <&frddr_a>;
+ };
+
+ dai-link-1 {
+ sound-dai = <&frddr_b>;
+ };
+
+ dai-link-2 {
+ sound-dai = <&frddr_c>;
+ };
+
+ /* 8ch hdmi interface */
+ dai-link-3 {
+ sound-dai = <&tdmif_b>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-0 = <1 1>;
+ dai-tdm-slot-tx-mask-1 = <1 1>;
+ dai-tdm-slot-tx-mask-2 = <1 1>;
+ dai-tdm-slot-tx-mask-3 = <1 1>;
+ mclk-fs = <256>;
+
+ codec {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+ };
+ };
+
+ /* hdmi glue */
+ dai-link-4 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+ codec {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+ };
+
+ wifi32k: wifi32k {
+ compatible = "pwm-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32768>;
+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+ };
+};
+
+&arb {
+ status = "okay";
+};
+
+&cec_AO {
+ pinctrl-0 = <&cec_ao_a_h_pins>;
+ pinctrl-names = "default";
+ status = "disabled";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+ pinctrl-0 = <&cec_ao_b_h_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&clkc_audio {
+ status = "okay";
+};
+
+&cpu0 {
+ cpu-supply = <&vddcpu_b>;
+ operating-points-v2 = <&cpu_opp_table_0>;
+ clocks = <&clkc CLKID_CPU_CLK>;
+ clock-latency = <50000>;
+};
+
+&cpu1 {
+ cpu-supply = <&vddcpu_b>;
+ operating-points-v2 = <&cpu_opp_table_0>;
+ clocks = <&clkc CLKID_CPU_CLK>;
+ clock-latency = <50000>;
+};
+
+&cpu100 {
+ cpu-supply = <&vddcpu_a>;
+ operating-points-v2 = <&cpub_opp_table_1>;
+ clocks = <&clkc CLKID_CPUB_CLK>;
+ clock-latency = <50000>;
+};
+
+&cpu101 {
+ cpu-supply = <&vddcpu_a>;
+ operating-points-v2 = <&cpub_opp_table_1>;
+ clocks = <&clkc CLKID_CPUB_CLK>;
+ clock-latency = <50000>;
+};
+
+&cpu102 {
+ cpu-supply = <&vddcpu_a>;
+ operating-points-v2 = <&cpub_opp_table_1>;
+ clocks = <&clkc CLKID_CPUB_CLK>;
+ clock-latency = <50000>;
+};
+
+&cpu103 {
+ cpu-supply = <&vddcpu_a>;
+ operating-points-v2 = <&cpub_opp_table_1>;
+ clocks = <&clkc CLKID_CPUB_CLK>;
+ clock-latency = <50000>;
+};
+
+&cvbs_vdac_port {
+ cvbs_vdac_out: endpoint {
+ remote-endpoint = <&cvbs_connector_in>;
+ };
+};
+
+&frddr_a {
+ status = "okay";
+};
+
+&frddr_b {
+ status = "okay";
+};
+
+&frddr_c {
+ status = "okay";
+};
+
+&gpio {
+ gpio-line-names =
+ /* GPIOZ */
+ "PIN_27", "PIN_28", "PIN_7", "PIN_11", "PIN_13", "PIN_15", "PIN_18", "PIN_40",
+ "", "", "", "", "", "", "", "",
+ /* GPIOH */
+ "", "", "", "", "PIN_19", "PIN_21", "PIN_24", "PIN_23",
+ "",
+ /* BOOT */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "EMMC_PWRSEQ", "", "", "",
+ /* GPIOC */
+ "", "", "", "", "", "", "SD_CD", "PIN_36",
+ /* GPIOA */
+ "PIN_32", "PIN_12", "PIN_35", "", "", "PIN_38", "", "",
+ "", "", "", "", "LED_GREEN", "PIN_31", "PIN_3", "PIN_5",
+ /* GPIOX */
+ "", "", "", "", "", "", "SDIO_PWRSEQ", "",
+ "", "", "", "", "", "", "", "",
+ "", "BT_SHUTDOWN", "", "";
+};
+
+&gpio_ao {
+ gpio-line-names =
+ /* GPIOAO */
+ "PIN_8", "PIN_10", "", "BTN_POWER", "", "", "", "PIN_29",
+ "PIN_33", "PIN_37", "FAN", "",
+ /* GPIOE */
+ "", "", "";
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+ pinctrl-names = "default";
+ hdmi-supply = <&ao_5v>;
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&ir {
+ status = "disabled";
+ pinctrl-0 = <&remote_input_ao_pins>;
+ pinctrl-names = "default";
+};
+
+&pwm_ab {
+ pinctrl-0 = <&pwm_a_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin0";
+ status = "okay";
+};
+
+&pwm_ef {
+ pinctrl-0 = <&pwm_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin2";
+ status = "okay";
+};
+
+&pwm_AO_cd {
+ pinctrl-0 = <&pwm_ao_d_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin4";
+ status = "okay";
+};
+
+&saradc {
+ status = "okay";
+ vref-supply = <&vddao_1v8>;
+};
+
+/* SDIO */
+&sd_emmc_a {
+ status = "okay";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <100000000>;
+
+ non-removable;
+ disable-wp;
+
+ /* WiFi firmware requires power to be kept while in suspend */
+ keep-power-in-suspend;
+
+ mmc-pwrseq = <&sdio_pwrseq>;
+
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddao_1v8>;
+
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+};
+
+/* SD card */
+&sd_emmc_b {
+ status = "okay";
+ pinctrl-0 = <&sdcard_c_pins>;
+ pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <50000000>;
+ disable-wp;
+
+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddao_3v3>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+ status = "okay";
+ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
+ pinctrl-1 = <&emmc_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ mmc-ddr-1_8v;
+ mmc-hs200-1_8v;
+ max-frequency = <200000000>;
+ disable-wp;
+
+ mmc-pwrseq = <&emmc_pwrseq>;
+ vmmc-supply = <&vcc_3v3>;
+ vqmmc-supply = <&vcc_1v8>;
+};
+
+&tdmif_b {
+ status = "okay";
+};
+
+&tdmout_b {
+ status = "okay";
+};
+
+&tohdmitx {
+ status = "okay";
+};
+
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+ max-speed = <2000000>;
+ clocks = <&wifi32k>;
+ clock-names = "lpo";
+ };
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb {
+ status = "okay";
+};
--
2.35.1

View File

@@ -0,0 +1,39 @@
From 4f925789d0713c48deb5067187c7e5acba397054 Mon Sep 17 00:00:00 2001
From: David Heidelberg <david@ixit.cz>
Date: Sat, 27 Nov 2021 07:23:35 +0000
Subject: [PATCH 28/90] FROMLIST(v1): arm64: dts: meson: make dts use gpio-fan
matrix instead of array
No functional changes.
Adjust to comply with dt-schema requirements
and make possible to validate values.
Signed-off-by: David Heidelberg <david@ixit.cz>
---
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
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 9c26d7489d2a..c5e3b5587135 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -54,10 +54,11 @@ gpio_fan: gpio-fan {
gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
&gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
/* Dummy RPM values since fan is optional */
- gpio-fan,speed-map = <0 0
- 1 1
- 2 2
- 3 3>;
+ gpio-fan,speed-map =
+ <0 0>,
+ <1 1>,
+ <2 2>,
+ <3 3>;
#cooling-cells = <2>;
};
--
2.35.1

View File

@@ -0,0 +1,38 @@
From 04ba78002ded0f9089b7fae6550a56ccd0669e65 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Fri, 21 Feb 2020 04:43:22 +0000
Subject: [PATCH 086/101] WIP: arm64: dts: meson: khadas-vim3: fix missing i2c3
node
Fixes: c6d29c66e582 ("arm64: dts: meson-g12b-khadas-vim3: add initial device-tree")
The i2c3 node was missed in the original device-tree and is required for the
optional Khadas 3705 fan to work.
Suggested-by: Art Nikpal <email2tema@gmail.com>
Signed-off-by: Christian Hewittt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
index 0ef60c7151cb..6022805d2032 100644
--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
@@ -217,6 +217,13 @@
};
};
+&i2c3 {
+ clock-frequency = <100000>;
+ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
&i2c_AO {
status = "okay";
pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
--
2.17.1

View File

@@ -0,0 +1,60 @@
From 5ff8dfecb282089107d1bd3da6b612c5294fe0cb Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Thu, 21 Jan 2021 01:35:36 +0000
Subject: [PATCH 07/90] HACK: arm64: dts: meson: add rtc/vrtc aliases to Khadas
VIM
Add aliases to ensure the vrtc time (which normally proves first) is /dev/rtc1
while the onboard rtc chip claims /dev/rtc0.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 ++
1 file changed, 2 insertions(+)
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 6ab1cc125b96..24af15e18026 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
@@ -29,6 +29,8 @@ button-function {
aliases {
serial2 = &uart_AO_B;
ethernet0 = &ethmac;
+ rtc0 = &rtc;
+ rtc1 = &vrtc;
};
gpio-keys-polled {
--
2.35.1
From 293a4281d04100f1a0ab8ced46a45fc557f6e130 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sat, 6 Nov 2021 13:01:08 +0000
Subject: [PATCH 08/90] HACK: arm64: dts: meson: add rtc/vrtc aliases to Khadas
VIM2
Add aliases to ensure the vrtc time (which normally proves first) is /dev/rtc1
while the onboard rtc chip claims /dev/rtc0.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 ++
1 file changed, 2 insertions(+)
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 86bdc0baf032..9c26d7489d2a 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -18,6 +18,8 @@ / {
aliases {
serial0 = &uart_AO;
serial2 = &uart_AO_B;
+ rtc0 = &rtc;
+ rtc1 = &vrtc;
};
chosen {
--
2.35.1

View File

@@ -0,0 +1,12 @@
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 cbe99bd..80c87e0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
@@ -13,6 +13,7 @@
aliases {
serial0 = &uart_AO;
+ serial2 = &uart_C;
ethernet0 = &ethmac;
};

View File

@@ -0,0 +1,22 @@
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 80c87e0bb..340559727 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
@@ -382,7 +382,7 @@
/* eMMC */
&sd_emmc_c {
- status = "disabled";
+ status = "okay";
pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
pinctrl-1 = <&emmc_clk_gate_pins>;
pinctrl-names = "default", "clk-gate";
@@ -392,8 +392,6 @@
non-removable;
disable-wp;
cap-mmc-highspeed;
- mmc-ddr-1_8v;
- mmc-hs200-1_8v;
mmc-pwrseq = <&emmc_pwrseq>;
vmmc-supply = <&vcc3v3>;

View File

@@ -0,0 +1,32 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 201596247fd9..b2cb12fb46fd 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -17,6 +17,8 @@ / {
aliases {
serial0 = &uart_AO;
+ serial1 = &uart_A;
+ serial2 = &uart_C;
ethernet0 = &ethmac;
};
@@ -399,6 +401,18 @@ &uart_AO {
pinctrl-names = "default";
};
+&uart_A {
+ status = "disabled";
+ pinctrl-0 = <&uart_a_pins>;
+ pinctrl-names = "default";
+};
+
+&uart_C {
+ status = "disabled";
+ pinctrl-0 = <&uart_c_pins>;
+ pinctrl-names = "default";
+};
+
&usb0_phy {
status = "disabled";
phy-supply = <&usb_otg_pwr>;

View File

@@ -0,0 +1,37 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index b2cb12fb46fd..c252de8e4b17 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -176,6 +176,32 @@ hdmi_connector_in: endpoint {
};
};
+ spi-gpio {
+ compatible = "spi-gpio";
+ #address-cells = <0x1>;
+ #size-cells = <0x0>;
+ ranges;
+ status = "disabled";
+ sck-gpios = <&gpio GPIOX_2 0>;
+ miso-gpios = <&gpio GPIOX_4 0>;
+ mosi-gpios = <&gpio GPIOX_7 0>;
+ cs-gpios = <&gpio GPIOX_3 0
+ &gpio GPIOX_1 0>;
+ num-chipselects = <2>;
+
+ /* clients */
+ spidev0@0 {
+ compatible = "spidev";
+ reg = <0>;
+ spi-max-frequency = <500000>;
+ };
+ spidev0@1 {
+ compatible = "spidev";
+ reg = <1>;
+ spi-max-frequency = <500000>;
+ };
+ };
+
sound {
compatible = "amlogic,gx-sound-card";
model = "ODROID-C2";

View File

@@ -0,0 +1,14 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index d147c853a..dbde670ba 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -246,7 +246,8 @@
};
&scpi_clocks {
- status = "disabled";
+ /* Works only with new blobs that have limited DVFS table */
+ status = "okay";
};
/* SD */

View File

@@ -0,0 +1,29 @@
From 9058e8940ae84b1bc97693d9aca7b27f55bb1964 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 26 Jun 2022 03:47:06 +0200
Subject: [PATCH] ODROID-HC4: add DT attributes to enable fan1_input
- from vendor kernel modified DT
- this allows userspace fancontrol/pwmconfig to work
---
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
index 0764f1bb5..2b0752144 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -23,6 +23,10 @@ fan0: pwm-fan {
cooling-max-state = <3>;
cooling-levels = <0 120 170 220>;
pwms = <&pwm_cd 1 40000 0>;
+ fan-supply = <&vcc_5v>;
+ interrupt-parent = <&gpio_intc>;
+ interrupts = <84 IRQ_TYPE_EDGE_FALLING>;
+ pulses-per-revolutions = <2>;
};
leds {
--
2.36.1

View File

@@ -0,0 +1,40 @@
From 86d9151effff69d2a8fc2027a31dd60bd8c6eb05 Mon Sep 17 00:00:00 2001
Message-Id: <86d9151effff69d2a8fc2027a31dd60bd8c6eb05.1627311993.git.stefan@agner.ch>
In-Reply-To: <c7825747afd8bb975dc918f28e4afe8058a518f3.1627311993.git.stefan@agner.ch>
References: <c7825747afd8bb975dc918f28e4afe8058a518f3.1627311993.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 11 Jan 2021 11:38:54 +0100
Subject: [PATCH 5/9] arm64: dts: meson: g12b: add GPIO fan support
Add simple GPIO fan node to support a fan on GPIO J8. Unfortunately the
pad used to control the fan does not support real PWM, hence the RPM
cannot be modulated.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Tested-by: Ricardo Pardini <ricardo@pardini.net>
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi (revision e209be874602b0a650b442801cbffe529aa7dfff)
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi (date 1655943404649)
@@ -44,6 +44,15 @@
reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
};
+ /* 5V 80x80x10.8mm cooling fan from Hardkernel shop... */
+ fan0: gpio-fan {
+ #cooling-cells = <2>;
+ compatible = "gpio-fan";
+ gpio-fan,speed-map = <0 0 1600 1>;
+ gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ };
+
leds {
compatible = "gpio-leds";
--
2.32.0

View File

@@ -0,0 +1,73 @@
From f1120f132dbdf2e7f7acf328de55bbdce877d882 Mon Sep 17 00:00:00 2001
Message-Id: <f1120f132dbdf2e7f7acf328de55bbdce877d882.1627311993.git.stefan@agner.ch>
In-Reply-To: <c7825747afd8bb975dc918f28e4afe8058a518f3.1627311993.git.stefan@agner.ch>
References: <c7825747afd8bb975dc918f28e4afe8058a518f3.1627311993.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 11 Jan 2021 15:53:55 +0100
Subject: [PATCH 6/9] arm64: dts: meson: g12b: odroid-n2: add fan as cooling
device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the GPIO fan as a cooling device for the CPU thermal zone. Since we
have only full fan speed available with this, set the tripping point to
30°C.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
.../dts/amlogic/meson-g12b-odroid-n2.dtsi | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index e8a3ede698b5..dd345c6aa4b5 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -388,6 +388,44 @@ &clkc_audio {
status = "okay";
};
+&cpu_thermal {
+ trips {
+ cpu_warm: cpu_warm {
+ hysteresis = <5000>;
+ temperature = <30000>;
+ type = "active";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ cooling-device =
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ trip = <&cpu_warm>;
+ };
+ map1 {
+ trip = <&cpu_passive>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ map2 {
+ trip = <&cpu_hot>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+};
+
&cpu0 {
cpu-supply = <&vddcpu_b>;
operating-points-v2 = <&cpu_opp_table_0>;
--
2.32.0

View File

@@ -0,0 +1,84 @@
Index: arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-spi.dts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-spi.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-spi.dts
new file mode 100644
--- /dev/null (date 1630421486471)
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-spi.dts (date 1630421486471)
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include "meson-g12b-odroid-n2.dts"
+
+/ {
+ model = "Hardkernel ODROID-N2 with SPI";
+};
+
+#include "meson-g12b-odroid-n2-enable-spi.dtsi"
Index: arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus-spi.dts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus-spi.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus-spi.dts
new file mode 100644
--- /dev/null (date 1630421477913)
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus-spi.dts (date 1630421477913)
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include "meson-g12b-odroid-n2-plus.dts"
+
+/ {
+ model = "Hardkernel ODROID-N2Plus with SPI";
+};
+
+#include "meson-g12b-odroid-n2-enable-spi.dtsi"
Index: arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-enable-spi.dtsi
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-enable-spi.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-enable-spi.dtsi
new file mode 100644
--- /dev/null (date 1630421525557)
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-enable-spi.dtsi (date 1630421525557)
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0, and change bus-width to 4 then spifc can be enabled.
+ */
+&sd_emmc_c {
+ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>;
+ bus-width = <4>;
+};
+
+&spifc {
+ status = "okay";
+};
Index: arch/arm64/boot/dts/amlogic/Makefile
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index f231280cd808..da3225d31e38 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -10,7 +10,9 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gsking-x.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-spi.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus-spi.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-radxa-zero2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb

View File

@@ -0,0 +1,46 @@
From 712b399ed54f49e0ac7ae92c57ed775604eaaed9 Mon Sep 17 00:00:00 2001
From: Igor Pecovnik <igor.pecovnik@gmail.com>
Date: Wed, 10 Feb 2021 18:07:08 +0100
Subject: [PATCH] Add missing CPU opp values for clocking g12b / N2+ higher
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
---
.../arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
index d61f43052..75030d197 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
@@ -65,6 +65,14 @@ opp-1800000000 {
opp-hz = /bits/ 64 <1800000000>;
opp-microvolt = <1001000>;
};
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <1030000>;
+ };
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1040000>;
+ };
};
cpub_opp_table_1: opp-table-1 {
@@ -145,5 +153,13 @@ opp-2208000000 {
opp-hz = /bits/ 64 <2208000000>;
opp-microvolt = <1011000>;
};
+ opp-2304000000 {
+ opp-hz = /bits/ 64 <2304000000>;
+ opp-microvolt = <1030000>;
+ };
+ opp-2400000000 {
+ opp-hz = /bits/ 64 <2400000000>;
+ opp-microvolt = <1040000>;
+ };
};
};
--
Created with Armbian build tools https://github.com/armbian/build

View File

@@ -0,0 +1,94 @@
From 795fad491189f7fd6034d6d639602119a4e60755 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Tue, 17 Aug 2021 16:16:43 +0000
Subject: [PATCH 68/90] WIP: arm64: dts: meson: radxa-zero: add support for the
usb type-c controller
Radxa Zero uses an FUSB302 type-c controller, so lets enable it.
NB: Polarity swapping via GPIO is not implemented in the current driver
(see drivers/usb/typec/tcpm/fusb302.c) so it is not possible to handle
GPIOAO_6 for USB3 polarity control.
Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
.../dts/amlogic/meson-g12a-radxa-zero.dts | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
index e3bb6df42ff3..5e3dc013409f 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
@@ -60,6 +60,14 @@ sdio_pwrseq: sdio-pwrseq {
clock-names = "ext_clock";
};
+ typec2_vbus: regulator-typec2_vbus {
+ compatible = "regulator-fixed";
+ regulator-name = "TYPEC2_VBUS";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&ao_5v>;
+ };
+
ao_5v: regulator-ao_5v {
compatible = "regulator-fixed";
regulator-name = "AO_5V";
@@ -191,6 +199,18 @@ wifi32k: wifi32k {
};
};
+&ao_pinctrl {
+ /* Ensure the TYPE C controller irq pin is not driven by the SoC */
+ fusb302_irq_pins: fusb302_irq {
+ mux {
+ groups = "GPIOAO_5";
+ function = "gpio_aobus";
+ bias-pull-up;
+ output-disable;
+ };
+ };
+};
+
&arb {
status = "okay";
};
@@ -278,6 +298,22 @@ &ir {
pinctrl-names = "default";
};
+&i2c_AO {
+ fusb302@22 {
+ compatible = "fcs,fusb302";
+ reg = <0x22>;
+
+ pinctrl-0 = <&fusb302_irq_pins>;
+ pinctrl-names = "default";
+ interrupt-parent = <&gpio_intc>;
+ interrupts = <59 IRQ_TYPE_LEVEL_LOW>;
+
+ vbus-supply = <&typec2_vbus>;
+
+ status = "okay";
+ };
+};
+
&pwm_AO_cd {
pinctrl-0 = <&pwm_ao_d_e_pins>;
pinctrl-names = "default";
@@ -403,3 +439,11 @@ &usb {
status = "okay";
dr_mode = "host";
};
+
+&usb2_phy0 {
+ phy-supply = <&typec2_vbus>;
+};
+
+&usb3_pcie_phy {
+ phy-supply = <&typec2_vbus>;
+};
--
2.35.1

View File

@@ -0,0 +1,12 @@
diff -Naur a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts 2022-03-20 16:14:17.000000000 -0400
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts 2022-03-27 07:44:01.636737819 -0400
@@ -310,7 +310,7 @@
bus-width = <4>;
cap-sd-highspeed;
- sd-uhs-sdr50;
+ cap-mmc-highspeed;
max-frequency = <100000000>;
non-removable;

View File

@@ -0,0 +1,31 @@
From 2653defc5e22ba86bd1d455eb01fc7edd2958473 Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Wed, 2 Feb 2022 11:56:51 +0300
Subject: [PATCH 08/50] drv:spi:spidev remove warnings
---
drivers/spi/spidev.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index b2775d82d2d7..3c65d3d74559 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -683,6 +683,7 @@ static const struct file_operations spidev_fops = {
static struct class *spidev_class;
static const struct spi_device_id spidev_spi_ids[] = {
+ { .name = "spi-dev" },
{ .name = "dh2228fv" },
{ .name = "ltc2488" },
{ .name = "sx1301" },
@@ -709,6 +710,7 @@ static int spidev_of_check(struct device *dev)
}
static const struct of_device_id spidev_dt_ids[] = {
+ { .compatible = "armbian,spi-dev", .data = &spidev_of_check },
{ .compatible = "rohm,dh2228fv", .data = &spidev_of_check },
{ .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check },
{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
--
2.35.3

View File

@@ -0,0 +1,135 @@
From e0252efa9190de31a2fc98eed28b273428a3fe36 Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Thu, 3 Nov 2016 15:29:23 +0100
Subject: [PATCH 05/90] HACK: arm64: meson: add Amlogic Meson GX PM Suspend
The Amlogic Meson GX SoCs uses a non-standard argument to the
PSCI CPU_SUSPEND call to enter system suspend.
Implement such call within platform_suspend_ops.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/firmware/meson/Kconfig | 6 ++
drivers/firmware/meson/Makefile | 1 +
drivers/firmware/meson/meson_gx_pm.c | 86 ++++++++++++++++++++++++++++
3 files changed, 93 insertions(+)
create mode 100644 drivers/firmware/meson/meson_gx_pm.c
diff --git a/drivers/firmware/meson/Kconfig b/drivers/firmware/meson/Kconfig
index f2fdd3756648..d3ead92ac61b 100644
--- a/drivers/firmware/meson/Kconfig
+++ b/drivers/firmware/meson/Kconfig
@@ -9,3 +9,9 @@ config MESON_SM
depends on ARM64_4K_PAGES
help
Say y here to enable the Amlogic secure monitor driver
+
+config MESON_GX_PM
+ bool
+ default ARCH_MESON if ARM64
+ help
+ Say y here to enable the Amlogic GX SoC Power Management
diff --git a/drivers/firmware/meson/Makefile b/drivers/firmware/meson/Makefile
index c6c09483b622..0193cdfee32f 100644
--- a/drivers/firmware/meson/Makefile
+++ b/drivers/firmware/meson/Makefile
@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_MESON_SM) += meson_sm.o
+obj-$(CONFIG_MESON_GX_PM) += meson_gx_pm.o
diff --git a/drivers/firmware/meson/meson_gx_pm.c b/drivers/firmware/meson/meson_gx_pm.c
new file mode 100644
index 000000000000..c104c2e4c77f
--- /dev/null
+++ b/drivers/firmware/meson/meson_gx_pm.c
@@ -0,0 +1,86 @@
+/*
+ * Amlogic Meson GX Power Management
+ *
+ * Copyright (c) 2016 Baylibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/suspend.h>
+#include <linux/arm-smccc.h>
+
+#include <uapi/linux/psci.h>
+
+#include <asm/suspend.h>
+
+/*
+ * The Amlogic GX SoCs uses a special argument value to the
+ * PSCI CPU_SUSPEND method to enter SUSPEND_MEM.
+ */
+
+#define MESON_SUSPEND_PARAM 0x0010000
+#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name
+
+static int meson_gx_suspend_finish(unsigned long arg)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_smc(PSCI_FN_NATIVE(0_2, CPU_SUSPEND), arg,
+ virt_to_phys(cpu_resume), 0, 0, 0, 0, 0, &res);
+
+ return res.a0;
+}
+
+static int meson_gx_suspend_enter(suspend_state_t state)
+{
+ switch (state) {
+ case PM_SUSPEND_MEM:
+ return cpu_suspend(MESON_SUSPEND_PARAM,
+ meson_gx_suspend_finish);
+ }
+
+ return -EINVAL;
+}
+
+static const struct platform_suspend_ops meson_gx_pm_ops = {
+ .enter = meson_gx_suspend_enter,
+ .valid = suspend_valid_only_mem,
+};
+
+static const struct of_device_id meson_gx_pm_match[] = {
+ { .compatible = "amlogic,meson-gx-pm", },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, meson_gx_pm_match);
+
+static int meson_gx_pm_probe(struct platform_device *pdev)
+{
+ suspend_set_ops(&meson_gx_pm_ops);
+
+ return 0;
+}
+
+static struct platform_driver meson_gx_pm_driver = {
+ .probe = meson_gx_pm_probe,
+ .driver = {
+ .name = "meson-gx-pm",
+ .of_match_table = meson_gx_pm_match,
+ },
+};
+
+module_platform_driver(meson_gx_pm_driver);
+
+MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>");
+MODULE_DESCRIPTION("Amlogic Meson GX PM driver");
+MODULE_LICENSE("GPL v2");
--
2.35.1

View File

@@ -0,0 +1,91 @@
diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore
index 8c759326baf4..e6ce8f6ad4b1 100644
--- a/arch/arm/boot/.gitignore
+++ b/arch/arm/boot/.gitignore
@@ -4,3 +4,5 @@ zImage
xipImage
bootpImage
uImage
+*.dtb*
+*.scr
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 190d781e84f4..6540de71182b 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -18,9 +18,12 @@ include $(srctree)/scripts/Kbuild.include
include $(src)/Makefile
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
+dtbos := $(addprefix $(dst)/, $(dtbo-y))
+scrs := $(addprefix $(dst)/, $(scr-y))
+readmes := $(addprefix $(dst)/, $(dtbotxt-y))
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
-__dtbs_install: $(dtbs) $(subdirs)
+__dtbs_install: $(dtbs) $(dtbos) $(scrs) $(readmes) $(subdirs)
@:
quiet_cmd_dtb_install = INSTALL $@
@@ -32,6 +35,15 @@ $(dst)/%.dtb: $(obj)/%.dtb
$(dst)/%.dtbo: $(obj)/%.dtbo
$(call cmd,dtb_install)
+$(dst)/%.dtbo: $(obj)/%.dtbo
+ $(call cmd,dtb_install)
+
+$(dst)/%.scr: $(obj)/%.scr
+ $(call cmd,dtb_install)
+
+$(dst)/README.meson-overlays: $(src)/README.meson-overlays
+ $(call cmd,dtb_install)
+
PHONY += $(subdirs)
$(subdirs):
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index d1425778664b..a28448cebd7c 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -311,6 +311,9 @@ quiet_cmd_gzip = GZIP $@
DTC ?= $(objtree)/scripts/dtc/dtc
DTC_FLAGS += -Wno-interrupt_provider
+# Overlay support
+DTC_FLAGS += -@ -Wno-unit_address_format -Wno-simple_bus_reg
+
# Disable noisy checks by default
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
DTC_FLAGS += -Wno-unit_address_vs_reg \
@@ -371,7 +374,7 @@ DT_BINDING_DIR := Documentation/devicetree/bindings
DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
quiet_cmd_dtb_check = CHECK $@
- cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+ cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
endif
define rule_dtc
@@ -385,6 +388,23 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
$(call if_changed_dep,dtc)
+quiet_cmd_dtco = DTCO $@
+cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
+ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+ $(DTC) -O dtb -o $@ -b 0 \
+ -i $(dir $<) $(DTC_FLAGS) \
+ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
+ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
+
+$(obj)/%.dtbo: $(src)/%.dts FORCE
+ $(call if_changed_dep,dtco)
+
+quiet_cmd_scr = MKIMAGE $@
+cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@
+
+$(obj)/%.scr: $(src)/%.scr-cmd FORCE
+ $(call if_changed,scr)
+
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
# Bzip2

View File

@@ -0,0 +1,29 @@
From 192ff185a6f85f2519cc4b97aa015a836f5a8fbb Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Mon, 9 Jul 2018 21:25:15 +0200
Subject: [PATCH 10/84] TEMP: drm: dw-hdmi: call hdmi_set_cts_n after clock is
enabled
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 3e1be9894ed1..733c3dec04de 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -781,6 +781,11 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable)
else
hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE;
hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
+
+ if (enable) {
+ hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0);
+ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n);
+ }
}
static u8 *hdmi_audio_get_eld(struct dw_hdmi *hdmi)
--
2.7.1

View File

@@ -0,0 +1,39 @@
From 0eb45601fe5d6b3aa9eb7038bb51df6b5fb9f860 Mon Sep 17 00:00:00 2001
From: Qinglang Miao <miaoqinglang@huawei.com>
Date: Sat, 28 Nov 2020 16:10:04 +0000
Subject: [PATCH 08/58] FROMLIST(v1): drm/panfrost: fix reference leak in
panfrost_job_hw_submit
pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to putting operation will result in a
reference leak here.
A new function pm_runtime_resume_and_get is introduced in
[0] to keep usage counter balanced. So We fix the reference
leak by replacing it with new funtion.
[0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
drivers/gpu/drm/panfrost/panfrost_job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 04e6f6f9b742..d6d5c15184f9 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -157,7 +157,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
panfrost_devfreq_record_busy(&pfdev->pfdevfreq);
- ret = pm_runtime_get_sync(pfdev->dev);
+ ret = pm_runtime_resume_and_get(pfdev->dev);
if (ret < 0)
return;
--
2.25.1

View File

@@ -0,0 +1,31 @@
From 5c9793b46115c2fd774678de7ff5efd7d6ae8d72 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sat, 13 Apr 2019 05:45:18 +0000
Subject: [PATCH 03/90] HACK: arm64: fix Kodi sysinfo CPU information
This allows the CPU information to show in the Kodi sysinfo screen, e.g.
"ARMv8 Processor rev 4 (v81)" on Amlogic devices
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/kernel/cpuinfo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 591c18a889a5..fdd91a00a285 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -151,8 +151,7 @@ static int c_show(struct seq_file *m, void *v)
* "processor". Give glibc what it expects.
*/
seq_printf(m, "processor\t: %d\n", i);
- if (compat)
- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
+ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
--
2.35.1

View File

@@ -0,0 +1,76 @@
From 9175674ca107a9090936d7373927567f41d1ae7e Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 10 Sep 2020 11:01:33 +0900
Subject: [PATCH] ODROID-COMMON: gpu/drm: add new display resolution 2560x1440
Signed-off-by: Joy Cho <joy.cho@hardkernel.com>
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
drivers/gpu/drm/meson/meson_vclk.c | 18 ++++++++++++++++++
drivers/gpu/drm/meson/meson_venc.c | 5 +++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
index 2a82119eb58e..eb4c251d79b7 100644
--- a/drivers/gpu/drm/meson/meson_vclk.c
+++ b/drivers/gpu/drm/meson/meson_vclk.c
@@ -357,6 +357,8 @@ enum {
MESON_VCLK_HDMI_594000,
/* 2970 /1 /1 /1 /5 /1 => /1 /2 */
MESON_VCLK_HDMI_594000_YUV420,
+/* 4830 /2 /1 /2 /5 /1 => /1 /1 */
+ MESON_VCLK_HDMI_241500,
};
struct meson_vclk_params {
@@ -467,6 +469,18 @@ struct meson_vclk_params {
.vid_pll_div = VID_PLL_DIV_5,
.vclk_div = 1,
},
+ [MESON_VCLK_HDMI_241500] = {
+ .pll_freq = 4830000,
+ .phy_freq = 2415000,
+ .venc_freq = 241500,
+ .vclk_freq = 241500,
+ .pixel_freq = 241500,
+ .pll_od1 = 2,
+ .pll_od2 = 1,
+ .pll_od3 = 2,
+ .vid_pll_div = VID_PLL_DIV_5,
+ .vclk_div = 1,
+ },
{ /* sentinel */ },
};
@@ -873,6 +887,10 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
m = 0xf7;
frac = vic_alternate_clock ? 0x8148 : 0x10000;
break;
+ case 4830000:
+ m = 0xc9;
+ frac = 0xd560;
+ break;
}
meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
index 3c55ed003359..559ab3b5e212 100644
--- a/drivers/gpu/drm/meson/meson_venc.c
+++ b/drivers/gpu/drm/meson/meson_venc.c
@@ -866,10 +866,11 @@ meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode)
DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))
return MODE_BAD;
- if (mode->hdisplay < 640 || mode->hdisplay > 1920)
+ /* support higher resolution than 1920x1080 */
+ if (mode->hdisplay < 640 || mode->hdisplay > 2560)
return MODE_BAD_HVALUE;
- if (mode->vdisplay < 480 || mode->vdisplay > 1200)
+ if (mode->vdisplay < 480 || mode->vdisplay > 1600)
return MODE_BAD_VVALUE;
return MODE_OK;
--
2.35.1

View File

@@ -0,0 +1,202 @@
From dd29d3d05631c4afdab56fb696424565a4afefba Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 23 Dec 2018 02:24:38 +0100
Subject: [PATCH 53/90] WIP: ASoC: hdmi-codec: reorder channel allocation list
Wrong channel allocation is selected by hdmi_codec_get_ch_alloc_table_idx().
E.g when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC
ca_id 0x01 with speaker mask FL|FR|LFE gets selected instead of
ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels
and
ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of
ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels
Fix this by reorder the channel allocation list with
most specific speaker mask at the top.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
sound/soc/codecs/hdmi-codec.c | 140 +++++++++++++++++++---------------
1 file changed, 77 insertions(+), 63 deletions(-)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index b07607a9ecea..a12015471ea2 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -188,84 +188,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {
/*
* hdmi_codec_channel_alloc: speaker configuration available for CEA
*
- * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct
+ * This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps
* The preceding ones have better chances to be selected by
* hdmi_codec_get_ch_alloc_table_idx().
*/
static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {
{ .ca_id = 0x00, .n_ch = 2,
- .mask = FL | FR},
- /* 2.1 */
- { .ca_id = 0x01, .n_ch = 4,
- .mask = FL | FR | LFE},
- /* Dolby Surround */
+ .mask = FL | FR },
+ { .ca_id = 0x03, .n_ch = 4,
+ .mask = FL | FR | LFE | FC },
{ .ca_id = 0x02, .n_ch = 4,
.mask = FL | FR | FC },
- /* surround51 */
+ { .ca_id = 0x01, .n_ch = 4,
+ .mask = FL | FR | LFE },
{ .ca_id = 0x0b, .n_ch = 6,
- .mask = FL | FR | LFE | FC | RL | RR},
- /* surround40 */
- { .ca_id = 0x08, .n_ch = 6,
- .mask = FL | FR | RL | RR },
- /* surround41 */
- { .ca_id = 0x09, .n_ch = 6,
- .mask = FL | FR | LFE | RL | RR },
- /* surround50 */
+ .mask = FL | FR | LFE | FC | RL | RR },
{ .ca_id = 0x0a, .n_ch = 6,
.mask = FL | FR | FC | RL | RR },
- /* 6.1 */
- { .ca_id = 0x0f, .n_ch = 8,
- .mask = FL | FR | LFE | FC | RL | RR | RC },
- /* surround71 */
+ { .ca_id = 0x09, .n_ch = 6,
+ .mask = FL | FR | LFE | RL | RR },
+ { .ca_id = 0x08, .n_ch = 6,
+ .mask = FL | FR | RL | RR },
+ { .ca_id = 0x07, .n_ch = 6,
+ .mask = FL | FR | LFE | FC | RC },
+ { .ca_id = 0x06, .n_ch = 6,
+ .mask = FL | FR | FC | RC },
+ { .ca_id = 0x05, .n_ch = 6,
+ .mask = FL | FR | LFE | RC },
+ { .ca_id = 0x04, .n_ch = 6,
+ .mask = FL | FR | RC },
{ .ca_id = 0x13, .n_ch = 8,
.mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
- /* others */
- { .ca_id = 0x03, .n_ch = 8,
- .mask = FL | FR | LFE | FC },
- { .ca_id = 0x04, .n_ch = 8,
- .mask = FL | FR | RC},
- { .ca_id = 0x05, .n_ch = 8,
- .mask = FL | FR | LFE | RC },
- { .ca_id = 0x06, .n_ch = 8,
- .mask = FL | FR | FC | RC },
- { .ca_id = 0x07, .n_ch = 8,
- .mask = FL | FR | LFE | FC | RC },
- { .ca_id = 0x0c, .n_ch = 8,
- .mask = FL | FR | RC | RL | RR },
- { .ca_id = 0x0d, .n_ch = 8,
- .mask = FL | FR | LFE | RL | RR | RC },
- { .ca_id = 0x0e, .n_ch = 8,
- .mask = FL | FR | FC | RL | RR | RC },
- { .ca_id = 0x10, .n_ch = 8,
- .mask = FL | FR | RL | RR | RLC | RRC },
- { .ca_id = 0x11, .n_ch = 8,
- .mask = FL | FR | LFE | RL | RR | RLC | RRC },
+ { .ca_id = 0x1f, .n_ch = 8,
+ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
{ .ca_id = 0x12, .n_ch = 8,
.mask = FL | FR | FC | RL | RR | RLC | RRC },
- { .ca_id = 0x14, .n_ch = 8,
- .mask = FL | FR | FLC | FRC },
- { .ca_id = 0x15, .n_ch = 8,
- .mask = FL | FR | LFE | FLC | FRC },
- { .ca_id = 0x16, .n_ch = 8,
- .mask = FL | FR | FC | FLC | FRC },
- { .ca_id = 0x17, .n_ch = 8,
- .mask = FL | FR | LFE | FC | FLC | FRC },
- { .ca_id = 0x18, .n_ch = 8,
- .mask = FL | FR | RC | FLC | FRC },
- { .ca_id = 0x19, .n_ch = 8,
- .mask = FL | FR | LFE | RC | FLC | FRC },
- { .ca_id = 0x1a, .n_ch = 8,
- .mask = FL | FR | RC | FC | FLC | FRC },
- { .ca_id = 0x1b, .n_ch = 8,
- .mask = FL | FR | LFE | RC | FC | FLC | FRC },
- { .ca_id = 0x1c, .n_ch = 8,
- .mask = FL | FR | RL | RR | FLC | FRC },
- { .ca_id = 0x1d, .n_ch = 8,
- .mask = FL | FR | LFE | RL | RR | FLC | FRC },
{ .ca_id = 0x1e, .n_ch = 8,
.mask = FL | FR | FC | RL | RR | FLC | FRC },
- { .ca_id = 0x1f, .n_ch = 8,
- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
+ { .ca_id = 0x11, .n_ch = 8,
+ .mask = FL | FR | LFE | RL | RR | RLC | RRC },
+ { .ca_id = 0x1d, .n_ch = 8,
+ .mask = FL | FR | LFE | RL | RR | FLC | FRC },
+ { .ca_id = 0x10, .n_ch = 8,
+ .mask = FL | FR | RL | RR | RLC | RRC },
+ { .ca_id = 0x1c, .n_ch = 8,
+ .mask = FL | FR | RL | RR | FLC | FRC },
+ { .ca_id = 0x0f, .n_ch = 8,
+ .mask = FL | FR | LFE | FC | RL | RR | RC },
+ { .ca_id = 0x1b, .n_ch = 8,
+ .mask = FL | FR | LFE | RC | FC | FLC | FRC },
+ { .ca_id = 0x0e, .n_ch = 8,
+ .mask = FL | FR | FC | RL | RR | RC },
+ { .ca_id = 0x1a, .n_ch = 8,
+ .mask = FL | FR | RC | FC | FLC | FRC },
+ { .ca_id = 0x0d, .n_ch = 8,
+ .mask = FL | FR | LFE | RL | RR | RC },
+ { .ca_id = 0x19, .n_ch = 8,
+ .mask = FL | FR | LFE | RC | FLC | FRC },
+ { .ca_id = 0x0c, .n_ch = 8,
+ .mask = FL | FR | RC | RL | RR },
+ { .ca_id = 0x18, .n_ch = 8,
+ .mask = FL | FR | RC | FLC | FRC },
+ { .ca_id = 0x17, .n_ch = 8,
+ .mask = FL | FR | LFE | FC | FLC | FRC },
+ { .ca_id = 0x16, .n_ch = 8,
+ .mask = FL | FR | FC | FLC | FRC },
+ { .ca_id = 0x15, .n_ch = 8,
+ .mask = FL | FR | LFE | FLC | FRC },
+ { .ca_id = 0x14, .n_ch = 8,
+ .mask = FL | FR | FLC | FRC },
+ { .ca_id = 0x0b, .n_ch = 8,
+ .mask = FL | FR | LFE | FC | RL | RR },
+ { .ca_id = 0x0a, .n_ch = 8,
+ .mask = FL | FR | FC | RL | RR },
+ { .ca_id = 0x09, .n_ch = 8,
+ .mask = FL | FR | LFE | RL | RR },
+ { .ca_id = 0x08, .n_ch = 8,
+ .mask = FL | FR | RL | RR },
+ { .ca_id = 0x07, .n_ch = 8,
+ .mask = FL | FR | LFE | FC | RC },
+ { .ca_id = 0x06, .n_ch = 8,
+ .mask = FL | FR | FC | RC },
+ { .ca_id = 0x05, .n_ch = 8,
+ .mask = FL | FR | LFE | RC },
+ { .ca_id = 0x04, .n_ch = 8,
+ .mask = FL | FR | RC },
+ { .ca_id = 0x03, .n_ch = 8,
+ .mask = FL | FR | LFE | FC },
+ { .ca_id = 0x02, .n_ch = 8,
+ .mask = FL | FR | FC },
+ { .ca_id = 0x01, .n_ch = 8,
+ .mask = FL | FR | LFE },
};
struct hdmi_codec_priv {
@@ -374,7 +387,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
struct hdmi_codec_priv *hcp = info->private_data;
- map = info->chmap[hcp->chmap_idx].map;
+ if (hcp->chmap_idx != HDMI_CODEC_CHMAP_IDX_UNKNOWN)
+ map = info->chmap[hcp->chmap_idx].map;
for (i = 0; i < info->max_channels; i++) {
if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN)
--
2.35.1

View File

@@ -0,0 +1,141 @@
From 9f34f631a394fb13fbe5c4fca5e9ab3792d4c7d6 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 30 Jun 2021 11:38:33 +0900
Subject: [PATCH] ODROID-COMMON: hwmon: (pwm-fan): fix to add 'pwm1_enable' to
set PWM fan mode
Change-Id: If0562f497703b8660206dad80d7933902bbf53e4
---
drivers/hwmon/pwm-fan.c | 67 +++++++++++++++++++++++++++++++++++++----
1 file changed, 61 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index f12b9a28a232..383a24316985 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -8,6 +8,7 @@
*/
#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/mutex.h>
@@ -44,6 +45,7 @@ struct pwm_fan_ctx {
unsigned int pwm_fan_max_state;
unsigned int *pwm_fan_cooling_levels;
struct thermal_cooling_device *cdev;
+ int enable;
struct hwmon_chip_info info;
struct hwmon_channel_info fan_channel;
@@ -99,6 +101,10 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm)
struct pwm_state *state = &ctx->pwm_state;
mutex_lock(&ctx->lock);
+
+ if (!ctx->enable)
+ pwm = MAX_PWM;
+
if (ctx->pwm_value == pwm)
goto exit_set_pwm_err;
@@ -183,6 +189,51 @@ static const struct hwmon_ops pwm_fan_hwmon_ops = {
.write = pwm_fan_write,
};
+static ssize_t enable_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
+ int err;
+ unsigned long val;
+
+ err = kstrtoul(buf, 10, &val);
+ if (err)
+ return err;
+
+ mutex_lock(&ctx->lock);
+ ctx->enable = val;
+ mutex_unlock(&ctx->lock);
+
+ err = __set_pwm(ctx, ctx->pwm_fan_cooling_levels[ctx->pwm_fan_state]);
+
+ return err ? err : count;
+}
+
+static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%u\n", ctx->enable);
+}
+
+static SENSOR_DEVICE_ATTR_RW(pwm1_enable, enable, 0);
+
+static struct attribute *pwm_fan_attrs[] = {
+ &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+ NULL,
+};
+
+static const struct attribute_group pwm_fan_group = {
+ .attrs = pwm_fan_attrs,
+};
+
+static const struct attribute_group *pwm_fan_groups[] = {
+ &pwm_fan_group,
+ NULL,
+};
+
/* thermal cooling device callbacks */
static int pwm_fan_get_max_state(struct thermal_cooling_device *cdev,
unsigned long *state)
@@ -214,7 +265,7 @@ static int
pwm_fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
{
struct pwm_fan_ctx *ctx = cdev->devdata;
- int ret;
+ int ret = 0;
if (!ctx || (state > ctx->pwm_fan_max_state))
return -EINVAL;
@@ -222,10 +273,12 @@ pwm_fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
if (state == ctx->pwm_fan_state)
return 0;
- ret = __set_pwm(ctx, ctx->pwm_fan_cooling_levels[state]);
- if (ret) {
- dev_err(&cdev->device, "Cannot set pwm!\n");
- return ret;
+ if (ctx->enable >= 2) {
+ ret = __set_pwm(ctx, ctx->pwm_fan_cooling_levels[state]);
+ if (ret) {
+ dev_err(&cdev->device, "Cannot set pwm!\n");
+ return ret;
+ }
}
ctx->pwm_fan_state = state;
@@ -316,6 +369,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
if (IS_ERR(ctx->pwm))
return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
+ ctx->enable = 2;
+
platform_set_drvdata(pdev, ctx);
ctx->reg_en = devm_regulator_get_optional(dev, "fan");
@@ -434,7 +489,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
ctx->info.info = channels;
hwmon = devm_hwmon_device_register_with_info(dev, "pwmfan",
- ctx, &ctx->info, NULL);
+ ctx, &ctx->info, pwm_fan_groups);
if (IS_ERR(hwmon)) {
dev_err(dev, "Failed to register hwmon device\n");
return PTR_ERR(hwmon);
--
2.35.1

View File

@@ -0,0 +1,56 @@
From 4b6096bb3fd5bdc139a45e022e4a2380ea919dea Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sat, 13 Apr 2019 05:41:51 +0000
Subject: [PATCH 01/90] HACK: set meson-gx cma pool to 896MB
This change sets the CMA pool to a larger 896MB! value for vdec use
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index aa14ea017a61..99b8916e0c5d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -58,7 +58,7 @@ secmon_reserved_bl32: secmon@5300000 {
linux,cma {
compatible = "shared-dma-pool";
reusable;
- size = <0x0 0x10000000>;
+ size = <0x0 0x38000000>;
alignment = <0x0 0x400000>;
linux,cma-default;
};
--
2.35.1
From 18586e3d94827f63903c4cd596a0a06134261c00 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Wed, 14 Aug 2019 19:58:14 +0000
Subject: [PATCH 02/90] HACK: set meson-g12 cma pool to 896MB
This change sets the CMA pool to a larger 896MB! value for vdec use
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index f84d4b489e0b..04da23119ff1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -116,7 +116,7 @@ secmon_reserved_bl32: secmon@5300000 {
linux,cma {
compatible = "shared-dma-pool";
reusable;
- size = <0x0 0x10000000>;
+ size = <0x0 0x38000000>;
alignment = <0x0 0x400000>;
linux,cma-default;
};
--
2.35.1

View File

@@ -0,0 +1,637 @@
From b615e1a2ac4cc58734db101cd209aed0a11d2343 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Thu, 5 Mar 2020 19:01:43 +0900
Subject: [PATCH] ODROID-COMMON: input/touchscreen: Add D-WAV Multitouch
driver.
Change-Id: Ia1c8c29d3f69c6ba5d630279c4cc98119b68ab71
---
drivers/hid/hid-ids.h | 6 +
drivers/hid/hid-quirks.c | 3 +
drivers/input/touchscreen/Kconfig | 10 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/dwav-usb-mt.c | 554 ++++++++++++++++++++++++
5 files changed, 574 insertions(+)
create mode 100644 drivers/input/touchscreen/dwav-usb-mt.c
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index a5a5a64c7abc..39c719033cd0 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1372,4 +1372,10 @@
#define USB_VENDOR_ID_SIGNOTEC 0x2133
#define USB_DEVICE_ID_SIGNOTEC_VIEWSONIC_PD1011 0x0018
+#define USB_DEVICE_ID_DWAV_MULTITOUCH 0x0005
+
+#define USB_VENDOR_ID_ODROID 0x16b4
+#define USB_DEVICE_ID_VU5 0x0704
+#define USB_DEVICE_ID_VU7PLUS 0x0705
+
#endif
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index ee7e504e7279..4d876faea391 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -863,6 +863,9 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) },
#endif
{ HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
+
+ { HID_USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU5) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU7PLUS) },
{ }
};
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 2f6adfb7b938..cec65479dc79 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -1367,4 +1367,14 @@ config TOUCHSCREEN_ZINITIX
To compile this driver as a module, choose M here: the
module will be called zinitix.
+config TOUCHSCREEN_DWAV_USB_MT
+ tristate "D-WAV Scientific USB MultiTouch"
+ depends on USB_ARCH_HAS_HCD
+ select USB
+ help
+ Say Y here if you have a D-WAV Scientific USB(HID) based MultiTouch
+ controller.
+
+ module will be called dwav-usb-mt.
+
endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 39a8127cf6a5..f8bede5caafd 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -115,3 +115,4 @@ obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o
obj-$(CONFIG_TOUCHSCREEN_IQS5XX) += iqs5xx.o
obj-$(CONFIG_TOUCHSCREEN_ZINITIX) += zinitix.o
+obj-$(CONFIG_TOUCHSCREEN_DWAV_USB_MT) += dwav-usb-mt.o
diff --git a/drivers/input/touchscreen/dwav-usb-mt.c b/drivers/input/touchscreen/dwav-usb-mt.c
new file mode 100644
index 000000000000..7ec8b6dd15fd
--- /dev/null
+++ b/drivers/input/touchscreen/dwav-usb-mt.c
@@ -0,0 +1,554 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * D-WAV Scientific USB(HID) MultiTouch Screen Driver(Based on usbtouchscreen.c)
+ *
+ * Copyright (C) Hardkernel, 2015
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/usb.h>
+#include <linux/usb/input.h>
+#include <linux/hid.h>
+
+#include <linux/input/mt.h>
+
+#define USB_VENDOR_ID_DWAV 0x0eef /* 800 x 480, 7" DWAV touch */
+#define USB_DEVICE_ID_VU7 0x0005
+
+#define USB_VENDOR_ID_ODROID 0x16b4
+#define USB_DEVICE_ID_VU5 0x0704
+#define USB_DEVICE_ID_VU7PLUS 0x0705
+
+enum {
+ ODROID_VU7 = 0, /* 800 x 480, 7" Touch */
+ ODROID_VU5, /* 800 x 480, 5" Touch */
+ ODROID_VU7PLUS, /* 1024 x 600, 7" Touch */
+};
+
+struct usbtouch_device_info {
+ char name[64];
+ int max_x;
+ int max_y;
+ int max_press;
+ int max_finger;
+};
+
+const struct usbtouch_device_info DEV_INFO[] = {
+ [ODROID_VU7] = {
+ .name = "ODROID VU7 MultiTouch(800x480)",
+ .max_x = 800,
+ .max_y = 480,
+ .max_press = 255,
+ .max_finger = 5,
+ },
+ [ODROID_VU5] = {
+ .name = "ODROID VU5 MultiTouch(800x480)",
+ .max_x = 800,
+ .max_y = 480,
+ .max_press = 255,
+ .max_finger = 5,
+ },
+ [ODROID_VU7PLUS] = {
+ .name = "ODROID VU7 Plus MultiTouch(1024x600)",
+ .max_x = 1024,
+ .max_y = 600,
+ .max_press = 255,
+ .max_finger = 5,
+ },
+};
+
+static const struct usb_device_id dwav_usb_mt_devices[] = {
+ {USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_VU7),
+ .driver_info = ODROID_VU7},
+ {USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU5),
+ .driver_info = ODROID_VU5},
+ {USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU7PLUS),
+ .driver_info = ODROID_VU7PLUS},
+ {}
+};
+
+struct dwav_raw { /* Total 25 bytes */
+ unsigned char header; /* frame header 0xAA*/
+ unsigned char press;
+ /* Touch flag (1:valid touch data, 0:touch finished) */
+ unsigned short x1; /* 1st x */
+ unsigned short y1; /* 1st y */
+ unsigned char end;
+ /* 1st touch finish flags 0xBB, RPI only uses the first 7 bytes */
+ unsigned char ids; /* touch ID(bit field) */
+ unsigned short y2;
+ unsigned short x2;
+ unsigned short y3;
+ unsigned short x3;
+ unsigned short y4;
+ unsigned short x4;
+ unsigned short y5;
+ unsigned short x5;
+ unsigned char tail; /* frame end 0xCC */
+};
+
+#define TS_EVENT_UNKNOWN 0x00
+#define TS_EVENT_PRESS 0x01
+#define TS_EVENT_RELEASE 0x02
+
+struct finger_t {
+ unsigned int status; /* ts event type */
+ unsigned int x; /* ts data x */
+ unsigned int y; /* ts data y */
+} __packed;
+
+struct dwav_usb_mt {
+ char name[128], phys[64];
+
+ int dev_id;
+ /* for URB Data DMA */
+ dma_addr_t data_dma;
+ unsigned char *data;
+ int data_size;
+
+ struct urb *irq;
+ struct usb_interface *interface;
+ struct input_dev *input;
+
+ struct finger_t *finger;
+};
+
+static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt)
+{
+ int id, max_x, max_y, max_press, max_finger;
+
+ max_x = DEV_INFO[dwav_usb_mt->dev_id].max_x;
+ max_y = DEV_INFO[dwav_usb_mt->dev_id].max_y;
+ max_press = DEV_INFO[dwav_usb_mt->dev_id].max_press;
+ max_finger = DEV_INFO[dwav_usb_mt->dev_id].max_finger;
+
+ for (id = 0; id < max_finger; id++) {
+
+ if (dwav_usb_mt->finger[id].status == TS_EVENT_UNKNOWN)
+ continue;
+
+ if (dwav_usb_mt->finger[id].x >= max_x ||
+ dwav_usb_mt->finger[id].y >= max_y)
+ continue;
+
+ input_mt_slot(dwav_usb_mt->input, id);
+
+ if (dwav_usb_mt->finger[id].status != TS_EVENT_RELEASE) {
+ input_mt_report_slot_state(dwav_usb_mt->input,
+ MT_TOOL_FINGER, true);
+ input_report_abs(dwav_usb_mt->input,
+ ABS_MT_POSITION_X,
+ dwav_usb_mt->finger[id].x);
+ input_report_abs(dwav_usb_mt->input,
+ ABS_MT_POSITION_Y,
+ dwav_usb_mt->finger[id].y);
+ input_report_abs(dwav_usb_mt->input,
+ ABS_MT_PRESSURE,
+ max_press);
+ } else {
+ input_mt_report_slot_state(dwav_usb_mt->input,
+ MT_TOOL_FINGER, false);
+ dwav_usb_mt->finger[id].status = TS_EVENT_UNKNOWN;
+ }
+ input_mt_report_pointer_emulation(dwav_usb_mt->input, true);
+ input_sync(dwav_usb_mt->input);
+ }
+}
+
+static void dwav_usb_mt_process(struct dwav_usb_mt *dwav_usb_mt,
+ unsigned char *pkt, int len)
+{
+ struct dwav_raw *dwav_raw = (struct dwav_raw *)pkt;
+ unsigned char bit_mask, cnt;
+
+ for (cnt = 0, bit_mask = 0x01;
+ cnt < DEV_INFO[dwav_usb_mt->dev_id].max_finger;
+ cnt++, bit_mask <<= 1) {
+ if ((dwav_raw->ids & bit_mask) && dwav_raw->press) {
+ dwav_usb_mt->finger[cnt].status = TS_EVENT_PRESS;
+ switch (cnt) {
+ case 0:
+ dwav_usb_mt->finger[cnt].x
+ = cpu_to_be16(dwav_raw->x1);
+ dwav_usb_mt->finger[cnt].y
+ = cpu_to_be16(dwav_raw->y1);
+ break;
+ case 1:
+ dwav_usb_mt->finger[cnt].x
+ = cpu_to_be16(dwav_raw->x2);
+ dwav_usb_mt->finger[cnt].y
+ = cpu_to_be16(dwav_raw->y2);
+ break;
+ case 2:
+ dwav_usb_mt->finger[cnt].x
+ = cpu_to_be16(dwav_raw->x3);
+ dwav_usb_mt->finger[cnt].y
+ = cpu_to_be16(dwav_raw->y3);
+ break;
+ case 3:
+ dwav_usb_mt->finger[cnt].x
+ = cpu_to_be16(dwav_raw->x4);
+ dwav_usb_mt->finger[cnt].y
+ = cpu_to_be16(dwav_raw->y4);
+ break;
+ case 4:
+ dwav_usb_mt->finger[cnt].x
+ = cpu_to_be16(dwav_raw->x5);
+ dwav_usb_mt->finger[cnt].y
+ = cpu_to_be16(dwav_raw->y5);
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (dwav_usb_mt->finger[cnt].status == TS_EVENT_PRESS)
+ dwav_usb_mt->finger[cnt].status
+ = TS_EVENT_RELEASE;
+ else
+ dwav_usb_mt->finger[cnt].status
+ = TS_EVENT_UNKNOWN;
+ }
+ }
+ dwav_usb_mt_report(dwav_usb_mt);
+}
+
+static void dwav_usb_mt_irq(struct urb *urb)
+{
+ struct dwav_usb_mt *dwav_usb_mt = urb->context;
+ struct device *dev = &dwav_usb_mt->interface->dev;
+ int retval;
+
+ switch (urb->status) {
+ case 0:
+ /* success */
+ break;
+ case -ETIME:
+ /* this urb is timing out */
+ dev_dbg(dev, "%s - urb timed out - was the device unplugged?\n",
+ __func__);
+ return;
+ case -ECONNRESET:
+ case -ENOENT:
+ case -ESHUTDOWN:
+ case -EPIPE:
+ /* this urb is terminated, clean up */
+ dev_dbg(dev, "%s - urb shutting down with status: %d\n",
+ __func__, urb->status);
+ return;
+ default:
+ dev_dbg(dev, "%s - nonzero urb status received: %d\n",
+ __func__, urb->status);
+ goto exit;
+ }
+
+ dwav_usb_mt_process(dwav_usb_mt, dwav_usb_mt->data, urb->actual_length);
+
+exit:
+ usb_mark_last_busy(interface_to_usbdev(dwav_usb_mt->interface));
+ retval = usb_submit_urb(urb, GFP_ATOMIC);
+ if (retval) {
+ dev_err(dev, "%s - usb_submit_urb failed with result: %d\n",
+ __func__, retval);
+ }
+}
+
+static int dwav_usb_mt_open(struct input_dev *input)
+{
+ struct dwav_usb_mt *dwav_usb_mt = input_get_drvdata(input);
+ int r;
+
+ dwav_usb_mt->irq->dev = interface_to_usbdev(dwav_usb_mt->interface);
+
+ r = usb_autopm_get_interface(dwav_usb_mt->interface) ? -EIO : 0;
+ if (r < 0)
+ goto out;
+
+ if (usb_submit_urb(dwav_usb_mt->irq, GFP_KERNEL)) {
+ r = -EIO;
+ goto out_put;
+ }
+
+ dwav_usb_mt->interface->needs_remote_wakeup = 1;
+out_put:
+ usb_autopm_put_interface(dwav_usb_mt->interface);
+out:
+ return r;
+}
+
+static void dwav_usb_mt_close(struct input_dev *input)
+{
+ struct dwav_usb_mt *dwav_usb_mt = input_get_drvdata(input);
+ int r;
+
+ usb_kill_urb(dwav_usb_mt->irq);
+
+ r = usb_autopm_get_interface(dwav_usb_mt->interface);
+
+ dwav_usb_mt->interface->needs_remote_wakeup = 0;
+ if (!r)
+ usb_autopm_put_interface(dwav_usb_mt->interface);
+}
+
+static int dwav_usb_mt_suspend(struct usb_interface *intf, pm_message_t message)
+{
+ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf);
+
+ usb_kill_urb(dwav_usb_mt->irq);
+
+ return 0;
+}
+
+static int dwav_usb_mt_resume(struct usb_interface *intf)
+{
+ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf);
+ struct input_dev *input = dwav_usb_mt->input;
+ int result = 0;
+
+ mutex_lock(&input->mutex);
+ if (input->users)
+ result = usb_submit_urb(dwav_usb_mt->irq, GFP_NOIO);
+ mutex_unlock(&input->mutex);
+
+ return result;
+}
+
+static int dwav_usb_mt_reset_resume(struct usb_interface *intf)
+{
+ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf);
+ struct input_dev *input = dwav_usb_mt->input;
+ int err = 0;
+
+ /* restart IO if needed */
+ mutex_lock(&input->mutex);
+ if (input->users)
+ err = usb_submit_urb(dwav_usb_mt->irq, GFP_NOIO);
+ mutex_unlock(&input->mutex);
+
+ return err;
+}
+
+static void dwav_usb_mt_free_buffers(struct usb_device *udev,
+ struct dwav_usb_mt *dwav_usb_mt)
+{
+ usb_free_coherent(udev, dwav_usb_mt->data_size,
+ dwav_usb_mt->data, dwav_usb_mt->data_dma);
+}
+
+static struct usb_endpoint_descriptor *dwav_usb_mt_get_input_endpoint(
+ struct usb_host_interface *interface)
+{
+ int i;
+
+ for (i = 0; i < interface->desc.bNumEndpoints; i++) {
+ if (usb_endpoint_dir_in(&interface->endpoint[i].desc))
+ return &interface->endpoint[i].desc;
+ }
+
+ return NULL;
+}
+
+static int dwav_usb_mt_init(struct dwav_usb_mt *dwav_usb_mt, void *dev)
+{
+ int err;
+ struct input_dev *input_dev = (struct input_dev *)dev;
+
+ input_dev->name = dwav_usb_mt->name;
+ input_dev->phys = dwav_usb_mt->phys;
+
+ input_set_drvdata(input_dev, dwav_usb_mt);
+
+ input_dev->open = dwav_usb_mt_open;
+ input_dev->close = dwav_usb_mt_close;
+
+ input_dev->id.bustype = BUS_USB;
+
+ /* single touch */
+ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+ input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+
+ input_set_abs_params(input_dev, ABS_X, 0,
+ DEV_INFO[dwav_usb_mt->dev_id].max_x, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0,
+ DEV_INFO[dwav_usb_mt->dev_id].max_y, 0, 0);
+
+ /* multi touch */
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0,
+ DEV_INFO[dwav_usb_mt->dev_id].max_x, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0,
+ DEV_INFO[dwav_usb_mt->dev_id].max_y, 0, 0);
+ input_mt_init_slots(input_dev,
+ DEV_INFO[dwav_usb_mt->dev_id].max_finger, 0);
+
+ err = input_register_device(input_dev);
+ if (err) {
+ pr_err("%s - input_register_device failed, err: %d\n",
+ __func__, err);
+ return err;
+ }
+
+ dwav_usb_mt->input = input_dev;
+
+ return 0;
+}
+
+static int dwav_usb_mt_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ struct dwav_usb_mt *dwav_usb_mt = NULL;
+ struct input_dev *input_dev = NULL;
+ struct usb_endpoint_descriptor *endpoint;
+ struct usb_device *udev = interface_to_usbdev(intf);
+
+ int err = 0;
+
+ endpoint = dwav_usb_mt_get_input_endpoint(intf->cur_altsetting);
+ if (!endpoint)
+ return -ENXIO;
+
+ dwav_usb_mt = kzalloc(sizeof(struct dwav_usb_mt), GFP_KERNEL);
+ if (!dwav_usb_mt)
+ return -ENOMEM;
+
+ dwav_usb_mt->dev_id = id->driver_info;
+
+ dwav_usb_mt->finger = kzalloc(sizeof(struct finger_t) *
+ DEV_INFO[dwav_usb_mt->dev_id].max_finger,
+ GFP_KERNEL);
+
+ if (!dwav_usb_mt->finger)
+ goto err_free_mem;
+
+ input_dev = input_allocate_device();
+ if (!input_dev)
+ goto err_free_mem;
+
+ dwav_usb_mt->data_size = sizeof(struct dwav_raw);
+ dwav_usb_mt->data = usb_alloc_coherent(udev, dwav_usb_mt->data_size,
+ GFP_KERNEL, &dwav_usb_mt->data_dma);
+ if (!dwav_usb_mt->data)
+ goto err_free_mem;
+
+ dwav_usb_mt->irq = usb_alloc_urb(0, GFP_KERNEL);
+ if (!dwav_usb_mt->irq) {
+ dev_dbg(&intf->dev,
+ "%s - usb_alloc_urb failed: usbtouch->irq\n",
+ __func__);
+ goto err_free_buffers;
+ }
+
+ if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) {
+ usb_fill_int_urb(dwav_usb_mt->irq, udev,
+ usb_rcvintpipe(udev, endpoint->bEndpointAddress),
+ dwav_usb_mt->data, dwav_usb_mt->data_size,
+ dwav_usb_mt_irq, dwav_usb_mt, endpoint->bInterval);
+ } else {
+ usb_fill_bulk_urb(dwav_usb_mt->irq, udev,
+ usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
+ dwav_usb_mt->data, dwav_usb_mt->data_size,
+ dwav_usb_mt_irq, dwav_usb_mt);
+ }
+
+ dwav_usb_mt->irq->dev = udev;
+ dwav_usb_mt->irq->transfer_dma = dwav_usb_mt->data_dma;
+ dwav_usb_mt->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+ dwav_usb_mt->interface = intf;
+
+ if (udev->manufacturer)
+ strlcpy(dwav_usb_mt->name,
+ udev->manufacturer, sizeof(dwav_usb_mt->name));
+
+ if (udev->product) {
+ if (udev->manufacturer)
+ strlcat(dwav_usb_mt->name,
+ " ", sizeof(dwav_usb_mt->name));
+
+ strlcat(dwav_usb_mt->name,
+ udev->product, sizeof(dwav_usb_mt->name));
+ }
+
+ if (!strlen(dwav_usb_mt->name)) {
+ snprintf(dwav_usb_mt->name, sizeof(dwav_usb_mt->name),
+ "D-WAV Scientific MultiTouch %04x:%04x",
+ le16_to_cpu(udev->descriptor.idVendor),
+ le16_to_cpu(udev->descriptor.idProduct));
+ }
+
+ usb_make_path(udev, dwav_usb_mt->phys, sizeof(dwav_usb_mt->phys));
+ strlcat(dwav_usb_mt->phys, "/input0", sizeof(dwav_usb_mt->phys));
+
+ usb_to_input_id(udev, &input_dev->id);
+
+ input_dev->dev.parent = &intf->dev;
+
+ err = dwav_usb_mt_init(dwav_usb_mt, (void *)input_dev);
+ if (err)
+ goto err_free_urb;
+
+ usb_set_intfdata(intf, dwav_usb_mt);
+
+ dev_info(&intf->dev, "%s\n", DEV_INFO[dwav_usb_mt->dev_id].name);
+
+ return 0;
+
+err_free_urb:
+ usb_free_urb(dwav_usb_mt->irq);
+
+err_free_buffers:
+ dwav_usb_mt_free_buffers(udev, dwav_usb_mt);
+
+err_free_mem:
+ if (input_dev)
+ input_free_device(input_dev);
+ kfree(dwav_usb_mt);
+
+ return err;
+}
+
+static void dwav_usb_mt_disconnect(struct usb_interface *intf)
+{
+ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf);
+
+ if (!dwav_usb_mt)
+ return;
+
+ dev_dbg(&intf->dev,
+ "%s - dwav_usb_mt is initialized, cleaning up\n",
+ __func__);
+
+ usb_set_intfdata(intf, NULL);
+
+ /* this will stop IO via close */
+ input_unregister_device(dwav_usb_mt->input);
+
+ usb_free_urb(dwav_usb_mt->irq);
+
+ dwav_usb_mt_free_buffers(interface_to_usbdev(intf), dwav_usb_mt);
+
+ kfree(dwav_usb_mt);
+}
+
+MODULE_DEVICE_TABLE(usb, dwav_usb_mt_devices);
+
+static struct usb_driver dwav_usb_mt_driver = {
+ .name = "dwav_usb_mt",
+ .probe = dwav_usb_mt_probe,
+ .disconnect = dwav_usb_mt_disconnect,
+ .suspend = dwav_usb_mt_suspend,
+ .resume = dwav_usb_mt_resume,
+ .reset_resume = dwav_usb_mt_reset_resume,
+ .id_table = dwav_usb_mt_devices,
+ .supports_autosuspend = 1,
+};
+
+module_usb_driver(dwav_usb_mt_driver);
+
+MODULE_AUTHOR("Hardkernel Co.,Ltd");
+MODULE_DESCRIPTION("D-WAV USB(HID) MultiTouch Driver");
+MODULE_LICENSE("GPL");
+
+MODULE_ALIAS("dwav_usb_mt");
\ No newline at end of file
--
2.35.1

View File

@@ -0,0 +1,16 @@
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 67cd420dcf89..e445d84b6cbc 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -218,6 +218,11 @@ if [ "$ARCH" != "um" ]; then
create_package linux-libc-dev debian/linux-libc-dev
fi
+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
+cat >> $tmpdir/DEBIAN/postinst <<EOT
+mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n "Linux" -d /$installed_image_path /boot/uImage > /dev/null 2>&1
+exit 0
+EOT
create_package "$packagename" "$tmpdir"
if [ -n "$BUILD_DEBUG" ] ; then

View File

@@ -0,0 +1,40 @@
From 03bfb3f6a703d7671508b698c5a552d0a0e0197b Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Tue, 7 Jan 2020 07:12:47 +0000
Subject: [PATCH 055/101] HACK: media: cec: silence CEC timeout message
If testing with an AVR that does not pass-through CEC state the system
log fills with timeout messages. Silence this to stop the log rotation
and ensure other issues are visible.
[ 42.718009] cec-meson_ao_cec: message ff 84 50 00 01 timed out
[ 45.021994] cec-meson_ao_cec: message ff 87 00 15 82 timed out
[ 47.325965] cec-meson_ao_cec: message 10 timed out
[ 49.630023] cec-meson_ao_cec: message 10 timed out
[ 51.933960] cec-meson_ao_cec: message 10 timed out
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/cec/core/cec-adap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
index 8bf91b5a7d0e..74a33366cc26 100644
--- a/drivers/media/cec/core/cec-adap.c
+++ b/drivers/media/cec/core/cec-adap.c
@@ -501,9 +501,9 @@ int cec_thread_func(void *_adap)
* default).
*/
if (adap->transmitting) {
- pr_warn("cec-%s: message %*ph timed out\n", adap->name,
- adap->transmitting->msg.len,
- adap->transmitting->msg.msg);
+ //pr_warn("cec-%s: message %*ph timed out\n", adap->name,
+ // adap->transmitting->msg.len,
+ // adap->transmitting->msg.msg);
/* Just give up on this. */
cec_data_cancel(adap->transmitting,
CEC_TX_STATUS_TIMEOUT, 0);
--
2.17.1

View File

@@ -0,0 +1,38 @@
From 4d11a956070513a173dd9fd0d6e981918a6331e4 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Wed, 15 Sep 2021 05:00:45 +0000
Subject: [PATCH 11/90] HACK: of: partial revert of fdt.c changes
This resolves reports similar to the below which are present in dmesg
since Linux 5.10; which are also causing crashes in some distros:
[ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'secmon@5000000': base 0x0000000005000000, size 3 MiB
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/of/fdt.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ec315b060cd5..15e9c0c2a2c6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -481,15 +481,6 @@ static int __init early_init_dt_reserve_memory_arch(phys_addr_t base,
phys_addr_t size, bool nomap)
{
if (nomap) {
- /*
- * If the memory is already reserved (by another region), we
- * should not allow it to be marked nomap, but don't worry
- * if the region isn't memory as it won't be mapped.
- */
- if (memblock_overlaps_region(&memblock.memory, base, size) &&
- memblock_is_region_reserved(base, size))
- return -EBUSY;
-
return memblock_mark_nomap(base, size);
}
return memblock_reserve(base, size);
--
2.35.1

View File

@@ -0,0 +1,233 @@
From 712edc341073c350a11658186609eafd292dbe8a Mon Sep 17 00:00:00 2001
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: Sun, 3 Oct 2021 05:35:48 +0000
Subject: [PATCH 27/90] FROMLIST(v1): ASoC: meson: aiu: Fix HDMI codec control
selection
The HDMI controllers on Amlogic Meson SoCs which use the AIU
audio-controller have two different audio format inputs:
- I2S which is also the only configuration supported on GXBB, GXL and
GXM SoCs since there's no SPDIF support in the DesignWare HDMI
controller driver (at the time of writing this)
- SPDIF can be used optionally, including pass-through formats
Switching between these requires us to set different registers:
AIU_HDMI_CLK_DATA_CTRL[1:0] "HDMI_DATA_CLK_SEL":
- 0x0 disables the HDMI output clock
- 0x1 selects the PCM clock
- 0x2 selects the AIU clock
- 0x3 is reserved
AIU_HDMI_CLK_DATA_CTRL[5:4] "HDMI_DATA_SEL":
- 0x0 outputs constant zero, disables HDMI data
- 0x1 selects PCM data
- 0x2 selects AIU I2S data
- 0x3 is reserved
AIU_CLK_CTRL_MORE[6] "HDMITX_SEL_AOCLKX2":
- 0x0 selects cts_i958 as AIU clk to hdmi_tx_audio_master_clk
- 0x1 selects cts_aoclkx2_int as AIU clk to hdmi_tx_audio_master_clk
The Meson8/8b/8m2 vendor driver uses the following settings:
SPDIF output to the HDMI controller:
- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0]
- 0x0 (no HDMI data) in AIU_HDMI_CLK_DATA_CTRL[5:4]
- 0x0 (using cts_i958 as AIU clk) in AIU_CLK_CTRL_MORE[6]
I2S output to the HDMI controller:
- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0]
- 0x2 (I2S data) in AIU_HDMI_CLK_DATA_CTRL[5:4]
- 0x0 (using cts_aoclkx2_int as AIU clk) in AIU_CLK_CTRL_MORE[6]
The GXBB/GXL/GXM vendor driver uses the following settings:
SPDIF output to the HDMI controller:
- not setting AIU_HDMI_CLK_DATA_CTRL at all
- 0x0 (using cts_i958 as AIU clk) in AIU_CLK_CTRL_MORE[6]
I2S output to the HDMI controller:
- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0]
- 0x2 (I2S data) in AIU_HDMI_CLK_DATA_CTRL[5:4]
- 0x0 (using cts_aoclkx2_int as AIU clk) in AIU_CLK_CTRL_MORE[6]
Set the three registers at the same time following what the vendor
driver does on Meson8/8b/8m2 SoCs. This makes the SPDIF output to the
HDMI controller work. The entries and order of the entries in the enum
is not changed on purpose to not break old configurations.
Fixes: b82b734c0e9a7 ("ASoC: meson: aiu: add hdmi codec control support")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
sound/soc/meson/aiu-codec-ctrl.c | 108 ++++++++++++++++++++++--------
sound/soc/meson/aiu-encoder-i2s.c | 6 --
2 files changed, 80 insertions(+), 34 deletions(-)
diff --git a/sound/soc/meson/aiu-codec-ctrl.c b/sound/soc/meson/aiu-codec-ctrl.c
index c3ea733fce91..2b8575491aeb 100644
--- a/sound/soc/meson/aiu-codec-ctrl.c
+++ b/sound/soc/meson/aiu-codec-ctrl.c
@@ -12,14 +12,60 @@
#include "aiu.h"
#include "meson-codec-glue.h"
-#define CTRL_CLK_SEL GENMASK(1, 0)
-#define CTRL_DATA_SEL_SHIFT 4
-#define CTRL_DATA_SEL (0x3 << CTRL_DATA_SEL_SHIFT)
-
-static const char * const aiu_codec_ctrl_mux_texts[] = {
- "DISABLED", "PCM", "I2S",
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL GENMASK(1, 0)
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_DISABLE 0x0
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_PCM 0x1
+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU 0x2
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL GENMASK(5, 4)
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO 0x0
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_PCM_DATA 0x1
+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA 0x2
+
+#define AIU_CLK_CTRL_MORE_AMCLK BIT(6)
+
+#define AIU_HDMI_CTRL_MUX_DISABLED 0
+#define AIU_HDMI_CTRL_MUX_PCM 1
+#define AIU_HDMI_CTRL_MUX_I2S 2
+
+static const char * const aiu_codec_hdmi_ctrl_mux_texts[] = {
+ [AIU_HDMI_CTRL_MUX_DISABLED] = "DISABLED",
+ [AIU_HDMI_CTRL_MUX_PCM] = "PCM",
+ [AIU_HDMI_CTRL_MUX_I2S] = "I2S",
};
+static int aiu_codec_ctrl_mux_get_enum(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_kcontrol_component(kcontrol);
+ unsigned int ctrl, more, mux = AIU_HDMI_CTRL_MUX_DISABLED;
+
+ ctrl = snd_soc_component_read(component, AIU_HDMI_CLK_DATA_CTRL);
+ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL, ctrl) !=
+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU) {
+ goto out;
+ }
+
+ more = snd_soc_component_read(component, AIU_CLK_CTRL_MORE);
+ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ctrl) ==
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA &&
+ !!(more & AIU_CLK_CTRL_MORE_AMCLK)) {
+ mux = AIU_HDMI_CTRL_MUX_I2S;
+ goto out;
+ }
+
+ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ctrl) ==
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO &&
+ !(more & AIU_CLK_CTRL_MORE_AMCLK)) {
+ mux = AIU_HDMI_CTRL_MUX_PCM;
+ goto out;
+ }
+
+out:
+ ucontrol->value.enumerated.item[0] = mux;
+ return 0;
+}
+
static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -28,45 +74,51 @@ static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,
struct snd_soc_dapm_context *dapm =
snd_soc_dapm_kcontrol_dapm(kcontrol);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
- unsigned int mux, changed;
+ unsigned int mux, ctrl, more;
mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]);
- changed = snd_soc_component_test_bits(component, e->reg,
- CTRL_DATA_SEL,
- FIELD_PREP(CTRL_DATA_SEL, mux));
- if (!changed)
- return 0;
+ if (mux == AIU_HDMI_CTRL_MUX_I2S) {
+ ctrl = FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL,
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA);
+ more = AIU_CLK_CTRL_MORE_AMCLK;
+ } else {
+ ctrl = FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL,
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO);
+ more = 0;
+ }
+
+ if (mux == AIU_HDMI_CTRL_MUX_DISABLED) {
+ ctrl |= FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL,
+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_DISABLE);
+ } else {
+ ctrl |= FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL,
+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU);
+ }
/* Force disconnect of the mux while updating */
snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL);
- /* Reset the source first */
- snd_soc_component_update_bits(component, e->reg,
- CTRL_CLK_SEL |
- CTRL_DATA_SEL,
- FIELD_PREP(CTRL_CLK_SEL, 0) |
- FIELD_PREP(CTRL_DATA_SEL, 0));
+ snd_soc_component_update_bits(component, AIU_HDMI_CLK_DATA_CTRL,
+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL |
+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL,
+ ctrl);
- /* Set the appropriate source */
- snd_soc_component_update_bits(component, e->reg,
- CTRL_CLK_SEL |
- CTRL_DATA_SEL,
- FIELD_PREP(CTRL_CLK_SEL, mux) |
- FIELD_PREP(CTRL_DATA_SEL, mux));
+ snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE,
+ AIU_CLK_CTRL_MORE_AMCLK,
+ more);
snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
return 1;
}
-static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL,
- CTRL_DATA_SEL_SHIFT,
- aiu_codec_ctrl_mux_texts);
+static SOC_ENUM_SINGLE_VIRT_DECL(aiu_hdmi_ctrl_mux_enum,
+ aiu_codec_hdmi_ctrl_mux_texts);
static const struct snd_kcontrol_new aiu_hdmi_ctrl_mux =
SOC_DAPM_ENUM_EXT("HDMI Source", aiu_hdmi_ctrl_mux_enum,
- snd_soc_dapm_get_enum_double,
+ aiu_codec_ctrl_mux_get_enum,
aiu_codec_ctrl_mux_put_enum);
static const struct snd_soc_dapm_widget aiu_hdmi_ctrl_widgets[] = {
diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c
index 67729de41a73..88637deb2d7a 100644
--- a/sound/soc/meson/aiu-encoder-i2s.c
+++ b/sound/soc/meson/aiu-encoder-i2s.c
@@ -23,7 +23,6 @@
#define AIU_CLK_CTRL_AOCLK_INVERT BIT(6)
#define AIU_CLK_CTRL_LRCLK_INVERT BIT(7)
#define AIU_CLK_CTRL_LRCLK_SKEW GENMASK(9, 8)
-#define AIU_CLK_CTRL_MORE_HDMI_AMCLK BIT(6)
#define AIU_CLK_CTRL_MORE_I2S_DIV GENMASK(5, 0)
#define AIU_CODEC_DAC_LRCLK_CTRL_DIV GENMASK(11, 0)
@@ -176,11 +175,6 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component,
if (ret)
return ret;
- /* Make sure amclk is used for HDMI i2s as well */
- snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE,
- AIU_CLK_CTRL_MORE_HDMI_AMCLK,
- AIU_CLK_CTRL_MORE_HDMI_AMCLK);
-
return 0;
}
--
2.35.1

View File

@@ -0,0 +1,35 @@
From b83c8168c58ccb96f92a4b6ecf1b8b7483fcced3 Mon Sep 17 00:00:00 2001
From: Sergey Shtylyov <s.shtylyov@omp.ru>
Date: Fri, 24 Dec 2021 06:09:57 +0000
Subject: [PATCH 38/90] FROMLIST(v1): mmc: meson-gx: fix deferred probing
The driver overrides the error codes and IRQ0 returned by platform_get_irq()
to -EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the error
codes upstream. IRQ0 is no longer returned by platform_get_irq(), so we now
can safely ignore it...
Fixes: cbcaac6d7dd2 ("mmc: meson-gx-mmc: Fix platform_get_irq's error checking")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/mmc/host/meson-gx-mmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 58ab9d90bc8b..1a11a4bf4d4f 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1183,8 +1183,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
}
host->irq = platform_get_irq(pdev, 0);
- if (host->irq <= 0) {
- ret = -EINVAL;
+ if (host->irq < 0) {
+ ret = host->irq;
goto free_host;
}
--
2.35.1

View File

@@ -0,0 +1,59 @@
From 5c5664545a97520bbce591add5a7dbbea143b999 Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Thu, 14 Jan 2021 17:43:02 +0100
Subject: [PATCH 54/90] WIP: mmc: meson-gx-mmc: set core clock phase to 270
degrees for AXG compatible controllers
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/mmc/host/meson-gx-mmc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 1a11a4bf4d4f..df60312a1765 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -38,6 +38,7 @@
#define CLK_RX_PHASE_MASK GENMASK(13, 12)
#define CLK_PHASE_0 0
#define CLK_PHASE_180 2
+#define CLK_PHASE_270 3
#define CLK_V2_TX_DELAY_MASK GENMASK(19, 16)
#define CLK_V2_RX_DELAY_MASK GENMASK(23, 20)
#define CLK_V2_ALWAYS_ON BIT(24)
@@ -136,6 +137,7 @@ struct meson_mmc_data {
unsigned int rx_delay_mask;
unsigned int always_on;
unsigned int adjust;
+ unsigned int clk_core_phase;
};
struct sd_emmc_desc {
@@ -428,7 +430,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
/* init SD_EMMC_CLOCK to sane defaults w/min clock rate */
clk_reg = CLK_ALWAYS_ON(host);
clk_reg |= CLK_DIV_MASK;
- clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);
+ clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, host->data->clk_core_phase);
clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);
clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
writel(clk_reg, host->regs + SD_EMMC_CLOCK);
@@ -1337,6 +1339,7 @@ static const struct meson_mmc_data meson_gx_data = {
.rx_delay_mask = CLK_V2_RX_DELAY_MASK,
.always_on = CLK_V2_ALWAYS_ON,
.adjust = SD_EMMC_ADJUST,
+ .clk_core_phase = CLK_PHASE_180,
};
static const struct meson_mmc_data meson_axg_data = {
@@ -1344,6 +1347,7 @@ static const struct meson_mmc_data meson_axg_data = {
.rx_delay_mask = CLK_V3_RX_DELAY_MASK,
.always_on = CLK_V3_ALWAYS_ON,
.adjust = SD_EMMC_V3_ADJUST,
+ .clk_core_phase = CLK_PHASE_270,
};
static const struct of_device_id meson_mmc_of_match[] = {
--
2.35.1

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,157 @@
From a9f750c672c4c1238cccd1d8d76a138a5602d035 Mon Sep 17 00:00:00 2001
From: benjamin545 <benjamin545@gmail.com>
Date: Mon, 2 Aug 2021 15:18:40 -0400
Subject: [PATCH 65/90] WIP: drivers: meson: vdec: add handling to HEVC decoder
to show frames when ready
..rather than when no longer referenced
the HEVC decode driver would not show the next frame until it was no longer referenced,
this would cause a backup of frames that were ready to render but held up by one or more
frames that were still referenced. The decoded picture buffer would fill up and stall
playback as no new frames could be placed in the decoded picture buffer.
---
drivers/staging/media/meson/vdec/codec_hevc.c | 52 ++++++++++++-------
1 file changed, 34 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c
index 3a6fd04a2d33..01218efde99b 100644
--- a/drivers/staging/media/meson/vdec/codec_hevc.c
+++ b/drivers/staging/media/meson/vdec/codec_hevc.c
@@ -223,6 +223,7 @@ struct hevc_frame {
u32 poc;
int referenced;
+ int show;
u32 num_reorder_pic;
u32 cur_slice_idx;
@@ -448,9 +449,11 @@ static void codec_hevc_update_referenced(struct codec_hevc *hevc)
((1 << (RPS_USED_BIT - 1)) - 1);
if (param->p.CUR_RPS[i] & (1 << (RPS_USED_BIT - 1))) {
poc_tmp = curr_poc -
- ((1 << (RPS_USED_BIT - 1)) - delt);
- } else
+ ((1 << (RPS_USED_BIT - 1)) - delt);
+ } else {
poc_tmp = curr_poc + delt;
+ }
+
if (poc_tmp == frame->poc) {
is_referenced = 1;
break;
@@ -462,13 +465,13 @@ static void codec_hevc_update_referenced(struct codec_hevc *hevc)
}
static struct hevc_frame *
-codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc)
+codec_hevc_get_next_ready_frame(struct codec_hevc *hevc)
{
struct hevc_frame *tmp, *ret = NULL;
u32 poc = INT_MAX;
list_for_each_entry(tmp, &hevc->ref_frames_list, list) {
- if (tmp->poc < poc) {
+ if ((tmp->poc < poc) && tmp->show) {
ret = tmp;
poc = tmp->poc;
}
@@ -478,28 +481,35 @@ codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc)
}
/* Try to output as many frames as possible */
-static void codec_hevc_output_frames(struct amvdec_session *sess)
+static void codec_hevc_show_frames(struct amvdec_session *sess)
{
- struct hevc_frame *tmp;
+ struct hevc_frame *tmp, *n;
struct codec_hevc *hevc = sess->priv;
- while ((tmp = codec_hevc_get_lowest_poc_frame(hevc))) {
+ while ((tmp = codec_hevc_get_next_ready_frame(hevc))) {
if (hevc->curr_poc &&
- (tmp->referenced ||
- tmp->num_reorder_pic >= hevc->frames_num))
+ (hevc->frames_num <= tmp->num_reorder_pic))
break;
dev_dbg(sess->core->dev, "DONE frame poc %u; vbuf %u\n",
tmp->poc, tmp->vbuf->vb2_buf.index);
amvdec_dst_buf_done_offset(sess, tmp->vbuf, tmp->offset,
V4L2_FIELD_NONE, false);
+
+ tmp->show = 0;
+ hevc->frames_num--;
+ }
+
+ /* clean output frame buffer */
+ list_for_each_entry_safe(tmp, n, &hevc->ref_frames_list, list) {
+ if (tmp->referenced || tmp->show)
+ continue;
+
list_del(&tmp->list);
kfree(tmp);
- hevc->frames_num--;
}
}
-
static int
codec_hevc_setup_workspace(struct amvdec_session *sess,
struct codec_hevc *hevc)
@@ -650,14 +660,17 @@ static int codec_hevc_start(struct amvdec_session *sess)
static void codec_hevc_flush_output(struct amvdec_session *sess)
{
struct codec_hevc *hevc = sess->priv;
- struct hevc_frame *tmp;
+ struct hevc_frame *tmp, *n;
- while (!list_empty(&hevc->ref_frames_list)) {
- tmp = codec_hevc_get_lowest_poc_frame(hevc);
+ while ((tmp = codec_hevc_get_next_ready_frame(hevc))) {
amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE);
+ tmp->show = 0;
+ hevc->frames_num--;
+ }
+
+ list_for_each_entry_safe(tmp, n, &hevc->ref_frames_list, list) {
list_del(&tmp->list);
kfree(tmp);
- hevc->frames_num--;
}
}
@@ -719,6 +732,7 @@ codec_hevc_prepare_new_frame(struct amvdec_session *sess)
new_frame->vbuf = vbuf;
new_frame->referenced = 1;
+ new_frame->show = 1;
new_frame->poc = hevc->curr_poc;
new_frame->cur_slice_type = params->p.slice_type;
new_frame->num_reorder_pic = params->p.sps_num_reorder_pics_0;
@@ -1267,7 +1281,7 @@ static int codec_hevc_process_segment(struct amvdec_session *sess)
/* First slice: new frame */
if (slice_segment_address == 0) {
codec_hevc_update_referenced(hevc);
- codec_hevc_output_frames(sess);
+ codec_hevc_show_frames(sess);
hevc->cur_frame = codec_hevc_prepare_new_frame(sess);
if (!hevc->cur_frame)
@@ -1370,9 +1384,11 @@ static void codec_hevc_fetch_rpm(struct amvdec_session *sess)
u16 *rpm_vaddr = hevc->workspace_vaddr + RPM_OFFSET;
int i, j;
- for (i = 0; i < RPM_SIZE; i += 4)
+ for (i = 0; i < RPM_SIZE; i += 4) {
for (j = 0; j < 4; j++)
- hevc->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j];
+ hevc->rpm_param.l.data[i + j] =
+ rpm_vaddr[i + 3 - j];
+ }
}
static void codec_hevc_resume(struct amvdec_session *sess)
--
2.35.1

View File

@@ -0,0 +1,51 @@
From cb0c20e84a934c66961ace27f340cd7c98188dbe Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Mon, 22 Nov 2021 09:15:21 +0000
Subject: [PATCH 67/90] WIP: drivers: meson: vdec: check if parser has really
parser before marking input buffer as error
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/staging/media/meson/vdec/esparser.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c
index 9b6034936d32..bb9480f0a70c 100644
--- a/drivers/staging/media/meson/vdec/esparser.c
+++ b/drivers/staging/media/meson/vdec/esparser.c
@@ -300,6 +300,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
u32 num_dst_bufs = 0;
u32 offset;
u32 pad_size;
+ u32 wp, wp2;
/*
* When max ref frame is held by VP9, this should be -= 3 to prevent a
@@ -349,15 +350,20 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
}
pad_size = esparser_pad_start_code(core, vb, payload_size);
+ wp = amvdec_read_parser(core, PARSER_VIDEO_WP);
ret = esparser_write_data(core, phy, payload_size + pad_size);
+ wp2 = amvdec_read_parser(core, PARSER_VIDEO_WP);
if (ret <= 0) {
- dev_warn(core->dev, "esparser: input parsing error\n");
- amvdec_remove_ts(sess, vb->timestamp);
- v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
amvdec_write_parser(core, PARSER_FETCH_CMD, 0);
- return 0;
+ if (ret < 0 || wp2 == wp) {
+ dev_err(core->dev, "esparser: input parsing error ret %d (%x <=> %x)\n", ret, wp, wp2);
+ amvdec_remove_ts(sess, vb->timestamp);
+ v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
+
+ return 0;
+ }
}
atomic_inc(&sess->esparser_queued_bufs);
--
2.35.1

View File

@@ -0,0 +1,586 @@
From df7d1adad3f60c8cb3f33235b6301093801b7b47 Mon Sep 17 00:00:00 2001
From: benjamin545 <benjamin545@gmail.com>
Date: Thu, 15 Jul 2021 16:32:39 -0400
Subject: [PATCH 63/90] WIP: drivers: meson: vdec: improve mmu and fbc handling
and add 10 bit handling
---
drivers/staging/media/meson/vdec/codec_h264.c | 3 +-
.../media/meson/vdec/codec_hevc_common.c | 164 +++++++++++-------
.../media/meson/vdec/codec_hevc_common.h | 3 +-
drivers/staging/media/meson/vdec/codec_vp9.c | 36 ++--
drivers/staging/media/meson/vdec/esparser.c | 1 +
drivers/staging/media/meson/vdec/vdec.h | 1 +
.../staging/media/meson/vdec/vdec_helpers.c | 46 +++--
.../staging/media/meson/vdec/vdec_helpers.h | 10 +-
8 files changed, 163 insertions(+), 101 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c
index c61128fc4bb9..d53c9a464bde 100644
--- a/drivers/staging/media/meson/vdec/codec_h264.c
+++ b/drivers/staging/media/meson/vdec/codec_h264.c
@@ -353,7 +353,8 @@ static void codec_h264_src_change(struct amvdec_session *sess)
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);
+ amvdec_src_change(sess, frame_width, frame_height,
+ h264->max_refs + 5, 8);
}
/*
diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c
index 0315cc0911cd..d6ed82dc93ca 100644
--- a/drivers/staging/media/meson/vdec/codec_hevc_common.c
+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c
@@ -30,8 +30,11 @@ const u16 vdec_hevc_parser_cmd[] = {
void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit)
{
struct amvdec_core *core = sess->core;
- u32 body_size = amvdec_am21c_body_size(sess->width, sess->height);
- u32 head_size = amvdec_am21c_head_size(sess->width, sess->height);
+ u32 use_mmu = codec_hevc_use_mmu(core->platform->revision,
+ sess->pixfmt_cap, is_10bit);
+ u32 body_size = amvdec_amfbc_body_size(sess->width, sess->height,
+ is_10bit, use_mmu);
+ u32 head_size = amvdec_amfbc_head_size(sess->width, sess->height);
if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) {
/* Enable 2-plane reference read mode */
@@ -39,9 +42,17 @@ void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit)
return;
}
+ /* enable mem saving mode for 8-bit */
+ if (!is_10bit)
+ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(9));
+ else
+ amvdec_clear_dos_bits(core, HEVC_SAO_CTRL5, BIT(9));
+
if (codec_hevc_use_mmu(core->platform->revision,
sess->pixfmt_cap, is_10bit))
amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(4));
+ else if (!is_10bit)
+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(3));
else
amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0);
@@ -73,7 +84,7 @@ static void codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess,
idx = vb->index;
- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit))
+ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit))
buf_y_paddr = comm->fbc_buffer_paddr[idx];
else
buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0);
@@ -114,8 +125,8 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess,
{
struct amvdec_core *core = sess->core;
struct v4l2_m2m_buffer *buf;
- u32 revision = core->platform->revision;
u32 pixfmt_cap = sess->pixfmt_cap;
+ const u32 revision = core->platform->revision;
int i;
amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR,
@@ -127,12 +138,14 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess,
dma_addr_t buf_uv_paddr = 0;
u32 idx = vb->index;
- if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit))
- buf_y_paddr = comm->mmu_header_paddr[idx];
- else if (codec_hevc_use_downsample(pixfmt_cap, is_10bit))
- buf_y_paddr = comm->fbc_buffer_paddr[idx];
- else
- buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0);
+ if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) {
+ if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit))
+ buf_y_paddr = comm->mmu_header_paddr[idx];
+ else
+ buf_y_paddr = comm->fbc_buffer_paddr[idx];
+ } else {
+ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0);
+ }
amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA,
buf_y_paddr >> 5);
@@ -150,60 +163,67 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess,
amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0);
}
-void codec_hevc_free_fbc_buffers(struct amvdec_session *sess,
+void codec_hevc_free_mmu_headers(struct amvdec_session *sess,
struct codec_hevc_common *comm)
{
struct device *dev = sess->core->dev;
- u32 am21_size = amvdec_am21c_size(sess->width, sess->height);
int i;
for (i = 0; i < MAX_REF_PIC_NUM; ++i) {
- if (comm->fbc_buffer_vaddr[i]) {
- dma_free_coherent(dev, am21_size,
- comm->fbc_buffer_vaddr[i],
- comm->fbc_buffer_paddr[i]);
- comm->fbc_buffer_vaddr[i] = NULL;
+ if (comm->mmu_header_vaddr[i]) {
+ dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE,
+ comm->mmu_header_vaddr[i],
+ comm->mmu_header_paddr[i]);
+ comm->mmu_header_vaddr[i] = NULL;
}
}
}
-EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers);
+EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers);
-static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess,
+static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess,
struct codec_hevc_common *comm)
{
struct device *dev = sess->core->dev;
struct v4l2_m2m_buffer *buf;
- u32 am21_size = amvdec_am21c_size(sess->width, sess->height);
v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) {
u32 idx = buf->vb.vb2_buf.index;
dma_addr_t paddr;
- void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr,
- GFP_KERNEL);
+ void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE,
+ &paddr, GFP_KERNEL);
if (!vaddr) {
- codec_hevc_free_fbc_buffers(sess, comm);
+ codec_hevc_free_mmu_headers(sess, comm);
return -ENOMEM;
}
- comm->fbc_buffer_vaddr[idx] = vaddr;
- comm->fbc_buffer_paddr[idx] = paddr;
+ comm->mmu_header_vaddr[idx] = vaddr;
+ comm->mmu_header_paddr[idx] = paddr;
}
return 0;
}
-void codec_hevc_free_mmu_headers(struct amvdec_session *sess,
+void codec_hevc_free_fbc_buffers(struct amvdec_session *sess,
struct codec_hevc_common *comm)
{
struct device *dev = sess->core->dev;
+ u32 use_mmu;
+ u32 am21_size;
int i;
+ use_mmu = codec_hevc_use_mmu(sess->core->platform->revision,
+ sess->pixfmt_cap,
+ sess->bitdepth == 10 ? 1 : 0);
+
+ am21_size = amvdec_amfbc_size(sess->width, sess->height,
+ sess->bitdepth == 10 ? 1 : 0, use_mmu);
+
for (i = 0; i < MAX_REF_PIC_NUM; ++i) {
- if (comm->mmu_header_vaddr[i]) {
- dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE,
- comm->mmu_header_vaddr[i],
- comm->mmu_header_paddr[i]);
- comm->mmu_header_vaddr[i] = NULL;
+ if (comm->fbc_buffer_vaddr[i]) {
+ dma_free_coherent(dev, am21_size,
+ comm->fbc_buffer_vaddr[i],
+ comm->fbc_buffer_paddr[i]);
+ comm->fbc_buffer_vaddr[i] = NULL;
}
}
@@ -213,33 +233,49 @@ void codec_hevc_free_mmu_headers(struct amvdec_session *sess,
comm->mmu_map_paddr);
comm->mmu_map_vaddr = NULL;
}
+
+ codec_hevc_free_mmu_headers(sess, comm);
}
-EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers);
+EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers);
-static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess,
+static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess,
struct codec_hevc_common *comm)
{
struct device *dev = sess->core->dev;
struct v4l2_m2m_buffer *buf;
+ u32 use_mmu;
+ u32 am21_size;
+ const u32 revision = sess->core->platform->revision;
+ const u32 is_10bit = sess->bitdepth == 10 ? 1 : 0;
+ int ret;
- comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE,
- &comm->mmu_map_paddr,
- GFP_KERNEL);
- if (!comm->mmu_map_vaddr)
- return -ENOMEM;
+ use_mmu = codec_hevc_use_mmu(revision, sess->pixfmt_cap,
+ is_10bit);
+
+ am21_size = amvdec_amfbc_size(sess->width, sess->height,
+ is_10bit, use_mmu);
v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) {
u32 idx = buf->vb.vb2_buf.index;
dma_addr_t paddr;
- void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE,
- &paddr, GFP_KERNEL);
+ void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr,
+ GFP_KERNEL);
if (!vaddr) {
- codec_hevc_free_mmu_headers(sess, comm);
+ codec_hevc_free_fbc_buffers(sess, comm);
return -ENOMEM;
}
- comm->mmu_header_vaddr[idx] = vaddr;
- comm->mmu_header_paddr[idx] = paddr;
+ comm->fbc_buffer_vaddr[idx] = vaddr;
+ comm->fbc_buffer_paddr[idx] = paddr;
+ }
+
+ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, is_10bit) &&
+ codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) {
+ ret = codec_hevc_alloc_mmu_headers(sess, comm);
+ if (ret) {
+ codec_hevc_free_fbc_buffers(sess, comm);
+ return ret;
+ }
}
return 0;
@@ -250,21 +286,24 @@ int codec_hevc_setup_buffers(struct amvdec_session *sess,
int is_10bit)
{
struct amvdec_core *core = sess->core;
+ struct device *dev = core->dev;
int ret;
- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) {
- ret = codec_hevc_alloc_fbc_buffers(sess, comm);
- if (ret)
- return ret;
+ if (codec_hevc_use_mmu(core->platform->revision,
+ sess->pixfmt_cap, is_10bit)) {
+ comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE,
+ &comm->mmu_map_paddr,
+ GFP_KERNEL);
+ if (!comm->mmu_map_vaddr)
+ return -ENOMEM;
}
if (codec_hevc_use_mmu(core->platform->revision,
- sess->pixfmt_cap, is_10bit)) {
- ret = codec_hevc_alloc_mmu_headers(sess, comm);
- if (ret) {
- codec_hevc_free_fbc_buffers(sess, comm);
- return ret;
- }
+ sess->pixfmt_cap, is_10bit) ||
+ codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) {
+ ret = codec_hevc_alloc_fbc_buffers(sess, comm);
+ if (ret)
+ return ret;
}
if (core->platform->revision == VDEC_REVISION_GXBB)
@@ -278,19 +317,24 @@ EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers);
void codec_hevc_fill_mmu_map(struct amvdec_session *sess,
struct codec_hevc_common *comm,
- struct vb2_buffer *vb)
+ struct vb2_buffer *vb,
+ u32 is_10bit)
{
- u32 size = amvdec_am21c_size(sess->width, sess->height);
- u32 nb_pages = size / PAGE_SIZE;
+ u32 use_mmu;
+ u32 size;
+ u32 nb_pages;
u32 *mmu_map = comm->mmu_map_vaddr;
u32 first_page;
u32 i;
- if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M)
- first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT;
- else
- first_page = vb2_dma_contig_plane_dma_addr(vb, 0) >> PAGE_SHIFT;
+ use_mmu = codec_hevc_use_mmu(sess->core->platform->revision,
+ sess->pixfmt_cap, is_10bit);
+
+ size = amvdec_amfbc_size(sess->width, sess->height, is_10bit,
+ use_mmu);
+ nb_pages = size / PAGE_SIZE;
+ first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT;
for (i = 0; i < nb_pages; ++i)
mmu_map[i] = first_page + i;
}
diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h
index cf072b8a9da2..13f9f1d90a94 100644
--- a/drivers/staging/media/meson/vdec/codec_hevc_common.h
+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h
@@ -64,6 +64,7 @@ int codec_hevc_setup_buffers(struct amvdec_session *sess,
void codec_hevc_fill_mmu_map(struct amvdec_session *sess,
struct codec_hevc_common *comm,
- struct vb2_buffer *vb);
+ struct vb2_buffer *vb,
+ u32 is_10bit);
#endif
diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c
index 897f5d7a6aad..bfc312ec2a56 100644
--- a/drivers/staging/media/meson/vdec/codec_vp9.c
+++ b/drivers/staging/media/meson/vdec/codec_vp9.c
@@ -458,12 +458,6 @@ struct codec_vp9 {
struct list_head ref_frames_list;
u32 frames_num;
- /* In case of downsampling (decoding with FBC but outputting in NV12M),
- * we need to allocate additional buffers for FBC.
- */
- void *fbc_buffer_vaddr[MAX_REF_PIC_NUM];
- dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM];
-
int ref_frame_map[REF_FRAMES];
int next_ref_frame_map[REF_FRAMES];
struct vp9_frame *frame_refs[REFS_PER_FRAME];
@@ -901,11 +895,8 @@ static void codec_vp9_set_sao(struct amvdec_session *sess,
buf_y_paddr =
vb2_dma_contig_plane_dma_addr(vb, 0);
- if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) {
- val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200;
- amvdec_write_dos(core, HEVC_SAO_CTRL5, val);
- amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr);
- }
+ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit))
+ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr);
if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) {
buf_y_paddr =
@@ -920,8 +911,12 @@ static void codec_vp9_set_sao(struct amvdec_session *sess,
if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap,
vp9->is_10bit)) {
- amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR,
- vp9->common.mmu_header_paddr[vb->index]);
+ dma_addr_t header_adr;
+ if (codec_hevc_use_downsample(sess->pixfmt_cap, vp9->is_10bit))
+ header_adr = vp9->common.mmu_header_paddr[vb->index];
+ else
+ header_adr = vb2_dma_contig_plane_dma_addr(vb, 0);
+ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, header_adr);
/* use HEVC_CM_HEADER_START_ADDR */
amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10));
}
@@ -1148,9 +1143,13 @@ static void codec_vp9_set_mc(struct amvdec_session *sess,
{
struct amvdec_core *core = sess->core;
u32 scale = 0;
+ u32 use_mmu;
u32 sz;
int i;
+ use_mmu = codec_hevc_use_mmu(core->platform->revision,
+ sess->pixfmt_cap, vp9->is_10bit);
+
amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1);
codec_vp9_set_refs(sess, vp9);
amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR,
@@ -1166,8 +1165,9 @@ static void codec_vp9_set_mc(struct amvdec_session *sess,
vp9->frame_refs[i]->height != vp9->height)
scale = 1;
- sz = amvdec_am21c_body_size(vp9->frame_refs[i]->width,
- vp9->frame_refs[i]->height);
+ sz = amvdec_amfbc_body_size(vp9->frame_refs[i]->width,
+ vp9->frame_refs[i]->height,
+ vp9->is_10bit, use_mmu);
amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA,
vp9->frame_refs[i]->width);
@@ -1283,7 +1283,8 @@ static void codec_vp9_process_frame(struct amvdec_session *sess)
if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap,
vp9->is_10bit))
codec_hevc_fill_mmu_map(sess, &vp9->common,
- &vp9->cur_frame->vbuf->vb2_buf);
+ &vp9->cur_frame->vbuf->vb2_buf,
+ vp9->is_10bit);
intra_only = param->p.show_frame ? 0 : param->p.intra_only;
@@ -2132,7 +2133,8 @@ static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess)
codec_vp9_fetch_rpm(sess);
if (codec_vp9_process_rpm(vp9)) {
- amvdec_src_change(sess, vp9->width, vp9->height, 16);
+ amvdec_src_change(sess, vp9->width, vp9->height, 16,
+ vp9->is_10bit ? 10 : 8);
/* No frame is actually processed */
vp9->cur_frame = NULL;
diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c
index e18334e57fc0..610a92b9f6f2 100644
--- a/drivers/staging/media/meson/vdec/esparser.c
+++ b/drivers/staging/media/meson/vdec/esparser.c
@@ -319,6 +319,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
if (esparser_vififo_get_free_space(sess) < payload_size ||
atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs)
return -EAGAIN;
+
} else if (esparser_vififo_get_free_space(sess) < payload_size) {
return -EAGAIN;
}
diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h
index 0906b8fb5cc6..a48170fe4cff 100644
--- a/drivers/staging/media/meson/vdec/vdec.h
+++ b/drivers/staging/media/meson/vdec/vdec.h
@@ -244,6 +244,7 @@ struct amvdec_session {
u32 width;
u32 height;
u32 colorspace;
+ u32 bitdepth;
u8 ycbcr_enc;
u8 quantization;
u8 xfer_func;
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c
index 203d7afa085d..23a69c51c634 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.c
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.c
@@ -50,32 +50,40 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val)
}
EXPORT_SYMBOL_GPL(amvdec_write_parser);
-/* 4 KiB per 64x32 block */
-u32 amvdec_am21c_body_size(u32 width, u32 height)
+/* AMFBC body is made out of 64x32 blocks with varying block size */
+u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu)
{
u32 width_64 = ALIGN(width, 64) / 64;
u32 height_32 = ALIGN(height, 32) / 32;
+ u32 blk_size = 4096;
- return SZ_4K * width_64 * height_32;
+ if (!is_10bit) {
+ if (use_mmu)
+ blk_size = 3200;
+ else
+ blk_size = 3072;
+ }
+
+ return blk_size * width_64 * height_32;
}
-EXPORT_SYMBOL_GPL(amvdec_am21c_body_size);
+EXPORT_SYMBOL_GPL(amvdec_amfbc_body_size);
/* 32 bytes per 128x64 block */
-u32 amvdec_am21c_head_size(u32 width, u32 height)
+u32 amvdec_amfbc_head_size(u32 width, u32 height)
{
u32 width_128 = ALIGN(width, 128) / 128;
u32 height_64 = ALIGN(height, 64) / 64;
return 32 * width_128 * height_64;
}
-EXPORT_SYMBOL_GPL(amvdec_am21c_head_size);
+EXPORT_SYMBOL_GPL(amvdec_amfbc_head_size);
-u32 amvdec_am21c_size(u32 width, u32 height)
+u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu)
{
- return ALIGN(amvdec_am21c_body_size(width, height) +
- amvdec_am21c_head_size(width, height), SZ_64K);
+ return ALIGN(amvdec_amfbc_body_size(width, height, is_10bit, use_mmu) +
+ amvdec_amfbc_head_size(width, height), SZ_64K);
}
-EXPORT_SYMBOL_GPL(amvdec_am21c_size);
+EXPORT_SYMBOL_GPL(amvdec_amfbc_size);
static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id)
{
@@ -436,7 +444,7 @@ 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)
+ u32 height, u32 dpb_size, u32 bitdepth)
{
static const struct v4l2_event ev = {
.type = V4L2_EVENT_SOURCE_CHANGE,
@@ -444,25 +452,27 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width,
v4l2_ctrl_s_ctrl(sess->ctrl_min_buf_capture, dpb_size);
+ sess->bitdepth = bitdepth;
+
/*
* Check if the capture queue is already configured well for our
- * usecase. If so, keep decoding with it and do not send the event
+ * usecase. If so, keep decoding with it.
*/
if (sess->streamon_cap &&
sess->width == width &&
sess->height == height &&
dpb_size <= sess->num_dst_bufs) {
sess->fmt_out->codec_ops->resume(sess);
- return;
- }
+ } else {
+ sess->status = STATUS_NEEDS_RESUME;
+ sess->changed_format = 0;
+ }
- sess->changed_format = 0;
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);
+ dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB %u, bitdepth %u\n",
+ width, height, dpb_size, bitdepth);
v4l2_event_queue_fh(&sess->fh, &ev);
}
EXPORT_SYMBOL_GPL(amvdec_src_change);
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h
index 88137d15aa3a..fca4251f7599 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.h
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.h
@@ -27,9 +27,10 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val);
u32 amvdec_read_parser(struct amvdec_core *core, u32 reg);
void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val);
-u32 amvdec_am21c_body_size(u32 width, u32 height);
-u32 amvdec_am21c_head_size(u32 width, u32 height);
-u32 amvdec_am21c_size(u32 width, u32 height);
+/* Helpers for the Amlogic compressed framebuffer format */
+u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu);
+u32 amvdec_amfbc_head_size(u32 width, u32 height);
+u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu);
/**
* amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding
@@ -77,9 +78,10 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess,
* @width: picture width detected by the hardware
* @height: picture height detected by the hardware
* @dpb_size: Decoded Picture Buffer size (= amount of buffers for decoding)
+ * @bitdepth: Bit depth (usually 10 or 8) of the coded content
*/
void amvdec_src_change(struct amvdec_session *sess, u32 width,
- u32 height, u32 dpb_size);
+ u32 height, u32 dpb_size, u32 bitdepth);
/**
* amvdec_abort() - Abort the current decoding session
--
2.35.1

View File

@@ -0,0 +1,29 @@
From 4aca1a59251338a9f98b58fc67e7749fae32b3be Mon Sep 17 00:00:00 2001
From: benjamin545 <benjamin545@gmail.com>
Date: Thu, 15 Jul 2021 14:32:33 -0400
Subject: [PATCH 62/90] WIP: drivers: meson: vdec: remove redundant if
statement
checking if sess->fmt_out->pixfmt is V4L2_PIX_FMT_VP9 was already done
as a condition to enter the if statement where this additional check is performed
---
drivers/staging/media/meson/vdec/esparser.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c
index db7022707ff8..e18334e57fc0 100644
--- a/drivers/staging/media/meson/vdec/esparser.c
+++ b/drivers/staging/media/meson/vdec/esparser.c
@@ -314,8 +314,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
num_dst_bufs = codec_ops->num_pending_bufs(sess);
num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx);
- if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9)
- num_dst_bufs -= 3;
+ num_dst_bufs -= 3;
if (esparser_vififo_get_free_space(sess) < payload_size ||
atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs)
--
2.35.1

View File

@@ -0,0 +1,262 @@
From 58c5526eb1798e61e4e76d37140cf10c8d325bc7 Mon Sep 17 00:00:00 2001
From: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
Date: Thu, 19 Sep 2019 16:20:31 +0800
Subject: [PATCH] general: meson64 overlays
Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 2 ++
arch/arm64/boot/dts/amlogic/overlay/Makefile | 20 ++++++++++++
.../dts/amlogic/overlay/README.meson-overlays | 20 ++++++++++++
.../dts/amlogic/overlay/meson-fixup.scr-cmd | 4 +++
.../boot/dts/amlogic/overlay/meson-i2cA.dts | 17 ++++++++++
.../boot/dts/amlogic/overlay/meson-i2cB.dts | 17 ++++++++++
.../boot/dts/amlogic/overlay/meson-uartA.dts | 11 +++++++
.../boot/dts/amlogic/overlay/meson-uartC.dts | 11 +++++++
.../dts/amlogic/overlay/meson-w1-gpio.dts | 20 ++++++++++++
.../dts/amlogic/overlay/meson-w1AB-gpio.dts | 32 +++++++++++++++++++
scripts/Makefile.lib | 3 ++
11 files changed, 157 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/Makefile
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/README.meson-overlays
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-fixup.scr-cmd
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-i2cA.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-i2cB.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-w1-gpio.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/meson-w1AB-gpio.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index da3225d31e38..5387963c0ee4 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -67,3 +67,5 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+
+subdir-y := $(dts-dirs) overlay
diff --git a/arch/arm64/boot/dts/amlogic/overlay/Makefile b/arch/arm64/boot/dts/amlogic/overlay/Makefile
new file mode 100644
index 000000000000..8630fd1a182d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/Makefile
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+dtbo-$(CONFIG_ARCH_MESON) += \
+ meson-i2cA.dtbo \
+ meson-i2cB.dtbo \
+ meson-uartA.dtbo \
+ meson-uartC.dtbo \
+ meson-w1-gpio.dtbo \
+ meson-w1AB-gpio.dtbo
+
+scr-$(CONFIG_ARCH_MESON) += \
+ meson-fixup.scr
+
+dtbotxt-$(CONFIG_ARCH_MESON) += \
+ README.meson-overlays
+
+targets += $(dtbo-y) $(scr-y) $(dtbotxt-y)
+
+always := $(dtbo-y) $(scr-y) $(dtbotxt-y)
+clean-files := *.dtbo *.scr
+
diff --git a/arch/arm64/boot/dts/amlogic/overlay/README.meson-overlays b/arch/arm64/boot/dts/amlogic/overlay/README.meson-overlays
new file mode 100644
index 000000000000..1b169a7a1525
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/README.meson-overlays
@@ -0,0 +1,20 @@
+This document describes overlays provided in the kernel packages
+For generic Armbian overlays documentation please see
+https://docs.armbian.com/User-Guide_Allwinner_overlays/
+
+### Platform:
+
+meson (Amlogic)
+
+### Provided overlays:
+
+- i2c8
+
+### Overlay details:
+
+### i2c8
+
+Activates TWI/I2C bus 8
+
+I2C8 pins (SCL, SDA): GPIO1-C4, GPIO1-C5
+
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-fixup.scr-cmd b/arch/arm64/boot/dts/amlogic/overlay/meson-fixup.scr-cmd
new file mode 100644
index 000000000000..d4c39e20a3a2
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-fixup.scr-cmd
@@ -0,0 +1,4 @@
+# overlays fixup script
+# implements (or rather substitutes) overlay arguments functionality
+# using u-boot scripting, environment variables and "fdt" command
+
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-i2cA.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-i2cA.dts
new file mode 100644
index 000000000000..bfb72feb7e36
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-i2cA.dts
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ i2cA = "/soc/bus@c1100000/i2c@8500";
+ };
+ };
+ fragment@1 {
+ target-path = "/soc/bus@c1100000/i2c@8500";
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-i2cB.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-i2cB.dts
new file mode 100644
index 000000000000..d75867bce99b
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-i2cB.dts
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ i2cA = "/soc/bus@c1100000/i2c@87c0";
+ };
+ };
+ fragment@1 {
+ target-path = "/soc/bus@c1100000/i2c@87c0";
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts
new file mode 100644
index 000000000000..3aecd60aaf64
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-uartA.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+ fragment@0 {
+ target-path = "/soc/bus@c1100000/serial@84c0";
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts
new file mode 100644
index 000000000000..2b40ee4c02d3
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-uartC.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+ fragment@0 {
+ target-path = "/soc/bus@c1100000/serial@8700";
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-w1-gpio.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-w1-gpio.dts
new file mode 100644
index 000000000000..ac76a4f20ab7
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-w1-gpio.dts
@@ -0,0 +1,20 @@
+// Definitions for w1-gpio module (without external pullup)
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+
+ fragment@0 {
+ target-path = "/";
+ __overlay__ {
+
+ w1: onewire@0 {
+ compatible = "w1-gpio";
+ pinctrl-names = "default";
+ gpios = <&gpio 91 6>; // GPIOY_16
+ status = "okay";
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlay/meson-w1AB-gpio.dts b/arch/arm64/boot/dts/amlogic/overlay/meson-w1AB-gpio.dts
new file mode 100644
index 000000000000..f6b0d7eff158
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/meson-w1AB-gpio.dts
@@ -0,0 +1,32 @@
+// Definitions for w1-gpio module (without external pullup)
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "amlogic,meson-gxbb";
+
+ fragment@0 {
+ target-path = "/";
+ __overlay__ {
+
+ w1a: onewire@0 {
+ compatible = "w1-gpio";
+ pinctrl-names = "default";
+ gpios = <&gpio 91 6>; // GPIOY_16
+ status = "okay";
+ };
+ };
+ };
+ fragment@1 {
+ target-path = "/";
+ __overlay__ {
+
+ w1b: onewire@1 {
+ compatible = "w1-gpio";
+ pinctrl-names = "default";
+ gpios = <&gpio 90 6>; // GPIOY_15
+ status = "okay";
+ };
+ };
+ };
+};
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a28448cebd7c..175e7b53eccf 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -87,6 +87,9 @@ base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m,
always-y += $(dtb-y)
+# Overlay targets
+extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y)
+
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))
--
2.30.2

View File

@@ -0,0 +1,368 @@
From 7d1ba33e12252f6661bf91ad28c6f8269bb13ff2 Mon Sep 17 00:00:00 2001
From: Kevin Kim <ckkim@hardkernel.com>
Date: Wed, 16 Jan 2019 14:45:10 +0900
Subject: [PATCH] ODROID-COMMON: pwm: gpio: Add a generic gpio based PWM driver
From: Olliver Schinagl <oliver@schinagl.nl>
This patch adds a bit-banging gpio PWM driver. It makes use of hrtimers,
to allow nano-second resolution, though it obviously strongly depends on
the switching speed of the gpio pins, hrtimer and system load.
Each pwm node can have 1 or more "pwm-gpio" entries, which will be
treated as pwm's as part of a pwm chip.
Change-Id: Idd42bf6d79f8ce52275a15965b02af470f28da7c
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
.../devicetree/bindings/pwm/pwm-gpio.txt | 18 ++
MAINTAINERS | 5 +
drivers/pwm/Kconfig | 15 ++
drivers/pwm/Makefile | 1 +
drivers/pwm/pwm-gpio.c | 255 ++++++++++++++++++
5 files changed, 294 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/pwm-gpio.txt
create mode 100644 drivers/pwm/pwm-gpio.c
diff --git a/Documentation/devicetree/bindings/pwm/pwm-gpio.txt b/Documentation/devicetree/bindings/pwm/pwm-gpio.txt
new file mode 100644
index 000000000000..336f61faa446
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-gpio.txt
@@ -0,0 +1,18 @@
+Generic GPIO bit-banged PWM driver
+
+Required properties:
+ - compatible: should be "pwm-gpio"
+ - #pwm-cells: should be 3, see pwm.txt in this directory for a general
+ description of the cells format.
+ - pwm-gpios: one or more gpios describing the used gpio, see the gpio
+ bindings for the used gpio driver.
+
+Example:
+#include <dt-bindings/gpio/gpio.h>
+
+ pwm: pwm@0 {
+ compatible = "pwm-gpio";
+ #pwm-cells = 3;
+ pwm-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>;
+ pwm-gpios = <&pio 7 2 GPIO_ACTIVE_LOW>;
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index dd36acc87ce6..0409221bb9a7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7959,6 +7959,11 @@ F: Documentation/i2c/muxes/i2c-mux-gpio.rst
F: drivers/i2c/muxes/i2c-mux-gpio.c
F: include/linux/platform_data/i2c-mux-gpio.h
+GENERIC GPIO PWM DRIVER
+M: Olliver Schinagl <oliver@schinagl.nl>
+S: Maintained
+F: drivers/pwm/pwm-gpio.c
+
GENERIC HDLC (WAN) DRIVERS
M: Krzysztof Halasa <khc@pm.waw.pl>
S: Maintained
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 21e3b05a5153..35f7bd5fb6b6 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -195,6 +195,21 @@ config PWM_FSL_FTM
To compile this driver as a module, choose M here: the module
will be called pwm-fsl-ftm.
+config PWM_GPIO
+ tristate "Generic GPIO bit-banged PWM driver"
+ depends on OF
+ depends on GPIOLIB
+ help
+ Some platforms do not offer any hardware PWM capabilities but do have
+ General Purpose Input Output (GPIO) pins available. Using the kernels
+ High-Resolution Timer API this driver tries to toggle GPIO using the
+ generic kernel PWM framework. The maximum frequency and/or accuracy
+ is dependent on several factors such as system load and the maximum
+ speed a pin can be toggled at the hardware.
+
+ To compile this driver as a module, choose M here: the module
+ will be called pwm-gpio.
+
config PWM_HIBVT
tristate "HiSilicon BVT PWM support"
depends on ARCH_HISI || COMPILE_TEST
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 708840b7fba8..f190bbc3af8d 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_PWM_CROS_EC) += pwm-cros-ec.o
obj-$(CONFIG_PWM_DWC) += pwm-dwc.o
obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o
obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o
+obj-$(CONFIG_PWM_GPIO) += pwm-gpio.o
obj-$(CONFIG_PWM_HIBVT) += pwm-hibvt.o
obj-$(CONFIG_PWM_IMG) += pwm-img.o
obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o
diff --git a/drivers/pwm/pwm-gpio.c b/drivers/pwm/pwm-gpio.c
new file mode 100644
index 000000000000..6707a5dbe5fb
--- /dev/null
+++ b/drivers/pwm/pwm-gpio.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2015 Olliver Schinagl <oliver@schinagl.nl>
+ *
+ * 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.
+ *
+ * This driver adds a high-resolution timer based PWM driver. Since this is a
+ * bit-banged driver, accuracy will always depend on a lot of factors, such as
+ * GPIO toggle speed and system load.
+ */
+
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/gpio/consumer.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/property.h>
+#include <linux/pwm.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/device.h>
+#include <linux/hrtimer.h>
+#include <linux/ktime.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#define DRV_NAME "pwm-gpio"
+
+struct gpio_pwm_data {
+ struct hrtimer timer;
+ struct gpio_desc *gpiod;
+ bool polarity;
+ bool pin_on;
+ int on_time;
+ int off_time;
+ bool run;
+};
+
+struct gpio_pwm_chip {
+ struct pwm_chip chip;
+};
+
+static void gpio_pwm_off(struct gpio_pwm_data *gpio_data)
+{
+ gpiod_set_value_cansleep(gpio_data->gpiod, gpio_data->polarity ? 0 : 1);
+}
+
+static void gpio_pwm_on(struct gpio_pwm_data *gpio_data)
+{
+ gpiod_set_value_cansleep(gpio_data->gpiod, gpio_data->polarity ? 1 : 0);
+}
+
+enum hrtimer_restart gpio_pwm_timer(struct hrtimer *timer)
+{
+ struct gpio_pwm_data *gpio_data = container_of(timer,
+ struct gpio_pwm_data,
+ timer);
+ if (!gpio_data->run) {
+ gpio_pwm_off(gpio_data);
+ gpio_data->pin_on = false;
+ return HRTIMER_NORESTART;
+ }
+
+ if (!gpio_data->pin_on) {
+ hrtimer_forward_now(&gpio_data->timer,
+ ns_to_ktime(gpio_data->on_time));
+ gpio_pwm_on(gpio_data);
+ gpio_data->pin_on = true;
+ } else {
+ hrtimer_forward_now(&gpio_data->timer,
+ ns_to_ktime(gpio_data->off_time));
+ gpio_pwm_off(gpio_data);
+ gpio_data->pin_on = false;
+ }
+
+ return HRTIMER_RESTART;
+}
+
+static int gpio_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
+ int duty_ns, int period_ns)
+{
+ struct gpio_pwm_data *gpio_data = pwm_get_chip_data(pwm);
+
+ gpio_data->on_time = duty_ns;
+ gpio_data->off_time = period_ns - duty_ns;
+
+ return 0;
+}
+
+static int gpio_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
+ enum pwm_polarity polarity)
+{
+ struct gpio_pwm_data *gpio_data = pwm_get_chip_data(pwm);
+
+ gpio_data->polarity = (polarity != PWM_POLARITY_NORMAL) ? true : false;
+
+ return 0;
+}
+
+static int gpio_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+ struct gpio_pwm_data *gpio_data = pwm_get_chip_data(pwm);
+
+ if (gpio_data->run)
+ return -EBUSY;
+
+ gpio_data->run = true;
+ if (gpio_data->off_time) {
+ hrtimer_start(&gpio_data->timer, ktime_set(0, 0),
+ HRTIMER_MODE_REL);
+ } else {
+ if (gpio_data->on_time)
+ gpio_pwm_on(gpio_data);
+ else
+ gpio_pwm_off(gpio_data);
+ }
+
+ return 0;
+}
+
+static void gpio_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+ struct gpio_pwm_data *gpio_data = pwm_get_chip_data(pwm);
+
+ gpio_data->run = false;
+ if (!gpio_data->off_time)
+ gpio_pwm_off(gpio_data);
+}
+
+static const struct pwm_ops gpio_pwm_ops = {
+ .config = gpio_pwm_config,
+ .set_polarity = gpio_pwm_set_polarity,
+ .enable = gpio_pwm_enable,
+ .disable = gpio_pwm_disable,
+ .owner = THIS_MODULE,
+};
+
+static int gpio_pwm_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct gpio_pwm_chip *gpio_chip;
+ int npwm, i;
+ int hrtimer = 0;
+
+ npwm = of_gpio_named_count(pdev->dev.of_node, "pwm-gpios");
+ if (npwm < 1)
+ return -ENODEV;
+
+ gpio_chip = devm_kzalloc(&pdev->dev, sizeof(*gpio_chip), GFP_KERNEL);
+ if (!gpio_chip)
+ return -ENOMEM;
+
+ gpio_chip->chip.dev = &pdev->dev;
+ gpio_chip->chip.ops = &gpio_pwm_ops;
+ gpio_chip->chip.base = -1;
+ gpio_chip->chip.npwm = npwm;
+ gpio_chip->chip.of_xlate = of_pwm_xlate_with_flags;
+ gpio_chip->chip.of_pwm_n_cells = 3;
+
+ ret = pwmchip_add(&gpio_chip->chip);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
+ return ret;
+ }
+
+ for (i = 0; i < npwm; i++) {
+ struct gpio_desc *gpiod;
+ struct gpio_pwm_data *gpio_data;
+
+ gpiod = devm_gpiod_get_index(&pdev->dev, "pwm", i,
+ GPIOD_OUT_LOW);
+ if (IS_ERR(gpiod)) {
+ int error;
+
+ error = PTR_ERR(gpiod);
+ if (error != -EPROBE_DEFER)
+ dev_err(&pdev->dev,
+ "failed to get gpio flags, error: %d\n",
+ error);
+ return error;
+ }
+
+ gpio_data = devm_kzalloc(&pdev->dev, sizeof(*gpio_data),
+ GFP_KERNEL);
+
+ hrtimer_init(&gpio_data->timer,
+ CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ gpio_data->timer.function = &gpio_pwm_timer;
+ gpio_data->gpiod = gpiod;
+ gpio_data->pin_on = false;
+ gpio_data->run = false;
+
+ if (hrtimer_is_hres_active(&gpio_data->timer))
+ hrtimer++;
+
+ pwm_set_chip_data(&gpio_chip->chip.pwms[i], gpio_data);
+ }
+ if (!hrtimer) {
+ dev_warn(&pdev->dev, "unable to use High-Resolution timer,");
+ dev_warn(&pdev->dev, "%s is restricted to low resolution.",
+ DRV_NAME);
+ }
+
+ platform_set_drvdata(pdev, gpio_chip);
+
+ dev_info(&pdev->dev, "%d gpio pwms loaded\n", npwm);
+
+ return 0;
+}
+
+static int gpio_pwm_remove(struct platform_device *pdev)
+{
+ struct gpio_pwm_chip *gpio_chip;
+ int i;
+
+ gpio_chip = platform_get_drvdata(pdev);
+ for (i = 0; i < gpio_chip->chip.npwm; i++) {
+ struct gpio_pwm_data *gpio_data;
+
+ gpio_data = pwm_get_chip_data(&gpio_chip->chip.pwms[i]);
+
+ hrtimer_cancel(&gpio_data->timer);
+ }
+
+ pwmchip_remove(&gpio_chip->chip);
+
+ return 0;
+}
+
+static const struct of_device_id gpio_pwm_of_match[] = {
+ { .compatible = DRV_NAME, },
+ {/* sentinel */},
+};
+MODULE_DEVICE_TABLE(of, gpio_pwm_of_match);
+
+static struct platform_driver gpio_pwm_driver = {
+ .probe = gpio_pwm_probe,
+ .remove = gpio_pwm_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = of_match_ptr(gpio_pwm_of_match),
+ },
+};
+module_platform_driver(gpio_pwm_driver);
+
+MODULE_AUTHOR("Olliver Schinagl <oliver@schinagl.nl>");
+MODULE_DESCRIPTION("Generic GPIO bit-banged PWM driver");
+MODULE_LICENSE("GPL");
--
2.35.1

View File

@@ -0,0 +1,14 @@
diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c
index 4b769111f78e..dd3aa1332f53 100644
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -91,7 +91,8 @@ static irqreturn_t meson_ir_irq(int irqno, void *dev_id)
status = readl_relaxed(ir->reg + IR_DEC_STATUS);
rawir.pulse = !!(status & STATUS_IR_DEC_IN);
- ir_raw_event_store_with_timeout(ir->rc, &rawir);
+ if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+ ir_raw_event_handle(ir->rc);
spin_unlock(&ir->lock);

View File

@@ -0,0 +1,28 @@
From 2e01cc074cc426da4b390af025a736eda9aef80c Mon Sep 17 00:00:00 2001
From: Koumes <koumes@centrum.cz>
Date: Sat, 1 Jun 2019 21:20:26 +0000
Subject: [PATCH] si2168: fix cmd timeout
Some demuxer si2168 commands may take 130-140 ms.
(DVB-T/T2 tuner MyGica T230C v2).
Details: https://github.com/CoreELEC/CoreELEC/pull/208
---
drivers/media/dvb-frontends/si2168.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index b05e6772c..ffaba6f81 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -42,7 +42,7 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
if (cmd->rlen) {
/* wait cmd execution terminate */
- #define TIMEOUT 70
+ #define TIMEOUT 200
timeout = jiffies + msecs_to_jiffies(TIMEOUT);
while (!time_after(jiffies, timeout)) {
ret = i2c_master_recv(client, cmd->args, cmd->rlen);
--
2.17.1

View File

@@ -0,0 +1,37 @@
From 79828b7d8ee8674b1538514a754337554cd4f856 Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Thu, 20 Feb 2020 18:52:57 +0900
Subject: [PATCH] ODROID-N2: sound/soc: remove mono channel as it currently
doesn't work hdmi output.
Change-Id: I4d43b802815779687ade974f049f2b0517a411d1
Signed-off-by: ckkim <changkon12@gmail.com>
---
sound/soc/meson/axg-frddr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/meson/axg-frddr.c b/sound/soc/meson/axg-frddr.c
index 37f4bb3469b5..b1cbeef98a73 100644
--- a/sound/soc/meson/axg-frddr.c
+++ b/sound/soc/meson/axg-frddr.c
@@ -106,7 +106,7 @@ static struct snd_soc_dai_driver axg_frddr_dai_drv = {
.name = "FRDDR",
.playback = {
.stream_name = "Playback",
- .channels_min = 1,
+ .channels_min = 2,
.channels_max = AXG_FIFO_CH_MAX,
.rates = AXG_FIFO_RATES,
.formats = AXG_FIFO_FORMATS,
@@ -180,7 +180,7 @@ static struct snd_soc_dai_driver g12a_frddr_dai_drv = {
.name = "FRDDR",
.playback = {
.stream_name = "Playback",
- .channels_min = 1,
+ .channels_min = 2,
.channels_max = AXG_FIFO_CH_MAX,
.rates = AXG_FIFO_RATES,
.formats = AXG_FIFO_FORMATS,
--
2.35.1

View File

@@ -0,0 +1,90 @@
From a5dc8bb92c6b67be7e48d442e821837b03fc129a Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Thu, 28 Jan 2021 09:43:36 +0000
Subject: [PATCH 17/58] FROMLIST(v1): spi-nor: add support for XT25F128B
This adds support for the XT25F128B as found on the RockPi4b SBC.
Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
---
This continues the efforts done in [1] & [2] that went stale. I've
tested this patch on my RockPi4b which only has the xt25f128b (and not
the xt25f32b as also propsed in [2]). I have tried to obtain a copy of
the datasheets but was unable to find them. Not sure whre you would get
them.
While [1] was already for the new spi-nor layout it was missing the bits
in the core.{c,h} files.
[1]: https://patchwork.ozlabs.org/project/linux-mtd/patch/CAMgqO2y9MYDj6antOaWLBRKU8vGEwqCB-Y1TkXTSWsmsed+W6A@mail.gmail.com/
[2]: https://patchwork.ozlabs.org/project/linux-mtd/patch/20200206171941.GA2398@makrotopia.org/
---
drivers/mtd/spi-nor/Makefile | 1 +
drivers/mtd/spi-nor/core.c | 1 +
drivers/mtd/spi-nor/core.h | 1 +
drivers/mtd/spi-nor/xtx.c | 16 ++++++++++++++++
4 files changed, 19 insertions(+)
create mode 100644 drivers/mtd/spi-nor/xtx.c
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index e347b435a038..8992c592a896 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -17,6 +17,7 @@ spi-nor-objs += sst.o
spi-nor-objs += winbond.o
spi-nor-objs += xilinx.o
spi-nor-objs += xmc.o
+spi-nor-objs += xtx.o
spi-nor-$(CONFIG_DEBUG_FS) += debugfs.o
obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 502967c76c5f..c171da5c8ca1 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1630,6 +1630,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
&spi_nor_winbond,
&spi_nor_xilinx,
&spi_nor_xmc,
+ &spi_nor_xtx,
};
static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 3f841ec36e56..9e29d67b419b 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -622,6 +622,7 @@ extern const struct spi_nor_manufacturer spi_nor_sst;
extern const struct spi_nor_manufacturer spi_nor_winbond;
extern const struct spi_nor_manufacturer spi_nor_xilinx;
extern const struct spi_nor_manufacturer spi_nor_xmc;
+extern const struct spi_nor_manufacturer spi_nor_xtx;
extern const struct attribute_group *spi_nor_sysfs_groups[];
diff --git a/drivers/mtd/spi-nor/xtx.c b/drivers/mtd/spi-nor/xtx.c
new file mode 100644
index 000000000000..73568854cf1e
--- /dev/null
+++ b/drivers/mtd/spi-nor/xtx.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info xtx_parts[] = {
+ /* XTX (Shenzhen Xin Tian Xia Tech) */
+ { "xt25f128b", INFO(0x0b4018, 0, 64 * 1024, 256) },
+};
+
+const struct spi_nor_manufacturer spi_nor_xtx = {
+ .name = "xtx",
+ .parts = xtx_parts,
+ .nparts = ARRAY_SIZE(xtx_parts),
+};
--
2.30.2

View File

@@ -0,0 +1,54 @@
From 477a4f4816028d590f7b013e04b29319dbe66a24 Mon Sep 17 00:00:00 2001
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Wed, 23 Feb 2022 02:21:19 +0000
Subject: [PATCH 50/90] FROMLIST(v1): usb: core: improve handling of hubs with
no ports
I get the "hub doesn't have any ports" error message on a system with
Amlogic S905W SoC. Seems the SoC has internal USB 3.0 supports but
is crippled with regard to USB 3.0 ports.
Maybe we shouldn't consider this scenario an error. So let's change
the message to info level, but otherwise keep the handling of the
scenario as it is today. With the patch it looks like this on my
system.
dwc2 c9100000.usb: supply vusb_d not found, using dummy regulator
dwc2 c9100000.usb: supply vusb_a not found, using dummy regulator
dwc2 c9100000.usb: EPs: 7, dedicated fifos, 712 entries in SPRAM
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f664 hci version 0x100 quirks 0x0000000002010010
xhci-hcd xhci-hcd.0.auto: irq 49, io mem 0xc9000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
hub 2-0:1.0: USB hub found
hub 2-0:1.0: hub has no ports, exiting
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/usb/core/hub.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 588f3ded89cd..4151b960915b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1423,9 +1423,8 @@ static int hub_configure(struct usb_hub *hub,
ret = -ENODEV;
goto fail;
} else if (hub->descriptor->bNbrPorts == 0) {
- message = "hub doesn't have any ports!";
- ret = -ENODEV;
- goto fail;
+ dev_info(hub_dev, "hub has no ports, exiting\n");
+ return -ENODEV;
}
/*
--
2.35.1

View File

@@ -0,0 +1,100 @@
From 369f3f5b1a0145b876407bd5900a90554cd89a05 Mon Sep 17 00:00:00 2001
From: usera <adeep@lexina.in>
Date: Mon, 12 Apr 2021 17:16:42 +0300
Subject: [PATCH 5/5] Fix:meson64: add gpio irq (patch from
https://lkml.org/lkml/2020/11/27/8)
Signed-off-by: Vyacheslav Bocharov <devel@lexina.in>
---
drivers/pinctrl/meson/pinctrl-meson.c | 41 +++++++++++++++++++++++++++
drivers/pinctrl/meson/pinctrl-meson.h | 1 +
2 files changed, 42 insertions(+)
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 49851444a6e3..3f295e9c561d 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -51,6 +51,7 @@
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/seq_file.h>
+#include <linux/of_irq.h>
#include "../core.h"
#include "../pinctrl-utils.h"
@@ -601,6 +602,40 @@ static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio)
return !!(val & BIT(bit));
}
+static int meson_gpio_to_irq(struct gpio_chip *chip, unsigned int gpio)
+{
+ struct meson_pinctrl *pc = gpiochip_get_data(chip);
+ struct meson_bank *bank;
+ struct irq_fwspec fwspec;
+ int hwirq;
+
+ if (meson_get_bank(pc, gpio, &bank))
+ return -EINVAL;
+
+ if (bank->irq_first < 0) {
+ dev_warn(pc->dev, "no support irq for pin[%d]\n", gpio);
+ return -EINVAL;
+ }
+ if (!pc->of_irq) {
+ dev_err(pc->dev, "invalid device node of gpio INTC\n");
+ return -EINVAL;
+ }
+
+ hwirq = gpio - bank->first + bank->irq_first;
+ printk("gpio irq setup: hwirq: 0x%X irqfirst: 0x%X irqlast: 0x%X pin[%d]\n", hwirq, bank->irq_first, bank->irq_last, gpio);
+ if (hwirq > bank->irq_last)
+ {
+ dev_warn(pc->dev, "no more irq for pin[%d]\n", gpio);
+ return -EINVAL;
+ }
+ fwspec.fwnode = of_node_to_fwnode(pc->of_irq);
+ fwspec.param_count = 2;
+ fwspec.param[0] = hwirq;
+ fwspec.param[1] = IRQ_TYPE_NONE;
+
+ return irq_create_fwspec_mapping(&fwspec);
+}
+
static int meson_gpiolib_register(struct meson_pinctrl *pc)
{
int ret;
@@ -615,6 +650,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
pc->chip.direction_output = meson_gpio_direction_output;
pc->chip.get = meson_gpio_get;
pc->chip.set = meson_gpio_set;
+ pc->chip.to_irq = meson_gpio_to_irq;
pc->chip.base = -1;
pc->chip.ngpio = pc->data->num_pins;
pc->chip.can_sleep = false;
@@ -685,6 +721,11 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc,
pc->of_node = gpio_np;
+ pc->of_irq = of_find_compatible_node(NULL,
+ NULL, "amlogic,meson-gpio-intc");
+ if (!pc->of_irq)
+ pc->of_irq = of_find_compatible_node(NULL,
+ NULL, "amlogic,meson-gpio-intc-ext");
pc->reg_mux = meson_map_resource(pc, gpio_np, "mux");
if (IS_ERR_OR_NULL(pc->reg_mux)) {
dev_err(pc->dev, "mux registers not found\n");
diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h
index ff5372e0a475..07f277946d1b 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.h
+++ b/drivers/pinctrl/meson/pinctrl-meson.h
@@ -132,6 +132,7 @@ struct meson_pinctrl {
struct regmap *reg_ds;
struct gpio_chip chip;
struct device_node *of_node;
+ struct device_node *of_irq;
};
#define FUNCTION(fn) \
--
2.35.1

View File

@@ -0,0 +1,47 @@
From 2428abb8dd4bc3c176a91a6d53d13b8b0cc67e24 Mon Sep 17 00:00:00 2001
From: Vyacheslav Bocharov <adeep@lexina.in>
Date: Wed, 15 Jun 2022 12:47:23 +0300
Subject: [PATCH] arm64: meson: add JetHub D1p device
Add support for JetHub D1p variation of D1 series home automation controller.
---
.../dts/amlogic/meson-axg-jethome-jethub-j100.dts | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts
index 8b0d586aa84e..f46b0ec9ec13 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts
@@ -258,18 +258,14 @@ &sd_emmc_b {
bus-width = <4>;
cap-sd-highspeed;
max-frequency = <50000000>;
- non-removable;
disable-wp;
+ keep-power-in-suspend;
+ broken-cd;/* cd-gpios = <&gpio GPIOAO_3 GPIO_ACTIVE_LOW>;*/
mmc-pwrseq = <&sdio_pwrseq>;
vmmc-supply = <&vddao_3v3>;
vqmmc-supply = <&vddio_boot>;
-
- brcmf: wifi@1 {
- reg = <1>;
- compatible = "brcm,bcm4329-fmac";
- };
};
/* emmc storage */
@@ -368,3 +364,8 @@ &cpu2 {
&cpu3 {
#cooling-cells = <2>;
};
+
+&saradc {
+ status = "okay";
+ vref-supply = <&vddio_ao18>;
+};
--
2.30.2

View File

@@ -0,0 +1,65 @@
From b47c9e9c9cba1c03fd8d99cca29989f3bde1c83a Mon Sep 17 00:00:00 2001
From: root <root@homeserver.msync.work>
Date: Tue, 24 May 2022 16:43:18 +0300
Subject: [PATCH] Overlay d1plus
---
arch/arm64/boot/dts/amlogic/overlay/Makefile | 3 ++-
.../dts/amlogic/overlay/jethub-d1plus.dts | 23 +++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlay/jethub-d1plus.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlay/Makefile b/arch/arm64/boot/dts/amlogic/overlay/Makefile
index 8630fd1a182..bcc8130119d 100644
--- a/arch/arm64/boot/dts/amlogic/overlay/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlay/Makefile
@@ -5,7 +5,8 @@ dtbo-$(CONFIG_ARCH_MESON) += \
meson-uartA.dtbo \
meson-uartC.dtbo \
meson-w1-gpio.dtbo \
- meson-w1AB-gpio.dtbo
+ meson-w1AB-gpio.dtbo \
+ jethub-d1plus.dtbo
scr-$(CONFIG_ARCH_MESON) += \
meson-fixup.scr
diff --git a/arch/arm64/boot/dts/amlogic/overlay/jethub-d1plus.dts b/arch/arm64/boot/dts/amlogic/overlay/jethub-d1plus.dts
new file mode 100644
index 00000000000..a5ea7e98622
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlay/jethub-d1plus.dts
@@ -0,0 +1,23 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "jethome,jethub-j100";
+ fragment@0 {
+ target-path = "/soc/bus@ffd00000/serial@23000";
+ __overlay__ {
+ /delete-node/ bluetooth;
+ };
+ };
+ fragment@1 {
+ target-path = "/soc/bus@ffd00000/serial@23000";
+ __overlay__ {
+ bluetooth {
+ compatible = "realtek,rtl8822cs-bt";
+ enable-gpios = <&gpio 7 0>;
+ /* host-wake-gpios = <&gpio 8 0>;*/
+ device-wake-gpios = <&gpio 6 0>;
+ };
+ };
+ };
+};
--
2.30.2
+ bluetooth {
+ compatible = "realtek,rtl8822cs-bt";
+ enable-gpios = <&gpio GPIOZ_7 GPIO_ACTIVE_HIGH>;
+ /* host-wake-gpios = <&gpio GPIOAO_8 GPIO_ACTIVE_HIGH>;*/
+ device-wake-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>;
+ };
};

View File

@@ -0,0 +1,41 @@
From 9c2b8d82e36bf5ce932e6561d13adf5c7c5d367f Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Thu, 3 Nov 2016 15:29:25 +0100
Subject: [PATCH 06/90] HACK: arm64: dts: meson: add support for GX PM and
Virtual RTC
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index 99b8916e0c5d..d6dc407127cd 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -221,6 +221,10 @@ sm: secure-monitor {
};
};
+ system-suspend {
+ compatible = "amlogic,meson-gx-pm";
+ };
+
efuse: efuse {
compatible = "amlogic,meson-gx-efuse", "amlogic,meson-gxbb-efuse";
#address-cells = <1>;
@@ -459,6 +463,11 @@ clkc_AO: clock-controller {
};
};
+ vrtc: rtc@a8 {
+ compatible = "amlogic,meson-vrtc";
+ reg = <0x0 0x000a8 0x0 0x4>;
+ };
+
cec_AO: cec@100 {
compatible = "amlogic,meson-gx-ao-cec";
reg = <0x0 0x00100 0x0 0x14>;
--
2.35.1

View File

@@ -0,0 +1,22 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..b3c22861b022 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -333,6 +333,8 @@ &hwrng {
&i2c_A {
clocks = <&clkc CLKID_I2C>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c_a_pins>;
};
&i2c_AO {
@@ -341,6 +343,8 @@ &i2c_AO {
&i2c_B {
clocks = <&clkc CLKID_I2C>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c_b_pins>;
};
&i2c_C {

View File

@@ -0,0 +1,39 @@
From 975c23d02776b023a75e6090b521a839e67a8c42 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sun, 21 Nov 2021 19:12:07 +0000
Subject: [PATCH 66/90] WIP: drivers: meson: vdec: add HEVC support to GXBB
It's not clear whether the GXL firmware is the same one used with GXBB
but let's try it and see!
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/staging/media/meson/vdec/vdec_platform.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c
index 8592cb3aaea9..810039a02b44 100644
--- a/drivers/staging/media/meson/vdec/vdec_platform.c
+++ b/drivers/staging/media/meson/vdec/vdec_platform.c
@@ -16,6 +16,18 @@
static const struct amvdec_format vdec_formats_gxbb[] = {
{
+ .pixfmt = V4L2_PIX_FMT_HEVC,
+ .min_buffers = 4,
+ .max_buffers = 24,
+ .max_width = 3840,
+ .max_height = 2160,
+ .vdec_ops = &vdec_hevc_ops,
+ .codec_ops = &codec_hevc_ops,
+ .firmware_path = "meson/vdec/gxl_hevc.bin",
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
+ .flags = V4L2_FMT_FLAG_COMPRESSED |
+ V4L2_FMT_FLAG_DYN_RESOLUTION,
+ }, {
.pixfmt = V4L2_PIX_FMT_H264,
.min_buffers = 2,
.max_buffers = 24,
--
2.35.1

View File

@@ -0,0 +1,44 @@
From fa0fc8498a811c85bace6138f60b7d09f07d18b8 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Thu, 25 Nov 2021 11:31:43 +0000
Subject: [PATCH 43/90] FROMLIST(v1): drivers: meson: vdec: add VP9 support to
GXM
VP9 support for GXM appears to have been missed from the original
codec submission [0] but it works well, so let's add support.
[0] https://github.com/torvalds/linux/commit/00c43088aa680989407b6afbda295f67b3f123f1
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/staging/media/meson/vdec/vdec_platform.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c
index 810039a02b44..38f353c6d27d 100644
--- a/drivers/staging/media/meson/vdec/vdec_platform.c
+++ b/drivers/staging/media/meson/vdec/vdec_platform.c
@@ -27,7 +27,19 @@ static const struct amvdec_format vdec_formats_gxbb[] = {
.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
.flags = V4L2_FMT_FLAG_COMPRESSED |
V4L2_FMT_FLAG_DYN_RESOLUTION,
- }, {
+ }, {
+ .pixfmt = V4L2_PIX_FMT_VP9,
+ .min_buffers = 16,
+ .max_buffers = 24,
+ .max_width = 3840,
+ .max_height = 2160,
+ .vdec_ops = &vdec_hevc_ops,
+ .codec_ops = &codec_vp9_ops,
+ .firmware_path = "meson/vdec/gxl_vp9.bin",
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
+ .flags = V4L2_FMT_FLAG_COMPRESSED |
+ V4L2_FMT_FLAG_DYN_RESOLUTION,
+ }, {
.pixfmt = V4L2_PIX_FMT_H264,
.min_buffers = 2,
.max_buffers = 24,
--
2.35.1

View File

@@ -0,0 +1,34 @@
From a11802ecb5686153614aa19a089900c22928988c Mon Sep 17 00:00:00 2001
From: Igor Pecovnik <igor.pecovnik@gmail.com>
Date: Tue, 4 Aug 2020 22:51:56 +0200
Subject: [PATCH] Add higher clocks for SM1 family
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
index d4ec735fb..a35cad1d4 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
@@ -150,6 +150,16 @@ opp-1908000000 {
opp-hz = /bits/ 64 <1908000000>;
opp-microvolt = <950000>;
};
+
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1000000>;
+ };
+
+ opp-2100000000 {
+ opp-hz = /bits/ 64 <2100000000>;
+ opp-microvolt = <1022000>;
+ };
};
};
--
Created with Armbian build tools https://github.com/armbian/build

View File

@@ -1 +1 @@
archive/meson64-5.17 archive/meson64-5.19