From 0f08496435e2d5c622f643da12c876b0847ed60a Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Wed, 8 Apr 2020 13:07:29 +0900 Subject: [PATCH 01/10] Revert "ODROID-COMMON: media/hdmitx: add "now" to attr to trigger set_disp_mode_auto()" This reverts commit 2e65f010b521bae8c5f72996613f9e5bc5eee104. Change-Id: I71054b56d1a2ae3590d496afcbb1ba4847881181 (cherry picked from commit 8f53e1c6e87206910b6334084b44335174abf2f7) --- .../vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 72cbcbd8bd0c..f2b0eb748b9f 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -465,9 +465,6 @@ static int set_disp_mode_auto(void) /* vic_ready got from IP */ enum hdmi_vic vic_ready = hdev->hwop.getstate( hdev, STAT_VIDEO_VIC, 0); -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - char *now = strstr(hdmitx_device.fmt_attr, "now"); -#endif memset(mode, 0, sizeof(mode)); hdev->ready = 0; @@ -555,12 +552,6 @@ static int set_disp_mode_auto(void) else { /* nothing */ } - -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - if (!now) - vic_ready = vic; -#endif - if ((vic_ready != HDMI_Unknown) && (vic_ready == vic)) { pr_info(SYS "[%s] ALREADY init VIC = %d\n", __func__, vic); @@ -598,11 +589,6 @@ static int set_disp_mode_auto(void) hdmitx_pre_display_init(); -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - if (now) - memset(now, ' ', 3); -#endif - hdev->cur_VIC = HDMI_Unknown; /* if vic is HDMI_Unknown, hdmitx_set_display will disable HDMI */ ret = hdmitx_set_display(hdev, vic); @@ -683,12 +669,6 @@ ssize_t store_attr(struct device *dev, hdmitx_device.para->cs = COLORSPACE_YUV420; else hdmitx_device.para->cs = COLORSPACE_YUV444; - -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - if (strstr(hdmitx_device.fmt_attr, "now")) - set_disp_mode_auto(); -#endif - return count; } /*aud_mode attr*/ From b75394739a870813a49c15a5660297a154249bab Mon Sep 17 00:00:00 2001 From: Deokgyu Yang Date: Tue, 7 Apr 2020 16:31:02 +0900 Subject: [PATCH 02/10] ODROID-COMMON: scripts: Add dtco target for better handling DT overlay Signed-off-by: Deokgyu Yang Change-Id: I67277f745dc292b53fead0e476969344dcb0d427 (cherry picked from commit 8335f10cb98e43f03ab56e5ef756abee85d4cb02) --- scripts/Makefile.lib | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ebb28f9918b9..ed87eaade2f5 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -325,7 +325,18 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ $(obj)/%.dtb: $(src)/%.dts FORCE $(call if_changed_dep,dtc) -ifeq ($(CONFIG_AMLOGIC_MODIFY),y) +ifeq ($(CONFIG_ARCH_MESON64_ODROID_COMMON),y) +quiet_cmd_dtco = DTCO $@ +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ + $(DTC) -@ -H epapr -O dtb -o $@ -b 0 -@ \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +$(obj)/%.dtbo: $(src)/%.dts FORCE + $(call if_changed_dep,dtco) +else ifeq ($(CONFIG_AMLOGIC_MODIFY),y) $(obj)/%.dtbo: $(src)/%.dts FORCE $(call if_changed_dep,dtc) endif From 56633329f87d10c6af8c4ef909be6a8628f72870 Mon Sep 17 00:00:00 2001 From: ckkim Date: Mon, 6 Apr 2020 16:02:58 +0900 Subject: [PATCH 03/10] ODROID-C4:Add support pcm5242(HiFi-shield2) codec. Signed-off-by: ckkim Change-Id: I9477e212374f819fd8b7d1ae0f1255a1f6660239 --- Documentation/devicetree/bindings/sound/pcm512x.txt | 4 ++-- sound/soc/codecs/pcm512x-i2c.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/pcm512x.txt b/Documentation/devicetree/bindings/sound/pcm512x.txt index 3aae3b41bd8e..4a81e894fe66 100644 --- a/Documentation/devicetree/bindings/sound/pcm512x.txt +++ b/Documentation/devicetree/bindings/sound/pcm512x.txt @@ -5,8 +5,8 @@ on the board). Required properties: - - compatible : One of "ti,pcm5121", "ti,pcm5122", "ti,pcm5141" or - "ti,pcm5142" + - compatible : One of "ti,pcm5121", "ti,pcm5122", "ti,pcm5141", + "ti,pcm5142" or "ti,pcm5242" - reg : the I2C address of the device for I2C, the chip select number for SPI. diff --git a/sound/soc/codecs/pcm512x-i2c.c b/sound/soc/codecs/pcm512x-i2c.c index dbff416e38be..19ae6fa760c4 100644 --- a/sound/soc/codecs/pcm512x-i2c.c +++ b/sound/soc/codecs/pcm512x-i2c.c @@ -48,6 +48,7 @@ static const struct i2c_device_id pcm512x_i2c_id[] = { { "pcm5122", }, { "pcm5141", }, { "pcm5142", }, + { "pcm5242", }, { } }; MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id); @@ -57,6 +58,7 @@ static const struct of_device_id pcm512x_of_match[] = { { .compatible = "ti,pcm5122", }, { .compatible = "ti,pcm5141", }, { .compatible = "ti,pcm5142", }, + { .compatible = "ti,pcm5242", }, { } }; MODULE_DEVICE_TABLE(of, pcm512x_of_match); From be8dae9c1a45e7a20e6217957971b8c5b0946bb1 Mon Sep 17 00:00:00 2001 From: ckkim Date: Mon, 6 Apr 2020 16:06:37 +0900 Subject: [PATCH 04/10] ODROID-C4:arm64/dts:Support I2S sound card.(HiFi-shield series) Signed-off-by: ckkim Change-Id: I0831e040831c1990796c63ff1ab92e333154d0db --- .../boot/dts/amlogic/meson64_odroidc4.dts | 68 ++++++++++++++++--- arch/arm64/configs/odroidg12_defconfig | 4 +- sound/soc/amlogic/auge/Kconfig | 1 + 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts index aeddd7e85490..fd342272d0bd 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts @@ -616,11 +616,16 @@ }; /* Audio Related start */ - dummy_codec:dummy{ + spdif_dit:spdif_dit{ + compatible = "linux,spdif-dit"; #sound-dai-cells = <0>; - compatible = "amlogic, aml_dummy_codec"; status = "okay"; }; + pcm5102a: pcm5102a { + compatible = "ti,pcm5102a"; + #sound-dai-cells = <0>; + status = "disabled"; + }; amlogic_codec:t9015{ #sound-dai-cells = <0>; compatible = "amlogic, aml_codec_T9015"; @@ -628,7 +633,7 @@ is_auge_used = <1>; /* meson or auge chipset used */ tocodec_inout = <0>; tdmout_index = <2>; - status = "okay"; + status = "disabled"; }; audio_effect:eqdrc{ /*eq_enable = <1>;*/ @@ -646,9 +651,10 @@ /* max 0xff, each bit for one channel */ channel_mask = <0x3>; }; - auge_sound { + odroid_hdmi:odroid_hdmi { compatible = "amlogic, g12a-sound-card"; - aml-audio-card,name = "AML-AUGESOUND"; + aml-audio-card,name = "ODROID-HDMI"; + status = "okay"; /* ODROID-C4: spdif_out GPIOAO_10(J7.2), HDMI out*/ aml-audio-card,dai-link@0 { @@ -659,12 +665,17 @@ system-clock-frequency = <6144000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&spdif_dit>; }; }; + }; + odroid_hifi:odroid_hifi { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI"; + status = "disabled"; /* ODROID-C4: I2S out(J7)*/ - aml-audio-card,dai-link@1 { + aml-audio-card,dai-link@0 { format = "i2s"; mclk-fs = <256>; bitclock-master = <&tdmb>; @@ -678,7 +689,31 @@ system-clock-frequency = <12288000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&pcm5102a>; + }; + }; + }; + odroid_hifi2:odroid_hifi2 { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI2"; + status = "disabled"; + + /* ODROID-C4: I2S out(J7)*/ + aml-audio-card,dai-link@0 { + format = "i2s"; + mclk-fs = <256>; + bitclock-master = <&tdmb>; + frame-master = <&tdmb>; + continuous-clock; + cpu { + sound-dai = <&tdmb>; + dai-tdm-slot-tx-mask = <1 1>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + system-clock-frequency = <12288000>; + }; + codec { + sound-dai = <&pcm5242>; }; }; }; @@ -779,8 +814,8 @@ compatible = "amlogic, sm1-snd-tdmb"; #sound-dai-cells = <0>; dai-tdm-lane-slot-mask-out = <1 0 0 0>; - dai-tdm-clk-sel = <0>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_A + dai-tdm-clk-sel = <1>; + clocks = <&clkaudio CLKID_AUDIO_MCLK_B &clkc CLKID_MPLL0>; clock-names = "mclk", "clk_srcpll"; pinctrl-names = "tdm_pins"; @@ -993,6 +1028,19 @@ compatible = "nxp,pcf8563"; reg = <0x51>; }; + + pcm5242: pcm5242@4c { + compatible = "ti,pcm5242"; + reg = <0x4c>; + #sound-dai-cells = <0>; + status = "disabled"; + + /* + AVDD-supply = <®_3v3_analog>; + DVDD-supply = <®_1v8>; + CPVDD-supply = <®_3v3>; + */ + }; }; &i2c3 { diff --git a/arch/arm64/configs/odroidg12_defconfig b/arch/arm64/configs/odroidg12_defconfig index 5839bd37c466..cf4167b480dd 100644 --- a/arch/arm64/configs/odroidg12_defconfig +++ b/arch/arm64/configs/odroidg12_defconfig @@ -4522,7 +4522,9 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_PCM179X_SPI is not set # CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM3168A_SPI is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set +CONFIG_SND_SOC_PCM5102A=y +CONFIG_SND_SOC_PCM512x=y +CONFIG_SND_SOC_PCM512x_I2C=y # CONFIG_SND_SOC_PCM512x_SPI is not set # CONFIG_SND_SOC_RT5616 is not set # CONFIG_SND_SOC_RT5631 is not set diff --git a/sound/soc/amlogic/auge/Kconfig b/sound/soc/amlogic/auge/Kconfig index eafeb0d45de5..99a320c1a537 100644 --- a/sound/soc/amlogic/auge/Kconfig +++ b/sound/soc/amlogic/auge/Kconfig @@ -1,5 +1,6 @@ menuconfig AMLOGIC_SND_SOC_AUGE bool "Amlogic Auge ASoC" + select SND_SOC_PCM5102A default n help Say Y or M if you want to add support for codecs attached to From 0a41720a5096ae4dd8c210bd5cccf69c1dcf5db8 Mon Sep 17 00:00:00 2001 From: Hyeonki Hong Date: Fri, 3 Apr 2020 11:50:13 +0900 Subject: [PATCH 05/10] ODROID-C4: arm64/dts: set spicc0 and i2c2 to enalbe by default Change-Id: I08225fdb27743bd8195d50967b61867bf67ef937 --- arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts index fd342272d0bd..b61a0d52c682 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts @@ -935,7 +935,7 @@ }; /* end of pinctrl_aobus */ &spicc0 { - status = "disabled"; + status = "okay"; /* 40 Pin Header : MOSI(GPIOX.8->19 Pin), MISO(GPIOX.9->21 Pin), @@ -959,7 +959,7 @@ }; spidev@0 { - status = "disabled"; + status = "okay"; compatible = "linux,spidev"; /* spi default max clock 100Mhz */ @@ -1021,8 +1021,6 @@ }; &i2c2 { - status = "disabled"; - pcf8563: rtc@51 { status = "disabled"; compatible = "nxp,pcf8563"; From b45d58f988300d105b1219bd52aa3cff191b6abf Mon Sep 17 00:00:00 2001 From: Hyeonki Hong Date: Thu, 2 Apr 2020 18:46:17 +0900 Subject: [PATCH 06/10] ODROID-COMMON: arm64/dts: modify i2c alias bus number Change-Id: I57a7d4b1ed78f86fbb7e4512fcabe9c008d89063 (cherry picked from commit 5125046c2b3f071ffcb3d9cd541e6e934a23cde5) --- arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index e9300731406e..10b85f8762f5 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -23,9 +23,9 @@ serial3 = &uart_C; serial4 = &uart_AO_B; i2c0 = &i2c0; - i2c1 = &i2c1; - i2c2 = &i2c2; - i2c3 = &i2c3; + i2c1 = &i2c2; + i2c2 = &i2c3; + i2c3 = &i2c1; i2c4 = &i2c_AO; tsensor0 = &p_tsensor; tsensor1 = &d_tsensor; From 42125fee380f68ccf7cf0f9a70ff046625b9847f Mon Sep 17 00:00:00 2001 From: ckkim Date: Mon, 13 Apr 2020 14:10:47 +0900 Subject: [PATCH 07/10] ODROID-COMMON:Added uSD card reset in poweroff function. Signed-off-by: ckkim Change-Id: I081293a937ff264f627db80c528295f0f886869e --- drivers/amlogic/reboot/reboot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/amlogic/reboot/reboot.c b/drivers/amlogic/reboot/reboot.c index 92b04caeb55e..d4761438938f 100644 --- a/drivers/amlogic/reboot/reboot.c +++ b/drivers/amlogic/reboot/reboot.c @@ -202,6 +202,12 @@ static void do_aml_restart(enum reboot_mode reboot_mode, const char *cmd) static void do_aml_poweroff(void) { +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + if (!board_is_odroidn2()) + odroidc4_card_reset(); + else + odroidn2_card_reset(); +#endif /* TODO: Add poweroff capability */ __invoke_psci_fn_smc(0x82000042, 1, 0, 0); __invoke_psci_fn_smc(psci_function_id_poweroff, From 2550d19d5670aa43d131acdd866e3d868c86d725 Mon Sep 17 00:00:00 2001 From: Hyeonki Hong Date: Fri, 17 Apr 2020 17:49:02 +0900 Subject: [PATCH 08/10] ODROID-C4: arm64/dts: add gpio-line-names Change-Id: Iee8660174a6dbaa35db3d7f32e84bf22a459c7d1 (cherry picked from commit 3eea1ff5b658da710d0e9d944de542d7d01f55c6) --- .../boot/dts/amlogic/meson64_odroidc4.dts | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts index b61a0d52c682..3ceefeb0da23 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts @@ -846,6 +846,69 @@ }; }; /* end of audiobus */ +&gpio { + gpio-line-names = + /* GPIOV */ + "", + /* 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_ao { + gpio-line-names = + /* GPIOAO */ + "", "", "", "", + "PIN_47", /* GPIOAO_4 */ + "", "", + "PIN_45", /* GPIOAO_7 */ + "PIN_46", /* GPIOAO_8 */ + "PIN_44", /* GPIOAO_9 */ + "PIN_42", /* GPIOAO_10 */ + "", + /* GPIOE */ + "", "", "", + /* GPIO_TEST_N */ + ""; +}; + &uart_A { status = "okay"; }; From 4c251af783d7c994ff02d49f6fa874e29dcc4bff Mon Sep 17 00:00:00 2001 From: Hyeonki Hong Date: Fri, 17 Apr 2020 16:14:51 +0900 Subject: [PATCH 09/10] ODROID-COMMON: arm64/dts: modify i2c alias bus number Change-Id: I94d1bc2f56bac1af6c7b45ab1b9bf8cbf50407c1 (cherry picked from commit 842d3137e635a69984da21192333e6c147ec4e8d) --- arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index 10b85f8762f5..2542bc88391f 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -22,9 +22,9 @@ serial2 = &uart_B; serial3 = &uart_C; serial4 = &uart_AO_B; - i2c0 = &i2c0; - i2c1 = &i2c2; - i2c2 = &i2c3; + i2c0 = &i2c2; + i2c1 = &i2c3; + i2c2 = &i2c0; i2c3 = &i2c1; i2c4 = &i2c_AO; tsensor0 = &p_tsensor; From 1d673b54faf8faae3e902e61ad87690276196fb2 Mon Sep 17 00:00:00 2001 From: Hyeonki Hong Date: Fri, 3 Apr 2020 18:26:53 +0900 Subject: [PATCH 10/10] ODROID-COMMON: arm64/dts: set uart_a cts/rts to disable Change-Id: I545a2c9e239af1eb2ccaa3f163f8f752b3d33f11 (cherry picked from commit 5a7fddf46c5709e7c05e77c189a902dec2364d1e) --- arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index 2542bc88391f..9f74a12816f7 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -173,6 +173,14 @@ clock-frequency = <100000>; /* default 100k */ }; +&a_uart_pins { + mux { + groups = "uart_tx_a", + "uart_rx_a"; + function = "uart_a"; + }; +}; + &usb2_phy_v2 { status = "okay"; portnum = <2>;