Extract Odroid related patches from Tobetter branch and move sources to mainline (#2847)

Also temoporally remove overlay support which is broken
This commit is contained in:
Igor Pečovnik
2021-05-23 17:28:33 +02:00
committed by GitHub
parent cafa137761
commit e78cb4ce2a
107 changed files with 20679 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 5.12.1 Kernel Configuration
# Linux/arm 5.12.6 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0"
CONFIG_CC_IS_GCC=y

View File

@@ -23,10 +23,7 @@ case $BRANCH in
;;
edge)
KERNELSOURCE='https://github.com/tobetter/linux'
KERNELBRANCH='branch:odroid-5.12.y'
KERNELDIR='linux-odroidxu4'
KERNELBRANCH='branch:linux-5.12.y'
;;
esac

View File

@@ -0,0 +1,42 @@
From 58058db3cfee1555bf8e0d74578be26ba852d1e4 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 10 Mar 2020 00:10:17 +0900
Subject: [PATCH 001/109] ODROID-C2: arm64/dts: add 'meson64_odroidc2.dts' for
compability
Change-Id: Idcec2c95970c75aca00c30726b4e007ad1651a13
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 2 ++
arch/arm64/boot/dts/amlogic/meson64_odroidc2.dts | 9 +++++++++
2 files changed, 11 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidc2.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 78a569d7fa20..b85f0a830d74 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -50,3 +50,5 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
+
+dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc2.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc2.dts
new file mode 100644
index 000000000000..fa1beeac3783
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc2.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
+ *
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-odroidc2.dts"
--
2.25.1

View File

@@ -0,0 +1,45 @@
From 75ba7ea39d0dfa0d03d23e4a71ff5d573084758b Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 1 Oct 2019 14:11:46 +0900
Subject: [PATCH 002/109] ODROID-N2: arm64/dts: add 'meson64_odroidn2.dts' for
compability
Change-Id: I361804b497d71fd67a4c6816463d5cac607e0a53
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 13 +++++++++++++
2 files changed, 14 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index b85f0a830d74..2fd90a311fae 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -52,3 +52,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
new file mode 100644
index 000000000000..2bf16e7ac197
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Dongjin Kim <tobetter@gmail.com>
+ *
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-odroid-n2.dts"
+
+/ {
+ model = "Hardkernel ODROID-N2";
+};
--
2.25.1

View File

@@ -0,0 +1,641 @@
From 0fc086bbb379d3d42dddbc6f8053799a3ea980ba Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 3 Mar 2020 14:20:59 +0900
Subject: [PATCH 003/109] ODROID-N2: arm64/dts: support Ulta High Speed MMC
card
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I52bbf26aaf807e96bff7665bb65a1ee5594f6449
---
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 617 ++++++++++++++++++
1 file changed, 617 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index a198a91259ec..fb331eb9f24e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -12,4 +12,621 @@
/ {
compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
model = "Hardkernel ODROID-N2";
+
+ aliases {
+ serial0 = &uart_AO;
+ ethernet0 = &ethmac;
+ };
+
+ dioo2133: audio-amplifier-0 {
+ compatible = "simple-audio-amplifier";
+ enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+ VCC-supply = <&vcc_5v>;
+ sound-name-prefix = "U19";
+ status = "okay";
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x40000000>;
+ };
+
+ emmc_pwrseq: emmc-pwrseq {
+ compatible = "mmc-pwrseq-emmc";
+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ blue {
+ label = "n2:blue";
+ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "heartbeat";
+ };
+ };
+
+ tflash_vdd: regulator-tflash_vdd {
+ compatible = "regulator-fixed";
+
+ regulator-name = "TFLASH_VDD";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+
+ gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ regulator-always-on;
+ };
+
+ tf_io: gpio-regulator-tf_io {
+ compatible = "regulator-gpio";
+
+ regulator-name = "TF_IO";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+
+ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+ gpios-states = <0>;
+
+ states = <3300000 0>,
+ <1800000 1>;
+ };
+
+ flash_1v8: regulator-flash_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "FLASH_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc_3v3>;
+ regulator-always-on;
+ };
+
+ main_12v: regulator-main_12v {
+ compatible = "regulator-fixed";
+ regulator-name = "12V";
+ regulator-min-microvolt = <12000000>;
+ regulator-max-microvolt = <12000000>;
+ regulator-always-on;
+ };
+
+ vcc_5v: regulator-vcc_5v {
+ compatible = "regulator-fixed";
+ regulator-name = "5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ vin-supply = <&main_12v>;
+ };
+
+ 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 */
+ };
+
+ vddcpu_a: regulator-vddcpu-a {
+ /*
+ * MP8756GD Regulator.
+ */
+ compatible = "pwm-regulator";
+
+ regulator-name = "VDDCPU_A";
+ regulator-min-microvolt = <721000>;
+ regulator-max-microvolt = <1022000>;
+
+ vin-supply = <&main_12v>;
+
+ 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 = <721000>;
+ regulator-max-microvolt = <1022000>;
+
+ vin-supply = <&main_12v>;
+
+ pwms = <&pwm_AO_cd 1 1250 0>;
+ pwm-dutycycle-range = <100 0>;
+
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ hub_5v: regulator-hub_5v {
+ compatible = "regulator-fixed";
+ regulator-name = "HUB_5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&vcc_5v>;
+
+ /* Connected to the Hub CHIPENABLE, LOW sets low power state */
+ gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ usb_pwr_en: regulator-usb_pwr_en {
+ compatible = "regulator-fixed";
+ regulator-name = "USB_PWR_EN";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&vcc_5v>;
+
+ /* Connected to the microUSB port power enable */
+ gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ vddao_1v8: regulator-vddao_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_1V8";
+ 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 = <&main_12v>;
+ regulator-always-on;
+ };
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ sound {
+ compatible = "amlogic,axg-sound-card";
+ model = "G12B-ODROID-N2";
+ audio-widgets = "Line", "Lineout";
+ audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
+ <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
+ <&dioo2133>;
+ 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",
+ "TDMOUT_C IN 0", "FRDDR_A OUT 2",
+ "TDMOUT_C IN 1", "FRDDR_B OUT 2",
+ "TDMOUT_C IN 2", "FRDDR_C OUT 2",
+ "TDM_C Playback", "TDMOUT_C OUT",
+ "TDMIN_A IN 4", "TDM_B Loopback",
+ "TDMIN_B IN 4", "TDM_B Loopback",
+ "TDMIN_C IN 4", "TDM_B Loopback",
+ "TDMIN_LB IN 1", "TDM_B Loopback",
+ "TDMIN_A IN 5", "TDM_C Loopback",
+ "TDMIN_B IN 5", "TDM_C Loopback",
+ "TDMIN_C IN 5", "TDM_C Loopback",
+ "TDMIN_LB IN 2", "TDM_C Loopback",
+ "TODDR_A IN 0", "TDMIN_A OUT",
+ "TODDR_B IN 0", "TDMIN_A OUT",
+ "TODDR_C IN 0", "TDMIN_A OUT",
+ "TODDR_A IN 1", "TDMIN_B OUT",
+ "TODDR_B IN 1", "TDMIN_B OUT",
+ "TODDR_C IN 1", "TDMIN_B OUT",
+ "TODDR_A IN 2", "TDMIN_C OUT",
+ "TODDR_B IN 2", "TDMIN_C OUT",
+ "TODDR_C IN 2", "TDMIN_C OUT",
+ "TODDR_A IN 6", "TDMIN_LB OUT",
+ "TODDR_B IN 6", "TDMIN_LB OUT",
+ "TODDR_C IN 6", "TDMIN_LB OUT",
+ "U19 INL", "ACODEC LOLP",
+ "U19 INR", "ACODEC LORP",
+ "Lineout", "U19 OUTL",
+ "Lineout", "U19 OUTR";
+
+ 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>;
+ };
+
+ dai-link-3 {
+ sound-dai = <&toddr_a>;
+ };
+
+ dai-link-4 {
+ sound-dai = <&toddr_b>;
+ };
+
+ dai-link-5 {
+ sound-dai = <&toddr_c>;
+ };
+
+ /* 8ch hdmi interface */
+ dai-link-6 {
+ 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-0 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+ };
+
+ codec-1 {
+ sound-dai = <&toacodec TOACODEC_IN_B>;
+ };
+ };
+
+ /* i2s jack output interface */
+ dai-link-7 {
+ sound-dai = <&tdmif_c>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-0 = <1 1>;
+ mclk-fs = <256>;
+
+ codec-0 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
+ };
+
+ codec-1 {
+ sound-dai = <&toacodec TOACODEC_IN_C>;
+ };
+ };
+
+ /* hdmi glue */
+ dai-link-8 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+ codec {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+
+ /* acodec glue */
+ dai-link-9 {
+ sound-dai = <&toacodec TOACODEC_OUT>;
+
+ codec {
+ sound-dai = <&acodec>;
+ };
+ };
+ };
+};
+
+&acodec {
+ AVDD-supply = <&vddao_1v8>;
+ status = "okay";
+};
+
+&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>;
+};
+
+&ext_mdio {
+ external_phy: ethernet-phy@0 {
+ /* Realtek RTL8211F (0x001cc916) */
+ reg = <0>;
+ max-speed = <1000>;
+
+ reset-assert-us = <10000>;
+ reset-deassert-us = <30000>;
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+
+ interrupt-parent = <&gpio_intc>;
+ /* MAC_INTR on GPIOZ_14 */
+ interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
+ };
+};
+
+&ethmac {
+ pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+ phy-mode = "rgmii";
+ phy-handle = <&external_phy>;
+ amlogic,tx-delay-ns = <2>;
+};
+
+&frddr_a {
+ status = "okay";
+};
+
+&frddr_b {
+ status = "okay";
+};
+
+&frddr_c {
+ status = "okay";
+};
+
+&gpio {
+ /*
+ * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
+ * to be turned high in order to be detected by the USB Controller
+ * This signal should be handled by a USB specific power sequence
+ * in order to reset the Hub when USB bus is powered down.
+ */
+ usb-hub {
+ gpio-hog;
+ gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
+ output-high;
+ line-name = "usb-hub-reset";
+ };
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+ pinctrl-names = "default";
+ hdmi-supply = <&vcc_5v>;
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&ir {
+ status = "okay";
+ pinctrl-0 = <&remote_input_ao_pins>;
+ pinctrl-names = "default";
+ linux,rc-map-name = "rc-odroid";
+};
+
+&pwm_ab {
+ pinctrl-0 = <&pwm_a_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin0";
+ status = "okay";
+};
+
+&pwm_AO_cd {
+ pinctrl-0 = <&pwm_ao_d_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin1";
+ status = "okay";
+};
+
+/* 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 = <200000000>;
+ sd-uhs-sdr12;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ disable-wp;
+
+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&tflash_vdd>;
+ vqmmc-supply = <&tf_io>;
+
+};
+
+/* 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 = <&flash_1v8>;
+};
+
+/*
+ * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR pins
+ * and eMMC Data 4 to 7 pins.
+ * 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.
+ * The SW1 slide should also be set to the correct position.
+ */
+&spifc {
+ status = "disabled";
+ pinctrl-0 = <&nor_pins>;
+ pinctrl-names = "default";
+
+ mx25u64: spi-flash@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "mxicy,mx25u6435f", "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <104000000>;
+ };
+};
+
+&tdmif_b {
+ status = "okay";
+};
+
+&tdmif_c {
+ status = "okay";
+};
+
+&tdmin_a {
+ status = "okay";
+};
+
+&tdmin_b {
+ status = "okay";
+};
+
+&tdmin_c {
+ status = "okay";
+};
+
+&tdmin_lb {
+ status = "okay";
+};
+
+&tdmout_b {
+ status = "okay";
+};
+
+&tdmout_c {
+ status = "okay";
+};
+
+&toacodec {
+ status = "okay";
+};
+
+&tohdmitx {
+ status = "okay";
+};
+
+&toddr_a {
+ status = "okay";
+};
+
+&toddr_b {
+ status = "okay";
+};
+
+&toddr_c {
+ status = "okay";
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb {
+ status = "okay";
+ vbus-supply = <&usb_pwr_en>;
+};
+
+&usb2_phy0 {
+ phy-supply = <&vcc_5v>;
+};
+
+&usb2_phy1 {
+ /* Enable the hub which is connected to this port */
+ phy-supply = <&hub_5v>;
};
--
2.25.1

View File

@@ -0,0 +1,69 @@
From 3f51c63d9a7bd41d75d0dbb0117e3f6485d63df1 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Fri, 13 Mar 2020 14:07:34 +0900
Subject: [PATCH 004/109] ODROID-N2: arm64/dts: Add gpio-line-names
Change-Id: Ie5b40ea8885c324c81b4fa80a5bbe59b533b1b3a
---
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index fb331eb9f24e..978ed64066a8 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -447,6 +447,51 @@ &frddr_c {
};
&gpio {
+ gpio-line-names =
+ /* GPIOZ */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ /* GPIOH */
+ "", "", "", "", "", "", "", "",
+ "",
+ /* BOOT */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ /* GPIOC */
+ "", "", "", "", "", "", "", "",
+ /* GPIOA */
+ "PIN_44", /* GPIOA_0 */
+ "PIN_46", /* GPIOA_1 */
+ "PIN_45", /* GPIOA_2 */
+ "PIN_47", /* GPIOA_3 */
+ "PIN_26", /* GPIOA_4 */
+ "", "", "", "", "", "",
+ "PIN_42", /* GPIOA_11 */
+ "PIN_32", /* GPIOA_12 */
+ "PIN_7", /* GPIOA_13 */
+ "PIN_27", /* GPIOA_14 */
+ "PIN_28", /* GPIOA_15 */
+ /* GPIOX */
+ "PIN_16", /* GPIOX_0 */
+ "PIN_18", /* GPIOX_1 */
+ "PIN_22", /* GPIOX_2 */
+ "PIN_11", /* GPIOX_3 */
+ "PIN_13", /* GPIOX_4 */
+ "PIN_33", /* GPIOX_5 */
+ "PIN_35", /* GPIOX_6 */
+ "PIN_15", /* GPIOX_7 */
+ "PIN_19", /* GPIOX_8 */
+ "PIN_21", /* GPIOX_9 */
+ "PIN_24", /* GPIOX_10 */
+ "PIN_23", /* GPIOX_11 */
+ "PIN_8", /* GPIOX_12 */
+ "PIN_10", /* GPIOX_13 */
+ "PIN_29", /* GPIOX_14 */
+ "PIN_31", /* GPIOX_15 */
+ "PIN_12", /* GPIOX_16 */
+ "PIN_3", /* GPIOX_17 */
+ "PIN_5", /* GPIOX_18 */
+ "PIN_36"; /* GPIOX_19 */
/*
* WARNING: The USB Hub on the Odroid-N2 needs a reset signal
* to be turned high in order to be detected by the USB Controller
--
2.25.1

View File

@@ -0,0 +1,41 @@
From ccac3a2b9c3924ba856fbc3021d5017195c137ed Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Fri, 27 Mar 2020 17:05:22 +0900
Subject: [PATCH 005/109] ODROID-N2: ARM64/dts: add uart_A node
Change-Id: I129c3d059231a7941285deffc293ee72784adcce
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 978ed64066a8..f5a993ef93a5 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -14,8 +14,9 @@ / {
model = "Hardkernel ODROID-N2";
aliases {
- serial0 = &uart_AO;
ethernet0 = &ethmac;
+ serial0 = &uart_AO;
+ serial1 = &uart_A;
};
dioo2133: audio-amplifier-0 {
@@ -656,6 +657,12 @@ &toddr_c {
status = "okay";
};
+&uart_A {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart_a_pins>;
+};
+
&uart_AO {
status = "okay";
pinctrl-0 = <&uart_ao_a_pins>;
--
2.25.1

View File

@@ -0,0 +1,91 @@
From 46beaaabd6bcf65d0d6d37be56852482870b8086 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Fri, 27 Mar 2020 16:54:02 +0900
Subject: [PATCH 006/109] ODROID-N2: ARM64/dts: add i2c2, i2c3 node
Change-Id: I00e3748a6f8474a99d05200afc60b8d794f75c96
---
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index f5a993ef93a5..7d4de0335873 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -15,6 +15,8 @@ / {
aliases {
ethernet0 = &ethmac;
+ i2c1 = &i2c2;
+ i2c2 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
};
@@ -520,6 +522,35 @@ hdmi_tx_tmds_out: endpoint {
};
};
+&i2c2 {
+ status = "okay";
+
+ /*
+ * 40 Pin Header : SDA(GPIOX.17->3 Pin)
+ * SCL(GPIOX.18->5 Pin)
+ */
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c2_master_pins1>;
+
+ /* default 400k */
+ clock-frequency = <400000>;
+};
+
+&i2c3 {
+ /* default i2c clock-frequency is 100Khz */
+ status = "okay";
+
+ /*
+ * 40 Pin Header : SDA(GPIOA.14->27 Pin)
+ * SCL(GPIOA.15->28 Pin)
+ */
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3_master_pins2>;
+
+ /* default 100k */
+ clock-frequency = <100000>;
+};
+
&ir {
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
@@ -527,6 +558,28 @@ &ir {
linux,rc-map-name = "rc-odroid";
};
+&periphs_pinctrl {
+ i2c2_master_pins1:i2c2-master-pins1 {
+ mux {
+ groups = "i2c2_sda_x",
+ "i2c2_sck_x";
+ function = "i2c2";
+ bias-pull-up;
+ drive-strength-microamp = <3000>;
+ };
+ };
+
+ i2c3_master_pins2:i2c2-master-pins2 {
+ mux {
+ groups = "i2c3_sda_a",
+ "i2c3_sck_a";
+ function = "i2c3";
+ bias-pull-up;
+ drive-strength-microamp = <3000>;
+ };
+ };
+};
+
&pwm_ab {
pinctrl-0 = <&pwm_a_e_pins>;
pinctrl-names = "default";
--
2.25.1

View File

@@ -0,0 +1,28 @@
From 0aaea4dc18c510cc140d3455b751979c9198da0b Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Fri, 27 Mar 2020 17:36:37 +0900
Subject: [PATCH 007/109] ODROID-N2: ARM64/dts: add saradc node
Change-Id: Ieced434cbde791edee600832f51bd5021b4604aa
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 7d4de0335873..68a5c6930f7d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -596,6 +596,10 @@ &pwm_AO_cd {
status = "okay";
};
+&saradc {
+ status = "okay";
+};
+
/* SD card */
&sd_emmc_b {
status = "okay";
--
2.25.1

View File

@@ -0,0 +1,37 @@
From c1e0e9e46f8433998eccb805a75b7035a9078e49 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Tue, 21 Apr 2020 16:22:24 +0900
Subject: [PATCH 008/109] ODROID-N2: arm64/dts: modify i2c alias bus number
Change-Id: I49b58c681dea5377df0ee7ab98163165d5521cb8
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 68a5c6930f7d..3aa8da458e5d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -15,8 +15,8 @@ / {
aliases {
ethernet0 = &ethmac;
- i2c1 = &i2c2;
- i2c2 = &i2c3;
+ i2c0 = &i2c2;
+ i2c1 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
};
@@ -414,7 +414,7 @@ &cpu103 {
&ext_mdio {
external_phy: ethernet-phy@0 {
- /* Realtek RTL8211F (0x001cc916) */
+ /* Realtek RTL8211F (0x001cc916) */
reg = <0>;
max-speed = <1000>;
--
2.25.1

View File

@@ -0,0 +1,28 @@
From 0a699992e0c88e3dcb79addb4e4d7c57d6b0cef7 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Tue, 21 Apr 2020 16:22:24 +0900
Subject: [PATCH 009/109] ODROID-N2: arm64/dts: modify i2c alias bus number
Change-Id: I49b58c681dea5377df0ee7ab98163165d5521cb8
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 3aa8da458e5d..e67e202ab996 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -15,8 +15,8 @@ / {
aliases {
ethernet0 = &ethmac;
- i2c0 = &i2c2;
- i2c1 = &i2c3;
+ i2c1 = &i2c2;
+ i2c2 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
};
--
2.25.1

View File

@@ -0,0 +1,638 @@
From c3d50a31b79e1937445f80410c084180a934cd9c Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Thu, 5 Mar 2020 19:01:43 +0900
Subject: [PATCH 010/109] ODROID-COMMON: input/touchscreen: Add D-WAV
Multitouch driver.
Change-Id: Ia1c8c29d3f69c6ba5d630279c4cc98119b68ab71
---
drivers/hid/hid-ids.h | 6 +
drivers/hid/hid-quirks.c | 4 +
drivers/input/touchscreen/Kconfig | 10 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/dwav-usb-mt.c | 554 ++++++++++++++++++++++++
5 files changed, 575 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 67fd8a2f5aba..7d9909b9cd11 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1333,4 +1333,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 1a9daf03dbfa..4033de7c2de1 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -858,6 +858,10 @@ 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_DWAV, USB_DEVICE_ID_DWAV_MULTITOUCH) },
+ { 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 529614d364fe..3b371f3a90fd 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -1335,4 +1335,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 6233541e9173..da1bea809cd9 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -112,3 +112,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.25.1

View File

@@ -0,0 +1,28 @@
From 621c626515dcc142ac64b489ebb8b97e2aed5cb3 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Fri, 12 Jun 2020 16:42:39 +0900
Subject: [PATCH 011/109] ODROID-N2: arm64/dts: modify i2c alias bus number
Change-Id: Ie9550c77f01931e6c718b869d6581cadd44d45f8
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index e67e202ab996..3aa8da458e5d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -15,8 +15,8 @@ / {
aliases {
ethernet0 = &ethmac;
- i2c1 = &i2c2;
- i2c2 = &i2c3;
+ i2c0 = &i2c2;
+ i2c1 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
};
--
2.25.1

View File

@@ -0,0 +1,37 @@
From 78f3c72b38c92760eef2fa8342894ced93fa6bfd Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Thu, 20 Feb 2020 18:52:57 +0900
Subject: [PATCH 012/109] 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 c3ae8ac30745..cfb9b12c2b56 100644
--- a/sound/soc/meson/axg-frddr.c
+++ b/sound/soc/meson/axg-frddr.c
@@ -92,7 +92,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,
@@ -165,7 +165,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.25.1

View File

@@ -0,0 +1,29 @@
From f33f00ef82433a6da9d66743c3c530ba654d5973 Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 16 Jun 2020 16:16:30 +0900
Subject: [PATCH 013/109] ODROID-N2: sound/soc: add audio module for g12a,
g12b, sm1
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I02b2b8d1ec756dfc361300082d94b3ef339cb0d6
---
sound/soc/meson/Kconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
index b93ea33739f2..48be62fa1136 100644
--- a/sound/soc/meson/Kconfig
+++ b/sound/soc/meson/Kconfig
@@ -70,6 +70,9 @@ config SND_MESON_AXG_SOUND_CARD
imply SND_MESON_AXG_PDM
imply SND_MESON_G12A_TOACODEC
imply SND_MESON_G12A_TOHDMITX if DRM_MESON_DW_HDMI
+ imply SND_MESON_G12A_TOACODEC
+ imply SND_SOC_MESON_T9015
+ imply SND_SOC_SIMPLE_AMPLIFIER
help
Select Y or M to add support for the AXG SoC sound card
--
2.25.1

View File

@@ -0,0 +1,183 @@
From 4b4a8e794d6f3af1a30c42b20f85a4c91a0149cd Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 16 Jun 2020 16:21:04 +0900
Subject: [PATCH 014/109] ODROID-N2: arm64: dts:add default sound card
'G12B-ODROID-N2'.
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: Ic289cb5de5a1f2f8f820f1a83327d7f3474fc2a2
---
.../boot/dts/amlogic/meson64_odroidn2.dts | 155 ++++++++++++++++++
1 file changed, 155 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
index 2bf16e7ac197..913b85baf6ea 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -6,8 +6,163 @@
/dts-v1/;
+#include <dt-bindings/clock/axg-audio-clkc.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+#include <dt-bindings/sound/meson-g12a-toacodec.h>
+#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
+#include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
+
#include "meson-g12b-odroid-n2.dts"
/ {
model = "Hardkernel ODROID-N2";
+
+ dio2133: audio-amplifier-0 {
+ compatible = "simple-audio-amplifier";
+ enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+ VCC-supply = <&vcc_5v>;
+ sound-name-prefix = "AMP";
+ };
+
+ spdif_dit: audio-codec-1 {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ status = "okay";
+ sound-name-prefix = "DIT";
+ };
+
+ sound {
+ compatible = "amlogic,axg-sound-card";
+ model = "G12B-ODROID-N2";
+ audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&dio2133>;
+ 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",
+ "TDMOUT_C IN 0", "FRDDR_A OUT 2",
+ "TDMOUT_C IN 1", "FRDDR_B OUT 2",
+ "TDMOUT_C IN 2", "FRDDR_C OUT 2",
+ "TDM_C Playback", "TDMOUT_C OUT",
+ "SPDIFOUT IN 0", "FRDDR_A OUT 3",
+ "SPDIFOUT IN 1", "FRDDR_B OUT 3",
+ "SPDIFOUT IN 2", "FRDDR_C OUT 3",
+ "AMP INL", "ACODEC LOLP",
+ "AMP INR", "ACODEC LORP";
+
+ assigned-clocks = <&clkc CLKID_HIFI_PLL>,
+ <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>;
+ assigned-clock-parents = <0>, <0>, <0>;
+ assigned-clock-rates = <589824000>,
+ <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>;
+ };
+ };
+
+ dai-link-4 {
+ sound-dai = <&tdmif_c>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-0 = <1 1>;
+ mclk-fs = <256>;
+
+ codec {
+ sound-dai = <&toacodec TOACODEC_IN_C>;
+ };
+ };
+
+ dai-link-5 {
+ sound-dai = <&spdifout>;
+
+ codec {
+ sound-dai = <&spdif_dit>;
+ };
+ };
+
+ dai-link-6 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+ codec {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+
+ dai-link-7 {
+ sound-dai = <&toacodec TOACODEC_OUT>;
+
+ codec {
+ sound-dai = <&acodec>;
+ };
+ };
+ };
+};
+
+&spdifout {
+ pinctrl-0 = <&spdif_out_a13_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&tdmif_b {
+ pinctrl-0 = <&mclk0_a_pins>, <&tdm_b_fs_pins>, <&tdm_b_sclk_pins>,
+ <&tdm_b_dout0_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ assigned-clocks = <&clkc_audio AUD_CLKID_TDM_MCLK_PAD0>,
+ <&clkc_audio AUD_CLKID_TDM_SCLK_PAD1>,
+ <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD1>;
+ assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
+ <&clkc_audio AUD_CLKID_MST_B_SCLK>,
+ <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
+ assigned-clock-rates = <0>, <0>, <0>;
+};
+
+&tdmif_c {
+ status = "okay";
+ assigned-clocks = <&clkc_audio AUD_CLKID_TDM_MCLK_PAD1>,
+ <&clkc_audio AUD_CLKID_TDM_SCLK_PAD2>,
+ <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD2>;
+ assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_C_MCLK>,
+ <&clkc_audio AUD_CLKID_MST_C_SCLK>,
+ <&clkc_audio AUD_CLKID_MST_C_LRCLK>;
+ assigned-clock-rates = <0>, <0>, <0>;
+};
+
+&tdmout_c {
+ status = "okay";
+};
+
+&acodec {
+ status = "okay";
+};
+
+&toacodec {
+ status = "okay";
};
--
2.25.1

View File

@@ -0,0 +1,44 @@
From 4ec49c152c6c347eed657f92d36421a77c9ec88a Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 8 Jul 2020 12:53:21 +0900
Subject: [PATCH 015/109] ODROID-N2PLUS: add new board 'ODROID-N2PLUS'
Change-Id: I40265ba32b9e34bf0be2bb0ce2784a3e8034adb4
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../boot/dts/amlogic/meson64_odroidn2_plus.dts | 13 +++++++++++++
2 files changed, 14 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 2fd90a311fae..6112beacefc8 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -53,3 +53,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2_plus.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
new file mode 100644
index 000000000000..061938ff870f
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
+ *
+ */
+
+/dts-v1/;
+
+#include "meson64_odroidn2.dts"
+
+/ {
+ model = "Hardkernel ODROID-N2Plus";
+};
--
2.25.1

View File

@@ -0,0 +1,139 @@
From 5c302fd398bbea1b5b110a0b6c1aeb331b7f0f3a Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Mon, 13 Jul 2020 11:44:52 +0900
Subject: [PATCH 016/109] ODROID-N2PLUS: arm64/dts: add cpu frequency table for
ODROID-N2PLUS
Change-Id: I6525f05da892e8047d62d87a47d4cca445c7159d
---
.../dts/amlogic/meson64_odroidn2_plus.dts | 116 ++++++++++++++++++
1 file changed, 116 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
index 061938ff870f..8dc68eee628d 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
@@ -11,3 +11,119 @@
/ {
model = "Hardkernel ODROID-N2Plus";
};
+
+&vddcpu_a {
+ regulator-min-microvolt = <680000>;
+ regulator-max-microvolt = <1040000>;
+
+ pwms = <&pwm_ab 0 1500 0>;
+};
+
+&vddcpu_b {
+ regulator-min-microvolt = <680000>;
+ regulator-max-microvolt = <1040000>;
+
+ pwms = <&pwm_AO_cd 1 1500 0>;
+};
+
+&cpu_opp_table_0 {
+ /delete-node/ opp-100000000;
+ /delete-node/ opp-250000000;
+ /delete-node/ opp-500000000;
+ /delete-node/ opp-667000000;
+ opp-1000000000 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <760000>;
+ };
+ opp-1200000000 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <780000>;
+ };
+ opp-1398000000 {
+ opp-hz = /bits/ 64 <1398000000>;
+ opp-microvolt = <810000>;
+ };
+ opp-1512000000 {
+ opp-hz = /bits/ 64 <1512000000>;
+ opp-microvolt = <860000>;
+ };
+ opp-1608000000 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <900000>;
+ };
+ opp-1704000000 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <960000>;
+ };
+ opp-1800000000 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <1020000>;
+ };
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <1030000>;
+ };
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1040000>;
+ };
+};
+
+&cpub_opp_table_1 {
+ /delete-node/ opp-100000000;
+ /delete-node/ opp-250000000;
+ /delete-node/ opp-500000000;
+ /delete-node/ opp-667000000;
+ opp-1000000000 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <730000>;
+ };
+ opp-1200000000 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <750000>;
+ };
+ opp-1398000000 {
+ opp-hz = /bits/ 64 <1398000000>;
+ opp-microvolt = <770000>;
+ };
+ opp-1512000000 {
+ opp-hz = /bits/ 64 <1512000000>;
+ opp-microvolt = <770000>;
+ };
+ opp-1608000000 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <780000>;
+ };
+ opp-1704000000 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <790000>;
+ };
+ opp-1800000000 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <830000>;
+ };
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <860000>;
+ };
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <910000>;
+ };
+ opp-2100000000 {
+ opp-hz = /bits/ 64 <2100000000>;
+ opp-microvolt = <960000>;
+ };
+ opp-2208000000 {
+ opp-hz = /bits/ 64 <2208000000>;
+ opp-microvolt = <1030000>;
+ };
+ opp-2304000000 {
+ opp-hz = /bits/ 64 <2304000000>;
+ opp-microvolt = <1030000>;
+ };
+ opp-2400000000 {
+ opp-hz = /bits/ 64 <2400000000>;
+ opp-microvolt = <1040000>;
+ };
+};
\ No newline at end of file
--
2.25.1

View File

@@ -0,0 +1,367 @@
From a28cee7b22890ce2e1c09652cade75fbd66a5eb1 Mon Sep 17 00:00:00 2001
From: Kevin Kim <ckkim@hardkernel.com>
Date: Wed, 16 Jan 2019 14:45:10 +0900
Subject: [PATCH 017/109] 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 | 253 ++++++++++++++++++
5 files changed, 292 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 9450e052f1b1..a70f9a1393a4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7460,6 +7460,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 9a4f66ae8070..d7e1cd668458 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 6374d3b1d6f3..5e511a88692a 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..ab421fb4b8ba
--- /dev/null
+++ b/drivers/pwm/pwm-gpio.c
@@ -0,0 +1,253 @@
+/*
+ * 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);
+ }
+
+ return pwmchip_remove(&gpio_chip->chip);
+}
+
+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.25.1

View File

@@ -0,0 +1,75 @@
From 32a068e44df50668cb8b9f1488527974cdb756fb Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 14 Jul 2020 11:44:33 +0900
Subject: [PATCH 018/109] ODROID-N2 :arm64/dts: add PWM based cooling fan
device
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I110778ba931405eef7d03ee3c764364590557b1c
---
.../boot/dts/amlogic/meson64_odroidn2.dts | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
index 913b85baf6ea..d7bbe52d92af 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -11,6 +11,7 @@
#include <dt-bindings/sound/meson-g12a-toacodec.h>
#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
#include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
+#include <dt-bindings/pwm/pwm.h>
#include "meson-g12b-odroid-n2.dts"
@@ -121,6 +122,47 @@ codec {
};
};
};
+
+ pwmgpio:pwmgpio {
+ compatible = "pwm-gpio";
+ #pwm-cells = <3>;
+ pwm-gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ };
+
+ pwmfan:pwm-fan {
+ compatible = "pwm-fan";
+ pwms = <&pwmgpio 0 40000 PWM_POLARITY_INVERTED>;
+ cooling-min-state = <0>;
+ cooling-max-state = <3>;
+ #cooling-cells = <2>;
+ cooling-levels = <0 120 170 220>;
+ };
+};
+
+&cpu_thermal {
+ trips {
+ fan_0: trip-point@0 {
+ temperature = <65000>;
+ hysteresis = <5000>;
+ type = "active";
+ };
+ fan_1: trip-point@1 {
+ temperature = <75000>;
+ hysteresis = <5000>;
+ type = "active";
+ };
+ };
+ cooling-maps {
+ fan_cooling_map0 {
+ trip = <&fan_0>;
+ cooling-device = <&pwmfan THERMAL_NO_LIMIT 2>;
+ };
+ fan_cooling_map1 {
+ trip = <&fan_1>;
+ cooling-device = <&pwmfan 2 THERMAL_NO_LIMIT>;
+ };
+ };
};
&spdifout {
--
2.25.1

View File

@@ -0,0 +1,50 @@
From 6e48c79be2f0ccddf11df2d24ca045ada9e13ba4 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 29 Jul 2020 04:05:03 +0900
Subject: [PATCH 019/109] ODROID-N2: drm/meson: Add YUV422 output support
This patch is to support YUV422 output from the Amlogic Meson SoC
VPU to the HDMI controller.
Change-Id: I03952f0592c7341585e518c3038877926a694329
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
drivers/gpu/drm/meson/meson_dw_hdmi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index aad75a22dc33..97d670081824 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -703,6 +703,7 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
static const u32 meson_dw_hdmi_out_bus_fmts[] = {
MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16,
MEDIA_BUS_FMT_UYYVYY8_0_5X24,
};
@@ -802,7 +803,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge,
if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) {
ycrcb_map = VPU_HDMI_OUTPUT_CRYCB;
yuv420_mode = true;
- }
+ } else if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16)
+ ycrcb_map = VPU_HDMI_OUTPUT_CRYCB;
/* VENC + VENC-DVI Mode setup */
meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, yuv420_mode, mode);
@@ -814,6 +816,10 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge,
/* Setup YUV420 to HDMI-TX, no 10bit diphering */
writel_relaxed(2 | (2 << 2),
priv->io_base + _REG(VPU_HDMI_FMT_CTRL));
+ else if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16)
+ /* Setup YUV422 to HDMI-TX, no 10bit diphering */
+ writel_relaxed(1 | (2 << 2),
+ priv->io_base + _REG(VPU_HDMI_FMT_CTRL));
else
/* Setup YUV444 to HDMI-TX, no 10bit diphering */
writel_relaxed(0, priv->io_base + _REG(VPU_HDMI_FMT_CTRL));
--
2.25.1

View File

@@ -0,0 +1,27 @@
From e81e1f2b93ffe9934105b082ffad5ae8408db87a Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Mon, 21 Oct 2019 10:58:47 +1030
Subject: [PATCH 020/109] ODROID-XU4: ARM: dma-mapping: increase DMA coherent
pool size to 2M
Change-Id: I8e3e7707ac182f3956f7415a80876b9d4c8ac771
---
arch/arm/mm/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c4b8df2ad328..b8f279e3b46b 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -315,7 +315,7 @@ static void *__alloc_remap_buffer(struct device *dev, size_t size, gfp_t gfp,
pgprot_t prot, struct page **ret_page,
const void *caller, bool want_vaddr);
-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M
static struct gen_pool *atomic_pool __ro_after_init;
static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE;
--
2.25.1

View File

@@ -0,0 +1,96 @@
From ccd58e3758edc64f8b817364da285a20837f30f9 Mon Sep 17 00:00:00 2001
From: Brian Kim <brian.kim@hardkernel.com>
Date: Thu, 5 Jan 2017 19:05:44 +0900
Subject: [PATCH 021/109] ODROID-XU4: drm/exynos/hdmi: add 'HPD' and 'vout' as
boot parameters
Change-Id: Ia3c94b0ee99e761a774ac63398ca86477b703b8c
Signed-off-by: Brian Kim <brian.kim@hardkernel.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 39 +++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 39fa5d3b01ef..ae4bae32b11d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -145,6 +145,33 @@ struct hdmi_context {
bool powered;
};
+static bool gdvi_mode = false;
+static bool gEnableHPD = true;
+
+static int __init dvi_force_enable(char *str)
+{
+ if (!strcmp(str, "dvi")) {
+ gdvi_mode = true;
+ pr_info("hdmi: using DVI mode\n");
+ } else {
+ gdvi_mode = false;
+ pr_info("hdmi: using HDMI mode\n");
+ }
+
+ return 0;
+}
+__setup("vout=", dvi_force_enable);
+
+static int __init hdmi_hpd_enable(char *str)
+{
+ if (!strcmp(str, "false")) {
+ gEnableHPD = false;
+ }
+
+ return 0;
+}
+__setup("HPD=", hdmi_hpd_enable);
+
static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
{
return container_of(e, struct hdmi_context, encoder);
@@ -854,6 +881,9 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
{
struct hdmi_context *hdata = connector_to_hdmi(connector);
+ if (!gEnableHPD)
+ return connector_status_connected;
+
if (gpiod_get_value(hdata->hpd_gpio))
return connector_status_connected;
@@ -893,7 +923,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
if (!edid)
return -ENODEV;
- hdata->dvi_mode = !drm_detect_hdmi_monitor(edid);
+ if (gdvi_mode)
+ hdata->dvi_mode = true;
+ else
+ hdata->dvi_mode = !drm_detect_hdmi_monitor(edid);
DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n",
(hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
edid->width_cm, edid->height_cm);
@@ -1590,6 +1623,9 @@ static int hdmi_audio_hw_params(struct device *dev, void *data,
{
struct hdmi_context *hdata = dev_get_drvdata(dev);
+ if (hdata->dvi_mode)
+ return 0;
+
if (daifmt->fmt != HDMI_I2S || daifmt->bit_clk_inv ||
daifmt->frame_clk_inv || daifmt->bit_clk_master ||
daifmt->frame_clk_master) {
@@ -1966,6 +2002,7 @@ static int hdmi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hdata);
hdata->dev = dev;
+ hdata->dvi_mode = gdvi_mode;
mutex_init(&hdata->mutex);
--
2.25.1

View File

@@ -0,0 +1,66 @@
From d2f42d7f124fd359ca61bbe7a8e34c57f8cc46a4 Mon Sep 17 00:00:00 2001
From: OtherCrashOverride <OtherCrashOverride@users.noreply.github.com>
Date: Sun, 9 Apr 2017 17:31:25 +0000
Subject: [PATCH 023/109] ODROID-XU4: drm/exynos/mixer: never blend the base
layer
On Exynos there is a solid color plane that is logically below all the other display planes.
This causes display artifacts due to alpha. The patch disables blending the base plane with
the solid color plane (no alpha).
Change-Id: Ibb2ada1d7a7be156d2f05ed477ee5972d63edd98
Reviewed-by: memeka <mihailescu2m@gmail.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/gpu/drm/exynos/exynos_mixer.c | 33 +++++++++++++++------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index af192e5a16ef..c95229c1d335 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -315,23 +315,26 @@ static void mixer_cfg_gfx_blend(struct mixer_context *ctx, unsigned int win,
u32 val;
val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */
- switch (pixel_alpha) {
- case DRM_MODE_BLEND_PIXEL_NONE:
- break;
- case DRM_MODE_BLEND_COVERAGE:
- val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
- break;
- case DRM_MODE_BLEND_PREMULTI:
- default:
- val |= MXR_GRP_CFG_BLEND_PRE_MUL;
- val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
- break;
- }
+ if (win) {
+ switch (pixel_alpha) {
+ case DRM_MODE_BLEND_PIXEL_NONE:
+ break;
+ case DRM_MODE_BLEND_COVERAGE:
+ val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+ break;
+ case DRM_MODE_BLEND_PREMULTI:
+ default:
+ val |= MXR_GRP_CFG_BLEND_PRE_MUL;
+ val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+ break;
+ }
- if (alpha != DRM_BLEND_ALPHA_OPAQUE) {
- val |= MXR_GRP_CFG_WIN_BLEND_EN;
- val |= win_alpha;
+ if (alpha != DRM_BLEND_ALPHA_OPAQUE) {
+ val |= MXR_GRP_CFG_WIN_BLEND_EN;
+ val |= win_alpha;
+ }
}
+
mixer_reg_writemask(ctx, MXR_GRAPHIC_CFG(win),
val, MXR_GRP_CFG_MISC_MASK);
}
--
2.25.1

View File

@@ -0,0 +1,113 @@
From 40ae76853f961fed1a668dbed547febcbaf3adf1 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Thu, 24 Jan 2019 16:07:24 +1030
Subject: [PATCH 024/109] ODROID-XU4: media: s5p-jpeg: Enable decoding with
multiple buffers
Change-Id: Ia83449849d4636baf57ed64d7183c2a9cec7fe22
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/media/platform/s5p-jpeg/jpeg-core.c | 45 ++++++++++++++++-----
1 file changed, 35 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 026111505f5a..93dc289d6fa7 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1785,6 +1785,31 @@ static int exynos3250_jpeg_try_crop(struct s5p_jpeg_ctx *ctx,
* V4L2 controls
*/
+static int vidioc_decoder_cmd(struct file *file, void *priv,
+ struct v4l2_decoder_cmd *cmd)
+{
+ struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
+ struct vb2_queue *vq_src = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+ struct vb2_v4l2_buffer *buf;
+
+ switch (cmd->cmd) {
+ case V4L2_DEC_CMD_STOP:
+ if (cmd->flags != 0)
+ return -EINVAL;
+ if (!vb2_is_streaming(vq_src))
+ return -EINVAL;
+
+ buf = v4l2_m2m_last_src_buf(ctx->fh.m2m_ctx);
+ buf->flags |= V4L2_BUF_FLAG_LAST;
+
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int s5p_jpeg_g_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{
@@ -1819,9 +1844,6 @@ static int s5p_jpeg_g_selection(struct file *file, void *priv,
return 0;
}
-/*
- * V4L2 controls
- */
static int s5p_jpeg_s_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{
@@ -2013,6 +2035,8 @@ static const struct v4l2_ioctl_ops s5p_jpeg_ioctl_ops = {
.vidioc_streamon = v4l2_m2m_ioctl_streamon,
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
+ .vidioc_decoder_cmd = vidioc_decoder_cmd,
+
.vidioc_g_selection = s5p_jpeg_g_selection,
.vidioc_s_selection = s5p_jpeg_s_selection,
@@ -2459,13 +2483,6 @@ static int s5p_jpeg_queue_setup(struct vb2_queue *vq,
size = q_data->size;
- /*
- * header is parsed during decoding and parsed information stored
- * in the context so we do not allow another buffer to overwrite it
- */
- if (ctx->mode == S5P_JPEG_DECODE)
- count = 1;
-
*nbuffers = count;
*nplanes = 1;
sizes[0] = size;
@@ -2576,6 +2593,7 @@ static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count)
static void s5p_jpeg_stop_streaming(struct vb2_queue *q)
{
struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q);
+ struct vb2_v4l2_buffer *buf;
/*
* STREAMOFF is an acknowledgment for resolution change event.
@@ -2588,6 +2606,11 @@ static void s5p_jpeg_stop_streaming(struct vb2_queue *q)
ctx->state = JPEGCTX_RUNNING;
}
+ while ((buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx)))
+ v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR);
+ while ((buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx)))
+ v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR);
+
pm_runtime_put(ctx->jpeg->dev);
}
@@ -2827,6 +2850,8 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id)
v4l2_m2m_buf_done(src_buf, state);
if (curr_ctx->mode == S5P_JPEG_ENCODE)
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload_size);
+ if (src_buf->flags & V4L2_BUF_FLAG_LAST)
+ dst_buf->flags |= V4L2_BUF_FLAG_LAST;
v4l2_m2m_buf_done(dst_buf, state);
curr_ctx->subsampling =
--
2.25.1

View File

@@ -0,0 +1,30 @@
From 6e231340a87c62768126af4eb77a0c4e719ee553 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Tue, 10 Jul 2018 11:24:56 +0930
Subject: [PATCH 025/109] ODROID-XU4: media: exynos-gsc: fix v4l2 SELECTION api
Change-Id: Ida63e217cd989d661b7620d390515c0ffcb830ac
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/media/platform/exynos-gsc/gsc-core.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h b/drivers/media/platform/exynos-gsc/gsc-core.h
index 8e5a9acb78aa..235d687614f0 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/exynos-gsc/gsc-core.h
@@ -474,9 +474,9 @@ static inline struct gsc_frame *ctx_get_frame(struct gsc_ctx *ctx,
{
struct gsc_frame *frame;
- if (V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE == type) {
+ if (V4L2_BUF_TYPE_VIDEO_OUTPUT == type || V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE == type) {
frame = &ctx->s_frame;
- } else if (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE == type) {
+ } else if (V4L2_BUF_TYPE_VIDEO_CAPTURE == type || V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE == type) {
frame = &ctx->d_frame;
} else {
pr_err("Wrong buffer/video queue type (%d)", type);
--
2.25.1

View File

@@ -0,0 +1,82 @@
From b23fc68b8c0603069b5719bbfffd8de958493d11 Mon Sep 17 00:00:00 2001
From: Thierry Escande <thierry.escande@collabora.com>
Date: Wed, 26 Oct 2016 10:52:05 +0200
Subject: [PATCH 026/109] ODROID-XU4: videobuf2-dc: Move vb2_dc_get_base_sgt()
above mmap callbacks
This patch moves vb2_dc_get_base_sgt() function above mmap buffers
callbacks, particularly vb2_dc_alloc() and vb2_dc_mmap() from where it
will be called for cacheable MMAP support introduced in the next patch.
Change-Id: Ia504fbc1f0b3741986e8fff1ad329215b6e2db2e
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
.../common/videobuf2/videobuf2-dma-contig.c | 44 +++++++++----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index a7f61ba85440..6298b4f23a29 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -62,6 +62,28 @@ static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
return size;
}
+static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
+{
+ int ret;
+ struct sg_table *sgt;
+
+ sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
+ if (!sgt) {
+ dev_err(buf->dev, "failed to alloc sg table\n");
+ return NULL;
+ }
+
+ ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
+ buf->size, buf->attrs);
+ if (ret < 0) {
+ dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
+ kfree(sgt);
+ return NULL;
+ }
+
+ return sgt;
+}
+
/*********************************************/
/* callbacks for all buffers */
/*********************************************/
@@ -375,28 +397,6 @@ static const struct dma_buf_ops vb2_dc_dmabuf_ops = {
.release = vb2_dc_dmabuf_ops_release,
};
-static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
-{
- int ret;
- struct sg_table *sgt;
-
- sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
- if (!sgt) {
- dev_err(buf->dev, "failed to alloc sg table\n");
- return NULL;
- }
-
- ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
- buf->size, buf->attrs);
- if (ret < 0) {
- dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
- kfree(sgt);
- return NULL;
- }
-
- return sgt;
-}
-
static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags)
{
struct vb2_dc_buf *buf = buf_priv;
--
2.25.1

View File

@@ -0,0 +1,37 @@
From a373b7b29fa44731e43ded7e16312f6e9ba41985 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Mon, 30 Oct 2017 09:31:09 +1030
Subject: [PATCH 027/109] ODROID-XU4: media: s5p-mfc: use cacheable DMA buffers
to improve performance
Change-Id: I2054a87278e545515be927ddcc52f52991224a6e
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index eba2b9f040df..37f2113a00ec 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -858,7 +858,7 @@ static int s5p_mfc_open(struct file *file)
* We'll do mostly sequential access, so sacrifice TLB efficiency for
* faster allocation.
*/
- q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES;
+ q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
ret = vb2_queue_init(q);
@@ -893,7 +893,7 @@ static int s5p_mfc_open(struct file *file)
* We'll do mostly sequential access, so sacrifice TLB efficiency for
* faster allocation.
*/
- q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES;
+ q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
ret = vb2_queue_init(q);
--
2.25.1

View File

@@ -0,0 +1,53 @@
From 609c12e0dfc3ce6c0eb6d4b13291751393ae84b9 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Tue, 10 Jul 2018 22:01:38 +0930
Subject: [PATCH 028/109] ODROID-XU4: media: s5p-mfc: copy timestamp and
timecode in encoder output
Change-Id: Ic3a2f6eb94d60604df50976eca4e210898f40b32
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 1fad99edb091..4a992f6b931c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -1214,6 +1214,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
{
struct s5p_mfc_dev *dev = ctx->dev;
struct s5p_mfc_buf *mb_entry;
+ struct s5p_mfc_buf *dst_buf;
unsigned long enc_y_addr = 0, enc_c_addr = 0;
unsigned long mb_y_addr, mb_c_addr;
int slice_type;
@@ -1233,8 +1234,12 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
&mb_entry->b->vb2_buf, 0);
mb_c_addr = vb2_dma_contig_plane_dma_addr(
&mb_entry->b->vb2_buf, 1);
+ dst_buf = list_entry(ctx->dst_queue.next,
+ struct s5p_mfc_buf, list);
if ((enc_y_addr == mb_y_addr) &&
(enc_c_addr == mb_c_addr)) {
+ dst_buf->b->timecode = mb_entry->b->timecode;
+ dst_buf->b->vb2_buf.timestamp = mb_entry->b->vb2_buf.timestamp;
list_del(&mb_entry->list);
ctx->src_queue_cnt--;
vb2_buffer_done(&mb_entry->b->vb2_buf,
@@ -1247,8 +1252,12 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
&mb_entry->b->vb2_buf, 0);
mb_c_addr = vb2_dma_contig_plane_dma_addr(
&mb_entry->b->vb2_buf, 1);
+ dst_buf = list_entry(ctx->dst_queue.next,
+ struct s5p_mfc_buf, list);
if ((enc_y_addr == mb_y_addr) &&
(enc_c_addr == mb_c_addr)) {
+ dst_buf->b->timecode = mb_entry->b->timecode;
+ dst_buf->b->vb2_buf.timestamp = mb_entry->b->vb2_buf.timestamp;
list_del(&mb_entry->list);
ctx->ref_queue_cnt--;
vb2_buffer_done(&mb_entry->b->vb2_buf,
--
2.25.1

View File

@@ -0,0 +1,33 @@
From bc13aa122359eca7b7e2f4fa71d2f13994db3117 Mon Sep 17 00:00:00 2001
From: OtherCrashOverride <OtherCrashOverride@users.noreply.github.com>
Date: Fri, 19 May 2017 12:59:51 +0000
Subject: [PATCH 029/109] ODROID-XU4: media: s5p-mfc: stop streaming before
releasing queues
If streaming is active when the MFC device is closed, it will generate an IOMMU page-fault.
Change-Id: Ie5c664ecddaebedf282eae1d56e82821b5883ffd
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/media/platform/s5p-mfc/s5p_mfc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 37f2113a00ec..8c39528be39e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -941,6 +941,11 @@ static int s5p_mfc_release(struct file *file)
mfc_debug_enter();
if (dev)
mutex_lock(&dev->mfc_mutex);
+
+ /* stop streaming */
+ vb2_streamoff(&ctx->vq_src, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+ vb2_streamoff(&ctx->vq_dst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+
vb2_queue_release(&ctx->vq_src);
vb2_queue_release(&ctx->vq_dst);
if (dev) {
--
2.25.1

View File

@@ -0,0 +1,51 @@
From 6365da91ca9b08baabe09bfac2803edbc73d3843 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Tue, 10 Jul 2018 22:13:03 +0930
Subject: [PATCH 030/109] ODROID-XU4: thermal: exynos: add support for 8 trip
points on Exynos5422 TMU
Change-Id: I6014d6d3fdecb6f58c6160f79ac969c6816f365d
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/thermal/samsung/exynos_tmu.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index e9a90bc23b11..b49df21fa0e7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -915,8 +915,6 @@ static int exynos_map_dt_data(struct platform_device *pdev)
case SOC_ARCH_EXYNOS4412:
case SOC_ARCH_EXYNOS5250:
case SOC_ARCH_EXYNOS5260:
- case SOC_ARCH_EXYNOS5420:
- case SOC_ARCH_EXYNOS5420_TRIMINFO:
data->tmu_set_trip_temp = exynos4412_tmu_set_trip_temp;
data->tmu_set_trip_hyst = exynos4412_tmu_set_trip_hyst;
data->tmu_initialize = exynos4412_tmu_initialize;
@@ -935,6 +933,22 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->min_efuse_value = 0;
data->max_efuse_value = 100;
break;
+ case SOC_ARCH_EXYNOS5420:
+ case SOC_ARCH_EXYNOS5420_TRIMINFO:
+ data->tmu_set_trip_temp = exynos4412_tmu_set_trip_temp;
+ data->tmu_set_trip_hyst = exynos4412_tmu_set_trip_hyst;
+ data->tmu_initialize = exynos4412_tmu_initialize;
+ data->tmu_control = exynos4210_tmu_control;
+ data->tmu_read = exynos4412_tmu_read;
+ data->tmu_set_emulation = exynos4412_tmu_set_emulation;
+ data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+ data->ntrip = 8;
+ data->gain = 8;
+ data->reference_voltage = 16;
+ data->efuse_value = 55;
+ data->min_efuse_value = 16;
+ data->max_efuse_value = 76;
+ break;
case SOC_ARCH_EXYNOS5433:
data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp;
data->tmu_set_trip_hyst = exynos5433_tmu_set_trip_hyst;
--
2.25.1

View File

@@ -0,0 +1,47 @@
From 7d7e4e7604ef068f5b9d9802ad3320ef5c50fbb5 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Tue, 22 Jan 2019 11:55:07 +1030
Subject: [PATCH 031/109] ODROID-XU4: arm: dts: exynos5422: enable Exynos5422
TMU
Change-Id: I3fb73f0f9a2f349fc667354a607c50ffefa7084e
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
arch/arm/boot/dts/exynos5422-odroid-core.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
index 6d690b1db099..e7505f46605b 100644
--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
@@ -1024,22 +1024,27 @@ &ppmu_dmc1_1 {
&tmu_cpu0 {
vtmu-supply = <&ldo7_reg>;
+ status = "okay";
};
&tmu_cpu1 {
vtmu-supply = <&ldo7_reg>;
+ status = "okay";
};
&tmu_cpu2 {
vtmu-supply = <&ldo7_reg>;
+ status = "okay";
};
&tmu_cpu3 {
vtmu-supply = <&ldo7_reg>;
+ status = "okay";
};
&tmu_gpu {
vtmu-supply = <&ldo7_reg>;
+ status = "okay";
};
&gpu {
--
2.25.1

View File

@@ -0,0 +1,36 @@
From 4f5cc439e7d6fc008d44fd1a075435fe78cbcaaf Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Tue, 10 Sep 2019 14:36:18 +0200
Subject: [PATCH 032/109] ODROID-XU4: ARM: dts: Add samsung,asv-bin property
for odroidxu3-lite
The Exynos5422 SoC used on Odroid XU3 Lite boards belongs to
a special ASV bin but this information cannot be read from the
CHIPID block registers. Add samsung,asv-bin property for XU3
Lite to ensure the ASV bin is properly determined.
Change-Id: I6e977b9cf0829be7ffff5aa84d7ee6b3e65b49cd
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts b/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
index 62c5928aa994..048b37d456e5 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
@@ -92,6 +92,10 @@ &cpu3_cooling_map4 {
<&cpu7 3 12>;
};
+&chipid {
+ samsung,asv-bin = <2>;
+};
+
&pwm {
/*
* PWM 0 -- fan
--
2.25.1

View File

@@ -0,0 +1,69 @@
From 8bd95f6bef334128a20d0386e672725d2ad5fd5d Mon Sep 17 00:00:00 2001
From: "k.konieczny@partner.samsung.com" <k.konieczny@partner.samsung.com>
Date: Tue, 8 Oct 2019 15:49:23 +0200
Subject: [PATCH 033/109] ODROID-XU4: devfreq: exynos-bus: workaround
dev_pm_opp_set_rate() errors on Exynos5422/5800 SoCs
Commit 4294a779bd8d ("PM / devfreq: exynos-bus: Convert to use
dev_pm_opp_set_rate()") introduced errors:
exynos-bus: new bus device registered: soc:bus_wcore ( 84000 KHz ~ 400000 KHz)
exynos-bus: new bus device registered: soc:bus_noc ( 67000 KHz ~ 100000 KHz)
exynos-bus: new bus device registered: soc:bus_fsys_apb (100000 KHz ~ 200000 KHz)
...
exynos-bus soc:bus_wcore: dev_pm_opp_set_rate: failed to find current OPP for freq 532000000 (-34)
exynos-bus soc:bus_noc: dev_pm_opp_set_rate: failed to find current OPP for freq 111000000 (-34)
exynos-bus soc:bus_fsys_apb: dev_pm_opp_set_rate: failed to find current OPP for freq 222000000 (-34)
They are caused by incorrect PLL assigned to clock source, which results
in clock rate outside of OPP range. Add workaround for this in
exynos_bus_parse_of() by adjusting clock rate to those present in OPP.
Fixes: 4294a779bd8d ("PM / devfreq: exynos-bus: Convert to use dev_pm_opp_set_rate()")
Change-Id: Ic07e2d68e0da2efa07cb81cc9b4f76d8ad15bd76
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
---
drivers/devfreq/exynos-bus.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index e689101abc93..061f36c00dd4 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -247,7 +247,7 @@ static int exynos_bus_parse_of(struct device_node *np,
{
struct device *dev = bus->dev;
struct dev_pm_opp *opp;
- unsigned long rate;
+ unsigned long rate, opp_rate;
int ret;
/* Get the clock to provide each bus with source clock */
@@ -271,13 +271,21 @@ static int exynos_bus_parse_of(struct device_node *np,
}
rate = clk_get_rate(bus->clk);
-
- opp = devfreq_recommended_opp(dev, &rate, 0);
+ opp_rate = rate;
+ opp = devfreq_recommended_opp(dev, &opp_rate, 0);
if (IS_ERR(opp)) {
dev_err(dev, "failed to find dev_pm_opp\n");
ret = PTR_ERR(opp);
goto err_opp;
}
+ /*
+ * FIXME: U-boot leaves clock source at incorrect PLL, this results
+ * in clock rate outside defined OPP rate. Work around this bug by
+ * setting clock rate to recommended one.
+ */
+ if (rate > opp_rate)
+ clk_set_rate(bus->clk, opp_rate);
+
bus->curr_freq = dev_pm_opp_get_freq(opp);
dev_pm_opp_put(opp);
--
2.25.1

View File

@@ -0,0 +1,75 @@
From 8a552e21a0996be6e4376bb3ea8506a68ec4aa0d Mon Sep 17 00:00:00 2001
From: Anand Moon <moon.linux@yahoo.com>
Date: Sun, 12 Jul 2015 18:41:20 +0530
Subject: [PATCH 034/109] ODROID-XU4: regulator: s2mps11: call shutdown
function to poweroff
Added .shutdown function to s2mps11 to help poweroff the board successfully.
The device driver clears the register to turn off the PMIC.
s2mps11-pmic: S2MPS11_REG_CTRL1 reg value 16:00000000000000000000000000010000
Console log.
* Unmounting temporary filesystems... [ OK ]
* Deactivating swap... [ OK ]
* Unmounting local filesystems... [ OK ]
* Will now halt
[ 209.020280] reboot: Power down
[ 209.122039] Power down failed, please power off system manually.
Change-Id: If6ea0dec154b00ceeaaddbac393c67dc35c26279
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
Signed-off-by: Marian Mihailescu <mihailescu2m@gmail.com>
---
drivers/regulator/s2mps11.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 33cf84bce05a..f1ade60ee8d3 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1243,6 +1243,31 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
return ret;
}
+static void s2mps11_pmic_shutdown(struct platform_device *pdev)
+{
+ struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+ unsigned int reg_val, ret;
+
+ ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_CTRL1, &reg_val);
+ if (ret < 0) {
+ dev_crit(&pdev->dev, "could not read S2MPS11_REG_CTRL1 value\n");
+ } else {
+ /*
+ * s2mps11-pmic: S2MPS11_REG_CTRL1 reg value
+ * is 00000000000000000000000000010000
+ * clear the S2MPS11_REG_CTRL1 0x10 value to shutdown.
+ */
+ if (reg_val & BIT(4)) {
+ ret = regmap_update_bits(iodev->regmap_pmic,
+ S2MPS11_REG_CTRL1,
+ BIT(4), BIT(0));
+ if (ret)
+ dev_crit(&pdev->dev,
+ "could not write S2MPS11_REG_CTRL1 value\n");
+ }
+ }
+}
+
static const struct platform_device_id s2mps11_pmic_id[] = {
{ "s2mps11-regulator", S2MPS11X},
{ "s2mps13-regulator", S2MPS13X},
@@ -1258,6 +1283,7 @@ static struct platform_driver s2mps11_pmic_driver = {
.name = "s2mps11-pmic",
},
.probe = s2mps11_pmic_probe,
+ .shutdown = s2mps11_pmic_shutdown,
.id_table = s2mps11_pmic_id,
};
--
2.25.1

View File

@@ -0,0 +1,92 @@
From b53d48cb8cb076824690d3d4fb69822cf5f38ef2 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Fri, 18 Jan 2019 14:36:21 +1030
Subject: [PATCH 035/109] ODROID-XU4: regulator: s2mps11: add ethernet power
reset in shutdown function
Ethernet device cannot be detected on warm boot sometimes. This patch is
to add the power reset routines for ethernet device using PMIC. Then
ethernet device can be reset hardware-wise.
Change-Id: Iffbe2966da7e4679f63b91ab79241167391792df
Signed-off-by: Brian Kim <brian.kim@hardkernel.com>
Signed-off-by: Marian Mihailescu <mihailescu2m@gmail.com>
---
drivers/regulator/s2mps11.c | 54 +++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index f1ade60ee8d3..f4c62c1c4e82 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1117,6 +1117,57 @@ static const struct regulator_desc s2mpu02_regulators[] = {
regulator_desc_s2mpu02_buck7(7),
};
+static int s2mps11_pmic_ethonoff(struct platform_device *pdev, bool onoff)
+{
+ struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+ unsigned int reg_val = 0;
+ int ret = 0;
+
+ ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, &reg_val);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to read S2MPS11_REG_L15CTRL value\n");
+ return ret;
+ }
+
+ ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, &reg_val);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to read S2MPS11_REG_L17CTRL value\n");
+ return ret;
+ }
+
+ if (onoff) {
+ /* ETH VDD0 ON */
+ ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, 0xFF, 0x72);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL15 register\n");
+ return ret;
+ }
+
+ /* ETH VDD1 ON */
+ ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, 0xFF, 0x72);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL17 register\n");
+ return ret;
+ }
+ } else {
+ /* ETH VDD0 OFF */
+ ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, 0x3F, 0x00);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL15 register\n");
+ return ret;
+ }
+
+ /* ETH VDD1 OFF */
+ ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, 0x3F, 0x00);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL17 register\n");
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
static int s2mps11_pmic_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
@@ -1266,6 +1317,9 @@ static void s2mps11_pmic_shutdown(struct platform_device *pdev)
"could not write S2MPS11_REG_CTRL1 value\n");
}
}
+ s2mps11_pmic_ethonoff(pdev, false);
+ mdelay(10);
+ s2mps11_pmic_ethonoff(pdev, true);
}
static const struct platform_device_id s2mps11_pmic_id[] = {
--
2.25.1

View File

@@ -0,0 +1,26 @@
From 12bcf16b29849d4ef1873c270272bde0ed44104b Mon Sep 17 00:00:00 2001
From: Marian Mihailescu <mihailescu2m@gmail.com>
Date: Thu, 14 Nov 2019 12:19:37 +1030
Subject: [PATCH 036/109] ODROID-XU4: fix eMMC clock settings
Change-Id: Ifa5b2f4730d96071f11931f4719c86c624f60194
---
drivers/mmc/host/dw_mmc-exynos.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/dw_mmc-exynos.h b/drivers/mmc/host/dw_mmc-exynos.h
index 0280d394a32a..7088e39de5d2 100644
--- a/drivers/mmc/host/dw_mmc-exynos.h
+++ b/drivers/mmc/host/dw_mmc-exynos.h
@@ -61,7 +61,7 @@
/* Fixed clock divider */
#define EXYNOS4210_FIXED_CIU_CLK_DIV 2
#define EXYNOS4412_FIXED_CIU_CLK_DIV 4
-#define HS400_FIXED_CIU_CLK_DIV 1
+#define HS400_FIXED_CIU_CLK_DIV 2
/* Minimal required clock frequency for cclkin, unit: HZ */
#define EXYNOS_CCLKIN_MIN 50000000
--
2.25.1

View File

@@ -0,0 +1,35 @@
From 59557a1fe423dd1d6ba7d2080a00780ffc147dbc Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 7 Nov 2019 10:58:33 +0900
Subject: [PATCH 039/109] ODROID-XU4: dts: Add i2c-1, i2c-5 nodes
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Ibd89677ca9dcc165b305488b9c1e106f4e53eba6
---
arch/arm/boot/dts/exynos5422-odroidxu4.dts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
index ede782257643..c953346dfabc 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
@@ -90,3 +90,16 @@ &pwm {
&usbdrd_dwc3_1 {
dr_mode = "host";
};
+
+/* i2c@12C70000 */
+&i2c_1 {
+ status = "okay";
+ samsung,i2c-max-bus-freq = <400000>;
+};
+
+/* i2c@12cb0000 */
+&hsi2c_5 {
+ status = "okay";
+ samsung,hs-mode;
+ clock-frequency = <400000>;
+};
--
2.25.1

View File

@@ -0,0 +1,63 @@
From 6c46208e3ec462d67912388b31579385b2566846 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 14 Nov 2019 13:45:22 +0900
Subject: [PATCH 040/109] ODROID-XU4: Add support for SPI1 on the 40 pin header
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I0b1d16b0f445838509eeb0cc8093239fa1805605
---
arch/arm/boot/dts/exynos5422-odroidxu4.dts | 20 ++++++++++++++++++++
drivers/spi/spidev.c | 2 ++
2 files changed, 22 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
index c953346dfabc..297df752199e 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
@@ -11,6 +11,7 @@
/dts-v1/;
#include <dt-bindings/sound/samsung-i2s.h>
#include "exynos5422-odroidxu3-common.dtsi"
+#include <dt-bindings/gpio/gpio.h>
/ {
model = "Hardkernel Odroid XU4";
@@ -103,3 +104,22 @@ &hsi2c_5 {
samsung,hs-mode;
clock-frequency = <400000>;
};
+
+&spi_1 {
+ status = "okay";
+ samsung,spi-src-clk = <0>;
+ num-cs = <2>;
+ cs-gpios = <&gpa2 5 GPIO_ACTIVE_HIGH>, <&gpx2 1 GPIO_ACTIVE_HIGH>;
+
+ spidev: spidev@0 {
+ status = "okay";
+ reg = <0>;
+ compatible = "odroid,spidev";
+ spi-max-frequency = <1000000>;
+
+ controller-data {
+ cs-gpio = <&gpa2 5 GPIO_ACTIVE_HIGH>;
+ samsung,spi-feedback-delay = <0>;
+ };
+ };
+};
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 8cb4d923aeaa..c177bba9c5bc 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -683,6 +683,8 @@ static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "dh,dhcom-board" },
{ .compatible = "menlo,m53cpld" },
{ .compatible = "cisco,spi-petra" },
+ /* ODROID Modification */
+ { .compatible = "odroid,spidev" },
{},
};
MODULE_DEVICE_TABLE(of, spidev_dt_ids);
--
2.25.1

View File

@@ -0,0 +1,343 @@
From 20db6052315208afee409c2f02ed672dbef7d39f Mon Sep 17 00:00:00 2001
From: Brian Kim <brian.kim@hardkernel.com>
Date: Tue, 10 Jan 2017 11:31:52 +0900
Subject: [PATCH 041/109] ODROID-XU4: char: exynos: add /dev/gpiomem device for
rootless user GPIO access
Signed-off-by: memeka <mihailescu2m@gmail.com>
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Ia6b9596501223037ee3be3587d720f74a2494380
---
.../boot/dts/exynos5422-odroidxu3-common.dtsi | 7 +
drivers/char/Kconfig | 9 +
drivers/char/Makefile | 1 +
drivers/char/exynos-gpiomem.c | 270 ++++++++++++++++++
4 files changed, 287 insertions(+)
create mode 100644 drivers/char/exynos-gpiomem.c
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
index e35af40a55cb..f218eb44da34 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
@@ -34,6 +34,13 @@ power-key {
};
};
+ gpiomem {
+ compatible = "samsung,exynos-gpiomem";
+ reg = <0x13400000 0x1000>,
+ <0x14010000 0x1000>;
+ status = "okay";
+ };
+
emmc_pwrseq: pwrseq {
pinctrl-0 = <&emmc_nrst_pin>;
pinctrl-names = "default";
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index d229a2d0c017..530d3af84aa8 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -471,6 +471,15 @@ config ADI
and SSM (Silicon Secured Memory). Intended consumers of this
driver include crash and makedumpfile.
+config EXYNOS_GPIOMEM
+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the EXYNOS"
+ default m
+ help
+ Provides users with root-free access to the GPIO registers
+ on EXYNOS. Calling mmap(/dev/gpiomem) will map the GPIO register
+ page to the user's pointer. This drvier can allow to access gpio
+ memory area in user account.
+
endmenu
config RANDOM_TRUST_CPU
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index ffce287ef415..923df22cf799 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -47,3 +47,4 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o
obj-$(CONFIG_XILLYBUS) += xillybus/
obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
obj-$(CONFIG_ADI) += adi.o
+obj-$(CONFIG_EXYNOS_GPIOMEM) += exynos-gpiomem.o
diff --git a/drivers/char/exynos-gpiomem.c b/drivers/char/exynos-gpiomem.c
new file mode 100644
index 000000000000..5dd684d48ffc
--- /dev/null
+++ b/drivers/char/exynos-gpiomem.c
@@ -0,0 +1,270 @@
+/*
+ * linux/drivers/char/exynos-gpiomem.c
+ *
+ * GPIO memory device driver
+ *
+ * Creates a chardev /dev/gpiomem which will provide user access to
+ * the EXYNOS's GPIO registers when it is mmap()'d.
+ * No longer need root for user GPIO access, but without relaxing permissions
+ * on /dev/mem.
+ *
+ * Copyright (c) 2017 Hardkernel Co., Ltd.
+ *
+ * This driver is based on bcm2835-gpiomem.c in Raspberrypi's linux kernel 4.4:
+ * Written by Luke Wren <luke@raspberrypi.org>
+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The names of the above-listed copyright holders may not be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2, as published by the Free
+ * Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/cdev.h>
+#include <linux/pagemap.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <asm/io.h>
+
+#define DEVICE_NAME "exynos-gpiomem"
+#define DRIVER_NAME "gpiomem-exynos"
+#define DEVICE_MINOR 0
+
+struct exynos_gpiomem_instance {
+ unsigned long gpio_regs_phys[32];
+ int gpio_area_count;
+ struct device *dev;
+};
+
+static struct cdev exynos_gpiomem_cdev;
+static dev_t exynos_gpiomem_devid;
+static struct class *exynos_gpiomem_class;
+static struct device *exynos_gpiomem_dev;
+static struct exynos_gpiomem_instance *inst;
+
+static int exynos_gpiomem_open(struct inode *inode, struct file *file)
+{
+ int dev = iminor(inode);
+ int ret = 0;
+
+ dev_info(inst->dev, "gpiomem device opened.");
+
+ if (dev != DEVICE_MINOR) {
+ dev_err(inst->dev, "Unknown minor device: %d", dev);
+ ret = -ENXIO;
+ }
+ return ret;
+}
+
+static int exynos_gpiomem_release(struct inode *inode, struct file *file)
+{
+ int dev = iminor(inode);
+ int ret = 0;
+
+ if (dev != DEVICE_MINOR) {
+ dev_err(inst->dev, "Unknown minor device %d", dev);
+ ret = -ENXIO;
+ }
+ return ret;
+}
+
+static const struct vm_operations_struct exynos_gpiomem_vm_ops = {
+#ifdef CONFIG_HAVE_IOREMAP_PROT
+ .access = generic_access_phys
+#endif
+};
+
+static int exynos_gpiomem_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ int gpio_area = 0;
+
+ while (gpio_area < inst->gpio_area_count) {
+ if ((inst->gpio_regs_phys[gpio_area] >> PAGE_SHIFT) == vma->vm_pgoff)
+ goto found;
+
+ gpio_area++;
+ }
+
+ return -EACCES;
+
+found:
+ vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
+ PAGE_SIZE,
+ vma->vm_page_prot);
+
+ vma->vm_ops = &exynos_gpiomem_vm_ops;
+
+ if (remap_pfn_range(vma, vma->vm_start,
+ vma->vm_pgoff,
+ PAGE_SIZE,
+ vma->vm_page_prot)) {
+ return -EAGAIN;
+ }
+
+ return 0;
+}
+
+static const struct file_operations
+exynos_gpiomem_fops = {
+ .owner = THIS_MODULE,
+ .open = exynos_gpiomem_open,
+ .release = exynos_gpiomem_release,
+ .mmap = exynos_gpiomem_mmap,
+};
+
+static int exynos_gpiomem_probe(struct platform_device *pdev)
+{
+ int err = 0;
+ struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct resource *res = NULL;
+ int i = 0;
+
+ /* Allocate buffers and instance data */
+ inst = kzalloc(sizeof(struct exynos_gpiomem_instance), GFP_KERNEL);
+
+ if (!inst) {
+ err = -ENOMEM;
+ goto failed_inst_alloc;
+ }
+
+ inst->dev = dev;
+
+ inst->gpio_area_count = of_property_count_elems_of_size(np, "reg",
+ sizeof(u32)) / 2;
+
+ if (inst->gpio_area_count > 32 || inst->gpio_area_count <= 0) {
+ dev_err(inst->dev, "failed to get gpio register area.");
+ err = -EINVAL;
+ goto failed_inst_alloc;
+ }
+
+ dev_info(inst->dev, "Initialised: GPIO register area is %d",
+ inst->gpio_area_count);
+
+ for (i = 0; i < inst->gpio_area_count; ++i) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+ if (res) {
+ inst->gpio_regs_phys[i] = res->start;
+ } else {
+ dev_err(inst->dev, "failed to get IO resource");
+ err = -ENOENT;
+ goto failed_get_resource;
+ }
+ }
+
+ /* Create character device entries */
+ err = alloc_chrdev_region(&exynos_gpiomem_devid,
+ DEVICE_MINOR, 1, DEVICE_NAME);
+ if (err != 0) {
+ dev_err(inst->dev, "unable to allocate device number");
+ goto failed_alloc_chrdev;
+ }
+ cdev_init(&exynos_gpiomem_cdev, &exynos_gpiomem_fops);
+ exynos_gpiomem_cdev.owner = THIS_MODULE;
+ err = cdev_add(&exynos_gpiomem_cdev, exynos_gpiomem_devid, 1);
+ if (err != 0) {
+ dev_err(inst->dev, "unable to register device");
+ goto failed_cdev_add;
+ }
+
+ /* Create sysfs entries */
+ exynos_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME);
+ err = IS_ERR(exynos_gpiomem_class);
+ if (err)
+ goto failed_class_create;
+
+ exynos_gpiomem_dev = device_create(exynos_gpiomem_class, NULL,
+ exynos_gpiomem_devid, NULL,
+ "gpiomem");
+ err = IS_ERR(exynos_gpiomem_dev);
+ if (err)
+ goto failed_device_create;
+
+ for (i = 0; i < inst->gpio_area_count; ++i) {
+ dev_info(inst->dev, "Initialised: Registers at 0x%08lx",
+ inst->gpio_regs_phys[i]);
+ }
+
+ return 0;
+
+failed_device_create:
+ class_destroy(exynos_gpiomem_class);
+failed_class_create:
+ cdev_del(&exynos_gpiomem_cdev);
+failed_cdev_add:
+ unregister_chrdev_region(exynos_gpiomem_devid, 1);
+failed_alloc_chrdev:
+failed_get_resource:
+ kfree(inst);
+failed_inst_alloc:
+ dev_err(inst->dev, "could not load exynos_gpiomem");
+ return err;
+}
+
+static int exynos_gpiomem_remove(struct platform_device *pdev)
+{
+ struct device *dev = inst->dev;
+
+ kfree(inst);
+ device_destroy(exynos_gpiomem_class, exynos_gpiomem_devid);
+ class_destroy(exynos_gpiomem_class);
+ cdev_del(&exynos_gpiomem_cdev);
+ unregister_chrdev_region(exynos_gpiomem_devid, 1);
+
+ dev_info(dev, "GPIO mem driver removed - OK");
+ return 0;
+}
+
+static const struct of_device_id exynos_gpiomem_of_match[] = {
+ {.compatible = "samsung,exynos-gpiomem",},
+ { },
+};
+MODULE_DEVICE_TABLE(of, exynos_gpiomem_of_match);
+
+static struct platform_driver exynos_gpiomem_driver = {
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = exynos_gpiomem_of_match,
+ },
+ .probe = exynos_gpiomem_probe,
+ .remove = exynos_gpiomem_remove,
+};
+
+module_platform_driver(exynos_gpiomem_driver);
+
+MODULE_ALIAS("platform:gpiomem-exynos");
+MODULE_DESCRIPTION("EXYNOS gpiomem driver for accessing GPIO from userspace");
+MODULE_AUTHOR("Brian Kim <brian.kim@hardkernel.com>");
+MODULE_LICENSE("GPL");
--
2.25.1

View File

@@ -0,0 +1,29 @@
From fbf91de06158db2ddd49cd27b2fb3c4240b7d85a Mon Sep 17 00:00:00 2001
From: Brian Kim <brian.kim@hardkernel.com>
Date: Tue, 21 Nov 2017 18:44:03 +0900
Subject: [PATCH 042/109] ODROID-XU4: arm: Set the system revision information
wiringPi library refers to this information in '/proc/cpuinfo' file.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I4a3368499cecf862eddb1430c6b436283f62d2c7
---
arch/arm/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1a5edf562e85..7872a520920f 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -92,7 +92,7 @@ EXPORT_SYMBOL(cacheid);
unsigned int __atags_pointer __initdata;
-unsigned int system_rev;
+unsigned int system_rev = 0x0100;
EXPORT_SYMBOL(system_rev);
const char *system_serial;
--
2.25.1

View File

@@ -0,0 +1,26 @@
From aca22949dde8b0fd7f78498a92f00c68a99a3d14 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Wed, 4 Dec 2019 18:35:40 +0900
Subject: [PATCH 043/109] ODROID-XU4: defconfig: Enable CONFIG_EXYNOS_GPIOMEM
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I506c7e34ba3be12b2934340667a7c6c42744c56c
---
arch/arm/configs/odroidxu4_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/odroidxu4_defconfig b/arch/arm/configs/odroidxu4_defconfig
index 59f40acfc228..66474ab94640 100644
--- a/arch/arm/configs/odroidxu4_defconfig
+++ b/arch/arm/configs/odroidxu4_defconfig
@@ -2668,6 +2668,7 @@ CONFIG_TCG_TIS_I2C_INFINEON=y
# CONFIG_TCG_TIS_ST33ZP24_I2C is not set
# CONFIG_TCG_TIS_ST33ZP24_SPI is not set
# CONFIG_XILLYBUS is not set
+CONFIG_EXYNOS_GPIOMEM=m
# end of Character devices
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
--
2.25.1

View File

@@ -0,0 +1,51 @@
From 404bffb3cb60be556eb0939238de76700c336d88 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 9 Nov 2017 22:09:37 -0500
Subject: [PATCH 044/109] ODROID-XU4: ARM: exynos: add machine description for
ODROID-XU3/4
Change-Id: Ice75e06366f107f761504512a84fb92affffb124
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm/mach-exynos/exynos.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 25b01da4771b..a96ebdc86697 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -218,3 +218,31 @@ DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)")
.dt_compat = exynos_dt_compat,
.dt_fixup = exynos_dt_fixup,
MACHINE_END
+
+#define ODROID_MACHINE_START(name, compat) \
+ DT_MACHINE_START(EXYNOS5422_ODROID_##name, "ODROID-"#name) \
+ .l2c_aux_val = 0x3c400001, \
+ .l2c_aux_mask = 0xc20fffff, \
+ .smp = smp_ops(exynos_smp_ops), \
+ .map_io = exynos_init_io, \
+ .init_early = exynos_firmware_init, \
+ .init_irq = exynos_init_irq, \
+ .init_machine = exynos_dt_machine_init, \
+ .init_late = exynos_init_late, \
+ .dt_compat = compat, \
+ .dt_fixup = exynos_dt_fixup, \
+ MACHINE_END
+
+static char const *const exynos5422_odroidxu3_dt_compat[] __initconst = {
+ "hardkernel,odroid-xu3",
+ "hardkernel,odroid-xu3-lite",
+ NULL,
+};
+
+static char const *const exynos5422_odroidxu4_dt_compat[] __initconst = {
+ "hardkernel,odroid-xu4",
+ NULL,
+};
+
+ODROID_MACHINE_START(XU3, exynos5422_odroidxu3_dt_compat)
+ODROID_MACHINE_START(XU4, exynos5422_odroidxu4_dt_compat)
--
2.25.1

View File

@@ -0,0 +1,28 @@
From e5e98d88b1696fcb4dbfd55f0ee047202af6268e Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 5 Dec 2019 10:09:00 +0900
Subject: [PATCH 045/109] ODROID-XU4: arm/exynos: No need to use
enynos_init_late
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I7d141a655c23bf364753be9831b4428ee3aa6711
---
arch/arm/mach-exynos/exynos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index a96ebdc86697..d34031c6c4d4 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -228,7 +228,7 @@ MACHINE_END
.init_early = exynos_firmware_init, \
.init_irq = exynos_init_irq, \
.init_machine = exynos_dt_machine_init, \
- .init_late = exynos_init_late, \
+ .init_late = exynos_pm_init, \
.dt_compat = compat, \
.dt_fixup = exynos_dt_fixup, \
MACHINE_END
--
2.25.1

View File

@@ -0,0 +1,30 @@
From 61f95b624eb3c402b6901812512d48f5c7085870 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 5 Dec 2019 10:13:54 +0900
Subject: [PATCH 046/109] ODROID-XU4: arm/exynos: Add vendor name Hardkernel to
its H/W information
Because the other devices we provided have vendor name in /proc/cpuinfo.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I81a553ea8f662016b702cbb5e543ba7a769e8d0f
---
arch/arm/mach-exynos/exynos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index d34031c6c4d4..c57032c68ac4 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -220,7 +220,7 @@ DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)")
MACHINE_END
#define ODROID_MACHINE_START(name, compat) \
- DT_MACHINE_START(EXYNOS5422_ODROID_##name, "ODROID-"#name) \
+ DT_MACHINE_START(EXYNOS5422_ODROID_##name, "Hardkernel ODROID-"#name) \
.l2c_aux_val = 0x3c400001, \
.l2c_aux_mask = 0xc20fffff, \
.smp = smp_ops(exynos_smp_ops), \
--
2.25.1

View File

@@ -0,0 +1,28 @@
From 3435061bf1560faf12b4d6676e1e8b2676cf8846 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Tue, 22 Oct 2019 15:17:19 +0900
Subject: [PATCH 047/109] ODROID-XU4: char/exynos-gpiomem: Remove unnecessary
kernel logs noticed when every time it opens
Change-Id: If35e49c6d96b960f0ff1a997b2126c2c6378fdad
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
---
drivers/char/exynos-gpiomem.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/char/exynos-gpiomem.c b/drivers/char/exynos-gpiomem.c
index 5dd684d48ffc..03ea4344346a 100644
--- a/drivers/char/exynos-gpiomem.c
+++ b/drivers/char/exynos-gpiomem.c
@@ -77,8 +77,6 @@ static int exynos_gpiomem_open(struct inode *inode, struct file *file)
int dev = iminor(inode);
int ret = 0;
- dev_info(inst->dev, "gpiomem device opened.");
-
if (dev != DEVICE_MINOR) {
dev_err(inst->dev, "Unknown minor device: %d", dev);
ret = -ENXIO;
--
2.25.1

View File

@@ -0,0 +1,350 @@
From 4a73513af2b3e43538315fd784bcef2be79f4701 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Mon, 18 Nov 2019 12:10:34 +0900
Subject: [PATCH 048/109] ODROID-XU4: drivers/fbtft: Add fb_hktft35 module for
Hardkernel 3.5 inch TFT LCD
No longer use flexfb, fbtft_device that is deprecated since kernel 5.4.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Iae252c64b91b2eabe97eb3aace12d7c4b98801c5
---
drivers/staging/fbtft/Kconfig | 7 +
drivers/staging/fbtft/Makefile | 1 +
drivers/staging/fbtft/fb_hktft35.c | 300 +++++++++++++++++++++++++++++
3 files changed, 308 insertions(+)
create mode 100644 drivers/staging/fbtft/fb_hktft35.c
diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index dad1ddcd7b0c..b6cd416ebb26 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -206,3 +206,10 @@ config FB_TFT_WATTEROTT
depends on FB_TFT
help
Generic Framebuffer support for WATTEROTT
+
+config FB_TFT_HKTFT35
+ tristate "FB driver for the Hardkernel 3.5 inch TFT LCD"
+ depends on FB_TFT
+ help
+ Generic Framebuffer support for the Hardkernel 3.5 inch TFT LCD
+ that uses the ILI9488 LCD Controller
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index e87193f7df14..3d41175663ed 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_FB_TFT_UC1611) += fb_uc1611.o
obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o
obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o
obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o
+obj-$(CONFIG_FB_TFT_HKTFT35) += fb_hktft35.o
diff --git a/drivers/staging/fbtft/fb_hktft35.c b/drivers/staging/fbtft/fb_hktft35.c
new file mode 100644
index 000000000000..2389343492d4
--- /dev/null
+++ b/drivers/staging/fbtft/fb_hktft35.c
@@ -0,0 +1,300 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * FB driver for the Hardkernel 3.5 inch TFT LCD
+ * that uses the ILI9488 LCD Controller
+ *
+ * Copyright (C) 2019 Yang Deokgyu
+ *
+ * Based on fb_ili9340.c by Noralf Tronnes
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/vmalloc.h>
+#include <linux/gpio/consumer.h>
+#include <linux/backlight.h>
+#include <linux/delay.h>
+
+#include "fbtft.h"
+
+#define DRVNAME "fb_hktft35"
+#define WIDTH 320
+#define HEIGHT 480
+
+#define ODROIDXU3_GPX1_REG 0x13400C24
+#define ODROIDXU3_GPX2_REG 0x13400C44
+#define ODROIDXU3_GPA2_REG 0x14010044
+
+#define ODROID_TFT35_MACTL_MV 0x20
+#define ODROID_TFT35_MACTL_MX 0x40
+#define ODROID_TFT35_MACTL_MY 0x80
+
+union reg_bitfield {
+ unsigned int wvalue;
+ struct {
+ unsigned int bit0 : 1;
+ unsigned int bit1 : 1;
+ unsigned int bit2 : 1;
+ unsigned int bit3 : 1;
+ unsigned int bit4 : 1;
+ unsigned int bit5 : 1;
+ unsigned int bit6 : 1;
+ unsigned int bit7 : 1;
+ unsigned int bit8_bit31 : 24;
+ } bits;
+};
+
+volatile void __iomem *reg_gpx1;
+volatile void __iomem *reg_gpx2;
+volatile void __iomem *reg_gpa2;
+
+/* this init sequence matches Hardkernel 3.5 inch TFT LCD */
+static const s16 default_init_sequence[] = {
+ -1, 0xB0,0x00,
+ -1, 0x11,
+ -2, 120,
+ -1, 0x3A,0x55,
+ -1, 0xC2,0x33,
+ -1, 0xC5,0x00,0x1E,0x80,
+ -1, 0x36,0x28,
+ -1, 0xB1,0xB0,
+ -1, 0xE0,0x00,0x04,0x0E,0x08,0x17,0x0A,0x40,0x79,0x4D,0x07,0x0E,0x0A,0x1A,0x1D,0x0F,
+ -1, 0xE1,0x00,0x1B,0x1F,0x02,0x10,0x05,0x32,0x34,0x43,0x02,0x0A,0x09,0x33,0x37,0x0F,
+ -1, 0x11,
+ -1, 0x29,
+ -3
+};
+
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+{
+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye);
+
+ /* Column address */
+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
+
+ /* Row adress */
+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
+
+ /* Memory write */
+ write_reg(par, 0x2C);
+}
+
+static int set_var(struct fbtft_par *par)
+{
+ u8 val;
+
+ switch (par->info->var.rotate) {
+ case 270:
+ val = ODROID_TFT35_MACTL_MV;
+ break;
+ case 180:
+ val = ODROID_TFT35_MACTL_MY;
+ break;
+ case 90:
+ val = ODROID_TFT35_MACTL_MV | ODROID_TFT35_MACTL_MX | ODROID_TFT35_MACTL_MY;
+ break;
+ default:
+ val = ODROID_TFT35_MACTL_MX;
+ break;
+ }
+ /* Memory Access Control */
+ write_reg(par, 0x36, val | (par->bgr << 3));
+ return 0;
+}
+
+static int fbtft_backlight_get_brightness(struct backlight_device *bd)
+{
+ return bd->props.brightness;
+}
+
+static int fbtft_backlight_update_status(struct backlight_device *bd)
+{
+ struct fbtft_par *par = bl_get_data(bd);
+ bool polarity = par->polarity;
+
+ fbtft_par_dbg(DEBUG_BACKLIGHT, par,
+ "%s: polarity=%d, power=%d, fb_blank=%d\n",
+ __func__, polarity, bd->props.power, bd->props.fb_blank);
+
+ if ((bd->props.power == FB_BLANK_UNBLANK) &&
+ (bd->props.fb_blank == FB_BLANK_UNBLANK))
+ gpiod_set_value(par->gpio.led[0], polarity);
+ else
+ gpiod_set_value(par->gpio.led[0], !polarity);
+
+ return 0;
+}
+
+static const struct backlight_ops fbtft_bl_ops = {
+ .get_brightness = fbtft_backlight_get_brightness,
+ .update_status = fbtft_backlight_update_status,
+};
+
+static void register_backlight(struct fbtft_par *par)
+{
+ struct backlight_device *bd;
+ struct backlight_properties bl_props = { 0, };
+
+ if (!par->gpio.led[0]) {
+ fbtft_par_dbg(DEBUG_BACKLIGHT, par,
+ "%s(): led pin not set, exiting.\n", __func__);
+ return;
+ }
+
+ bl_props.type = BACKLIGHT_RAW;
+ /* Assume backlight is off, get polarity from current state of pin */
+ bl_props.power = FB_BLANK_POWERDOWN;
+
+ /* Force polarity to true */
+ par->polarity = true;
+
+ bd = backlight_device_register(dev_driver_string(par->info->device),
+ par->info->device, par,
+ &fbtft_bl_ops, &bl_props);
+ if (IS_ERR(bd)) {
+ dev_err(par->info->device,
+ "cannot register backlight device (%ld)\n",
+ PTR_ERR(bd));
+ return;
+ }
+ par->info->bl_dev = bd;
+
+ if (!par->fbtftops.unregister_backlight)
+ par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
+}
+
+static void unregister_backlight(struct fbtft_par *par)
+{
+ if (par->info->bl_dev) {
+ par->info->bl_dev->props.power = FB_BLANK_POWERDOWN;
+ backlight_update_status(par->info->bl_dev);
+ backlight_device_unregister(par->info->bl_dev);
+ par->info->bl_dev = NULL;
+ }
+
+ /* Just to hook the remove routine */
+ if (reg_gpx1) iounmap(reg_gpx1);
+ if (reg_gpx2) iounmap(reg_gpx2);
+ if (reg_gpa2) iounmap(reg_gpa2);
+}
+
+static int verify_gpios(struct fbtft_par *par)
+{
+ struct fbtft_platform_data *pdata = par->pdata;
+ int i;
+
+ fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
+
+ if (pdata->display.buswidth != 9 && par->startbyte == 0 &&
+ !par->gpio.dc) {
+ dev_err(par->info->device,
+ "Missing info about 'dc' gpio. Aborting.\n");
+ return -EINVAL;
+ }
+
+ if (!par->pdev)
+ return 0;
+
+ if (!par->gpio.wr) {
+ dev_err(par->info->device, "Missing 'wr' gpio. Aborting.\n");
+ return -EINVAL;
+ }
+ for (i = 0; i < pdata->display.buswidth; i++) {
+ if (!par->gpio.db[i]) {
+ dev_err(par->info->device,
+ "Missing 'db%02d' gpio. Aborting.\n", i);
+ return -EINVAL;
+ }
+ }
+
+ /* Just to hook the probe routine */
+ reg_gpx1 = ioremap(ODROIDXU3_GPX1_REG, 4);
+ reg_gpx2 = ioremap(ODROIDXU3_GPX2_REG, 4);
+ reg_gpa2 = ioremap(ODROIDXU3_GPA2_REG, 4);
+ if ((reg_gpx1 == NULL) || (reg_gpx2 == NULL) || (reg_gpa2 == NULL)) {
+ pr_err("%s : ioremap gpio registers error!\n", __func__);
+ } else {
+ pr_info("%s : ioremap gpio registers success!\n", __func__);
+ }
+
+ return 0;
+}
+
+static void reset(struct fbtft_par *par)
+{
+ if (!par->gpio.reset)
+ return;
+ fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
+ gpiod_set_value_cansleep(par->gpio.reset, 0);
+ usleep_range(20, 40);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(120);
+}
+
+static int write(struct fbtft_par *par, void *buf, size_t len)
+{
+ u8 data;
+ union reg_bitfield gpx1, gpx2, gpa2;
+
+ if ((reg_gpx1 == NULL) || (reg_gpx2 == NULL) || (reg_gpa2 == NULL)) {
+ pr_err("%s : ioremap gpio register fail!\n", __func__);
+ return 0;
+ }
+
+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
+ "%s(len=%zu): ", __func__, len);
+
+ gpx1.wvalue = ioread32(reg_gpx1);
+ gpx2.wvalue = ioread32(reg_gpx2);
+ gpa2.wvalue = ioread32(reg_gpa2);
+
+ while (len--) {
+ data = *(u8 *) buf;
+ gpx1.bits.bit7 = (data & 0x01) ? 1 : 0;
+ gpx2.bits.bit0 = (data & 0x02) ? 1 : 0;
+ gpx1.bits.bit3 = (data & 0x04) ? 1 : 0;
+ gpa2.bits.bit4 = (data & 0x08) ? 1 : 0;
+ gpa2.bits.bit6 = (data & 0x10) ? 1 : 0;
+ gpa2.bits.bit7 = (data & 0x20) ? 1 : 0;
+ gpx1.bits.bit6 = (data & 0x40) ? 1 : 0;
+ gpx1.bits.bit5 = (data & 0x80) ? 1 : 0;
+ /* Start writing by pulling down /WR */
+ gpa2.bits.bit5 = 0;
+ iowrite32(gpx1.wvalue, reg_gpx1);
+ iowrite32(gpx2.wvalue, reg_gpx2);
+ iowrite32(gpa2.wvalue, reg_gpa2);
+ gpa2.bits.bit5 = 1;
+ iowrite32(gpa2.wvalue, reg_gpa2);
+
+ buf++;
+ }
+
+ return 0;
+}
+
+static struct fbtft_display display = {
+ .regwidth = 8,
+ .buswidth = 8,
+ .width = WIDTH,
+ .height = HEIGHT,
+ .init_sequence = default_init_sequence,
+ .fbtftops = {
+ .set_addr_win = set_addr_win,
+ .set_var = set_var,
+ .verify_gpios = verify_gpios,
+ .register_backlight = register_backlight,
+ .unregister_backlight = unregister_backlight,
+ .reset = reset,
+ .write = write,
+ },
+};
+FBTFT_REGISTER_DRIVER(DRVNAME, "odroid,hktft35", &display);
+
+MODULE_ALIAS("platform:" DRVNAME);
+MODULE_ALIAS("platform:hktft35");
+
+MODULE_DESCRIPTION("FB driver for the Hardkernel 3.5 inch TFT LCD uses the ILI9488 LCD Controller");
+MODULE_AUTHOR("Yang Deokgyu");
+MODULE_LICENSE("GPL");
--
2.25.1

View File

@@ -0,0 +1,206 @@
From ee0bc8397ef4da60ce3f022bb54bdf710ef624e2 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 21 Nov 2019 15:17:36 +0900
Subject: [PATCH 049/109] ODROID-XU4: drivers/fbtft: Add fb_hktft32 module for
Hardkernel 3.2 inch TFT LCD
No longer use flexfb, fbtft_device that is deprecated since kernel 5.4.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Iebd014360f90eab5210722102d54c6169be5e28e
---
drivers/staging/fbtft/Kconfig | 7 ++
drivers/staging/fbtft/Makefile | 1 +
drivers/staging/fbtft/fb_hktft32.c | 156 +++++++++++++++++++++++++++++
3 files changed, 164 insertions(+)
create mode 100644 drivers/staging/fbtft/fb_hktft32.c
diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index b6cd416ebb26..408ef1a2f978 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -213,3 +213,10 @@ config FB_TFT_HKTFT35
help
Generic Framebuffer support for the Hardkernel 3.5 inch TFT LCD
that uses the ILI9488 LCD Controller
+
+config FB_TFT_HKTFT32
+ tristate "FB driver for the Hardkernel 3.2 inch TFT LCD"
+ depends on FB_TFT
+ help
+ Generic Framebuffer support for the Hardkernel 3.2 inch TFT LCD
+ that uses the ILI9340 LCD Controller
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 3d41175663ed..34a5a14d1ab4 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -38,3 +38,4 @@ obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o
obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o
obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o
obj-$(CONFIG_FB_TFT_HKTFT35) += fb_hktft35.o
+obj-$(CONFIG_FB_TFT_HKTFT32) += fb_hktft32.o
diff --git a/drivers/staging/fbtft/fb_hktft32.c b/drivers/staging/fbtft/fb_hktft32.c
new file mode 100644
index 000000000000..33ac19603cad
--- /dev/null
+++ b/drivers/staging/fbtft/fb_hktft32.c
@@ -0,0 +1,156 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * FB driver for the Hardkernel 3.2 inch TFT LCD
+ * that uses the ILI9340 LCD Controller
+ *
+ * Copyright (C) 2019 Yang Deokgyu
+ *
+ * Based on fb_ili9340.c by Noralf Tronnes
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/gpio/consumer.h>
+#include <linux/delay.h>
+#include <video/mipi_display.h>
+
+#include "fbtft.h"
+
+#define DRVNAME "fb_hktft32"
+#define WIDTH 240
+#define HEIGHT 320
+
+/* Init sequence taken from: Arduino Library for the Adafruit 2.2" display */
+static int init_display(struct fbtft_par *par)
+{
+ par->fbtftops.reset(par);
+
+ write_reg(par, 0xEF, 0x03, 0x80, 0x02);
+ write_reg(par, 0xCF, 0x00, 0XC1, 0X30);
+ write_reg(par, 0xED, 0x64, 0x03, 0X12, 0X81);
+ write_reg(par, 0xE8, 0x85, 0x00, 0x78);
+ write_reg(par, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02);
+ write_reg(par, 0xF7, 0x20);
+ write_reg(par, 0xEA, 0x00, 0x00);
+
+ /* Power Control 1 */
+ write_reg(par, 0xC0, 0x23);
+
+ /* Power Control 2 */
+ write_reg(par, 0xC1, 0x10);
+
+ /* VCOM Control 1 */
+ write_reg(par, 0xC5, 0x3e, 0x28);
+
+ /* VCOM Control 2 */
+ write_reg(par, 0xC7, 0x86);
+
+ /* COLMOD: Pixel Format Set */
+ /* 16 bits/pixel */
+ write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
+
+ /* Frame Rate Control */
+ /* Division ratio = fosc, Frame Rate = 79Hz */
+ write_reg(par, 0xB1, 0x00, 0x18);
+
+ /* Display Function Control */
+ write_reg(par, 0xB6, 0x08, 0x82, 0x27);
+
+ /* Gamma Function Disable */
+ write_reg(par, 0xF2, 0x00);
+
+ /* Gamma curve selection */
+ write_reg(par, MIPI_DCS_SET_GAMMA_CURVE, 0x01);
+
+ /* Positive Gamma Correction */
+ write_reg(par, 0xE0,
+ 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1,
+ 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00);
+
+ /* Negative Gamma Correction */
+ write_reg(par, 0xE1,
+ 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1,
+ 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F);
+
+ write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
+
+ mdelay(120);
+
+ write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
+
+ return 0;
+}
+
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+{
+ write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
+ xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
+
+ write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
+ ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
+
+ write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
+}
+
+#define ILI9340_MADCTL_MV 0x20
+#define ILI9340_MADCTL_MX 0x40
+#define ILI9340_MADCTL_MY 0x80
+static int set_var(struct fbtft_par *par)
+{
+ u8 val;
+
+ switch (par->info->var.rotate) {
+ case 270:
+ val = ILI9340_MADCTL_MV;
+ break;
+ case 180:
+ val = ILI9340_MADCTL_MY;
+ break;
+ case 90:
+ val = ILI9340_MADCTL_MV | ILI9340_MADCTL_MY | ILI9340_MADCTL_MX;
+ break;
+ default:
+ val = ILI9340_MADCTL_MX;
+ break;
+ }
+ /* Memory Access Control */
+ write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, val | (par->bgr << 3));
+
+ return 0;
+}
+
+static void reset(struct fbtft_par *par)
+{
+ if (!par->gpio.reset)
+ return;
+ fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
+ gpiod_set_value_cansleep(par->gpio.reset, 0);
+ usleep_range(20, 40);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(120);
+}
+
+static struct fbtft_display display = {
+ .regwidth = 8,
+ .buswidth = 8,
+ .width = WIDTH,
+ .height = HEIGHT,
+ .fbtftops = {
+ .init_display = init_display,
+ .set_addr_win = set_addr_win,
+ .set_var = set_var,
+ .reset = reset,
+ },
+};
+
+FBTFT_REGISTER_DRIVER(DRVNAME, "odroid,hktft32", &display);
+
+MODULE_ALIAS("spi:" DRVNAME);
+MODULE_ALIAS("platform:" DRVNAME);
+MODULE_ALIAS("spi:hktft32");
+MODULE_ALIAS("platform:hktft32");
+
+MODULE_DESCRIPTION("FB driver for the Hardkernel 3.2 inch TFT LCD uses the ILI9340 LCD Controller");
+MODULE_AUTHOR("Yang Deokgyu");
+MODULE_LICENSE("GPL");
--
2.25.1

View File

@@ -0,0 +1,28 @@
From b111e5de07279c8fd6fd29397f0fb3679c0df8e0 Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 5 Dec 2019 13:47:30 +0900
Subject: [PATCH 050/109] ODROID-XU4: defconfig: Enable FB_TFT for Hardkernel
LCDs
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I8441bb567a119ca51281a4aefec7f72bf79f6f04
---
arch/arm/configs/odroidxu4_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/configs/odroidxu4_defconfig b/arch/arm/configs/odroidxu4_defconfig
index 66474ab94640..661a8490d87a 100644
--- a/arch/arm/configs/odroidxu4_defconfig
+++ b/arch/arm/configs/odroidxu4_defconfig
@@ -5227,6 +5227,8 @@ CONFIG_FB_TFT_UC1611=m
CONFIG_FB_TFT_UC1701=m
CONFIG_FB_TFT_UPD161704=m
CONFIG_FB_TFT_WATTEROTT=m
+CONFIG_FB_TFT_HKTFT35=m
+CONFIG_FB_TFT_HKTFT32=m
# CONFIG_WILC1000_SDIO is not set
# CONFIG_WILC1000_SPI is not set
# CONFIG_MOST is not set
--
2.25.1

View File

@@ -0,0 +1,134 @@
From 335bcaa5d13f772d9d0c7d6d78bf37ac84cd99ff Mon Sep 17 00:00:00 2001
From: Yang Deokgyu <secugyu@gmail.com>
Date: Thu, 5 Dec 2019 12:08:23 +0900
Subject: [PATCH 051/109] ODROID-XU4: dts: Add nodes for Hardkernel LCDs of 2
HATs, Cloudshell, OGST
It doesn't include its touchscreen yet.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: I110e897746dea17fc32e9fdc442c492d70888dfa
---
arch/arm/boot/dts/exynos5422-odroidxu4.dts | 101 +++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
index 297df752199e..9b218e1a3bec 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
@@ -44,6 +44,49 @@ codec {
sound-dai = <&hdmi>;
};
};
+
+ hktft35: hktft35 {
+ status = "disabled";
+ compatible = "odroid,hktft35";
+ pinctrl-names = "default";
+ pinctrl-0 = <&hktft35_pins>;
+
+ rotate = <270>;
+ bgr;
+ fps = <20>;
+ bpp = <16>;
+ reset-gpios = <&gpa0 3 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpx2 4 GPIO_ACTIVE_HIGH>;
+ wr-gpios = <&gpa2 5 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpa0 2 GPIO_ACTIVE_HIGH>;
+ led-gpios = <&gpx2 7 GPIO_ACTIVE_HIGH>;
+ db-gpios = <&gpx1 7 GPIO_ACTIVE_HIGH>,
+ <&gpx2 0 GPIO_ACTIVE_HIGH>,
+ <&gpx1 3 GPIO_ACTIVE_HIGH>,
+ <&gpa2 4 GPIO_ACTIVE_HIGH>,
+ <&gpa2 6 GPIO_ACTIVE_HIGH>,
+ <&gpa2 7 GPIO_ACTIVE_HIGH>,
+ <&gpx1 6 GPIO_ACTIVE_HIGH>,
+ <&gpx1 5 GPIO_ACTIVE_HIGH>;
+ debug = <0>;
+
+ hktft35_pins: hktft35_pins {
+ samsung,pins = "gpa0-3", /* reset */
+ "gpx2-4", /* dc */
+ "gpa2-5", /* wr */
+ "gpa0-2", /* cs */
+ "gpx2-7", /* led */
+ "gpx1-7", /* db00 */
+ "gpx2-0", /* db01 */
+ "gpx1-3", /* db02 */
+ "gpa2-4", /* db03 */
+ "gpa2-6", /* db04 */
+ "gpa2-7", /* db05 */
+ "gpx1-6", /* db06 */
+ "gpx1-5"; /* db07 */
+ samsung,pin-function = <1>;
+ };
+ };
};
&i2s0 {
@@ -122,4 +165,62 @@ controller-data {
samsung,spi-feedback-delay = <0>;
};
};
+
+ hktft_cs_ogst: hktft_cs_ogst@0 {
+ status = "disabled";
+ compatible = "odroid,hktft32";
+ reg = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&hktft_cs_ogst_pins>;
+
+ spi-max-frequency = <40000000>;
+ rotate = <270>;
+ bgr;
+ backlight;
+ fps = <20>;
+ bpp = <16>;
+ reset-gpios = <&gpx1 5 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpx1 6 GPIO_ACTIVE_HIGH>;
+ led-gpios = <&gpx1 2 GPIO_ACTIVE_HIGH>;
+ debug = <0>;
+
+ hktft_cs_ogst_pins: hktft_cs_ogst_pins {
+ samsung,pins = "gpx1-5", /* reset */
+ "gpx1-6", /* dc */
+ "gpx1-2"; /* led */
+ };
+
+ controller-data {
+ cs-gpio = <&gpa2 5 GPIO_ACTIVE_HIGH>;
+ samsung,spi-feedback-delay = <0>;
+ };
+ };
+
+ hktft32: hktft32@0 {
+ status = "disabled";
+ compatible = "odroid,hktft32";
+ reg = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&hktft32_pins>;
+
+ spi-max-frequency = <40000000>;
+ rotate = <90>;
+ bgr;
+ backlight;
+ fps = <20>;
+ bpp = <16>;
+ reset-gpios = <&gpx1 5 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpx1 6 GPIO_ACTIVE_HIGH>;
+ debug = <0>;
+
+ hktft32_pins: hktft32_pins {
+ samsung,pins = "gpx1-5", /* reset */
+ "gpx1-6"; /* dc */
+ };
+
+ controller-data {
+ cs-gpio = <&gpa2 5 GPIO_ACTIVE_HIGH>;
+ samsung,spi-feedback-delay = <0>;
+ };
+ };
};
--
2.25.1

View File

@@ -0,0 +1,33 @@
From 7eb428f1dfa5bb317981c60be449b6baeba69a07 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 27 Feb 2020 11:50:05 +0900
Subject: [PATCH 052/109] ODROID-XU4: FIXME: Revert "regulator: core: Let
boot-on regulators be powered off"
FIXME: this patch crashes when Mali is activated
This reverts commit f44b07472f29ae313ce875dc7b9c75b100c608b8.
Change-Id: I2f3e8e68b3172c2c1d035032b47fb256c5757be8
---
drivers/regulator/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 16114aea099a..41d0a739ceaf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1436,9 +1436,7 @@ static int set_machine_constraints(struct regulator_dev *rdev)
rdev_err(rdev, "failed to enable: %pe\n", ERR_PTR(ret));
return ret;
}
-
- if (rdev->constraints->always_on)
- rdev->use_count++;
+ rdev->use_count++;
}
print_constraints(rdev);
--
2.25.1

View File

@@ -0,0 +1,34 @@
From 97d921e384e25cf471917f544e1c6f75249e1198 Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Thu, 5 Mar 2020 14:26:42 +0900
Subject: [PATCH 053/109] ODROID-XU4: arm/dts: remove write-protect pin from SD
card
This patch removes the write-protect pin from SD card since it's not
being supported by a hardware and used at all.
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I72af94f7fd0a01e65f7ca3e15ccd66e797395df4
---
arch/arm/boot/dts/exynos5422-odroid-core.dtsi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
index e7505f46605b..13ae1e5fd4f0 100644
--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
@@ -970,9 +970,10 @@ &mmc_2 {
samsung,dw-mshc-sdr-timing = <0 4>;
samsung,dw-mshc-ddr-timing = <0 2>;
pinctrl-names = "default";
- pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_wp &sd2_bus1 &sd2_bus4>;
+ pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>;
bus-width = <4>;
cap-sd-highspeed;
+ disable-wp;
max-frequency = <200000000>;
vmmc-supply = <&ldo19_reg>;
vqmmc-supply = <&ldo13_reg>;
--
2.25.1

View File

@@ -0,0 +1,60 @@
From 7e51c80478a0ce1d36ee48b4007222296ea26cab Mon Sep 17 00:00:00 2001
From: "charles.park" <charles.park@hardkernel.com>
Date: Fri, 1 Jun 2018 18:12:01 +0900
Subject: [PATCH 054/109] ODROID-XU4: Update hack avoiding the invalid
temperature by TMU broken
Change-Id: I6092834427950a50746535458e99bf7089212044
---
drivers/thermal/thermal_helpers.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 7f50f412e02a..b0f1a9cf6a7d 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -75,6 +75,10 @@ EXPORT_SYMBOL(get_thermal_instance);
*
* Return: On success returns 0, an error code otherwise
*/
+
+#define CRITICAL_TEMP 120000
+int thermal_zone_data[4] = { 0, };
+
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
{
int ret = -EINVAL;
@@ -108,6 +112,30 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
*temp = tz->emul_temperature;
}
+ /* save thermal_zone data */
+ if (!ret)
+ thermal_zone_data[tz->id] = *temp;
+ /*
+ * This case is that the thermal sensor is broken.
+ * That's not real temperature. Set the fake temperature value in order to
+ * avoid reaching the ciritical temperature.
+ */
+ if ((thermal_zone_data[tz->id] > CRITICAL_TEMP) && (tz->id != 4)) {
+ int i, broken_sensor = 0, correct_temp = 0;
+ for (i = 0; i < 4; i++) {
+ if ((thermal_zone_data[i] <= CRITICAL_TEMP) &&
+ (correct_temp <= thermal_zone_data[i]))
+ correct_temp = thermal_zone_data[i];
+ if (thermal_zone_data[i] > CRITICAL_TEMP)
+ broken_sensor++;
+ }
+ /*
+ * if all thermal sensor broken then critical temperature data send
+ * for system poweroff.
+ */
+ *temp = (broken_sensor == 4) ? CRITICAL_TEMP : correct_temp;
+ }
+
mutex_unlock(&tz->lock);
exit:
return ret;
--
2.25.1

View File

@@ -0,0 +1,35 @@
From 8c9b76cd4af032be2135da813667a7e9ace27109 Mon Sep 17 00:00:00 2001
From: Marian Mihailescu <mihailescu2m@gmail.com>
Date: Thu, 14 Nov 2019 10:39:00 +1030
Subject: [PATCH 055/109] ODROID-XU4: ARM: dts: exynos5420: add mali dt node
and enable mali on Odroid XU3/4
Add device tree node for Mali GPU for Exynos 542x SoC.
GPU is disabled by default, and is enabled for each board after the
regulator is defined. Tested on Odroid-XU4.
Change-Id: I902932d29c7093b666fa3a8a8e1d0fda8fb11d5c
Signed-off-by: Marian Mihailescu <mihailescu2m@gmail.com>
---
arch/arm/boot/dts/exynos5422-odroid-core.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
index 13ae1e5fd4f0..2853f5cb6d84 100644
--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
@@ -1053,6 +1053,11 @@ &gpu {
status = "okay";
};
+&gpu {
+ mali-supply = <&buck4_reg>;
+ status = "okay";
+};
+
&rtc {
status = "okay";
clocks = <&clock CLK_RTC>, <&s2mps11_osc S2MPS11_CLK_AP>;
--
2.25.1

View File

@@ -0,0 +1,41 @@
From 638b0e4a50b8527f2446c63f9596e75920bb0d2f Mon Sep 17 00:00:00 2001
From: MastaG <mastag@gmail.com>
Date: Mon, 4 Jan 2021 14:05:08 +0100
Subject: [PATCH 058/109] ODROID-XU4: s5p-mfc: Try again after error.
This is a fix by AreaScout which makes sure that we can try to play new videos in Kodi.
Change-Id: I50181bebeb16aec6148468315ed67a7ce1bc7adb
---
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index a71753d459ba..a85dd2df1a3c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -600,8 +600,8 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
if (ctx->state == MFCINST_ERROR) {
- mfc_err("Call on QBUF after unrecoverable error\n");
- return -EIO;
+ //mfc_err("Call on QBUF after unrecoverable error\n");
+ return -EAGAIN;
}
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
return vb2_qbuf(&ctx->vq_src, NULL, buf);
@@ -620,8 +620,8 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
int ret;
if (ctx->state == MFCINST_ERROR) {
- mfc_err_limited("Call on DQBUF after unrecoverable error\n");
- return -EIO;
+ //mfc_err_limited("Call on DQBUF after unrecoverable error\n");
+ return -EAGAIN;
}
switch (buf->type) {
--
2.25.1

View File

@@ -0,0 +1,36 @@
From b68b89ebbc90d05c0c75a91ede4bed664b60c59b Mon Sep 17 00:00:00 2001
From: MastaG <mastag@gmail.com>
Date: Mon, 4 Jan 2021 14:28:17 +0100
Subject: [PATCH 060/109] ODROID-XU4: s5p-mfc: Remove DMA_ATTR_NON_CONSISTENT
as it's not supported any longer on the exynos platform
Change-Id: Ib339d7d1040705431dba49f3d876a6baec531dd4
---
drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 8c39528be39e..7550721bd0bb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -858,7 +858,7 @@ static int s5p_mfc_open(struct file *file)
* We'll do mostly sequential access, so sacrifice TLB efficiency for
* faster allocation.
*/
- q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
+ q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NO_KERNEL_MAPPING;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
ret = vb2_queue_init(q);
@@ -893,7 +893,7 @@ static int s5p_mfc_open(struct file *file)
* We'll do mostly sequential access, so sacrifice TLB efficiency for
* faster allocation.
*/
- q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
+ q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NO_KERNEL_MAPPING;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
ret = vb2_queue_init(q);
--
2.25.1

View File

@@ -0,0 +1,77 @@
From 32d3af60fff55d100dfdaa77c30b5dd5bc203d04 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 10 Sep 2020 11:01:33 +0900
Subject: [PATCH 061/109] 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 5e2236ec189f..cc4f2ed9140f 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.25.1

View File

@@ -0,0 +1,31 @@
From 540186425e60ded79430948b04151195c8437ebf Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 22 Oct 2020 13:04:53 +0900
Subject: [PATCH 062/109] ODROID-N2: arm64/dts: add new RTC node to I2C-3
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I9bd614306135fd31d80c6f03ac5192320ab21a84
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 3aa8da458e5d..17614be1901c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -549,6 +549,12 @@ &i2c3 {
/* default 100k */
clock-frequency = <100000>;
+
+ rtc: rtc@51 {
+ compatible = "nxp,pcf8563";
+ reg = <0x51>;
+ status = "okay";
+ };
};
&ir {
--
2.25.1

View File

@@ -0,0 +1,232 @@
From cb05858e162b1356c9e804194c94cc61b0b857af Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 6 Oct 2020 17:37:40 +0900
Subject: [PATCH 063/109] ODROID-COMMON: power:reset: Add odroid support
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I71955f76e5dbe0adb53a7cd62e747342c580209f
---
drivers/power/reset/Kconfig | 7 ++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/odroid-reboot.c | 181 ++++++++++++++++++++++++++++
3 files changed, 189 insertions(+)
create mode 100644 drivers/power/reset/odroid-reboot.c
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 4d1192062508..1b5fec649330 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -9,6 +9,13 @@ menuconfig POWER_RESET
if POWER_RESET
+config POWER_RESET_ODROID
+ bool "odroid reboot/power-off driver"
+ depends on ARCH_MESON
+ help
+ This driver supports restart / power off board for amlogic
+ g12a/g12b/sm1 SoCs
+
config POWER_RESET_AS3722
bool "ams AS3722 power-off driver"
depends on MFD_AS3722
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 4f959b697606..bc4f3627f476 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_POWER_RESET_ODROID) += odroid-reboot.o
obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
diff --git a/drivers/power/reset/odroid-reboot.c b/drivers/power/reset/odroid-reboot.c
new file mode 100644
index 000000000000..68092141fbbb
--- /dev/null
+++ b/drivers/power/reset/odroid-reboot.c
@@ -0,0 +1,181 @@
+/*
+ * drivers/power/reset/odroid-reboot.c
+ *
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/reboot.h>
+
+#include <asm/system_misc.h>
+
+#include <asm/compiler.h>
+#include <linux/kdebug.h>
+#include <linux/arm-smccc.h>
+
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
+
+int sd_vqsw;
+int sd_vmmc;
+int sd_vqen;
+
+static u32 psci_function_id_restart;
+static u32 psci_function_id_poweroff;
+
+#define CHECK_RET(ret) { \
+ if (ret) \
+ pr_err("[%s] gpio op failed(%d) at line %d\n",\
+ __func__, ret, __LINE__); \
+}
+
+static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
+ u64 arg2)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_smc((unsigned long)function_id,
+ (unsigned long)arg0,
+ (unsigned long)arg1,
+ (unsigned long)arg2,
+ 0, 0, 0, 0, &res);
+ return res.a0;
+}
+
+void odroid_card_reset(void)
+{
+ int ret = 0;
+
+ if ((sd_vqsw == 0) && (sd_vmmc == 0))
+ return;
+
+ if (sd_vqen == 0) {
+ gpio_free(sd_vqsw);
+ gpio_free(sd_vmmc);
+ ret = gpio_request_one(sd_vqsw,
+ GPIOF_OUT_INIT_LOW, "REBOOT");
+ CHECK_RET(ret);
+ mdelay(10);
+ ret = gpio_direction_output(sd_vqsw, 1);
+ CHECK_RET(ret);
+ ret = gpio_request_one(sd_vmmc,
+ GPIOF_OUT_INIT_LOW, "REBOOT");
+ CHECK_RET(ret);
+ mdelay(10);
+ ret = gpio_direction_output(sd_vqsw, 0);
+ CHECK_RET(ret);
+ ret = gpio_direction_output(sd_vmmc, 1);
+ CHECK_RET(ret);
+ mdelay(5);
+ gpio_free(sd_vqsw);
+ gpio_free(sd_vmmc);
+ } else {
+ gpio_free(sd_vqsw);
+ gpio_free(sd_vqen);
+ gpio_free(sd_vmmc);
+
+ ret = gpio_request_one(sd_vqsw,
+ GPIOF_OUT_INIT_LOW, "REBOOT");
+ CHECK_RET(ret);
+ ret = gpio_request_one(sd_vqen,
+ GPIOF_OUT_INIT_LOW, "REBOOT");
+ CHECK_RET(ret);
+ ret = gpio_request_one(sd_vmmc,
+ GPIOF_OUT_INIT_LOW, "REBOOT");
+ CHECK_RET(ret);
+ mdelay(100);
+ ret = gpio_direction_input(sd_vqen);
+ CHECK_RET(ret);
+ ret = gpio_direction_input(sd_vmmc);
+ CHECK_RET(ret);
+ ret = gpio_direction_input(sd_vqsw);
+ CHECK_RET(ret);
+ mdelay(5);
+ gpio_free(sd_vqen);
+ gpio_free(sd_vmmc);
+ gpio_free(sd_vqsw);
+ }
+}
+
+static void do_odroid_restart(enum reboot_mode reboot_mode, const char *cmd)
+{
+ odroid_card_reset();
+ __invoke_psci_fn_smc(psci_function_id_restart,
+ 0, 0, 0);
+}
+
+static void do_odroid_poweroff(void)
+{
+ odroid_card_reset();
+
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
+ __invoke_psci_fn_smc(psci_function_id_poweroff,
+ 0, 0, 0);
+}
+
+static int odroid_restart_probe(struct platform_device *pdev)
+{
+ struct device_node *of_node;
+ u32 id;
+
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) {
+ psci_function_id_restart = id;
+ arm_pm_restart = do_odroid_restart;
+ }
+
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
+ psci_function_id_poweroff = id;
+ pm_power_off = do_odroid_poweroff;
+ }
+
+ of_node = pdev->dev.of_node;
+
+ sd_vqsw = of_get_named_gpio(of_node, "sd-vqsw", 0);
+ if (!gpio_is_valid(sd_vqsw)) sd_vqsw = 0;
+
+ sd_vmmc = of_get_named_gpio(of_node, "sd-vmmc", 0);
+ if (!gpio_is_valid(sd_vmmc)) sd_vmmc = 0;
+
+ sd_vqen = of_get_named_gpio(of_node, "sd-vqen", 0);
+ if (!gpio_is_valid(sd_vqen)) sd_vqen = 0;
+
+ return 0;
+}
+
+static const struct of_device_id of_odroid_restart_match[] = {
+ { .compatible = "odroid,reboot", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_odroid_restart_match);
+
+static struct platform_driver odroid_restart_driver = {
+ .probe = odroid_restart_probe,
+ .driver = {
+ .name = "odroid-restart",
+ .of_match_table = of_match_ptr(of_odroid_restart_match),
+ },
+};
+
+static int __init odroid_restart_init(void)
+{
+ return platform_driver_register(&odroid_restart_driver);
+}
+device_initcall(odroid_restart_init);
--
2.25.1

View File

@@ -0,0 +1,46 @@
From 4f53d3bcbcd26bd766355ffa061570945a31af2a Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Sun, 15 Mar 2020 02:15:06 +0900
Subject: [PATCH 064/109] ODROID-C4: arm64/dts: add new board for Hardkernel
ODROID-C4
Change-Id: Idd9abac641030e5498171d88b3840349ce3b8442
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 12 ++++++++++++
2 files changed, 13 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 6112beacefc8..9d3ef969eb55 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -52,5 +52,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2_plus.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
new file mode 100644
index 000000000000..9b2c191620b9
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-odroid-c4.dts"
+
+/ {
+ model = "Hardkernel ODROID-C4";
+};
--
2.25.1

View File

@@ -0,0 +1,136 @@
From c252bb2322ebc77bdaf3a070aaaf3c4b951a4798 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Tue, 14 Apr 2020 14:15:25 +0900
Subject: [PATCH 065/109] ODROID-C4: arm64/dts: add uart_A node
Change-Id: Ib66a03da2fcf39fc459c20c9f98b1baca34dcf5b
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 105 ++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index b2a4e823c1d8..7e79168356ef 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -11,6 +11,26 @@ / {
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
model = "Hardkernel ODROID-C4";
+ aliases {
+ ethernet0 = &ethmac;
+ serial0 = &uart_AO;
+ serial1 = &uart_A;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x40000000>;
+ };
+
+ emmc_pwrseq: emmc-pwrseq {
+ compatible = "mmc-pwrseq-emmc";
+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+ };
+
leds {
compatible = "gpio-leds";
@@ -59,6 +79,91 @@ &ir {
linux,rc-map-name = "rc-odroid";
};
+&pwm_AO_cd {
+ pinctrl-0 = <&pwm_ao_d_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin1";
+ status = "okay";
+};
+
+&saradc {
+ status = "okay";
+};
+
+/* 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 = <200000000>;
+ sd-uhs-sdr12;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ disable-wp;
+
+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&tflash_vdd>;
+ vqmmc-supply = <&tf_io>;
+};
+
+/* 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 = <&flash_1v8>;
+};
+
+&tdmif_b {
+ status = "okay";
+};
+
+&tdmout_b {
+ status = "okay";
+};
+
+&tohdmitx {
+ status = "okay";
+};
+
+&uart_A {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart_a_pins>;
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb {
+ status = "okay";
+ vbus-supply = <&usb_pwr_en>;
+};
+
+&usb2_phy0 {
+ phy-supply = <&vcc_5v>;
+};
+
&usb2_phy1 {
/* Enable the hub which is connected to this port */
phy-supply = <&hub_5v>;
--
2.25.1

View File

@@ -0,0 +1,40 @@
From b478d4ef6c669a73c7b54cab1e8b07a813aa1377 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Mon, 11 May 2020 07:41:52 +0900
Subject: [PATCH 067/109] ODROID-C4: arm64/dts: add more CPU frequencies
Two new CPU frequencies, 2.016GHz and 2.100GHz are added.
ODROID-C4 could run 2.016GHz, but 2.100GHz can cause unexpected crashing.
Change-Id: I87588077509bcb1165b59ad94ff06f682a193c84
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
index 9b2c191620b9..b7e7df08691e 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -10,3 +10,18 @@
/ {
model = "Hardkernel ODROID-C4";
};
+
+&cpu_opp_table {
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1000000>;
+ };
+ opp-2100000000 {
+ opp-hz = /bits/ 64 <2100000000>;
+ opp-microvolt = <1022000>;
+ };
+};
+
+&vddcpu {
+ regulator-max-microvolt = <1030000>;
+};
--
2.25.1

View File

@@ -0,0 +1,85 @@
From f8246f96e5b3175ab30366ff7d6e71f4574f5388 Mon Sep 17 00:00:00 2001
From: Hyeonki Hong <hhk7734@gmail.com>
Date: Wed, 13 May 2020 10:37:28 +0900
Subject: [PATCH 068/109] ODROID-C4: arm64/dts: add i2c2, i2c3 node
Change-Id: Id75f935111744ff6945791deefef20f897dc98ac
(cherry picked from commit 3f4b2ffd0905946175c478baa65361695e78e0de)
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 7e79168356ef..d618bcd78594 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -13,6 +13,8 @@ / {
aliases {
ethernet0 = &ethmac;
+ i2c0 = &i2c2;
+ i2c1 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
};
@@ -79,6 +81,57 @@ &ir {
linux,rc-map-name = "rc-odroid";
};
+&i2c2 {
+ status = "okay";
+
+ /*
+ * 40 Pin Header : SDA(GPIOX.17->3 Pin)
+ * SCL(GPIOX.18->5 Pin)
+ */
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c2_master_pins1>;
+
+ /* default 400k */
+ clock-frequency = <400000>;
+};
+
+&i2c3 {
+ /* default i2c clock-frequency is 100Khz */
+ status = "okay";
+
+ /*
+ * 40 Pin Header : SDA(GPIOA.14->27 Pin)
+ * SCL(GPIOA.15->28 Pin)
+ */
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3_master_pins2>;
+
+ /* default 100k */
+ clock-frequency = <100000>;
+};
+
+&periphs_pinctrl {
+ i2c2_master_pins1: i2c2-master-pins1 {
+ mux {
+ groups = "i2c2_sda_x",
+ "i2c2_sck_x";
+ function = "i2c2";
+ bias-pull-up;
+ drive-strength-microamp = <3000>;
+ };
+ };
+
+ i2c3_master_pins2: i2c3-master-pins2 {
+ mux {
+ groups = "i2c3_sda_a",
+ "i2c3_sck_a";
+ function = "i2c3";
+ bias-pull-up;
+ drive-strength-microamp = <3000>;
+ };
+ };
+};
+
&pwm_AO_cd {
pinctrl-0 = <&pwm_ao_d_e_pins>;
pinctrl-names = "default";
--
2.25.1

View File

@@ -0,0 +1,67 @@
From e76578143e67a471a3ce46f7b4aecb590c729f5b Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 22 Sep 2020 16:12:16 +0900
Subject: [PATCH 069/109] ODROID-C4: arm64/dts: refining the CPU opp table
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I4a12582343dea8d4badac01a0258eda02fef293a
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index d618bcd78594..335a38ffb519 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -62,6 +62,48 @@ sound {
};
};
+&cpu_opp_table {
+ opp-1000000000 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <799999>;
+ };
+
+ opp-1200000000 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <809999>;
+ };
+
+ opp-1404000000 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <819999>;
+ };
+
+ opp-1500000000 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <829999>;
+ };
+
+ opp-1608000000 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <859999>;
+ };
+
+ opp-1704000000 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <899999>;
+ };
+
+ opp-1800000000 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <939999>;
+ };
+
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <999999>;
+ };
+};
+
&gpio {
/*
* WARNING: The USB Hub on the Odroid-C4 needs a reset signal
--
2.25.1

View File

@@ -0,0 +1,40 @@
From 0ea885177045192f231c1662a1ab1bd16b5e8a56 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 23 Sep 2020 12:20:36 +0900
Subject: [PATCH 070/109] ODROID-C4: arm64/dts: add new overclock and remove
underclock frequencies
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ib07f543529e5f17583abbb3bc868487612cfef9a
---
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
index b7e7df08691e..64b7645e87c4 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -12,13 +12,18 @@ / {
};
&cpu_opp_table {
+ /delete-node/ opp-100000000;
+ /delete-node/ opp-250000000;
+ /delete-node/ opp-500000000;
+ /delete-node/ opp-667000000;
+
opp-2016000000 {
opp-hz = /bits/ 64 <2016000000>;
- opp-microvolt = <1000000>;
+ opp-microvolt = <1010000>;
};
opp-2100000000 {
opp-hz = /bits/ 64 <2100000000>;
- opp-microvolt = <1022000>;
+ opp-microvolt = <1030000>;
};
};
--
2.25.1

View File

@@ -0,0 +1,65 @@
From 5452e139c7c221306252b1b6238a7689a9cc43e3 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 10 Jun 2020 13:11:12 +0900
Subject: [PATCH 071/109] ODROID-HC4: Introduce new SBC board 'ODROID-HC4'
Change-Id: I1ef7c77dd26c0870c2057a090417bb59ba0ba52c
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../boot/dts/amlogic/meson64_odroidhc4.dts | 32 +++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 9d3ef969eb55..3a9671f3a292 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -53,5 +53,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson64_odroidhc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2_plus.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
new file mode 100644
index 000000000000..d8e8246d3868
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-odroid-hc4.dts"
+
+/ {
+ model = "Hardkernel ODROID-HC4";
+};
+
+&cpu_opp_table {
+ /delete-node/ opp-100000000;
+ /delete-node/ opp-250000000;
+ /delete-node/ opp-500000000;
+ /delete-node/ opp-667000000;
+
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1010000>;
+ };
+ opp-2100000000 {
+ opp-hz = /bits/ 64 <2100000000>;
+ opp-microvolt = <1030000>;
+ };
+};
+
+&vddcpu {
+ regulator-max-microvolt = <1030000>;
+};
--
2.25.1

View File

@@ -0,0 +1,36 @@
From 154259cdf33359d1aa9e12b98f0ff099ad3d417b Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 6 Oct 2020 17:49:18 +0900
Subject: [PATCH 072/109] ODROID-C4: arm64:dts: reboot / power off support for
ODROID-C4
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I22316a4ab896a0d8511d2cb2c34ac00360bb44d1
---
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
index 64b7645e87c4..74531ad8dd75 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -9,6 +9,16 @@
/ {
model = "Hardkernel ODROID-C4";
+
+ odroid-reboot {
+ compatible = "odroid,reboot";
+ sys_reset = <0x84000009>;
+ sys_poweroff = <0x84000008>;
+
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+ };
};
&cpu_opp_table {
--
2.25.1

View File

@@ -0,0 +1,51 @@
From d61089abd81e867c9f521fa9dd383591046dafba Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Tue, 6 Oct 2020 18:37:25 +0900
Subject: [PATCH 073/109] ODROID-N2: arm64:dts: reboot / power off support for
ODROID-N2/N2Plus
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I27adc0b9836823219d70a05375fa1327f830130d
---
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 9 +++++++++
arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
index d7bbe52d92af..3f1a090be84c 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -18,6 +18,15 @@
/ {
model = "Hardkernel ODROID-N2";
+ reboot: odroid-reboot {
+ compatible = "odroid,reboot";
+ sys_reset = <0x84000009>;
+ sys_poweroff = <0x84000008>;
+
+ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
+ };
+
dio2133: audio-amplifier-0 {
compatible = "simple-audio-amplifier";
enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
index 8dc68eee628d..1f3ed5f03c68 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
@@ -12,6 +12,10 @@ / {
model = "Hardkernel ODROID-N2Plus";
};
+&reboot {
+ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+};
+
&vddcpu_a {
regulator-min-microvolt = <680000>;
regulator-max-microvolt = <1040000>;
--
2.25.1

View File

@@ -0,0 +1,68 @@
From 84f98f83d0cc930ae32085d80f5359a51e7c3fe2 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 13 Nov 2020 08:47:01 +0900
Subject: [PATCH 074/109] ODROID-N2/C4/HC: arm64/dts: remove property 'resets'
and 'reset-names'
Having this properties in the node 'ethmac', it does cause to load wrong
MAC address.
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ifca39bb60d4cbb6586ef9a8789f6dd243352dc1e
---
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 5 +++++
arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts | 5 +++++
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
index 74531ad8dd75..5de451074e18 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -37,6 +37,11 @@ opp-2100000000 {
};
};
+&ethmac {
+ /delete-property/ resets;
+ /delete-property/ reset-names;
+};
+
&vddcpu {
regulator-max-microvolt = <1030000>;
};
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
index d8e8246d3868..7e357612d27a 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
@@ -27,6 +27,11 @@ opp-2100000000 {
};
};
+&ethmac {
+ /delete-property/ resets;
+ /delete-property/ reset-names;
+};
+
&vddcpu {
regulator-max-microvolt = <1030000>;
};
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
index 3f1a090be84c..1d880b2752bb 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -174,6 +174,11 @@ fan_cooling_map1 {
};
};
+&ethmac {
+ /delete-property/ resets;
+ /delete-property/ reset-names;
+};
+
&spdifout {
pinctrl-0 = <&spdif_out_a13_pins>;
pinctrl-names = "default";
--
2.25.1

View File

@@ -0,0 +1,51 @@
From ee20cb8dfa5a748fd84dbc08f56694cc9883ff51 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 1 Dec 2020 17:59:23 +0900
Subject: [PATCH 075/109] ODROID-HC4: arm64/dts: remap opp-table for unstablity
at certain cpu freqs
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ifbd88df8379e51c912753249d4182a2c8f4b651b
---
.../boot/dts/amlogic/meson64_odroidhc4.dts | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
index 7e357612d27a..be344d0956c0 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
@@ -17,6 +17,31 @@ &cpu_opp_table {
/delete-node/ opp-500000000;
/delete-node/ opp-667000000;
+ opp-1000000000 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <860000>;
+ };
+
+ opp-1200000000 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <860000>;
+ };
+
+ opp-1404000000 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <870000>;
+ };
+
+ opp-1512000000 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <880000>;
+ };
+
+ opp-1608000000 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <890000>;
+ };
+
opp-2016000000 {
opp-hz = /bits/ 64 <2016000000>;
opp-microvolt = <1010000>;
--
2.25.1

View File

@@ -0,0 +1,42 @@
From 8a4c5fa7e64107390ac22dd352ac4b7bd99e6a5c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 17 Jan 2021 00:14:18 +0100
Subject: [PATCH 076/109] ODROID-HC4: arm64/dts: add red power led this is in
addition to the blue led in the C4.
Defaults mode of the RED led is always-on, but its mode can be changed,
$ echo rc-feedback | sudo tee /sys/class/leds/red:power/trigger
Or can be turned off,
$ echo 0 | sudo tee /sys/class/leds/red:power/brightness
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
Change-Id: Ia508724908e6af90d4c3dbc24d156c86d5b08c98
---
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 10 ++++++++++
1 file changed, 10 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 bf15700c4b15..2d4745950bb2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -47,6 +47,16 @@ led-red {
sound {
model = "ODROID-HC4";
};
+
+ leds {
+ compatible = "gpio-leds";
+ led-red {
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_POWER;
+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "default-on";
+ };
+ };
};
&cpu_thermal {
--
2.25.1

View File

@@ -0,0 +1,34 @@
From 548e2d642c46f64af836c969cdd8d44a224bbcb8 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 8 Jan 2021 03:27:07 +0900
Subject: [PATCH 077/109] (DO NOT MERGE) ODROID-COMMON: drm/meson: not load
RGB709 to YUV709 coefficient
By loading this matrix, OSD color becomes a bit reddish.
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ice08001c967c39b638ab534453b784c2958ff7f0
---
drivers/gpu/drm/meson/meson_viu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c
index aede0c67a57f..1287444b1bc8 100644
--- a/drivers/gpu/drm/meson/meson_viu.c
+++ b/drivers/gpu/drm/meson/meson_viu.c
@@ -425,9 +425,12 @@ void meson_viu_init(struct meson_drm *priv)
if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) ||
meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL))
meson_viu_load_matrix(priv);
+#if 0
+ /* FIXME: */
else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A))
meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff,
true);
+#endif
/* Initialize OSD1 fifo control register */
reg = VIU_OSD_DDR_PRIORITY_URGENT |
--
2.25.1

View File

@@ -0,0 +1,34 @@
From 2d7c1d62d1f32e889bc4f5aabb975f2dfae66fe9 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 10 Feb 2021 06:11:09 +0000
Subject: [PATCH 078/109] ODROID-N2/C4: gpu/drm: Add Hardkernel 3.2" LCD driver
to ili9341 driver
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I890f0369126eda88ef16723efec828cd85d25b53
---
drivers/gpu/drm/tiny/ili9341.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index 6ce97f0698eb..2dc471ee3503 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -163,12 +163,14 @@ static const struct drm_driver ili9341_driver = {
static const struct of_device_id ili9341_of_match[] = {
{ .compatible = "adafruit,yx240qv29" },
+ { .compatible = "hardkernel,hktft32" },
{ }
};
MODULE_DEVICE_TABLE(of, ili9341_of_match);
static const struct spi_device_id ili9341_id[] = {
{ "yx240qv29", 0 },
+ { "hktft32", 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, ili9341_id);
--
2.25.1

View File

@@ -0,0 +1,425 @@
From 7b5e53006f1e39f2630b7e4ab6db56d75163752d Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 9 Feb 2021 13:27:41 +0900
Subject: [PATCH 079/109] ODROID-N2/C4: gpu/drm: Add new Tiny DRM driver with
Ili9488
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I6e4f783ab642cc735ef445d010afb1cd930757c6
---
drivers/gpu/drm/tiny/Kconfig | 13 +
drivers/gpu/drm/tiny/Makefile | 1 +
drivers/gpu/drm/tiny/ili9488_pio.c | 365 +++++++++++++++++++++++++++++
3 files changed, 379 insertions(+)
create mode 100644 drivers/gpu/drm/tiny/ili9488_pio.c
diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 2b6414f0fa75..69f2a7428b4f 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -80,6 +80,19 @@ config TINYDRM_ILI9486
If M is selected the module will be called ili9486.
+config TINYDRM_ILI9488_PIO
+ tristate "DRM support for ILI9488 display panels (8bit PIO)"
+ depends on DRM
+ select DRM_KMS_HELPER
+ select DRM_KMS_CMA_HELPER
+ select DRM_MIPI_DBI
+ select BACKLIGHT_CLASS_DEVICE
+ help
+ DRM driver for th following Ilitek ILI9488 panels:
+ * Hardkernel 3.5" 480x320 TFT (HKTFT 3.5")
+
+ If M is selected the module will be called hktft35.
+
config TINYDRM_MI0283QT
tristate "DRM support for MI0283QT"
depends on DRM && SPI
diff --git a/drivers/gpu/drm/tiny/Makefile b/drivers/gpu/drm/tiny/Makefile
index 6ae4e9e5a35f..6a8459d14bca 100644
--- a/drivers/gpu/drm/tiny/Makefile
+++ b/drivers/gpu/drm/tiny/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o
obj-$(CONFIG_TINYDRM_ILI9225) += ili9225.o
obj-$(CONFIG_TINYDRM_ILI9341) += ili9341.o
obj-$(CONFIG_TINYDRM_ILI9486) += ili9486.o
+obj-$(CONFIG_TINYDRM_ILI9488_PIO) += ili9488_pio.o
obj-$(CONFIG_TINYDRM_MI0283QT) += mi0283qt.o
obj-$(CONFIG_TINYDRM_REPAPER) += repaper.o
obj-$(CONFIG_TINYDRM_ST7586) += st7586.o
diff --git a/drivers/gpu/drm/tiny/ili9488_pio.c b/drivers/gpu/drm/tiny/ili9488_pio.c
new file mode 100644
index 000000000000..5abee96d5a38
--- /dev/null
+++ b/drivers/gpu/drm/tiny/ili9488_pio.c
@@ -0,0 +1,365 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * DRM driver for Hardkernel 3.5 ISP TFT display
+ *
+ * Copyright 2021 Dongjin Kim <tobetter@gmail.com>
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/dma-buf.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/of_gpio.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+#include <video/mipi_display.h>
+
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_damage_helper.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_managed.h>
+#include <drm/drm_mipi_dbi.h>
+#include <drm/drm_rect.h>
+
+#define ILI9488_COLUMN_ADDR 0x2a
+#define ILI9488_PAGE_ADDR 0x2b
+#define ILI9488_MEMORY_WRITE 0x2c
+#define ILI9488_ITFCTR1 0xb0
+#define ILI9488_FRMCTR1 0xb1
+#define ILI9488_PWCTRL1 0xc2
+#define ILI9488_VMCTRL1 0xc5
+#define ILI9488_PGAMCTRL 0xe0
+#define ILI9488_NGAMCTRL 0xe1
+#define ILI9488_MADCTL_BGR BIT(3)
+#define ILI9488_MADCTL_MV BIT(5)
+#define ILI9488_MADCTL_MX BIT(6)
+#define ILI9488_MADCTL_MY BIT(7)
+
+struct ili9488_data {
+ struct mipi_dbi_dev *dbidev;
+ struct gpio_desc *wr;
+ struct gpio_desc *cs;
+ struct gpio_desc *db[8];
+ void __iomem *membase;
+ u32 mask;
+ u32 bits[8];
+ u32 bits_wr;
+};
+
+static struct ili9488_data *pdata;
+static u32 *rgb;
+
+static u32 ili9488_rgb565_to_gpiobus(struct ili9488_data *pdata, u8 color)
+{
+ int i;
+ u32 value = 0;
+
+ for (i = 0; i < 8; i++) {
+ if (color & 1)
+ value |= pdata->bits[i];
+ else
+ value &= ~(pdata->bits[i]);
+ color >>= 1;
+ }
+
+ return value;
+}
+
+static int ili9488_bus_write(struct mipi_dbi *dbi, u8 data)
+{
+ int i;
+
+ if (pdata->membase) {
+ u32 v = (readl(pdata->membase) & ~pdata->mask) | *(rgb + data);
+ writel(v, pdata->membase);
+ writel(v | pdata->bits_wr, pdata->membase);
+ return 0;
+ }
+
+ gpiod_set_value(pdata->wr, 0);
+ for (i = 0; i < 8; i++) {
+ gpiod_set_value(pdata->db[i], data & 1);
+ data >>= 1;
+ }
+ gpiod_set_value(pdata->wr, 1);
+
+ return 0;
+}
+
+static int ili9488_command(struct mipi_dbi *dbi, u8 *cmd, u8 *par, size_t num)
+{
+ u8 *p = par;
+
+ gpiod_set_value(dbi->dc, 0);
+ ili9488_bus_write(dbi, *cmd);
+ gpiod_set_value(dbi->dc, 1);
+
+ while (num--)
+ ili9488_bus_write(dbi, *p++);
+
+ return 0;
+}
+
+static void ili9488_pipe_enable(struct drm_simple_display_pipe *pipe,
+ struct drm_crtc_state *crtc_state,
+ struct drm_plane_state *plane_state)
+{
+ struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+ struct mipi_dbi *dbi = &dbidev->dbi;
+ u8 addr_mode;
+ int ret, idx;
+
+ if (!drm_dev_enter(pipe->crtc.dev, &idx))
+ return;
+
+ ret = mipi_dbi_poweron_reset(dbidev);
+ if (ret < 0)
+ goto out_exit;
+ if (ret == 1)
+ goto out_enable;
+
+ gpiod_set_value(pdata->cs, 0);
+
+ mipi_dbi_command(dbi, ILI9488_ITFCTR1, 0x00);
+ mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE);
+ msleep(250);
+
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
+ mipi_dbi_command(dbi, ILI9488_PWCTRL1, 0x33);
+ mipi_dbi_command(dbi, ILI9488_VMCTRL1, 0x00, 0x1e, 0x80, 0x00);
+ mipi_dbi_command(dbi, ILI9488_FRMCTR1, 0xb0, 0x11);
+ mipi_dbi_command(dbi, ILI9488_PGAMCTRL,
+ 0x00, 0x04, 0x0e, 0x08, 0x17, 0x0a, 0x40, 0x79,
+ 0x4d, 0x07, 0x0e, 0x0a, 0x1a, 0x1d, 0x0f);
+ mipi_dbi_command(dbi, ILI9488_NGAMCTRL,
+ 0x00, 0x1b, 0x1f, 0x02, 0x10, 0x05, 0x32, 0x34,
+ 0x43, 0x02, 0x0a, 0x09, 0x33, 0x37, 0x0f);
+ mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON);
+ msleep(100);
+
+ out_enable:
+ switch (dbidev->rotation) {
+ case 90:
+ addr_mode = ILI9488_MADCTL_MY;
+ break;
+ case 180:
+ addr_mode = ILI9488_MADCTL_MV;
+ break;
+ case 270:
+ addr_mode = ILI9488_MADCTL_MX;
+ break;
+ default:
+ addr_mode = ILI9488_MADCTL_MV | ILI9488_MADCTL_MY |
+ ILI9488_MADCTL_MX;
+ break;
+ }
+
+ addr_mode |= ILI9488_MADCTL_BGR;
+ mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
+ mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
+
+out_exit:
+ drm_dev_exit(idx);
+}
+
+static const struct drm_simple_display_pipe_funcs ili9488_pipe_funcs = {
+ .enable = ili9488_pipe_enable,
+ .disable = mipi_dbi_pipe_disable,
+ .update = mipi_dbi_pipe_update,
+ .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
+};
+
+static const struct drm_display_mode ili9488_mode = {
+ DRM_SIMPLE_MODE(480, 320, 73, 49),
+};
+
+DEFINE_DRM_GEM_CMA_FOPS(ili9488_fops);
+
+static struct drm_driver ili9488_driver = {
+ .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
+ .fops = &ili9488_fops,
+ DRM_GEM_CMA_DRIVER_OPS_VMAP,
+ .name = "ili9488",
+ .desc = "Ilitek ILI9488",
+ .date = "20210201",
+ .major = 1,
+ .minor = 0,
+};
+
+static int ili9488_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct mipi_dbi *dbi;
+ struct drm_device *drm;
+ struct mipi_dbi_dev *dbidev;
+ int ret;
+ int i;
+ u32 rotation = 0;
+ struct resource res;
+ char str[32];
+
+ pdata = devm_kzalloc(dev, sizeof(struct ili9488_data), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+
+ dbidev = devm_drm_dev_alloc(dev, &ili9488_driver,
+ struct mipi_dbi_dev, drm);
+ if (IS_ERR(dbidev))
+ return PTR_ERR(dbidev);
+
+ dbi = &dbidev->dbi;
+ drm = &dbidev->drm;
+
+ dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(dbi->reset)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
+ return PTR_ERR(dbi->reset);
+ }
+
+ dbi->dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
+ if (IS_ERR(dbi->dc)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
+ return PTR_ERR(dbi->dc);
+ }
+
+ pdata->wr = devm_gpiod_get(dev, "wr", GPIOD_OUT_HIGH);
+ if (IS_ERR(pdata->wr)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'wr'\n");
+ return PTR_ERR(pdata->wr);
+ }
+
+ pdata->cs = devm_gpiod_get(dev, "cs", GPIOD_OUT_LOW);
+ if (IS_ERR(pdata->cs)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'cs'\n");
+ return PTR_ERR(pdata->cs);
+ }
+
+ for (i = 0; i < 8; i++) {
+ struct gpio_desc *desc;
+ int gpio = of_get_named_gpio(np, "db-gpios", i);
+ if (gpio < 0)
+ break; /* FIXME */
+
+ desc = gpio_to_desc(gpio);
+
+ devm_gpio_request(dev, gpio, NULL);
+ gpiod_direction_output(desc, 1);
+
+ pdata->db[i] = desc;
+ }
+
+ ret = of_address_to_resource(np, 0, &res);
+ if (!ret) {
+ pdata->membase = devm_ioremap(dev, res.start,
+ resource_size(&res));
+ if (!IS_ERR(pdata->membase)) {
+ for (i = 0; i < 8; i++) {
+ sprintf(str, "db-bits-%d", i);
+ ret = of_property_read_u32(np, str,
+ &pdata->bits[i]);
+ if (ret)
+ continue;
+ pdata->mask |= pdata->bits[i];
+ }
+
+ ret = of_property_read_u32(np, "db-bits-wr",
+ &pdata->bits_wr);
+ if (!ret)
+ pdata->mask |= pdata->bits_wr;
+ }
+ }
+
+ dbidev->backlight = devm_of_find_backlight(dev);
+ if (IS_ERR(dbidev->backlight))
+ return PTR_ERR(dbidev->backlight);
+
+ device_property_read_u32(dev, "rotation", &rotation);
+
+ rgb = devm_kzalloc(dev, sizeof(u32) * 256, GFP_KERNEL);
+ if (rgb) {
+ u32 *p = rgb;
+ for (i = 0; i < 256; i++)
+ *p++ = ili9488_rgb565_to_gpiobus(pdata, i);
+ }
+
+ gpiod_set_value(pdata->wr, 1);
+ gpiod_set_value(dbi->dc, 0);
+
+ /* override the command function set in mipi_dbi_spi_init() */
+ dbi->command = ili9488_command;
+ dbi->read_commands = NULL;
+ dbi->swap_bytes = true;
+
+ ret = mipi_dbi_dev_init(dbidev, &ili9488_pipe_funcs,
+ &ili9488_mode, rotation);
+ if (ret)
+ return ret;
+
+ drm_mode_config_reset(drm);
+
+ ret = drm_dev_register(drm, 0);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, pdata);
+ pdata->dbidev = dbidev;
+
+ drm_fbdev_generic_setup(drm, 0);
+
+ return 0;
+}
+
+static int ili9488_remove(struct platform_device *pdev)
+{
+ struct ili9488_data *pdata = platform_get_drvdata(pdev);
+ struct mipi_dbi_dev *dbidev = pdata->dbidev;
+ struct drm_device *drm = &dbidev->drm;
+
+ drm_dev_unplug(drm);
+ drm_atomic_helper_shutdown(drm);
+
+ return 0;
+}
+
+static const struct of_device_id ili9488_dt_ids[] = {
+ { .compatible = "ili9488", 0 },
+ { .compatible = "hardkernel,ili9488", 0 },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, ili9488_dt_ids);
+
+static struct platform_driver ili9488_platform_driver = {
+ .driver = {
+ .name = "ili9488",
+ .of_match_table = ili9488_dt_ids,
+ },
+ .probe = ili9488_probe,
+ .remove = ili9488_remove,
+};
+
+static int __init ili9488_init(void)
+{
+ return platform_driver_register(&ili9488_platform_driver);
+}
+
+static void __exit ili9488_exit(void)
+{
+ platform_driver_unregister(&ili9488_platform_driver);
+}
+
+module_init(ili9488_init);
+module_exit(ili9488_exit);
+
+MODULE_DESCRIPTION("Ilitek ILI9488 DRM driver (8bit PIO mode)");
+MODULE_AUTHOR("Dongjin Kim <tobetter@gmail.com>");
+MODULE_LICENSE("GPL");
--
2.25.1

View File

@@ -0,0 +1,50 @@
From ef2a8191ceec8bd0eb0c09930a40fc400cb492d9 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 10 Feb 2021 07:10:06 +0000
Subject: [PATCH 080/109] ODROID-C4: arm64/dts: add SPI device entry to
'ODROID-C4'
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ia55c649297cd988ca19ae9b65fa7736d0f074352
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 335a38ffb519..44687ec071b6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -17,6 +17,7 @@ aliases {
i2c1 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
+ spi0 = &spicc0;
};
chosen {
@@ -226,6 +227,22 @@ &sd_emmc_c {
vqmmc-supply = <&flash_1v8>;
};
+&spicc0 {
+ status = "okay";
+
+ pinctrl-names = "default","gpio_periphs";
+ pinctrl-0 = <&spicc0_x_pins>;
+ pinctrl-1 = <&spicc0_ss0_x_pins>;
+
+ spidev@0 {
+ status = "okay";
+
+ compatible = "linux,spidev";
+ reg = <0>;
+ spi-max-frequency = <100000000>;
+ };
+};
+
&tdmif_b {
status = "okay";
};
--
2.25.1

View File

@@ -0,0 +1,110 @@
From 98a3afbd797c0a891a9bd74902f05921f204e3e9 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 10 Feb 2021 05:55:12 +0000
Subject: [PATCH 081/109] ODROID-N2/C4: arm64/dts: add device tree overlay for
SPI0
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I6aac29505b9ce8a867c95dff0a304f37ff1bcfef
---
arch/arm64/boot/dts/amlogic/Makefile | 3 +++
.../dts/amlogic/overlays/odroidc4/Makefile | 5 +++++
.../dts/amlogic/overlays/odroidc4/spi0.dts | 21 +++++++++++++++++++
.../dts/amlogic/overlays/odroidn2/Makefile | 5 +++++
.../dts/amlogic/overlays/odroidn2/spi0.dts | 21 +++++++++++++++++++
5 files changed, 55 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/spi0.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/spi0.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 3a9671f3a292..73767f68eaa2 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -56,3 +56,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson64_odroidc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidhc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson64_odroidn2_plus.dtb
+
+subdir-y += overlays/odroidc4
+subdir-y += overlays/odroidn2
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
new file mode 100644
index 000000000000..fc1a76db000d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -0,0 +1,5 @@
+dtbo-y += \
+ spi0.dtbo
+
+targets += $(dtbo-y)
+always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/spi0.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/spi0.dts
new file mode 100644
index 000000000000..da9817758bea
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/spi0.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&spicc0>;
+
+ __overlay__ {
+ status = "okay";
+
+ cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
+
+ spidev: spidev@0 {
+ spi-max-frequency = <100000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
new file mode 100644
index 000000000000..fc1a76db000d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -0,0 +1,5 @@
+dtbo-y += \
+ spi0.dtbo
+
+targets += $(dtbo-y)
+always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/spi0.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/spi0.dts
new file mode 100644
index 000000000000..da9817758bea
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/spi0.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&spicc0>;
+
+ __overlay__ {
+ status = "okay";
+
+ cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
+
+ spidev: spidev@0 {
+ spi-max-frequency = <100000000>;
+ };
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,160 @@
From f02d1093380829a87e2391c2f0fe80f2802796e9 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 29 Jan 2021 04:52:14 +0000
Subject: [PATCH 082/109] ODROID-N2/C4: arm64/dts: add device tree overlay for
HKTFT35 LCD
Change-Id: Iee351b10593e8fc9e778f47b72482a44722c0dad
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
.../dts/amlogic/overlays/odroidc4/Makefile | 3 +-
.../dts/amlogic/overlays/odroidc4/hktft35.dts | 53 +++++++++++++++++++
.../dts/amlogic/overlays/odroidn2/Makefile | 1 +
.../dts/amlogic/overlays/odroidn2/hktft35.dts | 53 +++++++++++++++++++
4 files changed, 109 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index fc1a76db000d..31b06704004e 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,5 +1,6 @@
dtbo-y += \
- spi0.dtbo
+ spi0.dtbo \
+ hktft35.dtbo
targets += $(dtbo-y)
always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
new file mode 100644
index 000000000000..0fb34f609c79
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target-path = "/";
+
+ __overlay__ {
+ backlight: backlight {
+ compatible = "gpio-backlight";
+ gpios = <&gpio GPIOX_6 GPIO_ACTIVE_HIGH>;
+ };
+
+ display: display {
+ #address-cells = <2>;
+ #size-cells = <1>;
+
+ status = "okay";
+ compatible = "hardkernel,ili9488";
+ reg = <0x0 0xff63445c 0x0 0x04>;
+
+ rotate = <270>;
+ backlight = <&backlight>;
+
+ db-bits-0 = <0x00000002>;
+ db-bits-1 = <0x00000004>;
+ db-bits-2 = <0x00000001>;
+ db-bits-3 = <0x00000800>;
+ db-bits-4 = <0x00000200>;
+ db-bits-5 = <0x00000100>;
+ db-bits-6 = <0x00000080>;
+ db-bits-7 = <0x00000010>;
+ db-bits-wr = <0x00000400>;
+
+ reset-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpio GPIOX_14 GPIO_ACTIVE_HIGH>;
+ wr-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio GPIOX_16 GPIO_ACTIVE_HIGH>;
+ db-gpios = <&gpio GPIOX_1 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_2 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_0 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_11 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_9 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_8 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_7 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index fc1a76db000d..64462609b8c7 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -1,4 +1,5 @@
dtbo-y += \
+ hktft35.dtbo \
spi0.dtbo
targets += $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts
new file mode 100644
index 000000000000..3dfc3c8e5eb2
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target-path = "/";
+
+ __overlay__ {
+ backlight: backlight {
+ compatible = "gpio-backlight";
+ gpios = <&gpio GPIOX_5 GPIO_ACTIVE_HIGH>;
+ };
+
+ display: display {
+ #address-cells = <2>;
+ #size-cells = <1>;
+
+ status = "okay";
+ compatible = "hardkernel,ili9488";
+ reg = <0x0 0xff63445c 0x0 0x04>;
+
+ rotate = <270>;
+ backlight = <&backlight>;
+
+ db-bits-0 = <0x00000002>;
+ db-bits-1 = <0x00000004>;
+ db-bits-2 = <0x00000001>;
+ db-bits-3 = <0x00000800>;
+ db-bits-4 = <0x00000200>;
+ db-bits-5 = <0x00000100>;
+ db-bits-6 = <0x00000080>;
+ db-bits-7 = <0x00000010>;
+ db-bits-wr = <0x00000400>;
+
+ reset-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpio GPIOX_14 GPIO_ACTIVE_HIGH>;
+ wr-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio GPIOX_16 GPIO_ACTIVE_HIGH>;
+ db-gpios = <&gpio GPIOX_1 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_2 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_0 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_11 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_9 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_8 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_7 GPIO_ACTIVE_HIGH>,
+ <&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,67 @@
From b12c04ecbfc4aede531bd08b51219b73d66b2b39 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 5 Feb 2021 15:21:25 +0000
Subject: [PATCH 083/109] ODROID-C4: arm64/dts: add device tree overlay for
Hardkernel 3.2" LCD
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Iaae4a9346c322ae3b7221ec306341c97ab020a05
---
.../dts/amlogic/overlays/odroidc4/Makefile | 1 +
.../dts/amlogic/overlays/odroidc4/hktft32.dts | 33 +++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft32.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index 31b06704004e..e82456f99f2f 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,5 +1,6 @@
dtbo-y += \
spi0.dtbo \
+ hktft32.dtbo \
hktft35.dtbo
targets += $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft32.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft32.dts
new file mode 100644
index 000000000000..b4dc1a55862d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft32.dts
@@ -0,0 +1,33 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&spicc0>;
+
+ __overlay__ {
+ status = "okay";
+
+ cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
+
+ display: display@0 {
+ #address-cells = <0x1>;
+ #size-cells = <0x0>;
+
+ status = "okay";
+
+ compatible = "hardkernel,hktft32";
+ reg = <0>;
+
+ spi-max-frequency = <40000000>;
+ rotation = <90>;
+ reset-gpios = <&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
+ dc-gpios = <&gpio GPIOX_7 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
+
--
2.25.1

View File

@@ -0,0 +1,124 @@
From 14516c8f925fc5b792459ff82de05a3df0af9c39 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Mon, 15 Feb 2021 05:46:24 +0000
Subject: [PATCH 084/109] ODROID-N2/C4: arm64/dts: add device tree overlay for
SX865x resistive touch screen
Change-Id: Ie9628a065791e5043c7086ce9820db3b64e1b1bc
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
.../dts/amlogic/overlays/odroidc4/Makefile | 1 +
.../amlogic/overlays/odroidc4/sx865x-i2c1.dts | 34 +++++++++++++++++++
.../dts/amlogic/overlays/odroidn2/Makefile | 3 +-
.../amlogic/overlays/odroidn2/sx865x-i2c1.dts | 34 +++++++++++++++++++
4 files changed, 71 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/sx865x-i2c1.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/sx865x-i2c1.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index e82456f99f2f..e466486632de 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,5 +1,6 @@
dtbo-y += \
spi0.dtbo \
+ sx865x-i2c1.dtbo \
hktft32.dtbo \
hktft35.dtbo
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/sx865x-i2c1.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/sx865x-i2c1.dts
new file mode 100644
index 000000000000..4b5e399bae62
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/sx865x-i2c1.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+ fragment@0 {
+ target = <&i2c3>;
+
+ __overlay__ {
+ status = "okay";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ sx865x: sx865x@49 {
+ status = "okay";
+ compatible = "semtech,sx8650";
+ reg = <0x49>;
+ #clock-cells = <0>;
+
+ interrupt-parent = <&gpio_intc>;
+ /* GPIOH_5 */
+ interrupts = <33 IRQ_TYPE_EDGE_FALLING>;
+ reset-gpios = <&gpio GPIOH_7 GPIO_ACTIVE_LOW>;
+
+ touchscreen-inverted-x;
+ touchscreen-swapped-x-y;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index 64462609b8c7..1bbd8e741230 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -1,6 +1,7 @@
dtbo-y += \
hktft35.dtbo \
- spi0.dtbo
+ spi0.dtbo \
+ sx865x-i2c1.dtbo
targets += $(dtbo-y)
always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/sx865x-i2c1.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/sx865x-i2c1.dts
new file mode 100644
index 000000000000..981c61338c6d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/sx865x-i2c1.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+ fragment@0 {
+ target = <&i2c3>;
+
+ __overlay__ {
+ status = "okay";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ sx865x: sx865x@49 {
+ status = "okay";
+ compatible = "semtech,sx8650";
+ reg = <0x49>;
+ #clock-cells = <0>;
+
+ interrupt-parent = <&gpio_intc>;
+ /* GPIOX_19 */
+ interrupts = <96 IRQ_TYPE_EDGE_FALLING>;
+ reset-gpios = <&gpio GPIOA_12 GPIO_ACTIVE_LOW>;
+
+ touchscreen-inverted-x;
+ touchscreen-swapped-x-y;
+ };
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,70 @@
From eb15a61584e870d80138b16825468c000a59a6f7 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 22 Jan 2021 11:38:06 +0900
Subject: [PATCH 085/109] ODROID-N2: arm64/dts: add new clock 1GHz for GPU
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ic1f4bb11a13ec003f35700d03c44f5b3e4f19a13
---
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 7 +++++++
arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts | 7 +++++++
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 7 +++++++
3 files changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
index 5de451074e18..5a77df90033e 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
@@ -42,6 +42,13 @@ &ethmac {
/delete-property/ reset-names;
};
+&gpu_opp_table {
+ opp-999999984 {
+ opp-hz = /bits/ 64 <999999984>;
+ opp-microvolt = <800000>;
+ };
+};
+
&vddcpu {
regulator-max-microvolt = <1030000>;
};
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
index be344d0956c0..6a9cd8513f9f 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
@@ -57,6 +57,13 @@ &ethmac {
/delete-property/ reset-names;
};
+&gpu_opp_table {
+ opp-999999984 {
+ opp-hz = /bits/ 64 <999999984>;
+ opp-microvolt = <800000>;
+ };
+};
+
&vddcpu {
regulator-max-microvolt = <1030000>;
};
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
index 1d880b2752bb..da1a0eb1eb32 100644
--- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
@@ -179,6 +179,13 @@ &ethmac {
/delete-property/ reset-names;
};
+&gpu_opp_table {
+ opp-999999984 {
+ opp-hz = /bits/ 64 <999999984>;
+ opp-microvolt = <800000>;
+ };
+};
+
&spdifout {
pinctrl-0 = <&spdif_out_a13_pins>;
pinctrl-names = "default";
--
2.25.1

View File

@@ -0,0 +1,219 @@
From c1268e4012c505dd8e2b0a3b4d5560de287364f1 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 25 Feb 2021 16:27:27 +0900
Subject: [PATCH 086/109] ODROID-N2/C4: arm64/dts: add 'w1-gpio' device tree
overlay nodes
This patch is to add the device tree node to connect onewire device to
GPIOX_2 (P15) or GPIOX_7 (P22).
Change-Id: I6d547a285388b16885dea7a4b7730a6aa09874d3
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
.../dts/amlogic/overlays/odroidc4/Makefile | 6 ++--
.../amlogic/overlays/odroidc4/w1-gpio_p15.dts | 34 +++++++++++++++++++
.../amlogic/overlays/odroidc4/w1-gpio_p22.dts | 34 +++++++++++++++++++
.../dts/amlogic/overlays/odroidn2/Makefile | 4 ++-
.../amlogic/overlays/odroidn2/w1-gpio_p15.dts | 34 +++++++++++++++++++
.../amlogic/overlays/odroidn2/w1-gpio_p22.dts | 34 +++++++++++++++++++
6 files changed, 143 insertions(+), 3 deletions(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p15.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p22.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p15.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p22.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index e466486632de..0e01ffc53908 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,8 +1,10 @@
dtbo-y += \
+ hktft32.dtbo \
+ hktft35.dtbo \
spi0.dtbo \
sx865x-i2c1.dtbo \
- hktft32.dtbo \
- hktft35.dtbo
+ w1-gpio_p15.dtbo \
+ w1-gpio_p22.dtbo
targets += $(dtbo-y)
always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p15.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p15.dts
new file mode 100644
index 000000000000..6134f057cdfc
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p15.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&pwm_f_x_pins>;
+
+ __overlay__ {
+ mux {
+ groups = "GPIOX_7";
+ function = "gpio_periphs";
+ bias-disable;
+ drive-strength-microamp = <4000>;
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/";
+
+ __overlay__ {
+ onewire: onewire {
+ compatible = "w1-gpio";
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pdm_din1_x_pins>;
+ gpios = <&gpio GPIOX_7 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p22.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p22.dts
new file mode 100644
index 000000000000..14e700b10a48
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/w1-gpio_p22.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&pdm_din1_x_pins>;
+
+ __overlay__ {
+ mux {
+ groups = "GPIOX_2";
+ function = "gpio_periphs";
+ bias-disable;
+ drive-strength-microamp = <4000>;
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/";
+
+ __overlay__ {
+ onewire: onewire {
+ compatible = "w1-gpio";
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pdm_din1_x_pins>;
+ gpios = <&gpio GPIOX_2 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index 1bbd8e741230..35dc85811b57 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -1,7 +1,9 @@
dtbo-y += \
hktft35.dtbo \
spi0.dtbo \
- sx865x-i2c1.dtbo
+ sx865x-i2c1.dtbo \
+ w1-gpio_p15.dtbo \
+ w1-gpio_p22.dtbo
targets += $(dtbo-y)
always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p15.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p15.dts
new file mode 100644
index 000000000000..6134f057cdfc
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p15.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&pwm_f_x_pins>;
+
+ __overlay__ {
+ mux {
+ groups = "GPIOX_7";
+ function = "gpio_periphs";
+ bias-disable;
+ drive-strength-microamp = <4000>;
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/";
+
+ __overlay__ {
+ onewire: onewire {
+ compatible = "w1-gpio";
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pdm_din1_x_pins>;
+ gpios = <&gpio GPIOX_7 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p22.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p22.dts
new file mode 100644
index 000000000000..14e700b10a48
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/w1-gpio_p22.dts
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ fragment@0 {
+ target = <&pdm_din1_x_pins>;
+
+ __overlay__ {
+ mux {
+ groups = "GPIOX_2";
+ function = "gpio_periphs";
+ bias-disable;
+ drive-strength-microamp = <4000>;
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/";
+
+ __overlay__ {
+ onewire: onewire {
+ compatible = "w1-gpio";
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pdm_din1_x_pins>;
+ gpios = <&gpio GPIOX_2 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,24 @@
From 789911a4df5edc958d60f2cbe181ca8b9a2c2791 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 4 Mar 2021 11:57:03 +0900
Subject: [PATCH 087/109] ODROID-N2: arm64/dts: overlay: add softlink for
ODROID-N2Plus
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I7ffd728cac899fc79983edf28e7dc3b0e2820173
---
arch/arm64/boot/dts/amlogic/overlays/odroidn2_plus | 1 +
1 file changed, 1 insertion(+)
create mode 120000 arch/arm64/boot/dts/amlogic/overlays/odroidn2_plus
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2_plus b/arch/arm64/boot/dts/amlogic/overlays/odroidn2_plus
new file mode 120000
index 000000000000..2583b0c5131c
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2_plus
@@ -0,0 +1 @@
+odroidn2
\ No newline at end of file
--
2.25.1

View File

@@ -0,0 +1,39 @@
From 9e17a896fb33d2f492cc878a0a700b2620c0dfdc Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Fri, 16 Apr 2021 12:17:41 +0900
Subject: [PATCH 088/109] ODROID-N2: arm64/dts: Add UART_B node
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: Icd77deb14d6047c051b16ca97c54d49fe1662aa8
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 17614be1901c..54adc2f4c46e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -19,6 +19,7 @@ aliases {
i2c1 = &i2c3;
serial0 = &uart_AO;
serial1 = &uart_A;
+ serial2 = &uart_B;
};
dioo2133: audio-amplifier-0 {
@@ -726,6 +727,12 @@ &uart_A {
pinctrl-0 = <&uart_a_pins>;
};
+&uart_B {
+ status = "disabled";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart_b_pins>;
+};
+
&uart_AO {
status = "okay";
pinctrl-0 = <&uart_ao_a_pins>;
--
2.25.1

View File

@@ -0,0 +1,84 @@
From 6f5c6f1ee0147778a86338b6c17a3ac3a97fb6b8 Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Fri, 16 Apr 2021 12:18:29 +0900
Subject: [PATCH 089/109] ODROID-N2: arm64/dts: Make UART_A disabled by default
and add UART DTBOs
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: If762b1001c48f123b62f8cb5f5d37195bc214ab1
---
.../arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 2 +-
.../boot/dts/amlogic/overlays/odroidn2/Makefile | 2 ++
.../boot/dts/amlogic/overlays/odroidn2/uart0.dts | 13 +++++++++++++
.../boot/dts/amlogic/overlays/odroidn2/uart1.dts | 13 +++++++++++++
4 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart0.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart1.dts
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 54adc2f4c46e..04c1aaef54f4 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -722,7 +722,7 @@ &toddr_c {
};
&uart_A {
- status = "okay";
+ status = "disabled";
pinctrl-names = "default";
pinctrl-0 = <&uart_a_pins>;
};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index 35dc85811b57..44b24128d317 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -1,6 +1,8 @@
dtbo-y += \
hktft35.dtbo \
spi0.dtbo \
+ uart0.dtbo \
+ uart1.dtbo \
sx865x-i2c1.dtbo \
w1-gpio_p15.dtbo \
w1-gpio_p22.dtbo
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart0.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart0.dts
new file mode 100644
index 000000000000..a9cb3fb41077
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart0.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_A>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart1.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart1.dts
new file mode 100644
index 000000000000..c1d25f9bee4c
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/uart1.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_B>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
--
2.25.1

View File

@@ -0,0 +1,44 @@
From 0142b646784e944d23ccabef00f129050d97cf2b Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Tue, 30 Mar 2021 09:57:28 +0900
Subject: [PATCH 090/109] ODROID-N2: arm64/dts: Move gpio-line-names into the
periphs_pinctrl node
In general, the gpio-line-names property should belong to the node
whereby the gpio-controller property by the related document written.
But from now, at least for the Odroid boards based on AMLogic SoC,
the property has to be in the periphs_pinctrl node so that the
function for assigning the line names recognizes that.
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I1b491db19dd7e6b678d34c4d288de7549458d783
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 04c1aaef54f4..7e2071cd44e3 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -450,7 +450,7 @@ &frddr_c {
status = "okay";
};
-&gpio {
+&periphs_pinctrl {
gpio-line-names =
/* GPIOZ */
"", "", "", "", "", "", "", "",
@@ -496,6 +496,9 @@ &gpio {
"PIN_3", /* GPIOX_17 */
"PIN_5", /* GPIOX_18 */
"PIN_36"; /* GPIOX_19 */
+};
+
+&gpio {
/*
* WARNING: The USB Hub on the Odroid-N2 needs a reset signal
* to be turned high in order to be detected by the USB Controller
--
2.25.1

View File

@@ -0,0 +1,58 @@
From 623548be09653f06b3f368a13c6b9e6190e54a58 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Mon, 22 Mar 2021 11:34:41 +0900
Subject: [PATCH 091/109] ODROID-C4: arm64/dts: add 'pcf8563' device tree
overlay nodes
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Iea246f2f8a2fb0047dbb7179dff2d96274ab4407
---
.../dts/amlogic/overlays/odroidc4/Makefile | 1 +
.../dts/amlogic/overlays/odroidc4/pcf8563.dts | 23 +++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/pcf8563.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index 0e01ffc53908..5bc56edf9770 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,6 +1,7 @@
dtbo-y += \
hktft32.dtbo \
hktft35.dtbo \
+ pcf8563.dtbo \
spi0.dtbo \
sx865x-i2c1.dtbo \
w1-gpio_p15.dtbo \
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pcf8563.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pcf8563.dts
new file mode 100644
index 000000000000..6fe883a62b2b
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pcf8563.dts
@@ -0,0 +1,23 @@
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ // i2c2 aliased with i2c0.
+ target = <&i2c2>;
+
+ __overlay__ {
+ status = "okay";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pcf8563: rtc@51 {
+ status = "okay";
+ compatible = "nxp,pcf8563";
+ reg = <0x51>;
+ };
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,76 @@
From 862c12d3903a2e82b3be7ae07cbadf32876d60de Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Tue, 30 Mar 2021 09:58:12 +0900
Subject: [PATCH 092/109] ODROID-C4: arm64/dts: Move gpio-line-names into the
periphs_pinctrl node
In general, the gpio-line-names property should belong to the node
whereby the gpio-controller property by the related document written.
But from now, at least for the Odroid boards based on AMLogic SoC,
the property has to be in the periphs_pinctrl node so that the
function for assigning the line names recognizes that.
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I328b47f88c0466de8657997d2c097c7f6fae33d7
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 44687ec071b6..5d021d1639fa 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -105,6 +105,50 @@ opp-1908000000 {
};
};
+&periphs_pinctrl {
+ gpio-line-names =
+ /* GPIOZ */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ /* GPIOH */
+ "", "", "", "", "",
+ "PIN_36", /* GPIOH_5 */
+ "PIN_26", /* GPIOH_6 */
+ "PIN_32", /* GPIOH_7 */
+ "",
+ /* BOOT */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ /* GPIOC */
+ "", "", "", "", "", "", "", "",
+ /* GPIOA */
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "",
+ "PIN_27", /* GPIOA_14 */
+ "PIN_28", /* GPIOA_15 */
+ /* GPIOX */
+ "PIN_16", /* GPIOX_0 */
+ "PIN_18", /* GPIOX_1 */
+ "PIN_22", /* GPIOX_2 */
+ "PIN_11", /* GPIOX_3 */
+ "PIN_13", /* GPIOX_4 */
+ "PIN_7", /* GPIOX_5 */
+ "PIN_33", /* GPIOX_6 */
+ "PIN_15", /* GPIOX_7 */
+ "PIN_19", /* GPIOX_8 */
+ "PIN_21", /* GPIOX_9 */
+ "PIN_24", /* GPIOX_10 */
+ "PIN_23", /* GPIOX_11 */
+ "PIN_8", /* GPIOX_12 */
+ "PIN_10", /* GPIOX_13 */
+ "PIN_29", /* GPIOX_14 */
+ "PIN_31", /* GPIOX_15 */
+ "PIN_12", /* GPIOX_16 */
+ "PIN_3", /* GPIOX_17 */
+ "PIN_5", /* GPIOX_18 */
+ "PIN_35"; /* GPIOX_19 */
+};
+
&gpio {
/*
* WARNING: The USB Hub on the Odroid-C4 needs a reset signal
--
2.25.1

View File

@@ -0,0 +1,130 @@
From ec672c0df13c296d37c600fa753485a9ac4a97e1 Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Thu, 15 Apr 2021 18:25:05 +0900
Subject: [PATCH 093/109] ODROID-C4: arm64/dts: Make UART_A disabled by default
and add UART DTBOs
Since UART_A can be enabled by DTBO now.
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: Ie08f49bafc7fab96879469deeaa53b5d7c9a9dfa
---
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 2 +-
.../boot/dts/amlogic/overlays/odroidc4/Makefile | 4 ++++
.../boot/dts/amlogic/overlays/odroidc4/uart0.dts | 13 +++++++++++++
.../boot/dts/amlogic/overlays/odroidc4/uart1.dts | 13 +++++++++++++
.../boot/dts/amlogic/overlays/odroidc4/uart2.dts | 13 +++++++++++++
.../boot/dts/amlogic/overlays/odroidc4/uart3.dts | 13 +++++++++++++
6 files changed, 57 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart0.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart1.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart2.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart3.dts
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 5d021d1639fa..5735664734fc 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -300,7 +300,7 @@ &tohdmitx {
};
&uart_A {
- status = "okay";
+ status = "disabled";
pinctrl-names = "default";
pinctrl-0 = <&uart_a_pins>;
};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index 5bc56edf9770..6a308651b833 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -3,6 +3,10 @@ dtbo-y += \
hktft35.dtbo \
pcf8563.dtbo \
spi0.dtbo \
+ uart0.dtbo \
+ uart1.dtbo \
+ uart2.dtbo \
+ uart3.dtbo \
sx865x-i2c1.dtbo \
w1-gpio_p15.dtbo \
w1-gpio_p22.dtbo
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart0.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart0.dts
new file mode 100644
index 000000000000..a9cb3fb41077
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart0.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_A>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart1.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart1.dts
new file mode 100644
index 000000000000..c1d25f9bee4c
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart1.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_B>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart2.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart2.dts
new file mode 100644
index 000000000000..e2d717288ed0
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart2.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_C>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart3.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart3.dts
new file mode 100644
index 000000000000..735faedc9d94
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/uart3.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&uart_AO_B>;
+
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
+
--
2.25.1

View File

@@ -0,0 +1,109 @@
From c7897872fabfb2456c8a4191155f769b9ab85671 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Tue, 20 Apr 2021 23:01:40 +0900
Subject: [PATCH 094/109] ODROID-C4: arm64/dts: Add basic overlay for
Hifi-Shield2
Support analog output only
BUG: channels are reversed which cannot be fixed by software
at this stage due to sharing with HDMI dai
Change-Id: I15fd0b96e996d092dce9845f13bbf3d8844a784e
Signed-off-by: Brad Harper <bjharper@gmail.com>
---
.../dts/amlogic/overlays/odroidc4/Makefile | 3 +-
.../amlogic/overlays/odroidc4/hifishield2.dts | 67 +++++++++++++++++++
2 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/hifishield2.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index 6a308651b833..ba98b92bc449 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -9,7 +9,8 @@ dtbo-y += \
uart3.dtbo \
sx865x-i2c1.dtbo \
w1-gpio_p15.dtbo \
- w1-gpio_p22.dtbo
+ w1-gpio_p22.dtbo \
+ hifishield2.dtbo
targets += $(dtbo-y)
always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hifishield2.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hifishield2.dts
new file mode 100644
index 000000000000..e1b94d6d0b34
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hifishield2.dts
@@ -0,0 +1,67 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/clock/axg-audio-clkc.h>
+
+/ {
+ fragment@0 {
+ // i2c2 aliased with i2c0.
+ target = <&i2c2>;
+
+ __overlay__ {
+ status = "okay";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pcm5122: pcm5122@4c {
+ #sound-dai-cells = <0>;
+ compatible = "ti,pcm5122";
+ reg = <0x4c>;
+ AVDD-supply = <&vddao_3v3>;
+ DVDD-supply = <&vddao_3v3>;
+ CPVDD-supply = <&vddao_3v3>;
+
+ status = "okay";
+ };
+ };
+ };
+
+ fragment@1 {
+ // add pcm5122 as seconday dai link to HDMI
+ target-path = "/sound";
+
+ sound_overlay: __overlay__ {
+
+ dai-link-3 {
+ codec-2 {
+ sound-dai = <&pcm5122>;
+ };
+ };
+ };
+ };
+
+ fragment@2 {
+ // set I2S master clocks and output on AO pins
+ target = <&tdmif_b>;
+
+ __overlay__ {
+ status = "okay";
+
+ pinctrl-0 = <&mclk0_ao_pins>,
+ <&tdm_ao_b_fs_pins>,
+ <&tdm_ao_b_sclk_pins>,
+ <&tdm_ao_b_dout0_pins>;
+
+ pinctrl-names = "default";
+
+ assigned-clocks = <&clkc_audio AUD_CLKID_TDM_MCLK_PAD0>,
+ <&clkc_audio AUD_CLKID_TDM_SCLK_PAD1>,
+ <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD1>;
+ assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
+ <&clkc_audio AUD_CLKID_MST_B_SCLK>,
+ <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
+ assigned-clock-rates = <0>, <0>, <0>;
+ };
+ };
+};
--
2.25.1

View File

@@ -0,0 +1,47 @@
From 98656dfcce55ca7d6d1b5a75594081d508fd0800 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Wed, 14 Apr 2021 18:00:07 +0900
Subject: [PATCH 095/109] ODROID-N2/C4/HC4: Revert "drm: meson_drv add shutdown
function"
Reboot fails 100% with this commit.
This reverts commit b0fe7f2c002adecda5f146bc5e430d0e3965c255.
Change-Id: Id91b44dad4359f137dfea2738e3a7705b211e67a
---
drivers/gpu/drm/meson/meson_drv.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 453d8b4c5763..42c5d3246cfc 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -482,16 +482,6 @@ static int meson_probe_remote(struct platform_device *pdev,
return count;
}
-static void meson_drv_shutdown(struct platform_device *pdev)
-{
- struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
- struct drm_device *drm = priv->drm;
-
- DRM_DEBUG_DRIVER("\n");
- drm_kms_helper_poll_fini(drm);
- drm_atomic_helper_shutdown(drm);
-}
-
static int meson_drv_probe(struct platform_device *pdev)
{
struct component_match *match = NULL;
@@ -563,7 +553,6 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
static struct platform_driver meson_drm_platform_driver = {
.probe = meson_drv_probe,
- .shutdown = meson_drv_shutdown,
.driver = {
.name = "meson-drm",
.of_match_table = dt_match,
--
2.25.1

View File

@@ -0,0 +1,38 @@
From 3f702e98d416b3c9490f2f8baeac72e3e06c3d93 Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Thu, 29 Apr 2021 11:48:37 +0900
Subject: [PATCH 096/109] ODROID-N2: arm64/dts: Add pin mux for PWM pins
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I4796c8a1ba5f5bc0e35aea1fa181d366f51bb474
---
.../arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 7e2071cd44e3..bcbd0b42516d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -588,6 +588,19 @@ mux {
drive-strength-microamp = <3000>;
};
};
+ pwmcd_to_gpios: pwmcd_gpio {
+ mux {
+ groups = "GPIOX_5", "GPIOX_6";
+ function = "gpio_periphs";
+ };
+ };
+
+ pwmef_to_gpios: pwmef_gpio {
+ mux {
+ groups = "GPIOX_16", "GPIOX_7";
+ function = "gpio_periphs";
+ };
+ };
};
&pwm_ab {
--
2.25.1

View File

@@ -0,0 +1,93 @@
From 4904aa5abb49cded10945162524a4493acac535f Mon Sep 17 00:00:00 2001
From: Deokgyu Yang <secugyu@gmail.com>
Date: Thu, 29 Apr 2021 11:48:59 +0900
Subject: [PATCH 097/109] ODROID-N2: arm64/dts: Add overlays for pwm_cd, pwm_ef
Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: Ie82fef5966107df46635c9538120e06b4a1c29a1
---
.../dts/amlogic/overlays/odroidn2/Makefile | 2 ++
.../dts/amlogic/overlays/odroidn2/pwm_cd.dts | 24 +++++++++++++++++++
.../dts/amlogic/overlays/odroidn2/pwm_ef.dts | 24 +++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_cd.dts
create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_ef.dts
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index 44b24128d317..7b84252ec076 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -3,6 +3,8 @@ dtbo-y += \
spi0.dtbo \
uart0.dtbo \
uart1.dtbo \
+ pwm_cd.dtbo \
+ pwm_ef.dtbo \
sx865x-i2c1.dtbo \
w1-gpio_p15.dtbo \
w1-gpio_p22.dtbo
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_cd.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_cd.dts
new file mode 100644
index 000000000000..aadf685f131b
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_cd.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&pwm_cd>;
+
+ __overlay__ {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm_c_x5_pins &pwm_d_x6_pins>;
+ pinctrl-1 = <&pwmcd_to_gpios>;
+ clocks = <&xtal>,
+ <&xtal>,
+ <&xtal>,
+ <&xtal>;
+ clock-names = "clkin0",
+ "clkin1",
+ "clkin2",
+ "clkin3";
+ };
+ };
+};
\ No newline at end of file
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_ef.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_ef.dts
new file mode 100644
index 000000000000..b25d1c45d95f
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_ef.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&pwm_ef>;
+
+ __overlay__ {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm_e_pins &pwm_f_x_pins>;
+ pinctrl-1 = <&pwmef_to_gpios>;
+ clocks = <&xtal>,
+ <&xtal>,
+ <&xtal>,
+ <&xtal>;
+ clock-names = "clkin0",
+ "clkin1",
+ "clkin2",
+ "clkin3";
+ };
+ };
+};
\ No newline at end of file
--
2.25.1

View File

@@ -0,0 +1,68 @@
From e7495effeb9ceb9c0abe75e34169f34604328e68 Mon Sep 17 00:00:00 2001
From: Lukasz Luba <lukasz.luba@arm.com>
Date: Thu, 21 Jan 2021 17:04:45 +0000
Subject: [PATCH 098/109] ODROID-BACKPORT: drm/panfrost: Add governor data with
pre-defined thresholds
The simple_ondemand devfreq governor uses two thresholds to decide about
the frequency change: upthreshold, downdifferential. These two tunable
change the behavior of the governor decision, e.g. how fast to increase
the frequency or how rapidly limit the frequency. This patch adds needed
governor data with thresholds values gathered experimentally in different
workloads.
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210121170445.19761-1-lukasz.luba@arm.com
Change-Id: I31515863ab174edf691542cbc6ffbf50959bb095
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 10 +++++++++-
drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 56b3f5935703..7c5ffc81dce1 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -130,8 +130,16 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
panfrost_devfreq_profile.initial_freq = cur_freq;
dev_pm_opp_put(opp);
+ /*
+ * Setup default thresholds for the simple_ondemand governor.
+ * The values are chosen based on experiments.
+ */
+ pfdevfreq->gov_data.upthreshold = 45;
+ pfdevfreq->gov_data.downdifferential = 5;
+
devfreq = devm_devfreq_add_device(dev, &panfrost_devfreq_profile,
- DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
+ DEVFREQ_GOV_SIMPLE_ONDEMAND,
+ &pfdevfreq->gov_data);
if (IS_ERR(devfreq)) {
DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n");
ret = PTR_ERR(devfreq);
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
index db6ea48e21f9..1e2a4de941aa 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
@@ -4,6 +4,7 @@
#ifndef __PANFROST_DEVFREQ_H__
#define __PANFROST_DEVFREQ_H__
+#include <linux/devfreq.h>
#include <linux/spinlock.h>
#include <linux/ktime.h>
@@ -17,6 +18,7 @@ struct panfrost_devfreq {
struct devfreq *devfreq;
struct opp_table *regulators_opp_table;
struct thermal_cooling_device *cooling;
+ struct devfreq_simple_ondemand_data gov_data;
bool opp_of_table_added;
ktime_t busy_time;
--
2.25.1

View File

@@ -0,0 +1,342 @@
From 4b9a12b4634223a342348c67c03894db900908a7 Mon Sep 17 00:00:00 2001
From: Luben Tuikov <luben.tuikov@amd.com>
Date: Wed, 20 Jan 2021 15:09:59 -0500
Subject: [PATCH 099/109] ODROID-BACKPORT: drm/scheduler: Job timeout handler
returns status (v3)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch does not change current behaviour.
The driver's job timeout handler now returns
status indicating back to the DRM layer whether
the device (GPU) is no longer available, such as
after it's been unplugged, or whether all is
normal, i.e. current behaviour.
All drivers which make use of the
drm_sched_backend_ops' .timedout_job() callback
have been accordingly renamed and return the
would've-been default value of
DRM_GPU_SCHED_STAT_NOMINAL to restart the task's
timeout timer--this is the old behaviour, and is
preserved by this patch.
v2: Use enum as the status of a driver's job
timeout callback method.
v3: Return scheduler/device information, rather
than task information.
Cc: Alexander Deucher <Alexander.Deucher@amd.com>
Cc: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Qiang Yu <yuq825@gmail.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Steven Price <steven.price@arm.com>
Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: Eric Anholt <eric@anholt.net>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Steven Price <steven.price@arm.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/415095/
Change-Id: I9adc003c8fc5863af748bbd027f4571a6c885647
---
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++--
drivers/gpu/drm/etnaviv/etnaviv_sched.c | 7 +++++-
drivers/gpu/drm/lima/lima_sched.c | 4 +++-
drivers/gpu/drm/panfrost/panfrost_job.c | 9 ++++---
drivers/gpu/drm/scheduler/sched_main.c | 4 +---
drivers/gpu/drm/v3d/v3d_sched.c | 32 +++++++++++++------------
include/drm/gpu_scheduler.h | 18 +++++++++++---
7 files changed, 52 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index ff48101bab55..759b34799221 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -28,7 +28,7 @@
#include "amdgpu.h"
#include "amdgpu_trace.h"
-static void amdgpu_job_timedout(struct drm_sched_job *s_job)
+static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
{
struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched);
struct amdgpu_job *job = to_amdgpu_job(s_job);
@@ -41,7 +41,7 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
DRM_ERROR("ring %s timeout, but soft recovered\n",
s_job->sched->name);
- return;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
amdgpu_vm_get_task_info(ring->adev, job->pasid, &ti);
@@ -53,10 +53,12 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
if (amdgpu_device_should_recover_gpu(ring->adev)) {
amdgpu_device_gpu_recover(ring->adev, job);
+ return DRM_GPU_SCHED_STAT_NOMINAL;
} else {
drm_sched_suspend_timeout(&ring->sched);
if (amdgpu_sriov_vf(adev))
adev->virt.tdr_debug = true;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index cd46c882269c..2a9439cbb0fb 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -82,7 +82,8 @@ static struct dma_fence *etnaviv_sched_run_job(struct drm_sched_job *sched_job)
return fence;
}
-static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
+static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
+ *sched_job)
{
struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
struct etnaviv_gpu *gpu = submit->gpu;
@@ -120,9 +121,13 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
drm_sched_resubmit_jobs(&gpu->sched);
+ drm_sched_start(&gpu->sched, true);
+ return DRM_GPU_SCHED_STAT_NOMINAL;
+
out_no_timeout:
/* restart scheduler after GPU is usable again */
drm_sched_start(&gpu->sched, true);
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
static void etnaviv_sched_free_job(struct drm_sched_job *sched_job)
diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c
index 5cc20b403a25..20dafa62980f 100644
--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -415,7 +415,7 @@ static void lima_sched_build_error_task_list(struct lima_sched_task *task)
mutex_unlock(&dev->error_task_list_lock);
}
-static void lima_sched_timedout_job(struct drm_sched_job *job)
+static enum drm_gpu_sched_stat lima_sched_timedout_job(struct drm_sched_job *job)
{
struct lima_sched_pipe *pipe = to_lima_pipe(job->sched);
struct lima_sched_task *task = to_lima_task(job);
@@ -449,6 +449,8 @@ static void lima_sched_timedout_job(struct drm_sched_job *job)
drm_sched_resubmit_jobs(&pipe->base);
drm_sched_start(&pipe->base, true);
+
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
static void lima_sched_free_job(struct drm_sched_job *job)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 04e6f6f9b742..0a83eefa49c4 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -432,7 +432,8 @@ static void panfrost_scheduler_start(struct panfrost_queue_state *queue)
mutex_unlock(&queue->lock);
}
-static void panfrost_job_timedout(struct drm_sched_job *sched_job)
+static enum drm_gpu_sched_stat panfrost_job_timedout(struct drm_sched_job
+ *sched_job)
{
struct panfrost_job *job = to_panfrost_job(sched_job);
struct panfrost_device *pfdev = job->pfdev;
@@ -443,7 +444,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
* spurious. Bail out.
*/
if (dma_fence_is_signaled(job->done_fence))
- return;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
dev_err(pfdev->dev, "gpu sched timeout, js=%d, config=0x%x, status=0x%x, head=0x%x, tail=0x%x, sched_job=%p",
js,
@@ -455,11 +456,13 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
/* Scheduler is already stopped, nothing to do. */
if (!panfrost_scheduler_stop(&pfdev->js->queue[js], sched_job))
- return;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
/* Schedule a reset if there's no reset in progress. */
if (!atomic_xchg(&pfdev->reset.pending, 1))
schedule_work(&pfdev->reset.work);
+
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
static const struct drm_sched_backend_ops panfrost_sched_ops = {
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 92637b70c9bf..73fccc54268b 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -527,7 +527,7 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
EXPORT_SYMBOL(drm_sched_start);
/**
- * drm_sched_resubmit_jobs - helper to relunch job from pending ring list
+ * drm_sched_resubmit_jobs - helper to relaunch jobs from the pending list
*
* @sched: scheduler instance
*
@@ -561,8 +561,6 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
} else {
s_job->s_fence->parent = fence;
}
-
-
}
}
EXPORT_SYMBOL(drm_sched_resubmit_jobs);
diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index 452682e2209f..ef2338a294ca 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -259,7 +259,7 @@ v3d_cache_clean_job_run(struct drm_sched_job *sched_job)
return NULL;
}
-static void
+static enum drm_gpu_sched_status
v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job)
{
enum v3d_queue q;
@@ -285,6 +285,8 @@ v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job)
}
mutex_unlock(&v3d->reset_lock);
+
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
/* If the current address or return address have changed, then the GPU
@@ -292,7 +294,7 @@ v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job)
* could fail if the GPU got in an infinite loop in the CL, but that
* is pretty unlikely outside of an i-g-t testcase.
*/
-static void
+static enum drm_task_status
v3d_cl_job_timedout(struct drm_sched_job *sched_job, enum v3d_queue q,
u32 *timedout_ctca, u32 *timedout_ctra)
{
@@ -304,39 +306,39 @@ v3d_cl_job_timedout(struct drm_sched_job *sched_job, enum v3d_queue q,
if (*timedout_ctca != ctca || *timedout_ctra != ctra) {
*timedout_ctca = ctca;
*timedout_ctra = ctra;
- return;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
- v3d_gpu_reset_for_timeout(v3d, sched_job);
+ return v3d_gpu_reset_for_timeout(v3d, sched_job);
}
-static void
+static enum drm_task_status
v3d_bin_job_timedout(struct drm_sched_job *sched_job)
{
struct v3d_bin_job *job = to_bin_job(sched_job);
- v3d_cl_job_timedout(sched_job, V3D_BIN,
- &job->timedout_ctca, &job->timedout_ctra);
+ return v3d_cl_job_timedout(sched_job, V3D_BIN,
+ &job->timedout_ctca, &job->timedout_ctra);
}
-static void
+static enum drm_task_status
v3d_render_job_timedout(struct drm_sched_job *sched_job)
{
struct v3d_render_job *job = to_render_job(sched_job);
- v3d_cl_job_timedout(sched_job, V3D_RENDER,
- &job->timedout_ctca, &job->timedout_ctra);
+ return v3d_cl_job_timedout(sched_job, V3D_RENDER,
+ &job->timedout_ctca, &job->timedout_ctra);
}
-static void
+static enum drm_task_status
v3d_generic_job_timedout(struct drm_sched_job *sched_job)
{
struct v3d_job *job = to_v3d_job(sched_job);
- v3d_gpu_reset_for_timeout(job->v3d, sched_job);
+ return v3d_gpu_reset_for_timeout(job->v3d, sched_job);
}
-static void
+static enum drm_task_status
v3d_csd_job_timedout(struct drm_sched_job *sched_job)
{
struct v3d_csd_job *job = to_csd_job(sched_job);
@@ -348,10 +350,10 @@ v3d_csd_job_timedout(struct drm_sched_job *sched_job)
*/
if (job->timedout_batches != batches) {
job->timedout_batches = batches;
- return;
+ return DRM_GPU_SCHED_STAT_NOMINAL;
}
- v3d_gpu_reset_for_timeout(v3d, sched_job);
+ return v3d_gpu_reset_for_timeout(v3d, sched_job);
}
static const struct drm_sched_backend_ops v3d_bin_sched_ops = {
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 975e8a67947f..ce6a383ed99f 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -206,6 +206,12 @@ static inline bool drm_sched_invalidate_job(struct drm_sched_job *s_job,
return s_job && atomic_inc_return(&s_job->karma) > threshold;
}
+enum drm_gpu_sched_stat {
+ DRM_GPU_SCHED_STAT_NONE, /* Reserve 0 */
+ DRM_GPU_SCHED_STAT_NOMINAL,
+ DRM_GPU_SCHED_STAT_ENODEV,
+};
+
/**
* struct drm_sched_backend_ops
*
@@ -230,10 +236,16 @@ struct drm_sched_backend_ops {
struct dma_fence *(*run_job)(struct drm_sched_job *sched_job);
/**
- * @timedout_job: Called when a job has taken too long to execute,
- * to trigger GPU recovery.
+ * @timedout_job: Called when a job has taken too long to execute,
+ * to trigger GPU recovery.
+ *
+ * Return DRM_GPU_SCHED_STAT_NOMINAL, when all is normal,
+ * and the underlying driver has started or completed recovery.
+ *
+ * Return DRM_GPU_SCHED_STAT_ENODEV, if the device is no longer
+ * available, i.e. has been unplugged.
*/
- void (*timedout_job)(struct drm_sched_job *sched_job);
+ enum drm_gpu_sched_stat (*timedout_job)(struct drm_sched_job *sched_job);
/**
* @free_job: Called once the job's finished fence has been signaled
--
2.25.1

View File

@@ -0,0 +1,245 @@
From 392503dcd868c38e7c660192bdcf48d3a837ba34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
Date: Tue, 2 Feb 2021 12:40:01 +0100
Subject: [PATCH 100/109] ODROID-BACKPORT: drm/scheduler: provide scheduler
score externally
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Allow multiple schedulers to share the load balancing score.
This is useful when one engine has different hw rings.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Leo Liu <leo.liu@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210204144405.2737-1-christian.koenig@amd.com
Change-Id: Ideed6849c5d73ec05bac9c769722bc4fd85e1c6f
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +-
drivers/gpu/drm/lima/lima_sched.c | 2 +-
drivers/gpu/drm/panfrost/panfrost_job.c | 2 +-
drivers/gpu/drm/scheduler/sched_entity.c | 2 +-
drivers/gpu/drm/scheduler/sched_main.c | 18 +++++++++---------
drivers/gpu/drm/v3d/v3d_sched.c | 10 +++++-----
include/drm/gpu_scheduler.h | 5 +++--
8 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index d56f4023ebb3..8e0a5650d383 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -487,7 +487,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
num_hw_submission, amdgpu_job_hang_limit,
- timeout, ring->name);
+ timeout, NULL, ring->name);
if (r) {
DRM_ERROR("Failed to create scheduler on ring %s.\n",
ring->name);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index 2a9439cbb0fb..19826e504efc 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -190,7 +190,7 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
ret = drm_sched_init(&gpu->sched, &etnaviv_sched_ops,
etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
- msecs_to_jiffies(500), dev_name(gpu->dev));
+ msecs_to_jiffies(500), NULL, dev_name(gpu->dev));
if (ret)
return ret;
diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c
index 20dafa62980f..ecf3267334ff 100644
--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -509,7 +509,7 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name)
return drm_sched_init(&pipe->base, &lima_sched_ops, 1,
lima_job_hang_limit, msecs_to_jiffies(timeout),
- name);
+ NULL, name);
}
void lima_sched_pipe_fini(struct lima_sched_pipe *pipe)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 0a83eefa49c4..6003cfeb1322 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -627,7 +627,7 @@ int panfrost_job_init(struct panfrost_device *pfdev)
ret = drm_sched_init(&js->queue[j].sched,
&panfrost_sched_ops,
1, 0, msecs_to_jiffies(JOB_TIMEOUT_MS),
- "pan_js");
+ NULL, "pan_js");
if (ret) {
dev_err(pfdev->dev, "Failed to create scheduler: %d.", ret);
goto err_sched;
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index c1ac3e4003c6..92d965b629c6 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -489,7 +489,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,
bool first;
trace_drm_sched_job(sched_job, entity);
- atomic_inc(&entity->rq->sched->score);
+ atomic_inc(entity->rq->sched->score);
WRITE_ONCE(entity->last_user, current->group_leader);
first = spsc_queue_push(&entity->job_queue, &sched_job->queue_node);
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 73fccc54268b..d82a7ebf6099 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -91,7 +91,7 @@ void drm_sched_rq_add_entity(struct drm_sched_rq *rq,
if (!list_empty(&entity->list))
return;
spin_lock(&rq->lock);
- atomic_inc(&rq->sched->score);
+ atomic_inc(rq->sched->score);
list_add_tail(&entity->list, &rq->entities);
spin_unlock(&rq->lock);
}
@@ -110,7 +110,7 @@ void drm_sched_rq_remove_entity(struct drm_sched_rq *rq,
if (list_empty(&entity->list))
return;
spin_lock(&rq->lock);
- atomic_dec(&rq->sched->score);
+ atomic_dec(rq->sched->score);
list_del_init(&entity->list);
if (rq->current_entity == entity)
rq->current_entity = NULL;
@@ -173,7 +173,7 @@ static void drm_sched_job_done(struct drm_sched_job *s_job)
struct drm_gpu_scheduler *sched = s_fence->sched;
atomic_dec(&sched->hw_rq_count);
- atomic_dec(&sched->score);
+ atomic_dec(sched->score);
trace_drm_sched_process_job(s_fence);
@@ -732,7 +732,7 @@ drm_sched_pick_best(struct drm_gpu_scheduler **sched_list,
continue;
}
- num_score = atomic_read(&sched->score);
+ num_score = atomic_read(sched->score);
if (num_score < min_score) {
min_score = num_score;
picked_sched = sched;
@@ -842,16 +842,15 @@ static int drm_sched_main(void *param)
* @hw_submission: number of hw submissions that can be in flight
* @hang_limit: number of times to allow a job to hang before dropping it
* @timeout: timeout value in jiffies for the scheduler
+ * @score: optional score atomic shared with other schedulers
* @name: name used for debugging
*
* Return 0 on success, otherwise error code.
*/
int drm_sched_init(struct drm_gpu_scheduler *sched,
const struct drm_sched_backend_ops *ops,
- unsigned hw_submission,
- unsigned hang_limit,
- long timeout,
- const char *name)
+ unsigned hw_submission, unsigned hang_limit, long timeout,
+ atomic_t *score, const char *name)
{
int i, ret;
sched->ops = ops;
@@ -859,6 +858,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
sched->name = name;
sched->timeout = timeout;
sched->hang_limit = hang_limit;
+ sched->score = score ? score : &sched->_score;
for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_COUNT; i++)
drm_sched_rq_init(sched, &sched->sched_rq[i]);
@@ -868,7 +868,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
spin_lock_init(&sched->job_list_lock);
atomic_set(&sched->hw_rq_count, 0);
INIT_DELAYED_WORK(&sched->work_tdr, drm_sched_job_timedout);
- atomic_set(&sched->score, 0);
+ atomic_set(&sched->_score, 0);
atomic64_set(&sched->job_id_count, 0);
/* Each scheduler will run on a seperate kernel thread */
diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index ef2338a294ca..2cab9b1ee38b 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -403,7 +403,7 @@ v3d_sched_init(struct v3d_dev *v3d)
&v3d_bin_sched_ops,
hw_jobs_limit, job_hang_limit,
msecs_to_jiffies(hang_limit_ms),
- "v3d_bin");
+ NULL, "v3d_bin");
if (ret) {
dev_err(v3d->drm.dev, "Failed to create bin scheduler: %d.", ret);
return ret;
@@ -413,7 +413,7 @@ v3d_sched_init(struct v3d_dev *v3d)
&v3d_render_sched_ops,
hw_jobs_limit, job_hang_limit,
msecs_to_jiffies(hang_limit_ms),
- "v3d_render");
+ NULL, "v3d_render");
if (ret) {
dev_err(v3d->drm.dev, "Failed to create render scheduler: %d.",
ret);
@@ -425,7 +425,7 @@ v3d_sched_init(struct v3d_dev *v3d)
&v3d_tfu_sched_ops,
hw_jobs_limit, job_hang_limit,
msecs_to_jiffies(hang_limit_ms),
- "v3d_tfu");
+ NULL, "v3d_tfu");
if (ret) {
dev_err(v3d->drm.dev, "Failed to create TFU scheduler: %d.",
ret);
@@ -438,7 +438,7 @@ v3d_sched_init(struct v3d_dev *v3d)
&v3d_csd_sched_ops,
hw_jobs_limit, job_hang_limit,
msecs_to_jiffies(hang_limit_ms),
- "v3d_csd");
+ NULL, "v3d_csd");
if (ret) {
dev_err(v3d->drm.dev, "Failed to create CSD scheduler: %d.",
ret);
@@ -450,7 +450,7 @@ v3d_sched_init(struct v3d_dev *v3d)
&v3d_cache_clean_sched_ops,
hw_jobs_limit, job_hang_limit,
msecs_to_jiffies(hang_limit_ms),
- "v3d_cache_clean");
+ NULL, "v3d_cache_clean");
if (ret) {
dev_err(v3d->drm.dev, "Failed to create CACHE_CLEAN scheduler: %d.",
ret);
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index ce6a383ed99f..1c815e0a14ed 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -297,7 +297,8 @@ struct drm_gpu_scheduler {
struct list_head pending_list;
spinlock_t job_list_lock;
int hang_limit;
- atomic_t score;
+ atomic_t *score;
+ atomic_t _score;
bool ready;
bool free_guilty;
};
@@ -305,7 +306,7 @@ struct drm_gpu_scheduler {
int drm_sched_init(struct drm_gpu_scheduler *sched,
const struct drm_sched_backend_ops *ops,
uint32_t hw_submission, unsigned hang_limit, long timeout,
- const char *name);
+ atomic_t *score, const char *name);
void drm_sched_fini(struct drm_gpu_scheduler *sched);
int drm_sched_job_init(struct drm_sched_job *job,
--
2.25.1

View File

@@ -0,0 +1,89 @@
From 03749575413c63730642fe0ce2f2c1a525a2c9a1 Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Fri, 5 Feb 2021 12:17:57 +0100
Subject: [PATCH 103/109] ODROID-BACKPORT: drm/panfrost: Stay in the threaded
MMU IRQ handler until we've handled all IRQs
Doing a hw-irq -> threaded-irq round-trip is counter-productive, stay
in the threaded irq handler as long as we can.
v2:
* Rework the loop to avoid a goto
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210205111757.585248-4-boris.brezillon@collabora.com
Change-Id: I0d61c9bb3f301434a61ecd0eb30a87174ac375d2
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 26 +++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 21e552d1ac71..0581186ebfb3 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -578,22 +578,20 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
{
struct panfrost_device *pfdev = data;
u32 status = mmu_read(pfdev, MMU_INT_RAWSTAT);
- int i, ret;
+ int ret;
- for (i = 0; status; i++) {
- u32 mask = BIT(i) | BIT(i + 16);
+ while (status) {
+ u32 as = ffs(status | (status >> 16)) - 1;
+ u32 mask = BIT(as) | BIT(as + 16);
u64 addr;
u32 fault_status;
u32 exception_type;
u32 access_type;
u32 source_id;
- if (!(status & mask))
- continue;
-
- fault_status = mmu_read(pfdev, AS_FAULTSTATUS(i));
- addr = mmu_read(pfdev, AS_FAULTADDRESS_LO(i));
- addr |= (u64)mmu_read(pfdev, AS_FAULTADDRESS_HI(i)) << 32;
+ fault_status = mmu_read(pfdev, AS_FAULTSTATUS(as));
+ addr = mmu_read(pfdev, AS_FAULTADDRESS_LO(as));
+ addr |= (u64)mmu_read(pfdev, AS_FAULTADDRESS_HI(as)) << 32;
/* decode the fault status */
exception_type = fault_status & 0xFF;
@@ -604,8 +602,8 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
/* Page fault only */
ret = -1;
- if ((status & mask) == BIT(i) && (exception_type & 0xF8) == 0xC0)
- ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
+ if ((status & mask) == BIT(as) && (exception_type & 0xF8) == 0xC0)
+ ret = panfrost_mmu_map_fault_addr(pfdev, as, addr);
if (ret)
/* terminal fault, print info about the fault */
@@ -617,7 +615,7 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
"exception type 0x%X: %s\n"
"access type 0x%X: %s\n"
"source id 0x%X\n",
- i, addr,
+ as, addr,
"TODO",
fault_status,
(fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"),
@@ -626,6 +624,10 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
source_id);
status &= ~mask;
+
+ /* If we received new MMU interrupts, process them before returning. */
+ if (!status)
+ status = mmu_read(pfdev, MMU_INT_RAWSTAT);
}
mmu_write(pfdev, MMU_INT_MASK, ~0);
--
2.25.1

View File

@@ -0,0 +1,69 @@
From 5a086823d16444ffb76e145897e21091433398dd Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Thu, 13 May 2021 11:56:08 +0900
Subject: [PATCH 104/109] Revert "ODROID-C4: arm64/dts: Move gpio-line-names
into the periphs_pinctrl node"
This reverts commit 862c12d3903a2e82b3be7ae07cbadf32876d60de.
---
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 44 -------------------
1 file changed, 44 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 5735664734fc..337c3a3a30b1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -105,50 +105,6 @@ opp-1908000000 {
};
};
-&periphs_pinctrl {
- gpio-line-names =
- /* GPIOZ */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- /* GPIOH */
- "", "", "", "", "",
- "PIN_36", /* GPIOH_5 */
- "PIN_26", /* GPIOH_6 */
- "PIN_32", /* GPIOH_7 */
- "",
- /* BOOT */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- /* GPIOC */
- "", "", "", "", "", "", "", "",
- /* GPIOA */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "",
- "PIN_27", /* GPIOA_14 */
- "PIN_28", /* GPIOA_15 */
- /* GPIOX */
- "PIN_16", /* GPIOX_0 */
- "PIN_18", /* GPIOX_1 */
- "PIN_22", /* GPIOX_2 */
- "PIN_11", /* GPIOX_3 */
- "PIN_13", /* GPIOX_4 */
- "PIN_7", /* GPIOX_5 */
- "PIN_33", /* GPIOX_6 */
- "PIN_15", /* GPIOX_7 */
- "PIN_19", /* GPIOX_8 */
- "PIN_21", /* GPIOX_9 */
- "PIN_24", /* GPIOX_10 */
- "PIN_23", /* GPIOX_11 */
- "PIN_8", /* GPIOX_12 */
- "PIN_10", /* GPIOX_13 */
- "PIN_29", /* GPIOX_14 */
- "PIN_31", /* GPIOX_15 */
- "PIN_12", /* GPIOX_16 */
- "PIN_3", /* GPIOX_17 */
- "PIN_5", /* GPIOX_18 */
- "PIN_35"; /* GPIOX_19 */
-};
-
&gpio {
/*
* WARNING: The USB Hub on the Odroid-C4 needs a reset signal
--
2.25.1

Some files were not shown because too many files have changed in this diff Show More