From 18b24717be9639b65b86db3dbcf2b42fe73ca12c Mon Sep 17 00:00:00 2001 From: tonymac32 Date: Sun, 2 Feb 2020 18:26:14 -0500 Subject: [PATCH] [ rockchip64 ] rk3328 and renegade sound and dts clean Adds k5.5 audio pipeline dts entries, adds audio to Renegade, cleans up some dts mess in renegade - Note: PulseAudio seems to need to toggle a couple times before audio will play. That is not addressed in this patch. --- .../add-RK3328-audio-path.patch | 66 +++++ .../rk3328-audio-and-renegade-supplies.patch | 268 ++++++++++++++++++ 2 files changed, 334 insertions(+) create mode 100644 patch/kernel/rockchip64-current/add-RK3328-audio-path.patch create mode 100644 patch/kernel/rockchip64-current/rk3328-audio-and-renegade-supplies.patch diff --git a/patch/kernel/rockchip64-current/add-RK3328-audio-path.patch b/patch/kernel/rockchip64-current/add-RK3328-audio-path.patch new file mode 100644 index 000000000..4ca657720 --- /dev/null +++ b/patch/kernel/rockchip64-current/add-RK3328-audio-path.patch @@ -0,0 +1,66 @@ +From 29e8976e604f15838a71959ab853a802617113f9 Mon Sep 17 00:00:00 2001 +From: Robin Murphy +Date: Mon, 14 Oct 2019 23:19:05 +0100 +Subject: [PATCH] arm64: dts: rockchip: Add RK3328 audio pipelines + +The audio pipelines for HDMI and the analog codec are internal to the +SoC, so it makes sense to describe them at that level such that boards +need only enable the respective nodes for outputs they implement. + +Signed-off-by: Robin Murphy +Link: https://lore.kernel.org/r/a09c8d795e7a66fb7bc47af2b6580f6e8dbec91e.1571090991.git.robin.murphy@arm.com +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 32 ++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 31cc1541f1f59..91306ebed4da2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -142,6 +142,22 @@ + }; + }; + ++ analog_sound: analog-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "Analog"; ++ status = "disabled"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ + arm-pmu { + compatible = "arm,cortex-a53-pmu"; + interrupts = , +@@ -156,6 +172,22 @@ + ports = <&vop_out>; + }; + ++ hdmi_sound: hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <128>; ++ simple-audio-card,name = "HDMI"; ++ status = "disabled"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s0>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ + psci { + compatible = "arm,psci-1.0", "arm,psci-0.2"; + method = "smc"; diff --git a/patch/kernel/rockchip64-current/rk3328-audio-and-renegade-supplies.patch b/patch/kernel/rockchip64-current/rk3328-audio-and-renegade-supplies.patch new file mode 100644 index 000000000..b5806e079 --- /dev/null +++ b/patch/kernel/rockchip64-current/rk3328-audio-and-renegade-supplies.patch @@ -0,0 +1,268 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index f4b6799a8..a1041ec3e 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -21,32 +21,24 @@ + #clock-cells = <0>; + }; + +- dc_12v: dc-12v { +- compatible = "regulator-fixed"; +- regulator-name = "dc_12v"; +- regulator-always-on; +- regulator-boot-on; +- regulator-min-microvolt = <12000000>; +- regulator-max-microvolt = <12000000>; +- }; +- + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; +- gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0m1_gpio>; ++ regulator-boot-on; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + +- vcc_sdio: sdmmcio-regulator { ++ vccio_sd: sdmmcio-regulator { + compatible = "regulator-gpio"; + gpios = <&grf_gpio 0 GPIO_ACTIVE_HIGH>; + states = <1800000 0x1 + 3300000 0x0>; +- regulator-name = "vcc_sdio"; ++ regulator-name = "vccio_sd"; + regulator-type = "voltage"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; +@@ -68,11 +60,8 @@ + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; +- vin-supply = <&dc_12v>; + }; + + vcc_phy: vcc-phy-regulator { +@@ -82,6 +71,13 @@ + regulator-boot-on; + }; + ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -103,6 +99,15 @@ + }; + }; + ++&analog_sound { ++ simple-audio-card,name = "TRS Jack"; ++ status = "okay"; ++}; ++ ++&codec { ++ status = "okay"; ++}; ++ + &cpu0 { + cpu-supply = <&vdd_arm>; + }; +@@ -122,7 +127,6 @@ + &emmc { + bus-width = <8>; + cap-mmc-highspeed; +- max-frequency = <150000000>; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; +@@ -152,6 +156,10 @@ + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_logic>; ++}; ++ + &hdmi { + status = "okay"; + }; +@@ -160,6 +168,10 @@ + status = "okay"; + }; + ++&hdmi_sound { ++ status = "okay"; ++}; ++ + &i2c1 { + status = "okay"; + +@@ -187,8 +199,9 @@ + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; +- regulator-min-microvolt = <712500>; +- regulator-max-microvolt = <1450000>; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <1150000>; ++ regulator-ramp-delay = <12500>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { +@@ -199,8 +212,9 @@ + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; +- regulator-min-microvolt = <712500>; +- regulator-max-microvolt = <1450000>; ++ regulator-min-microvolt = <950000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <12500>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { +@@ -269,12 +283,20 @@ + }; + }; + ++&i2s0 { ++ status = "okay"; ++}; ++ ++&i2s1 { ++ status = "okay"; ++}; ++ + &io_domains { + status = "okay"; + + vccio1-supply = <&vcc_io>; + vccio2-supply = <&vcc18_emmc>; +- vccio3-supply = <&vcc_sdio>; ++ vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io>; + vccio6-supply = <&vcc_io>; +@@ -282,6 +304,12 @@ + }; + + &pinctrl { ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; +@@ -308,11 +336,26 @@ + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; +- vqmmc-supply = <&vcc_sdio>; ++ vqmmc-supply = <&vccio_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ pinctrl-0 = <&spdifm0_tx>; ++ status = "okay"; ++}; ++ ++&spdif_out { ++ status = "okay"; ++}; ++ ++&spdif_sound { + status = "okay"; + }; + + &tsadc { ++ rockchip,hw-tshut-mode = <0>; ++ rockchip,hw-tshut-polarity = <0>; + status = "okay"; + }; + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index eedc25132..5c62f0116 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -198,6 +198,26 @@ + method = "smc"; + }; + ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spdif_sound: spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ status = "disabled"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ + timer { + compatible = "arm,armv8-timer"; + interrupts = , +@@ -319,6 +339,12 @@ + }; + }; + ++ ++ pd_gpu@RK3328_PD_GPU { ++ reg = ; ++ clocks = <&cru ACLK_GPU>; ++ }; ++ + reboot-mode { + compatible = "syscon-reboot-mode"; + offset = <0x5c8>; +@@ -609,6 +635,7 @@ + "ppmmu1"; + clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; + clock-names = "bus", "core"; ++ power-domains = <&power RK3328_PD_GPU>; + resets = <&cru SRST_GPU_A>; + }; + +@@ -781,6 +808,7 @@ + <&cru ACLK_BUS_PRE>, <&cru HCLK_BUS_PRE>, + <&cru PCLK_BUS_PRE>, <&cru ACLK_PERI_PRE>, + <&cru HCLK_PERI>, <&cru PCLK_PERI>, ++ <&cru ACLK_GPU>, + <&cru SCLK_RTC32K>; + assigned-clock-parents = + <&cru HDMIPHY>, <&cru PLL_APLL>, +@@ -802,6 +830,7 @@ + <150000000>, <75000000>, + <75000000>, <150000000>, + <75000000>, <75000000>, ++ <500000000>, + <32768>; + }; +